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);
}
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();
}
}
}
}
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);
}
}
Aggregations