From e6bb87a9cc2ded99707020592957627726d91898 Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Thu, 4 Nov 2021 22:13:59 +0800 Subject: Fix Material Design 3 issue. --- .../activities/ViewImageOrGifActivity.java | 2 +- .../activities/ViewRedditGalleryActivity.java | 20 ++++++++++---------- .../activities/ViewVideoActivity.java | 4 ++-- .../infinityforreddit/utils/MaterialYouUtils.java | 21 +++++++++++---------- app/src/main/res/layout/activity_post_gallery.xml | 8 ++++---- app/src/main/res/layout/activity_post_image.xml | 10 ++++++---- app/src/main/res/layout/activity_post_link.xml | 14 +++++++------- app/src/main/res/layout/activity_post_text.xml | 8 ++++---- app/src/main/res/layout/activity_post_video.xml | 8 ++++---- .../res/layout/activity_view_subreddit_detail.xml | 3 ++- .../main/res/layout/activity_view_user_detail.xml | 3 ++- 11 files changed, 53 insertions(+), 48 deletions(-) (limited to 'app/src/main') diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImageOrGifActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImageOrGifActivity.java index e5d5f72b..a8d13ed7 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImageOrGifActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImageOrGifActivity.java @@ -163,7 +163,7 @@ public class ViewImageOrGifActivity extends AppCompatActivity implements SetAsWa boolean useBottomAppBar = mSharedPreferences.getBoolean(SharedPreferencesUtils.USE_BOTTOM_TOOLBAR_IN_MEDIA_VIEWER, false); if (postTitle != null) { - Spanned title = Html.fromHtml(String.format("%s", postTitle)); + Spanned title = Html.fromHtml(String.format("%s", postTitle)); if (useBottomAppBar) { titleTextView.setText(title); } else { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewRedditGalleryActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewRedditGalleryActivity.java index 61a5066f..8b477c34 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewRedditGalleryActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewRedditGalleryActivity.java @@ -5,6 +5,7 @@ import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.os.Handler; +import android.text.Html; import android.view.Menu; import android.view.MenuItem; import android.widget.Toast; @@ -17,17 +18,20 @@ import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentStatePagerAdapter; import androidx.viewpager.widget.ViewPager; -import app.futured.hauler.DragDirection; -import app.futured.hauler.HaulerView; - import java.util.ArrayList; import java.util.concurrent.Executor; import javax.inject.Inject; import javax.inject.Named; +import app.futured.hauler.DragDirection; +import app.futured.hauler.HaulerView; import butterknife.BindView; import butterknife.ButterKnife; +import ml.docilealligator.infinityforreddit.Infinity; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.SetAsWallpaperCallback; +import ml.docilealligator.infinityforreddit.WallpaperSetter; import ml.docilealligator.infinityforreddit.customviews.ViewPagerBugFixed; import ml.docilealligator.infinityforreddit.font.ContentFontFamily; import ml.docilealligator.infinityforreddit.font.ContentFontStyle; @@ -37,12 +41,8 @@ import ml.docilealligator.infinityforreddit.font.TitleFontFamily; import ml.docilealligator.infinityforreddit.font.TitleFontStyle; import ml.docilealligator.infinityforreddit.fragments.ViewRedditGalleryImageOrGifFragment; import ml.docilealligator.infinityforreddit.fragments.ViewRedditGalleryVideoFragment; -import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.post.Post; -import ml.docilealligator.infinityforreddit.R; -import ml.docilealligator.infinityforreddit.SetAsWallpaperCallback; import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils; -import ml.docilealligator.infinityforreddit.WallpaperSetter; public class ViewRedditGalleryActivity extends AppCompatActivity implements SetAsWallpaperCallback { @@ -147,11 +147,11 @@ public class ViewRedditGalleryActivity extends AppCompatActivity implements SetA private void setToolbarTitle(int position) { if (gallery != null && position >= 0 && position < gallery.size()) { if (gallery.get(position).mediaType == Post.Gallery.TYPE_IMAGE) { - setTitle(getString(R.string.view_reddit_gallery_activity_image_label, position + 1, gallery.size())); + setTitle(Html.fromHtml("" + getString(R.string.view_reddit_gallery_activity_image_label, position + 1, gallery.size()) + "")); } else if (gallery.get(position).mediaType == Post.Gallery.TYPE_GIF) { - setTitle(getString(R.string.view_reddit_gallery_activity_gif_label, position + 1, gallery.size())); + setTitle(Html.fromHtml("" + getString(R.string.view_reddit_gallery_activity_gif_label, position + 1, gallery.size()) + "")); } else { - setTitle(getString(R.string.view_reddit_gallery_activity_video_label, position + 1, gallery.size())); + setTitle(Html.fromHtml("" + getString(R.string.view_reddit_gallery_activity_video_label, position + 1, gallery.size()) + "")); } } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java index 09d9850b..548e7c53 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java @@ -324,9 +324,9 @@ public class ViewVideoActivity extends AppCompatActivity { if (postTitle != null) { if (useBottomAppBar) { - titleTextView.setText(Html.fromHtml(String.format("%s", postTitle))); + titleTextView.setText(Html.fromHtml(String.format("%s", postTitle))); } else { - setTitle(Html.fromHtml(String.format("%s", postTitle))); + setTitle(Html.fromHtml(String.format("%s", postTitle))); } } else { if (!useBottomAppBar) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/MaterialYouUtils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/MaterialYouUtils.java index 2a1912fa..082f6a75 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/MaterialYouUtils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/MaterialYouUtils.java @@ -54,7 +54,7 @@ public class MaterialYouUtils { CustomTheme amoledTheme = CustomThemeWrapper.getIndigoAmoled(context); lightTheme.colorPrimary = context.getColor(android.R.color.system_accent1_100); - lightTheme.colorPrimaryDark = context.getColor(android.R.color.system_accent1_200); + lightTheme.colorPrimaryDark = lightTheme.colorPrimary; lightTheme.colorAccent = context.getColor(android.R.color.system_accent3_300); lightTheme.colorPrimaryLightTheme = lightTheme.colorPrimary; lightTheme.backgroundColor = context.getColor(android.R.color.system_neutral1_100); @@ -65,17 +65,18 @@ public class MaterialYouUtils { lightTheme.navBarColor = lightTheme.colorPrimary; lightTheme.primaryTextColor = context.getColor(android.R.color.system_neutral1_900); lightTheme.secondaryTextColor = context.getColor(android.R.color.system_neutral1_700); - lightTheme.bottomAppBarIconColor = context.getColor(android.R.color.system_accent1_800); + lightTheme.buttonTextColor = context.getColor(android.R.color.system_accent1_800); + lightTheme.bottomAppBarIconColor = lightTheme.buttonTextColor; lightTheme.primaryIconColor = context.getColor(android.R.color.system_accent1_400); - lightTheme.fabIconColor = lightTheme.bottomAppBarIconColor; - lightTheme.toolbarPrimaryTextAndIconColor = lightTheme.bottomAppBarIconColor; - lightTheme.toolbarSecondaryTextColor = lightTheme.bottomAppBarIconColor; - lightTheme.tabLayoutWithCollapsedCollapsingToolbarTabIndicator = lightTheme.bottomAppBarIconColor; - lightTheme.tabLayoutWithCollapsedCollapsingToolbarTextColor = lightTheme.bottomAppBarIconColor; + lightTheme.fabIconColor = lightTheme.buttonTextColor; + lightTheme.toolbarPrimaryTextAndIconColor = lightTheme.buttonTextColor; + lightTheme.toolbarSecondaryTextColor = lightTheme.buttonTextColor; + lightTheme.tabLayoutWithCollapsedCollapsingToolbarTabIndicator = lightTheme.buttonTextColor; + lightTheme.tabLayoutWithCollapsedCollapsingToolbarTextColor = lightTheme.buttonTextColor; lightTheme.tabLayoutWithCollapsedCollapsingToolbarTabBackground = lightTheme.colorPrimary; lightTheme.tabLayoutWithExpandedCollapsingToolbarTabBackground = lightTheme.backgroundColor; - lightTheme.tabLayoutWithExpandedCollapsingToolbarTabIndicator = lightTheme.bottomAppBarIconColor; - lightTheme.tabLayoutWithExpandedCollapsingToolbarTextColor = lightTheme.bottomAppBarIconColor; + lightTheme.tabLayoutWithExpandedCollapsingToolbarTabIndicator = lightTheme.buttonTextColor; + lightTheme.tabLayoutWithExpandedCollapsingToolbarTextColor = lightTheme.buttonTextColor; lightTheme.circularProgressBarBackground = context.getColor(android.R.color.system_accent1_10); lightTheme.dividerColor = context.getColor(android.R.color.system_neutral1_400); lightTheme.isLightStatusBar = true; @@ -83,7 +84,7 @@ public class MaterialYouUtils { lightTheme.name = "Material You"; darkTheme.colorPrimary = context.getColor(android.R.color.system_accent2_800); - darkTheme.colorPrimaryDark = context.getColor(android.R.color.system_accent2_900); + darkTheme.colorPrimaryDark = darkTheme.colorPrimary; darkTheme.colorAccent = context.getColor(android.R.color.system_accent3_100); darkTheme.colorPrimaryLightTheme = context.getColor(android.R.color.system_accent1_300); darkTheme.backgroundColor = context.getColor(android.R.color.system_neutral1_900); diff --git a/app/src/main/res/layout/activity_post_gallery.xml b/app/src/main/res/layout/activity_post_gallery.xml index 150870e0..7d3124f8 100644 --- a/app/src/main/res/layout/activity_post_gallery.xml +++ b/app/src/main/res/layout/activity_post_gallery.xml @@ -36,9 +36,7 @@ + android:layout_centerVertical="true" + android:layout_marginStart="16dp" /> diff --git a/app/src/main/res/layout/activity_post_image.xml b/app/src/main/res/layout/activity_post_image.xml index 2e66a7ea..fe286ab8 100644 --- a/app/src/main/res/layout/activity_post_image.xml +++ b/app/src/main/res/layout/activity_post_image.xml @@ -36,9 +36,7 @@ + android:layout_centerVertical="true" + android:layout_marginStart="16dp" /> @@ -197,6 +197,7 @@ android:id="@+id/capture_fab_post_image_activity" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:layout_margin="16dp" android:src="@drawable/ic_outline_add_a_photo_24dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toStartOf="@+id/select_from_library_fab_post_image_activity" @@ -209,6 +210,7 @@ android:id="@+id/select_from_library_fab_post_image_activity" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:layout_margin="16dp" android:src="@drawable/ic_outline_select_photo_24dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" diff --git a/app/src/main/res/layout/activity_post_link.xml b/app/src/main/res/layout/activity_post_link.xml index 427b8306..9023e2a0 100644 --- a/app/src/main/res/layout/activity_post_link.xml +++ b/app/src/main/res/layout/activity_post_link.xml @@ -36,9 +36,7 @@ + android:layout_centerVertical="true" + android:layout_marginStart="16dp" /> @@ -171,9 +171,7 @@ + android:layout_height="wrap_content"> diff --git a/app/src/main/res/layout/activity_post_text.xml b/app/src/main/res/layout/activity_post_text.xml index f18bf667..12440dd4 100644 --- a/app/src/main/res/layout/activity_post_text.xml +++ b/app/src/main/res/layout/activity_post_text.xml @@ -42,9 +42,7 @@ + android:layout_centerVertical="true" + android:layout_marginStart="16dp" /> diff --git a/app/src/main/res/layout/activity_post_video.xml b/app/src/main/res/layout/activity_post_video.xml index e1c297cb..3c74922a 100644 --- a/app/src/main/res/layout/activity_post_video.xml +++ b/app/src/main/res/layout/activity_post_video.xml @@ -36,9 +36,7 @@ + android:layout_centerVertical="true" + android:layout_marginStart="16dp" /> 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 6709af9f..a347b353 100644 --- a/app/src/main/res/layout/activity_view_subreddit_detail.xml +++ b/app/src/main/res/layout/activity_view_subreddit_detail.xml @@ -65,7 +65,8 @@ android:id="@+id/subscribe_subreddit_chip_view_subreddit_detail_activity" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_gravity="center_horizontal"/> + android:layout_gravity="center_horizontal" + app:chipStrokeColor="#00000000" /> + android:visibility="gone" + app:chipStrokeColor="#00000000" />