Esempio n. 1
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. 2
0
  @Override
  public void onCheckedChanged(RadioGroup group, int checkedId) {

    switch (checkedId) {
      case R.id.main_rb:
        {
          if (mMainFramgent == null) {
            mMainFramgent = HomeFragment.newInstance(null, null);
          }
          changeFrag(mMainFramgent, mCurFragment);

          break;
        }
      case R.id.find_rb:
        {
          if (mFindFrament == null) {
            mFindFrament = FindFragment.newInstance(null, null);
          }
          changeFrag(mFindFrament, mCurFragment);
          break;
        }
      case R.id.publish_rb:
        {
          if (mPublishFragment == null) {
            mPublishFragment = PublishFragment.newInstance(null, null);
            mPublishFragment.setCallback(this);
          }
          changeFrag(mPublishFragment, mCurFragment);
          break;
        }
      case R.id.center_rb:
        {
          if (mCenterFragment == null) {
            mCenterFragment = CenterFragment.newInstance(null, null);
          }

          changeFrag(mCenterFragment, mCurFragment);

          break;
        }
      default:
        {
          break;
        }
    }
  }
Esempio n. 3
0
  private void initialize() {

    mainrb = (RadioButton) findViewById(R.id.main_rb);
    findrb = (RadioButton) findViewById(R.id.find_rb);
    publishrb = (RadioButton) findViewById(R.id.publish_rb);
    centerrb = (RadioButton) findViewById(R.id.center_rb);
    mainrg = (RadioGroup) findViewById(R.id.main_rg);
    maincontentfl = (FrameLayout) findViewById(R.id.main_content_fl);

    mainrg.setOnCheckedChangeListener(this);
    // 启动程序是默认加载第一个tab.
    mMainFramgent = HomeFragment.newInstance(null, null);
    mFM = getSupportFragmentManager();
    FragmentTransaction ft = mFM.beginTransaction();
    ft.add(R.id.main_content_fl, mMainFramgent, "main");
    ft.commitAllowingStateLoss();
    mCurFragment = mMainFramgent; // 记录当前frag。
  }