diff options
author | Alex Ning <chineseperson5@gmail.com> | 2019-12-18 10:41:23 +0000 |
---|---|---|
committer | Alex Ning <chineseperson5@gmail.com> | 2019-12-18 10:41:23 +0000 |
commit | dafd0796e914a5b540c2edb272b62a3afd468c2d (patch) | |
tree | 0053be1e140c6257c90ef57fe51e55361bfe582e /app/src/main/java | |
parent | 5097919a3616b4dab44cc36e24fe8b08d7daf8dc (diff) | |
download | infinity-for-reddit-dafd0796e914a5b540c2edb272b62a3afd468c2d.tar infinity-for-reddit-dafd0796e914a5b540c2edb272b62a3afd468c2d.tar.gz infinity-for-reddit-dafd0796e914a5b540c2edb272b62a3afd468c2d.tar.bz2 infinity-for-reddit-dafd0796e914a5b540c2edb272b62a3afd468c2d.tar.lz infinity-for-reddit-dafd0796e914a5b540c2edb272b62a3afd468c2d.tar.xz infinity-for-reddit-dafd0796e914a5b540c2edb272b62a3afd468c2d.tar.zst infinity-for-reddit-dafd0796e914a5b540c2edb272b62a3afd468c2d.zip |
Hide FAB and BottomAppBar in anonymous mode.
Diffstat (limited to 'app/src/main/java')
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java | 23 |
1 files changed, 11 insertions, 12 deletions
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 d8021fce..525d8273 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java @@ -329,14 +329,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb getCurrentAccountAndBindView(); } - fab.setOnClickListener(view -> { - if (mAccessToken == null) { - Toast.makeText(MainActivity.this, R.string.login_first, Toast.LENGTH_SHORT).show(); - return; - } - - postTypeBottomSheetFragment.show(getSupportFragmentManager(), postTypeBottomSheetFragment.getTag()); - }); + fab.setOnClickListener(view -> postTypeBottomSheetFragment.show(getSupportFragmentManager(), postTypeBottomSheetFragment.getTag())); } @Override @@ -453,8 +446,10 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb if (mAccessToken == null) { bottomNavigationView.setVisibility(View.GONE); + fab.setVisibility(View.GONE); } else { bottomNavigationView.setVisibility(View.VISIBLE); + fab.setVisibility(View.VISIBLE); subscriptionsBottomAppBar.setOnClickListener(view -> { Intent intent = new Intent(MainActivity.this, SubscribedThingListingActivity.class); startActivity(intent); @@ -924,13 +919,17 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb } public void postScrollUp() { - bottomNavigationView.performShow(); - fab.show(); + if (mAccessToken != null) { + bottomNavigationView.performShow(); + fab.show(); + } } public void postScrollDown() { - fab.hide(); - bottomNavigationView.performHide(); + if (mAccessToken != null) { + fab.hide(); + bottomNavigationView.performHide(); + } } @Subscribe |