@Override protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); // if the graph was not already restored if (!getTabHost().getCurrentTabTag().equals("tab_graphs")) { support.onCreate(savedInstanceState); } }
@Override protected Dialog onCreateDialog(int id) { if (id == DIALOG_DETAILS) { return dlgDetails; } else if (id == MainActivitySupport.DIALOG_FAILURE_MESSAGE) { return support.getDlgFailureMessage(); } return null; }
/** @param force loading stack to 0 */ public void hideLoading(boolean force) { if (force) loadingDlgStack = 1; if ((loadingDlgStack = Math.max(--loadingDlgStack, 0)) == 0) { support.hideLoading(); // possibly open details dlg if (showDialogDetails) { showDialogDetails = false; showDialog(DIALOG_DETAILS); } } }
@Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == R.id.menuitem_preferences) { Intent intent = new Intent(getApplicationContext(), AppPreferenceActivity.class); startActivityForResult(intent, 0); return true; } else if (item.getItemId() == R.id.menuitem_clear) { clearLocalDatabase(); return true; } else if (item.getItemId() == R.id.menuitem_buy_bonus) { support.menuItemBuyBonusSelected(); return true; } return false; }
@Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); support.onSaveInstanceState(outState); // if applicable, store the graph, so that after // a orientation change the graph could be restored if (getTabHost().getCurrentTabTag().equals("tab_graphs") && lastShowChart_itemid != null) { outState.putLong("lastShowChart_itemid", lastShowChart_itemid); outState.putString("lastShowChart_units", lastShowChart_units); outState.putString("lastShowChart_description", lastShowChart_description); outState.putString("lastShowChart_graphText", lastShowChart_graphText); outState.putString("prevTabTag", prevTabTag); } // also for screen tab if (getTabHost().getCurrentTabTag().equals("tab_screens") && lastShowScreen_screen__id != -1) { outState.putLong("lastShowScreen_screenid", lastShowScreen_screen__id); } }
@Override protected void onResume() { super.onResume(); support.onResume(); // workaround for a strange bug: if you go to second level in the HieraticalHostListView, // then open the Preferences-Activity and close it again, the 2 lists will show overlapped. HieraticalHostListView hlv = (HieraticalHostListView) findViewById(R.id.hosts_status); if (hlv != null) { hlv.setDisplayedChild(0); } hlv = (HieraticalHostListView) findViewById(R.id.hosts_checks); if (hlv != null) { hlv.setDisplayedChild(0); } ViewFlipper vf_screens = (ViewFlipper) findViewById(R.id.view_switcher_screens); if (vf_screens != null) { vf_screens.setDisplayedChild(0); } }
/** opens the loading-dlg and pushes the loading stack */ public void showLoading() { if (++loadingDlgStack > 0) { support.showLoading(); } }
@Override protected void onStop() { super.onStop(); support.onStop(); }
@Override public boolean onPrepareOptionsMenu(Menu menu) { boolean b = super.onPrepareOptionsMenu(menu); support.onPrepareOptionsMenu(menu); return b; }
@Override protected void onPause() { super.onPause(); support.onPause(); }