Stop hanging out in the background, this toast is important

This commit is contained in:
TwistedUmbrella 2014-01-26 04:45:48 -05:00
parent 4e8c96279f
commit 4307068022
1 changed files with 9 additions and 2 deletions

View File

@ -32,6 +32,8 @@ public class MOGAInput
static final int ACTION_VERSION_MOGAPRO = Controller.ACTION_VERSION_MOGAPRO;
Controller mController = null;
private Handler handler;
private String notify;
public boolean isActive[] = { false, false, false, false };
public boolean isMogaPro[] = { false, false, false, false };
@ -99,6 +101,8 @@ public class MOGAInput
{
this.act = act;
handler = new Handler();
mController = Controller.getInstance(act);
mController.init();
mController.setListener(new ExampleControllerListener(), new Handler());
@ -231,7 +235,6 @@ public class MOGAInput
if (event.getState() == StateEvent.STATE_CONNECTION && event.getAction() == ACTION_CONNECTED) {
int mControllerVersion = mController.getState(Controller.STATE_CURRENT_PRODUCT_VERSION);
String notify = null;
if (mControllerVersion == Controller.ACTION_VERSION_MOGAPRO) {
isActive[playerNum] = true;
isMogaPro[playerNum] = true;
@ -244,7 +247,11 @@ public class MOGAInput
notify = act.getApplicationContext().getString(R.string.moga_connect);
}
if (notify != null && !notify.equals(null)) {
Toast.makeText(act.getApplicationContext(), notify, Toast.LENGTH_SHORT).show();
handler.post(new Runnable() {
public void run() {
Toast.makeText(act.getApplicationContext(), notify, Toast.LENGTH_SHORT).show();
}
});
}
}
}