@Override public void onClick(final View view) { switch (view.getId()) { case R.id.btn_right: mDialog.dismiss(); break; case R.id.btn_left: mPreferences.delete(PreferenceConstants.AUTORIZATION_TOKEN); Constants.setAuthTOken(""); Constants.setCustServiceObj(null); Constants.setMyCheckServerData(null); Constants.setCCServiceObj(null); Moneymart.getInstance().myChecksList = new ArrayList<ChecksObject>(); Moneymart.getInstance().myCheckUploadQueue = new LinkedHashMap<String, MyChecksDataObject>(); Moneymart.getInstance().failedChecksList = new TreeMap<String, ChecksObject>(); Intent intent = new Intent(this, LoginActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); finish(); break; default: break; } }
@Override public void onCreate(final Bundle savedInstance) { super.onCreate(savedInstance); setContentView(R.layout.activity_home); // CheckCashingDetailsFragment otherFragment = new CheckCashingDetailsFragment(); // otherFragment.setCommunicator(this); initHomeUI(); mTitle = getTitle(); mPreferences = Preferences.getInstance(mContext); navMenuTitles = getResources().getStringArray(R.array.nav_drawer_items); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); // enabling action bar app icon and behaving it as toggle button getActionBar().setDisplayHomeAsUpEnabled(true); getActionBar().setHomeButtonEnabled(true); getActionBar().setTitle(R.string.navigation_menu_cash_a_check); getActionBar().setDisplayShowTitleEnabled(true); mDrawerToggle = new ActionBarDrawerToggle( this, mDrawerLayout, R.drawable.menu_btn_phn, // nav menu toggle icon R.string.app_name, // nav drawer open - description for accessibility R.string.app_name // nav drawer close - description for accessibility ) { public void onDrawerClosed(View view) { // getActionBar().setTitle(mTitle); // MMUtil.setFragmentActionBarTitle(HomeActivity.this, mTitle.toString()); // calling onPrepareOptionsMenu() to show action bar icons invalidateOptionsMenu(); } public void onDrawerOpened(View drawerView) { // getActionBar().setTitle(""); if (getDrawerTitle().isEmpty()) { Util.setFragmentActionBarTitle( HomeActivityCanada.this, getResources().getString(R.string.navigation_menu_cash_a_check)); } // else // { // MMUtil.setFragmentActionBarTitle(HomeActivity.this, getDrawerTitle()); // } // calling onPrepareOptionsMenu() to hide action bar icons invalidateOptionsMenu(); } }; mDrawerLayout.setDrawerListener(mDrawerToggle); if (savedInstance == null) { // on first time display view for first nav item setFocus(); } }
@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, ""); }*/ }