Minor UI tweaks in ViewSubredditDetailActivity, ViewUserDetailActivity and CustomThemePreviewActivity.

This commit is contained in:
Docile-Alligator 2022-07-28 23:42:46 +10:00
parent 318240e271
commit 9614f4a67a
12 changed files with 46 additions and 27 deletions

View File

@ -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" />
<activity
android:name=".activities.CustomThemeListingActivity"
android:label="@string/custom_theme_listing_activity_label"
@ -411,11 +411,11 @@
<activity
android:name=".activities.ViewSubredditDetailActivity"
android:parentActivityName=".activities.MainActivity"
android:theme="@style/AppTheme.SlidableWithTranslucentWindow" />
android:theme="@style/AppTheme.Slidable" />
<activity
android:name=".activities.ViewUserDetailActivity"
android:parentActivityName=".activities.MainActivity"
android:theme="@style/AppTheme.SlidableWithTranslucentWindow" />
android:theme="@style/AppTheme.Slidable" />
<provider
android:name="androidx.core.content.FileProvider"

View File

@ -16,6 +16,7 @@ import android.util.TypedValue;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageView;
@ -80,6 +81,8 @@ public class CustomThemePreviewActivity extends AppCompatActivity implements Cus
CollapsingToolbarLayout collapsingToolbarLayout;
@BindView(R.id.toolbar_linear_layout_theme_preview_activity)
LinearLayout linearLayout;
@BindView(R.id.extra_padding_view_theme_preview_activity)
View extraPaddingView;
@BindView(R.id.subreddit_name_text_view_theme_preview_activity)
TextView subredditNameTextView;
@BindView(R.id.user_name_text_view_theme_preview_activity)
@ -239,6 +242,7 @@ public class CustomThemePreviewActivity extends AppCompatActivity implements Cus
} else {
window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
}
adjustToolbar(toolbar);
Resources resources = getResources();
int navBarResourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android");
@ -304,7 +308,6 @@ public class CustomThemePreviewActivity extends AppCompatActivity implements Cus
});
}
adjustToolbar(toolbar);
setSupportActionBar(toolbar);
subscribeSubredditChip.setOnClickListener(view -> {
@ -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);

View File

@ -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) {

View File

@ -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) {

View File

@ -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" />
<pl.droidsonroids.gif.GifImageView

View File

@ -29,7 +29,7 @@
android:id="@+id/banner_image_view_view_user_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" />
<pl.droidsonroids.gif.GifImageView

View File

@ -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" />
<pl.droidsonroids.gif.GifImageView

View File

@ -29,7 +29,7 @@
android:id="@+id/banner_image_view_view_user_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" />
<pl.droidsonroids.gif.GifImageView

View File

@ -31,14 +31,17 @@
android:id="@+id/toolbar_linear_layout_theme_preview_activity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="16dp"
android:paddingStart="16dp"
android:paddingEnd="16dp">
android:orientation="vertical">
<View
android:id="@+id/extra_padding_view_theme_preview_activity"
android:layout_width="match_parent"
android:layout_height="140dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:padding="16dp">
<LinearLayout
android:layout_width="0dp"
@ -69,16 +72,19 @@
android:id="@+id/subscribe_subreddit_chip_theme_preview_activity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginEnd="16dp"
android:text="@string/subscribe"
android:layout_gravity="center_horizontal"/>
app:chipStrokeColor="#00000000" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp">
android:paddingBottom="16dp"
android:paddingStart="16dp"
android:paddingEnd="16dp">
<TextView
android:id="@+id/primary_text_text_view_theme_preview_activity"

View File

@ -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" />
<pl.droidsonroids.gif.GifImageView

View File

@ -29,7 +29,7 @@
android:id="@+id/banner_image_view_view_user_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" />
<pl.droidsonroids.gif.GifImageView

View File

@ -34,10 +34,6 @@
<item name="android:fontFamily">?attr/font_family</item>
</style>
<style name="AppTheme.SlidableWithTranslucentWindow" parent="AppTheme.Slidable">
<item name="android:windowTranslucentStatus">true</item>
</style>
<style name="AppTheme.Draggable" parent="AppTheme">
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:windowContentOverlay">@null</item>