Esempio n. 1
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   LogCat.i("--->", "onCreate");
   setContentView(R.layout.activity_main);
   initialize();
 }
Esempio n. 2
0
 @Override
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   LogCat.i("--->", "requestCode:" + requestCode + " Result ok?:" + resultCode);
   super.onActivityResult(requestCode, resultCode, data);
   if (mPublishFragment != null && mPublishFragment.isMyRequest(requestCode)) {
     LogCat.i("--->", "mPublishFragment->onActivityResult");
     mPublishFragment.onActivityResult(requestCode, resultCode, data);
   } else if (requestCode == LoginDialog.REQUEST_CODE && resultCode == RESULT_OK) {
     if (mCenterFragment == null) {
       mCenterFragment = new CenterFragment();
     }
     changeFrag(mCenterFragment, mCurFragment);
     centerrb.setChecked(true);
   } else if (requestCode == BaseFragment.TO_SCAN) {
     if (!mMainFramgent.isHidden()) {
       mMainFramgent.onActivityResult(requestCode, resultCode, data);
     } else if (!mFindFrament.isHidden()) {
       mFindFrament.onActivityResult(requestCode, resultCode, data);
     }
   }
 }
Esempio n. 3
0
  /**
   * 隐藏显示相应的frag,并将设置当前的fragment。
   *
   * @param showFrag 将要显示的frag
   * @param hideFrag 要隐藏的frag。
   */
  private void changeFrag(Fragment showFrag, Fragment hideFrag) {
    if (showFrag == hideFrag) {
      LogCat.e(MainActivity.class.getName() + ":changeFrag:showFrag=hideFragment");
      return;
    }
    FragmentTransaction ft = mFM.beginTransaction();
    if (showFrag.isAdded()) {
      ft.show(showFrag);

    } else {
      ft.add(R.id.main_content_fl, showFrag, null);
    }
    if (hideFrag != null && hideFrag.isAdded()) {
      ft.hide(hideFrag);
    }
    ft.commitAllowingStateLoss();
    mCurFragment = showFrag;
  }
Esempio n. 4
0
 @Override
 protected void onRestart() {
   super.onRestart();
   LogCat.i("--->", "onRestart");
 }
Esempio n. 5
0
 @Override
 protected void onResume() {
   super.onResume();
   LogCat.i("--->", "onResume");
 }