gt:             if (name.contains("TabFragment")) {
context: /*
   * Copyright (C) 2014 Arpit Khurana <arpitkh96@gmail.com>, Vishal Nehra <vishalmeham2@gmail.com>
   *
   * This file is part of Amaze File Manager.
   *
   * Amaze File Manager is free software: you can redistribute it and/or modify
   * it under the terms of the GNU General Public License as published by
   * the Free Software Foundation, either version 3 of the License, or
   * (at your option) any later version.
   *
   * This program is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   * GNU General Public License for more details.
   *
   * You should have received a copy of the GNU General Public License
   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
   */
  
  package com.amaze.filemanager.activities;
  
  import android.animation.Animator;
  import android.animation.AnimatorListenerAdapter;
  import android.animation.ObjectAnimator;
  import android.app.Activity;
  import android.app.ActivityManager;
  import android.content.BroadcastReceiver;
  import android.content.ContentResolver;
  import android.content.Context;
  import android.content.Intent;
  import android.content.IntentFilter;
  import android.content.IntentSender;
  import android.content.SharedPreferences;
  import android.content.res.Configuration;
  import android.content.res.Resources;
  import android.content.res.TypedArray;
  import android.graphics.Bitmap;
  import android.graphics.Color;
  import android.graphics.drawable.BitmapDrawable;
  import android.graphics.drawable.ColorDrawable;
  import android.graphics.drawable.Drawable;
  import android.media.RingtoneManager;
  import android.net.Uri;
  import android.os.AsyncTask;
  import android.os.Build;
  import android.os.Bundle;
  import android.os.CountDownTimer;
  import android.os.Environment;
  import android.os.Handler;
  import android.preference.PreferenceManager;
  import android.support.annotation.NonNull;
  import android.support.v4.app.ActionBarDrawerToggle;
  import android.support.v4.app.Fragment;
  import android.support.v4.app.FragmentTransaction;
  import android.support.v4.content.ContextCompat;
  import android.support.v4.widget.DrawerLayout;
  import android.support.v7.app.AppCompatActivity;
  import android.support.v7.widget.Toolbar;
  import android.text.TextUtils;
  import android.util.DisplayMetrics;
  import android.util.Log;
  import android.view.Gravity;
  import android.view.KeyEvent;
  import android.view.LayoutInflater;
  import android.view.Menu;
  import android.view.MenuInflater;
  import android.view.MenuItem;
  import android.view.View;
  import android.view.ViewGroup;
  import android.view.ViewTreeObserver;
  import android.view.Window;
  import android.view.WindowManager;
  import android.view.animation.Animation;
  import android.view.animation.AnimationUtils;
  import android.view.inputmethod.InputMethodManager;
  import android.widget.Button;
  import android.widget.CheckBox;
  import android.widget.EditText;
  import android.widget.FrameLayout;
  import android.widget.HorizontalScrollView;
  import android.widget.ImageButton;
  import android.widget.ImageView;
  import android.widget.LinearLayout;
  import android.widget.ListView;
  import android.widget.RelativeLayout;
  import android.widget.Spinner;
  import android.widget.TextView;
  import android.widget.Toast;
  
  import com.afollestad.materialdialogs.DialogAction;
  import com.afollestad.materialdialogs.MaterialDialog;
  import com.afollestad.materialdialogs.Theme;
  import com.amaze.filemanager.R;
  import com.amaze.filemanager.adapters.DrawerAdapter;
  import com.amaze.filemanager.database.TabHandler;
  import com.amaze.filemanager.fragments.AppsList;
  import com.amaze.filemanager.fragments.Main;
  import com.amaze.filemanager.fragments.ProcessViewer;
  import com.amaze.filemanager.fragments.TabFragment;
  import com.amaze.filemanager.fragments.ZipViewer;
  import com.amaze.filemanager.services.CopyService;
  import com.amaze.filemanager.services.DeleteTask;
  import com.amaze.filemanager.services.ExtractService;
  import com.amaze.filemanager.services.ZipTask;
  import com.amaze.filemanager.services.asynctasks.MoveFiles;
  import com.amaze.filemanager.services.asynctasks.SearchTask;
  import com.amaze.filemanager.ui.drawer.EntryItem;
  import com.amaze.filemanager.ui.drawer.Item;
  import com.amaze.filemanager.ui.drawer.SectionItem;
  import com.amaze.filemanager.utils.FileUtil;
  import com.amaze.filemanager.utils.Futils;
  import com.amaze.filemanager.ui.icons.IconUtils;
  import com.amaze.filemanager.utils.HFile;
  import com.amaze.filemanager.utils.PreferenceUtils;
  import com.amaze.filemanager.utils.RootHelper;
  import com.amaze.filemanager.ui.views.RoundedImageView;
  import com.amaze.filemanager.ui.views.ScrimInsetsRelativeLayout;
  import com.amaze.filemanager.utils.Shortcuts;
  import com.github.clans.fab.FloatingActionButton;
  import com.github.clans.fab.FloatingActionMenu;
  import com.readystatesoftware.systembartint.SystemBarTintManager;
  import com.stericson.RootTools.RootTools;
  
  import org.xml.sax.SAXException;
  
  import java.io.File;
  import java.io.IOException;
  import java.io.UnsupportedEncodingException;
  import java.net.MalformedURLException;
  import java.net.URL;
  import java.net.URLDecoder;
  import java.util.ArrayList;
  import java.util.Collections;
  import java.util.List;
  import java.util.regex.Pattern;
  
  import javax.xml.parsers.ParserConfigurationException;
  import javax.xml.transform.TransformerException;
  
  import jcifs.smb.SmbException;
  import jcifs.smb.SmbFile;
  
  
  public class MainActivity extends AppCompatActivity{
      public Integer select;
      Futils utils;
      private boolean backPressedToExitOnce = false;
      private Toast toast = null;
      public DrawerLayout mDrawerLayout;
      public ListView mDrawerList;
      SharedPreferences Sp;
      private ActionBarDrawerToggle mDrawerToggle;
      public List<String> val;
      ArrayList<String> books;
      public ArrayList<String> Servers;
      MainActivity mainActivity = this;
      DrawerAdapter adapter;
      IconUtils util;
      public ScrimInsetsRelativeLayout mDrawerLinear;
      Shortcuts s, servers;
      public String skin, path = "", launchPath;
      public int theme;
      public ArrayList<String> COPY_PATH = null, MOVE_PATH = null;
      Context con = this;
      public FrameLayout frameLayout;
      public boolean mReturnIntent = false;
      private Intent intent;
      private static final Pattern DIR_SEPARATOR = Pattern.compile("/");
      public ArrayList<Item> list;
      public int theme1;
      public boolean rootmode, aBoolean, openzip = false;
      String zippath;
      public Spinner tabsSpinner;
      public boolean mRingtonePickerIntent = false, restart = false, colourednavigation = false;
      public Toolbar toolbar;
      public int skinStatusBar;
      FragmentTransaction pending_fragmentTransaction;
      String pending_path;
      boolean openprocesses = false;
      public int storage_count = 0;
      private View drawerHeaderLayout;
      private View drawerHeaderView;
      private RoundedImageView drawerProfilePic;
      private int sdk;
      private TextView mGoogleName, mGoogleId;
      public String fabskin;
      private LinearLayout buttons;
      private HorizontalScrollView scroll, scroll1;
      private CountDownTimer timer;
      private IconUtils icons;
      private TabHandler tabHandler;
      int hidemode;
      public FloatingActionMenu floatingActionButton;
      public LinearLayout pathbar;
      public FrameLayout buttonBarFrame;
      private RelativeLayout drawerHeaderParent;
      int operation;
      ArrayList<String> oparrayList;
      String oppathe, oppathe1;
      // Check for user interaction for google+ api only once
      private boolean mGoogleApiKey = false;
      // string builder object variables for pathBar animations
      private StringBuilder newPathBuilder, oldPathBuilder;
  
      // counter manages the pathBar animations
      private int COUNTER=0;
  
      /* Request code used to invoke sign in user interactions. */
      private static final int RC_SIGN_IN = 0;
  
      /* A flag indicating that a PendingIntent is in progress and prevents
     * us from starting further intents.
     */
      private boolean mIntentInProgress, topfab = false, showHidden = false;
      public boolean isDrawerLocked = false;
      static final int DELETE = 0, COPY = 1, MOVE = 2, NEW_FOLDER = 3, RENAME = 4, NEW_FILE = 5, EXTRACT = 6, COMPRESS = 7;
  
      /**
       * Called when the activity is first created.
       */
      @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);
  
          utils = new Futils();
          s = new Shortcuts(this, "shortcut.xml");
          servers = new Shortcuts(this, "servers.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);
  
  
          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);
              }
          });
          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;
                  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.getPath();
              }
          } 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());
  
                  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);
          }
      }
  
      /**
       * Returns all available SD-Cards in the system (include emulated)
       * <p/>
       * Warning: Hack! Based on Android source code of version 4.3 (API 18)
       * Because there is no standard way to get it.
       * TODO: Test on future Android versions 4.4+
       *
       * @return paths to all available SD-Cards in the system (include emulated)
       */
  
  
      public List<String> getStorageDirectories() {
          // Final set of paths
          final ArrayList<String> rv = new ArrayList<String>();
          // Primary physical SD-CARD (not emulated)
          final String rawExternalStorage = System.getenv("EXTERNAL_STORAGE");
          // All Secondary SD-CARDs (all exclude primary) separated by ":"
          final String rawSecondaryStoragesStr = System.getenv("SECONDARY_STORAGE");
          // Primary emulated SD-CARD
          final String rawEmulatedStorageTarget = System.getenv("EMULATED_STORAGE_TARGET");
          if (TextUtils.isEmpty(rawEmulatedStorageTarget)) {
              // Device has physical external storage; use plain paths.
              if (TextUtils.isEmpty(rawExternalStorage)) {
                  // EXTERNAL_STORAGE undefined; falling back to default.
                  rv.add("/storage/sdcard0");
              } else {
                  rv.add(rawExternalStorage);
              }
          } else {
              // Device has emulated storage; external storage paths should have
              // userId burned into them.
              final String rawUserId;
              if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) {
                  rawUserId = "";
              } else {
                  final String path = Environment.getExternalStorageDirectory().getAbsolutePath();
                  final String[] folders = DIR_SEPARATOR.split(path);
                  final String lastFolder = folders[folders.length - 1];
                  boolean isDigit = false;
                  try {
                      Integer.valueOf(lastFolder);
                      isDigit = true;
                  } catch (NumberFormatException ignored) {
                  }
                  rawUserId = isDigit ? lastFolder : "";
              }
              // /storage/emulated/0[1,2,...]
              if (TextUtils.isEmpty(rawUserId)) {
                  rv.add(rawEmulatedStorageTarget);
              } else {
                  rv.add(rawEmulatedStorageTarget + File.separator + rawUserId);
              }
          }
          // Add all secondary storages
          if (!TextUtils.isEmpty(rawSecondaryStoragesStr)) {
              // All Secondary SD-CARDs splited into array
              final String[] rawSecondaryStorages = rawSecondaryStoragesStr.split(File.pathSeparator);
              Collections.addAll(rv, rawSecondaryStorages);
          }
          rootmode = Sp.getBoolean("rootmode", false);
          if (rootmode)
              rv.add("/");
          File usb = getUsbDrive();
          if (usb != null && !rv.contains(usb.getPath())) rv.add(usb.getPath());
  
          return rv;
      }
  
  
      @Override
      public void onBackPressed() {
          if (!isDrawerLocked) {
              if (mDrawerLayout.isDrawerOpen(mDrawerLinear)) {
                  mDrawerLayout.closeDrawer(mDrawerLinear);
              } else {
                  onbackpressed();
              }
          } else onbackpressed();
      }
  
      void onbackpressed() {
          try {
  
              Fragment fragment = getSupportFragmentManager().findFragmentById(R.id.content_frame);
              String name = fragment.getClass().getName();
  