use of com.amaze.filemanager.fragments.CompressedExplorerFragment in project AmazeFileManager by TeamAmaze.
the class MainActivity method openZip.
public void openZip(String path) {
appBarLayout.animate().translationY(0).setInterpolator(new DecelerateInterpolator(2)).start();
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
fragmentTransaction.setCustomAnimations(R.anim.slide_in_top, R.anim.slide_in_bottom);
Fragment zipFragment = new CompressedExplorerFragment();
Bundle bundle = new Bundle();
bundle.putString(CompressedExplorerFragment.KEY_PATH, path);
zipFragment.setArguments(bundle);
fragmentTransaction.add(R.id.content_frame, zipFragment);
fragmentTransaction.commitAllowingStateLoss();
}
use of com.amaze.filemanager.fragments.CompressedExplorerFragment in project AmazeFileManager by TeamAmaze.
the class MainActivity method onOptionsItemSelected.
// called when the user exits the action mode
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// ActionBarDrawerToggle will take care of this.
if (drawer.onOptionsItemSelected(item))
return true;
// Handle action buttons
MainFragment ma = getCurrentMainFragment();
switch(item.getItemId()) {
case R.id.home:
if (ma != null)
ma.home();
break;
case R.id.history:
if (ma != null)
GeneralDialogCreation.showHistoryDialog(dataUtils, getPrefs(), ma, getAppTheme());
break;
case R.id.sethome:
if (ma == null)
return super.onOptionsItemSelected(item);
final MainFragment main = ma;
if (main.openMode != OpenMode.FILE && main.openMode != OpenMode.ROOT) {
Toast.makeText(mainActivity, R.string.not_allowed, Toast.LENGTH_SHORT).show();
break;
}
final MaterialDialog dialog = GeneralDialogCreation.showBasicDialog(mainActivity, new String[] { getResources().getString(R.string.questionset), getResources().getString(R.string.setashome), getResources().getString(R.string.yes), getResources().getString(R.string.no), null });
dialog.getActionButton(DialogAction.POSITIVE).setOnClickListener((v) -> {
main.home = main.getCurrentPath();
updatePaths(main.no);
dialog.dismiss();
});
dialog.show();
break;
case R.id.exit:
finish();
break;
case R.id.sort:
Fragment fragment = getFragmentAtFrame();
if (fragment instanceof AppsListFragment) {
GeneralDialogCreation.showSortDialog((AppsListFragment) fragment, getAppTheme());
}
break;
case R.id.sortby:
if (ma != null)
GeneralDialogCreation.showSortDialog(ma, getAppTheme(), getPrefs());
break;
case R.id.dsort:
if (ma == null)
return super.onOptionsItemSelected(item);
String[] sort = getResources().getStringArray(R.array.directorysortmode);
MaterialDialog.Builder builder = new MaterialDialog.Builder(mainActivity);
builder.theme(getAppTheme().getMaterialDialogTheme());
builder.title(R.string.directorysort);
int current = Integer.parseInt(getPrefs().getString(PreferencesConstants.PREFERENCE_DIRECTORY_SORT_MODE, "0"));
final MainFragment mainFrag = ma;
builder.items(sort).itemsCallbackSingleChoice(current, (dialog1, view, which, text) -> {
getPrefs().edit().putString(PreferencesConstants.PREFERENCE_DIRECTORY_SORT_MODE, "" + which).commit();
mainFrag.getSortModes();
mainFrag.updateList();
dialog1.dismiss();
return true;
});
builder.build().show();
break;
case R.id.hiddenitems:
GeneralDialogCreation.showHiddenDialog(dataUtils, getPrefs(), ma, getAppTheme());
break;
case R.id.view:
final MainFragment mainFragment = ma;
int pathLayout = dataUtils.getListOrGridForPath(ma.getCurrentPath(), DataUtils.LIST);
if (ma.IS_LIST) {
if (pathLayout == DataUtils.LIST) {
AppConfig.runInBackground(() -> {
utilsHandler.removeListViewPath(mainFragment.getCurrentPath());
});
}
AppConfig.runInBackground(() -> {
utilsHandler.addGridView(mainFragment.getCurrentPath());
});
dataUtils.setPathAsGridOrList(ma.getCurrentPath(), DataUtils.GRID);
} else {
if (pathLayout == DataUtils.GRID) {
AppConfig.runInBackground(() -> {
utilsHandler.removeGridViewPath(mainFragment.getCurrentPath());
});
}
AppConfig.runInBackground(() -> {
utilsHandler.addListView(mainFragment.getCurrentPath());
});
dataUtils.setPathAsGridOrList(ma.getCurrentPath(), DataUtils.LIST);
}
ma.switchView();
break;
case R.id.paste:
String path = ma.getCurrentPath();
ArrayList<HybridFileParcelable> arrayList = new ArrayList<>(Arrays.asList(pasteHelper.paths));
boolean move = pasteHelper.operation == PasteHelper.OPERATION_CUT;
new PrepareCopyTask(ma, path, move, mainActivity, isRootExplorer()).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, arrayList);
pasteHelper = null;
invalidatePasteButton(item);
break;
case R.id.extract:
Fragment fragment1 = getFragmentAtFrame();
if (fragment1 instanceof CompressedExplorerFragment) {
mainActivityHelper.extractFile(((CompressedExplorerFragment) fragment1).compressedFile);
}
break;
case R.id.search:
getAppbar().getSearchView().revealSearchView();
break;
}
return super.onOptionsItemSelected(item);
}
use of com.amaze.filemanager.fragments.CompressedExplorerFragment 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);
MenuItem paste = menu.findItem(R.id.paste);
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 {
MainFragment ma = getCurrentMainFragment();
if (ma.IS_LIST)
s.setTitle(R.string.gridview);
else
s.setTitle(R.string.listview);
appbar.getBottomBar().updatePath(ma.getCurrentPath(), ma.results, MainActivityHelper.SEARCH_TEXT, ma.openMode, ma.folder_count, ma.file_count, ma);
} catch (Exception e) {
}
appbar.getBottomBar().setClickListener();
invalidatePasteButton(paste);
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);
if (getBoolean(PREFERENCE_SHOW_HIDDENFILES))
menu.findItem(R.id.hiddenitems).setVisible(true);
menu.findItem(R.id.view).setVisible(true);
menu.findItem(R.id.extract).setVisible(false);
invalidatePasteButton(menu.findItem(R.id.paste));
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 {
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);
menu.findItem(R.id.paste).setVisible(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.paste).setVisible(false);
menu.findItem(R.id.extract).setVisible(true);
}
return super.onPrepareOptionsMenu(menu);
}
Aggregations