Skip to content

Commit

Permalink
Merge pull request #3891 from TranceLove/feature/migrate-to-appcompat…
Browse files Browse the repository at this point in the history
…-widgets

Migrate widgets to use AppCompat versions where possible
  • Loading branch information
VishalNehra authored Jul 23, 2023
2 parents bc7d182 + 79e68fe commit 8b86e7c
Show file tree
Hide file tree
Showing 98 changed files with 662 additions and 643 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<[email protected]> */
Expand Down Expand Up @@ -127,7 +127,7 @@ public ArrayList<Integer> 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;

Expand Down Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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()
Expand All @@ -1204,7 +1204,7 @@ private View getDragShadow(int selectionCount) {
.getTabFragment()
.getDragPlaceholder()
.findViewById(R.id.files_count_parent);
TextView filesCount =
AppCompatTextView filesCount =
mainFragment
.getMainActivity()
.getTabFragment()
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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 =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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
Expand All @@ -69,7 +69,7 @@ class AppHolder(view: View) : RecyclerView.ViewHolder(view) {
)
txtDesc.layoutParams = layoutParams

view.findViewById<ImageView>(R.id.picture_icon).visibility = View.GONE
view.findViewById<ImageView>(R.id.generic_icon).visibility = View.GONE
view.findViewById<AppCompatImageView>(R.id.picture_icon).visibility = View.GONE
view.findViewById<AppCompatImageView>(R.id.generic_icon).visibility = View.GONE
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,37 +21,37 @@
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

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)
}
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)
}
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand All @@ -39,12 +39,12 @@
public class CountItemsOrAndSizeTask extends AsyncTask<Void, Pair<Integer, Long>, 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;
Expand Down
Loading

0 comments on commit 8b86e7c

Please sign in to comment.