diff options
author | Alex Ning <chineseperson5@gmail.com> | 2020-09-27 09:06:55 +0000 |
---|---|---|
committer | Alex Ning <chineseperson5@gmail.com> | 2020-09-27 09:06:55 +0000 |
commit | ca19c566c338a8c815ce68aa88e3a09987112881 (patch) | |
tree | 25d9036af4de32a738251bc1a476685394ec7e89 | |
parent | 62a457a868a5441483cbce8de7ec43db106d880d (diff) | |
download | infinity-for-reddit-ca19c566c338a8c815ce68aa88e3a09987112881.tar infinity-for-reddit-ca19c566c338a8c815ce68aa88e3a09987112881.tar.gz infinity-for-reddit-ca19c566c338a8c815ce68aa88e3a09987112881.tar.bz2 infinity-for-reddit-ca19c566c338a8c815ce68aa88e3a09987112881.tar.lz infinity-for-reddit-ca19c566c338a8c815ce68aa88e3a09987112881.tar.xz infinity-for-reddit-ca19c566c338a8c815ce68aa88e3a09987112881.tar.zst infinity-for-reddit-ca19c566c338a8c815ce68aa88e3a09987112881.zip |
Long press the Floating Action Button to see more options.
30 files changed, 349 insertions, 33 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 66689f59..c98a5e84 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java @@ -67,6 +67,7 @@ import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask import ml.docilealligator.infinityforreddit.AsyncTask.InsertSubscribedThingsAsyncTask; import ml.docilealligator.infinityforreddit.AsyncTask.SwitchAccountAsyncTask; import ml.docilealligator.infinityforreddit.AsyncTask.SwitchToAnonymousAccountAsyncTask; +import ml.docilealligator.infinityforreddit.BottomSheetFragment.FABMoreOptionsBottomSheetFragment; import ml.docilealligator.infinityforreddit.BottomSheetFragment.PostLayoutBottomSheetFragment; import ml.docilealligator.infinityforreddit.BottomSheetFragment.PostTypeBottomSheetFragment; import ml.docilealligator.infinityforreddit.BottomSheetFragment.SortTimeBottomSheetFragment; @@ -104,7 +105,7 @@ import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES; public class MainActivity extends BaseActivity implements SortTypeSelectionCallback, PostTypeBottomSheetFragment.PostTypeSelectionCallback, PostLayoutBottomSheetFragment.PostLayoutSelectionCallback, - ActivityToolbarInterface { + ActivityToolbarInterface, FABMoreOptionsBottomSheetFragment.FABOptionSelectionCallback { static final String EXTRA_POST_TYPE = "EPT"; static final String EXTRA_MESSSAGE_FULLNAME = "ENF"; @@ -191,6 +192,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb private SortTypeBottomSheetFragment sortTypeBottomSheetFragment; private SortTimeBottomSheetFragment sortTimeBottomSheetFragment; private PostLayoutBottomSheetFragment postLayoutBottomSheetFragment; + private FABMoreOptionsBottomSheetFragment fabMoreOptionsBottomSheetFragment; private NavigationDrawerRecyclerViewAdapter adapter; private boolean mNullAccessToken = false; private String mAccessToken; @@ -264,6 +266,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb sortTypeBottomSheetFragment = new SortTypeBottomSheetFragment(); sortTimeBottomSheetFragment = new SortTimeBottomSheetFragment(); postLayoutBottomSheetFragment = new PostLayoutBottomSheetFragment(); + fabMoreOptionsBottomSheetFragment = new FABMoreOptionsBottomSheetFragment(); setSupportActionBar(toolbar); setToolbarGoToTop(toolbar); @@ -555,13 +558,13 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb int 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_black_24dp); + 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); + fab.setImageResource(R.drawable.ic_sort_24dp); break; case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_CHANGE_POST_LAYOUT: - fab.setImageResource(R.drawable.ic_post_layout_black_24dp); + 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); @@ -596,6 +599,10 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb break; } }); + fab.setOnLongClickListener(view -> { + fabMoreOptionsBottomSheetFragment.show(getSupportFragmentManager(), fabMoreOptionsBottomSheetFragment.getTag()); + return true; + }); fab.setVisibility(View.VISIBLE); } @@ -1130,6 +1137,30 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb } } + @Override + public void fabOptionSelected(int option) { + switch (option) { + case FABMoreOptionsBottomSheetFragment.FAB_OPTION_SUBMIT_POST: + postTypeBottomSheetFragment.show(getSupportFragmentManager(), postTypeBottomSheetFragment.getTag()); + break; + case FABMoreOptionsBottomSheetFragment.FAB_OPTION_REFRESH: + if (sectionsPagerAdapter != null) { + sectionsPagerAdapter.refresh(); + } + break; + case FABMoreOptionsBottomSheetFragment.FAB_OPTION_CHANGE_SORT_TYPE: + changeSortType(); + break; + case FABMoreOptionsBottomSheetFragment.FAB_OPTION_CHANGE_POST_LAYOUT: + postLayoutBottomSheetFragment.show(getSupportFragmentManager(), postLayoutBottomSheetFragment.getTag()); + break; + case FABMoreOptionsBottomSheetFragment.FAB_OPTION_SEARCH: + Intent intent = new Intent(this, SearchActivity.class); + startActivity(intent); + break; + } + } + private class SectionsPagerAdapter extends FragmentStateAdapter { int tabCount; boolean showFavoriteSubscribedSubreddits; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java index 79c881fd..f1799f06 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java @@ -60,6 +60,7 @@ import ml.docilealligator.infinityforreddit.AsyncTask.CheckIsSubscribedToSubredd import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask; import ml.docilealligator.infinityforreddit.AsyncTask.InsertSubredditDataAsyncTask; import ml.docilealligator.infinityforreddit.AsyncTask.SwitchAccountAsyncTask; +import ml.docilealligator.infinityforreddit.BottomSheetFragment.FABMoreOptionsBottomSheetFragment; import ml.docilealligator.infinityforreddit.BottomSheetFragment.PostLayoutBottomSheetFragment; import ml.docilealligator.infinityforreddit.BottomSheetFragment.PostTypeBottomSheetFragment; import ml.docilealligator.infinityforreddit.BottomSheetFragment.SortTimeBottomSheetFragment; @@ -89,7 +90,7 @@ import retrofit2.Retrofit; public class ViewSubredditDetailActivity extends BaseActivity implements SortTypeSelectionCallback, PostTypeBottomSheetFragment.PostTypeSelectionCallback, PostLayoutBottomSheetFragment.PostLayoutSelectionCallback, - ActivityToolbarInterface { + ActivityToolbarInterface, FABMoreOptionsBottomSheetFragment.FABOptionSelectionCallback { public static final String EXTRA_SUBREDDIT_NAME_KEY = "ESN"; public static final String EXTRA_MESSAGE_FULLNAME = "ENF"; @@ -196,6 +197,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp private SortTypeBottomSheetFragment sortTypeBottomSheetFragment; private SortTimeBottomSheetFragment sortTimeBottomSheetFragment; private PostLayoutBottomSheetFragment postLayoutBottomSheetFragment; + private FABMoreOptionsBottomSheetFragment fabMoreOptionsBottomSheetFragment; private int expandedTabTextColor; private int expandedTabBackgroundColor; private int expandedTabIndicatorColor; @@ -341,8 +343,8 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp sortTypeBottomSheetFragment.setArguments(bottomSheetBundle); sortTimeBottomSheetFragment = new SortTimeBottomSheetFragment(); - postLayoutBottomSheetFragment = new PostLayoutBottomSheetFragment(); + fabMoreOptionsBottomSheetFragment = new FABMoreOptionsBottomSheetFragment(); params = (AppBarLayout.LayoutParams) collapsingToolbarLayout.getLayoutParams(); @@ -643,13 +645,13 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp int 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_black_24dp); + 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); + fab.setImageResource(R.drawable.ic_sort_24dp); break; case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_CHANGE_POST_LAYOUT: - fab.setImageResource(R.drawable.ic_post_layout_black_24dp); + 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); @@ -685,6 +687,10 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp break; } }); + fab.setOnLongClickListener(view -> { + fabMoreOptionsBottomSheetFragment.show(getSupportFragmentManager(), fabMoreOptionsBottomSheetFragment.getTag()); + return true; + }); fab.setVisibility(View.VISIBLE); } else { @@ -1017,9 +1023,32 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp } } + @Override + public void fabOptionSelected(int option) { + switch (option) { + case FABMoreOptionsBottomSheetFragment.FAB_OPTION_SUBMIT_POST: + postTypeBottomSheetFragment.show(getSupportFragmentManager(), postTypeBottomSheetFragment.getTag()); + break; + case FABMoreOptionsBottomSheetFragment.FAB_OPTION_REFRESH: + if (sectionsPagerAdapter != null) { + sectionsPagerAdapter.refresh(); + } + break; + case FABMoreOptionsBottomSheetFragment.FAB_OPTION_CHANGE_SORT_TYPE: + sortTypeBottomSheetFragment.show(getSupportFragmentManager(), sortTypeBottomSheetFragment.getTag()); + break; + case FABMoreOptionsBottomSheetFragment.FAB_OPTION_CHANGE_POST_LAYOUT: + postLayoutBottomSheetFragment.show(getSupportFragmentManager(), postLayoutBottomSheetFragment.getTag()); + break; + case FABMoreOptionsBottomSheetFragment.FAB_OPTION_SEARCH: + Intent intent = new Intent(this, SearchActivity.class); + intent.putExtra(SearchActivity.EXTRA_SUBREDDIT_NAME, subredditName); + startActivity(intent); + break; + } + } + private class SectionsPagerAdapter extends FragmentStateAdapter { - /*private PostFragment postFragment; - private SidebarFragment sidebarFragment;*/ SectionsPagerAdapter(FragmentManager fm, Lifecycle lifecycle) { super(fm, lifecycle); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/BottomSheetFragment/FABMoreOptionsBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/BottomSheetFragment/FABMoreOptionsBottomSheetFragment.java new file mode 100644 index 00000000..dc4b212b --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/BottomSheetFragment/FABMoreOptionsBottomSheetFragment.java @@ -0,0 +1,87 @@ +package ml.docilealligator.infinityforreddit.BottomSheetFragment; + +import android.content.Context; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + +import androidx.annotation.NonNull; + +import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialogFragment; + +import butterknife.BindView; +import butterknife.ButterKnife; +import ml.docilealligator.infinityforreddit.R; + +public class FABMoreOptionsBottomSheetFragment extends RoundedBottomSheetDialogFragment { + + public static final int FAB_OPTION_SUBMIT_POST = 0; + public static final int FAB_OPTION_REFRESH = 1; + public static final int FAB_OPTION_CHANGE_SORT_TYPE = 2; + public static final int FAB_OPTION_CHANGE_POST_LAYOUT = 3; + public static final int FAB_OPTION_SEARCH = 4; + + @BindView(R.id.submit_post_text_view_fab_more_options_bottom_sheet_fragment) + TextView submitPostTextView; + @BindView(R.id.refresh_text_view_fab_more_options_bottom_sheet_fragment) + TextView refreshTextView; + @BindView(R.id.change_sort_type_text_view_fab_more_options_bottom_sheet_fragment) + TextView changeSortTypeTextView; + @BindView(R.id.change_post_layout_text_view_fab_more_options_bottom_sheet_fragment) + TextView changePostLayoutTextView; + @BindView(R.id.search_text_view_fab_more_options_bottom_sheet_fragment) + TextView searchTextView; + private FABOptionSelectionCallback activity; + + public FABMoreOptionsBottomSheetFragment() { + // Required empty public constructor + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + // Inflate the layout for this fragment + View rootView = inflater.inflate(R.layout.fragment_fab_more_options_bottom_sheet, container, false); + + ButterKnife.bind(this, rootView); + + submitPostTextView.setOnClickListener(view -> { + activity.fabOptionSelected(FAB_OPTION_SUBMIT_POST); + dismiss(); + }); + + refreshTextView.setOnClickListener(view -> { + activity.fabOptionSelected(FAB_OPTION_REFRESH); + dismiss(); + }); + + changeSortTypeTextView.setOnClickListener(view -> { + activity.fabOptionSelected(FAB_OPTION_CHANGE_SORT_TYPE); + dismiss(); + }); + + changePostLayoutTextView.setOnClickListener(view -> { + activity.fabOptionSelected(FAB_OPTION_CHANGE_POST_LAYOUT); + dismiss(); + }); + + searchTextView.setOnClickListener(view -> { + activity.fabOptionSelected(FAB_OPTION_SEARCH); + dismiss(); + }); + + return rootView; + } + + @Override + public void onAttach(@NonNull Context context) { + super.onAttach(context); + this.activity = (FABOptionSelectionCallback) context; + } + + public interface FABOptionSelectionCallback { + void fabOptionSelected(int option); + } +}
\ No newline at end of file diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/BottomSheetFragment/PostTypeBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/BottomSheetFragment/PostTypeBottomSheetFragment.java index 1f40fc22..328aeec2 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/BottomSheetFragment/PostTypeBottomSheetFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/BottomSheetFragment/PostTypeBottomSheetFragment.java @@ -39,6 +39,7 @@ public class PostTypeBottomSheetFragment extends RoundedBottomSheetDialogFragmen @BindView(R.id.video_type_linear_layout_post_type_bottom_sheet_fragment) TextView videoTypeTextView; private Activity activity; + public PostTypeBottomSheetFragment() { // Required empty public constructor } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Infinity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Infinity.java index d9ee278c..4ee21747 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Infinity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Infinity.java @@ -46,9 +46,7 @@ public class Infinity extends Application { EventBus.builder().addIndex(new EventBusIndex()).installDefaultEventBus(); mNetworkWifiStatusReceiver = - new NetworkWifiStatusReceiver(() -> { - EventBus.getDefault().post(new ChangeNetworkStatusEvent(Utils.getConnectedNetwork(getApplicationContext()))); - }); + new NetworkWifiStatusReceiver(() -> EventBus.getDefault().post(new ChangeNetworkStatusEvent(Utils.getConnectedNetwork(getApplicationContext())))); registerReceiver(mNetworkWifiStatusReceiver, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION)); } diff --git a/app/src/main/res/drawable-night/ic_post_layout_24dp.xml b/app/src/main/res/drawable-night/ic_post_layout_24dp.xml new file mode 100644 index 00000000..c83788d8 --- /dev/null +++ b/app/src/main/res/drawable-night/ic_post_layout_24dp.xml @@ -0,0 +1,9 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24"> + <path + android:pathData="M3,5v14h19L22,5L3,5zM5,7h15v4L5,11L5,7zM5,17v-4h4v4L5,17zM11,17v-4h9v4h-9z" + android:fillColor="#FFFFFF"/> +</vector> diff --git a/app/src/main/res/drawable-night/ic_refresh_24dp.xml b/app/src/main/res/drawable-night/ic_refresh_24dp.xml new file mode 100644 index 00000000..768b210a --- /dev/null +++ b/app/src/main/res/drawable-night/ic_refresh_24dp.xml @@ -0,0 +1,9 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24"> + <path + android:pathData="M17.65,6.35C16.2,4.9 14.21,4 12,4c-4.42,0 -7.99,3.58 -7.99,8s3.57,8 7.99,8c3.73,0 6.84,-2.55 7.73,-6h-2.08c-0.82,2.33 -3.04,4 -5.65,4 -3.31,0 -6,-2.69 -6,-6s2.69,-6 6,-6c1.66,0 3.14,0.69 4.22,1.78L13,11h7V4l-2.35,2.35z" + android:fillColor="#FFFFFF"/> +</vector> diff --git a/app/src/main/res/drawable/ic_search_toolbar_24dp.xml b/app/src/main/res/drawable-night/ic_search_24dp.xml index 466e71dd..466e71dd 100644 --- a/app/src/main/res/drawable/ic_search_toolbar_24dp.xml +++ b/app/src/main/res/drawable-night/ic_search_24dp.xml diff --git a/app/src/main/res/drawable/ic_sort_toolbar_24dp.xml b/app/src/main/res/drawable-night/ic_sort_24dp.xml index e795d2a2..e795d2a2 100644 --- a/app/src/main/res/drawable/ic_sort_toolbar_24dp.xml +++ b/app/src/main/res/drawable-night/ic_sort_24dp.xml diff --git a/app/src/main/res/drawable-night/ic_submit_post_24dp.xml b/app/src/main/res/drawable-night/ic_submit_post_24dp.xml new file mode 100644 index 00000000..21ef5658 --- /dev/null +++ b/app/src/main/res/drawable-night/ic_submit_post_24dp.xml @@ -0,0 +1,9 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24"> + <path + android:pathData="M3,17.25V21h3.75L17.81,9.94l-3.75,-3.75L3,17.25zM20.71,7.04c0.39,-0.39 0.39,-1.02 0,-1.41l-2.34,-2.34c-0.39,-0.39 -1.02,-0.39 -1.41,0l-1.83,1.83 3.75,3.75 1.83,-1.83z" + android:fillColor="#FFFFFF"/> +</vector> diff --git a/app/src/main/res/drawable-night/ic_outline_text_24px.xml b/app/src/main/res/drawable-night/ic_text_24dp.xml index a88d9084..a88d9084 100644 --- a/app/src/main/res/drawable-night/ic_outline_text_24px.xml +++ b/app/src/main/res/drawable-night/ic_text_24dp.xml diff --git a/app/src/main/res/drawable/ic_post_layout_black_24dp.xml b/app/src/main/res/drawable/ic_post_layout_24dp.xml index bca9e973..bca9e973 100644 --- a/app/src/main/res/drawable/ic_post_layout_black_24dp.xml +++ b/app/src/main/res/drawable/ic_post_layout_24dp.xml diff --git a/app/src/main/res/drawable/ic_refresh_black_24dp.xml b/app/src/main/res/drawable/ic_refresh_24dp.xml index 528662cf..528662cf 100644 --- a/app/src/main/res/drawable/ic_refresh_black_24dp.xml +++ b/app/src/main/res/drawable/ic_refresh_24dp.xml diff --git a/app/src/main/res/drawable/ic_search_24dp.xml b/app/src/main/res/drawable/ic_search_24dp.xml new file mode 100644 index 00000000..9bece0ba --- /dev/null +++ b/app/src/main/res/drawable/ic_search_24dp.xml @@ -0,0 +1,5 @@ +<vector android:height="24dp" + android:viewportHeight="24.0" android:viewportWidth="24.0" + android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> + <path android:fillColor="#000000" android:pathData="M15.5,14h-0.79l-0.28,-0.27C15.41,12.59 16,11.11 16,9.5 16,5.91 13.09,3 9.5,3S3,5.91 3,9.5 5.91,16 9.5,16c1.61,0 3.09,-0.59 4.23,-1.57l0.27,0.28v0.79l5,4.99L20.49,19l-4.99,-5zM9.5,14C7.01,14 5,11.99 5,9.5S7.01,5 9.5,5 14,7.01 14,9.5 11.99,14 9.5,14z"/> +</vector> diff --git a/app/src/main/res/drawable/ic_sort_24dp.xml b/app/src/main/res/drawable/ic_sort_24dp.xml new file mode 100644 index 00000000..6cef6369 --- /dev/null +++ b/app/src/main/res/drawable/ic_sort_24dp.xml @@ -0,0 +1,9 @@ +<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="#000000" + android:pathData="M3,18h6v-2L3,16v2zM3,6v2h18L21,6L3,6zM3,13h12v-2L3,11v2z"/> +</vector> diff --git a/app/src/main/res/drawable/ic_submit_post_24dp.xml b/app/src/main/res/drawable/ic_submit_post_24dp.xml new file mode 100644 index 00000000..df26adda --- /dev/null +++ b/app/src/main/res/drawable/ic_submit_post_24dp.xml @@ -0,0 +1,9 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24"> + <path + android:pathData="M3,17.25V21h3.75L17.81,9.94l-3.75,-3.75L3,17.25zM20.71,7.04c0.39,-0.39 0.39,-1.02 0,-1.41l-2.34,-2.34c-0.39,-0.39 -1.02,-0.39 -1.41,0l-1.83,1.83 3.75,3.75 1.83,-1.83z" + android:fillColor="#000000"/> +</vector> diff --git a/app/src/main/res/drawable/ic_outline_text_24px.xml b/app/src/main/res/drawable/ic_text_24dp.xml index 6afe43f5..6afe43f5 100644 --- a/app/src/main/res/drawable/ic_outline_text_24px.xml +++ b/app/src/main/res/drawable/ic_text_24dp.xml diff --git a/app/src/main/res/layout/fragment_fab_more_options_bottom_sheet.xml b/app/src/main/res/layout/fragment_fab_more_options_bottom_sheet.xml new file mode 100644 index 00000000..fa7f9833 --- /dev/null +++ b/app/src/main/res/layout/fragment_fab_more_options_bottom_sheet.xml @@ -0,0 +1,111 @@ +<?xml version="1.0" encoding="utf-8"?> +<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="wrap_content" + xmlns:app="http://schemas.android.com/apk/res-auto" + tools:context=".BottomSheetFragment.FABMoreOptionsBottomSheetFragment"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical"> + + <TextView + android:id="@+id/submit_post_text_view_fab_more_options_bottom_sheet_fragment" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:gravity="center_vertical" + android:paddingTop="16dp" + android:paddingBottom="16dp" + android:paddingStart="32dp" + android:paddingEnd="32dp" + android:text="@string/submit_post" + android:textColor="?attr/primaryTextColor" + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" + app:drawableStartCompat="@drawable/ic_submit_post_24dp" + android:drawablePadding="48dp" + android:clickable="true" + android:focusable="true" + android:background="?attr/selectableItemBackground" /> + + <TextView + android:id="@+id/refresh_text_view_fab_more_options_bottom_sheet_fragment" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:gravity="center_vertical" + android:paddingTop="16dp" + android:paddingBottom="16dp" + android:paddingStart="32dp" + android:paddingEnd="32dp" + android:text="@string/refresh" + android:textColor="?attr/primaryTextColor" + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" + app:drawableStartCompat="@drawable/ic_refresh_24dp" + android:drawablePadding="48dp" + android:clickable="true" + android:focusable="true" + android:background="?attr/selectableItemBackground" /> + + <TextView + android:id="@+id/change_sort_type_text_view_fab_more_options_bottom_sheet_fragment" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:gravity="center_vertical" + android:paddingTop="16dp" + android:paddingBottom="16dp" + android:paddingStart="32dp" + android:paddingEnd="32dp" + android:text="@string/change_sort_type" + android:textColor="?attr/primaryTextColor" + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" + app:drawableStartCompat="@drawable/ic_sort_24dp" + android:drawablePadding="48dp" + android:clickable="true" + android:focusable="true" + android:background="?attr/selectableItemBackground" /> + + <TextView + android:id="@+id/change_post_layout_text_view_fab_more_options_bottom_sheet_fragment" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:gravity="center_vertical" + android:paddingTop="16dp" + android:paddingBottom="16dp" + android:paddingStart="32dp" + android:paddingEnd="32dp" + android:text="@string/change_post_layout" + android:textColor="?attr/primaryTextColor" + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" + app:drawableStartCompat="@drawable/ic_post_layout_24dp" + android:drawablePadding="48dp" + android:clickable="true" + android:focusable="true" + android:background="?attr/selectableItemBackground" /> + + <TextView + android:id="@+id/search_text_view_fab_more_options_bottom_sheet_fragment" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:gravity="center_vertical" + android:paddingTop="16dp" + android:paddingBottom="16dp" + android:paddingStart="32dp" + android:paddingEnd="32dp" + android:text="@string/search" + android:textColor="?attr/primaryTextColor" + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" + app:drawableStartCompat="@drawable/ic_search_24dp" + android:drawablePadding="48dp" + android:clickable="true" + android:focusable="true" + android:background="?attr/selectableItemBackground" /> + + </LinearLayout> + +</androidx.core.widget.NestedScrollView>
\ No newline at end of file diff --git a/app/src/main/res/layout/fragment_post_type_bottom_sheet.xml b/app/src/main/res/layout/fragment_post_type_bottom_sheet.xml index 5dc07eb0..e89e36a2 100644 --- a/app/src/main/res/layout/fragment_post_type_bottom_sheet.xml +++ b/app/src/main/res/layout/fragment_post_type_bottom_sheet.xml @@ -23,7 +23,7 @@ android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" android:fontFamily="?attr/font_family" - android:drawableStart="@drawable/ic_outline_text_24px" + android:drawableStart="@drawable/ic_text_24dp" android:drawablePadding="48dp" android:clickable="true" android:focusable="true" diff --git a/app/src/main/res/menu/filtered_posts_activity.xml b/app/src/main/res/menu/filtered_posts_activity.xml index 6e826b5a..296af78c 100644 --- a/app/src/main/res/menu/filtered_posts_activity.xml +++ b/app/src/main/res/menu/filtered_posts_activity.xml @@ -5,14 +5,14 @@ android:id="@+id/action_sort_filtered_thing_activity" android:orderInCategory="1" android:title="@string/action_sort" - android:icon="@drawable/ic_sort_toolbar_24dp" + android:icon="@drawable/ic_sort_24dp" app:showAsAction="ifRoom" /> <item android:id="@+id/action_refresh_filtered_thing_activity" android:orderInCategory="2" android:title="@string/action_refresh" - android:icon="@drawable/ic_search_toolbar_24dp" + android:icon="@drawable/ic_search_24dp" app:showAsAction="never" /> <item diff --git a/app/src/main/res/menu/main_activity.xml b/app/src/main/res/menu/main_activity.xml index 2e3062b1..127bbb43 100644 --- a/app/src/main/res/menu/main_activity.xml +++ b/app/src/main/res/menu/main_activity.xml @@ -8,14 +8,14 @@ android:id="@+id/action_search_main_activity" android:orderInCategory="1" android:title="@string/action_search" - android:icon="@drawable/ic_search_toolbar_24dp" + android:icon="@drawable/ic_search_24dp" app:showAsAction="ifRoom" /> <item android:id="@+id/action_sort_main_activity" android:orderInCategory="2" android:title="@string/action_sort" - android:icon="@drawable/ic_sort_toolbar_24dp" + android:icon="@drawable/ic_sort_24dp" app:showAsAction="ifRoom" /> <item diff --git a/app/src/main/res/menu/search_activity.xml b/app/src/main/res/menu/search_activity.xml index 94119685..599901d0 100644 --- a/app/src/main/res/menu/search_activity.xml +++ b/app/src/main/res/menu/search_activity.xml @@ -7,6 +7,6 @@ android:id="@+id/action_search_search_activity" android:orderInCategory="1" android:title="@string/action_search" - android:icon="@drawable/ic_search_toolbar_24dp" + android:icon="@drawable/ic_search_24dp" app:showAsAction="ifRoom" /> </menu> diff --git a/app/src/main/res/menu/search_result_activity.xml b/app/src/main/res/menu/search_result_activity.xml index d503471f..9cd243a5 100644 --- a/app/src/main/res/menu/search_result_activity.xml +++ b/app/src/main/res/menu/search_result_activity.xml @@ -5,14 +5,14 @@ android:id="@+id/action_sort_search_result_activity" android:orderInCategory="1" android:title="@string/action_sort" - android:icon="@drawable/ic_sort_toolbar_24dp" + android:icon="@drawable/ic_sort_24dp" app:showAsAction="ifRoom" /> <item android:id="@+id/action_search_search_result_activity" android:orderInCategory="2" android:title="@string/action_search" - android:icon="@drawable/ic_search_toolbar_24dp" + android:icon="@drawable/ic_search_24dp" app:showAsAction="ifRoom" /> <item diff --git a/app/src/main/res/menu/subreddit_multiselection_activity.xml b/app/src/main/res/menu/subreddit_multiselection_activity.xml index ea842fd3..1ca3dd37 100644 --- a/app/src/main/res/menu/subreddit_multiselection_activity.xml +++ b/app/src/main/res/menu/subreddit_multiselection_activity.xml @@ -12,6 +12,6 @@ android:id="@+id/action_search_subreddit_multiselection_activity" android:orderInCategory="2" android:title="@string/action_search" - android:icon="@drawable/ic_search_toolbar_24dp" + android:icon="@drawable/ic_search_24dp" app:showAsAction="ifRoom" /> </menu>
\ No newline at end of file diff --git a/app/src/main/res/menu/subreddit_selection_activity.xml b/app/src/main/res/menu/subreddit_selection_activity.xml index a55e1b97..28abcb17 100644 --- a/app/src/main/res/menu/subreddit_selection_activity.xml +++ b/app/src/main/res/menu/subreddit_selection_activity.xml @@ -5,6 +5,6 @@ android:id="@+id/action_search_subreddit_selection_activity" android:orderInCategory="1" android:title="@string/action_search" - android:icon="@drawable/ic_search_toolbar_24dp" + android:icon="@drawable/ic_search_24dp" app:showAsAction="ifRoom" /> </menu>
\ No newline at end of file diff --git a/app/src/main/res/menu/view_multi_reddit_detail_activity.xml b/app/src/main/res/menu/view_multi_reddit_detail_activity.xml index 0da0d682..06257308 100644 --- a/app/src/main/res/menu/view_multi_reddit_detail_activity.xml +++ b/app/src/main/res/menu/view_multi_reddit_detail_activity.xml @@ -7,14 +7,14 @@ android:id="@+id/action_sort_view_multi_reddit_detail_activity" android:orderInCategory="1" android:title="@string/action_sort" - android:icon="@drawable/ic_sort_toolbar_24dp" + android:icon="@drawable/ic_sort_24dp" app:showAsAction="ifRoom" /> <item android:id="@+id/action_search_view_multi_reddit_detail_activity" android:orderInCategory="2" android:title="@string/action_search" - android:icon="@drawable/ic_search_toolbar_24dp" + android:icon="@drawable/ic_search_24dp" app:showAsAction="ifRoom" /> <item android:id="@+id/action_refresh_view_multi_reddit_detail_activity" diff --git a/app/src/main/res/menu/view_subreddit_detail_activity.xml b/app/src/main/res/menu/view_subreddit_detail_activity.xml index 67a7bf24..a558d9a6 100644 --- a/app/src/main/res/menu/view_subreddit_detail_activity.xml +++ b/app/src/main/res/menu/view_subreddit_detail_activity.xml @@ -7,14 +7,14 @@ android:id="@+id/action_sort_view_subreddit_detail_activity" android:orderInCategory="1" android:title="@string/action_sort" - android:icon="@drawable/ic_sort_toolbar_24dp" + android:icon="@drawable/ic_sort_24dp" app:showAsAction="ifRoom" /> <item android:id="@+id/action_search_view_subreddit_detail_activity" android:orderInCategory="2" android:title="@string/action_search" - android:icon="@drawable/ic_search_toolbar_24dp" + android:icon="@drawable/ic_search_24dp" app:showAsAction="ifRoom" /> <item android:id="@+id/action_refresh_view_subreddit_detail_activity" diff --git a/app/src/main/res/menu/view_user_detail_activity.xml b/app/src/main/res/menu/view_user_detail_activity.xml index a06c2677..352114a1 100644 --- a/app/src/main/res/menu/view_user_detail_activity.xml +++ b/app/src/main/res/menu/view_user_detail_activity.xml @@ -6,13 +6,13 @@ android:id="@+id/action_sort_view_user_detail_activity" android:orderInCategory="1" android:title="@string/action_search" - android:icon="@drawable/ic_sort_toolbar_24dp" + android:icon="@drawable/ic_sort_24dp" app:showAsAction="ifRoom" /> <item android:id="@+id/action_search_view_user_detail_activity" android:orderInCategory="2" android:title="@string/action_search" - android:icon="@drawable/ic_search_toolbar_24dp" + android:icon="@drawable/ic_search_24dp" app:showAsAction="ifRoom" /> <item android:id="@+id/action_refresh_view_user_detail_activity" diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 6d8d37cf..a4b5a801 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -468,7 +468,7 @@ <string name="settings_video_download_location_title">Video Download Location</string> <string name="settings_separate_folder_for_each_subreddit">Separate Folder for Each Subreddit</string> <string name="settings_swipe_action_title">Swipe Action</string> - <string name="settings_vibrate_when_action_triggered_title">Vibrate the phone when the action is triggered</string> + <string name="settings_vibrate_when_action_triggered_title">Vibrate the phone when an action is triggered</string> <string name="settings_disable_swiping_between_tabs_title">Disable Swiping Between Tabs</string> <string name="settings_enable_swipe_action_title">Enable Swipe Action</string> <string name="settings_swipe_action_threshold">Threshold</string> @@ -487,6 +487,7 @@ <string name="settings_bottom_app_bar_option_4">Option 4</string> <string name="settings_bottom_app_bar_fab">Floating Action Button</string> <string name="settings_data_saving_mode">Data Saving Mode</string> + <string name="settings_data_saving_mode_info_summary">In data saving mode, preview images are in lower resolution.</string> <string name="no_link_available">Cannot get the link</string> @@ -893,7 +894,10 @@ <string name="unlock_account_section">Unlock Account Section</string> <string name="unlock">Unlock</string> - <!-- TODO: Remove or change this placeholder text --> - <string name="hello_blank_fragment">Hello blank fragment</string> + + <string name="submit_post">Submit Post</string> + <string name="refresh">Refresh</string> + <string name="change_sort_type">Change Sort Type</string> + <string name="change_post_layout">Change Post Layout</string> </resources> diff --git a/app/src/main/res/xml/data_saving_mode_preferences.xml b/app/src/main/res/xml/data_saving_mode_preferences.xml index 1f66892f..f120afe5 100644 --- a/app/src/main/res/xml/data_saving_mode_preferences.xml +++ b/app/src/main/res/xml/data_saving_mode_preferences.xml @@ -10,4 +10,9 @@ app:entryValues="@array/settings_data_saving_mode_values" app:useSimpleSummaryProvider="true" /> + <Preference + app:icon="@drawable/ic_info_preference_24dp" + app:summary="@string/settings_data_saving_mode_info_summary" + app:enabled="false" /> + </PreferenceScreen>
\ No newline at end of file |