From 2612b829e55fcf66b865d4251ed0b1dbe7351633 Mon Sep 17 00:00:00 2001 From: Raymond Lai Date: Sat, 22 Jul 2023 16:00:36 +0800 Subject: [PATCH 1/2] Migrate widgets to use AppCompat versions where possible Fixes #3890 --- .../adapters/CompressedExplorerAdapter.java | 8 +- .../filemanager/adapters/RecyclerAdapter.java | 14 +- .../adapters/SearchRecyclerViewAdapter.kt | 6 +- .../glide/AppsAdapterPreloadModel.java | 4 +- .../filemanager/adapters/holders/AppHolder.kt | 18 +- .../holders/CompressedItemViewHolder.kt | 18 +- .../adapters/holders/DonationViewHolder.kt | 8 +- .../adapters/holders/HiddenViewHolder.kt | 10 +- .../adapters/holders/ItemViewHolder.kt | 28 +-- .../adapters/holders/SpecialViewHolder.kt | 4 +- .../asynctasks/CountItemsOrAndSizeTask.java | 6 +- .../hashcalculator/CalculateHashTask.kt | 8 +- .../asynctasks/movecopy/PrepareCopyTask.java | 4 +- .../asynchronous/services/ExtractService.java | 4 +- .../crashreport/ErrorActivity.java | 26 +-- .../filesystem/files/EncryptDecryptUtils.java | 4 +- .../com/amaze/filemanager/ui/Extensions.kt | 4 +- .../ui/activities/AboutActivity.java | 4 +- .../texteditor/TextEditorActivity.java | 14 +- .../ui/dialogs/ColorPickerDialog.java | 12 +- .../ui/dialogs/DecryptFingerprintDialog.kt | 6 +- .../ui/dialogs/DragAndDropDialog.kt | 10 +- .../ui/dialogs/GeneralDialogCreation.java | 66 +++--- .../ui/dialogs/SmbConnectDialog.java | 4 +- .../filemanager/ui/dialogs/SmbSearchDialog.kt | 10 +- .../ui/dialogs/share/ShareAdapter.java | 8 +- .../fragments/CompressedExplorerFragment.kt | 14 +- .../ui/fragments/DbViewerFragment.java | 4 +- .../ui/fragments/FtpServerFragment.kt | 22 +- .../ui/fragments/MainFragment.java | 20 +- .../filemanager/ui/fragments/TabFragment.java | 6 +- .../BookmarksPrefsFragment.kt | 7 +- .../ui/selection/SelectionPopupMenu.kt | 5 +- .../filemanager/ui/views/FastScroller.java | 4 +- .../filemanager/ui/views/ThemedTextView.java | 4 +- .../ui/views/WarnableTextInputValidator.java | 6 +- .../ui/views/appbar/BottomBar.java | 36 ++-- .../ui/views/appbar/SearchView.java | 14 +- .../views/drawer/ActionViewStateManager.java | 6 +- .../filemanager/ui/views/drawer/Drawer.java | 17 +- .../utils/MainActivityActionMode.kt | 5 +- .../filemanager/utils/MainActivityHelper.java | 19 +- .../com/amaze/filemanager/utils/Utils.java | 8 +- app/src/main/res/layout-v16/grid_header.xml | 4 +- app/src/main/res/layout-v16/list_header.xml | 4 +- app/src/main/res/layout-v21/layout_appbar.xml | 6 +- app/src/main/res/layout-v21/layout_search.xml | 8 +- .../res/layout-w500dp/properties_dialog.xml | 24 +-- .../main/res/layout-w720dp/layout_appbar.xml | 6 +- .../main/res/layout-w720dp/layout_search.xml | 8 +- .../main/res/layout-w720dp/main_toolbar.xml | 4 +- app/src/main/res/layout/actionmode.xml | 4 +- .../main/res/layout/actionmode_textviewer.xml | 10 +- app/src/main/res/layout/activity_about.xml | 194 +++++++++--------- app/src/main/res/layout/activity_error.xml | 30 +-- app/src/main/res/layout/bookmarkrow.xml | 5 +- app/src/main/res/layout/copy_dialog.xml | 6 +- ...log_decrypt_fingerprint_authentication.xml | 2 +- .../main/res/layout/dialog_twoedittexts.xml | 4 +- app/src/main/res/layout/drag_placeholder.xml | 4 +- app/src/main/res/layout/drawerheader.xml | 6 +- app/src/main/res/layout/fastscroller.xml | 13 +- app/src/main/res/layout/fragment_app_list.xml | 2 +- .../main/res/layout/fragment_db_viewer.xml | 2 +- app/src/main/res/layout/fragment_ftp.xml | 18 +- .../res/layout/fragment_open_file_dialog.xml | 12 +- .../main/res/layout/fragment_sheet_cloud.xml | 2 +- app/src/main/res/layout/grid_header.xml | 4 +- app/src/main/res/layout/griditem.xml | 9 +- app/src/main/res/layout/layout_appbar.xml | 6 +- .../res/layout/layout_draweractionview.xml | 2 +- app/src/main/res/layout/layout_search.xml | 6 +- app/src/main/res/layout/lexadrawer.xml | 8 +- app/src/main/res/layout/list_header.xml | 4 +- app/src/main/res/layout/main_frag.xml | 10 +- app/src/main/res/layout/main_toolbar.xml | 4 +- app/src/main/res/layout/permissiontable.xml | 32 +-- app/src/main/res/layout/processparent.xml | 9 +- app/src/main/res/layout/properties_audio.xml | 18 +- app/src/main/res/layout/properties_dialog.xml | 24 +-- .../main/res/layout/properties_document.xml | 62 +++--- .../main/res/layout/properties_general.xml | 30 +-- app/src/main/res/layout/properties_image.xml | 58 +++--- .../res/layout/properties_information.xml | 26 +-- app/src/main/res/layout/properties_video.xml | 18 +- app/src/main/res/layout/rowlayout.xml | 27 ++- app/src/main/res/layout/search.xml | 2 +- app/src/main/res/layout/search_row_item.xml | 4 +- app/src/main/res/layout/simplerow.xml | 4 +- app/src/main/res/layout/smb_computers_row.xml | 6 +- app/src/main/res/layout/smb_dialog.xml | 2 +- app/src/main/res/layout/snackbar_view.xml | 6 +- app/src/main/res/layout/tabfragment.xml | 4 +- .../res/layout/utilities_alias_layout.xml | 8 +- .../asynctasks/DbViewerTaskTest.java | 11 +- .../ssh/PemToKeyPairObservableRsaTest.kt | 4 +- .../ui/activities/TextEditorActivityTest.java | 4 +- .../views/WarnableTextInputValidatorTest.java | 6 +- 98 files changed, 660 insertions(+), 641 deletions(-) diff --git a/app/src/main/java/com/amaze/filemanager/adapters/CompressedExplorerAdapter.java b/app/src/main/java/com/amaze/filemanager/adapters/CompressedExplorerAdapter.java index 3917d23fb9..73b6e2bb07 100644 --- a/app/src/main/java/com/amaze/filemanager/adapters/CompressedExplorerAdapter.java +++ b/app/src/main/java/com/amaze/filemanager/adapters/CompressedExplorerAdapter.java @@ -53,10 +53,10 @@ import android.view.ViewGroup; import android.view.animation.Animation; import android.view.animation.AnimationUtils; -import android.widget.ImageButton; -import android.widget.ImageView; import android.widget.Toast; +import androidx.appcompat.widget.AppCompatImageButton; +import androidx.appcompat.widget.AppCompatImageView; import androidx.recyclerview.widget.RecyclerView; /** Created by Arpit on 25-01-2015 edited by Emmanuel Messulam */ @@ -127,7 +127,7 @@ public ArrayList getCheckedItemPositions() { * @param position the position of the item * @param imageView the circular {@link CircleGradientDrawable} that is to be animated */ - private void toggleChecked(int position, ImageView imageView) { + private void toggleChecked(int position, AppCompatImageView imageView) { compressedExplorerFragment.stopAnim(); stoppedAnimation = true; @@ -204,7 +204,7 @@ public CompressedItemViewHolder onCreateViewHolder(ViewGroup parent, int viewTyp } else if (viewType == TYPE_ITEM) { View v = mInflater.inflate(R.layout.rowlayout, parent, false); CompressedItemViewHolder vh = new CompressedItemViewHolder(v); - ImageButton about = v.findViewById(R.id.properties); + AppCompatImageButton about = v.findViewById(R.id.properties); about.setVisibility(View.INVISIBLE); return vh; } else { diff --git a/app/src/main/java/com/amaze/filemanager/adapters/RecyclerAdapter.java b/app/src/main/java/com/amaze/filemanager/adapters/RecyclerAdapter.java index 7e180188ae..bffe1cdd6c 100644 --- a/app/src/main/java/com/amaze/filemanager/adapters/RecyclerAdapter.java +++ b/app/src/main/java/com/amaze/filemanager/adapters/RecyclerAdapter.java @@ -84,15 +84,15 @@ import android.view.ViewGroup; import android.view.animation.Animation; import android.view.animation.AnimationUtils; -import android.widget.ImageView; import android.widget.PopupMenu; -import android.widget.TextView; import androidx.annotation.IntDef; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.view.ActionMode; import androidx.appcompat.view.ContextThemeWrapper; +import androidx.appcompat.widget.AppCompatImageView; +import androidx.appcompat.widget.AppCompatTextView; import androidx.recyclerview.widget.RecyclerView; /** @@ -200,7 +200,7 @@ public RecyclerAdapter( * @param position the position of the item * @param imageView the check {@link CircleGradientDrawable} that is to be animated */ - public void toggleChecked(int position, ImageView imageView) { + public void toggleChecked(int position, AppCompatImageView imageView) { if (getItemsDigested().size() <= position || position < 0) { AppConfig.toast(context, R.string.operation_not_supported); return; @@ -1192,7 +1192,7 @@ private View getDragShadow(int selectionCount) { .setVisibility(View.VISIBLE); String rememberMovePreference = sharedPrefs.getString(PreferencesConstants.PREFERENCE_DRAG_AND_DROP_REMEMBERED, ""); - ImageView icon = + AppCompatImageView icon = mainFragment .getMainActivity() .getTabFragment() @@ -1204,7 +1204,7 @@ private View getDragShadow(int selectionCount) { .getTabFragment() .getDragPlaceholder() .findViewById(R.id.files_count_parent); - TextView filesCount = + AppCompatTextView filesCount = mainFragment .getMainActivity() .getTabFragment() @@ -1238,7 +1238,7 @@ private int getDragIconReference(String rememberMovePreference) { private void showThumbnailWithBackground( ItemViewHolder viewHolder, IconDataParcelable iconData, - ImageView view, + AppCompatImageView view, OnImageProcessed errorListener) { if (iconData.isImageBroken()) { viewHolder.genericIcon.setVisibility(View.VISIBLE); @@ -1301,7 +1301,7 @@ public boolean onResourceReady( private void showRoundedThumbnail( ItemViewHolder viewHolder, IconDataParcelable iconData, - ImageView view, + AppCompatImageView view, OnImageProcessed errorListener) { if (iconData.isImageBroken()) { View iconBackground = diff --git a/app/src/main/java/com/amaze/filemanager/adapters/SearchRecyclerViewAdapter.kt b/app/src/main/java/com/amaze/filemanager/adapters/SearchRecyclerViewAdapter.kt index c523453385..d9ea4c87ce 100644 --- a/app/src/main/java/com/amaze/filemanager/adapters/SearchRecyclerViewAdapter.kt +++ b/app/src/main/java/com/amaze/filemanager/adapters/SearchRecyclerViewAdapter.kt @@ -24,7 +24,7 @@ import android.content.Context import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import android.widget.TextView +import androidx.appcompat.widget.AppCompatTextView import androidx.core.content.ContextCompat import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.ListAdapter @@ -81,8 +81,8 @@ class SearchRecyclerViewAdapter : inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view) { - val fileNameTV: TextView - val filePathTV: TextView + val fileNameTV: AppCompatTextView + val filePathTV: AppCompatTextView val colorView: View init { diff --git a/app/src/main/java/com/amaze/filemanager/adapters/glide/AppsAdapterPreloadModel.java b/app/src/main/java/com/amaze/filemanager/adapters/glide/AppsAdapterPreloadModel.java index 53d98db748..c76d130cfc 100644 --- a/app/src/main/java/com/amaze/filemanager/adapters/glide/AppsAdapterPreloadModel.java +++ b/app/src/main/java/com/amaze/filemanager/adapters/glide/AppsAdapterPreloadModel.java @@ -36,10 +36,10 @@ import android.content.Context; import android.content.pm.PackageManager; import android.graphics.drawable.Drawable; -import android.widget.ImageView; import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import androidx.appcompat.widget.AppCompatImageView; import androidx.core.content.ContextCompat; import androidx.fragment.app.Fragment; @@ -85,7 +85,7 @@ public RequestBuilder getPreloadRequestBuilder(String item) { } } - public void loadApkImage(String item, ImageView v) { + public void loadApkImage(String item, AppCompatImageView v) { if (isBottomSheet) { request.load(getApplicationIconFromPackageName(item)).into(v); } else { diff --git a/app/src/main/java/com/amaze/filemanager/adapters/holders/AppHolder.kt b/app/src/main/java/com/amaze/filemanager/adapters/holders/AppHolder.kt index f5ef96a37f..71edf51820 100644 --- a/app/src/main/java/com/amaze/filemanager/adapters/holders/AppHolder.kt +++ b/app/src/main/java/com/amaze/filemanager/adapters/holders/AppHolder.kt @@ -22,10 +22,10 @@ package com.amaze.filemanager.adapters.holders import android.view.View import android.view.ViewGroup -import android.widget.ImageButton -import android.widget.ImageView import android.widget.RelativeLayout -import android.widget.TextView +import androidx.appcompat.widget.AppCompatImageButton +import androidx.appcompat.widget.AppCompatImageView +import androidx.appcompat.widget.AppCompatTextView import androidx.core.view.marginBottom import androidx.core.view.marginLeft import androidx.core.view.marginTop @@ -36,7 +36,7 @@ import com.amaze.filemanager.utils.Utils class AppHolder(view: View) : RecyclerView.ViewHolder(view) { @JvmField - val apkIcon: ImageView = view.findViewById(R.id.apk_icon) + val apkIcon: AppCompatImageView = view.findViewById(R.id.apk_icon) @JvmField val txtTitle: ThemedTextView = view.findViewById(R.id.firstline) @@ -45,16 +45,16 @@ class AppHolder(view: View) : RecyclerView.ViewHolder(view) { val rl: RelativeLayout = view.findViewById(R.id.second) @JvmField - val txtDesc: TextView = view.findViewById(R.id.date) + val txtDesc: AppCompatTextView = view.findViewById(R.id.date) @JvmField - val about: ImageButton = view.findViewById(R.id.properties) + val about: AppCompatImageButton = view.findViewById(R.id.properties) @JvmField val summary: RelativeLayout = view.findViewById(R.id.summary) @JvmField - val packageName: TextView = view.findViewById(R.id.appManagerPackageName) + val packageName: AppCompatTextView = view.findViewById(R.id.appManagerPackageName) init { apkIcon.visibility = View.VISIBLE @@ -69,7 +69,7 @@ class AppHolder(view: View) : RecyclerView.ViewHolder(view) { ) txtDesc.layoutParams = layoutParams - view.findViewById(R.id.picture_icon).visibility = View.GONE - view.findViewById(R.id.generic_icon).visibility = View.GONE + view.findViewById(R.id.picture_icon).visibility = View.GONE + view.findViewById(R.id.generic_icon).visibility = View.GONE } } diff --git a/app/src/main/java/com/amaze/filemanager/adapters/holders/CompressedItemViewHolder.kt b/app/src/main/java/com/amaze/filemanager/adapters/holders/CompressedItemViewHolder.kt index a49cd50a0c..bf1dc4d78d 100644 --- a/app/src/main/java/com/amaze/filemanager/adapters/holders/CompressedItemViewHolder.kt +++ b/app/src/main/java/com/amaze/filemanager/adapters/holders/CompressedItemViewHolder.kt @@ -21,8 +21,8 @@ package com.amaze.filemanager.adapters.holders import android.view.View -import android.widget.ImageView -import android.widget.TextView +import androidx.appcompat.widget.AppCompatImageView +import androidx.appcompat.widget.AppCompatTextView import androidx.recyclerview.widget.RecyclerView import com.amaze.filemanager.R import com.amaze.filemanager.ui.views.ThemedTextView @@ -30,28 +30,28 @@ import com.amaze.filemanager.ui.views.ThemedTextView class CompressedItemViewHolder(view: View) : RecyclerView.ViewHolder(view) { // each data item is just a string in this case @JvmField - val pictureIcon: ImageView = view.findViewById(R.id.picture_icon) + val pictureIcon: AppCompatImageView = view.findViewById(R.id.picture_icon) @JvmField - val genericIcon: ImageView = view.findViewById(R.id.generic_icon) + val genericIcon: AppCompatImageView = view.findViewById(R.id.generic_icon) @JvmField - val apkIcon: ImageView = view.findViewById(R.id.apk_icon) + val apkIcon: AppCompatImageView = view.findViewById(R.id.apk_icon) @JvmField val txtTitle: ThemedTextView = view.findViewById(R.id.firstline) @JvmField - val txtDesc: TextView = view.findViewById(R.id.secondLine) + val txtDesc: AppCompatTextView = view.findViewById(R.id.secondLine) @JvmField - val date: TextView = view.findViewById(R.id.date) + val date: AppCompatTextView = view.findViewById(R.id.date) - val perm: TextView = view.findViewById(R.id.permis) + val perm: AppCompatTextView = view.findViewById(R.id.permis) @JvmField val rl: View = view.findViewById(R.id.second) @JvmField - val checkImageView: ImageView = view.findViewById(R.id.check_icon) + val checkImageView: AppCompatImageView = view.findViewById(R.id.check_icon) } diff --git a/app/src/main/java/com/amaze/filemanager/adapters/holders/DonationViewHolder.kt b/app/src/main/java/com/amaze/filemanager/adapters/holders/DonationViewHolder.kt index c2593c297f..21a7a223d6 100644 --- a/app/src/main/java/com/amaze/filemanager/adapters/holders/DonationViewHolder.kt +++ b/app/src/main/java/com/amaze/filemanager/adapters/holders/DonationViewHolder.kt @@ -22,7 +22,7 @@ package com.amaze.filemanager.adapters.holders import android.view.View import android.widget.LinearLayout -import android.widget.TextView +import androidx.appcompat.widget.AppCompatTextView import androidx.recyclerview.widget.RecyclerView import com.amaze.filemanager.R @@ -31,11 +31,11 @@ class DonationViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { val ROOT_VIEW: LinearLayout = itemView.findViewById(R.id.adapter_donation_root) @JvmField - val TITLE: TextView = itemView.findViewById(R.id.adapter_donation_title) + val TITLE: AppCompatTextView = itemView.findViewById(R.id.adapter_donation_title) @JvmField - val SUMMARY: TextView = itemView.findViewById(R.id.adapter_donation_summary) + val SUMMARY: AppCompatTextView = itemView.findViewById(R.id.adapter_donation_summary) @JvmField - val PRICE: TextView = itemView.findViewById(R.id.adapter_donation_price) + val PRICE: AppCompatTextView = itemView.findViewById(R.id.adapter_donation_price) } diff --git a/app/src/main/java/com/amaze/filemanager/adapters/holders/HiddenViewHolder.kt b/app/src/main/java/com/amaze/filemanager/adapters/holders/HiddenViewHolder.kt index 0b19831a9f..23cdc016d9 100644 --- a/app/src/main/java/com/amaze/filemanager/adapters/holders/HiddenViewHolder.kt +++ b/app/src/main/java/com/amaze/filemanager/adapters/holders/HiddenViewHolder.kt @@ -21,9 +21,9 @@ package com.amaze.filemanager.adapters.holders import android.view.View -import android.widget.ImageButton import android.widget.LinearLayout -import android.widget.TextView +import androidx.appcompat.widget.AppCompatImageButton +import androidx.appcompat.widget.AppCompatTextView import androidx.recyclerview.widget.RecyclerView import com.amaze.filemanager.R @@ -34,13 +34,13 @@ import com.amaze.filemanager.R */ class HiddenViewHolder(view: View) : RecyclerView.ViewHolder(view) { @JvmField - val deleteButton: ImageButton = view.findViewById(R.id.delete_button) + val deleteButton: AppCompatImageButton = view.findViewById(R.id.delete_button) @JvmField - val textTitle: TextView = view.findViewById(R.id.filename) + val textTitle: AppCompatTextView = view.findViewById(R.id.filename) @JvmField - val textDescription: TextView = view.findViewById(R.id.file_path) + val textDescription: AppCompatTextView = view.findViewById(R.id.file_path) @JvmField val row: LinearLayout = view.findViewById(R.id.bookmarkrow) diff --git a/app/src/main/java/com/amaze/filemanager/adapters/holders/ItemViewHolder.kt b/app/src/main/java/com/amaze/filemanager/adapters/holders/ItemViewHolder.kt index 3681602210..a0e1685460 100644 --- a/app/src/main/java/com/amaze/filemanager/adapters/holders/ItemViewHolder.kt +++ b/app/src/main/java/com/amaze/filemanager/adapters/holders/ItemViewHolder.kt @@ -21,10 +21,10 @@ package com.amaze.filemanager.adapters.holders import android.view.View -import android.widget.ImageButton -import android.widget.ImageView import android.widget.RelativeLayout -import android.widget.TextView +import androidx.appcompat.widget.AppCompatImageButton +import androidx.appcompat.widget.AppCompatImageView +import androidx.appcompat.widget.AppCompatTextView import androidx.recyclerview.widget.RecyclerView import com.amaze.filemanager.R import com.amaze.filemanager.ui.views.ThemedTextView @@ -36,43 +36,43 @@ import com.amaze.filemanager.ui.views.ThemedTextView class ItemViewHolder(view: View) : RecyclerView.ViewHolder(view) { // each data item is just a string in this case @JvmField - val pictureIcon: ImageView? = view.findViewById(R.id.picture_icon) + val pictureIcon: AppCompatImageView? = view.findViewById(R.id.picture_icon) @JvmField - val genericIcon: ImageView = view.findViewById(R.id.generic_icon) + val genericIcon: AppCompatImageView = view.findViewById(R.id.generic_icon) @JvmField - val apkIcon: ImageView? = view.findViewById(R.id.apk_icon) + val apkIcon: AppCompatImageView? = view.findViewById(R.id.apk_icon) @JvmField - val imageView1: ImageView? = view.findViewById(R.id.icon_thumb) + val imageView1: AppCompatImageView? = view.findViewById(R.id.icon_thumb) @JvmField val txtTitle: ThemedTextView = view.findViewById(R.id.firstline) @JvmField - val txtDesc: TextView = view.findViewById(R.id.secondLine) + val txtDesc: AppCompatTextView = view.findViewById(R.id.secondLine) @JvmField - val date: TextView = view.findViewById(R.id.date) + val date: AppCompatTextView = view.findViewById(R.id.date) @JvmField - val perm: TextView = view.findViewById(R.id.permis) + val perm: AppCompatTextView = view.findViewById(R.id.permis) @JvmField val baseItemView: View = view.findViewById(R.id.second) @JvmField - val genericText: TextView? = view.findViewById(R.id.generictext) + val genericText: AppCompatTextView? = view.findViewById(R.id.generictext) @JvmField - val about: ImageButton = view.findViewById(R.id.properties) + val about: AppCompatImageButton = view.findViewById(R.id.properties) @JvmField - val checkImageView: ImageView? = view.findViewById(R.id.check_icon) + val checkImageView: AppCompatImageView? = view.findViewById(R.id.check_icon) @JvmField - val checkImageViewGrid: ImageView? = view.findViewById(R.id.check_icon_grid) + val checkImageViewGrid: AppCompatImageView? = view.findViewById(R.id.check_icon_grid) @JvmField val iconLayout: RelativeLayout? = view.findViewById(R.id.icon_frame_grid) diff --git a/app/src/main/java/com/amaze/filemanager/adapters/holders/SpecialViewHolder.kt b/app/src/main/java/com/amaze/filemanager/adapters/holders/SpecialViewHolder.kt index ec4a3e128e..0fc7f10bb0 100644 --- a/app/src/main/java/com/amaze/filemanager/adapters/holders/SpecialViewHolder.kt +++ b/app/src/main/java/com/amaze/filemanager/adapters/holders/SpecialViewHolder.kt @@ -22,7 +22,7 @@ package com.amaze.filemanager.adapters.holders import android.content.Context import android.view.View -import android.widget.TextView +import androidx.appcompat.widget.AppCompatTextView import androidx.recyclerview.widget.RecyclerView import com.amaze.filemanager.R import com.amaze.filemanager.ui.provider.UtilitiesProvider @@ -39,7 +39,7 @@ class SpecialViewHolder( val type: Int ) : RecyclerView.ViewHolder(view) { // each data item is just a string in this case - private val txtTitle: TextView = view.findViewById(R.id.text) + private val txtTitle: AppCompatTextView = view.findViewById(R.id.text) companion object { const val HEADER_FILES = 0 diff --git a/app/src/main/java/com/amaze/filemanager/asynchronous/asynctasks/CountItemsOrAndSizeTask.java b/app/src/main/java/com/amaze/filemanager/asynchronous/asynctasks/CountItemsOrAndSizeTask.java index 2319ef3c30..a6e63e1304 100644 --- a/app/src/main/java/com/amaze/filemanager/asynchronous/asynctasks/CountItemsOrAndSizeTask.java +++ b/app/src/main/java/com/amaze/filemanager/asynchronous/asynctasks/CountItemsOrAndSizeTask.java @@ -29,8 +29,8 @@ import android.content.Context; import android.os.AsyncTask; import android.text.format.Formatter; -import android.widget.TextView; +import androidx.appcompat.widget.AppCompatTextView; import androidx.core.util.Pair; /** @@ -39,12 +39,12 @@ public class CountItemsOrAndSizeTask extends AsyncTask, String> { private Context context; - private TextView itemsText; + private AppCompatTextView itemsText; private HybridFileParcelable file; private boolean isStorage; public CountItemsOrAndSizeTask( - Context c, TextView itemsText, HybridFileParcelable f, boolean storage) { + Context c, AppCompatTextView itemsText, HybridFileParcelable f, boolean storage) { this.context = c; this.itemsText = itemsText; file = f; diff --git a/app/src/main/java/com/amaze/filemanager/asynchronous/asynctasks/hashcalculator/CalculateHashTask.kt b/app/src/main/java/com/amaze/filemanager/asynchronous/asynctasks/hashcalculator/CalculateHashTask.kt index 486c2cfacf..43e0dc27bb 100644 --- a/app/src/main/java/com/amaze/filemanager/asynchronous/asynctasks/hashcalculator/CalculateHashTask.kt +++ b/app/src/main/java/com/amaze/filemanager/asynchronous/asynctasks/hashcalculator/CalculateHashTask.kt @@ -23,8 +23,8 @@ package com.amaze.filemanager.asynchronous.asynctasks.hashcalculator import android.content.Context import android.view.View import android.widget.LinearLayout -import android.widget.TextView import android.widget.Toast +import androidx.appcompat.widget.AppCompatTextView import com.amaze.filemanager.R import com.amaze.filemanager.asynchronous.asynctasks.Task import com.amaze.filemanager.filesystem.HybridFileParcelable @@ -32,7 +32,7 @@ import com.amaze.filemanager.filesystem.files.FileUtils import org.slf4j.Logger import org.slf4j.LoggerFactory import java.lang.ref.WeakReference -import java.util.* +import java.util.Locale import java.util.concurrent.Callable data class Hash(val md5: String, val sha: String) @@ -78,8 +78,8 @@ class CalculateHashTask( val md5Text = hashes?.md5 ?: context.getString(R.string.unavailable) val shaText = hashes?.sha ?: context.getString(R.string.unavailable) - val md5HashText = view.findViewById(R.id.t9) - val sha256Text = view.findViewById(R.id.t10) + val md5HashText = view.findViewById(R.id.t9) + val sha256Text = view.findViewById(R.id.t10) val mMD5LinearLayout = view.findViewById(R.id.properties_dialog_md5) val mSHA256LinearLayout = view.findViewById(R.id.properties_dialog_sha256) diff --git a/app/src/main/java/com/amaze/filemanager/asynchronous/asynctasks/movecopy/PrepareCopyTask.java b/app/src/main/java/com/amaze/filemanager/asynchronous/asynctasks/movecopy/PrepareCopyTask.java index 4bd15f349a..9d06ddb19d 100644 --- a/app/src/main/java/com/amaze/filemanager/asynchronous/asynctasks/movecopy/PrepareCopyTask.java +++ b/app/src/main/java/com/amaze/filemanager/asynchronous/asynctasks/movecopy/PrepareCopyTask.java @@ -52,10 +52,10 @@ import android.os.AsyncTask; import android.view.LayoutInflater; import android.view.View; -import android.widget.CheckBox; import android.widget.Toast; import androidx.annotation.IntDef; +import androidx.appcompat.widget.AppCompatCheckBox; /** * This AsyncTask works by creating a tree where each folder that can be fusioned together with @@ -222,7 +222,7 @@ private void showDialog( copyDialogBinding.fileNameText.setText(conflictingFiles.get(counter).getName(context.get())); // checkBox - final CheckBox checkBox = copyDialogBinding.checkBox; + final AppCompatCheckBox checkBox = copyDialogBinding.checkBox; Utils.setTint(context.get(), checkBox, accentColor); dialogBuilder.theme(mainActivity.get().getAppTheme().getMaterialDialogTheme(context.get())); dialogBuilder.title(context.get().getResources().getString(R.string.paste)); diff --git a/app/src/main/java/com/amaze/filemanager/asynchronous/services/ExtractService.java b/app/src/main/java/com/amaze/filemanager/asynchronous/services/ExtractService.java index 74f426a53e..e836e9cb94 100644 --- a/app/src/main/java/com/amaze/filemanager/asynchronous/services/ExtractService.java +++ b/app/src/main/java/com/amaze/filemanager/asynchronous/services/ExtractService.java @@ -54,12 +54,12 @@ import android.os.AsyncTask; import android.os.IBinder; import android.text.TextUtils; -import android.widget.EditText; import android.widget.RemoteViews; import android.widget.Toast; import androidx.annotation.Nullable; import androidx.annotation.StringRes; +import androidx.appcompat.widget.AppCompatEditText; import androidx.core.app.NotificationCompat; import androidx.core.app.NotificationManagerCompat; import androidx.preference.PreferenceManager; @@ -391,7 +391,7 @@ protected void onProgressUpdate(IOException... values) { R.string.archive_password_prompt, R.string.authenticate_password, (dialog, which) -> { - EditText editText = dialog.getView().findViewById(R.id.singleedittext_input); + AppCompatEditText editText = dialog.getView().findViewById(R.id.singleedittext_input); ArchivePasswordCache.getInstance().put(compressedPath, editText.getText().toString()); ExtractService.this.getDataPackages().clear(); this.paused = false; diff --git a/app/src/main/java/com/amaze/filemanager/crashreport/ErrorActivity.java b/app/src/main/java/com/amaze/filemanager/crashreport/ErrorActivity.java index ade83ff7b2..7921a34c40 100644 --- a/app/src/main/java/com/amaze/filemanager/crashreport/ErrorActivity.java +++ b/app/src/main/java/com/amaze/filemanager/crashreport/ErrorActivity.java @@ -58,13 +58,13 @@ import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; -import android.widget.Button; -import android.widget.EditText; -import android.widget.TextView; import android.widget.Toast; import androidx.annotation.StringRes; import androidx.appcompat.app.ActionBar; +import androidx.appcompat.widget.AppCompatButton; +import androidx.appcompat.widget.AppCompatEditText; +import androidx.appcompat.widget.AppCompatTextView; import androidx.appcompat.widget.Toolbar; import androidx.core.app.NavUtils; @@ -109,7 +109,7 @@ public class ErrorActivity extends ThemedActivity { private ErrorInfo errorInfo; private Class returnActivity; private String currentTimeStamp; - private EditText userCommentBox; + private AppCompatEditText userCommentBox; public static void reportError( final Context context, @@ -197,14 +197,14 @@ public void onCreate(final Bundle savedInstanceState) { actionBar.setDisplayShowTitleEnabled(true); } - final Button reportEmailButton = findViewById(R.id.errorReportEmailButton); - final Button reportTelegramButton = findViewById(R.id.errorReportTelegramButton); - final Button copyButton = findViewById(R.id.errorReportCopyButton); - final Button reportGithubButton = findViewById(R.id.errorReportGitHubButton); + final AppCompatButton reportEmailButton = findViewById(R.id.errorReportEmailButton); + final AppCompatButton reportTelegramButton = findViewById(R.id.errorReportTelegramButton); + final AppCompatButton copyButton = findViewById(R.id.errorReportCopyButton); + final AppCompatButton reportGithubButton = findViewById(R.id.errorReportGitHubButton); userCommentBox = findViewById(R.id.errorCommentBox); - final TextView errorView = findViewById(R.id.errorView); - final TextView errorMessageView = findViewById(R.id.errorMessageView); + final AppCompatTextView errorView = findViewById(R.id.errorView); + final AppCompatTextView errorMessageView = findViewById(R.id.errorMessageView); returnActivity = MainActivity.class; errorInfo = intent.getParcelableExtra(ERROR_INFO); @@ -306,8 +306,8 @@ private void goToReturnActivity() { } private void buildInfo(final ErrorInfo info) { - final TextView infoLabelView = findViewById(R.id.errorInfoLabelsView); - final TextView infoView = findViewById(R.id.errorInfosView); + final AppCompatTextView infoLabelView = findViewById(R.id.errorInfoLabelsView); + final AppCompatTextView infoView = findViewById(R.id.errorInfosView); String text = ""; infoLabelView.setText(getString(R.string.info_labels).replace("\\n", "\n")); @@ -440,7 +440,7 @@ private String getOsString() { private void addGuruMeditation() { // just an easter egg - final TextView sorryView = findViewById(R.id.errorSorryView); + final AppCompatTextView sorryView = findViewById(R.id.errorSorryView); String text = sorryView.getText().toString(); text += "\n" + getString(R.string.guru_meditation); sorryView.setText(text); diff --git a/app/src/main/java/com/amaze/filemanager/filesystem/files/EncryptDecryptUtils.java b/app/src/main/java/com/amaze/filemanager/filesystem/files/EncryptDecryptUtils.java index b2418779c6..8744369041 100644 --- a/app/src/main/java/com/amaze/filemanager/filesystem/files/EncryptDecryptUtils.java +++ b/app/src/main/java/com/amaze/filemanager/filesystem/files/EncryptDecryptUtils.java @@ -50,10 +50,10 @@ import android.content.SharedPreferences; import android.os.Build; import android.util.Base64; -import android.widget.EditText; import android.widget.Toast; import androidx.annotation.NonNull; +import androidx.appcompat.widget.AppCompatEditText; import androidx.preference.PreferenceManager; /** @@ -114,7 +114,7 @@ public static void decryptFile( R.string.crypt_decrypt, R.string.authenticate_password, (dialog, which) -> { - EditText editText = dialog.getView().findViewById(R.id.singleedittext_input); + AppCompatEditText editText = dialog.getView().findViewById(R.id.singleedittext_input); decryptIntent.putExtra(EncryptService.TAG_PASSWORD, editText.getText().toString()); ServiceWatcherUtil.runService(main.getContext(), decryptIntent); dialog.dismiss(); diff --git a/app/src/main/java/com/amaze/filemanager/ui/Extensions.kt b/app/src/main/java/com/amaze/filemanager/ui/Extensions.kt index 8b2b0f8013..98d28b1d7f 100644 --- a/app/src/main/java/com/amaze/filemanager/ui/Extensions.kt +++ b/app/src/main/java/com/amaze/filemanager/ui/Extensions.kt @@ -27,8 +27,8 @@ import android.content.pm.PackageManager import android.text.TextUtils import android.view.View import android.view.inputmethod.InputMethodManager -import android.widget.EditText import android.widget.Toast +import androidx.appcompat.widget.AppCompatEditText import com.amaze.filemanager.R import com.amaze.filemanager.application.AppConfig import com.google.android.material.textfield.TextInputLayout @@ -82,7 +82,7 @@ fun Context.updateAUAlias(shouldEnable: Boolean) { /** * Force keyboard pop up on focus */ -fun EditText.openKeyboard(context: Context) { +fun AppCompatEditText.openKeyboard(context: Context) { this.requestFocus() this.postDelayed( diff --git a/app/src/main/java/com/amaze/filemanager/ui/activities/AboutActivity.java b/app/src/main/java/com/amaze/filemanager/ui/activities/AboutActivity.java index 5bd40d7128..7c35f30838 100644 --- a/app/src/main/java/com/amaze/filemanager/ui/activities/AboutActivity.java +++ b/app/src/main/java/com/amaze/filemanager/ui/activities/AboutActivity.java @@ -49,9 +49,9 @@ import android.os.Bundle; import android.view.MenuItem; import android.view.View; -import android.widget.TextView; import androidx.annotation.Nullable; +import androidx.appcompat.widget.AppCompatTextView; import androidx.appcompat.widget.Toolbar; import androidx.coordinatorlayout.widget.CoordinatorLayout; import androidx.core.content.FileProvider; @@ -66,7 +66,7 @@ public class AboutActivity extends ThemedActivity implements View.OnClickListene private AppBarLayout mAppBarLayout; private CollapsingToolbarLayout mCollapsingToolbarLayout; - private TextView mTitleTextView; + private AppCompatTextView mTitleTextView; private View mAuthorsDivider, mDeveloper1Divider; private Billing billing; diff --git a/app/src/main/java/com/amaze/filemanager/ui/activities/texteditor/TextEditorActivity.java b/app/src/main/java/com/amaze/filemanager/ui/activities/texteditor/TextEditorActivity.java index 51f86a430e..f3bebaf489 100644 --- a/app/src/main/java/com/amaze/filemanager/ui/activities/texteditor/TextEditorActivity.java +++ b/app/src/main/java/com/amaze/filemanager/ui/activities/texteditor/TextEditorActivity.java @@ -70,20 +70,20 @@ import android.view.animation.AccelerateDecelerateInterpolator; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputMethodManager; -import android.widget.EditText; -import android.widget.ImageButton; import android.widget.RelativeLayout; import android.widget.ScrollView; import android.widget.Toast; import androidx.annotation.ColorInt; +import androidx.appcompat.widget.AppCompatEditText; +import androidx.appcompat.widget.AppCompatImageButton; import androidx.lifecycle.ViewModelProvider; public class TextEditorActivity extends ThemedActivity implements TextWatcher, View.OnClickListener { - public EditText mainTextView; - public EditText searchEditText; + public AppCompatEditText mainTextView; + public AppCompatEditText searchEditText; private Typeface inputTypefaceDefault; private Typeface inputTypefaceMono; private androidx.appcompat.widget.Toolbar toolbar; @@ -96,9 +96,9 @@ public class TextEditorActivity extends ThemedActivity private static final String KEY_MONOFONT = "monofont"; private RelativeLayout searchViewLayout; - public ImageButton upButton; - public ImageButton downButton; - public ImageButton closeButton; + public AppCompatImageButton upButton; + public AppCompatImageButton downButton; + public AppCompatImageButton closeButton; private Snackbar loadingSnackbar; diff --git a/app/src/main/java/com/amaze/filemanager/ui/dialogs/ColorPickerDialog.java b/app/src/main/java/com/amaze/filemanager/ui/dialogs/ColorPickerDialog.java index 18aa5742b3..977ba264e4 100644 --- a/app/src/main/java/com/amaze/filemanager/ui/dialogs/ColorPickerDialog.java +++ b/app/src/main/java/com/amaze/filemanager/ui/dialogs/ColorPickerDialog.java @@ -43,10 +43,10 @@ import android.view.View; import android.widget.LinearLayout; import android.widget.RadioButton; -import android.widget.TextView; import androidx.annotation.NonNull; import androidx.annotation.StringRes; +import androidx.appcompat.widget.AppCompatTextView; import androidx.core.util.Pair; import androidx.preference.Preference.BaseSavedState; import androidx.preference.PreferenceDialogFragmentCompat; @@ -167,7 +167,7 @@ public void onBindDialogView(View view) { select(selectedItem, true); } - ((TextView) child.findViewById(R.id.text)).setText(COLORS[i].first); + ((AppCompatTextView) child.findViewById(R.id.text)).setText(COLORS[i].first); CircularColorsView colorsView = child.findViewById(R.id.circularColorsView); colorsView.setColors(getColor(i, 0), getColor(i, 1), getColor(i, 2), getColor(i, 3)); AppTheme appTheme = @@ -185,7 +185,7 @@ public void onBindDialogView(View view) { select(selectedItem, true); } - ((TextView) child.findViewById(R.id.text)).setText(R.string.custom); + ((AppCompatTextView) child.findViewById(R.id.text)).setText(R.string.custom); child.findViewById(R.id.circularColorsView).setVisibility(View.INVISIBLE); container.addView(child); } @@ -197,7 +197,7 @@ public void onBindDialogView(View view) { select(selectedItem, true); } - ((TextView) child.findViewById(R.id.text)).setText(R.string.random); + ((AppCompatTextView) child.findViewById(R.id.text)).setText(R.string.random); child.findViewById(R.id.circularColorsView).setVisibility(View.INVISIBLE); container.addView(child); } @@ -249,9 +249,9 @@ public Dialog onCreateDialog(Bundle savedInstanceState) { ((UserColorPreferences) requireArguments().getParcelable(ARG_COLOR_PREF)).getAccent(); // Button views - ((TextView) dialog.findViewById(res.getIdentifier("button1", "id", "android"))) + ((AppCompatTextView) dialog.findViewById(res.getIdentifier("button1", "id", "android"))) .setTextColor(accentColor); - ((TextView) dialog.findViewById(res.getIdentifier("button2", "id", "android"))) + ((AppCompatTextView) dialog.findViewById(res.getIdentifier("button2", "id", "android"))) .setTextColor(accentColor); return dialog; diff --git a/app/src/main/java/com/amaze/filemanager/ui/dialogs/DecryptFingerprintDialog.kt b/app/src/main/java/com/amaze/filemanager/ui/dialogs/DecryptFingerprintDialog.kt index 149a24a319..5647c930de 100644 --- a/app/src/main/java/com/amaze/filemanager/ui/dialogs/DecryptFingerprintDialog.kt +++ b/app/src/main/java/com/amaze/filemanager/ui/dialogs/DecryptFingerprintDialog.kt @@ -25,8 +25,8 @@ import android.content.Intent import android.hardware.fingerprint.FingerprintManager import android.os.Build import android.view.View -import android.widget.Button import androidx.annotation.RequiresApi +import androidx.appcompat.widget.AppCompatButton import com.afollestad.materialdialogs.MaterialDialog import com.amaze.filemanager.R import com.amaze.filemanager.filesystem.files.CryptUtil @@ -62,7 +62,9 @@ object DecryptFingerprintDialog { val builder = MaterialDialog.Builder(c) builder.title(c.getString(R.string.crypt_decrypt)) val rootView = View.inflate(c, R.layout.dialog_decrypt_fingerprint_authentication, null) - val cancelButton = rootView.findViewById