aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
authorDocile-Alligator <chineseperson5@gmail.com>2020-06-20 04:22:32 +0000
committerGitHub <noreply@github.com>2020-06-20 04:22:32 +0000
commit88dea552dd3f61c84b651f7d1412155638fb22f6 (patch)
treed83518f9764ab69e208863d59e06afd4f2c917e0 /app/src/main/java
parent508f881171f853ccbda4ac6f5695e6e7c1f03d37 (diff)
parent8cec7aff119459f9478d296906a9167c808be89f (diff)
downloadinfinity-for-reddit-88dea552dd3f61c84b651f7d1412155638fb22f6.tar
infinity-for-reddit-88dea552dd3f61c84b651f7d1412155638fb22f6.tar.gz
infinity-for-reddit-88dea552dd3f61c84b651f7d1412155638fb22f6.tar.bz2
infinity-for-reddit-88dea552dd3f61c84b651f7d1412155638fb22f6.tar.lz
infinity-for-reddit-88dea552dd3f61c84b651f7d1412155638fb22f6.tar.xz
infinity-for-reddit-88dea552dd3f61c84b651f7d1412155638fb22f6.tar.zst
infinity-for-reddit-88dea552dd3f61c84b651f7d1412155638fb22f6.zip
Merge pull request #136 from OHermesJunior/version-about
Add version info to about section.
Diffstat (limited to '')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Settings/AboutPreferenceFragment.java20
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Utils/SharedPreferencesUtils.java1
2 files changed, 21 insertions, 0 deletions
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 3d81bb30..71e9dbc6 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/AboutPreferenceFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/AboutPreferenceFragment.java
@@ -13,6 +13,7 @@ import androidx.preference.Preference;
import androidx.preference.PreferenceFragmentCompat;
import ml.docilealligator.infinityforreddit.Activity.LinkResolverActivity;
+import ml.docilealligator.infinityforreddit.BuildConfig;
import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils;
@@ -34,6 +35,7 @@ public class AboutPreferenceFragment extends PreferenceFragmentCompat {
Preference redditAccountPreference = findPreference(SharedPreferencesUtils.REDDIT_ACCOUNT_KEY);
Preference subredditPreference = findPreference(SharedPreferencesUtils.SUBREDDIT_KEY);
Preference sharePreference = findPreference(SharedPreferencesUtils.SHARE_KEY);
+ Preference versionPreference = findPreference(SharedPreferencesUtils.VERSION_KEY);
if (openSourcePreference != null) {
openSourcePreference.setOnPreferenceClickListener(preference -> {
@@ -112,6 +114,24 @@ public class AboutPreferenceFragment extends PreferenceFragmentCompat {
return true;
});
}
+
+ if (versionPreference != null) {
+ versionPreference.setSummary(getString(R.string.settings_version_summary, BuildConfig.VERSION_NAME));
+
+ versionPreference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
+ int clickedTimes = 0;
+
+ @Override
+ public boolean onPreferenceClick(Preference preference) {
+ clickedTimes++;
+ if (clickedTimes > 6) {
+ Toast.makeText(activity, R.string.no_developer_easter_egg, Toast.LENGTH_SHORT).show();
+ clickedTimes = 0;
+ }
+ return true;
+ }
+ });
+ }
}
@Override
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 61af3068..b36bb25d 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/SharedPreferencesUtils.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/SharedPreferencesUtils.java
@@ -27,6 +27,7 @@ public class SharedPreferencesUtils {
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 VERSION_KEY = "version";
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";