Fix Material Design 3 issue.

This commit is contained in:
Alex Ning 2021-11-04 22:13:59 +08:00
parent 7c8bde7e99
commit e6bb87a9cc
11 changed files with 53 additions and 48 deletions

View File

@ -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("<small>%s</small>", postTitle));
Spanned title = Html.fromHtml(String.format("<font color=\"#FFFFFF\"><small>%s</small></font>", postTitle));
if (useBottomAppBar) {
titleTextView.setText(title);
} else {

View File

@ -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("<font color=\"#FFFFFF\">" + getString(R.string.view_reddit_gallery_activity_image_label, position + 1, gallery.size()) + "</font>"));
} 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("<font color=\"#FFFFFF\">" + getString(R.string.view_reddit_gallery_activity_gif_label, position + 1, gallery.size()) + "</font>"));
} else {
setTitle(getString(R.string.view_reddit_gallery_activity_video_label, position + 1, gallery.size()));
setTitle(Html.fromHtml("<font color=\"#FFFFFF\">" + getString(R.string.view_reddit_gallery_activity_video_label, position + 1, gallery.size()) + "</font>"));
}
}
}

View File

@ -324,9 +324,9 @@ public class ViewVideoActivity extends AppCompatActivity {
if (postTitle != null) {
if (useBottomAppBar) {
titleTextView.setText(Html.fromHtml(String.format("<small>%s</small>", postTitle)));
titleTextView.setText(Html.fromHtml(String.format("<font color=\"#FFFFFF\"><small>%s</small></font>", postTitle)));
} else {
setTitle(Html.fromHtml(String.format("<small>%s</small>", postTitle)));
setTitle(Html.fromHtml(String.format("<font color=\"#FFFFFF\"><small>%s</small></font>", postTitle)));
}
} else {
if (!useBottomAppBar) {

View File

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

View File

@ -36,9 +36,7 @@
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="16dp"
android:paddingTop="8dp"
android:paddingEnd="16dp"
android:paddingBottom="8dp">
<pl.droidsonroids.gif.GifImageView
@ -46,7 +44,8 @@
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_alignParentStart="true"
android:layout_centerVertical="true" />
android:layout_centerVertical="true"
android:layout_marginStart="16dp" />
<TextView
android:id="@+id/subreddit_name_text_view_post_gallery_activity"
@ -54,7 +53,6 @@
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="32dp"
android:layout_marginEnd="16dp"
android:layout_toStartOf="@id/rules_button_post_gallery_activity"
android:layout_toEndOf="@id/subreddit_icon_gif_image_view_post_gallery_activity"
android:text="@string/choose_a_subreddit"
@ -67,6 +65,8 @@
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:text="@string/rules"
android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family" />

View File

@ -36,9 +36,7 @@
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="16dp"
android:paddingTop="8dp"
android:paddingEnd="16dp"
android:paddingBottom="8dp">
<pl.droidsonroids.gif.GifImageView
@ -46,7 +44,8 @@
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_alignParentStart="true"
android:layout_centerVertical="true" />
android:layout_centerVertical="true"
android:layout_marginStart="16dp" />
<TextView
android:id="@+id/subreddit_name_text_view_post_image_activity"
@ -54,7 +53,6 @@
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="32dp"
android:layout_marginEnd="16dp"
android:layout_toStartOf="@id/rules_button_post_image_activity"
android:layout_toEndOf="@id/subreddit_icon_gif_image_view_post_image_activity"
android:text="@string/choose_a_subreddit"
@ -67,6 +65,8 @@
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:text="@string/rules"
android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family" />
@ -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"

View File

@ -36,9 +36,7 @@
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="16dp"
android:paddingTop="8dp"
android:paddingEnd="16dp"
android:paddingBottom="8dp">
<pl.droidsonroids.gif.GifImageView
@ -46,7 +44,8 @@
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_alignParentStart="true"
android:layout_centerVertical="true" />
android:layout_centerVertical="true"
android:layout_marginStart="16dp" />
<TextView
android:id="@+id/subreddit_name_text_view_post_link_activity"
@ -54,7 +53,6 @@
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="32dp"
android:layout_marginEnd="16dp"
android:layout_toStartOf="@id/rules_button_post_link_activity"
android:layout_toEndOf="@id/subreddit_icon_gif_image_view_post_link_activity"
android:text="@string/choose_a_subreddit"
@ -67,6 +65,8 @@
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:text="@string/rules"
android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family" />
@ -171,9 +171,7 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="0dp"
android:paddingEnd="16dp">
android:layout_height="wrap_content">
<EditText
android:id="@+id/post_title_edit_text_post_link_activity"
@ -195,6 +193,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:text="@string/suggest_title"
android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family" />

View File

@ -42,9 +42,7 @@
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="16dp"
android:paddingTop="8dp"
android:paddingEnd="16dp"
android:paddingBottom="8dp">
<pl.droidsonroids.gif.GifImageView
@ -52,7 +50,8 @@
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_alignParentStart="true"
android:layout_centerVertical="true" />
android:layout_centerVertical="true"
android:layout_marginStart="16dp" />
<TextView
android:id="@+id/subreddit_name_text_view_post_text_activity"
@ -60,7 +59,6 @@
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="32dp"
android:layout_marginEnd="16dp"
android:layout_toStartOf="@id/rules_button_post_text_activity"
android:layout_toEndOf="@id/subreddit_icon_gif_image_view_post_text_activity"
android:text="@string/choose_a_subreddit"
@ -73,6 +71,8 @@
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:text="@string/rules"
android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family" />

View File

@ -36,9 +36,7 @@
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="16dp"
android:paddingTop="8dp"
android:paddingEnd="16dp"
android:paddingBottom="8dp">
<pl.droidsonroids.gif.GifImageView
@ -46,7 +44,8 @@
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_alignParentStart="true"
android:layout_centerVertical="true" />
android:layout_centerVertical="true"
android:layout_marginStart="16dp" />
<TextView
android:id="@+id/subreddit_name_text_view_post_video_activity"
@ -54,7 +53,6 @@
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="32dp"
android:layout_marginEnd="16dp"
android:layout_toStartOf="@id/rules_button_post_video_activity"
android:layout_toEndOf="@id/subreddit_icon_gif_image_view_post_video_activity"
android:text="@string/choose_a_subreddit"
@ -67,6 +65,8 @@
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:text="@string/rules"
android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family" />

View File

@ -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" />
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"

View File

@ -67,7 +67,8 @@
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:layout_gravity="center_horizontal"
android:visibility="gone"/>
android:visibility="gone"
app:chipStrokeColor="#00000000" />
<RelativeLayout
android:layout_width="match_parent"