Skip to content

Commit

Permalink
Refactor(quick settings): remove generic leading to unchecked typecast
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathias-Boulay committed Nov 21, 2024
1 parent 371494c commit 9c12611
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
7 changes: 3 additions & 4 deletions app_pojavlauncher/src/main/java/com/kdt/SideDialogView.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,14 @@
/**
* The base class for side dialog views
* 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 @LayoutRes int mLayoutId;
private ViewGroup mDialogLayout;
private DefocusableScrollView mScrollView;
protected T mDialogContent;
protected View mDialogContent;

protected final int mMargin;
private ObjectAnimator mSideDialogAnimator;
Expand Down Expand Up @@ -103,7 +102,7 @@ private void inflateLayout() {
mTitleDivider = mDialogLayout.findViewById(R.id.side_dialog_title_divider);

LayoutInflater.from(mParent.getContext()).inflate(mLayoutId, mScrollView, true);
mDialogContent = (T) mScrollView.getChildAt(0);
mDialogContent = mScrollView.getChildAt(0);

// Attach layouts
mParent.addView(mDialogLayout);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

import java.util.List;

public class EditControlSideDialog extends SideDialogView<ConstraintLayout> {
public class EditControlSideDialog extends SideDialogView {

private final Spinner[] mKeycodeSpinners = new Spinner[4];
public boolean internalChanges = false; // True when we programmatically change stuff.
Expand Down Expand Up @@ -326,8 +326,8 @@ private void loadAdapter() {
}

private void setDefaultVisibilitySetting() {
for (int i = 0; i < mDialogContent.getChildCount(); ++i) {
mDialogContent.getChildAt(i).setVisibility(VISIBLE);
for (int i = 0; i < ((ViewGroup)mDialogContent).getChildCount(); ++i) {
((ViewGroup)mDialogContent).getChildAt(i).setVisibility(VISIBLE);
}
for(Spinner s : mKeycodeSpinners) {
s.setVisibility(View.INVISIBLE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* Side dialog for quick settings that you can change in game
* 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;
@SuppressLint("UseSwitchCompatOrMaterialCode")
Expand Down

0 comments on commit 9c12611

Please sign in to comment.