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 240f4b4a..d6eeba0c 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,14 @@ package ml.docilealligator.infinityforreddit.Activity;
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
+import android.content.res.ColorStateList;
import android.content.res.Configuration;
import android.content.res.Resources;
+import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.util.TypedValue;
+import android.view.Gravity;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
@@ -24,6 +27,7 @@ import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.appcompat.widget.Toolbar;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
+import androidx.core.content.ContextCompat;
import androidx.core.view.GravityCompat;
import androidx.core.widget.NestedScrollView;
import androidx.drawerlayout.widget.DrawerLayout;
@@ -139,6 +143,8 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
LinearLayout profileLinearLayout;
@BindView(R.id.subscriptions_linear_layout_main_activity)
LinearLayout subscriptionLinearLayout;
+ @BindView(R.id.multi_reddits_linear_layout_main_activity)
+ LinearLayout multiRedditsLinearLayout;
@BindView(R.id.inbox_linear_layout_main_activity)
LinearLayout inboxLinearLayout;
@BindView(R.id.post_label_main_activity)
@@ -448,7 +454,17 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
bottomNavigationView.setVisibility(View.GONE);
fab.setVisibility(View.GONE);
} else {
- bottomNavigationView.setVisibility(View.VISIBLE);
+ if (mSharedPreferences.getBoolean(SharedPreferencesUtils.BOTTOM_APP_BAR_KEY, false)) {
+ bottomNavigationView.setVisibility(View.VISIBLE);
+ } else {
+ CoordinatorLayout.LayoutParams lp = (CoordinatorLayout.LayoutParams) fab.getLayoutParams();
+ lp.setAnchorId(View.NO_ID);
+ lp.gravity = Gravity.END | Gravity.BOTTOM;
+ fab.setLayoutParams(lp);
+ fab.setImageTintList(ColorStateList.valueOf(Color.WHITE));
+ fab.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.backgroundColorPrimary)));
+ }
+
fab.setVisibility(View.VISIBLE);
subscriptionsBottomAppBar.setOnClickListener(view -> {
Intent intent = new Intent(MainActivity.this, SubscribedThingListingActivity.class);
@@ -603,6 +619,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
accountLabelTextView.setVisibility(View.GONE);
profileLinearLayout.setVisibility(View.GONE);
subscriptionLinearLayout.setVisibility(View.GONE);
+ multiRedditsLinearLayout.setVisibility(View.GONE);
inboxLinearLayout.setVisibility(View.GONE);
postLabelTextView.setVisibility(View.GONE);
upvotedLinearLayout.setVisibility(View.GONE);
@@ -642,6 +659,12 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
drawer.closeDrawers();
});
+ multiRedditsLinearLayout.setOnClickListener(view -> {
+ Intent intent = new Intent(this, MultiRedditListingActivity.class);
+ startActivity(intent);
+ drawer.closeDrawers();
+ });
+
inboxLinearLayout.setOnClickListener(view -> {
Intent intent = new Intent(this, ViewMessageActivity.class);
startActivity(intent);
@@ -956,7 +979,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
private PostFragment allPostFragment;
SectionsPagerAdapter(FragmentManager fm) {
- super(fm);
+ super(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
}
@NonNull
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SubscribedThingListingActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SubscribedThingListingActivity.java
index 061c3c06..1ed80213 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SubscribedThingListingActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SubscribedThingListingActivity.java
@@ -244,7 +244,7 @@ public class SubscribedThingListingActivity extends BaseActivity {
private FollowedUsersListingFragment followedUsersListingFragment;
public SectionsPagerAdapter(FragmentManager fm) {
- super(fm);
+ super(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
}
@NonNull
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/MainPreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/MainPreferenceFragment.java
index 99d06569..8228333e 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/MainPreferenceFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/MainPreferenceFragment.java
@@ -49,6 +49,7 @@ public class MainPreferenceFragment extends PreferenceFragmentCompat {
SwitchPreference amoledDarkSwitch = findPreference(SharedPreferencesUtils.AMOLED_DARK_KEY);
SwitchPreference immersiveInterfaceSwitch = findPreference(SharedPreferencesUtils.IMMERSIVE_INTERFACE_KEY);
+ SwitchPreference bottomAppBarSwitch = findPreference(SharedPreferencesUtils.BOTTOM_APP_BAR_KEY);
SwitchPreference voteButtonsOnTheRightSwitch = findPreference(SharedPreferencesUtils.VOTE_BUTTONS_ON_THE_RIGHT_KEY);
SwitchPreference showElapsedTimeSwitch = findPreference(SharedPreferencesUtils.SHOW_ELAPSED_TIME_KEY);
SwitchPreference nsfwSwitch = findPreference(SharedPreferencesUtils.NSFW_KEY);
@@ -78,6 +79,13 @@ public class MainPreferenceFragment extends PreferenceFragmentCompat {
}
}
+ if (bottomAppBarSwitch != null) {
+ bottomAppBarSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
+ EventBus.getDefault().post(new RecreateActivityEvent());
+ return true;
+ });
+ }
+
if (voteButtonsOnTheRightSwitch != null) {
voteButtonsOnTheRightSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
EventBus.getDefault().post(new ChangeVoteButtonsPositionEvent((Boolean) newValue));
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/SharedPreferencesUtils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/SharedPreferencesUtils.java
index 6fe83045..ef6354aa 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/SharedPreferencesUtils.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/SharedPreferencesUtils.java
@@ -30,6 +30,7 @@ public class SharedPreferencesUtils {
public static final String CONTENT_FONT_SIZE_KEY = "content_font_size";
public static final String AMOLED_DARK_KEY = "amoled_dark";
public static final String IMMERSIVE_INTERFACE_KEY = "immersive_interface";
+ public static final String BOTTOM_APP_BAR_KEY = "bottom_app_bar";
public static final String VOTE_BUTTONS_ON_THE_RIGHT_KEY = "vote_buttons_on_the_right";
public static final String SORT_TYPE_BEST_POST = "sort_type_best_post";
public static final String SORT_TIME_BEST_POST = "sort_time_best_post";
diff --git a/app/src/main/res/drawable-night/ic_add_bottom_app_bar_24dp.xml b/app/src/main/res/drawable-night/ic_add_bottom_app_bar_24dp.xml
index 51867af8..b6814bc2 100644
--- a/app/src/main/res/drawable-night/ic_add_bottom_app_bar_24dp.xml
+++ b/app/src/main/res/drawable-night/ic_add_bottom_app_bar_24dp.xml
@@ -4,6 +4,6 @@
android:viewportWidth="24"
android:viewportHeight="24">
diff --git a/app/src/main/res/drawable-night/ic_multi_reddit_24dp.xml b/app/src/main/res/drawable-night/ic_multi_reddit_24dp.xml
index aefb602a..cd680d79 100644
--- a/app/src/main/res/drawable-night/ic_multi_reddit_24dp.xml
+++ b/app/src/main/res/drawable-night/ic_multi_reddit_24dp.xml
@@ -4,6 +4,6 @@
android:viewportWidth="24"
android:viewportHeight="24">
diff --git a/app/src/main/res/drawable-night/ic_subscritptions_bottom_app_bar_24dp.xml b/app/src/main/res/drawable-night/ic_subscritptions_bottom_app_bar_24dp.xml
index bb341b85..660848ef 100644
--- a/app/src/main/res/drawable-night/ic_subscritptions_bottom_app_bar_24dp.xml
+++ b/app/src/main/res/drawable-night/ic_subscritptions_bottom_app_bar_24dp.xml
@@ -4,6 +4,6 @@
android:viewportWidth="24"
android:viewportHeight="24">
diff --git a/app/src/main/res/drawable/ic_add_bottom_app_bar_24dp.xml b/app/src/main/res/drawable/ic_add_bottom_app_bar_24dp.xml
index a032b560..ed95d188 100644
--- a/app/src/main/res/drawable/ic_add_bottom_app_bar_24dp.xml
+++ b/app/src/main/res/drawable/ic_add_bottom_app_bar_24dp.xml
@@ -4,6 +4,6 @@
android:viewportWidth="24"
android:viewportHeight="24">
diff --git a/app/src/main/res/drawable/ic_multi_reddit_24dp.xml b/app/src/main/res/drawable/ic_multi_reddit_24dp.xml
index 83623504..74b886ad 100644
--- a/app/src/main/res/drawable/ic_multi_reddit_24dp.xml
+++ b/app/src/main/res/drawable/ic_multi_reddit_24dp.xml
@@ -4,6 +4,6 @@
android:viewportWidth="24"
android:viewportHeight="24">
diff --git a/app/src/main/res/drawable/ic_subscritptions_bottom_app_bar_24dp.xml b/app/src/main/res/drawable/ic_subscritptions_bottom_app_bar_24dp.xml
index 989c9f29..96b7725a 100644
--- a/app/src/main/res/drawable/ic_subscritptions_bottom_app_bar_24dp.xml
+++ b/app/src/main/res/drawable/ic_subscritptions_bottom_app_bar_24dp.xml
@@ -4,6 +4,6 @@
android:viewportWidth="24"
android:viewportHeight="24">
diff --git a/app/src/main/res/ic_subscritptions_24dp.xml b/app/src/main/res/ic_subscritptions_24dp.xml
deleted file mode 100644
index 96b7725a..00000000
--- a/app/src/main/res/ic_subscritptions_24dp.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 08f715d1..cf48f84e 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -104,6 +104,32 @@
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 072c1b1e..a66a43b9 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -16,7 +16,7 @@
Inbox
Settings
Saved
- MultiReddit
+ Multireddit
Open navigation drawer
Close navigation drawer
@@ -79,6 +79,7 @@
Profile
Following
Subscriptions
+ Multireddit
Inbox
Upvoted
Downvoted
@@ -291,6 +292,7 @@
Device default
Amoled Dark
Immersive Interface
+ Enable Bottom Navigation
Vote Buttons on the Right
Use Volume Keys to Navigate Comments in Posts
Use Volume Keys to Navigate Posts
diff --git a/app/src/main/res/xml/main_preferences.xml b/app/src/main/res/xml/main_preferences.xml
index 98e566eb..02c0f750 100644
--- a/app/src/main/res/xml/main_preferences.xml
+++ b/app/src/main/res/xml/main_preferences.xml
@@ -26,6 +26,11 @@
app:title="@string/settings_immersive_interface_title"
app:isPreferenceVisible="false" />
+
+