mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-12-30 21:07:11 +01:00
Merge pull request #136 from OHermesJunior/version-about
Add version info to about section.
This commit is contained in:
commit
88dea552dd
@ -13,6 +13,7 @@ import androidx.preference.Preference;
|
|||||||
import androidx.preference.PreferenceFragmentCompat;
|
import androidx.preference.PreferenceFragmentCompat;
|
||||||
|
|
||||||
import ml.docilealligator.infinityforreddit.Activity.LinkResolverActivity;
|
import ml.docilealligator.infinityforreddit.Activity.LinkResolverActivity;
|
||||||
|
import ml.docilealligator.infinityforreddit.BuildConfig;
|
||||||
import ml.docilealligator.infinityforreddit.R;
|
import ml.docilealligator.infinityforreddit.R;
|
||||||
import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils;
|
import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils;
|
||||||
|
|
||||||
@ -34,6 +35,7 @@ public class AboutPreferenceFragment extends PreferenceFragmentCompat {
|
|||||||
Preference redditAccountPreference = findPreference(SharedPreferencesUtils.REDDIT_ACCOUNT_KEY);
|
Preference redditAccountPreference = findPreference(SharedPreferencesUtils.REDDIT_ACCOUNT_KEY);
|
||||||
Preference subredditPreference = findPreference(SharedPreferencesUtils.SUBREDDIT_KEY);
|
Preference subredditPreference = findPreference(SharedPreferencesUtils.SUBREDDIT_KEY);
|
||||||
Preference sharePreference = findPreference(SharedPreferencesUtils.SHARE_KEY);
|
Preference sharePreference = findPreference(SharedPreferencesUtils.SHARE_KEY);
|
||||||
|
Preference versionPreference = findPreference(SharedPreferencesUtils.VERSION_KEY);
|
||||||
|
|
||||||
if (openSourcePreference != null) {
|
if (openSourcePreference != null) {
|
||||||
openSourcePreference.setOnPreferenceClickListener(preference -> {
|
openSourcePreference.setOnPreferenceClickListener(preference -> {
|
||||||
@ -112,6 +114,24 @@ public class AboutPreferenceFragment extends PreferenceFragmentCompat {
|
|||||||
return true;
|
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
|
@Override
|
||||||
|
@ -27,6 +27,7 @@ public class SharedPreferencesUtils {
|
|||||||
public static final String REDDIT_ACCOUNT_KEY = "reddit_account";
|
public static final String REDDIT_ACCOUNT_KEY = "reddit_account";
|
||||||
public static final String SUBREDDIT_KEY = "subreddit";
|
public static final String SUBREDDIT_KEY = "subreddit";
|
||||||
public static final String SHARE_KEY = "share";
|
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 FONT_SIZE_KEY = "font_size";
|
||||||
public static final String TITLE_FONT_SIZE_KEY = "title_font_size";
|
public static final String TITLE_FONT_SIZE_KEY = "title_font_size";
|
||||||
public static final String CONTENT_FONT_SIZE_KEY = "content_font_size";
|
public static final String CONTENT_FONT_SIZE_KEY = "content_font_size";
|
||||||
|
@ -404,6 +404,8 @@
|
|||||||
<string name="settings_subreddit_summary">r/Infinity_For_Reddit</string>
|
<string name="settings_subreddit_summary">r/Infinity_For_Reddit</string>
|
||||||
<string name="settings_share_title">Share</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="settings_share_summary">Share this app to other people if you enjoy it</string>
|
||||||
|
<string name="settings_version_title">Infinity For Reddit</string>
|
||||||
|
<string name="settings_version_summary">Version %s</string>
|
||||||
<string name="settings_category_customization_title">Customization</string>
|
<string name="settings_category_customization_title">Customization</string>
|
||||||
<string name="settings_customize_light_theme_title">Light Theme</string>
|
<string name="settings_customize_light_theme_title">Light Theme</string>
|
||||||
<string name="settings_customize_dark_theme_title">Dark Theme</string>
|
<string name="settings_customize_dark_theme_title">Dark Theme</string>
|
||||||
@ -427,6 +429,7 @@
|
|||||||
<string name="settings_tab_subreddit_name">Subreddit Name (Without r/ prefix)</string>
|
<string name="settings_tab_subreddit_name">Subreddit Name (Without r/ prefix)</string>
|
||||||
<string name="settings_tab_multi_reddit_name">MultiReddit Name (/user/yourusername/m/yourmultiredditname)</string>
|
<string name="settings_tab_multi_reddit_name">MultiReddit Name (/user/yourusername/m/yourmultiredditname)</string>
|
||||||
<string name="settings_tab_username">Username (Without u/ prefix)</string>
|
<string name="settings_tab_username">Username (Without u/ prefix)</string>
|
||||||
|
<string name="no_developer_easter_egg">There\'s no developer options here</string>
|
||||||
|
|
||||||
<string name="no_link_available">Cannot get the link</string>
|
<string name="no_link_available">Cannot get the link</string>
|
||||||
|
|
||||||
|
@ -45,4 +45,9 @@
|
|||||||
app:title="@string/settings_share_title"
|
app:title="@string/settings_share_title"
|
||||||
app:summary="@string/settings_share_summary" />
|
app:summary="@string/settings_share_summary" />
|
||||||
|
|
||||||
|
<Preference
|
||||||
|
android:key="version"
|
||||||
|
app:title="@string/settings_version_title"
|
||||||
|
app:summary="@string/settings_version_summary" />
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
Loading…
Reference in New Issue
Block a user