@Override public void onResume() { super.onResume(); CatLog.d(LOGTAG, "onResume, sim id: " + mMenuInstance.mSimId); int res = mMenuInstance.handleResume(mTitleIconView, mTitleTextView, this, mProgressView); switch (res) { case StkMenuInstance.FINISH_CAUSE_FLIGHT_MODE: mMenuInstance.showTextToast( getApplicationContext(), getString(R.string.lable_on_flight_mode)); finish(); break; case StkMenuInstance.FINISH_CAUSE_NULL_MENU: mMenuInstance.showTextToast( getApplicationContext(), getString(R.string.main_menu_not_initialized)); finish(); break; case StkMenuInstance.FINISH_CAUSE_NULL_SERVICE: finish(); break; case StkMenuInstance.FINISH_CAUSE_NOT_AVAILABLE: finish(); break; } }
@Override public boolean onOptionsItemSelected(MenuItem item) { boolean result = mMenuInstance.handleOptionItemSelected(item, mProgressView); CatLog.d(LOGTAG, "onOptionsItemSelected, result: " + result); if (result) return result; else return super.onOptionsItemSelected(item); }
@Override public void onCreate(Bundle icicle) { super.onCreate(icicle); CatLog.d(LOGTAG, "onCreate+"); // Remove the default title, customized one is used. requestWindowFeature(Window.FEATURE_NO_TITLE); // Set the layout for this activity. setContentView(R.layout.stk_menu_list); mTitleTextView = (TextView) findViewById(R.id.title_text); mTitleIconView = (ImageView) findViewById(R.id.title_icon); mProgressView = (ProgressBar) findViewById(R.id.progress_bar); getListView().setOnCreateContextMenuListener(mOnCreateContextMenuListener); if (!mMenuInstance.handleOnCreate(getBaseContext(), getIntent(), true)) { CatLog.d(LOGTAG, "finish!"); finish(); } /* // Change content background color to support theme mananger. if (FeatureOption.MTK_THEMEMANAGER_APP) { View contentView = this.findViewById(android.R.id.content); contentView.setThemeContentBgColor(Color.TRANSPARENT); } */ registerReceiver(mSIMStateChangeReceiver, mSIMStateChangeFilter); CatLog.d(LOGTAG, "onCreate-"); }
@Override public boolean onContextItemSelected(MenuItem item) { final AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo(); switch (item.getItemId()) { case StkApp.MENU_ID_HELP: mMenuInstance.cancelTimeOut(); mMenuInstance.mAcceptUsersInput = false; Item stkItem = mMenuInstance.getSelectedItem(info.position); if (stkItem == null) { break; } // send help needed response. mMenuInstance.sendResponse(StkAppService.RES_ID_MENU_SELECTION, stkItem.id, true); return true; default: break; } return super.onContextItemSelected(item); }
@Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); CatLog.d(LOGTAG, "onNewIntent"); if (!mMenuInstance.handleNewIntent(intent, true)) { CatLog.d(LOGTAG, "finish!"); finish(); } }
@Override protected void onRestoreInstanceState(Bundle savedInstanceState) { mMenuInstance.mState = savedInstanceState.getInt("STATE"); mMenuInstance.mStkMenu = savedInstanceState.getParcelable("MENU"); }
@Override public boolean onPrepareOptionsMenu(android.view.Menu menu) { super.onPrepareOptionsMenu(menu); return mMenuInstance.handlePrepareOptionMenu(menu); }
@Override public void onPause() { super.onPause(); CatLog.d(LOGTAG, "onPause, sim id: " + mMenuInstance.mSimId); mMenuInstance.handlePause(); }
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { boolean result = mMenuInstance.handleKeyDown(keyCode, event); if (result) return result; else return super.onKeyDown(keyCode, event); }
@Override protected void onListItemClick(ListView l, View v, int position, long id) { super.onListItemClick(l, v, position, id); mMenuInstance.handleListItemClick(position, mProgressView); }