Example usage for android.view.animation DecelerateInterpolator DecelerateInterpolator

List of usage examples for android.view.animation DecelerateInterpolator DecelerateInterpolator

Introduction

In this page you can find the example usage for android.view.animation DecelerateInterpolator DecelerateInterpolator.

Prototype

public DecelerateInterpolator(float factor) 

Source Link

Document

Constructor

Usage

From source file:cw.kop.autobackground.sources.SourceInfoFragment.java

@Override
public void onStart() {
    super.onStart();
    Animation animation;//ww w. j a  v a2  s .co  m
    if (sourcePosition == -1) {
        animation = new Animation() {
            @Override
            protected void applyTransformation(float interpolatedTime, Transformation t) {

                sourceSpinnerText.setAlpha(interpolatedTime);
                sourceSpinner.setAlpha(interpolatedTime);
                sourceTitle.setAlpha(interpolatedTime);
                settingsContainer.setAlpha(interpolatedTime);
                sourceUse.setAlpha(interpolatedTime);

            }
        };
    } else {
        animation = new Animation() {
            @Override
            protected void applyTransformation(float interpolatedTime, Transformation t) {

                settingsContainer.setAlpha(interpolatedTime);
                sourceUse.setAlpha(interpolatedTime);

            }
        };
    }

    animation.setDuration(FADE_IN_TIME);
    animation.setInterpolator(new DecelerateInterpolator(3.0f));
    settingsContainer.startAnimation(animation);

}

From source file:com.usabusi.swiperefreshlayoutupdown.view.SwipeRefreshLayoutUpDown.java

/**
 * Constructor that is called when inflating SwipeRefreshLayout from XML.
 *
 * @param context//from www. j a  va  2s.com
 * @param attrs
 */
public SwipeRefreshLayoutUpDown(Context context, AttributeSet attrs) {
    super(context, attrs);

    mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();

    mMediumAnimationDuration = getResources().getInteger(android.R.integer.config_mediumAnimTime);

    setWillNotDraw(false);
    mDecelerateInterpolator = new DecelerateInterpolator(DECELERATE_INTERPOLATION_FACTOR);

    final TypedArray a = context.obtainStyledAttributes(attrs, LAYOUT_ATTRS);
    setEnabled(a.getBoolean(0, true));
    a.recycle();

    final DisplayMetrics metrics = getResources().getDisplayMetrics();
    mCircleWidth = (int) (CIRCLE_DIAMETER * metrics.density);
    mCircleHeight = (int) (CIRCLE_DIAMETER * metrics.density);

    createProgressView();
    ViewCompat.setChildrenDrawingOrderEnabled(this, true);
    // the absolute offset has to take into account that the circle starts at an offset
    mSpinnerFinalOffset = DEFAULT_CIRCLE_TARGET * metrics.density;
    mTotalDragDistance = mSpinnerFinalOffset;
}

From source file:com.hippo.refreshlayout.RefreshLayout.java

/**
 * Constructor that is called when inflating SwipeRefreshLayout from XML.
 *
 * @param context//from  w  w w  .jav  a 2s . c  o  m
 * @param attrs
 */
public RefreshLayout(Context context, AttributeSet attrs) {
    super(context, attrs);

    mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();

    mMediumAnimationDuration = getResources().getInteger(android.R.integer.config_mediumAnimTime);

    setWillNotDraw(false);
    mDecelerateInterpolator = new DecelerateInterpolator(DECELERATE_INTERPOLATION_FACTOR);
    mAccelerateInterpolator = new AccelerateInterpolator(ACCELERATE_INTERPOLATION_FACTOR);

    final DisplayMetrics metrics = getResources().getDisplayMetrics();
    mCircleDiameter = (int) (CIRCLE_DIAMETER * metrics.density);

    createProgressView();
    ViewCompat.setChildrenDrawingOrderEnabled(this, true);
    // the absolute offset has to take into account that the circle starts at an offset
    mHeaderSpinnerOffsetEnd = (int) (DEFAULT_CIRCLE_TARGET * metrics.density);
    mHeaderTotalDragDistance = mHeaderSpinnerOffsetEnd;
    mNestedScrollingParentHelper = new NestedScrollingParentHelper(this);

    mNestedScrollingChildHelper = new NestedScrollingChildHelper(this);
    setNestedScrollingEnabled(true);

    mHeaderOriginalOffsetTop = mHeaderCurrentTargetOffsetTop = -mCircleDiameter;
    moveToStart(1.0f);

    final TypedArray a = context.obtainStyledAttributes(attrs, LAYOUT_ATTRS);
    setEnabled(a.getBoolean(0, true));
    a.recycle();

    mProgressBar = new SwipeProgressBar(this);
    mProgressBarHeight = (int) (metrics.density * PROGRESS_BAR_HEIGHT);
}

From source file:com.amaze.filemanager.ui.views.drawer.Drawer.java

public void refreshDrawer() {
    Menu menu = navView.getMenu();
    menu.clear();/*from w  w w.j av a 2  s.c o m*/
    actionViewStateManager.deselectCurrentActionView();

    int order = 0;
    ArrayList<String> storageDirectories = mainActivity.getStorageDirectories();
    phoneStorageCount = 0;
    for (String file : storageDirectories) {
        if (file.contains(OTGUtil.PREFIX_OTG)) {
            addNewItem(menu, STORAGES_GROUP, order++, "OTG", new MenuMetadata(file),
                    R.drawable.ic_usb_white_24dp, R.drawable.ic_show_chart_black_24dp);
            continue;
        }

        File f = new File(file);
        String name;
        @DrawableRes
        int icon1;
        if ("/storage/emulated/legacy".equals(file) || "/storage/emulated/0".equals(file)
                || "/mnt/sdcard".equals(file)) {
            name = resources.getString(R.string.storage);
            icon1 = R.drawable.ic_phone_android_white_24dp;
        } else if ("/storage/sdcard1".equals(file)) {
            name = resources.getString(R.string.extstorage);
            icon1 = R.drawable.ic_sd_storage_white_24dp;
        } else if ("/".equals(file)) {
            name = resources.getString(R.string.rootdirectory);
            icon1 = R.drawable.ic_drawer_root_white;
        } else {
            name = f.getName();
            icon1 = R.drawable.ic_sd_storage_white_24dp;
        }

        if (f.isDirectory() || f.canExecute()) {
            addNewItem(menu, STORAGES_GROUP, order++, name, new MenuMetadata(file), icon1,
                    R.drawable.ic_show_chart_black_24dp);
            if (phoneStorageCount == 0)
                firstPath = file;
            else if (phoneStorageCount == 1)
                secondPath = file;

            phoneStorageCount++;
        }
    }
    dataUtils.setStorages(storageDirectories);

    if (dataUtils.getServers().size() > 0) {
        Collections.sort(dataUtils.getServers(), new BookSorter());
        synchronized (dataUtils.getServers()) {
            for (String[] file : dataUtils.getServers()) {
                addNewItem(menu, SERVERS_GROUP, order++, file[0], new MenuMetadata(file[1]),
                        R.drawable.ic_settings_remote_white_24dp, R.drawable.ic_edit_24dp);
            }
        }
    }

    ArrayList<String[]> accountAuthenticationList = new ArrayList<>();

    if (CloudSheetFragment.isCloudProviderAvailable(mainActivity)) {
        for (CloudStorage cloudStorage : dataUtils.getAccounts()) {
            @DrawableRes
            int deleteIcon = R.drawable.ic_delete_grey_24dp;

            if (cloudStorage instanceof Dropbox) {
                addNewItem(menu, CLOUDS_GROUP, order++, CloudHandler.CLOUD_NAME_DROPBOX,
                        new MenuMetadata(CloudHandler.CLOUD_PREFIX_DROPBOX + "/"),
                        R.drawable.ic_dropbox_white_24dp, deleteIcon);

                accountAuthenticationList.add(new String[] { CloudHandler.CLOUD_NAME_DROPBOX,
                        CloudHandler.CLOUD_PREFIX_DROPBOX + "/", });
            } else if (cloudStorage instanceof Box) {
                addNewItem(menu, CLOUDS_GROUP, order++, CloudHandler.CLOUD_NAME_BOX,
                        new MenuMetadata(CloudHandler.CLOUD_PREFIX_BOX + "/"), R.drawable.ic_box_white_24dp,
                        deleteIcon);

                accountAuthenticationList.add(
                        new String[] { CloudHandler.CLOUD_NAME_BOX, CloudHandler.CLOUD_PREFIX_BOX + "/", });
            } else if (cloudStorage instanceof OneDrive) {
                addNewItem(menu, CLOUDS_GROUP, order++, CloudHandler.CLOUD_NAME_ONE_DRIVE,
                        new MenuMetadata(CloudHandler.CLOUD_PREFIX_ONE_DRIVE + "/"),
                        R.drawable.ic_onedrive_white_24dp, deleteIcon);

                accountAuthenticationList.add(new String[] { CloudHandler.CLOUD_NAME_ONE_DRIVE,
                        CloudHandler.CLOUD_PREFIX_ONE_DRIVE + "/", });
            } else if (cloudStorage instanceof GoogleDrive) {
                addNewItem(menu, CLOUDS_GROUP, order++, CloudHandler.CLOUD_NAME_GOOGLE_DRIVE,
                        new MenuMetadata(CloudHandler.CLOUD_PREFIX_GOOGLE_DRIVE + "/"),
                        R.drawable.ic_google_drive_white_24dp, deleteIcon);

                accountAuthenticationList.add(new String[] { CloudHandler.CLOUD_NAME_GOOGLE_DRIVE,
                        CloudHandler.CLOUD_PREFIX_GOOGLE_DRIVE + "/", });
            }
        }
        Collections.sort(accountAuthenticationList, new BookSorter());
    }

    if (mainActivity.getBoolean(PREFERENCE_SHOW_SIDEBAR_FOLDERS)) {
        if (dataUtils.getBooks().size() > 0) {

            Collections.sort(dataUtils.getBooks(), new BookSorter());

            synchronized (dataUtils.getBooks()) {
                for (String[] file : dataUtils.getBooks()) {
                    addNewItem(menu, FOLDERS_GROUP, order++, file[0], new MenuMetadata(file[1]),
                            R.drawable.ic_folder_white_24dp, R.drawable.ic_edit_24dp);
                }
            }
        }
    }

    Boolean[] quickAccessPref = TinyDB.getBooleanArray(mainActivity.getPrefs(), QuickAccessPref.KEY,
            QuickAccessPref.DEFAULT);

    if (mainActivity.getBoolean(PREFERENCE_SHOW_SIDEBAR_QUICKACCESSES)) {
        if (quickAccessPref[0]) {
            addNewItem(menu, QUICKACCESSES_GROUP, order++, R.string.quick, new MenuMetadata("5"),
                    R.drawable.ic_star_white_24dp, null);
        }
        if (quickAccessPref[1]) {
            addNewItem(menu, QUICKACCESSES_GROUP, order++, R.string.recent, new MenuMetadata("6"),
                    R.drawable.ic_history_white_24dp, null);
        }
        if (quickAccessPref[2]) {
            addNewItem(menu, QUICKACCESSES_GROUP, order++, R.string.images, new MenuMetadata("0"),
                    R.drawable.ic_photo_library_white_24dp, null);
        }
        if (quickAccessPref[3]) {
            addNewItem(menu, QUICKACCESSES_GROUP, order++, R.string.videos, new MenuMetadata("1"),
                    R.drawable.ic_video_library_white_24dp, null);
        }
        if (quickAccessPref[4]) {
            addNewItem(menu, QUICKACCESSES_GROUP, order++, R.string.audio, new MenuMetadata("2"),
                    R.drawable.ic_library_music_white_24dp, null);
        }
        if (quickAccessPref[5]) {
            addNewItem(menu, QUICKACCESSES_GROUP, order++, R.string.documents, new MenuMetadata("3"),
                    R.drawable.ic_library_books_white_24dp, null);
        }
        if (quickAccessPref[6]) {
            addNewItem(menu, QUICKACCESSES_GROUP, order++, R.string.apks, new MenuMetadata("4"),
                    R.drawable.ic_apk_library_white_24dp, null);
        }
    }

    addNewItem(menu, LASTGROUP, order++, R.string.ftp, new MenuMetadata(() -> {
        FragmentTransaction transaction2 = mainActivity.getSupportFragmentManager().beginTransaction();
        transaction2.replace(R.id.content_frame, new FtpServerFragment());
        mainActivity.getAppbar().getAppbarLayout().animate().translationY(0)
                .setInterpolator(new DecelerateInterpolator(2)).start();
        pending_fragmentTransaction = transaction2;
        if (!isDrawerLocked)
            close();
        else
            onDrawerClosed();
    }), R.drawable.ic_ftp_white_24dp, null);

    addNewItem(menu, LASTGROUP, order++, R.string.apps, new MenuMetadata(() -> {
        FragmentTransaction transaction2 = mainActivity.getSupportFragmentManager().beginTransaction();
        transaction2.replace(R.id.content_frame, new AppsListFragment());
        mainActivity.getAppbar().getAppbarLayout().animate().translationY(0)
                .setInterpolator(new DecelerateInterpolator(2)).start();
        pending_fragmentTransaction = transaction2;
        if (!isDrawerLocked)
            close();
        else
            onDrawerClosed();
    }), R.drawable.ic_android_white_24dp, null);

    addNewItem(menu, LASTGROUP, order++, R.string.setting, new MenuMetadata(() -> {
        Intent in = new Intent(mainActivity, PreferencesActivity.class);
        mainActivity.startActivity(in);
        mainActivity.finish();
    }), R.drawable.ic_settings_white_24dp, null);

    for (int i = 0; i < navView.getMenu().size(); i++) {
        navView.getMenu().getItem(i).setEnabled(true);
    }

    for (int group : GROUPS) {
        menu.setGroupCheckable(group, true, true);
    }

    MenuItem item = navView.getSelected();
    if (item != null) {
        item.setChecked(true);
        actionViewStateManager.selectActionView(item);
        isSomethingSelected = true;
    }
}

From source file:com.amaze.filemanager.fragments.RarViewer.java

public void createviews(ArrayList<FileHeader> zipEntries, String dir) {
    zipViewer.zipAdapter = new RarAdapter(zipViewer.getActivity(), zipEntries, zipViewer);
    zipViewer.listView.setAdapter(zipViewer.zipAdapter);
    if (!addheader) {
        listView.removeItemDecoration(dividerItemDecoration);
        listView.removeItemDecoration(headersDecor);
        addheader = true;/*from   w  ww . j a  v a 2 s. c o  m*/
    }
    if (addheader) {
        dividerItemDecoration = new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL_LIST,
                false, showDividers);
        listView.addItemDecoration(dividerItemDecoration);

        headersDecor = new StickyRecyclerHeadersDecoration(zipAdapter);
        listView.addItemDecoration(headersDecor);
        addheader = false;
    }
    listView.setOnScrollListener(new HidingScrollListener(mToolbarHeight, hidemode) {

        @Override
        public void onMoved(int distance) {
            mToolbarContainer.setTranslationY(-distance);
        }

        @Override
        public void onShow() {
            mToolbarContainer.animate().translationY(0).setInterpolator(new DecelerateInterpolator(2)).start();
        }

        @Override
        public void onHide() {
            mToolbarContainer.findViewById(R.id.lin).animate().translationY(-mToolbarHeight)
                    .setInterpolator(new AccelerateInterpolator(2)).start();
        }

    });
    zipViewer.current = dir;
    zipViewer.bbar();
    swipeRefreshLayout.setRefreshing(false);
}

From source file:com.geecko.QuickLyric.fragment.LocalLyricsFragment.java

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    final MainActivity mainActivity = ((MainActivity) this.getActivity());
    super.onViewCreated(view, savedInstanceState);
    if (this.isHidden())
        return;/*from  w w  w .  ja v a  2  s .co m*/

    DrawerAdapter drawerAdapter = ((DrawerAdapter) ((ListView) mainActivity.findViewById(R.id.drawer_list))
            .getAdapter());
    if (drawerAdapter.getSelectedItem() != 1) {
        drawerAdapter.setSelectedItem(1);
        drawerAdapter.notifyDataSetChanged();
    }

    if (!megaListView.hasOnGroupClickListener())
        megaListView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {

            @Override
            public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
                final ImageView indicator = (ImageView) v.findViewById(R.id.group_indicator);
                RotateAnimation anim;
                if (megaListView.isGroupExpanded(groupPosition)) {
                    megaListView.collapseGroupWithAnimation(groupPosition);
                    if (indicator != null) {
                        anim = new RotateAnimation(180f, 360f, indicator.getWidth() / 2,
                                indicator.getHeight() / 2);
                        anim.setInterpolator(new DecelerateInterpolator(3));
                        anim.setDuration(500);
                        anim.setFillAfter(true);
                        indicator.startAnimation(anim);
                    }
                } else {
                    megaListView.expandGroupWithAnimation(groupPosition);
                    if (indicator != null) {
                        anim = new RotateAnimation(0f, 180f, indicator.getWidth() / 2,
                                indicator.getHeight() / 2);
                        anim.setInterpolator(new DecelerateInterpolator(2));
                        anim.setDuration(500);
                        anim.setFillAfter(true);
                        indicator.startAnimation(anim);
                    }
                }
                return true;
            }
        });

    if (!megaListView.hasOnChildClickListener())
        megaListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
            @Override
            public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition,
                    long id) {
                if (mSwiping) {
                    mSwiping = false;
                    return false;
                }
                final MainActivity mainActivity = (MainActivity) getActivity();
                megaListView.setOnChildClickListener(null); // prevents bug on double tap
                mainActivity.updateLyricsFragment(R.animator.slide_out_start, R.animator.slide_in_start, true,
                        ((LocalAdapter) megaListView.getExpandableListAdapter()).getChild(groupPosition,
                                childPosition));
                return true;
            }
        });

    this.isActiveFragment = true;
    new DBContentLister(this).execute();
}

From source file:com.italankin.dictionary.ui.main.MainActivity.java

/**
 * Called from {@link MainPresenter}, when languages were fetched from cache/net.
 *///from   ww  w  .j a va 2  s .  co m
public void onLanguagesResult() {
    mToolbarInnerLayout.setVisibility(View.VISIBLE);
    mToolbarInnerLayout.setTranslationY(-mToolbarInnerLayout.getHeight());
    mToolbarInnerLayout.setAlpha(0);
    mToolbarInnerLayout.animate().alpha(1).translationY(0).setDuration(TOOLBAR_ANIM_IN_DURATION)
            .setInterpolator(new DecelerateInterpolator(2.5f)).start();

    setControlsState(true);
    updateTextViews();

    // if we are not coming from share intent
    if (!handleIntent(getIntent())) {
        Result lastResult = _presenter.getLastResult();
        if (lastResult == null) {
            mInput.requestFocus();
        } else {
            onLookupResult(lastResult);
        }
    }
}

From source file:com.android.tv.settings.accessories.AddAccessoryActivity.java

private void animateActionsIn() {
    prepareAndAnimateView(mContentView, 1f, mViewOffset / 2, 0, ANIMATE_IN_DURATION,
            new DecelerateInterpolator(1.0f), true);
    prepareAndAnimateView(mActionView, 1f, mViewOffset, 0, ANIMATE_IN_DURATION,
            new DecelerateInterpolator(1.0f), false);
}

From source file:com.evandroid.musica.fragment.LocalLyricsFragment.java

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    if (this.isHidden())
        return;/*w  w w.j  av  a 2s . c o m*/

    megaListView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {

        @Override
        public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
            final ImageView indicator = (ImageView) v.findViewById(R.id.group_indicator);
            RotateAnimation anim;
            if (megaListView.isGroupExpanded(groupPosition)) {
                megaListView.collapseGroupWithAnimation(groupPosition);
                if (indicator != null) {
                    anim = new RotateAnimation(180f, 360f, indicator.getWidth() / 2, indicator.getHeight() / 2);
                    anim.setInterpolator(new DecelerateInterpolator(3));
                    anim.setDuration(500);
                    anim.setFillAfter(true);
                    indicator.startAnimation(anim);
                }
            } else {
                megaListView.expandGroupWithAnimation(groupPosition);
                if (indicator != null) {
                    anim = new RotateAnimation(0f, 180f, indicator.getWidth() / 2, indicator.getHeight() / 2);
                    anim.setInterpolator(new DecelerateInterpolator(2));
                    anim.setDuration(500);
                    anim.setFillAfter(true);
                    indicator.startAnimation(anim);
                }
            }
            return true;
        }
    });

    megaListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
        @Override
        public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition,
                long id) {
            if (mSwiping) {
                mSwiping = false;
                return false;
            }
            final MainLyricActivity mainLyricActivity = (MainLyricActivity) getActivity();
            megaListView.setOnChildClickListener(null); // prevents bug on double tap
            mainLyricActivity.updateLyricsFragment(R.animator.slide_out_start, R.animator.slide_in_start, true,
                    lyricsArray.get(groupPosition).get(childPosition));
            return true;
        }
    });

    this.isActiveFragment = true;
    new DBContentLister(this).execute();
}

From source file:com.amaze.carbonfilemanager.activities.MainActivity.java

/**
 * Called when the activity is first created.
 *///from  www  .j  a  v  a2 s  .  co  m
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    initialisePreferences();
    initializeInteractiveShell();

    dataUtils = new DataUtils();
    dataUtils.registerOnDataChangedListener(this);

    setContentView(R.layout.main_toolbar);
    initialiseViews();
    tabHandler = new TabHandler(this);
    mImageLoader = AppConfig.getInstance().getImageLoader();
    utils = getFutils();
    mainActivityHelper = new MainActivityHelper(this);
    initialiseFab();

    // TODO: Create proper SQLite database handler class with calls to database from background thread
    history = new HistoryManager(this, "Table2");
    history.initializeTable(DataUtils.HISTORY, 0);
    history.initializeTable(DataUtils.HIDDEN, 0);

    grid = new HistoryManager(this, "listgridmodes");
    grid.initializeTable(DataUtils.LIST, 0);
    grid.initializeTable(DataUtils.GRID, 0);
    grid.initializeTable(DataUtils.BOOKS, 1);
    grid.initializeTable(DataUtils.SMB, 1);

    if (!sharedPref.getBoolean("booksadded", false)) {
        grid.make(DataUtils.BOOKS);
        sharedPref.edit().putBoolean("booksadded", true).commit();
    }
    dataUtils.setHiddenfiles(history.readTable(DataUtils.HIDDEN));
    dataUtils.setGridfiles(grid.readTable(DataUtils.GRID));
    dataUtils.setListfiles(grid.readTable(DataUtils.LIST));

    // initialize g+ api client as per preferences
    if (sharedPref.getBoolean("plus_pic", false)) {
        mGoogleApiClient = new GoogleApiClient.Builder(this).addConnectionCallbacks(this)
                .addOnConnectionFailedListener(this).addApi(Plus.API).addScope(Plus.SCOPE_PLUS_LOGIN).build();
    }

    if (CloudSheetFragment.isCloudProviderAvailable(this)) {

        getSupportLoaderManager().initLoader(REQUEST_CODE_CLOUD_LIST_KEY_CLOUD, null, this);
    }

    util = new IconUtils(sharedPref, this);
    icons = new IconUtils(sharedPref, this);

    timer = new CountDownTimer(5000, 1000) {
        @Override
        public void onTick(long l) {
        }

        @Override
        public void onFinish() {
            utils.crossfadeInverse(buttons, pathbar);
        }
    };
    path = getIntent().getStringExtra("path");
    openProcesses = getIntent().getBooleanExtra(KEY_INTENT_PROCESS_VIEWER, false);
    try {
        intent = getIntent();
        if (intent.getStringArrayListExtra(TAG_INTENT_FILTER_FAILED_OPS) != null) {
            ArrayList<BaseFile> failedOps = intent.getParcelableArrayListExtra(TAG_INTENT_FILTER_FAILED_OPS);
            if (failedOps != null) {
                mainActivityHelper.showFailedOperationDialog(failedOps, intent.getBooleanExtra("move", false),
                        this);
            }
        }
        if (intent.getAction() != null) {
            if (intent.getAction().equals(Intent.ACTION_GET_CONTENT)) {

                // file picker intent
                mReturnIntent = true;
                Toast.makeText(this, getString(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, getString(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) {

        e.printStackTrace();
    }

    if (savedInstanceState != null) {

        selectedStorage = savedInstanceState.getInt("selectitem", SELECT_0);
    }

    refreshDrawer();

    // setting window background color instead of each item, in order to reduce pixel overdraw
    if (getAppTheme().equals(AppTheme.LIGHT)) {
        /*if(Main.IS_LIST)
        getWindow().setBackgroundDrawableResource(android.R.color.white);
        else
        getWindow().setBackgroundDrawableResource(R.color.grid_background_light);
        */
        getWindow().setBackgroundDrawableResource(android.R.color.white);
    } else {
        getWindow().setBackgroundDrawableResource(R.color.holo_dark_background);
    }

    if (savedInstanceState == null) {
        if (openProcesses) {
            android.support.v4.app.FragmentTransaction transaction = getSupportFragmentManager()
                    .beginTransaction();
            transaction.replace(R.id.content_frame, new ProcessViewer(), KEY_INTENT_PROCESS_VIEWER);
            //transaction.addToBackStack(null);
            selectedStorage = SELECT_102;
            openProcesses = false;
            //title.setText(utils.getString(con, R.string.process_viewer));
            //Commit the transaction
            transaction.commit();
            supportInvalidateOptionsMenu();
        } else if (intent.getAction() != null
                && intent.getAction().equals(TileService.ACTION_QS_TILE_PREFERENCES)) {
            // tile preferences, open ftp fragment

            android.support.v4.app.FragmentTransaction transaction2 = getSupportFragmentManager()
                    .beginTransaction();
            transaction2.replace(R.id.content_frame, new FTPServerFragment());
            findViewById(R.id.lin).animate().translationY(0).setInterpolator(new DecelerateInterpolator(2))
                    .start();

            selectedStorage = SELECT_MINUS_2;
            adapter.toggleChecked(false);
            transaction2.commit();
        } else {
            if (path != null && path.length() > 0) {
                HFile file = new HFile(OpenMode.UNKNOWN, path);
                file.generateMode(this);
                if (file.isDirectory())
                    goToMain(path);
                else {
                    goToMain("");
                    utils.openFile(new File(path), this);
                }
            } else {
                goToMain("");

            }
        }
    } else {
        COPY_PATH = savedInstanceState.getParcelableArrayList("COPY_PATH");
        MOVE_PATH = savedInstanceState.getParcelableArrayList("MOVE_PATH");
        oppathe = savedInstanceState.getString("oppathe");
        oppathe1 = savedInstanceState.getString("oppathe1");
        oparrayList = savedInstanceState.getParcelableArrayList("oparrayList");
        operation = savedInstanceState.getInt("operation");
        selectedStorage = savedInstanceState.getInt("selectitem", SELECT_0);
        //mainFragment = (Main) savedInstanceState.getParcelable("main_fragment");
        adapter.toggleChecked(selectedStorage);
    }

    if (getAppTheme().equals(AppTheme.DARK)) {
        mDrawerList.setBackgroundColor(ContextCompat.getColor(this, R.color.holo_dark_background));
    }
    mDrawerList.setDivider(null);
    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 (SDK_INT >= 21) {
        ActivityManager.TaskDescription taskDescription = new ActivityManager.TaskDescription("Amaze",
                ((BitmapDrawable) getResources().getDrawable(R.mipmap.ic_launcher)).getBitmap(),
                getColorPreference().getColor(ColorUsage.getPrimary(MainActivity.currentTab)));
        setTaskDescription(taskDescription);
    }
}