Add custom theme entries for read posts. Fix crash in ViewUserDetailActivity.

This commit is contained in:
Alex Ning 2020-12-09 00:29:22 +08:00
parent 7cf90856d6
commit b38025882d
7 changed files with 47 additions and 5 deletions

View File

@ -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<Void, Void, Void> {
private UserDao userDao;

View File

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

View File

@ -173,7 +173,7 @@
</com.google.android.material.appbar.AppBarLayout>
<include
layout="@layout/bottom_app_bar_other_activities"
layout="@layout/bottom_app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom" />

View File

@ -140,7 +140,7 @@
</com.google.android.material.appbar.AppBarLayout>
<include
layout="@layout/bottom_app_bar_other_activities"
layout="@layout/bottom_app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom" />

View File

@ -52,7 +52,7 @@
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<include
layout="@layout/bottom_app_bar_other_activities"
layout="@layout/bottom_app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom" />

View File

@ -630,6 +630,10 @@
<string name="theme_item_post_title_color_detail">Applied to: Post title</string>
<string name="theme_item_post_content_color">Post Content Color</string>
<string name="theme_item_post_content_color_detail">Applied to: Post content</string>
<string name="theme_item_read_post_title_color">Read Post Title Color</string>
<string name="theme_item_read_post_title_color_detail">Applied to: Read Post Title</string>
<string name="theme_item_read_post_content_color">Read Post Content Color</string>
<string name="theme_item_read_post_content_color_detail">Applied to: Read Post Content</string>
<string name="theme_item_comment_color">Comment Color</string>
<string name="theme_item_comment_color_detail">Applied to: Comment</string>
<string name="theme_item_button_text_color">Button Text Color</string>
@ -646,6 +650,8 @@
<string name="theme_item_background_color_detail">Applied to: Background of every page and navigation drawer</string>
<string name="theme_item_card_view_background_color">Card View Background Color</string>
<string name="theme_item_card_view_background_color_detail">Applied to: Post background and message background</string>
<string name="theme_item_read_post_card_view_background_color">Read Post Card View Background Color</string>
<string name="theme_item_read_post_card_view_background_color_detail">Applied to: Read Post background</string>
<string name="theme_item_comment_background_color">Comment Background Color</string>
<string name="theme_item_comment_background_color_detail">Applied to: Comment background</string>
<string name="theme_item_fully_collapsed_comment_background_color">Fully-Collapsed Comment Background Color</string>