1
0
Fork 0

Avoid creating new remote and beamer instances in onCreate()

Esse commit está contido em:
Maurizio Porrato 2019-02-17 12:29:35 +00:00
commit 661ef08e58
1 arquivos alterados com 10 adições e 7 exclusões

Ver arquivo

@ -44,14 +44,17 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
remote = new RoboVac11sRemote();
if (remote == null)
remote = new RoboVac11sRemote();
beamer = new AndroidIRBeamer(this);
if (!beamer.isAvailable()) {
Toast.makeText(this.getApplicationContext(),
"No IR beamer found: entering debug mode",
Toast.LENGTH_LONG).show();
beamer = new DebugIRBeamer(this);
if (beamer == null) {
beamer = new AndroidIRBeamer(this);
if (!beamer.isAvailable()) {
Toast.makeText(this.getApplicationContext(),
"No IR beamer found: entering debug mode",
Toast.LENGTH_LONG).show();
beamer = new DebugIRBeamer(this);
}
}
findViewById(R.id.schedule).setEnabled(