mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-19 01:27:18 -04:00
Fix[gamepad_remapper]: use setBackgroundColor instead of creating ColorDrawable, add settings entry
This commit is contained in:
parent
beb58d72eb
commit
1513156262
@ -3,7 +3,6 @@ package net.kdt.pojavlaunch.customcontrols.gamepad;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@ -156,7 +155,6 @@ public class GamepadMapperAdapter extends RecyclerView.Adapter<GamepadMapperAdap
|
||||
public class ViewHolder extends RecyclerView.ViewHolder implements AdapterView.OnItemSelectedListener, View.OnClickListener {
|
||||
private static final int COLOR_ACTIVE_BUTTON = 0x2000FF00;
|
||||
private final Context mContext;
|
||||
private final ColorDrawable mBackgroundDrawable;
|
||||
private final ImageView mButtonIcon;
|
||||
private final ImageView mExpansionIndicator;
|
||||
private final Spinner[] mKeySpinners;
|
||||
@ -167,8 +165,6 @@ public class GamepadMapperAdapter extends RecyclerView.Adapter<GamepadMapperAdap
|
||||
|
||||
public ViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
mBackgroundDrawable = new ColorDrawable(Color.TRANSPARENT);
|
||||
itemView.setBackground(mBackgroundDrawable);
|
||||
mContext = itemView.getContext();
|
||||
mButtonIcon = itemView.findViewById(R.id.controller_mapper_button);
|
||||
mExpandedView = itemView.findViewById(R.id.controller_mapper_expanded_view);
|
||||
@ -223,7 +219,7 @@ public class GamepadMapperAdapter extends RecyclerView.Adapter<GamepadMapperAdap
|
||||
mAttachedPosition = -1;
|
||||
}
|
||||
private void setPressed(boolean pressed) {
|
||||
mBackgroundDrawable.setColor(pressed ? COLOR_ACTIVE_BUTTON : Color.TRANSPARENT);
|
||||
itemView.setBackgroundColor(pressed ? COLOR_ACTIVE_BUTTON : Color.TRANSPARENT);
|
||||
}
|
||||
|
||||
private void updateKeycodeLabel() {
|
||||
|
@ -411,4 +411,6 @@
|
||||
<string name="customctrl_visibility_ingame">In-game</string>
|
||||
<string name="customctrl_visibility_in_menus">In menus</string>
|
||||
<string name="controller_remapper_expand_entry">Expand to change keycodes</string>
|
||||
<string name="preference_remap_controller_title">Change controller key bindings</string>
|
||||
<string name="preference_remap_controller_description">Allows you to modify the keyboard keys bound to each controller button</string>
|
||||
</resources>
|
||||
|
@ -132,6 +132,10 @@
|
||||
<PreferenceCategory
|
||||
android:title="@string/preference_category_controller_settings"
|
||||
>
|
||||
<Preference
|
||||
android:title="@string/preference_remap_controller_title"
|
||||
android:summary="@string/preference_remap_controller_description"
|
||||
android:fragment="net.kdt.pojavlaunch.fragments.GamepadMapperFragment"/>
|
||||
<net.kdt.pojavlaunch.prefs.GamepadRemapPreference
|
||||
android:title="@string/preference_wipe_controller_title"
|
||||
android:summary="@string/preference_wipe_controller_description"
|
||||
@ -143,6 +147,7 @@
|
||||
app2:showSeekBarValue="true"
|
||||
app2:seekBarIncrement="5"
|
||||
/>
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user