mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2025-01-04 07:17:12 +01:00
Show the FAB in anonymous mode.
This commit is contained in:
parent
f376de69e1
commit
3938d9734f
@ -68,9 +68,9 @@ import butterknife.ButterKnife;
|
|||||||
import ml.docilealligator.infinityforreddit.ActivityToolbarInterface;
|
import ml.docilealligator.infinityforreddit.ActivityToolbarInterface;
|
||||||
import ml.docilealligator.infinityforreddit.FetchMyInfo;
|
import ml.docilealligator.infinityforreddit.FetchMyInfo;
|
||||||
import ml.docilealligator.infinityforreddit.FetchSubscribedThing;
|
import ml.docilealligator.infinityforreddit.FetchSubscribedThing;
|
||||||
import ml.docilealligator.infinityforreddit.PostFragmentContentScrollingInterface;
|
|
||||||
import ml.docilealligator.infinityforreddit.Infinity;
|
import ml.docilealligator.infinityforreddit.Infinity;
|
||||||
import ml.docilealligator.infinityforreddit.MarkPostAsReadInterface;
|
import ml.docilealligator.infinityforreddit.MarkPostAsReadInterface;
|
||||||
|
import ml.docilealligator.infinityforreddit.PostFragmentContentScrollingInterface;
|
||||||
import ml.docilealligator.infinityforreddit.PullNotificationWorker;
|
import ml.docilealligator.infinityforreddit.PullNotificationWorker;
|
||||||
import ml.docilealligator.infinityforreddit.R;
|
import ml.docilealligator.infinityforreddit.R;
|
||||||
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
|
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
|
||||||
@ -201,11 +201,6 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
|
|||||||
private FragmentManager fragmentManager;
|
private FragmentManager fragmentManager;
|
||||||
private SectionsPagerAdapter sectionsPagerAdapter;
|
private SectionsPagerAdapter sectionsPagerAdapter;
|
||||||
private AppBarLayout.LayoutParams params;
|
private AppBarLayout.LayoutParams params;
|
||||||
private PostTypeBottomSheetFragment postTypeBottomSheetFragment;
|
|
||||||
private SortTypeBottomSheetFragment sortTypeBottomSheetFragment;
|
|
||||||
private SortTimeBottomSheetFragment sortTimeBottomSheetFragment;
|
|
||||||
private PostLayoutBottomSheetFragment postLayoutBottomSheetFragment;
|
|
||||||
private FABMoreOptionsBottomSheetFragment fabMoreOptionsBottomSheetFragment;
|
|
||||||
private NavigationDrawerRecyclerViewAdapter adapter;
|
private NavigationDrawerRecyclerViewAdapter adapter;
|
||||||
private boolean mNullAccessToken = false;
|
private boolean mNullAccessToken = false;
|
||||||
private String mAccessToken;
|
private String mAccessToken;
|
||||||
@ -226,6 +221,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
|
|||||||
private boolean mDisableSwipingBetweenTabs;
|
private boolean mDisableSwipingBetweenTabs;
|
||||||
private boolean mShowFavoriteSubscribedSubreddits;
|
private boolean mShowFavoriteSubscribedSubreddits;
|
||||||
private boolean mShowSubscribedSubreddits;
|
private boolean mShowSubscribedSubreddits;
|
||||||
|
private int fabOption;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@ -278,12 +274,6 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
postTypeBottomSheetFragment = new PostTypeBottomSheetFragment();
|
|
||||||
sortTypeBottomSheetFragment = new SortTypeBottomSheetFragment();
|
|
||||||
sortTimeBottomSheetFragment = new SortTimeBottomSheetFragment();
|
|
||||||
postLayoutBottomSheetFragment = new PostLayoutBottomSheetFragment();
|
|
||||||
fabMoreOptionsBottomSheetFragment = new FABMoreOptionsBottomSheetFragment();
|
|
||||||
|
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
setToolbarGoToTop(toolbar);
|
setToolbarGoToTop(toolbar);
|
||||||
|
|
||||||
@ -513,8 +503,11 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mAccessToken == null) {
|
if (mAccessToken == null) {
|
||||||
|
CoordinatorLayout.LayoutParams lp = (CoordinatorLayout.LayoutParams) fab.getLayoutParams();
|
||||||
|
lp.setAnchorId(View.NO_ID);
|
||||||
|
lp.gravity = Gravity.END | Gravity.BOTTOM;
|
||||||
|
fab.setLayoutParams(lp);
|
||||||
bottomAppBar.setVisibility(View.GONE);
|
bottomAppBar.setVisibility(View.GONE);
|
||||||
fab.setVisibility(View.GONE);
|
|
||||||
} else {
|
} else {
|
||||||
if (showBottomAppBar) {
|
if (showBottomAppBar) {
|
||||||
int optionCount = bottomAppBarSharedPreference.getInt(SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_COUNT, 4);
|
int optionCount = bottomAppBarSharedPreference.getInt(SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_COUNT, 4);
|
||||||
@ -569,205 +562,222 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
|
|||||||
lp.gravity = Gravity.END | Gravity.BOTTOM;
|
lp.gravity = Gravity.END | Gravity.BOTTOM;
|
||||||
fab.setLayoutParams(lp);
|
fab.setLayoutParams(lp);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int fabOption = bottomAppBarSharedPreference.getInt(SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB, SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_SUBMIT_POSTS);
|
fabOption = bottomAppBarSharedPreference.getInt(SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB,
|
||||||
|
SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_SUBMIT_POSTS);
|
||||||
|
switch (fabOption) {
|
||||||
|
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_REFRESH:
|
||||||
|
fab.setImageResource(R.drawable.ic_refresh_24dp);
|
||||||
|
break;
|
||||||
|
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_CHANGE_SORT_TYPE:
|
||||||
|
fab.setImageResource(R.drawable.ic_sort_toolbar_24dp);
|
||||||
|
break;
|
||||||
|
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_CHANGE_POST_LAYOUT:
|
||||||
|
fab.setImageResource(R.drawable.ic_post_layout_24dp);
|
||||||
|
break;
|
||||||
|
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_SEARCH:
|
||||||
|
fab.setImageResource(R.drawable.ic_search_black_24dp);
|
||||||
|
break;
|
||||||
|
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_GO_TO_SUBREDDIT:
|
||||||
|
fab.setImageResource(R.drawable.ic_subreddit_24dp);
|
||||||
|
break;
|
||||||
|
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_GO_TO_USER:
|
||||||
|
fab.setImageResource(R.drawable.ic_user_24dp);
|
||||||
|
break;
|
||||||
|
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_RANDOM:
|
||||||
|
fab.setImageResource(R.drawable.ic_random_24dp);
|
||||||
|
break;
|
||||||
|
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_HIDE_READ_POSTS:
|
||||||
|
if (mAccessToken == null) {
|
||||||
|
fab.setImageResource(R.drawable.ic_filter_24dp);
|
||||||
|
fabOption = SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_FILTER_POSTS;
|
||||||
|
} else {
|
||||||
|
fab.setImageResource(R.drawable.ic_hide_read_posts_24dp);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_FILTER_POSTS:
|
||||||
|
fab.setImageResource(R.drawable.ic_filter_24dp);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if (mAccessToken == null) {
|
||||||
|
fab.setImageResource(R.drawable.ic_filter_24dp);
|
||||||
|
fabOption = SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_FILTER_POSTS;
|
||||||
|
} else {
|
||||||
|
fab.setImageResource(R.drawable.ic_add_day_night_24dp);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
fab.setOnClickListener(view -> {
|
||||||
switch (fabOption) {
|
switch (fabOption) {
|
||||||
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_REFRESH:
|
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_REFRESH: {
|
||||||
fab.setImageResource(R.drawable.ic_refresh_24dp);
|
if (sectionsPagerAdapter != null) {
|
||||||
|
sectionsPagerAdapter.refresh();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_CHANGE_SORT_TYPE:
|
}
|
||||||
fab.setImageResource(R.drawable.ic_sort_toolbar_24dp);
|
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_CHANGE_SORT_TYPE: {
|
||||||
|
changeSortType();
|
||||||
break;
|
break;
|
||||||
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_CHANGE_POST_LAYOUT:
|
}
|
||||||
fab.setImageResource(R.drawable.ic_post_layout_24dp);
|
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_CHANGE_POST_LAYOUT: {
|
||||||
|
PostLayoutBottomSheetFragment postLayoutBottomSheetFragment = new PostLayoutBottomSheetFragment();
|
||||||
|
postLayoutBottomSheetFragment.show(getSupportFragmentManager(), postLayoutBottomSheetFragment.getTag());
|
||||||
break;
|
break;
|
||||||
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_SEARCH:
|
}
|
||||||
fab.setImageResource(R.drawable.ic_search_black_24dp);
|
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_SEARCH: {
|
||||||
|
Intent intent = new Intent(this, SearchActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_GO_TO_SUBREDDIT:
|
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_GO_TO_SUBREDDIT:
|
||||||
fab.setImageResource(R.drawable.ic_subreddit_24dp);
|
goToSubreddit();
|
||||||
break;
|
break;
|
||||||
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_GO_TO_USER:
|
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_GO_TO_USER:
|
||||||
fab.setImageResource(R.drawable.ic_user_24dp);
|
goToUser();
|
||||||
break;
|
break;
|
||||||
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_RANDOM:
|
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_RANDOM:
|
||||||
fab.setImageResource(R.drawable.ic_random_24dp);
|
randomThing();
|
||||||
break;
|
break;
|
||||||
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_HIDE_READ_POSTS:
|
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_HIDE_READ_POSTS:
|
||||||
fab.setImageResource(R.drawable.ic_hide_read_posts_24dp);
|
if (sectionsPagerAdapter != null) {
|
||||||
|
sectionsPagerAdapter.hideReadPosts();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_FILTER_POSTS:
|
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_FILTER_POSTS:
|
||||||
fab.setImageResource(R.drawable.ic_filter_24dp);
|
if (sectionsPagerAdapter != null) {
|
||||||
|
sectionsPagerAdapter.filterPosts();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fab.setImageResource(R.drawable.ic_add_day_night_24dp);
|
PostTypeBottomSheetFragment postTypeBottomSheetFragment = new PostTypeBottomSheetFragment();
|
||||||
|
postTypeBottomSheetFragment.show(getSupportFragmentManager(), postTypeBottomSheetFragment.getTag());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
fab.setOnClickListener(view -> {
|
});
|
||||||
switch (fabOption) {
|
fab.setOnLongClickListener(view -> {
|
||||||
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_REFRESH: {
|
FABMoreOptionsBottomSheetFragment fabMoreOptionsBottomSheetFragment= new FABMoreOptionsBottomSheetFragment();
|
||||||
if (sectionsPagerAdapter != null) {
|
Bundle bundle = new Bundle();
|
||||||
sectionsPagerAdapter.refresh();
|
bundle.putBoolean(FABMoreOptionsBottomSheetFragment.EXTRA_ANONYMOUS_MODE, mAccessToken == null);
|
||||||
}
|
fabMoreOptionsBottomSheetFragment.setArguments(bundle);
|
||||||
break;
|
fabMoreOptionsBottomSheetFragment.show(getSupportFragmentManager(), fabMoreOptionsBottomSheetFragment.getTag());
|
||||||
}
|
return true;
|
||||||
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_CHANGE_SORT_TYPE: {
|
});
|
||||||
changeSortType();
|
fab.setVisibility(View.VISIBLE);
|
||||||
break;
|
|
||||||
}
|
|
||||||
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_CHANGE_POST_LAYOUT: {
|
|
||||||
postLayoutBottomSheetFragment.show(getSupportFragmentManager(), postLayoutBottomSheetFragment.getTag());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_SEARCH: {
|
|
||||||
Intent intent = new Intent(this, SearchActivity.class);
|
|
||||||
startActivity(intent);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_GO_TO_SUBREDDIT:
|
|
||||||
goToSubreddit();
|
|
||||||
break;
|
|
||||||
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_GO_TO_USER:
|
|
||||||
goToUser();
|
|
||||||
break;
|
|
||||||
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_RANDOM:
|
|
||||||
randomThing();
|
|
||||||
break;
|
|
||||||
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_HIDE_READ_POSTS:
|
|
||||||
if (sectionsPagerAdapter != null) {
|
|
||||||
sectionsPagerAdapter.hideReadPosts();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_FILTER_POSTS:
|
|
||||||
if (sectionsPagerAdapter != null) {
|
|
||||||
sectionsPagerAdapter.filterPosts();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
postTypeBottomSheetFragment.show(getSupportFragmentManager(), postTypeBottomSheetFragment.getTag());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
fab.setOnLongClickListener(view -> {
|
|
||||||
fabMoreOptionsBottomSheetFragment.show(getSupportFragmentManager(), fabMoreOptionsBottomSheetFragment.getTag());
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
fab.setVisibility(View.VISIBLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
adapter = new NavigationDrawerRecyclerViewAdapter(this, mSharedPreferences,
|
adapter = new NavigationDrawerRecyclerViewAdapter(this, mSharedPreferences,
|
||||||
mNsfwAndSpoilerSharedPreferences, mCustomThemeWrapper, mAccountName,
|
mNsfwAndSpoilerSharedPreferences, mCustomThemeWrapper, mAccountName,
|
||||||
mProfileImageUrl, mBannerImageUrl, mKarma,
|
mProfileImageUrl, mBannerImageUrl, mKarma,
|
||||||
new NavigationDrawerRecyclerViewAdapter.ItemClickListener() {
|
new NavigationDrawerRecyclerViewAdapter.ItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onMenuClick(int stringId) {
|
public void onMenuClick(int stringId) {
|
||||||
Intent intent = null;
|
Intent intent = null;
|
||||||
switch (stringId) {
|
switch (stringId) {
|
||||||
case R.string.profile:
|
case R.string.profile:
|
||||||
intent = new Intent(MainActivity.this, ViewUserDetailActivity.class);
|
intent = new Intent(MainActivity.this, ViewUserDetailActivity.class);
|
||||||
intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, mAccountName);
|
intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, mAccountName);
|
||||||
break;
|
break;
|
||||||
case R.string.subscriptions:
|
case R.string.subscriptions:
|
||||||
intent = new Intent(MainActivity.this, SubscribedThingListingActivity.class);
|
intent = new Intent(MainActivity.this, SubscribedThingListingActivity.class);
|
||||||
break;
|
break;
|
||||||
case R.string.multi_reddit:
|
case R.string.multi_reddit:
|
||||||
intent = new Intent(MainActivity.this, SubscribedThingListingActivity.class);
|
intent = new Intent(MainActivity.this, SubscribedThingListingActivity.class);
|
||||||
intent.putExtra(SubscribedThingListingActivity.EXTRA_SHOW_MULTIREDDITS, true);
|
intent.putExtra(SubscribedThingListingActivity.EXTRA_SHOW_MULTIREDDITS, true);
|
||||||
break;
|
break;
|
||||||
case R.string.inbox:
|
case R.string.inbox:
|
||||||
intent = new Intent(MainActivity.this, InboxActivity.class);
|
intent = new Intent(MainActivity.this, InboxActivity.class);
|
||||||
break;
|
break;
|
||||||
case R.string.upvoted:
|
case R.string.upvoted:
|
||||||
intent = new Intent(MainActivity.this, AccountPostsActivity.class);
|
intent = new Intent(MainActivity.this, AccountPostsActivity.class);
|
||||||
intent.putExtra(AccountPostsActivity.EXTRA_USER_WHERE, PostDataSource.USER_WHERE_UPVOTED);
|
intent.putExtra(AccountPostsActivity.EXTRA_USER_WHERE, PostDataSource.USER_WHERE_UPVOTED);
|
||||||
break;
|
break;
|
||||||
case R.string.downvoted:
|
case R.string.downvoted:
|
||||||
intent = new Intent(MainActivity.this, AccountPostsActivity.class);
|
intent = new Intent(MainActivity.this, AccountPostsActivity.class);
|
||||||
intent.putExtra(AccountPostsActivity.EXTRA_USER_WHERE, PostDataSource.USER_WHERE_DOWNVOTED);
|
intent.putExtra(AccountPostsActivity.EXTRA_USER_WHERE, PostDataSource.USER_WHERE_DOWNVOTED);
|
||||||
break;
|
break;
|
||||||
case R.string.hidden:
|
case R.string.hidden:
|
||||||
intent = new Intent(MainActivity.this, AccountPostsActivity.class);
|
intent = new Intent(MainActivity.this, AccountPostsActivity.class);
|
||||||
intent.putExtra(AccountPostsActivity.EXTRA_USER_WHERE, PostDataSource.USER_WHERE_HIDDEN);
|
intent.putExtra(AccountPostsActivity.EXTRA_USER_WHERE, PostDataSource.USER_WHERE_HIDDEN);
|
||||||
break;
|
break;
|
||||||
case R.string.saved:
|
case R.string.saved:
|
||||||
intent = new Intent(MainActivity.this, AccountSavedThingActivity.class);
|
intent = new Intent(MainActivity.this, AccountSavedThingActivity.class);
|
||||||
break;
|
break;
|
||||||
case R.string.gilded:
|
case R.string.gilded:
|
||||||
intent = new Intent(MainActivity.this, AccountPostsActivity.class);
|
intent = new Intent(MainActivity.this, AccountPostsActivity.class);
|
||||||
intent.putExtra(AccountPostsActivity.EXTRA_USER_WHERE, PostDataSource.USER_WHERE_GILDED);
|
intent.putExtra(AccountPostsActivity.EXTRA_USER_WHERE, PostDataSource.USER_WHERE_GILDED);
|
||||||
break;
|
break;
|
||||||
case R.string.light_theme:
|
case R.string.light_theme:
|
||||||
mSharedPreferences.edit().putString(SharedPreferencesUtils.THEME_KEY, "0").apply();
|
mSharedPreferences.edit().putString(SharedPreferencesUtils.THEME_KEY, "0").apply();
|
||||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
|
||||||
mCustomThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.LIGHT);
|
mCustomThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.LIGHT);
|
||||||
break;
|
break;
|
||||||
case R.string.dark_theme:
|
case R.string.dark_theme:
|
||||||
mSharedPreferences.edit().putString(SharedPreferencesUtils.THEME_KEY, "1").apply();
|
mSharedPreferences.edit().putString(SharedPreferencesUtils.THEME_KEY, "1").apply();
|
||||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
|
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
|
||||||
if (mSharedPreferences.getBoolean(SharedPreferencesUtils.AMOLED_DARK_KEY, false)) {
|
if (mSharedPreferences.getBoolean(SharedPreferencesUtils.AMOLED_DARK_KEY, false)) {
|
||||||
mCustomThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.AMOLED);
|
mCustomThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.AMOLED);
|
||||||
} else {
|
} else {
|
||||||
mCustomThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.DARK);
|
mCustomThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.DARK);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case R.string.enable_nsfw:
|
case R.string.enable_nsfw:
|
||||||
if (sectionsPagerAdapter != null) {
|
if (sectionsPagerAdapter != null) {
|
||||||
mNsfwAndSpoilerSharedPreferences.edit().putBoolean((mAccountName == null ? "" : mAccountName) + SharedPreferencesUtils.NSFW_BASE, true).apply();
|
mNsfwAndSpoilerSharedPreferences.edit().putBoolean((mAccountName == null ? "" : mAccountName) + SharedPreferencesUtils.NSFW_BASE, true).apply();
|
||||||
sectionsPagerAdapter.changeNSFW(true);
|
sectionsPagerAdapter.changeNSFW(true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case R.string.disable_nsfw:
|
case R.string.disable_nsfw:
|
||||||
if (sectionsPagerAdapter != null) {
|
if (sectionsPagerAdapter != null) {
|
||||||
mNsfwAndSpoilerSharedPreferences.edit().putBoolean((mAccountName == null ? "" : mAccountName) + SharedPreferencesUtils.NSFW_BASE, false).apply();
|
mNsfwAndSpoilerSharedPreferences.edit().putBoolean((mAccountName == null ? "" : mAccountName) + SharedPreferencesUtils.NSFW_BASE, false).apply();
|
||||||
sectionsPagerAdapter.changeNSFW(false);
|
sectionsPagerAdapter.changeNSFW(false);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case R.string.settings:
|
case R.string.settings:
|
||||||
intent = new Intent(MainActivity.this, SettingsActivity.class);
|
intent = new Intent(MainActivity.this, SettingsActivity.class);
|
||||||
break;
|
break;
|
||||||
case R.string.add_account:
|
case R.string.add_account:
|
||||||
Intent addAccountIntent = new Intent(MainActivity.this, LoginActivity.class);
|
Intent addAccountIntent = new Intent(MainActivity.this, LoginActivity.class);
|
||||||
startActivityForResult(addAccountIntent, LOGIN_ACTIVITY_REQUEST_CODE);
|
startActivityForResult(addAccountIntent, LOGIN_ACTIVITY_REQUEST_CODE);
|
||||||
break;
|
break;
|
||||||
case R.string.anonymous_account:
|
case R.string.anonymous_account:
|
||||||
new SwitchToAnonymousAccountAsyncTask(mRedditDataRoomDatabase, false,
|
new SwitchToAnonymousAccountAsyncTask(mRedditDataRoomDatabase, false,
|
||||||
() -> {
|
() -> {
|
||||||
Intent anonymousIntent = new Intent(MainActivity.this, MainActivity.class);
|
Intent anonymousIntent = new Intent(MainActivity.this, MainActivity.class);
|
||||||
startActivity(anonymousIntent);
|
startActivity(anonymousIntent);
|
||||||
finish();
|
finish();
|
||||||
}).execute();
|
}).execute();
|
||||||
break;
|
break;
|
||||||
case R.string.log_out:
|
case R.string.log_out:
|
||||||
new SwitchToAnonymousAccountAsyncTask(mRedditDataRoomDatabase, true,
|
new SwitchToAnonymousAccountAsyncTask(mRedditDataRoomDatabase, true,
|
||||||
() -> {
|
() -> {
|
||||||
Intent logOutIntent = new Intent(MainActivity.this, MainActivity.class);
|
Intent logOutIntent = new Intent(MainActivity.this, MainActivity.class);
|
||||||
startActivity(logOutIntent);
|
startActivity(logOutIntent);
|
||||||
finish();
|
finish();
|
||||||
}).execute();
|
}).execute();
|
||||||
|
|
||||||
}
|
}
|
||||||
if (intent != null) {
|
if (intent != null) {
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
drawer.closeDrawers();
|
drawer.closeDrawers();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSubscribedSubredditClick(String subredditName) {
|
public void onSubscribedSubredditClick(String subredditName) {
|
||||||
Intent intent = new Intent(MainActivity.this, ViewSubredditDetailActivity.class);
|
Intent intent = new Intent(MainActivity.this, ViewSubredditDetailActivity.class);
|
||||||
intent.putExtra(ViewSubredditDetailActivity.EXTRA_SUBREDDIT_NAME_KEY, subredditName);
|
intent.putExtra(ViewSubredditDetailActivity.EXTRA_SUBREDDIT_NAME_KEY, subredditName);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAccountClick(String accountName) {
|
public void onAccountClick(String accountName) {
|
||||||
new SwitchAccountAsyncTask(mRedditDataRoomDatabase, accountName, newAccount -> {
|
new SwitchAccountAsyncTask(mRedditDataRoomDatabase, accountName, newAccount -> {
|
||||||
Intent intent = new Intent(MainActivity.this, MainActivity.class);
|
Intent intent = new Intent(MainActivity.this, MainActivity.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
finish();
|
finish();
|
||||||
}).execute();
|
}).execute();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
navDrawerRecyclerView.setLayoutManager(new LinearLayoutManager(this));
|
navDrawerRecyclerView.setLayoutManager(new LinearLayoutManager(this));
|
||||||
navDrawerRecyclerView.setAdapter(adapter);
|
navDrawerRecyclerView.setAdapter(adapter);
|
||||||
|
|
||||||
@ -829,8 +839,8 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
|
|||||||
if (showBottomAppBar) {
|
if (showBottomAppBar) {
|
||||||
bottomAppBar.performShow();
|
bottomAppBar.performShow();
|
||||||
}
|
}
|
||||||
fab.show();
|
|
||||||
}
|
}
|
||||||
|
fab.show();
|
||||||
sectionsPagerAdapter.displaySortTypeInToolbar();
|
sectionsPagerAdapter.displaySortTypeInToolbar();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -928,7 +938,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
|
|||||||
public void onFetchMyInfoFailed(boolean parseFailed) {
|
public void onFetchMyInfoFailed(boolean parseFailed) {
|
||||||
mFetchUserInfoSuccess = false;
|
mFetchUserInfoSuccess = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -971,6 +981,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
|
|||||||
} else {
|
} else {
|
||||||
bundle.putBoolean(SortTypeBottomSheetFragment.EXTRA_NO_BEST_TYPE, false);
|
bundle.putBoolean(SortTypeBottomSheetFragment.EXTRA_NO_BEST_TYPE, false);
|
||||||
}
|
}
|
||||||
|
SortTypeBottomSheetFragment sortTypeBottomSheetFragment = new SortTypeBottomSheetFragment();
|
||||||
sortTypeBottomSheetFragment.setArguments(bundle);
|
sortTypeBottomSheetFragment.setArguments(bundle);
|
||||||
sortTypeBottomSheetFragment.show(getSupportFragmentManager(), sortTypeBottomSheetFragment.getTag());
|
sortTypeBottomSheetFragment.show(getSupportFragmentManager(), sortTypeBottomSheetFragment.getTag());
|
||||||
}
|
}
|
||||||
@ -1011,6 +1022,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
case R.id.action_change_post_layout_main_activity:
|
case R.id.action_change_post_layout_main_activity:
|
||||||
|
PostLayoutBottomSheetFragment postLayoutBottomSheetFragment = new PostLayoutBottomSheetFragment();
|
||||||
postLayoutBottomSheetFragment.show(getSupportFragmentManager(), postLayoutBottomSheetFragment.getTag());
|
postLayoutBottomSheetFragment.show(getSupportFragmentManager(), postLayoutBottomSheetFragment.getTag());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1074,6 +1086,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sortTypeSelected(String sortType) {
|
public void sortTypeSelected(String sortType) {
|
||||||
|
SortTimeBottomSheetFragment sortTimeBottomSheetFragment = new SortTimeBottomSheetFragment();
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putString(SortTimeBottomSheetFragment.EXTRA_SORT_TYPE, sortType);
|
bundle.putString(SortTimeBottomSheetFragment.EXTRA_SORT_TYPE, sortType);
|
||||||
sortTimeBottomSheetFragment.setArguments(bundle);
|
sortTimeBottomSheetFragment.setArguments(bundle);
|
||||||
@ -1109,25 +1122,21 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void contentScrollUp() {
|
public void contentScrollUp() {
|
||||||
if (mAccessToken != null) {
|
if (mAccessToken != null && showBottomAppBar && !mLockBottomAppBar) {
|
||||||
if (showBottomAppBar && !mLockBottomAppBar) {
|
bottomAppBar.performShow();
|
||||||
bottomAppBar.performShow();
|
}
|
||||||
}
|
if (!(mAccessToken != null && showBottomAppBar && mLockBottomAppBar)) {
|
||||||
if (!(showBottomAppBar && mLockBottomAppBar)) {
|
fab.show();
|
||||||
fab.show();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void contentScrollDown() {
|
public void contentScrollDown() {
|
||||||
if (mAccessToken != null) {
|
if (!(mAccessToken != null && showBottomAppBar && mLockBottomAppBar)) {
|
||||||
if (!(showBottomAppBar && mLockBottomAppBar)) {
|
fab.hide();
|
||||||
fab.hide();
|
}
|
||||||
}
|
if (mAccessToken != null && showBottomAppBar && !mLockBottomAppBar) {
|
||||||
if (showBottomAppBar && !mLockBottomAppBar) {
|
bottomAppBar.performHide();
|
||||||
bottomAppBar.performHide();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1190,6 +1199,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
|
|||||||
public void fabOptionSelected(int option) {
|
public void fabOptionSelected(int option) {
|
||||||
switch (option) {
|
switch (option) {
|
||||||
case FABMoreOptionsBottomSheetFragment.FAB_OPTION_SUBMIT_POST:
|
case FABMoreOptionsBottomSheetFragment.FAB_OPTION_SUBMIT_POST:
|
||||||
|
PostTypeBottomSheetFragment postTypeBottomSheetFragment = new PostTypeBottomSheetFragment();
|
||||||
postTypeBottomSheetFragment.show(getSupportFragmentManager(), postTypeBottomSheetFragment.getTag());
|
postTypeBottomSheetFragment.show(getSupportFragmentManager(), postTypeBottomSheetFragment.getTag());
|
||||||
break;
|
break;
|
||||||
case FABMoreOptionsBottomSheetFragment.FAB_OPTION_REFRESH:
|
case FABMoreOptionsBottomSheetFragment.FAB_OPTION_REFRESH:
|
||||||
@ -1201,6 +1211,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
|
|||||||
changeSortType();
|
changeSortType();
|
||||||
break;
|
break;
|
||||||
case FABMoreOptionsBottomSheetFragment.FAB_OPTION_CHANGE_POST_LAYOUT:
|
case FABMoreOptionsBottomSheetFragment.FAB_OPTION_CHANGE_POST_LAYOUT:
|
||||||
|
PostLayoutBottomSheetFragment postLayoutBottomSheetFragment = new PostLayoutBottomSheetFragment();
|
||||||
postLayoutBottomSheetFragment.show(getSupportFragmentManager(), postLayoutBottomSheetFragment.getTag());
|
postLayoutBottomSheetFragment.show(getSupportFragmentManager(), postLayoutBottomSheetFragment.getTag());
|
||||||
break;
|
break;
|
||||||
case FABMoreOptionsBottomSheetFragment.FAB_OPTION_SEARCH:
|
case FABMoreOptionsBottomSheetFragment.FAB_OPTION_SEARCH:
|
||||||
@ -1562,4 +1573,4 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -118,6 +118,7 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect
|
|||||||
private FragmentManager fragmentManager;
|
private FragmentManager fragmentManager;
|
||||||
private SectionsPagerAdapter sectionsPagerAdapter;
|
private SectionsPagerAdapter sectionsPagerAdapter;
|
||||||
private SlidrInterface mSlidrInterface;
|
private SlidrInterface mSlidrInterface;
|
||||||
|
private int fabOption;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@ -241,6 +242,7 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect
|
|||||||
viewPager2.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {
|
viewPager2.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onPageSelected(int position) {
|
public void onPageSelected(int position) {
|
||||||
|
fab.show();
|
||||||
sectionsPagerAdapter.displaySortTypeInToolbar();
|
sectionsPagerAdapter.displaySortTypeInToolbar();
|
||||||
if (position == 0) {
|
if (position == 0) {
|
||||||
unlockSwipeRightToGoBack();
|
unlockSwipeRightToGoBack();
|
||||||
@ -264,7 +266,7 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect
|
|||||||
}).attach();
|
}).attach();
|
||||||
fixViewPager2Sensitivity(viewPager2);
|
fixViewPager2Sensitivity(viewPager2);
|
||||||
|
|
||||||
int fabOption = bottomAppBarSharedPreference.getInt(SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB, SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_SUBMIT_POSTS);
|
fabOption = bottomAppBarSharedPreference.getInt(SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB, SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_SUBMIT_POSTS);
|
||||||
switch (fabOption) {
|
switch (fabOption) {
|
||||||
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_REFRESH:
|
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_REFRESH:
|
||||||
fab.setImageResource(R.drawable.ic_refresh_24dp);
|
fab.setImageResource(R.drawable.ic_refresh_24dp);
|
||||||
@ -290,6 +292,7 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect
|
|||||||
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_HIDE_READ_POSTS:
|
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_HIDE_READ_POSTS:
|
||||||
if (mAccessToken == null) {
|
if (mAccessToken == null) {
|
||||||
fab.setImageResource(R.drawable.ic_filter_24dp);
|
fab.setImageResource(R.drawable.ic_filter_24dp);
|
||||||
|
fabOption = SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_FILTER_POSTS;
|
||||||
} else {
|
} else {
|
||||||
fab.setImageResource(R.drawable.ic_hide_read_posts_24dp);
|
fab.setImageResource(R.drawable.ic_hide_read_posts_24dp);
|
||||||
}
|
}
|
||||||
@ -300,6 +303,7 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect
|
|||||||
default:
|
default:
|
||||||
if (mAccessToken == null) {
|
if (mAccessToken == null) {
|
||||||
fab.setImageResource(R.drawable.ic_filter_24dp);
|
fab.setImageResource(R.drawable.ic_filter_24dp);
|
||||||
|
fabOption = SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_FILTER_POSTS;
|
||||||
} else {
|
} else {
|
||||||
fab.setImageResource(R.drawable.ic_add_day_night_24dp);
|
fab.setImageResource(R.drawable.ic_add_day_night_24dp);
|
||||||
}
|
}
|
||||||
|
@ -222,6 +222,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
|||||||
private int collapsedTabIndicatorColor;
|
private int collapsedTabIndicatorColor;
|
||||||
private int unsubscribedColor;
|
private int unsubscribedColor;
|
||||||
private int subscribedColor;
|
private int subscribedColor;
|
||||||
|
private int fabOption;
|
||||||
private SlidrInterface mSlidrInterface;
|
private SlidrInterface mSlidrInterface;
|
||||||
private MaterialAlertDialogBuilder nsfwWarningBuilder;
|
private MaterialAlertDialogBuilder nsfwWarningBuilder;
|
||||||
|
|
||||||
@ -687,96 +688,110 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
|||||||
lp.gravity = Gravity.END | Gravity.BOTTOM;
|
lp.gravity = Gravity.END | Gravity.BOTTOM;
|
||||||
fab.setLayoutParams(lp);
|
fab.setLayoutParams(lp);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
int fabOption = bottomAppBarSharedPreference.getInt(SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB, SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_SUBMIT_POSTS);
|
CoordinatorLayout.LayoutParams lp = (CoordinatorLayout.LayoutParams) fab.getLayoutParams();
|
||||||
|
lp.setAnchorId(View.NO_ID);
|
||||||
|
lp.gravity = Gravity.END | Gravity.BOTTOM;
|
||||||
|
fab.setLayoutParams(lp);
|
||||||
|
bottomNavigationView.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
fabOption = bottomAppBarSharedPreference.getInt(SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB, SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_SUBMIT_POSTS);
|
||||||
|
switch (fabOption) {
|
||||||
|
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_REFRESH:
|
||||||
|
fab.setImageResource(R.drawable.ic_refresh_24dp);
|
||||||
|
break;
|
||||||
|
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_CHANGE_SORT_TYPE:
|
||||||
|
fab.setImageResource(R.drawable.ic_sort_toolbar_24dp);
|
||||||
|
break;
|
||||||
|
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_CHANGE_POST_LAYOUT:
|
||||||
|
fab.setImageResource(R.drawable.ic_post_layout_24dp);
|
||||||
|
break;
|
||||||
|
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_SEARCH:
|
||||||
|
fab.setImageResource(R.drawable.ic_search_black_24dp);
|
||||||
|
break;
|
||||||
|
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_GO_TO_SUBREDDIT:
|
||||||
|
fab.setImageResource(R.drawable.ic_subreddit_24dp);
|
||||||
|
break;
|
||||||
|
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_GO_TO_USER:
|
||||||
|
fab.setImageResource(R.drawable.ic_user_24dp);
|
||||||
|
break;
|
||||||
|
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_RANDOM:
|
||||||
|
fab.setImageResource(R.drawable.ic_random_24dp);
|
||||||
|
break;
|
||||||
|
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_HIDE_READ_POSTS:
|
||||||
|
if (mAccessToken == null) {
|
||||||
|
fab.setImageResource(R.drawable.ic_filter_24dp);
|
||||||
|
fabOption = SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_FILTER_POSTS;
|
||||||
|
} else {
|
||||||
|
fab.setImageResource(R.drawable.ic_hide_read_posts_24dp);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_FILTER_POSTS:
|
||||||
|
fab.setImageResource(R.drawable.ic_filter_24dp);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if (mAccessToken == null) {
|
||||||
|
fab.setImageResource(R.drawable.ic_filter_24dp);
|
||||||
|
fabOption = SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_FILTER_POSTS;
|
||||||
|
} else {
|
||||||
|
fab.setImageResource(R.drawable.ic_add_day_night_24dp);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
fab.setOnClickListener(view -> {
|
||||||
switch (fabOption) {
|
switch (fabOption) {
|
||||||
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_REFRESH:
|
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_REFRESH: {
|
||||||
fab.setImageResource(R.drawable.ic_refresh_24dp);
|
if (sectionsPagerAdapter != null) {
|
||||||
|
sectionsPagerAdapter.refresh();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_CHANGE_SORT_TYPE:
|
}
|
||||||
fab.setImageResource(R.drawable.ic_sort_toolbar_24dp);
|
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_CHANGE_SORT_TYPE: {
|
||||||
|
sortTypeBottomSheetFragment.show(getSupportFragmentManager(), sortTypeBottomSheetFragment.getTag());
|
||||||
break;
|
break;
|
||||||
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_CHANGE_POST_LAYOUT:
|
}
|
||||||
fab.setImageResource(R.drawable.ic_post_layout_24dp);
|
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_CHANGE_POST_LAYOUT: {
|
||||||
|
postLayoutBottomSheetFragment.show(getSupportFragmentManager(), postLayoutBottomSheetFragment.getTag());
|
||||||
break;
|
break;
|
||||||
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_SEARCH:
|
}
|
||||||
fab.setImageResource(R.drawable.ic_search_black_24dp);
|
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_SEARCH: {
|
||||||
|
Intent intent = new Intent(this, SearchActivity.class);
|
||||||
|
intent.putExtra(SearchActivity.EXTRA_SUBREDDIT_NAME, subredditName);
|
||||||
|
startActivity(intent);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_GO_TO_SUBREDDIT:
|
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_GO_TO_SUBREDDIT:
|
||||||
fab.setImageResource(R.drawable.ic_subreddit_24dp);
|
goToSubreddit();
|
||||||
break;
|
break;
|
||||||
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_GO_TO_USER:
|
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_GO_TO_USER:
|
||||||
fab.setImageResource(R.drawable.ic_user_24dp);
|
goToUser();
|
||||||
break;
|
break;
|
||||||
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_RANDOM:
|
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_RANDOM:
|
||||||
fab.setImageResource(R.drawable.ic_random_24dp);
|
random();
|
||||||
break;
|
break;
|
||||||
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_HIDE_READ_POSTS:
|
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_HIDE_READ_POSTS:
|
||||||
fab.setImageResource(R.drawable.ic_hide_read_posts_24dp);
|
if (sectionsPagerAdapter != null) {
|
||||||
|
sectionsPagerAdapter.hideReadPosts();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_FILTER_POSTS:
|
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_FILTER_POSTS:
|
||||||
fab.setImageResource(R.drawable.ic_filter_24dp);
|
if (sectionsPagerAdapter != null) {
|
||||||
|
sectionsPagerAdapter.filterPosts();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fab.setImageResource(R.drawable.ic_add_day_night_24dp);
|
postTypeBottomSheetFragment.show(getSupportFragmentManager(), postTypeBottomSheetFragment.getTag());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
fab.setOnClickListener(view -> {
|
});
|
||||||
switch (fabOption) {
|
fab.setOnLongClickListener(view -> {
|
||||||
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_REFRESH: {
|
Bundle bundle = new Bundle();
|
||||||
if (sectionsPagerAdapter != null) {
|
bundle.putBoolean(FABMoreOptionsBottomSheetFragment.EXTRA_ANONYMOUS_MODE, mAccessToken == null);
|
||||||
sectionsPagerAdapter.refresh();
|
fabMoreOptionsBottomSheetFragment.setArguments(bundle);
|
||||||
}
|
fabMoreOptionsBottomSheetFragment.show(getSupportFragmentManager(), fabMoreOptionsBottomSheetFragment.getTag());
|
||||||
break;
|
return true;
|
||||||
}
|
});
|
||||||
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_CHANGE_SORT_TYPE: {
|
fab.setVisibility(View.VISIBLE);
|
||||||
sortTypeBottomSheetFragment.show(getSupportFragmentManager(), sortTypeBottomSheetFragment.getTag());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_CHANGE_POST_LAYOUT: {
|
|
||||||
postLayoutBottomSheetFragment.show(getSupportFragmentManager(), postLayoutBottomSheetFragment.getTag());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_SEARCH: {
|
|
||||||
Intent intent = new Intent(this, SearchActivity.class);
|
|
||||||
intent.putExtra(SearchActivity.EXTRA_SUBREDDIT_NAME, subredditName);
|
|
||||||
startActivity(intent);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_GO_TO_SUBREDDIT:
|
|
||||||
goToSubreddit();
|
|
||||||
break;
|
|
||||||
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_GO_TO_USER:
|
|
||||||
goToUser();
|
|
||||||
break;
|
|
||||||
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_RANDOM:
|
|
||||||
random();
|
|
||||||
break;
|
|
||||||
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_HIDE_READ_POSTS:
|
|
||||||
if (sectionsPagerAdapter != null) {
|
|
||||||
sectionsPagerAdapter.hideReadPosts();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_FILTER_POSTS:
|
|
||||||
if (sectionsPagerAdapter != null) {
|
|
||||||
sectionsPagerAdapter.filterPosts();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
postTypeBottomSheetFragment.show(getSupportFragmentManager(), postTypeBottomSheetFragment.getTag());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
fab.setOnLongClickListener(view -> {
|
|
||||||
fabMoreOptionsBottomSheetFragment.show(getSupportFragmentManager(), fabMoreOptionsBottomSheetFragment.getTag());
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
|
|
||||||
fab.setVisibility(View.VISIBLE);
|
|
||||||
} else {
|
|
||||||
bottomNavigationView.setVisibility(View.GONE);
|
|
||||||
fab.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
subscribeSubredditChip.setOnClickListener(view -> {
|
subscribeSubredditChip.setOnClickListener(view -> {
|
||||||
if (mAccessToken == null) {
|
if (mAccessToken == null) {
|
||||||
@ -857,8 +872,8 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
|||||||
if (showBottomAppBar) {
|
if (showBottomAppBar) {
|
||||||
bottomNavigationView.performShow();
|
bottomNavigationView.performShow();
|
||||||
}
|
}
|
||||||
fab.show();
|
|
||||||
}
|
}
|
||||||
|
fab.show();
|
||||||
|
|
||||||
sectionsPagerAdapter.displaySortTypeInToolbar();
|
sectionsPagerAdapter.displaySortTypeInToolbar();
|
||||||
}
|
}
|
||||||
|
@ -217,6 +217,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
|
|||||||
private int collapsedTabIndicatorColor;
|
private int collapsedTabIndicatorColor;
|
||||||
private int unsubscribedColor;
|
private int unsubscribedColor;
|
||||||
private int subscribedColor;
|
private int subscribedColor;
|
||||||
|
private int fabOption;
|
||||||
private boolean showToast = false;
|
private boolean showToast = false;
|
||||||
private boolean showBottomAppBar;
|
private boolean showBottomAppBar;
|
||||||
private boolean lockBottomAppBar;
|
private boolean lockBottomAppBar;
|
||||||
@ -633,8 +634,8 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
|
|||||||
if (showBottomAppBar) {
|
if (showBottomAppBar) {
|
||||||
bottomNavigationView.performShow();
|
bottomNavigationView.performShow();
|
||||||
}
|
}
|
||||||
fab.show();
|
|
||||||
}
|
}
|
||||||
|
fab.show();
|
||||||
|
|
||||||
sectionsPagerAdapter.displaySortTypeInToolbar();
|
sectionsPagerAdapter.displaySortTypeInToolbar();
|
||||||
}
|
}
|
||||||
@ -710,97 +711,112 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
|
|||||||
lp.gravity = Gravity.END | Gravity.BOTTOM;
|
lp.gravity = Gravity.END | Gravity.BOTTOM;
|
||||||
fab.setLayoutParams(lp);
|
fab.setLayoutParams(lp);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
int fabOption = bottomAppBarSharedPreference.getInt(SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB, SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_SUBMIT_POSTS);
|
CoordinatorLayout.LayoutParams lp = (CoordinatorLayout.LayoutParams) fab.getLayoutParams();
|
||||||
|
lp.setAnchorId(View.NO_ID);
|
||||||
|
lp.gravity = Gravity.END | Gravity.BOTTOM;
|
||||||
|
fab.setLayoutParams(lp);
|
||||||
|
bottomNavigationView.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
fabOption = bottomAppBarSharedPreference.getInt(SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB, SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_SUBMIT_POSTS);
|
||||||
|
switch (fabOption) {
|
||||||
|
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_REFRESH:
|
||||||
|
fab.setImageResource(R.drawable.ic_refresh_24dp);
|
||||||
|
break;
|
||||||
|
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_CHANGE_SORT_TYPE:
|
||||||
|
fab.setImageResource(R.drawable.ic_sort_toolbar_24dp);
|
||||||
|
break;
|
||||||
|
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_CHANGE_POST_LAYOUT:
|
||||||
|
fab.setImageResource(R.drawable.ic_post_layout_24dp);
|
||||||
|
break;
|
||||||
|
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_SEARCH:
|
||||||
|
fab.setImageResource(R.drawable.ic_search_black_24dp);
|
||||||
|
break;
|
||||||
|
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_GO_TO_SUBREDDIT:
|
||||||
|
fab.setImageResource(R.drawable.ic_subreddit_24dp);
|
||||||
|
break;
|
||||||
|
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_GO_TO_USER:
|
||||||
|
fab.setImageResource(R.drawable.ic_user_24dp);
|
||||||
|
break;
|
||||||
|
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_RANDOM:
|
||||||
|
fab.setImageResource(R.drawable.ic_random_24dp);
|
||||||
|
break;
|
||||||
|
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_HIDE_READ_POSTS:
|
||||||
|
if (mAccessToken == null) {
|
||||||
|
fab.setImageResource(R.drawable.ic_filter_24dp);
|
||||||
|
fabOption = SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_FILTER_POSTS;
|
||||||
|
} else {
|
||||||
|
fab.setImageResource(R.drawable.ic_hide_read_posts_24dp);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_FILTER_POSTS:
|
||||||
|
fab.setImageResource(R.drawable.ic_filter_24dp);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if (mAccessToken == null) {
|
||||||
|
fab.setImageResource(R.drawable.ic_filter_24dp);
|
||||||
|
fabOption = SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_FILTER_POSTS;
|
||||||
|
} else {
|
||||||
|
fab.setImageResource(R.drawable.ic_add_day_night_24dp);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
fab.setOnClickListener(view -> {
|
||||||
switch (fabOption) {
|
switch (fabOption) {
|
||||||
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_REFRESH:
|
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_REFRESH: {
|
||||||
fab.setImageResource(R.drawable.ic_refresh_24dp);
|
if (sectionsPagerAdapter != null) {
|
||||||
|
sectionsPagerAdapter.refresh();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_CHANGE_SORT_TYPE:
|
}
|
||||||
fab.setImageResource(R.drawable.ic_sort_toolbar_24dp);
|
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_CHANGE_SORT_TYPE: {
|
||||||
|
userThingSortTypeBottomSheetFragment.show(getSupportFragmentManager(), userThingSortTypeBottomSheetFragment.getTag());
|
||||||
break;
|
break;
|
||||||
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_CHANGE_POST_LAYOUT:
|
}
|
||||||
fab.setImageResource(R.drawable.ic_post_layout_24dp);
|
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_CHANGE_POST_LAYOUT: {
|
||||||
|
postLayoutBottomSheetFragment.show(getSupportFragmentManager(), postLayoutBottomSheetFragment.getTag());
|
||||||
break;
|
break;
|
||||||
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_SEARCH:
|
}
|
||||||
fab.setImageResource(R.drawable.ic_search_black_24dp);
|
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_SEARCH: {
|
||||||
|
Intent intent = new Intent(this, SearchActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_GO_TO_SUBREDDIT:
|
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_GO_TO_SUBREDDIT:
|
||||||
fab.setImageResource(R.drawable.ic_subreddit_24dp);
|
goToSubreddit();
|
||||||
break;
|
break;
|
||||||
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_GO_TO_USER:
|
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_GO_TO_USER:
|
||||||
fab.setImageResource(R.drawable.ic_user_24dp);
|
goToUser();
|
||||||
break;
|
break;
|
||||||
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_RANDOM:
|
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_RANDOM:
|
||||||
fab.setImageResource(R.drawable.ic_random_24dp);
|
random();
|
||||||
break;
|
break;
|
||||||
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_HIDE_READ_POSTS:
|
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_HIDE_READ_POSTS:
|
||||||
fab.setImageResource(R.drawable.ic_hide_read_posts_24dp);
|
if (sectionsPagerAdapter != null) {
|
||||||
|
sectionsPagerAdapter.hideReadPosts();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_FILTER_POSTS:
|
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_FILTER_POSTS:
|
||||||
fab.setImageResource(R.drawable.ic_filter_24dp);
|
if (sectionsPagerAdapter != null) {
|
||||||
|
sectionsPagerAdapter.filterPosts();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fab.setImageResource(R.drawable.ic_add_day_night_24dp);
|
PostTypeBottomSheetFragment postTypeBottomSheetFragment = new PostTypeBottomSheetFragment();
|
||||||
|
postTypeBottomSheetFragment.show(getSupportFragmentManager(), postTypeBottomSheetFragment.getTag());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
fab.setOnClickListener(view -> {
|
});
|
||||||
switch (fabOption) {
|
fab.setOnLongClickListener(view -> {
|
||||||
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_REFRESH: {
|
FABMoreOptionsBottomSheetFragment fabMoreOptionsBottomSheetFragment = new FABMoreOptionsBottomSheetFragment();
|
||||||
if (sectionsPagerAdapter != null) {
|
Bundle bundle = new Bundle();
|
||||||
sectionsPagerAdapter.refresh();
|
bundle.putBoolean(FABMoreOptionsBottomSheetFragment.EXTRA_ANONYMOUS_MODE, mAccessToken == null);
|
||||||
}
|
fabMoreOptionsBottomSheetFragment.setArguments(bundle);
|
||||||
break;
|
fabMoreOptionsBottomSheetFragment.show(getSupportFragmentManager(), fabMoreOptionsBottomSheetFragment.getTag());
|
||||||
}
|
return true;
|
||||||
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_CHANGE_SORT_TYPE: {
|
});
|
||||||
userThingSortTypeBottomSheetFragment.show(getSupportFragmentManager(), userThingSortTypeBottomSheetFragment.getTag());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_CHANGE_POST_LAYOUT: {
|
|
||||||
postLayoutBottomSheetFragment.show(getSupportFragmentManager(), postLayoutBottomSheetFragment.getTag());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_SEARCH: {
|
|
||||||
Intent intent = new Intent(this, SearchActivity.class);
|
|
||||||
startActivity(intent);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_GO_TO_SUBREDDIT:
|
|
||||||
goToSubreddit();
|
|
||||||
break;
|
|
||||||
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_GO_TO_USER:
|
|
||||||
goToUser();
|
|
||||||
break;
|
|
||||||
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_RANDOM:
|
|
||||||
random();
|
|
||||||
break;
|
|
||||||
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_HIDE_READ_POSTS:
|
|
||||||
if (sectionsPagerAdapter != null) {
|
|
||||||
sectionsPagerAdapter.hideReadPosts();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_FILTER_POSTS:
|
|
||||||
if (sectionsPagerAdapter != null) {
|
|
||||||
sectionsPagerAdapter.filterPosts();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
PostTypeBottomSheetFragment postTypeBottomSheetFragment = new PostTypeBottomSheetFragment();
|
|
||||||
postTypeBottomSheetFragment.show(getSupportFragmentManager(), postTypeBottomSheetFragment.getTag());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
fab.setOnLongClickListener(view -> {
|
|
||||||
FABMoreOptionsBottomSheetFragment fabMoreOptionsBottomSheetFragment = new FABMoreOptionsBottomSheetFragment();
|
|
||||||
fabMoreOptionsBottomSheetFragment.show(getSupportFragmentManager(), fabMoreOptionsBottomSheetFragment.getTag());
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
|
|
||||||
fab.setVisibility(View.VISIBLE);
|
fab.setVisibility(View.VISIBLE);
|
||||||
} else {
|
|
||||||
bottomNavigationView.setVisibility(View.GONE);
|
|
||||||
fab.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void bottomAppBarOptionAction(int option) {
|
private void bottomAppBarOptionAction(int option) {
|
||||||
|
@ -184,7 +184,6 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="@dimen/fab_margin"
|
android:layout_margin="@dimen/fab_margin"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
app:tint="@android:color/white"
|
|
||||||
app:layout_anchor="@id/bottom_app_bar_bottom_app_bar" />
|
app:layout_anchor="@id/bottom_app_bar_bottom_app_bar" />
|
||||||
|
|
||||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
@ -151,7 +151,6 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="@dimen/fab_margin"
|
android:layout_margin="@dimen/fab_margin"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
app:tint="@android:color/white"
|
|
||||||
app:layout_anchor="@id/bottom_app_bar_bottom_app_bar" />
|
app:layout_anchor="@id/bottom_app_bar_bottom_app_bar" />
|
||||||
|
|
||||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
Loading…
Reference in New Issue
Block a user