Пример #1
0
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);

    menu.add(Menu.NONE, MENU_REFRESH, Menu.NONE, R.string.refresh)
        .setIcon(R.drawable.ic_menu_refresh);

    menu.add(Menu.NONE, MENU_EXIT, Menu.NONE, R.string.preferences_exit_title);

    return true;
  }
Пример #2
0
  @Override
  public void onPause() {
    super.onPause();

    ((Jianjianroid) getApplication()).removeLocationUpdates();

    if (isFinishing()) {
      if (mListAdapter != null) {
        mListAdapter.removeObserver();
      }

      unregisterReceiver(mLoggedOutReceiver);
      mStateHolder.cancel();
    }
  }
Пример #3
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    registerReceiver(mLoggedOutReceiver, new IntentFilter(Jianjianroid.INTENT_ACTION_LOGGED_OUT));

    if (getLastNonConfigurationInstance() != null) {
      mStateHolder = (StateHolder) getLastNonConfigurationInstance();
      mStateHolder.setActivity(this);
    } else {
      mStateHolder = new StateHolder();
      mStateHolder.setSortMethod(SORT_METHOD_RECENT);
    }

    ensureUi();

    Jianjianroid mJianjianroid = (Jianjianroid) getApplication();
    if (mJianjianroid.isReady()) {
      if (!mStateHolder.getRanOnce()) {
        mStateHolder.startTask(this);
      }
    }
  }
Пример #4
0
  @Override
  public void onResume() {
    super.onResume();

    ((Jianjianroid) getApplication()).requestLocationUpdates(true);
  }