aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2019-12-19 13:09:58 +0000
committerAlex Ning <chineseperson5@gmail.com>2019-12-19 13:09:58 +0000
commit2113d4a902de2dcc6a0347834118ffc877c865a8 (patch)
tree90a8d7e964533dd2f8035a79af9f3dfa248d3e0d /app/src/main/java
parenta914ed95ef2874bbde229a79e5c314dad474e25f (diff)
downloadinfinity-for-reddit-2113d4a902de2dcc6a0347834118ffc877c865a8.tar
infinity-for-reddit-2113d4a902de2dcc6a0347834118ffc877c865a8.tar.gz
infinity-for-reddit-2113d4a902de2dcc6a0347834118ffc877c865a8.tar.bz2
infinity-for-reddit-2113d4a902de2dcc6a0347834118ffc877c865a8.tar.lz
infinity-for-reddit-2113d4a902de2dcc6a0347834118ffc877c865a8.tar.xz
infinity-for-reddit-2113d4a902de2dcc6a0347834118ffc877c865a8.tar.zst
infinity-for-reddit-2113d4a902de2dcc6a0347834118ffc877c865a8.zip
Fixed UI in ViewMultiRedditDetailActivity. Add a share option in Settings -> About to let you easily share this app to other people. Version 2.0.0.
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/FilteredThingActivity.java19
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewMultiRedditDetailActivity.java3
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Settings/AboutPreferenceFragment.java15
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Utils/SharedPreferencesUtils.java1
4 files changed, 28 insertions, 10 deletions
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";