void handleMessage(Message msg) { switch (MsgType.values()[msg.what]) { case TIMER: if (progress == null) timerTick(); if (gameWantsTimer) { handler.sendMessageDelayed(handler.obtainMessage(MsgType.TIMER.ordinal()), timerInterval); } break; case DONE: if (resizeOnDone) { resizeEvent(gameView.w, gameView.h); resizeOnDone = false; } // set ActionBar icon to the one for this puzzle if (msg.obj != null && actionBarCompat != null) { int iconId = getResources().getIdentifier((String) msg.obj, "drawable", getPackageName()); homeAsUpNoticeable = actionBarCompat.setIconAsShortcut(iconId > 0 ? iconId : R.drawable.icon); if (menu != null) menu.findItem(R.id.other).setVisible(!homeAsUpNoticeable); } dismissProgress(); if (menu != null) onPrepareOptionsMenu(menu); save(); break; case ABORT: stopNative(); dismissProgress(); startChooser(); if (msg.obj != null) { messageBox(getString(R.string.Error), (String) msg.obj, 2, false); } else { finish(); } break; } }