Skip to content

Commit

Permalink
[WIP] Add context menu "Open in Terminal" option
Browse files Browse the repository at this point in the history
  • Loading branch information
TranceLove committed Apr 25, 2023
1 parent b5199ff commit 9d76e88
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1386,12 +1386,14 @@ private void showPopup(@NonNull View view, @NonNull final LayoutElementParcelabl
if (rowItem.isDirectory) {
popupMenu.getMenu().findItem(R.id.open_with).setVisible(false);
popupMenu.getMenu().findItem(R.id.share).setVisible(false);
popupMenu.getMenu().findItem(R.id.open_in_terminal).setVisible(true);

if (mainFragment.getMainActivity().mReturnIntent) {
popupMenu.getMenu().findItem(R.id.return_select).setVisible(true);
}
} else {
popupMenu.getMenu().findItem(R.id.book).setVisible(false);
popupMenu.getMenu().findItem(R.id.open_in_terminal).setVisible(false);

if (description.endsWith(fileExtensionZip)
|| description.endsWith(fileExtensionJar)
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/java/com/amaze/filemanager/ui/ItemPopupMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,9 @@ public void onButtonPressed(Intent intent, String password)
return true;
case R.id.return_select:
mainFragment.returnIntentResults(rowItem.generateBaseFile());
return true;
case R.id.open_in_terminal:

return true;
}
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1087,6 +1087,7 @@ public boolean onPrepareOptionsMenu(Menu menu) {
menu.findItem(R.id.hiddenitems).setVisible(true);
menu.findItem(R.id.view).setVisible(true);
menu.findItem(R.id.extract).setVisible(false);
menu.findItem(R.id.open_in_terminal).setVisible(true);
invalidatePasteSnackbar(true);
findViewById(R.id.buttonbarframe).setVisibility(View.VISIBLE);
} else if (fragment instanceof AppsListFragment
Expand All @@ -1100,6 +1101,7 @@ public boolean onPrepareOptionsMenu(Menu menu) {
menu.findItem(R.id.home).setVisible(false);
menu.findItem(R.id.history).setVisible(false);
menu.findItem(R.id.extract).setVisible(false);
menu.findItem(R.id.open_in_terminal).setVisible(false);
if (fragment instanceof ProcessViewerFragment) {
menu.findItem(R.id.sort).setVisible(false);
} else if (fragment instanceof FtpServerFragment) {
Expand All @@ -1123,6 +1125,7 @@ public boolean onPrepareOptionsMenu(Menu menu) {
menu.findItem(R.id.hiddenitems).setVisible(false);
menu.findItem(R.id.view).setVisible(false);
menu.findItem(R.id.extract).setVisible(true);
menu.findItem(R.id.open_in_terminal).setVisible(false);
invalidatePasteSnackbar(false);
}
return super.onPrepareOptionsMenu(menu);
Expand Down Expand Up @@ -1259,6 +1262,11 @@ public boolean onOptionsItemSelected(MenuItem item) {
case R.id.search:
getAppbar().getSearchView().revealSearchView();
break;
case R.id.open_in_terminal:
if (getFragmentAtFrame() instanceof MainFragment) {

}
break;
}
return null;
},
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/res/menu/activity_extra.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@
<item
android:id="@+id/sethome"
android:title="@string/set_as_home"/>
<item
android:id="@+id/open_in_terminal"
android:title="@string/open_in_terminal"/>
<item
android:id="@+id/extract"
android:title="@string/extract"
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/res/menu/item_extras.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,7 @@
<item
android:id="@+id/book"
android:title="@string/add_to_bookmarks" />
<item
android:id="@+id/open_in_terminal"
android:title="@string/open_in_terminal" />
</menu>
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
<string name="about">About</string>
<string name="extract">Extract</string>
<string name="compress">Compress</string>
<string name="open_in_terminal">Open in Terminal</string>
<string name="yes">Yes</string>
<string name="no">No</string>
<string name="info_glyph" translatable="false">&#9432;</string>
Expand Down

0 comments on commit 9d76e88

Please sign in to comment.