From 8c89603f198c0912d926018c26f8856c3b59c1cd Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Mon, 12 Jul 2021 20:17:38 +0800 Subject: [PATCH] Apply custom theme to the search panel in ViewPostDetailActivity. --- .../activities/ViewPostDetailActivity.java | 18 +++++++++++++++++- .../res/layout/activity_view_post_detail.xml | 18 ++++++++++-------- .../res/layout/exo_playback_control_view.xml | 4 ++-- app/src/main/res/values/strings.xml | 2 ++ 4 files changed, 31 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPostDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPostDetailActivity.java index a00f4c8d..3dd98593 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPostDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPostDetailActivity.java @@ -3,6 +3,7 @@ package ml.docilealligator.infinityforreddit.activities; import android.app.Activity; import android.content.Intent; import android.content.SharedPreferences; +import android.content.res.ColorStateList; import android.os.Build; import android.os.Bundle; import android.os.Handler; @@ -176,6 +177,11 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) fab.getLayoutParams(); params.bottomMargin += navBarHeight; fab.setLayoutParams(params); + + searchPanelMaterialCardView.setContentPadding(searchPanelMaterialCardView.getPaddingStart(), + searchPanelMaterialCardView.getPaddingTop(), + searchPanelMaterialCardView.getPaddingEnd(), + searchPanelMaterialCardView.getPaddingBottom() + navBarHeight); } } } @@ -272,6 +278,14 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele mCoordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); applyAppBarLayoutAndToolbarTheme(mAppBarLayout, mToolbar); applyFABTheme(fab); + searchPanelMaterialCardView.setBackgroundTintList(ColorStateList.valueOf(mCustomThemeWrapper.getColorPrimary())); + int searchPanelTextAndIconColor = mCustomThemeWrapper.getToolbarPrimaryTextAndIconColor(); + searchTextInputLayout.setBoxStrokeColor(searchPanelTextAndIconColor); + searchTextInputLayout.setDefaultHintTextColor(ColorStateList.valueOf(searchPanelTextAndIconColor)); + searchTextInputEditText.setTextColor(searchPanelTextAndIconColor); + previousResultImageView.setColorFilter(searchPanelTextAndIconColor, android.graphics.PorterDuff.Mode.SRC_IN); + nextResultImageView.setColorFilter(searchPanelTextAndIconColor, android.graphics.PorterDuff.Mode.SRC_IN); + closeSearchPanelImageView.setColorFilter(searchPanelTextAndIconColor, android.graphics.PorterDuff.Mode.SRC_IN); } private void checkNewAccountAndBindView(Bundle savedInstanceState) { @@ -419,7 +433,9 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele } public void searchComment(ViewPostDetailFragment fragment, boolean searchNextComment) { - fragment.searchComment(searchTextInputEditText.getText().toString(), searchNextComment); + if (!searchTextInputEditText.getText().toString().isEmpty()) { + fragment.searchComment(searchTextInputEditText.getText().toString(), searchNextComment); + } } @Subscribe diff --git a/app/src/main/res/layout/activity_view_post_detail.xml b/app/src/main/res/layout/activity_view_post_detail.xml index f44fd823..3a7cbf3c 100644 --- a/app/src/main/res/layout/activity_view_post_detail.xml +++ b/app/src/main/res/layout/activity_view_post_detail.xml @@ -65,7 +65,6 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" - android:paddingTop="8dp" android:paddingBottom="8dp" android:paddingStart="16dp" @@ -78,15 +77,16 @@ android:layout_height="wrap_content" android:fontFamily="?attr/font_family" android:textSize="?attr/font_default" - android:hint="@string/post_filter_name_hint" /> + android:hint="@string/search_comments" /> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index aad47bf1..df5ae856 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1133,4 +1133,6 @@ Cannot parse RPAN broadcasts Cannot parse RPAN broadcast + Search Comments +