mirror of
https://github.com/f-droid/fdroidclient.git
synced 2025-12-23 23:27:44 -05:00
Clean up deprecated code
This commit is contained in:
@@ -4,9 +4,10 @@ import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Rect;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import org.fdroid.fdroid.R;
|
||||
|
||||
public class LatestLayoutPolicy {
|
||||
@@ -81,7 +82,7 @@ public class LatestLayoutPolicy {
|
||||
// will only have padding on the right. This will allow the same amount of padding
|
||||
// on the left, centre, and right of the grid, rather than double the padding in the
|
||||
// middle (which would happen if both left and right padding was set for both items).
|
||||
boolean isLtr = ViewCompat.getLayoutDirection(parent) == ViewCompat.LAYOUT_DIRECTION_LTR;
|
||||
boolean isLtr = parent.getLayoutDirection() == View.LAYOUT_DIRECTION_LTR;
|
||||
boolean isAtStart = relativePositionInCycle == 1 || relativePositionInCycle == 3;
|
||||
int paddingStart = isAtStart ? horizontalPadding : 0;
|
||||
int paddingLeft = isLtr ? paddingStart : horizontalPadding;
|
||||
|
||||
@@ -42,7 +42,6 @@ import android.widget.TextView;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.graphics.drawable.DrawableCompat;
|
||||
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
|
||||
@@ -129,9 +128,8 @@ public class AppSecurityPermissions {
|
||||
}
|
||||
|
||||
Preferences.Theme theme = Preferences.get().getTheme();
|
||||
Drawable wrappedIconDrawable = DrawableCompat.wrap(iconDrawable).mutate();
|
||||
DrawableCompat.setTint(wrappedIconDrawable, theme == Preferences.Theme.light ? Color.BLACK : Color.WHITE);
|
||||
return wrappedIconDrawable;
|
||||
iconDrawable.setTint(theme == Preferences.Theme.light ? Color.BLACK : Color.WHITE);
|
||||
return iconDrawable;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.annotation.SuppressLint;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Rect;
|
||||
@@ -38,12 +39,10 @@ import androidx.compose.ui.platform.ComposeView;
|
||||
import androidx.compose.ui.platform.ViewCompositionStrategy;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.content.FileProvider;
|
||||
import androidx.core.graphics.drawable.DrawableCompat;
|
||||
import androidx.core.os.ConfigurationCompat;
|
||||
import androidx.core.os.LocaleListCompat;
|
||||
import androidx.core.text.HtmlCompat;
|
||||
import androidx.core.text.util.LinkifyCompat;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.widget.TextViewCompat;
|
||||
import androidx.gridlayout.widget.GridLayout;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
@@ -500,7 +499,7 @@ public class AppDetailsRecyclerViewAdapter
|
||||
descriptionView.setEllipsize(TextUtils.TruncateAt.MARQUEE);
|
||||
descriptionMoreView.setOnClickListener(v -> {
|
||||
TransitionManager.beginDelayedTransition(recyclerView, null);
|
||||
if (TextViewCompat.getMaxLines(descriptionView) != MAX_LINES) {
|
||||
if (descriptionView.getMaxLines() != MAX_LINES) {
|
||||
descriptionView.setMaxLines(MAX_LINES);
|
||||
descriptionMoreView.setText(R.string.more);
|
||||
descriptionIsExpanded = false;
|
||||
@@ -964,7 +963,7 @@ public class AppDetailsRecyclerViewAdapter
|
||||
Drawable iconDrawable = ContextCompat.getDrawable(headerView.getContext(), icon);
|
||||
final Drawable expandLess = ContextCompat.getDrawable(headerView.getContext(), R.drawable.ic_expand_less);
|
||||
final Drawable expandMore = ContextCompat.getDrawable(headerView.getContext(), R.drawable.ic_expand_more);
|
||||
TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds(headerView,
|
||||
headerView.setCompoundDrawablesRelativeWithIntrinsicBounds(
|
||||
iconDrawable, null, isExpanded ? expandLess : expandMore, null);
|
||||
}
|
||||
}
|
||||
@@ -997,11 +996,8 @@ public class AppDetailsRecyclerViewAdapter
|
||||
NoVersionsViewHolder(View view) {
|
||||
super(view);
|
||||
headerView = view.findViewById(R.id.information);
|
||||
final Drawable versions = ContextCompat.getDrawable(headerView.getContext(), R.drawable.ic_versions);
|
||||
final Drawable accessTime = DrawableCompat.wrap(Objects.requireNonNull(versions)).mutate();
|
||||
DrawableCompat.setTint(accessTime, Color.parseColor("#B4B4B4"));
|
||||
TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds(headerView,
|
||||
accessTime, null, null, null);
|
||||
headerView.setCompoundDrawablesRelativeWithIntrinsicBounds(R.drawable.ic_versions, 0, 0, 0);
|
||||
TextViewCompat.setCompoundDrawableTintList(headerView, ColorStateList.valueOf(Color.parseColor("#B4B4B4")));
|
||||
itemView.setOnClickListener(v -> explainIncompatibleVersions());
|
||||
}
|
||||
|
||||
@@ -1214,7 +1210,7 @@ public class AppDetailsRecyclerViewAdapter
|
||||
|
||||
int margin = context.getResources().getDimensionPixelSize(R.dimen.layout_horizontal_margin);
|
||||
int padding = context.getResources().getDimensionPixelSize(R.dimen.details_activity_padding);
|
||||
ViewCompat.setPaddingRelative(view, margin + padding + ViewCompat.getPaddingStart(view), view.getPaddingTop(), margin + ViewCompat.getPaddingEnd(view), view.getPaddingBottom());
|
||||
view.setPaddingRelative(margin + padding + view.getPaddingStart(), view.getPaddingTop(), margin + view.getPaddingEnd(), view.getPaddingBottom());
|
||||
}
|
||||
|
||||
void bindModel(final Apk apk) {
|
||||
@@ -1480,7 +1476,7 @@ public class AppDetailsRecyclerViewAdapter
|
||||
text = parent.getContext().getString(resIdText, formatArg);
|
||||
}
|
||||
view.setText(text);
|
||||
TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds(view, resIdDrawable, 0, 0, 0);
|
||||
view.setCompoundDrawablesRelativeWithIntrinsicBounds(resIdDrawable, 0, 0, 0);
|
||||
parent.addView(view);
|
||||
view.setOnClickListener(v -> onLinkClicked(url));
|
||||
view.setOnLongClickListener(v -> {
|
||||
|
||||
@@ -16,7 +16,6 @@ import androidx.annotation.ColorInt;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.os.LocaleListCompat;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
@@ -176,7 +175,7 @@ public class CategoryController extends RecyclerView.ViewHolder {
|
||||
R.dimen.category_preview__app_list__padding__horizontal__first);
|
||||
int horizontalPaddingLast = (int) r.getDimension(
|
||||
R.dimen.category_preview__app_list__padding__horizontal__last);
|
||||
boolean isLtr = ViewCompat.getLayoutDirection(parent) == ViewCompat.LAYOUT_DIRECTION_LTR;
|
||||
boolean isLtr = parent.getLayoutDirection() == View.LAYOUT_DIRECTION_LTR;
|
||||
int itemPosition = parent.getChildLayoutPosition(view);
|
||||
boolean first = itemPosition == 0;
|
||||
boolean end = itemPosition == NUM_OF_APPS_PER_CATEGORY_ON_OVERVIEW - 1;
|
||||
|
||||
Reference in New Issue
Block a user