diff options
author | Alex Ning <chineseperson5@gmail.com> | 2020-03-01 01:42:57 +0000 |
---|---|---|
committer | Alex Ning <chineseperson5@gmail.com> | 2020-03-01 01:42:57 +0000 |
commit | 152a6a280ace51a09ed55fe1e57c2f9168a59c95 (patch) | |
tree | 2b9486cb4b1e1d41041285a2fd3323b21af10902 /app/src/main/java/ml | |
parent | e528158f03f1fb26b75a99180cfd2dac8de96222 (diff) | |
download | infinity-for-reddit-152a6a280ace51a09ed55fe1e57c2f9168a59c95.tar infinity-for-reddit-152a6a280ace51a09ed55fe1e57c2f9168a59c95.tar.gz infinity-for-reddit-152a6a280ace51a09ed55fe1e57c2f9168a59c95.tar.bz2 infinity-for-reddit-152a6a280ace51a09ed55fe1e57c2f9168a59c95.tar.lz infinity-for-reddit-152a6a280ace51a09ed55fe1e57c2f9168a59c95.tar.xz infinity-for-reddit-152a6a280ace51a09ed55fe1e57c2f9168a59c95.tar.zst infinity-for-reddit-152a6a280ace51a09ed55fe1e57c2f9168a59c95.zip |
Still prepare to support multiple themes.
Diffstat (limited to 'app/src/main/java/ml')
6 files changed, 131 insertions, 86 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/AccountPostsActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/AccountPostsActivity.java index 373a8655..39645f1d 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/AccountPostsActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/AccountPostsActivity.java @@ -38,9 +38,9 @@ import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.Post.PostDataSource; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; -import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils; import ml.docilealligator.infinityforreddit.SortType; import ml.docilealligator.infinityforreddit.SortTypeSelectionCallback; +import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils; public class AccountPostsActivity extends BaseActivity implements SortTypeSelectionCallback, PostLayoutBottomSheetFragment.PostLayoutSelectionCallback { @@ -86,9 +86,7 @@ public class AccountPostsActivity extends BaseActivity implements SortTypeSelect Resources resources = getResources(); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1 - && (resources.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT - || resources.getBoolean(R.bool.isTablet)) + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && mSharedPreferences.getBoolean(SharedPreferencesUtils.IMMERSIVE_INTERFACE_KEY, true)) { Window window = getWindow(); window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/AccountSavedThingActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/AccountSavedThingActivity.java index 7f3f0341..c7a2c256 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/AccountSavedThingActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/AccountSavedThingActivity.java @@ -124,12 +124,19 @@ public class AccountSavedThingActivity extends BaseActivity { } }); - int statusBarResourceId = getResources().getIdentifier("status_bar_height", "dimen", "android"); + /*int statusBarResourceId = getResources().getIdentifier("status_bar_height", "dimen", "android"); if (statusBarResourceId > 0) { ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) toolbar.getLayoutParams(); params.topMargin = getResources().getDimensionPixelSize(statusBarResourceId); toolbar.setLayoutParams(params); - } + }*/ + } + + int statusBarResourceId = getResources().getIdentifier("status_bar_height", "dimen", "android"); + if (statusBarResourceId > 0) { + ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) toolbar.getLayoutParams(); + params.topMargin = getResources().getDimensionPixelSize(statusBarResourceId); + toolbar.setLayoutParams(params); } setSupportActionBar(toolbar); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/BaseActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/BaseActivity.java index 0902a493..0f75fb87 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/BaseActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/BaseActivity.java @@ -2,21 +2,24 @@ package ml.docilealligator.infinityforreddit.Activity; import android.content.SharedPreferences; import android.content.res.Configuration; +import android.content.res.Resources; import android.os.Build; import android.os.Bundle; -import android.util.TypedValue; import android.view.View; +import android.view.ViewGroup; import android.view.Window; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatDelegate; +import androidx.appcompat.widget.Toolbar; import ml.docilealligator.infinityforreddit.ContentFontStyle; import ml.docilealligator.infinityforreddit.FontStyle; import ml.docilealligator.infinityforreddit.R; -import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils; import ml.docilealligator.infinityforreddit.TitleFontStyle; +import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils; +import ml.docilealligator.infinityforreddit.Utils.Utils; import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY; import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM; @@ -24,6 +27,12 @@ import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO; import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES; public abstract class BaseActivity extends AppCompatActivity { + private boolean immersiveInterface; + private boolean lightStatusbar; + private boolean changeStatusBarIconColor = true; + private int systemVisibilityToolbarExpanded; + private int systemVisibilityToolbarCollapsed; + @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -31,10 +40,14 @@ public abstract class BaseActivity extends AppCompatActivity { SharedPreferences mSharedPreferences = getSharedPreferences(); boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q; int themeType = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.THEME_KEY, "2")); + immersiveInterface = Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && + mSharedPreferences.getBoolean(SharedPreferencesUtils.IMMERSIVE_INTERFACE_KEY, true); switch (themeType) { case 0: AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO); getTheme().applyStyle(R.style.Theme_Purple, true); + lightStatusbar = true; + changeStatusBarIconColor = false; break; case 1: AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES); @@ -43,6 +56,7 @@ public abstract class BaseActivity extends AppCompatActivity { } else { getTheme().applyStyle(R.style.Theme_Default_NormalDark, true); } + changeStatusBarIconColor = false; break; case 2: if (systemDefault) { @@ -52,12 +66,15 @@ public abstract class BaseActivity extends AppCompatActivity { } if((getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_NO) { getTheme().applyStyle(R.style.Theme_Purple, true); + lightStatusbar = true; + changeStatusBarIconColor = false; } else { if(mSharedPreferences.getBoolean(SharedPreferencesUtils.AMOLED_DARK_KEY, false)) { getTheme().applyStyle(R.style.Theme_Default_AmoledDark, true); } else { getTheme().applyStyle(R.style.Theme_Default_NormalDark, true); } + changeStatusBarIconColor = false; } } @@ -70,17 +87,69 @@ public abstract class BaseActivity extends AppCompatActivity { getTheme().applyStyle(ContentFontStyle.valueOf(mSharedPreferences .getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true); + Window window = getWindow(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - Window window = getWindow(); - if ((getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_YES) { + if (lightStatusbar) { + window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR); + systemVisibilityToolbarExpanded = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR; + if (changeStatusBarIconColor) { + systemVisibilityToolbarCollapsed = View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR; + } + } else { window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR); + systemVisibilityToolbarExpanded = View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR; + if (changeStatusBarIconColor) { + systemVisibilityToolbarCollapsed = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR; + } + } + window.setNavigationBarColor(Utils.getAttributeColor(this, R.attr.navBarColor)); + } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + if (lightStatusbar) { + window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); + systemVisibilityToolbarExpanded = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR; + } + if (changeStatusBarIconColor) { + systemVisibilityToolbarCollapsed = 0; } - TypedValue typedValue = new TypedValue(); - getTheme().resolveAttribute(R.attr.navBarColor, typedValue, true); - int navBarColor = typedValue.data; - window.setNavigationBarColor(navBarColor); } } public abstract SharedPreferences getSharedPreferences(); + + protected boolean isLightStatusbar() { + return lightStatusbar; + } + protected boolean isChangeStatusBarIconColor() { + return changeStatusBarIconColor; + } + + protected int getSystemVisibilityToolbarExpanded() { + return systemVisibilityToolbarExpanded; + } + + protected int getSystemVisibilityToolbarCollapsed() { + return systemVisibilityToolbarCollapsed; + } + + protected boolean isImmersiveInterface() { + return immersiveInterface; + } + + protected void adjustToolbar(Toolbar toolbar) { + int statusBarResourceId = getResources().getIdentifier("status_bar_height", "dimen", "android"); + if (statusBarResourceId > 0) { + ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) toolbar.getLayoutParams(); + params.topMargin = getResources().getDimensionPixelSize(statusBarResourceId); + toolbar.setLayoutParams(params); + } + } + + protected int getNavBarHeight() { + Resources resources = getResources(); + int navBarResourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android"); + if (navBarResourceId > 0) { + return resources.getDimensionPixelSize(navBarResourceId); + } + return 0; + } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java index 2fd3c70c..1830e6cc 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java @@ -3,11 +3,9 @@ package ml.docilealligator.infinityforreddit.Activity; import android.app.Activity; import android.content.Intent; import android.content.SharedPreferences; -import android.content.res.Configuration; import android.content.res.Resources; import android.os.Build; import android.os.Bundle; -import android.util.TypedValue; import android.view.Gravity; import android.view.KeyEvent; import android.view.Menu; @@ -196,61 +194,34 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb EventBus.getDefault().register(this); - getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE); - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { Window window = getWindow(); - if ((getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_YES) { - window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR); - } - TypedValue typedValue = new TypedValue(); - getTheme().resolveAttribute(R.attr.navBarColor, typedValue, true); - int navBarColor = typedValue.data; - window.setNavigationBarColor(navBarColor); - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) { - Resources resources = getResources(); - - if ((resources.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT || resources.getBoolean(R.bool.isTablet)) - && mSharedPreferences.getBoolean(SharedPreferencesUtils.IMMERSIVE_INTERFACE_KEY, true)) { - window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); + Resources resources = getResources(); + View decorView = window.getDecorView(); - boolean lightNavBar = false; - if ((resources.getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_YES) { - lightNavBar = true; + if (isChangeStatusBarIconColor()) { + appBarLayout.addOnOffsetChangedListener(new AppBarStateChangeListener() { + @Override + public void onStateChanged(AppBarLayout appBarLayout, AppBarStateChangeListener.State state) { + if (state == State.COLLAPSED) { + decorView.setSystemUiVisibility(getSystemVisibilityToolbarCollapsed()); + } else if (state == State.EXPANDED) { + decorView.setSystemUiVisibility(getSystemVisibilityToolbarExpanded()); + } } - boolean finalLightNavBar = lightNavBar; + }); + } - View decorView = window.getDecorView(); - appBarLayout.addOnOffsetChangedListener(new AppBarStateChangeListener() { - @Override - public void onStateChanged(AppBarLayout appBarLayout, State state) { - if (state == State.COLLAPSED) { - if (finalLightNavBar) { - decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR); - } - } else if (state == State.EXPANDED) { - if (finalLightNavBar) { - decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR); - } - } - } - }); + if (isImmersiveInterface()) { + window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); - int statusBarResourceId = getResources().getIdentifier("status_bar_height", "dimen", "android"); - if (statusBarResourceId > 0) { - ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) toolbar.getLayoutParams(); - params.topMargin = resources.getDimensionPixelSize(statusBarResourceId); - toolbar.setLayoutParams(params); - } + adjustToolbar(toolbar); - int navBarResourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android"); - if (navBarResourceId > 0) { - int navBarHeight = resources.getDimensionPixelSize(navBarResourceId); - linearLayoutBottomAppBar.setPadding(0, - (int) (6 * resources.getDisplayMetrics().density), 0, navBarHeight); - navDrawerRecyclerView.setPadding(0, 0, 0, navBarHeight); - } + int navBarHeight = getNavBarHeight(); + if (navBarHeight > 0) { + linearLayoutBottomAppBar.setPadding(0, + (int) (6 * resources.getDisplayMetrics().density), 0, navBarHeight); + navDrawerRecyclerView.setPadding(0, 0, 0, navBarHeight); } } } @@ -506,7 +477,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb case R.string.dark_theme: mSharedPreferences.edit().putString(SharedPreferencesUtils.THEME_KEY, "1").apply(); AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES); - if(mSharedPreferences.getBoolean(SharedPreferencesUtils.AMOLED_DARK_KEY, false)) { + if (mSharedPreferences.getBoolean(SharedPreferencesUtils.AMOLED_DARK_KEY, false)) { getTheme().applyStyle(R.style.Theme_Default_AmoledDark, true); } else { getTheme().applyStyle(R.style.Theme_Default_NormalDark, true); @@ -1194,7 +1165,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb switch (viewPager.getCurrentItem()) { case 0: mSharedPreferences.edit().putString(SharedPreferencesUtils.SORT_TYPE_BEST_POST, sortType.getType().name()).apply(); - if(sortType.getTime() != null) { + if (sortType.getTime() != null) { mSharedPreferences.edit().putString(SharedPreferencesUtils.SORT_TIME_BEST_POST, sortType.getTime().name()).apply(); } @@ -1202,7 +1173,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb break; case 1: mSharedPreferences.edit().putString(SharedPreferencesUtils.SORT_TYPE_POPULAR_POST, sortType.getType().name()).apply(); - if(sortType.getTime() != null) { + if (sortType.getTime() != null) { mSharedPreferences.edit().putString(SharedPreferencesUtils.SORT_TIME_POPULAR_POST, sortType.getTime().name()).apply(); } @@ -1210,7 +1181,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb break; case 2: mSharedPreferences.edit().putString(SharedPreferencesUtils.SORT_TYPE_ALL_POST, sortType.getType().name()).apply(); - if(sortType.getTime() != null) { + if (sortType.getTime() != null) { mSharedPreferences.edit().putString(SharedPreferencesUtils.SORT_TIME_ALL_POST, sortType.getTime().name()).apply(); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java index 1842a59d..f4ea7620 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java @@ -460,10 +460,10 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS if (mAccessToken != null) { if (mPost.isSaved()) { saveItem.setVisible(true); - saveItem.setIcon(R.drawable.ic_bookmark_black_24dp); + saveItem.setIcon(R.drawable.ic_bookmark_toolbar_24dp); } else { saveItem.setVisible(true); - saveItem.setIcon(R.drawable.ic_bookmark_border_black_24dp); + saveItem.setIcon(R.drawable.ic_bookmark_border_toolbar_24dp); } if (mPost.isHidden()) { @@ -601,10 +601,10 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS if (mAccessToken != null) { if (post.isSaved()) { saveItem.setVisible(true); - saveItem.setIcon(R.drawable.ic_bookmark_black_24dp); + saveItem.setIcon(R.drawable.ic_bookmark_toolbar_24dp); } else { saveItem.setVisible(true); - saveItem.setIcon(R.drawable.ic_bookmark_border_black_24dp); + saveItem.setIcon(R.drawable.ic_bookmark_border_toolbar_24dp); } if (post.isHidden()) { @@ -911,10 +911,10 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS if (mAccessToken != null) { if (post.isSaved()) { saveItem.setVisible(true); - saveItem.setIcon(R.drawable.ic_bookmark_black_24dp); + saveItem.setIcon(R.drawable.ic_bookmark_toolbar_24dp); } else { saveItem.setVisible(true); - saveItem.setIcon(R.drawable.ic_bookmark_border_black_24dp); + saveItem.setIcon(R.drawable.ic_bookmark_border_toolbar_24dp); } if (post.isHidden()) { @@ -1181,10 +1181,10 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS if (mMenu != null) { if (event.post.isSaved()) { mMenu.findItem(R.id.action_save_view_post_detail_activity).setIcon(getResources() - .getDrawable(R.drawable.ic_bookmark_black_24dp)); + .getDrawable(R.drawable.ic_bookmark_toolbar_24dp)); } else { mMenu.findItem(R.id.action_save_view_post_detail_activity).setIcon(getResources() - .getDrawable(R.drawable.ic_bookmark_border_black_24dp)); + .getDrawable(R.drawable.ic_bookmark_border_toolbar_24dp)); } } mAdapter.updatePost(mPost); @@ -1241,10 +1241,10 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS if (mAccessToken != null) { if (mPost.isSaved()) { saveItem.setVisible(true); - saveItem.setIcon(R.drawable.ic_bookmark_black_24dp); + saveItem.setIcon(R.drawable.ic_bookmark_toolbar_24dp); } else { saveItem.setVisible(true); - saveItem.setIcon(R.drawable.ic_bookmark_border_black_24dp); + saveItem.setIcon(R.drawable.ic_bookmark_border_toolbar_24dp); } if (mPost.isHidden()) { @@ -1324,13 +1324,13 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS case R.id.action_save_view_post_detail_activity: if (mPost != null && mAccessToken != null) { if (mPost.isSaved()) { - item.setIcon(R.drawable.ic_bookmark_border_black_24dp); + item.setIcon(R.drawable.ic_bookmark_border_toolbar_24dp); SaveThing.unsaveThing(mOauthRetrofit, mAccessToken, mPost.getFullName(), new SaveThing.SaveThingListener() { @Override public void success() { mPost.setSaved(false); - item.setIcon(R.drawable.ic_bookmark_border_black_24dp); + item.setIcon(R.drawable.ic_bookmark_border_toolbar_24dp); showMessage(R.string.post_unsaved_success); EventBus.getDefault().post(new PostUpdateEventToPostList(mPost, postListPosition)); } @@ -1338,19 +1338,19 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS @Override public void failed() { mPost.setSaved(true); - item.setIcon(R.drawable.ic_bookmark_black_24dp); + item.setIcon(R.drawable.ic_bookmark_toolbar_24dp); showMessage(R.string.post_unsaved_failed); EventBus.getDefault().post(new PostUpdateEventToPostList(mPost, postListPosition)); } }); } else { - item.setIcon(R.drawable.ic_bookmark_black_24dp); + item.setIcon(R.drawable.ic_bookmark_toolbar_24dp); SaveThing.saveThing(mOauthRetrofit, mAccessToken, mPost.getFullName(), new SaveThing.SaveThingListener() { @Override public void success() { mPost.setSaved(true); - item.setIcon(R.drawable.ic_bookmark_black_24dp); + item.setIcon(R.drawable.ic_bookmark_toolbar_24dp); showMessage(R.string.post_saved_success); EventBus.getDefault().post(new PostUpdateEventToPostList(mPost, postListPosition)); } @@ -1358,7 +1358,7 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS @Override public void failed() { mPost.setSaved(false); - item.setIcon(R.drawable.ic_bookmark_border_black_24dp); + item.setIcon(R.drawable.ic_bookmark_border_toolbar_24dp); showMessage(R.string.post_saved_failed); EventBus.getDefault().post(new PostUpdateEventToPostList(mPost, postListPosition)); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java index 6c5a74d0..41dc90cf 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java @@ -1502,7 +1502,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView MaterialCardView cardView; @BindView(R.id.icon_gif_image_view_item_post) AspectRatioGifImageView iconGifImageView; - @BindView(R.id.name_text_view_item_post) + @BindView(R.id.subreddit_name_text_view_item_post) TextView subredditTextView; @BindView(R.id.user_text_view_item_post) TextView userTextView; |