Example #1
0
  @SuppressLint("RtlHardcoded")
  @Override
  protected void onResume() {
    super.onResume();
    Log.e("isFirstLaunch", ":" + mPreferences.getBoolean(Constants.isFirstLaunch));
    if (Constants.isOpenDrawer) {
      Constants.setOpenDrawer(false);
      mDrawerLayout.openDrawer(Gravity.LEFT);
      if (!mPreferences.getBoolean(Constants.isFirstLaunch))
        mPreferences.addOrUpdateBoolean(Constants.isFirstLaunch, true);
      Util.setFragmentActionBarTitle(
          HomeActivityCanada.this, getResources().getString(R.string.navigation_menu_my_checks));
    }

    /*	if(!isIntialLaunch){
    	mDrawerLayout.openDrawer(Gravity.LEFT);
    	isIntialLaunch = true;
    	MMUtil.setFragmentActionBarTitle(HomeActivity.this, "");
    }*/
  }
Example #2
0
  /** Diplaying fragment view for selected nav drawer list item */
  public void displayView(int position) {
    /*if (!Util.isNetworkAvailable(this) && position != 4) {
    	showAlertDialog(getResources().getText(R.string.error_network).toString(), this);//("Network not available.", this);
    }
    else
    {*/
    if (Util.isNetworkAvailable(this) || position == 4) {
      FragmentManager fragmentMgr = getFragmentManager();
      android.app.FragmentTransaction ft = fragmentMgr.beginTransaction();

      // update the main content by replacing fragments
      switch (position) {
        case Constants.MENU_LOAN_FRAGMENT:
          loanFragment();
          ft.replace(R.id.frame_container, fragment);
          setSelectedDrawerItem(mTrApply, mTvApply);
          setDrawerTitle(getResources().getString(R.string.navigation_apply));
          break;
        case Constants.MENU_CARD_DETAILS_FRAGMENT:
          System.out.println("In card Details Fragment");
          cardDetailFragment();
          ft.replace(R.id.frame_container, fragment);
          setSelectedDrawerItem(mTrCardServices, mTvCardServices);
          setDrawerTitle(getResources().getString(R.string.navigation_menu_card_services));
          break;
        case Constants.MENU_LEARN_MORE_FRAGMENTS:
          System.out.println("In Learn More Fragment");
          learnMoreFragment();
          ft.replace(R.id.frame_container, fragment);
          setSelectedDrawerItem(mTrLearnMore, mTvLearnMore);
          setDrawerTitle(getResources().getString(R.string.navigation_learn_more));
          break;
        case Constants.MENU_PERSONAL_DETAILS_FRAGMENT:
          personalDetailFragment();
          ft.replace(R.id.frame_container, fragment);
          setSelectedDrawerItem(mTrPersonalDetails, mTvPersonalDetails);
          setDrawerTitle(getResources().getString(R.string.navigation_menu_personal_details));
          break;
        case Constants.MENU_ACCOUNT_DETAILS_FRAGMENT:
          accountDetailFragment();
          ft.replace(R.id.frame_container, fragment);
          setSelectedDrawerItem(mTrAccountDetails, mTvAccountDetails);
          setDrawerTitle(getResources().getString(R.string.navigation_menu_account_details));
          break;
        case Constants.MENU_CONTACT_US_FRAGMENT:
          contactUsFragment();
          ft.replace(R.id.frame_container, fragment);
          setSelectedDrawerItem(mTrContactUs, mTvContactUs);
          setTitle(getResources().getString(R.string.navigation_menu_contact_us));
          break;
        case Constants.MENU_STORE_LOCATOR_FRAGMENT:
          storeLocatorFragment();
          ft.replace(R.id.frame_container, fragment);
          setSelectedDrawerItem(mTrStoreLocator, mTvStoreLocator);
          setDrawerTitle(getResources().getString(R.string.navigation_menu_store_locator));
          break;
        case Constants.MENU_FAQ_FRAGMENT:
          faqFragment();
          ft.replace(R.id.frame_container, fragment);
          setSelectedDrawerItem(mTrFAQ, mTvFAQ);
          setDrawerTitle(getResources().getString(R.string.navigation_menu_faq));
          break;

        default:
          break;
      }

      if (fragment != null) {
        ft.addToBackStack(null);
        ft.commit();
        setTitle(navMenuTitles[position]);
        mDrawerLayout.closeDrawers();
      }
    } else {
      showAlertDialog(getResources().getText(R.string.error_network).toString(), this);
    }
  }