From b38025882d7b03adb0a3acad136b90d4bafdcf0a Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Wed, 9 Dec 2020 00:29:22 +0800 Subject: Add custom theme entries for read posts. Fix crash in ViewUserDetailActivity. --- .../activities/ViewUserDetailActivity.java | 26 ++++++++- .../customtheme/CustomThemeSettingsItem.java | 14 +++++ .../res/layout/activity_view_subreddit_detail.xml | 2 +- .../main/res/layout/activity_view_user_detail.xml | 2 +- app/src/main/res/layout/app_bar_main.xml | 2 +- app/src/main/res/layout/bottom_app_bar.xml | 66 ++++++++++++++++++++++ .../res/layout/bottom_app_bar_other_activities.xml | 66 ---------------------- app/src/main/res/values/strings.xml | 6 ++ 8 files changed, 113 insertions(+), 71 deletions(-) create mode 100644 app/src/main/res/layout/bottom_app_bar.xml delete mode 100644 app/src/main/res/layout/bottom_app_bar_other_activities.xml (limited to 'app/src') 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 d1c32368..d5fb3823 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java @@ -106,8 +106,8 @@ import pl.droidsonroids.gif.GifImageView; import retrofit2.Retrofit; public class ViewUserDetailActivity extends BaseActivity implements SortTypeSelectionCallback, - PostLayoutBottomSheetFragment.PostLayoutSelectionCallback, ActivityToolbarInterface, - FABMoreOptionsBottomSheetFragment.FABOptionSelectionCallback, + PostTypeBottomSheetFragment.PostTypeSelectionCallback, PostLayoutBottomSheetFragment.PostLayoutSelectionCallback, + ActivityToolbarInterface, FABMoreOptionsBottomSheetFragment.FABOptionSelectionCallback, RandomBottomSheetFragment.RandomOptionSelectionCallback, MarkPostAsReadInterface { public static final String EXTRA_USER_NAME_KEY = "EUNK"; @@ -1241,6 +1241,28 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele InsertReadPost.insertReadPost(mRedditDataRoomDatabase, mAccountName, post.getId()); } + @Override + public void postTypeSelected(int postType) { + Intent intent; + switch (postType) { + case PostTypeBottomSheetFragment.TYPE_TEXT: + intent = new Intent(this, PostTextActivity.class); + startActivity(intent); + break; + case PostTypeBottomSheetFragment.TYPE_LINK: + intent = new Intent(this, PostLinkActivity.class); + startActivity(intent); + break; + case PostTypeBottomSheetFragment.TYPE_IMAGE: + intent = new Intent(this, PostImageActivity.class); + startActivity(intent); + break; + case PostTypeBottomSheetFragment.TYPE_VIDEO: + intent = new Intent(this, PostVideoActivity.class); + startActivity(intent); + } + } + private static class InsertUserDataAsyncTask extends AsyncTask { private UserDao userDao; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/customtheme/CustomThemeSettingsItem.java b/app/src/main/java/ml/docilealligator/infinityforreddit/customtheme/CustomThemeSettingsItem.java index 56ad8718..e61d87c9 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/customtheme/CustomThemeSettingsItem.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/customtheme/CustomThemeSettingsItem.java @@ -98,6 +98,16 @@ public class CustomThemeSettingsItem implements Parcelable { context.getString(R.string.theme_item_post_content_color), context.getString(R.string.theme_item_post_content_color_detail), customTheme.postContentColor)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_read_post_title_color), + context.getString(R.string.theme_item_read_post_title_color_detail), + customTheme.readPostTitleColor + )); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_read_post_content_color), + context.getString(R.string.theme_item_read_post_content_color_detail), + customTheme.readPostContentColor + )); customThemeSettingsItems.add(new CustomThemeSettingsItem( context.getString(R.string.theme_item_comment_color), context.getString(R.string.theme_item_comment_color_detail), @@ -130,6 +140,10 @@ public class CustomThemeSettingsItem implements Parcelable { context.getString(R.string.theme_item_card_view_background_color), context.getString(R.string.theme_item_card_view_background_color_detail), customTheme.cardViewBackgroundColor)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_read_post_card_view_background_color), + context.getString(R.string.theme_item_read_post_card_view_background_color_detail), + customTheme.readPostCardViewBackgroundColor)); customThemeSettingsItems.add(new CustomThemeSettingsItem( context.getString(R.string.theme_item_comment_background_color), context.getString(R.string.theme_item_comment_background_color_detail), 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 ef26b762..fbaf0fab 100644 --- a/app/src/main/res/layout/activity_view_subreddit_detail.xml +++ b/app/src/main/res/layout/activity_view_subreddit_detail.xml @@ -173,7 +173,7 @@ 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 3ace2e08..8cad86b9 100644 --- a/app/src/main/res/layout/activity_view_user_detail.xml +++ b/app/src/main/res/layout/activity_view_user_detail.xml @@ -140,7 +140,7 @@ diff --git a/app/src/main/res/layout/app_bar_main.xml b/app/src/main/res/layout/app_bar_main.xml index c17ef9f7..85db79c9 100644 --- a/app/src/main/res/layout/app_bar_main.xml +++ b/app/src/main/res/layout/app_bar_main.xml @@ -52,7 +52,7 @@ app:layout_behavior="@string/appbar_scrolling_view_behavior" /> diff --git a/app/src/main/res/layout/bottom_app_bar.xml b/app/src/main/res/layout/bottom_app_bar.xml new file mode 100644 index 00000000..fa1d886f --- /dev/null +++ b/app/src/main/res/layout/bottom_app_bar.xml @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/bottom_app_bar_other_activities.xml b/app/src/main/res/layout/bottom_app_bar_other_activities.xml deleted file mode 100644 index fa1d886f..00000000 --- a/app/src/main/res/layout/bottom_app_bar_other_activities.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 2fe0623c..87b52482 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -630,6 +630,10 @@ Applied to: Post title Post Content Color Applied to: Post content + Read Post Title Color + Applied to: Read Post Title + Read Post Content Color + Applied to: Read Post Content Comment Color Applied to: Comment Button Text Color @@ -646,6 +650,8 @@ Applied to: Background of every page and navigation drawer Card View Background Color Applied to: Post background and message background + Read Post Card View Background Color + Applied to: Read Post background Comment Background Color Applied to: Comment background Fully-Collapsed Comment Background Color -- cgit v1.2.3