diff options
author | Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> | 2024-08-20 18:11:03 +0000 |
---|---|---|
committer | Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> | 2024-08-20 18:11:03 +0000 |
commit | 8fdc2cc945a518c5b9c08cec546ea952caad71a4 (patch) | |
tree | dcaee535138d5204234b0c216065c1bf6b4fd50f /app | |
parent | 55b845c0b8abdedf6e82a652a0bd04693ca18f35 (diff) | |
download | infinity-for-reddit-8fdc2cc945a518c5b9c08cec546ea952caad71a4.tar infinity-for-reddit-8fdc2cc945a518c5b9c08cec546ea952caad71a4.tar.gz infinity-for-reddit-8fdc2cc945a518c5b9c08cec546ea952caad71a4.tar.bz2 infinity-for-reddit-8fdc2cc945a518c5b9c08cec546ea952caad71a4.tar.lz infinity-for-reddit-8fdc2cc945a518c5b9c08cec546ea952caad71a4.tar.xz infinity-for-reddit-8fdc2cc945a518c5b9c08cec546ea952caad71a4.tar.zst infinity-for-reddit-8fdc2cc945a518c5b9c08cec546ea952caad71a4.zip |
Fix spinner issue in CustomizeCommentFilterActivity.
Diffstat (limited to '')
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizeCommentFilterActivity.java | 8 | ||||
-rw-r--r-- | app/src/main/res/layout/activity_customize_comment_filter.xml | 10 |
2 files changed, 13 insertions, 5 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizeCommentFilterActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizeCommentFilterActivity.java index 960340bb..afa5cad6 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizeCommentFilterActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizeCommentFilterActivity.java @@ -48,6 +48,7 @@ public class CustomizeCommentFilterActivity extends BaseActivity { public static final String RETURN_EXTRA_COMMENT_FILTER = "RECF"; private static final String COMMENT_FILTER_STATE = "CFS"; private static final String ORIGINAL_NAME_STATE = "ONS"; + private static final String DISPLAY_MODE_SELECTED_ITEM_INDEX_STATE = "DMSIIS"; @Inject RedditDataRoomDatabase mRedditDataRoomDatabase; @Inject @@ -122,6 +123,7 @@ public class CustomizeCommentFilterActivity extends BaseActivity { if (savedInstanceState != null) { commentFilter = savedInstanceState.getParcelable(COMMENT_FILTER_STATE); originalName = savedInstanceState.getString(ORIGINAL_NAME_STATE); + binding.displayModeSpinnerCustomizeCommentFilterActivity.setSelection(savedInstanceState.getInt(DISPLAY_MODE_SELECTED_ITEM_INDEX_STATE), false); } else { commentFilter = getIntent().getParcelableExtra(EXTRA_COMMENT_FILTER); if (commentFilter == null) { @@ -185,7 +187,10 @@ public class CustomizeCommentFilterActivity extends BaseActivity { binding.displayModeSpinnerCustomizeCommentFilterActivity.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { - ((TextView) parent.getChildAt(0)).setTextColor(primaryTextColor); + View child = parent.getChildAt(0); + if (child instanceof TextView) { + ((TextView) child).setTextColor(primaryTextColor); + } } @Override @@ -326,5 +331,6 @@ public class CustomizeCommentFilterActivity extends BaseActivity { super.onSaveInstanceState(outState); outState.putParcelable(COMMENT_FILTER_STATE, commentFilter); outState.putString(ORIGINAL_NAME_STATE, originalName); + outState.putInt(DISPLAY_MODE_SELECTED_ITEM_INDEX_STATE, binding.displayModeSpinnerCustomizeCommentFilterActivity.getSelectedItemPosition()); } }
\ No newline at end of file diff --git a/app/src/main/res/layout/activity_customize_comment_filter.xml b/app/src/main/res/layout/activity_customize_comment_filter.xml index dbb24455..4e393ff4 100644 --- a/app/src/main/res/layout/activity_customize_comment_filter.xml +++ b/app/src/main/res/layout/activity_customize_comment_filter.xml @@ -65,24 +65,26 @@ <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" - android:paddingTop="8dp" - android:paddingBottom="8dp" - android:paddingStart="20dp"> + android:layout_marginTop="8dp" + android:layout_marginBottom="8dp" + android:layout_marginStart="20dp"> <TextView android:id="@+id/display_mode_title_text_view_customize_comment_filter_activity" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginEnd="16dp" + android:layout_gravity="center_vertical" android:text="@string/comment_filter_display_mode" android:textSize="?attr/font_default" android:fontFamily="?attr/font_family" /> - <Spinner + <androidx.appcompat.widget.AppCompatSpinner android:id="@+id/display_mode_spinner_customize_comment_filter_activity" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" + android:layout_gravity="center_vertical" android:entries="@array/comment_filter_display_mode" /> </LinearLayout> |