Search in sources :

Example 1 with ProcessViewerFragment

use of com.amaze.filemanager.ui.fragments.ProcessViewerFragment in project AmazeFileManager by TeamAmaze.

the class MainActivity method onPrepareOptionsMenu.

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    MenuItem s = menu.findItem(R.id.view);
    MenuItem search = menu.findItem(R.id.search);
    Fragment fragment = getFragmentAtFrame();
    if (fragment instanceof TabFragment) {
        appbar.setTitle(R.string.appbar_name);
        if (getBoolean(PREFERENCE_VIEW)) {
            s.setTitle(getResources().getString(R.string.gridview));
        } else {
            s.setTitle(getResources().getString(R.string.listview));
        }
        try {
            executeWithMainFragment(mainFragment -> {
                if (mainFragment.getMainFragmentViewModel().isList()) {
                    s.setTitle(R.string.gridview);
                } else {
                    s.setTitle(R.string.listview);
                }
                appbar.getBottomBar().updatePath(mainFragment.getCurrentPath(), mainFragment.getMainFragmentViewModel().getResults(), MainActivityHelper.SEARCH_TEXT, mainFragment.getMainFragmentViewModel().getOpenMode(), mainFragment.getMainFragmentViewModel().getFolderCount(), mainFragment.getMainFragmentViewModel().getFileCount(), mainFragment);
                return null;
            });
        } catch (Exception e) {
            e.printStackTrace();
        }
        appbar.getBottomBar().setClickListener();
        search.setVisible(true);
        if (indicator_layout != null)
            indicator_layout.setVisibility(View.VISIBLE);
        menu.findItem(R.id.search).setVisible(true);
        menu.findItem(R.id.home).setVisible(true);
        menu.findItem(R.id.history).setVisible(true);
        menu.findItem(R.id.sethome).setVisible(true);
        menu.findItem(R.id.sort).setVisible(true);
        menu.findItem(R.id.hiddenitems).setVisible(true);
        menu.findItem(R.id.view).setVisible(true);
        menu.findItem(R.id.extract).setVisible(false);
        invalidatePasteSnackbar(true);
        findViewById(R.id.buttonbarframe).setVisibility(View.VISIBLE);
    } else if (fragment instanceof AppsListFragment || fragment instanceof ProcessViewerFragment || fragment instanceof FtpServerFragment) {
        appBarLayout.setExpanded(true);
        menu.findItem(R.id.sethome).setVisible(false);
        if (indicator_layout != null)
            indicator_layout.setVisibility(View.GONE);
        findViewById(R.id.buttonbarframe).setVisibility(View.GONE);
        menu.findItem(R.id.search).setVisible(false);
        menu.findItem(R.id.home).setVisible(false);
        menu.findItem(R.id.history).setVisible(false);
        menu.findItem(R.id.extract).setVisible(false);
        if (fragment instanceof ProcessViewerFragment) {
            menu.findItem(R.id.sort).setVisible(false);
        } else if (fragment instanceof FtpServerFragment) {
            menu.findItem(R.id.sort).setVisible(false);
        } else {
            menu.findItem(R.id.dsort).setVisible(false);
            menu.findItem(R.id.sortby).setVisible(false);
        }
        menu.findItem(R.id.hiddenitems).setVisible(false);
        menu.findItem(R.id.view).setVisible(false);
        invalidatePasteSnackbar(false);
    } else if (fragment instanceof CompressedExplorerFragment) {
        appbar.setTitle(R.string.appbar_name);
        menu.findItem(R.id.sethome).setVisible(false);
        if (indicator_layout != null)
            indicator_layout.setVisibility(View.GONE);
        getAppbar().getBottomBar().resetClickListener();
        menu.findItem(R.id.search).setVisible(false);
        menu.findItem(R.id.home).setVisible(false);
        menu.findItem(R.id.history).setVisible(false);
        menu.findItem(R.id.sort).setVisible(false);
        menu.findItem(R.id.hiddenitems).setVisible(false);
        menu.findItem(R.id.view).setVisible(false);
        menu.findItem(R.id.extract).setVisible(true);
        invalidatePasteSnackbar(false);
    }
    return super.onPrepareOptionsMenu(menu);
}
Also used : AppsListFragment(com.amaze.filemanager.ui.fragments.AppsListFragment) CompressedExplorerFragment(com.amaze.filemanager.ui.fragments.CompressedExplorerFragment) MenuItem(android.view.MenuItem) TabFragment(com.amaze.filemanager.ui.fragments.TabFragment) ProcessViewerFragment(com.amaze.filemanager.ui.fragments.ProcessViewerFragment) Fragment(androidx.fragment.app.Fragment) CompressedExplorerFragment(com.amaze.filemanager.ui.fragments.CompressedExplorerFragment) CloudSheetFragment(com.amaze.filemanager.ui.fragments.CloudSheetFragment) SearchWorkerFragment(com.amaze.filemanager.ui.fragments.SearchWorkerFragment) TabFragment(com.amaze.filemanager.ui.fragments.TabFragment) FtpServerFragment(com.amaze.filemanager.ui.fragments.FtpServerFragment) MainFragment(com.amaze.filemanager.ui.fragments.MainFragment) ProcessViewerFragment(com.amaze.filemanager.ui.fragments.ProcessViewerFragment) AppsListFragment(com.amaze.filemanager.ui.fragments.AppsListFragment) BottomSheetDialogFragment(com.google.android.material.bottomsheet.BottomSheetDialogFragment) CloudPluginException(com.amaze.filemanager.file_operations.exceptions.CloudPluginException) FtpServerFragment(com.amaze.filemanager.ui.fragments.FtpServerFragment)

Example 2 with ProcessViewerFragment

use of com.amaze.filemanager.ui.fragments.ProcessViewerFragment in project AmazeFileManager by TeamAmaze.

the class MainActivity method onNewIntent.

@Override
public void onNewIntent(Intent i) {
    super.onNewIntent(i);
    intent = i;
    path = i.getStringExtra("path");
    if (path != null) {
        if (new File(path).isDirectory()) {
            final MainFragment mainFragment = getCurrentMainFragment();
            if (mainFragment != null) {
                mainFragment.loadlist(path, false, OpenMode.FILE);
            } else {
                goToMain(path);
            }
        } else
            FileUtils.openFile(new File(path), mainActivity, getPrefs());
    } else if (i.getStringArrayListExtra(TAG_INTENT_FILTER_FAILED_OPS) != null) {
        ArrayList<HybridFileParcelable> failedOps = i.getParcelableArrayListExtra(TAG_INTENT_FILTER_FAILED_OPS);
        if (failedOps != null) {
            mainActivityHelper.showFailedOperationDialog(failedOps, this);
        }
    } else if (i.getCategories() != null && i.getCategories().contains(CLOUD_AUTHENTICATOR_GDRIVE)) {
        // we used an external authenticator instead of APIs. Probably for Google Drive
        CloudRail.setAuthenticationResponse(intent);
    } else if ((openProcesses = i.getBooleanExtra(KEY_INTENT_PROCESS_VIEWER, false))) {
        FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
        transaction.replace(R.id.content_frame, new ProcessViewerFragment(), KEY_INTENT_PROCESS_VIEWER);
        // transaction.addToBackStack(null);
        openProcesses = false;
        // title.setText(utils.getString(con, R.string.process_viewer));
        // Commit the transaction
        transaction.commitAllowingStateLoss();
        supportInvalidateOptionsMenu();
    } else if (intent.getAction() != null) {
        checkForExternalIntent(intent);
        if (SDK_INT >= KITKAT) {
            if (intent.getAction().equals(UsbManager.ACTION_USB_DEVICE_DETACHED)) {
                SingletonUsbOtg.getInstance().resetUsbOtgRoot();
                drawer.refreshDrawer();
            }
        }
    }
}
Also used : MainFragment(com.amaze.filemanager.ui.fragments.MainFragment) FragmentTransaction(androidx.fragment.app.FragmentTransaction) ArrayList(java.util.ArrayList) ProcessViewerFragment(com.amaze.filemanager.ui.fragments.ProcessViewerFragment) File(java.io.File) HybridFile(com.amaze.filemanager.filesystem.HybridFile)

Example 3 with ProcessViewerFragment

use of com.amaze.filemanager.ui.fragments.ProcessViewerFragment in project AmazeFileManager by TeamAmaze.

the class MainActivity method invalidateFragmentAndBundle.

private void invalidateFragmentAndBundle(Bundle savedInstanceState) {
    if (savedInstanceState == null) {
        if (openProcesses) {
            FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
            transaction.replace(R.id.content_frame, new ProcessViewerFragment(), KEY_INTENT_PROCESS_VIEWER);
            // transaction.addToBackStack(null);
            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) || INTENT_ACTION_OPEN_FTP_SERVER.equals(intent.getAction()))) {
            // tile preferences, open ftp fragment
            FragmentTransaction transaction2 = getSupportFragmentManager().beginTransaction();
            transaction2.replace(R.id.content_frame, new FtpServerFragment());
            appBarLayout.animate().translationY(0).setInterpolator(new DecelerateInterpolator(2)).start();
            drawer.deselectEverything();
            transaction2.commit();
        } else if (intent.getAction() != null && INTENT_ACTION_OPEN_APP_MANAGER.equals(intent.getAction())) {
            FragmentTransaction transaction3 = getSupportFragmentManager().beginTransaction();
            transaction3.replace(R.id.content_frame, new AppsListFragment());
            appBarLayout.animate().translationY(0).setInterpolator(new DecelerateInterpolator(2)).start();
            drawer.deselectEverything();
            transaction3.commit();
        } else {
            if (path != null && path.length() > 0) {
                HybridFile file = new HybridFile(OpenMode.UNKNOWN, path);
                file.generateMode(MainActivity.this);
                if (file.isDirectory(MainActivity.this))
                    goToMain(path);
                else {
                    goToMain(null);
                    FileUtils.openFile(new File(path), MainActivity.this, getPrefs());
                }
            } else {
                goToMain(null);
            }
        }
    } else {
        pasteHelper = savedInstanceState.getParcelable(PASTEHELPER_BUNDLE);
        oppathe = savedInstanceState.getString(KEY_OPERATION_PATH);
        oppathe1 = savedInstanceState.getString(KEY_OPERATED_ON_PATH);
        oparrayList = savedInstanceState.getParcelableArrayList(KEY_OPERATIONS_PATH_LIST);
        operation = savedInstanceState.getInt(KEY_OPERATION);
        int selectedStorage = savedInstanceState.getInt(KEY_DRAWER_SELECTED, 0);
        getDrawer().selectCorrectDrawerItem(selectedStorage);
    }
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) HybridFile(com.amaze.filemanager.filesystem.HybridFile) FragmentTransaction(androidx.fragment.app.FragmentTransaction) AppsListFragment(com.amaze.filemanager.ui.fragments.AppsListFragment) ProcessViewerFragment(com.amaze.filemanager.ui.fragments.ProcessViewerFragment) File(java.io.File) HybridFile(com.amaze.filemanager.filesystem.HybridFile) FtpServerFragment(com.amaze.filemanager.ui.fragments.FtpServerFragment)

Aggregations

ProcessViewerFragment (com.amaze.filemanager.ui.fragments.ProcessViewerFragment)3 FragmentTransaction (androidx.fragment.app.FragmentTransaction)2 HybridFile (com.amaze.filemanager.filesystem.HybridFile)2 AppsListFragment (com.amaze.filemanager.ui.fragments.AppsListFragment)2 FtpServerFragment (com.amaze.filemanager.ui.fragments.FtpServerFragment)2 MainFragment (com.amaze.filemanager.ui.fragments.MainFragment)2 File (java.io.File)2 MenuItem (android.view.MenuItem)1 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)1 Fragment (androidx.fragment.app.Fragment)1 CloudPluginException (com.amaze.filemanager.file_operations.exceptions.CloudPluginException)1 CloudSheetFragment (com.amaze.filemanager.ui.fragments.CloudSheetFragment)1 CompressedExplorerFragment (com.amaze.filemanager.ui.fragments.CompressedExplorerFragment)1 SearchWorkerFragment (com.amaze.filemanager.ui.fragments.SearchWorkerFragment)1 TabFragment (com.amaze.filemanager.ui.fragments.TabFragment)1 BottomSheetDialogFragment (com.google.android.material.bottomsheet.BottomSheetDialogFragment)1 ArrayList (java.util.ArrayList)1