diff options
4 files changed, 32 insertions, 33 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 668ea783..960340bb 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizeCommentFilterActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizeCommentFilterActivity.java @@ -178,7 +178,6 @@ public class CustomizeCommentFilterActivity extends BaseActivity { applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(binding.appbarLayoutCustomizeCommentFilterActivity, binding.collapsingToolbarLayoutCustomizeCommentFilterActivity, binding.toolbarCustomizeCommentFilterActivity); int primaryTextColor = mCustomThemeWrapper.getPrimaryTextColor(); int primaryIconColor = mCustomThemeWrapper.getPrimaryIconColor(); - Drawable cursorDrawable = Utils.getTintedDrawable(this, R.drawable.edit_text_cursor, primaryTextColor); binding.nameTextInputLayoutCustomizeCommentFilterActivity.setBoxStrokeColor(primaryTextColor); binding.nameTextInputLayoutCustomizeCommentFilterActivity.setDefaultHintTextColor(ColorStateList.valueOf(primaryTextColor)); binding.nameTextInputEditTextCustomizeCommentFilterActivity.setTextColor(primaryTextColor); @@ -208,11 +207,11 @@ public class CustomizeCommentFilterActivity extends BaseActivity { binding.maxVoteTextInputEditTextCustomizeCommentFilterActivity.setTextColor(primaryTextColor); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { - binding.nameTextInputEditTextCustomizeCommentFilterActivity.setTextCursorDrawable(cursorDrawable); - binding.excludeStringsTextInputEditTextCustomizeCommentFilterActivity.setTextCursorDrawable(cursorDrawable); - binding.excludeUsersTextInputEditTextCustomizeCommentFilterActivity.setTextCursorDrawable(cursorDrawable); - binding.minVoteTextInputEditTextCustomizeCommentFilterActivity.setTextCursorDrawable(cursorDrawable); - binding.maxVoteTextInputEditTextCustomizeCommentFilterActivity.setTextCursorDrawable(cursorDrawable); + binding.nameTextInputLayoutCustomizeCommentFilterActivity.setCursorColor(ColorStateList.valueOf(primaryTextColor)); + binding.excludeStringsTextInputLayoutCustomizeCommentFilterActivity.setCursorColor(ColorStateList.valueOf(primaryTextColor)); + binding.excludeUsersTextInputLayoutCustomizeCommentFilterActivity.setCursorColor(ColorStateList.valueOf(primaryTextColor)); + binding.minVoteTextInputLayoutCustomizeCommentFilterActivity.setCursorColor(ColorStateList.valueOf(primaryTextColor)); + binding.maxVoteTextInputLayoutCustomizeCommentFilterActivity.setCursorColor(ColorStateList.valueOf(primaryTextColor)); } else { setCursorDrawableColor(binding.nameTextInputEditTextCustomizeCommentFilterActivity, primaryTextColor); setCursorDrawableColor(binding.excludeStringsTextInputEditTextCustomizeCommentFilterActivity, primaryTextColor); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizePostFilterActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizePostFilterActivity.java index fdeeb22f..959fad63 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizePostFilterActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizePostFilterActivity.java @@ -263,7 +263,6 @@ public class CustomizePostFilterActivity extends BaseActivity { binding.collapsingToolbarLayoutCustomizePostFilterActivity, binding.toolbarCustomizePostFilterActivity); int primaryTextColor = mCustomThemeWrapper.getPrimaryTextColor(); int primaryIconColor = mCustomThemeWrapper.getPrimaryIconColor(); - Drawable cursorDrawable = Utils.getTintedDrawable(this, R.drawable.edit_text_cursor, primaryTextColor); binding.nameTextInputLayoutCustomizePostFilterActivity.setBoxStrokeColor(primaryTextColor); binding.nameTextInputLayoutCustomizePostFilterActivity.setDefaultHintTextColor(ColorStateList.valueOf(primaryTextColor)); binding.nameTextInputEditTextCustomizePostFilterActivity.setTextColor(primaryTextColor); @@ -321,21 +320,21 @@ public class CustomizePostFilterActivity extends BaseActivity { binding.maxCommentsTextInputEditTextCustomizePostFilterActivity.setTextColor(primaryTextColor); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { - binding.nameTextInputEditTextCustomizePostFilterActivity.setTextCursorDrawable(cursorDrawable); - binding.titleExcludesStringsTextInputEditTextCustomizePostFilterActivity.setTextCursorDrawable(cursorDrawable); - binding.titleContainsStringsTextInputEditTextCustomizePostFilterActivity.setTextCursorDrawable(cursorDrawable); - binding.titleExcludesRegexTextInputEditTextCustomizePostFilterActivity.setTextCursorDrawable(cursorDrawable); - binding.titleContainsRegexTextInputEditTextCustomizePostFilterActivity.setTextCursorDrawable(cursorDrawable); - binding.excludesSubredditsTextInputEditTextCustomizePostFilterActivity.setTextCursorDrawable(cursorDrawable); - binding.excludesUsersTextInputEditTextCustomizePostFilterActivity.setTextCursorDrawable(cursorDrawable); - binding.excludesFlairsTextInputEditTextCustomizePostFilterActivity.setTextCursorDrawable(cursorDrawable); - binding.containsFlairsTextInputEditTextCustomizePostFilterActivity.setTextCursorDrawable(cursorDrawable); - binding.excludeDomainsTextInputEditTextCustomizePostFilterActivity.setTextCursorDrawable(cursorDrawable); - binding.containDomainsTextInputEditTextCustomizePostFilterActivity.setTextCursorDrawable(cursorDrawable); - binding.minVoteTextInputEditTextCustomizePostFilterActivity.setTextCursorDrawable(cursorDrawable); - binding.maxVoteTextInputEditTextCustomizePostFilterActivity.setTextCursorDrawable(cursorDrawable); - binding.minCommentsTextInputEditTextCustomizePostFilterActivity.setTextCursorDrawable(cursorDrawable); - binding.maxCommentsTextInputEditTextCustomizePostFilterActivity.setTextCursorDrawable(cursorDrawable); + binding.nameTextInputLayoutCustomizePostFilterActivity.setCursorColor(ColorStateList.valueOf(primaryTextColor)); + binding.titleExcludesStringsTextInputLayoutCustomizePostFilterActivity.setCursorColor(ColorStateList.valueOf(primaryTextColor)); + binding.titleContainsStringsTextInputLayoutCustomizePostFilterActivity.setCursorColor(ColorStateList.valueOf(primaryTextColor)); + binding.titleExcludesRegexTextInputLayoutCustomizePostFilterActivity.setCursorColor(ColorStateList.valueOf(primaryTextColor)); + binding.titleContainsRegexTextInputLayoutCustomizePostFilterActivity.setCursorColor(ColorStateList.valueOf(primaryTextColor)); + binding.excludesSubredditsTextInputLayoutCustomizePostFilterActivity.setCursorColor(ColorStateList.valueOf(primaryTextColor)); + binding.excludesUsersTextInputLayoutCustomizePostFilterActivity.setCursorColor(ColorStateList.valueOf(primaryTextColor)); + binding.excludesFlairsTextInputLayoutCustomizePostFilterActivity.setCursorColor(ColorStateList.valueOf(primaryTextColor)); + binding.containsFlairsTextInputLayoutCustomizePostFilterActivity.setCursorColor(ColorStateList.valueOf(primaryTextColor)); + binding.excludeDomainsTextInputLayoutCustomizePostFilterActivity.setCursorColor(ColorStateList.valueOf(primaryTextColor)); + binding.containDomainsTextInputLayoutCustomizePostFilterActivity.setCursorColor(ColorStateList.valueOf(primaryTextColor)); + binding.minVoteTextInputLayoutCustomizePostFilterActivity.setCursorColor(ColorStateList.valueOf(primaryTextColor)); + binding.maxVoteTextInputLayoutCustomizePostFilterActivity.setCursorColor(ColorStateList.valueOf(primaryTextColor)); + binding.minCommentsTextInputLayoutCustomizePostFilterActivity.setCursorColor(ColorStateList.valueOf(primaryTextColor)); + binding.maxCommentsTextInputLayoutCustomizePostFilterActivity.setCursorColor(ColorStateList.valueOf(primaryTextColor)); } else { setCursorDrawableColor(binding.nameTextInputEditTextCustomizePostFilterActivity, primaryTextColor); setCursorDrawableColor(binding.titleExcludesStringsTextInputEditTextCustomizePostFilterActivity, primaryTextColor); @@ -357,7 +356,9 @@ public class CustomizePostFilterActivity extends BaseActivity { if (typeface != null) { Utils.setFontToAllTextViews(binding.coordinatorLayoutCustomizePostFilterActivity, typeface); } - } void setCursorDrawableColor(EditText editText, int color) { + } + + private void setCursorDrawableColor(EditText editText, int color) { try { Field fCursorDrawableRes = TextView.class.getDeclaredField("mCursorDrawableRes"); fCursorDrawableRes.setAccessible(true); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostPollActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostPollActivity.java index 08d2e130..b836c718 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostPollActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostPollActivity.java @@ -433,13 +433,12 @@ public class PostPollActivity extends BaseActivity implements FlairBottomSheetFr binding.option6TextInputLayoutEditTextPostPollActivity.setTextColor(primaryTextColor); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { - Drawable cursorDrawable = Utils.getTintedDrawable(this, R.drawable.edit_text_cursor, primaryTextColor); - binding.option1TextInputLayoutEditTextPostPollActivity.setTextCursorDrawable(cursorDrawable); - binding.option2TextInputLayoutEditTextPostPollActivity.setTextCursorDrawable(cursorDrawable); - binding.option3TextInputLayoutEditTextPostPollActivity.setTextCursorDrawable(cursorDrawable); - binding.option4TextInputLayoutEditTextPostPollActivity.setTextCursorDrawable(cursorDrawable); - binding.option5TextInputLayoutEditTextPostPollActivity.setTextCursorDrawable(cursorDrawable); - binding.option6TextInputLayoutEditTextPostPollActivity.setTextCursorDrawable(cursorDrawable); + binding.option1TextInputLayoutPostPollActivity.setCursorColor(ColorStateList.valueOf(primaryTextColor)); + binding.option2TextInputLayoutPostPollActivity.setCursorColor(ColorStateList.valueOf(primaryTextColor)); + binding.option3TextInputLayoutPostPollActivity.setCursorColor(ColorStateList.valueOf(primaryTextColor)); + binding.option4TextInputLayoutPostPollActivity.setCursorColor(ColorStateList.valueOf(primaryTextColor)); + binding.option5TextInputLayoutPostPollActivity.setCursorColor(ColorStateList.valueOf(primaryTextColor)); + binding.option6TextInputLayoutPostPollActivity.setCursorColor(ColorStateList.valueOf(primaryTextColor)); } else { setCursorDrawableColor(binding.option1TextInputLayoutEditTextPostPollActivity, primaryTextColor); setCursorDrawableColor(binding.option2TextInputLayoutEditTextPostPollActivity, primaryTextColor); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/SetRedditGalleryItemCaptionAndUrlBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/SetRedditGalleryItemCaptionAndUrlBottomSheetFragment.java index 564bcb08..4c4ef214 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/SetRedditGalleryItemCaptionAndUrlBottomSheetFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/SetRedditGalleryItemCaptionAndUrlBottomSheetFragment.java @@ -2,6 +2,7 @@ package ml.docilealligator.infinityforreddit.bottomsheetfragments; import android.annotation.SuppressLint; import android.content.Context; +import android.content.res.ColorStateList; import android.graphics.PorterDuff; import android.graphics.drawable.Drawable; import android.os.Build; @@ -55,11 +56,10 @@ public class SetRedditGalleryItemCaptionAndUrlBottomSheetFragment extends Landsc okButton = rootView.findViewById(R.id.ok_button_set_reddit_gallery_item_caption_and_url_bottom_sheet_fragment); int primaryTextColor = mActivity.getResources().getColor(R.color.primaryTextColor); - Drawable cursorDrawable = Utils.getTintedDrawable(mActivity, R.drawable.edit_text_cursor, primaryTextColor); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { - captionTextInputEditText.setTextCursorDrawable(cursorDrawable); - urlTextInputEditText.setTextCursorDrawable(cursorDrawable); + captionTextInputLayout.setCursorColor(ColorStateList.valueOf(primaryTextColor)); + urlTextInputLayout.setCursorColor(ColorStateList.valueOf(primaryTextColor)); } else { setCursorDrawableColor(captionTextInputEditText, primaryTextColor); setCursorDrawableColor(urlTextInputEditText, primaryTextColor); |