Apply custom theme to the search panel in ViewPostDetailActivity.

This commit is contained in:
Alex Ning 2021-07-12 20:17:38 +08:00
parent 67d4d9cc4f
commit 8c89603f19
4 changed files with 31 additions and 11 deletions

View File

@ -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,8 +433,10 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele
}
public void searchComment(ViewPostDetailFragment fragment, boolean searchNextComment) {
if (!searchTextInputEditText.getText().toString().isEmpty()) {
fragment.searchComment(searchTextInputEditText.getText().toString(), searchNextComment);
}
}
@Subscribe
public void onAccountSwitchEvent(SwitchAccountEvent event) {

View File

@ -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" />
</com.google.android.material.textfield.TextInputLayout>
<ImageView
android:id="@+id/previous_result_image_view_view_post_detail_activity"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:padding="8dp"
android:src="@drawable/ic_arrow_upward_black_24dp"
android:background="?actionBarItemBackground"
android:clickable="true"
@ -94,9 +94,10 @@
<ImageView
android:id="@+id/next_result_image_view_view_post_detail_activity"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:padding="8dp"
android:src="@drawable/ic_arrow_downward_black_24dp"
android:background="?actionBarItemBackground"
android:clickable="true"
@ -104,9 +105,10 @@
<ImageView
android:id="@+id/close_search_panel_image_view_view_post_detail_activity"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:padding="8dp"
android:src="@drawable/ic_close_black_24dp"
android:background="?actionBarItemBackground"
android:clickable="true"

View File

@ -58,7 +58,7 @@
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:includeFontPadding="false"
android:textColor="#FFBEBEBE"
android:textColor="#FFFFFF"
android:fontFamily="?attr/font_family" />
<com.google.android.exoplayer2.ui.DefaultTimeBar
@ -78,7 +78,7 @@
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:includeFontPadding="false"
android:textColor="#FFBEBEBE"
android:textColor="#FFFFFF"
android:fontFamily="?attr/font_family" />
</LinearLayout>

View File

@ -1133,4 +1133,6 @@
<string name="parse_rpan_broadcasts_failed">Cannot parse RPAN broadcasts</string>
<string name="parse_rpan_broadcast_failed">Cannot parse RPAN broadcast</string>
<string name="search_comments">Search Comments</string>
</resources>