diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java | 23 | ||||
-rw-r--r-- | app/src/main/res/layout/app_bar_main.xml | 2 |
2 files changed, 13 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 diff --git a/app/src/main/res/layout/app_bar_main.xml b/app/src/main/res/layout/app_bar_main.xml index 1fcb0353..78636065 100644 --- a/app/src/main/res/layout/app_bar_main.xml +++ b/app/src/main/res/layout/app_bar_main.xml @@ -62,6 +62,7 @@ android:layout_height="wrap_content" android:layout_gravity="bottom" android:gravity="center" + android:visibility="gone" app:backgroundTint="?attr/backgroundColor" app:layout_anchorGravity="start" app:fabAnimationMode="scale" @@ -110,6 +111,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="@dimen/fab_margin" + android:visibility="gone" app:backgroundTint="?attr/backgroundColor" app:srcCompat="@drawable/ic_add_bottom_app_bar_24dp" app:tint="@null" |