aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2022-07-28 13:42:46 +0000
committerDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2022-07-28 13:42:46 +0000
commit9614f4a67afc10b9a003dc345f1176d92c5b64fd (patch)
treee14cb70f70048e23f87fd8b82e7b2c4b9aa03729
parent318240e271ee9be0c4ec119aa72d25cb777287df (diff)
downloadinfinity-for-reddit-9614f4a67afc10b9a003dc345f1176d92c5b64fd.tar
infinity-for-reddit-9614f4a67afc10b9a003dc345f1176d92c5b64fd.tar.gz
infinity-for-reddit-9614f4a67afc10b9a003dc345f1176d92c5b64fd.tar.bz2
infinity-for-reddit-9614f4a67afc10b9a003dc345f1176d92c5b64fd.tar.lz
infinity-for-reddit-9614f4a67afc10b9a003dc345f1176d92c5b64fd.tar.xz
infinity-for-reddit-9614f4a67afc10b9a003dc345f1176d92c5b64fd.tar.zst
infinity-for-reddit-9614f4a67afc10b9a003dc345f1176d92c5b64fd.zip
Minor UI tweaks in ViewSubredditDetailActivity, ViewUserDetailActivity and CustomThemePreviewActivity.
-rw-r--r--app/src/main/AndroidManifest.xml6
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomThemePreviewActivity.java22
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java4
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java3
-rw-r--r--app/src/main/res/layout-land/activity_view_subreddit_detail.xml2
-rw-r--r--app/src/main/res/layout-land/activity_view_user_detail.xml2
-rw-r--r--app/src/main/res/layout-sw600dp/activity_view_subreddit_detail.xml2
-rw-r--r--app/src/main/res/layout-sw600dp/activity_view_user_detail.xml2
-rw-r--r--app/src/main/res/layout/activity_theme_preview.xml22
-rw-r--r--app/src/main/res/layout/activity_view_subreddit_detail.xml2
-rw-r--r--app/src/main/res/layout/activity_view_user_detail.xml2
-rw-r--r--app/src/main/res/values/styles.xml4
12 files changed, 46 insertions, 27 deletions
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" />
<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"
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomThemePreviewActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomThemePreviewActivity.java
index db63b198..18da2dce 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomThemePreviewActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomThemePreviewActivity.java
@@ -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);
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" />
<pl.droidsonroids.gif.GifImageView
diff --git a/app/src/main/res/layout-land/activity_view_user_detail.xml b/app/src/main/res/layout-land/activity_view_user_detail.xml
index 1ca12e14..ab2e41b2 100644
--- a/app/src/main/res/layout-land/activity_view_user_detail.xml
+++ b/app/src/main/res/layout-land/activity_view_user_detail.xml
@@ -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
diff --git a/app/src/main/res/layout-sw600dp/activity_view_subreddit_detail.xml b/app/src/main/res/layout-sw600dp/activity_view_subreddit_detail.xml
index 0a7af4da..580f628c 100644
--- a/app/src/main/res/layout-sw600dp/activity_view_subreddit_detail.xml
+++ b/app/src/main/res/layout-sw600dp/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" />
<pl.droidsonroids.gif.GifImageView
diff --git a/app/src/main/res/layout-sw600dp/activity_view_user_detail.xml b/app/src/main/res/layout-sw600dp/activity_view_user_detail.xml
index 87e97b37..0de2645a 100644
--- a/app/src/main/res/layout-sw600dp/activity_view_user_detail.xml
+++ b/app/src/main/res/layout-sw600dp/activity_view_user_detail.xml
@@ -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
diff --git a/app/src/main/res/layout/activity_theme_preview.xml b/app/src/main/res/layout/activity_theme_preview.xml
index f2504287..9f40fd7a 100644
--- a/app/src/main/res/layout/activity_theme_preview.xml
+++ b/app/src/main/res/layout/activity_theme_preview.xml
@@ -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"
diff --git a/app/src/main/res/layout/activity_view_subreddit_detail.xml b/app/src/main/res/layout/activity_view_subreddit_detail.xml
index a347b353..e0167ed6 100644
--- a/app/src/main/res/layout/activity_view_subreddit_detail.xml
+++ b/app/src/main/res/layout/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" />
<pl.droidsonroids.gif.GifImageView
diff --git a/app/src/main/res/layout/activity_view_user_detail.xml b/app/src/main/res/layout/activity_view_user_detail.xml
index 680a4af5..186c7023 100644
--- a/app/src/main/res/layout/activity_view_user_detail.xml
+++ b/app/src/main/res/layout/activity_view_user_detail.xml
@@ -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
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index 2694fc6f..5edc64cb 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -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>