diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 202ceb42..c5bd8ebf 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -187,7 +187,7 @@ android:name=".activities.CustomThemePreviewActivity" android:label="@string/theme_preview_activity_label" android:parentActivityName=".activities.MainActivity" - android:theme="@style/AppTheme.SlidableWithTranslucentWindow" /> + android:theme="@style/AppTheme.Slidable" /> + android:theme="@style/AppTheme.Slidable" /> + android:theme="@style/AppTheme.Slidable" /> { @@ -335,6 +338,13 @@ public class CustomThemePreviewActivity extends AppCompatActivity implements Cus private void applyCustomTheme() { coordinatorLayout.setBackgroundColor(customTheme.backgroundColor); + appBarLayout.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { + @Override + public void onGlobalLayout() { + appBarLayout.getViewTreeObserver().removeOnGlobalLayoutListener(this); + collapsingToolbarLayout.setScrimVisibleHeightTrigger(toolbar.getHeight() + tabLayout.getHeight() + getStatusBarHeight() * 2); + } + }); collapsingToolbarLayout.setContentScrimColor(customTheme.colorPrimary); subscribeSubredditChip.setTextColor(customTheme.chipTextColor); subscribeSubredditChip.setChipBackgroundColor(ColorStateList.valueOf(customTheme.unsubscribed)); @@ -346,6 +356,7 @@ public class CustomThemePreviewActivity extends AppCompatActivity implements Cus collapsedTabIndicatorColor = customTheme.tabLayoutWithCollapsedCollapsingToolbarTabIndicator; collapsedTabBackgroundColor = customTheme.tabLayoutWithCollapsedCollapsingToolbarTabBackground; linearLayout.setBackgroundColor(customTheme.tabLayoutWithExpandedCollapsingToolbarTabBackground); + extraPaddingView.setBackgroundColor(customTheme.colorPrimary); subredditNameTextView.setTextColor(customTheme.subreddit); usernameTextView.setTextColor(customTheme.username); subscribeSubredditChip.setTextColor(customTheme.chipTextColor); @@ -370,6 +381,15 @@ public class CustomThemePreviewActivity extends AppCompatActivity implements Cus } } + private int getStatusBarHeight() { + int result = 0; + int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android"); + if (resourceId > 0) { + result = getResources().getDimensionPixelSize(resourceId); + } + return result; + } + protected void applyAppBarLayoutAndToolbarTheme(AppBarLayout appBarLayout, Toolbar toolbar) { appBarLayout.setBackgroundColor(customTheme.colorPrimary); toolbar.setTitleTextColor(customTheme.toolbarPrimaryTextAndIconColor); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java index ad200202..48054ceb 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java @@ -236,7 +236,6 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp @Override protected void onCreate(Bundle savedInstanceState) { ((Infinity) getApplication()).getAppComponent().inject(this); - setTransparentStatusBarAfterToolbarCollapsed(); super.onCreate(savedInstanceState); @@ -268,6 +267,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp } else { window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); } + adjustToolbar(toolbar); int navBarHeight = getNavBarHeight(); if (navBarHeight > 0) { @@ -364,7 +364,6 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp subredditNameTextView.setText(title); toolbar.setTitle(title); - adjustToolbar(toolbar); setSupportActionBar(toolbar); setToolbarGoToTop(toolbar); @@ -537,7 +536,6 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp creationTimeTextView.setTextColor(primaryTextColor); descriptionTextView.setTextColor(primaryTextColor); navigationWrapper.applyCustomTheme(mCustomThemeWrapper.getBottomAppBarIconColor(), mCustomThemeWrapper.getBottomAppBarBackgroundColor()); - int bottomAppBarIconColor = mCustomThemeWrapper.getBottomAppBarIconColor(); applyTabLayoutTheme(tabLayout); applyFABTheme(navigationWrapper.floatingActionButton); if (typeface != null) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java index ddf997c9..15b55477 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java @@ -286,8 +286,6 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele Resources resources = getResources(); - adjustToolbar(toolbar); - String title = "u/" + username; userNameTextView.setText(title); toolbar.setTitle(title); @@ -304,6 +302,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele } else { window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); } + adjustToolbar(toolbar); int navBarHeight = getNavBarHeight(); if (navBarHeight > 0) { diff --git a/app/src/main/res/layout-land/activity_view_subreddit_detail.xml b/app/src/main/res/layout-land/activity_view_subreddit_detail.xml index 0a7af4da..580f628c 100644 --- a/app/src/main/res/layout-land/activity_view_subreddit_detail.xml +++ b/app/src/main/res/layout-land/activity_view_subreddit_detail.xml @@ -29,7 +29,7 @@ android:id="@+id/banner_image_view_view_subreddit_detail_activity" android:layout_width="match_parent" android:scaleType="centerCrop" - android:layout_height="180dp" + android:layout_height="160dp" android:contentDescription="@string/content_description_banner_imageview" /> + android:orientation="vertical"> + + + android:layout_height="wrap_content" + android:padding="16dp"> + app:chipStrokeColor="#00000000" /> + android:paddingBottom="16dp" + android:paddingStart="16dp" + android:paddingEnd="16dp"> ?attr/font_family - -