diff options
Diffstat (limited to '')
9 files changed, 42 insertions, 15 deletions
diff --git a/app/build.gradle b/app/build.gradle index faaee51b..d52412a8 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -6,8 +6,8 @@ android { applicationId "ml.docilealligator.infinityforreddit" minSdkVersion 21 targetSdkVersion 29 - versionCode 24 - versionName "1.6.2" + versionCode 25 + versionName "2.0.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 97125e7d..4d96a7e8 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -23,7 +23,7 @@ tools:replace="android:label"> <activity android:name=".Activity.ViewMultiRedditDetailActivity" android:parentActivityName=".Activity.MainActivity" - android:theme="@style/AppTheme.NoActionBarWithTranslucentWindow" /> + android:theme="@style/AppTheme.NoActionBar" /> <activity android:name=".Activity.MultiRedditListingActivity" android:label="@string/multi_reddit_listing_activity" diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/FilteredThingActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/FilteredThingActivity.java index 901d5d69..6fc27fb1 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/FilteredThingActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/FilteredThingActivity.java @@ -82,6 +82,7 @@ public class FilteredThingActivity extends BaseActivity implements SortTypeSelec private SortTypeBottomSheetFragment bestSortTypeBottomSheetFragment; private SortTypeBottomSheetFragment popularAndAllSortTypeBottomSheetFragment; private SortTypeBottomSheetFragment subredditSortTypeBottomSheetFragment; + private SortTypeBottomSheetFragment multiRedditSortTypeBottomSheetFragment; private UserThingSortTypeBottomSheetFragment userThingSortTypeBottomSheetFragment; private SearchPostSortTypeBottomSheetFragment searchPostSortTypeBottomSheetFragment; private SortTimeBottomSheetFragment sortTimeBottomSheetFragment; @@ -228,9 +229,9 @@ public class FilteredThingActivity extends BaseActivity implements SortTypeSelec getSupportActionBar().setTitle(subredditNamePrefixed); subredditSortTypeBottomSheetFragment = new SortTypeBottomSheetFragment(); - Bundle bottomSheetBundle = new Bundle(); - bottomSheetBundle.putBoolean(SortTypeBottomSheetFragment.EXTRA_NO_BEST_TYPE, true); - subredditSortTypeBottomSheetFragment.setArguments(bottomSheetBundle); + Bundle subredditSheetBundle = new Bundle(); + subredditSheetBundle.putBoolean(SortTypeBottomSheetFragment.EXTRA_NO_BEST_TYPE, true); + subredditSortTypeBottomSheetFragment.setArguments(subredditSheetBundle); } break; case PostDataSource.TYPE_MULTI_REDDIT: @@ -243,10 +244,11 @@ public class FilteredThingActivity extends BaseActivity implements SortTypeSelec } getSupportActionBar().setTitle(multiRedditName); - subredditSortTypeBottomSheetFragment = new SortTypeBottomSheetFragment(); - Bundle bottomSheetBundle = new Bundle(); - bottomSheetBundle.putBoolean(SortTypeBottomSheetFragment.EXTRA_NO_BEST_TYPE, true); - subredditSortTypeBottomSheetFragment.setArguments(bottomSheetBundle); + multiRedditSortTypeBottomSheetFragment = new SortTypeBottomSheetFragment(); + Bundle multiRedditBundle = new Bundle(); + multiRedditBundle.putBoolean(SortTypeBottomSheetFragment.EXTRA_NO_BEST_TYPE, true); + multiRedditBundle.putBoolean(SortTypeBottomSheetFragment.EXTRA_NO_RANDOM_TYPE, true); + multiRedditSortTypeBottomSheetFragment.setArguments(multiRedditBundle); break; case PostDataSource.TYPE_USER: String usernamePrefixed = "u/" + name; @@ -341,6 +343,9 @@ public class FilteredThingActivity extends BaseActivity implements SortTypeSelec subredditSortTypeBottomSheetFragment.show(getSupportFragmentManager(), subredditSortTypeBottomSheetFragment.getTag()); } break; + case PostDataSource.TYPE_MULTI_REDDIT: + multiRedditSortTypeBottomSheetFragment.show(getSupportFragmentManager(), multiRedditSortTypeBottomSheetFragment.getTag()); + break; case PostDataSource.TYPE_USER: userThingSortTypeBottomSheetFragment.show(getSupportFragmentManager(), userThingSortTypeBottomSheetFragment.getTag()); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewMultiRedditDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewMultiRedditDetailActivity.java index 99bd19fc..34ee2e1e 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewMultiRedditDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewMultiRedditDetailActivity.java @@ -16,7 +16,6 @@ import android.widget.Toast; import androidx.annotation.NonNull; import androidx.appcompat.widget.Toolbar; -import androidx.coordinatorlayout.widget.CoordinatorLayout; import androidx.fragment.app.Fragment; import com.google.android.material.appbar.AppBarLayout; @@ -55,8 +54,6 @@ public class ViewMultiRedditDetailActivity extends BaseActivity implements SortT private static final String ACCESS_TOKEN_STATE = "ATS"; private static final String ACCOUNT_NAME_STATE = "ANS"; - @BindView(R.id.coordinator_layout_view_multi_reddit_detail_activity) - CoordinatorLayout coordinatorLayout; @BindView(R.id.appbar_layout_view_multi_reddit_detail_activity) AppBarLayout appBarLayout; @BindView(R.id.collapsing_toolbar_layout_view_multi_reddit_detail_activity) diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/AboutPreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/AboutPreferenceFragment.java index 65b8237f..79f0dfb5 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/AboutPreferenceFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/AboutPreferenceFragment.java @@ -28,6 +28,7 @@ public class AboutPreferenceFragment extends PreferenceFragmentCompat { Preference emailPreference = findPreference(SharedPreferencesUtils.EMAIL_KEY); Preference redditAccountPreference = findPreference(SharedPreferencesUtils.REDDIT_ACCOUNT_KEY); Preference subredditPreference = findPreference(SharedPreferencesUtils.SUBREDDIT_KEY); + Preference sharePreference = findPreference(SharedPreferencesUtils.SHARE_KEY); Activity activity = getActivity(); @@ -86,6 +87,20 @@ public class AboutPreferenceFragment extends PreferenceFragmentCompat { return true; }); } + + if (sharePreference != null) { + sharePreference.setOnPreferenceClickListener(preference -> { + Intent intent = new Intent(Intent.ACTION_SEND); + intent.setType("text/plain"); + intent.putExtra(Intent.EXTRA_TEXT, getString(R.string.share_this_app)); + if (intent.resolveActivity(activity.getPackageManager()) != null) { + startActivity(intent); + } else { + Toast.makeText(activity, R.string.no_app, Toast.LENGTH_SHORT).show(); + } + return true; + }); + } } } } 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 f4cc86fc..6fe83045 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/SharedPreferencesUtils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/SharedPreferencesUtils.java @@ -24,6 +24,7 @@ public class SharedPreferencesUtils { public static final String EMAIL_KEY = "email"; public static final String REDDIT_ACCOUNT_KEY = "reddit_account"; public static final String SUBREDDIT_KEY = "subreddit"; + public static final String SHARE_KEY = "share"; public static final String FONT_SIZE_KEY = "font_size"; public static final String TITLE_FONT_SIZE_KEY = "title_font_size"; public static final String CONTENT_FONT_SIZE_KEY = "content_font_size"; diff --git a/app/src/main/res/layout/activity_view_multi_reddit_detail.xml b/app/src/main/res/layout/activity_view_multi_reddit_detail.xml index 42567cc4..a0ec7c23 100644 --- a/app/src/main/res/layout/activity_view_multi_reddit_detail.xml +++ b/app/src/main/res/layout/activity_view_multi_reddit_detail.xml @@ -4,7 +4,6 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" - android:id="@+id/coordinator_layout_view_multi_reddit_detail_activity" android:background="?attr/backgroundColor" tools:context=".Activity.ViewMultiRedditDetailActivity"> @@ -37,7 +36,7 @@ <FrameLayout android:id="@+id/frame_layout_view_multi_reddit_detail_activity" android:layout_width="match_parent" - android:layout_height="wrap_content" + android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior" /> </androidx.coordinatorlayout.widget.CoordinatorLayout>
\ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 366a6980..072c1b1e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -330,6 +330,8 @@ <string name="settings_reddit_account_summary">u/Hostilenemy</string> <string name="settings_subreddit_title">Subreddit</string> <string name="settings_subreddit_summary">r/Infinity_For_Reddit</string> + <string name="settings_share_title">Share</string> + <string name="settings_share_summary">Share this app to other people if you enjoy it</string> <string name="no_link_available">Cannot get the link</string> @@ -350,6 +352,7 @@ <string name="share">Share</string> <string name="no_email_client">No Email client found</string> + <string name="no_app">No app available</string> <string name="comment_saved_success">Comment saved</string> <string name="comment_saved_failed">Unable to save comment</string> @@ -377,4 +380,6 @@ <string name="error_getting_multi_reddit_data">Error getting multireddit data</string> <string name="error_loading_multi_reddit_list">Cannot sync multireddits</string> <string name="error_loading_subscriptions">Cannot sync subscriptions</string> + + <string name="share_this_app">Check out Infinity for Reddit, an awesome Reddit client!\nhttps://play.google.com/store/apps/details?id=ml.docilealligator.infinityforreddit</string> </resources> diff --git a/app/src/main/res/xml/about_preferences.xml b/app/src/main/res/xml/about_preferences.xml index fca988af..82898326 100644 --- a/app/src/main/res/xml/about_preferences.xml +++ b/app/src/main/res/xml/about_preferences.xml @@ -35,4 +35,9 @@ app:title="@string/settings_subreddit_title" app:summary="@string/settings_subreddit_summary" /> + <Preference + android:key="share" + app:title="@string/settings_share_title" + app:summary="@string/settings_share_summary" /> + </PreferenceScreen>
\ No newline at end of file |