List of usage examples for com.google.api.client.googleapis.extensions.android.gms.auth GoogleAccountCredential usingOAuth2
public static GoogleAccountCredential usingOAuth2(Context context, Collection<String> scopes)
From source file:amhamogus.com.daysoff.fragments.AddEventFragment.java
License:Open Source License
@Override public void onCreate(Bundle savedInstanceState) { if (getArguments() != null) { currentDate = new Date(); currentDate.setTime(getArguments().getLong(ARG_CURRENT_DATE)); }// w w w.jav a 2 s . c o m super.onCreate(savedInstanceState); setHasOptionsMenu(true); checkedActivities = new String[3]; mEvent = new Event(); SharedPreferences preferences = getActivity().getSharedPreferences(PREF_FILE, Context.MODE_PRIVATE); currentAccountName = preferences.getString(PREF_ACCOUNT_NAME, null); calendarId = "Calendar Name: " + preferences.getString(PREF_CALENDAR_NAME, null); mCredential = GoogleAccountCredential .usingOAuth2(getActivity().getApplicationContext(), Arrays.asList(SCOPES)) .setSelectedAccountName(currentAccountName).setBackOff(new ExponentialBackOff()); }
From source file:amhamogus.com.daysoff.fragments.CalendarFragment.java
License:Open Source License
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); eventsReturnedCollection = new EventCollection(); SharedPreferences preferences = getActivity().getSharedPreferences(PREF_FILE, Context.MODE_PRIVATE); currentAccountName = preferences.getString(PREF_ACCOUNT_NAME, null); calendarName = preferences.getString(PREF_CALENDAR_NAME, "primary"); calendarId = preferences.getString(PREF_CALENDAR_ID, "primary"); mCredential = GoogleAccountCredential .usingOAuth2(getActivity().getApplicationContext(), Arrays.asList(SCOPES)) .setSelectedAccountName(currentAccountName).setBackOff(new ExponentialBackOff()); }
From source file:amhamogus.com.daysoff.fragments.CalendarSharedWithFragment.java
License:Open Source License
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null) { accountName = getArguments().getString(ARG_ACCNT_NAME); }/*from w w w . j av a 2 s . c om*/ mCredential = GoogleAccountCredential .usingOAuth2(getActivity().getApplicationContext(), Arrays.asList(SCOPES)) .setSelectedAccountName(accountName).setBackOff(new ExponentialBackOff()); }
From source file:amhamogus.com.daysoff.fragments.MainListFragment.java
License:Open Source License
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); SharedPreferences pref = getActivity().getSharedPreferences(PREF_FILE, Context.MODE_PRIVATE); String name = pref.getString(PREF_ACCOUNT_NAME, null); mCredential = GoogleAccountCredential .usingOAuth2(getActivity().getApplicationContext(), Arrays.asList(SCOPES)) .setSelectedAccountName(name).setBackOff(new ExponentialBackOff()); }
From source file:amhamogus.com.daysoff.MainActivity.java
License:Open Source License
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); fragmentManager = getSupportFragmentManager(); mList = (MainListFragment) fragmentManager.findFragmentByTag("list"); if (mList == null) { mList = mList.newInstance(1);// w w w . ja v a 2s .c o m fragmentManager.beginTransaction().add(R.id.list_wrapper, mList, "list").commit(); } settings = getSharedPreferences(PREF_FILE, Context.MODE_PRIVATE); mCredential = GoogleAccountCredential.usingOAuth2(getApplicationContext(), Arrays.asList(SCOPES)) .setBackOff(new ExponentialBackOff()); if (!settings.contains(PREF_ACCOUNT_NAME)) { getCalendarList(); } }
From source file:br.com.bioscada.apps.biotracks.io.sendtogoogle.SendToGoogleUtils.java
License:Apache License
/** * Gets the google account credential./* w w w . j ava 2 s . c om*/ * * @param context the context * @param accountName the account name * @param scope the scope */ public static GoogleAccountCredential getGoogleAccountCredential(Context context, String accountName, String scope) throws IOException, GoogleAuthException { GoogleAccountCredential credential = GoogleAccountCredential.usingOAuth2(context, scope); credential.setSelectedAccountName(accountName); credential.getToken(); return credential; }
From source file:br.com.bioscada.apps.biotracks.io.sendtogoogle.SendToGoogleUtils.java
License:Apache License
/** * Gets the OAuth2 token./* ww w .j ava 2 s . com*/ * * @param context the context * @param accountName the account name * @param scope the scope */ public static String getToken(Context context, String accountName, String scope) throws IOException, GoogleAuthException { GoogleAccountCredential credential = GoogleAccountCredential.usingOAuth2(context, scope); credential.setSelectedAccountName(accountName); return credential.getToken(); }
From source file:com.afrozaar.jazzfestreporting.MainActivity.java
License:Apache License
@Override protected void onCreate(Bundle savedInstanceState) { getWindow().requestFeature(Window.FEATURE_INDETERMINATE_PROGRESS); super.onCreate(savedInstanceState); // Check to see if the proper keys and playlist IDs have been set up if (!isCorrectlyConfigured()) { setContentView(R.layout.developer_setup_required); showMissingConfigurations();// w w w. j av a 2 s . c o m } else { setContentView(R.layout.activity_main); ensureFetcher(); credential = GoogleAccountCredential.usingOAuth2(getApplicationContext(), Arrays.asList(Auth.SCOPES)); // set exponential backoff policy credential.setBackOff(new ExponentialBackOff()); if (savedInstanceState != null) { mChosenAccountName = savedInstanceState.getString(ACCOUNT_KEY); } else { loadAccount(); } //mTokenTask = new GetTokenTask(); //mTokenTask.execute(); credential.setSelectedAccountName(mChosenAccountName); mUploadsListFragment = UploadsListFragment.newInstance(mChosenAccountName); getFragmentManager().beginTransaction() .replace(R.id.list_fragment, mUploadsListFragment, "UploadFragment").commit(); Toast.makeText(this, "Account Name: " + mChosenAccountName, Toast.LENGTH_LONG).show(); } }
From source file:com.afrozaar.jazzfestreporting.UploadService.java
License:Apache License
@Override protected void onHandleIntent(Intent intent) { Uri fileUri = intent.getData();/*from ww w. j a v a 2 s.co m*/ String chosenAccountName = intent.getStringExtra(MainActivity.ACCOUNT_KEY); credential = GoogleAccountCredential.usingOAuth2(getApplicationContext(), Lists.newArrayList(Auth.SCOPES)); credential.setSelectedAccountName(chosenAccountName); credential.setBackOff(new ExponentialBackOff()); String appName = getResources().getString(R.string.app_name); final YouTube youtube = new YouTube.Builder(transport, jsonFactory, credential).setApplicationName(appName) .build(); try { tryUploadAndShowSelectableNotification(fileUri, youtube); } catch (InterruptedException e) { // ignore } }
From source file:com.amaze.filemanager.activities.MainActivity.java
License:Open Source License
/** * Called when the activity is first created. *///from w w w. ja va 2 s .co m @Override public void onCreate(Bundle savedInstanceState) { try { super.onCreate(savedInstanceState); } catch (Exception e) { e.printStackTrace(); } Sp = PreferenceManager.getDefaultSharedPreferences(this); int th = Integer.parseInt(Sp.getString("theme", "0")); theme1 = th == 2 ? PreferenceUtils.hourOfDay() : th; fabskin = PreferenceUtils.getFabColor(Sp.getInt("fab_skin_color_position", 1)); // setting accent theme if (Build.VERSION.SDK_INT >= 21) { switch (fabskin) { case "#F44336": if (theme1 == 0) setTheme(R.style.pref_accent_light_red); else setTheme(R.style.pref_accent_dark_red); break; case "#e91e63": if (theme1 == 0) setTheme(R.style.pref_accent_light_pink); else setTheme(R.style.pref_accent_dark_pink); break; case "#9c27b0": if (theme1 == 0) setTheme(R.style.pref_accent_light_purple); else setTheme(R.style.pref_accent_dark_purple); break; case "#673ab7": if (theme1 == 0) setTheme(R.style.pref_accent_light_deep_purple); else setTheme(R.style.pref_accent_dark_deep_purple); break; case "#3f51b5": if (theme1 == 0) setTheme(R.style.pref_accent_light_indigo); else setTheme(R.style.pref_accent_dark_indigo); break; case "#2196F3": if (theme1 == 0) setTheme(R.style.pref_accent_light_blue); else setTheme(R.style.pref_accent_dark_blue); break; case "#03A9F4": if (theme1 == 0) setTheme(R.style.pref_accent_light_light_blue); else setTheme(R.style.pref_accent_dark_light_blue); break; case "#00BCD4": if (theme1 == 0) setTheme(R.style.pref_accent_light_cyan); else setTheme(R.style.pref_accent_dark_cyan); break; case "#009688": if (theme1 == 0) setTheme(R.style.pref_accent_light_teal); else setTheme(R.style.pref_accent_dark_teal); break; case "#4CAF50": if (theme1 == 0) setTheme(R.style.pref_accent_light_green); else setTheme(R.style.pref_accent_dark_green); break; case "#8bc34a": if (theme1 == 0) setTheme(R.style.pref_accent_light_light_green); else setTheme(R.style.pref_accent_dark_light_green); break; case "#FFC107": if (theme1 == 0) setTheme(R.style.pref_accent_light_amber); else setTheme(R.style.pref_accent_dark_amber); break; case "#FF9800": if (theme1 == 0) setTheme(R.style.pref_accent_light_orange); else setTheme(R.style.pref_accent_dark_orange); break; case "#FF5722": if (theme1 == 0) setTheme(R.style.pref_accent_light_deep_orange); else setTheme(R.style.pref_accent_dark_deep_orange); break; case "#795548": if (theme1 == 0) setTheme(R.style.pref_accent_light_brown); else setTheme(R.style.pref_accent_dark_brown); break; case "#212121": if (theme1 == 0) setTheme(R.style.pref_accent_light_black); else setTheme(R.style.pref_accent_dark_black); break; case "#607d8b": if (theme1 == 0) setTheme(R.style.pref_accent_light_blue_grey); else setTheme(R.style.pref_accent_dark_blue_grey); break; case "#004d40": if (theme1 == 0) setTheme(R.style.pref_accent_light_super_su); else setTheme(R.style.pref_accent_dark_super_su); break; } } else { if (theme1 == 1) { setTheme(R.style.appCompatDark); } else { setTheme(R.style.appCompatLight); } } setContentView(R.layout.main_toolbar); tabHandler = new TabHandler(this, null, null, 1); buttonBarFrame = (FrameLayout) findViewById(R.id.buttonbarframe); int fabSkinPressed = PreferenceUtils.getStatusColor(fabskin); boolean random = Sp.getBoolean("random_checkbox", false); if (random) skin = PreferenceUtils.random(Sp); else skin = PreferenceUtils.getSkinColor(Sp.getInt("skin_color_position", 4)); hidemode = Sp.getInt("hidemode", 0); showHidden = Sp.getBoolean("showHidden", false); topfab = hidemode == 0 ? Sp.getBoolean("topFab", false) : false; floatingActionButton = !topfab ? (FloatingActionMenu) findViewById(R.id.menu) : (FloatingActionMenu) findViewById(R.id.menu_top); floatingActionButton.setVisibility(View.VISIBLE); floatingActionButton.showMenuButton(true); floatingActionButton.setMenuButtonColorNormal(Color.parseColor(fabskin)); floatingActionButton.setMenuButtonColorPressed(fabSkinPressed); //if (theme1 == 1) floatingActionButton.setMen floatingActionButton.setOnMenuToggleListener(new FloatingActionMenu.OnMenuToggleListener() { @Override public void onMenuToggle(boolean b) { View v = findViewById(R.id.fab_bg); if (b) revealShow(v, true); else revealShow(v, false); } }); View v = findViewById(R.id.fab_bg); if (theme1 == 1) v.setBackgroundColor(Color.parseColor("#a6ffffff")); v.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { floatingActionButton.close(true); revealShow(view, false); } }); drawerHeaderLayout = getLayoutInflater().inflate(R.layout.drawerheader, null); drawerHeaderParent = (RelativeLayout) drawerHeaderLayout.findViewById(R.id.drawer_header_parent); drawerHeaderView = (View) drawerHeaderLayout.findViewById(R.id.drawer_header); drawerProfilePic = (RoundedImageView) drawerHeaderLayout.findViewById(R.id.profile_pic); mGoogleName = (TextView) drawerHeaderLayout.findViewById(R.id.account_header_drawer_name); mGoogleId = (TextView) drawerHeaderLayout.findViewById(R.id.account_header_drawer_email); history = new HistoryManager(this, "Table1", "Table2"); hidden = new HistoryManager(this, "Table2", "Table2"); grid = new HistoryManager(this, "grid", "listgridmodes"); listManager = new HistoryManager(this, "list", "listgridmodes"); hiddenfiles = hidden.readTable(); gridfiles = grid.readTable(); listfiles = listManager.readTable(); // initialize g+ api client as per preferences if (Sp.getBoolean("plus_pic", false)) { mGoogleApiClient = new GoogleApiClient.Builder(this).addConnectionCallbacks(this) .addOnConnectionFailedListener(this).addApi(Plus.API) .addScope(Plus.SCOPE_PLUS_LOGIN).build(); } displayImageOptions = new DisplayImageOptions.Builder().showImageOnLoading(R.drawable.amaze_header) .showImageForEmptyUri(R.drawable.amaze_header).showImageOnFail(R.drawable.amaze_header) .cacheInMemory(true).cacheOnDisk(true).considerExifParams(true).bitmapConfig(Bitmap.Config.RGB_565) .build(); if (!ImageLoader.getInstance().isInited()) { ImageLoader.getInstance().init(ImageLoaderConfiguration.createDefault(this)); } utils = new Futils(); s = new Shortcuts(this, "shortcut.xml"); servers = new Shortcuts(this, "servers.xml"); account = new Shortcuts(this, "accounts.xml"); path = getIntent().getStringExtra("path"); openprocesses = getIntent().getBooleanExtra("openprocesses", false); restart = getIntent().getBooleanExtra("restart", false); rootmode = Sp.getBoolean("rootmode", false); theme = Integer.parseInt(Sp.getString("theme", "0")); util = new IconUtils(Sp, this); icons = new IconUtils(Sp, this); mCredential = GoogleAccountCredential.usingOAuth2(getApplicationContext(), Arrays.asList(SCOPES)) .setBackOff(new ExponentialBackOff()).setSelectedAccountName(null); pathbar = (LinearLayout) findViewById(R.id.pathbar); buttons = (LinearLayout) findViewById(R.id.buttons); scroll = (HorizontalScrollView) findViewById(R.id.scroll); scroll1 = (HorizontalScrollView) findViewById(R.id.scroll1); scroll.setSmoothScrollingEnabled(true); scroll1.setSmoothScrollingEnabled(true); FloatingActionButton floatingActionButton1 = (FloatingActionButton) findViewById( topfab ? R.id.menu_item_top : R.id.menu_item); String folder_skin = PreferenceUtils.getSkinColor(Sp.getInt("icon_skin_color_position", 4)); int folderskin = Color.parseColor(folder_skin); int fabskinpressed = (PreferenceUtils.getStatusColor(folder_skin)); floatingActionButton1.setColorNormal(folderskin); floatingActionButton1.setColorPressed(fabskinpressed); floatingActionButton1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { add(0); revealShow(findViewById(R.id.fab_bg), false); floatingActionButton.close(true); } }); FloatingActionButton floatingActionButton2 = (FloatingActionButton) findViewById( topfab ? R.id.menu_item1_top : R.id.menu_item1); floatingActionButton2.setColorNormal(folderskin); floatingActionButton2.setColorPressed(fabskinpressed); floatingActionButton2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { add(1); revealShow(findViewById(R.id.fab_bg), false); floatingActionButton.close(true); } }); FloatingActionButton floatingActionButton3 = (FloatingActionButton) findViewById( topfab ? R.id.menu_item2_top : R.id.menu_item2); floatingActionButton3.setColorNormal(folderskin); floatingActionButton3.setColorPressed(fabskinpressed); floatingActionButton3.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { add(2); revealShow(findViewById(R.id.fab_bg), false); floatingActionButton.close(true); } }); FloatingActionButton floatingActionButton4 = (FloatingActionButton) findViewById( topfab ? R.id.menu_item3_top : R.id.menu_item3); floatingActionButton4.setColorNormal(folderskin); floatingActionButton4.setColorPressed(fabskinpressed); floatingActionButton4.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { add(3); revealShow(findViewById(R.id.fab_bg), false); floatingActionButton.close(true); } }); if (topfab) { buttonBarFrame.getViewTreeObserver() .addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() { FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) floatingActionButton .getLayoutParams(); layoutParams.setMargins(layoutParams.leftMargin, findViewById(R.id.lin).getBottom() - (floatingActionButton.getMenuIconView().getHeight()), layoutParams.rightMargin, layoutParams.bottomMargin); floatingActionButton.setLayoutParams(layoutParams); if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN) { buttonBarFrame.getViewTreeObserver().removeOnGlobalLayoutListener(this); } else { buttonBarFrame.getViewTreeObserver().removeGlobalOnLayoutListener(this); } } }); } // Toolbar toolbar = (Toolbar) findViewById(R.id.action_bar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayShowTitleEnabled(false); aBoolean = Sp.getBoolean("view", true); //ImageView overflow = ((ImageView)findViewById(R.id.action_overflow)); //showPopup(overflow); tabsSpinner = (Spinner) findViewById(R.id.tab_spinner); //title = (TextView) findViewById(R.id.title); frameLayout = (FrameLayout) findViewById(R.id.content_frame); timer = new CountDownTimer(5000, 1000) { @Override public void onTick(long l) { } @Override public void onFinish() { crossfadeInverse(); } }; try { intent = getIntent(); if (intent.getAction().equals(Intent.ACTION_GET_CONTENT)) { // file picker intent mReturnIntent = true; Toast.makeText(this, utils.getString(con, R.string.pick_a_file), Toast.LENGTH_LONG).show(); } else if (intent.getAction().equals(RingtoneManager.ACTION_RINGTONE_PICKER)) { // ringtone picker intent mReturnIntent = true; mRingtonePickerIntent = true; System.out.println(intent.getData()); Toast.makeText(this, utils.getString(con, R.string.pick_a_file), Toast.LENGTH_LONG).show(); } else if (intent.getAction().equals(Intent.ACTION_VIEW)) { // zip viewer intent Uri uri = intent.getData(); openzip = true; zippath = uri.toString(); } } catch (Exception e) { } findViewById(R.id.buttonbarframe).setBackgroundColor(Color.parseColor(skin)); getSupportActionBar().setBackgroundDrawable(new ColorDrawable(Color.parseColor(skin))); skinStatusBar = (PreferenceUtils.getStatusColor(skin)); mDrawerLinear = (ScrimInsetsRelativeLayout) findViewById(R.id.left_drawer); if (theme1 == 1) mDrawerLinear.setBackgroundColor(Color.parseColor("#303030")); else mDrawerLinear.setBackgroundColor(Color.WHITE); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerLayout.setStatusBarBackgroundColor(Color.parseColor(skin)); mDrawerList = (ListView) findViewById(R.id.menu_drawer); if (((ViewGroup.MarginLayoutParams) findViewById(R.id.main_frame) .getLayoutParams()).leftMargin == (int) getResources().getDimension(R.dimen.drawer_width)) { mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_OPEN, mDrawerLinear); mDrawerLayout.setScrimColor(Color.TRANSPARENT); isDrawerLocked = true; } // status bar0 sdk = Build.VERSION.SDK_INT; if (sdk == 20 || sdk == 19) { SystemBarTintManager tintManager = new SystemBarTintManager(this); tintManager.setStatusBarTintEnabled(true); tintManager.setStatusBarTintColor(Color.parseColor(skin)); FrameLayout.MarginLayoutParams p = (ViewGroup.MarginLayoutParams) findViewById(R.id.drawer_layout) .getLayoutParams(); SystemBarTintManager.SystemBarConfig config = tintManager.getConfig(); if (!isDrawerLocked) p.setMargins(0, config.getStatusBarHeight(), 0, 0); } else if (Build.VERSION.SDK_INT >= 21) { colourednavigation = Sp.getBoolean("colorednavigation", true); Window window = getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); //window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); if (isDrawerLocked) { window.setStatusBarColor((skinStatusBar)); } else window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); if (colourednavigation) window.setNavigationBarColor(skinStatusBar); } View settingsbutton = findViewById(R.id.settingsbutton); if (theme1 == 1) { settingsbutton.setBackgroundResource(R.drawable.safr_ripple_black); ((ImageView) settingsbutton.findViewById(R.id.settingicon)) .setImageResource(R.drawable.ic_settings_white_48dp); ((TextView) settingsbutton.findViewById(R.id.settingtext)) .setTextColor(getResources().getColor(android.R.color.white)); } settingsbutton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent in = new Intent(MainActivity.this, Preferences.class); finish(); final int enter_anim = android.R.anim.fade_in; final int exit_anim = android.R.anim.fade_out; Activity s = MainActivity.this; s.overridePendingTransition(exit_anim, enter_anim); s.finish(); s.overridePendingTransition(enter_anim, exit_anim); s.startActivity(in); } }); View appbutton = findViewById(R.id.appbutton); if (theme1 == 1) { appbutton.setBackgroundResource(R.drawable.safr_ripple_black); ((ImageView) appbutton.findViewById(R.id.appicon)).setImageResource(R.drawable.ic_doc_apk_white); ((TextView) appbutton.findViewById(R.id.apptext)) .setTextColor(getResources().getColor(android.R.color.white)); } appbutton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { android.support.v4.app.FragmentTransaction transaction2 = getSupportFragmentManager() .beginTransaction(); transaction2.replace(R.id.content_frame, new AppsList()); findViewById(R.id.lin).animate().translationY(0).setInterpolator(new DecelerateInterpolator(2)) .start(); pending_fragmentTransaction = transaction2; if (!isDrawerLocked) mDrawerLayout.closeDrawer(mDrawerLinear); else onDrawerClosed(); select = list.size() + 1; adapter.toggleChecked(false); } }); ImageView divider = (ImageView) findViewById(R.id.divider1); if (theme1 == 0) divider.setImageResource(R.color.divider); else divider.setImageResource(R.color.divider_dark); mDrawerList.addHeaderView(drawerHeaderLayout); updateDrawer(); drawerHeaderView.setBackgroundResource(R.drawable.amaze_header); drawerHeaderParent.setBackgroundColor(Color.parseColor(skin)); if (savedInstanceState == null) { if (openprocesses) { android.support.v4.app.FragmentTransaction transaction = getSupportFragmentManager() .beginTransaction(); transaction.replace(R.id.content_frame, new ProcessViewer()); // transaction.addToBackStack(null); select = 102; openprocesses = false; //title.setText(utils.getString(con, R.string.process_viewer)); //Commit the transaction transaction.commit(); supportInvalidateOptionsMenu(); } else { goToMain(path); } } else { oppathe = savedInstanceState.getString("oppathe"); oppathe1 = savedInstanceState.getString("oppathe1"); ArrayList<String> k = savedInstanceState.getStringArrayList("oparrayList"); if (k != null) { oparrayList = (k); operation = savedInstanceState.getInt("operation"); } select = savedInstanceState.getInt("selectitem", 0); adapter.toggleChecked(select); } if (theme1 == 1) { mDrawerList.setBackgroundColor(getResources().getColor(R.color.holo_dark_background)); } mDrawerList.setDivider(null); if (select == 0) { //title.setVisibility(View.GONE); tabsSpinner.setVisibility(View.VISIBLE); } else { //title.setVisibility(View.VISIBLE); tabsSpinner.setVisibility(View.GONE); } if (!isDrawerLocked) { mDrawerToggle = new ActionBarDrawerToggle(this, /* host Activity */ mDrawerLayout, /* DrawerLayout object */ R.drawable.ic_drawer_l, /* nav drawer image to replace 'Up' caret */ R.string.drawer_open, /* "open drawer" description for accessibility */ R.string.drawer_close /* "close drawer" description for accessibility */ ) { public void onDrawerClosed(View view) { mainActivity.onDrawerClosed(); } public void onDrawerOpened(View drawerView) { //title.setText("Amaze File Manager"); // creates call to onPrepareOptionsMenu() } }; mDrawerLayout.setDrawerListener(mDrawerToggle); getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_drawer_l); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeButtonEnabled(true); mDrawerToggle.syncState(); } /*((ImageButton) findViewById(R.id.drawer_buttton)).setOnClickListener(new ImageView.OnClickListener() { @Override public void onClick(View view) { if (mDrawerLayout.isDrawerOpen(mDrawerLinear)) { mDrawerLayout.closeDrawer(mDrawerLinear); } else mDrawerLayout.openDrawer(mDrawerLinear); } });*/ if (mDrawerToggle != null) { mDrawerToggle.setDrawerIndicatorEnabled(true); mDrawerToggle.setHomeAsUpIndicator(R.drawable.ic_drawer_l); } //recents header color implementation if (Build.VERSION.SDK_INT >= 21) { ActivityManager.TaskDescription taskDescription = new ActivityManager.TaskDescription("Amaze", ((BitmapDrawable) getResources().getDrawable(R.mipmap.ic_launcher)).getBitmap(), Color.parseColor(skin)); ((Activity) this).setTaskDescription(taskDescription); } }