From cfb171d488bb24b528f88a7a434fd358101a64c8 Mon Sep 17 00:00:00 2001 From: Page Asgardius Date: Thu, 8 Sep 2022 16:32:10 -0700 Subject: [PATCH] delete menu template --- .idea/misc.xml | 1 + .../page/s3manager/ObjectSelect.java | 21 ++++++++++++++++++- app/src/main/res/menu/folder_menu.xml | 9 ++++++++ app/src/main/res/menu/object_menu.xml | 3 +++ app/src/main/res/values/strings.xml | 4 +++- 5 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 app/src/main/res/menu/folder_menu.xml diff --git a/.idea/misc.xml b/.idea/misc.xml index 5a1c707..6edae9e 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -16,6 +16,7 @@ + diff --git a/app/src/main/java/asgardius/page/s3manager/ObjectSelect.java b/app/src/main/java/asgardius/page/s3manager/ObjectSelect.java index 5e9292c..e393219 100644 --- a/app/src/main/java/asgardius/page/s3manager/ObjectSelect.java +++ b/app/src/main/java/asgardius/page/s3manager/ObjectSelect.java @@ -228,7 +228,24 @@ public class ObjectSelect extends AppCompatActivity { //System.out.println("Long click on "+Name.get(position).toString()); if (Img.get(position).equals(R.drawable.folder)) { //go to subfolder - //explorer(Name.get(position).toString()); + /// Initializing the popup menu and giving the reference as current context + PopupMenu popupMenu = new PopupMenu(ObjectSelect.this, recyclerView); + + // Inflating popup menu from popup_menu.xml file + popupMenu.getMenuInflater().inflate(R.menu.folder_menu, popupMenu.getMenu()); + popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { + @Override + public boolean onMenuItemClick(MenuItem menuItem) { + // Toast message on menu item clicked + //Toast.makeText(MainActivity.this, "You Clicked " + menuItem.getTitle(), Toast.LENGTH_SHORT).show(); + if (menuItem.getTitle() == getResources().getString(R.string.file_del)) { + Toast.makeText(ObjectSelect.this, getResources().getString(R.string.pending_feature), Toast.LENGTH_SHORT).show(); + } + return true; + } + }); + // Showing the popup menu + popupMenu.show(); } else { // Initializing the popup menu and giving the reference as current context PopupMenu popupMenu = new PopupMenu(ObjectSelect.this, recyclerView); @@ -244,6 +261,8 @@ public class ObjectSelect extends AppCompatActivity { GeneratePresignedUrlRequest request = new GeneratePresignedUrlRequest(bucket, prefix + Name.get(position).toString()); URL objectURL = s3client.generatePresignedUrl(request); share(objectURL.toString()); + } else if (menuItem.getTitle() == getResources().getString(R.string.file_del)) { + Toast.makeText(ObjectSelect.this, getResources().getString(R.string.pending_feature), Toast.LENGTH_SHORT).show(); } return true; } diff --git a/app/src/main/res/menu/folder_menu.xml b/app/src/main/res/menu/folder_menu.xml new file mode 100644 index 0000000..3070ac4 --- /dev/null +++ b/app/src/main/res/menu/folder_menu.xml @@ -0,0 +1,9 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/menu/object_menu.xml b/app/src/main/res/menu/object_menu.xml index 4265ab4..90a8148 100644 --- a/app/src/main/res/menu/object_menu.xml +++ b/app/src/main/res/menu/object_menu.xml @@ -5,5 +5,8 @@ android:id="@+id/sharefile" android:title="@string/file_share" /> + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 67d49d3..de7b608 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -3,7 +3,9 @@ .amazonaws.com VideoPlayer Local database is corrupted. Please reinstall this app - Get object link + This feature is not implemented yet + Get link + Delete Please choose an account Add Account Test credentials