mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-13 06:39:54 -04:00
Refactor(quick settings): remove generic leading to unchecked typecast
This commit is contained in:
parent
371494c43e
commit
9c12611dd3
@ -28,15 +28,14 @@ import net.kdt.pojavlaunch.Tools;
|
|||||||
/**
|
/**
|
||||||
* The base class for side dialog views
|
* The base class for side dialog views
|
||||||
* A side dialog is a dialog appearing from one side of the screen
|
* A side dialog is a dialog appearing from one side of the screen
|
||||||
* @param <T> The type of the content view root
|
|
||||||
*/
|
*/
|
||||||
public abstract class SideDialogView<T extends View> {
|
public abstract class SideDialogView {
|
||||||
|
|
||||||
private final ViewGroup mParent;
|
private final ViewGroup mParent;
|
||||||
private final @LayoutRes int mLayoutId;
|
private final @LayoutRes int mLayoutId;
|
||||||
private ViewGroup mDialogLayout;
|
private ViewGroup mDialogLayout;
|
||||||
private DefocusableScrollView mScrollView;
|
private DefocusableScrollView mScrollView;
|
||||||
protected T mDialogContent;
|
protected View mDialogContent;
|
||||||
|
|
||||||
protected final int mMargin;
|
protected final int mMargin;
|
||||||
private ObjectAnimator mSideDialogAnimator;
|
private ObjectAnimator mSideDialogAnimator;
|
||||||
@ -103,7 +102,7 @@ public abstract class SideDialogView<T extends View> {
|
|||||||
mTitleDivider = mDialogLayout.findViewById(R.id.side_dialog_title_divider);
|
mTitleDivider = mDialogLayout.findViewById(R.id.side_dialog_title_divider);
|
||||||
|
|
||||||
LayoutInflater.from(mParent.getContext()).inflate(mLayoutId, mScrollView, true);
|
LayoutInflater.from(mParent.getContext()).inflate(mLayoutId, mScrollView, true);
|
||||||
mDialogContent = (T) mScrollView.getChildAt(0);
|
mDialogContent = mScrollView.getChildAt(0);
|
||||||
|
|
||||||
// Attach layouts
|
// Attach layouts
|
||||||
mParent.addView(mDialogLayout);
|
mParent.addView(mDialogLayout);
|
||||||
|
@ -40,7 +40,7 @@ import net.kdt.pojavlaunch.utils.interfaces.SimpleTextWatcher;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class EditControlSideDialog extends SideDialogView<ConstraintLayout> {
|
public class EditControlSideDialog extends SideDialogView {
|
||||||
|
|
||||||
private final Spinner[] mKeycodeSpinners = new Spinner[4];
|
private final Spinner[] mKeycodeSpinners = new Spinner[4];
|
||||||
public boolean internalChanges = false; // True when we programmatically change stuff.
|
public boolean internalChanges = false; // True when we programmatically change stuff.
|
||||||
@ -326,8 +326,8 @@ public class EditControlSideDialog extends SideDialogView<ConstraintLayout> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setDefaultVisibilitySetting() {
|
private void setDefaultVisibilitySetting() {
|
||||||
for (int i = 0; i < mDialogContent.getChildCount(); ++i) {
|
for (int i = 0; i < ((ViewGroup)mDialogContent).getChildCount(); ++i) {
|
||||||
mDialogContent.getChildAt(i).setVisibility(VISIBLE);
|
((ViewGroup)mDialogContent).getChildAt(i).setVisibility(VISIBLE);
|
||||||
}
|
}
|
||||||
for(Spinner s : mKeycodeSpinners) {
|
for(Spinner s : mKeycodeSpinners) {
|
||||||
s.setVisibility(View.INVISIBLE);
|
s.setVisibility(View.INVISIBLE);
|
||||||
|
@ -29,7 +29,7 @@ import net.kdt.pojavlaunch.utils.interfaces.SimpleSeekBarListener;
|
|||||||
* Side dialog for quick settings that you can change in game
|
* Side dialog for quick settings that you can change in game
|
||||||
* The implementation has to take action on some preference changes
|
* The implementation has to take action on some preference changes
|
||||||
*/
|
*/
|
||||||
public abstract class QuickSettingSideDialog extends com.kdt.SideDialogView<ConstraintLayout> {
|
public abstract class QuickSettingSideDialog extends com.kdt.SideDialogView {
|
||||||
|
|
||||||
private SharedPreferences.Editor mEditor;
|
private SharedPreferences.Editor mEditor;
|
||||||
@SuppressLint("UseSwitchCompatOrMaterialCode")
|
@SuppressLint("UseSwitchCompatOrMaterialCode")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user