diff options
Diffstat (limited to 'app')
15 files changed, 77 insertions, 21 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 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"> <path - android:fillColor="#B3FFFFFF" + android:fillColor="#FFFFFFFF" android:pathData="M18,13h-5v5c0,0.55 -0.45,1 -1,1s-1,-0.45 -1,-1v-5H6c-0.55,0 -1,-0.45 -1,-1s0.45,-1 1,-1h5V6c0,-0.55 0.45,-1 1,-1s1,0.45 1,1v5h5c0.55,0 1,0.45 1,1s-0.45,1 -1,1z"/> </vector> 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"> <path - android:fillColor="#B3FFFFFF" + android:fillColor="#FFFFFFFF" android:pathData="M3,6c-0.55,0 -1,0.45 -1,1v13c0,1.1 0.9,2 2,2h13c0.55,0 1,-0.45 1,-1s-0.45,-1 -1,-1L5,20c-0.55,0 -1,-0.45 -1,-1L4,7c0,-0.55 -0.45,-1 -1,-1zM20,2L8,2c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2L22,4c0,-1.1 -0.9,-2 -2,-2zM18,11h-8c-0.55,0 -1,-0.45 -1,-1s0.45,-1 1,-1h8c0.55,0 1,0.45 1,1s-0.45,1 -1,1zM14,15h-4c-0.55,0 -1,-0.45 -1,-1s0.45,-1 1,-1h4c0.55,0 1,0.45 1,1s-0.45,1 -1,1zM18,7h-8c-0.55,0 -1,-0.45 -1,-1s0.45,-1 1,-1h8c0.55,0 1,0.45 1,1s-0.45,1 -1,1z"/> </vector> 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"> <path - android:fillColor="#B3FFFFFF" + android:fillColor="#FFFFFFFF" android:pathData="M11.99,2C6.47,2 2,6.48 2,12s4.47,10 9.99,10C17.52,22 22,17.52 22,12S17.52,2 11.99,2zM19.47,9.16l-5.01,-0.43 -2,-4.71c3.21,0.19 5.91,2.27 7.01,5.14zM14.4,15.42L12,13.98l-2.39,1.44 0.63,-2.72 -2.11,-1.83 2.78,-0.24L12,8.06l1.09,2.56 2.78,0.24 -2.11,1.83 0.64,2.73zM11.54,4.02l-2,4.72 -5.02,0.43c1.1,-2.88 3.8,-4.97 7.02,-5.15zM4,12c0,-0.64 0.08,-1.26 0.23,-1.86l3.79,3.28 -1.11,4.75C5.13,16.7 4,14.48 4,12zM7.84,18.82L12,16.31l4.16,2.5c-1.22,0.75 -2.64,1.19 -4.17,1.19 -1.52,0 -2.94,-0.44 -4.15,-1.18zM17.09,18.17l-1.11,-4.75 3.79,-3.28c0.14,0.59 0.23,1.22 0.23,1.86 0,2.48 -1.14,4.7 -2.91,6.17z"/> </vector> 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"> <path - android:fillColor="#8A000000" + android:fillColor="#FF000000" android:pathData="M18,13h-5v5c0,0.55 -0.45,1 -1,1s-1,-0.45 -1,-1v-5H6c-0.55,0 -1,-0.45 -1,-1s0.45,-1 1,-1h5V6c0,-0.55 0.45,-1 1,-1s1,0.45 1,1v5h5c0.55,0 1,0.45 1,1s-0.45,1 -1,1z"/> </vector> 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"> <path - android:fillColor="#8A000000" + android:fillColor="#FF000000" android:pathData="M3,6c-0.55,0 -1,0.45 -1,1v13c0,1.1 0.9,2 2,2h13c0.55,0 1,-0.45 1,-1s-0.45,-1 -1,-1L5,20c-0.55,0 -1,-0.45 -1,-1L4,7c0,-0.55 -0.45,-1 -1,-1zM20,2L8,2c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2L22,4c0,-1.1 -0.9,-2 -2,-2zM18,11h-8c-0.55,0 -1,-0.45 -1,-1s0.45,-1 1,-1h8c0.55,0 1,0.45 1,1s-0.45,1 -1,1zM14,15h-4c-0.55,0 -1,-0.45 -1,-1s0.45,-1 1,-1h4c0.55,0 1,0.45 1,1s-0.45,1 -1,1zM18,7h-8c-0.55,0 -1,-0.45 -1,-1s0.45,-1 1,-1h8c0.55,0 1,0.45 1,1s-0.45,1 -1,1z"/> </vector> 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"> <path - android:fillColor="#8A000000" + android:fillColor="#FF000000" android:pathData="M11.99,2C6.47,2 2,6.48 2,12s4.47,10 9.99,10C17.52,22 22,17.52 22,12S17.52,2 11.99,2zM19.47,9.16l-5.01,-0.43 -2,-4.71c3.21,0.19 5.91,2.27 7.01,5.14zM14.4,15.42L12,13.98l-2.39,1.44 0.63,-2.72 -2.11,-1.83 2.78,-0.24L12,8.06l1.09,2.56 2.78,0.24 -2.11,1.83 0.64,2.73zM11.54,4.02l-2,4.72 -5.02,0.43c1.1,-2.88 3.8,-4.97 7.02,-5.15zM4,12c0,-0.64 0.08,-1.26 0.23,-1.86l3.79,3.28 -1.11,4.75C5.13,16.7 4,14.48 4,12zM7.84,18.82L12,16.31l4.16,2.5c-1.22,0.75 -2.64,1.19 -4.17,1.19 -1.52,0 -2.94,-0.44 -4.15,-1.18zM17.09,18.17l-1.11,-4.75 3.79,-3.28c0.14,0.59 0.23,1.22 0.23,1.86 0,2.48 -1.14,4.7 -2.91,6.17z"/> </vector> 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 @@ -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="#FF000000" - android:pathData="M11.99,2C6.47,2 2,6.48 2,12s4.47,10 9.99,10C17.52,22 22,17.52 22,12S17.52,2 11.99,2zM19.47,9.16l-5.01,-0.43 -2,-4.71c3.21,0.19 5.91,2.27 7.01,5.14zM14.4,15.42L12,13.98l-2.39,1.44 0.63,-2.72 -2.11,-1.83 2.78,-0.24L12,8.06l1.09,2.56 2.78,0.24 -2.11,1.83 0.64,2.73zM11.54,4.02l-2,4.72 -5.02,0.43c1.1,-2.88 3.8,-4.97 7.02,-5.15zM4,12c0,-0.64 0.08,-1.26 0.23,-1.86l3.79,3.28 -1.11,4.75C5.13,16.7 4,14.48 4,12zM7.84,18.82L12,16.31l4.16,2.5c-1.22,0.75 -2.64,1.19 -4.17,1.19 -1.52,0 -2.94,-0.44 -4.15,-1.18zM17.09,18.17l-1.11,-4.75 3.79,-3.28c0.14,0.59 0.23,1.22 0.23,1.86 0,2.48 -1.14,4.7 -2.91,6.17z"/> -</vector> 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 @@ -105,6 +105,32 @@ </LinearLayout> <LinearLayout + android:id="@+id/multi_reddits_linear_layout_main_activity" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="?attr/selectableItemBackground" + android:clickable="true" + android:focusable="true" + android:padding="16dp"> + + <ImageView + android:layout_width="24dp" + android:layout_height="24dp" + android:layout_gravity="center_vertical" + android:layout_marginEnd="32dp" + android:src="@drawable/ic_multi_reddit_24dp" /> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_vertical" + android:text="@string/multi_reddit" + android:textColor="@color/primaryTextColor" + android:textSize="?attr/font_default" /> + + </LinearLayout> + + <LinearLayout android:id="@+id/inbox_linear_layout_main_activity" android:layout_width="match_parent" android:layout_height="wrap_content" diff --git a/app/src/main/res/layout/app_bar_main.xml b/app/src/main/res/layout/app_bar_main.xml index 9185d505..ffa18ea1 100644 --- a/app/src/main/res/layout/app_bar_main.xml +++ b/app/src/main/res/layout/app_bar_main.xml @@ -79,7 +79,7 @@ android:gravity="center" android:drawableTop="@drawable/ic_subscritptions_bottom_app_bar_24dp" android:text="@string/subscriptions" - android:textColor="@color/defaultTextColor" + android:textColor="@color/primaryTextColor" android:background="?attr/selectableItemBackgroundBorderless" /> <TextView @@ -97,7 +97,7 @@ android:gravity="center" android:drawableTop="@drawable/ic_multi_reddit_24dp" android:text="@string/multi_reddit_listing_activity" - android:textColor="@color/defaultTextColor" + android:textColor="@color/primaryTextColor" android:background="?attr/selectableItemBackgroundBorderless"/> </LinearLayout> 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 @@ <string name="view_message_activity_label">Inbox</string> <string name="settings_activity_label">Settings</string> <string name="account_saved_thing_activity">Saved</string> - <string name="multi_reddit_listing_activity">MultiReddit</string> + <string name="multi_reddit_listing_activity">Multireddit</string> <string name="navigation_drawer_open">Open navigation drawer</string> <string name="navigation_drawer_close">Close navigation drawer</string> @@ -79,6 +79,7 @@ <string name="profile">Profile</string> <string name="following">Following</string> <string name="subscriptions">Subscriptions</string> + <string name="multi_reddit">Multireddit</string> <string name="inbox">Inbox</string> <string name="upvoted">Upvoted</string> <string name="downvoted">Downvoted</string> @@ -291,6 +292,7 @@ <string name="settings_theme_system_default_summary">Device default</string> <string name="settings_amoled_dark_title">Amoled Dark</string> <string name="settings_immersive_interface_title">Immersive Interface</string> + <string name="settings_enable_bottom_app_bar_title">Enable Bottom Navigation</string> <string name="settings_vote_buttons_on_the_right_title">Vote Buttons on the Right</string> <string name="settings_volume_keys_navigate_comments_title">Use Volume Keys to Navigate Comments in Posts</string> <string name="settings_volume_keys_navigate_posts_title">Use Volume Keys to Navigate Posts</string> 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 @@ -28,6 +28,11 @@ <SwitchPreference app:defaultValue="false" + app:key="bottom_app_bar" + app:title="@string/settings_enable_bottom_app_bar_title" /> + + <SwitchPreference + app:defaultValue="false" app:key="vote_buttons_on_the_right" app:title="@string/settings_vote_buttons_on_the_right_title" /> |