From 1be7ec0aa51e6e16308fbfa18c6e4b608af05f7f Mon Sep 17 00:00:00 2001 From: yashwanthgajji Date: Thu, 5 Dec 2024 20:34:59 -0500 Subject: [PATCH] spotless changes --- .../amaze/filemanager/ui/ItemPopupMenu.java | 14 +++--- .../filemanager/ui/fragments/TabFragment.java | 47 +++++++++---------- .../utils/MainActivityActionMode.kt | 11 +++-- .../filemanager/utils/MainActivityHelper.java | 14 +++--- 4 files changed, 43 insertions(+), 43 deletions(-) diff --git a/app/src/main/java/com/amaze/filemanager/ui/ItemPopupMenu.java b/app/src/main/java/com/amaze/filemanager/ui/ItemPopupMenu.java index a1fdaf3a8c..826cb14078 100644 --- a/app/src/main/java/com/amaze/filemanager/ui/ItemPopupMenu.java +++ b/app/src/main/java/com/amaze/filemanager/ui/ItemPopupMenu.java @@ -157,18 +157,18 @@ public boolean onMenuItemClick(MenuItem item) { case R.id.delete: ArrayList positions = new ArrayList<>(); positions.add(rowItem); - SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); - boolean deletePermanently = sharedPreferences.getBoolean( + SharedPreferences sharedPreferences = + PreferenceManager.getDefaultSharedPreferences(context); + boolean deletePermanently = + sharedPreferences.getBoolean( PreferencesConstants.PREFERENCE_DELETE_PERMANENTLY_WITHOUT_CONFIRMATION, - PreferencesConstants.DEFAULT_PREFERENCE_DELETE_PERMANENTLY_WITHOUT_CONFIRMATION - ); + PreferencesConstants.DEFAULT_PREFERENCE_DELETE_PERMANENTLY_WITHOUT_CONFIRMATION); if (deletePermanently) { - Toast.makeText(context, context.getString(R.string.deleting), Toast.LENGTH_SHORT) - .show(); + Toast.makeText(context, context.getString(R.string.deleting), Toast.LENGTH_SHORT).show(); mainActivity.mainActivityHelper.deleteFilesPermanently(positions); } else { GeneralDialogCreation.deleteFilesDialog( - context, mainActivity, positions, utilitiesProvider.getAppTheme()); + context, mainActivity, positions, utilitiesProvider.getAppTheme()); } return true; case R.id.restore: diff --git a/app/src/main/java/com/amaze/filemanager/ui/fragments/TabFragment.java b/app/src/main/java/com/amaze/filemanager/ui/fragments/TabFragment.java index 1bada9abc4..7fda33a207 100644 --- a/app/src/main/java/com/amaze/filemanager/ui/fragments/TabFragment.java +++ b/app/src/main/java/com/amaze/filemanager/ui/fragments/TabFragment.java @@ -32,7 +32,6 @@ import org.slf4j.LoggerFactory; import com.amaze.filemanager.R; -import com.amaze.filemanager.adapters.data.LayoutElementParcelable; import com.amaze.filemanager.application.AppConfig; import com.amaze.filemanager.database.TabHandler; import com.amaze.filemanager.database.models.explorer.Tab; @@ -508,29 +507,29 @@ private void initLeftAndRightDragListeners(boolean destroy) { new DragToTrashListener( () -> { if (mainFragment != null) { - SharedPreferences sharedPreferences = - PreferenceManager.getDefaultSharedPreferences(requireContext()); - boolean deletePermanently = sharedPreferences.getBoolean( - PreferencesConstants.PREFERENCE_DELETE_PERMANENTLY_WITHOUT_CONFIRMATION, - PreferencesConstants.DEFAULT_PREFERENCE_DELETE_PERMANENTLY_WITHOUT_CONFIRMATION - ); - if (deletePermanently) { - Toast.makeText( - requireContext(), - requireContext().getString(R.string.deleting), - Toast.LENGTH_SHORT - ).show(); - requireMainActivity().mainActivityHelper.deleteFilesPermanently( - mainFragment.adapter.getCheckedItems() - ); - } else { - GeneralDialogCreation.deleteFilesDialog( - requireContext(), - requireMainActivity(), - mainFragment.adapter.getCheckedItems(), - requireMainActivity().getAppTheme() - ); - } + SharedPreferences sharedPreferences = + PreferenceManager.getDefaultSharedPreferences(requireContext()); + boolean deletePermanently = + sharedPreferences.getBoolean( + PreferencesConstants.PREFERENCE_DELETE_PERMANENTLY_WITHOUT_CONFIRMATION, + PreferencesConstants + .DEFAULT_PREFERENCE_DELETE_PERMANENTLY_WITHOUT_CONFIRMATION); + if (deletePermanently) { + Toast.makeText( + requireContext(), + requireContext().getString(R.string.deleting), + Toast.LENGTH_SHORT) + .show(); + requireMainActivity() + .mainActivityHelper + .deleteFilesPermanently(mainFragment.adapter.getCheckedItems()); + } else { + GeneralDialogCreation.deleteFilesDialog( + requireContext(), + requireMainActivity(), + mainFragment.adapter.getCheckedItems(), + requireMainActivity().getAppTheme()); + } } else { AppConfig.toast(requireContext(), getString(R.string.operation_unsuccesful)); } diff --git a/app/src/main/java/com/amaze/filemanager/utils/MainActivityActionMode.kt b/app/src/main/java/com/amaze/filemanager/utils/MainActivityActionMode.kt index 6f94cc3f5c..7847025441 100644 --- a/app/src/main/java/com/amaze/filemanager/utils/MainActivityActionMode.kt +++ b/app/src/main/java/com/amaze/filemanager/utils/MainActivityActionMode.kt @@ -241,15 +241,16 @@ class MainActivityActionMode(private val mainActivityReference: WeakReference { val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(mainActivity) - val deletePermanently = sharedPreferences.getBoolean( - PreferencesConstants.PREFERENCE_DELETE_PERMANENTLY_WITHOUT_CONFIRMATION, - PreferencesConstants.DEFAULT_PREFERENCE_DELETE_PERMANENTLY_WITHOUT_CONFIRMATION - ) + val deletePermanently = + sharedPreferences.getBoolean( + PreferencesConstants.PREFERENCE_DELETE_PERMANENTLY_WITHOUT_CONFIRMATION, + PreferencesConstants.DEFAULT_PREFERENCE_DELETE_PERMANENTLY_WITHOUT_CONFIRMATION, + ) if (deletePermanently) { Toast.makeText( mainActivity, mainActivity.getString(R.string.deleting), - Toast.LENGTH_SHORT + Toast.LENGTH_SHORT, ).show() mainActivity.mainActivityHelper.deleteFilesPermanently(checkedItems) } else { diff --git a/app/src/main/java/com/amaze/filemanager/utils/MainActivityHelper.java b/app/src/main/java/com/amaze/filemanager/utils/MainActivityHelper.java index c1a4ef1df5..db83fb222c 100644 --- a/app/src/main/java/com/amaze/filemanager/utils/MainActivityHelper.java +++ b/app/src/main/java/com/amaze/filemanager/utils/MainActivityHelper.java @@ -686,14 +686,14 @@ public void deleteFiles(ArrayList files, boolean doDeleteP else Toast.makeText(mainActivity, R.string.not_allowed, Toast.LENGTH_SHORT).show(); } - public void deleteFilesPermanently(ArrayList files) { - final ArrayList itemsToDelete = new ArrayList<>(); - for (int i = 0; i < files.size(); i++) { - final LayoutElementParcelable layoutElement = files.get(i); - itemsToDelete.add(layoutElement.generateBaseFile()); - } - deleteFiles(itemsToDelete, true); + public void deleteFilesPermanently(ArrayList files) { + final ArrayList itemsToDelete = new ArrayList<>(); + for (int i = 0; i < files.size(); i++) { + final LayoutElementParcelable layoutElement = files.get(i); + itemsToDelete.add(layoutElement.generateBaseFile()); } + deleteFiles(itemsToDelete, true); + } public void extractFile(@NonNull File file) { final File parent = file.getParentFile();