Remove unnecessary compat method calls.

This commit is contained in:
Isira Seneviratne 2022-05-10 07:45:01 +05:30
parent 212a413e93
commit 23c1fc3544
4 changed files with 8 additions and 11 deletions

View File

@ -29,7 +29,6 @@ import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.content.res.AppCompatResources; import androidx.appcompat.content.res.AppCompatResources;
import androidx.core.app.NotificationCompat; import androidx.core.app.NotificationCompat;
import androidx.core.app.ServiceCompat; import androidx.core.app.ServiceCompat;
import androidx.core.widget.TextViewCompat;
import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentManager;
import androidx.preference.PreferenceManager; import androidx.preference.PreferenceManager;
@ -388,7 +387,7 @@ public class RouterActivity extends AppCompatActivity {
for (final AdapterChoiceItem item : choices) { for (final AdapterChoiceItem item : choices) {
final RadioButton radioButton = ListRadioIconItemBinding.inflate(inflater).getRoot(); final RadioButton radioButton = ListRadioIconItemBinding.inflate(inflater).getRoot();
radioButton.setText(item.description); radioButton.setText(item.description);
TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds(radioButton, radioButton.setCompoundDrawablesRelativeWithIntrinsicBounds(
AppCompatResources.getDrawable(themeWrapperContext, item.icon), AppCompatResources.getDrawable(themeWrapperContext, item.icon),
null, null, null); null, null, null);
radioButton.setChecked(false); radioButton.setChecked(false);

View File

@ -88,6 +88,7 @@ import android.provider.Settings;
import android.util.DisplayMetrics; import android.util.DisplayMetrics;
import android.util.Log; import android.util.Log;
import android.util.TypedValue; import android.util.TypedValue;
import android.view.GestureDetector;
import android.view.Gravity; import android.view.Gravity;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -118,7 +119,6 @@ import androidx.appcompat.widget.PopupMenu;
import androidx.collection.ArraySet; import androidx.collection.ArraySet;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.core.graphics.Insets; import androidx.core.graphics.Insets;
import androidx.core.view.GestureDetectorCompat;
import androidx.core.view.ViewCompat; import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat; import androidx.core.view.WindowInsetsCompat;
import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentManager;
@ -387,7 +387,7 @@ public final class Player implements
private static final float MAX_GESTURE_LENGTH = 0.75f; private static final float MAX_GESTURE_LENGTH = 0.75f;
private int maxGestureLength; // scaled private int maxGestureLength; // scaled
private GestureDetectorCompat gestureDetector; private GestureDetector gestureDetector;
private PlayerGestureListener playerGestureListener; private PlayerGestureListener playerGestureListener;
/*////////////////////////////////////////////////////////////////////////// /*//////////////////////////////////////////////////////////////////////////
@ -555,7 +555,7 @@ public final class Player implements
binding.playbackLiveSync.setOnClickListener(this); binding.playbackLiveSync.setOnClickListener(this);
playerGestureListener = new PlayerGestureListener(this, service); playerGestureListener = new PlayerGestureListener(this, service);
gestureDetector = new GestureDetectorCompat(context, playerGestureListener); gestureDetector = new GestureDetector(context, playerGestureListener);
binding.getRoot().setOnTouchListener(playerGestureListener); binding.getRoot().setOnTouchListener(playerGestureListener);
binding.queueButton.setOnClickListener(v -> onQueueClicked()); binding.queueButton.setOnClickListener(v -> onQueueClicked());
@ -4428,7 +4428,7 @@ public final class Player implements
return audioReactor; return audioReactor;
} }
public GestureDetectorCompat getGestureDetector() { public GestureDetector getGestureDetector() {
return gestureDetector; return gestureDetector;
} }

View File

@ -21,7 +21,6 @@ import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.content.res.AppCompatResources; import androidx.appcompat.content.res.AppCompatResources;
import androidx.core.graphics.drawable.DrawableCompat; import androidx.core.graphics.drawable.DrawableCompat;
import androidx.core.widget.TextViewCompat;
import androidx.preference.Preference; import androidx.preference.Preference;
import androidx.preference.PreferenceViewHolder; import androidx.preference.PreferenceViewHolder;
@ -220,8 +219,8 @@ public class NotificationActionsPreference extends Preference {
android.R.attr.textColorPrimary); android.R.attr.textColorPrimary);
drawable = DrawableCompat.wrap(drawable).mutate(); drawable = DrawableCompat.wrap(drawable).mutate();
DrawableCompat.setTint(drawable, color); DrawableCompat.setTint(drawable, color);
TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds(radioButton, radioButton.setCompoundDrawablesRelativeWithIntrinsicBounds(null,
null, null, drawable, null); null, drawable, null);
} }
} }

View File

@ -29,7 +29,6 @@ import androidx.appcompat.app.AlertDialog;
import androidx.core.app.NotificationCompat; import androidx.core.app.NotificationCompat;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.core.content.FileProvider; import androidx.core.content.FileProvider;
import androidx.core.view.ViewCompat;
import androidx.recyclerview.widget.DiffUtil; import androidx.recyclerview.widget.DiffUtil;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.RecyclerView.Adapter; import androidx.recyclerview.widget.RecyclerView.Adapter;
@ -871,7 +870,7 @@ public class MissionAdapter extends Adapter<ViewHolder> implements Handler.Callb
super(view); super(view);
progress = new ProgressDrawable(); progress = new ProgressDrawable();
ViewCompat.setBackground(itemView.findViewById(R.id.item_bkg), progress); itemView.findViewById(R.id.item_bkg).setBackground(progress);
status = itemView.findViewById(R.id.item_status); status = itemView.findViewById(R.id.item_status);
name = itemView.findViewById(R.id.item_name); name = itemView.findViewById(R.id.item_name);