Add Privacy Policy.

This commit is contained in:
Alex Ning 2021-01-11 19:42:39 +08:00
parent 4b6127efe2
commit ba75ae1f53
4 changed files with 25 additions and 6 deletions

View File

@ -35,13 +35,14 @@ 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 privacyPolicyPreference = findPreference(SharedPreferencesUtils.PRIVACY_POLICY_KEY);
Preference versionPreference = findPreference(SharedPreferencesUtils.VERSION_KEY);
if (openSourcePreference != null) {
openSourcePreference.setOnPreferenceClickListener(preference -> {
Intent intent = new Intent(activity, LinkResolverActivity.class);
intent.setData(Uri.parse("https://github.com/Docile-Alligator/Infinity-For-Reddit"));
startActivity(intent);
activity.startActivity(intent);
return true;
});
}
@ -55,7 +56,7 @@ public class AboutPreferenceFragment extends PreferenceFragmentCompat {
} else {
Intent intent = new Intent(activity, LinkResolverActivity.class);
intent.setData(Uri.parse("https://play.google.com/store/apps/details?id=ml.docilealligator.infinityforreddit"));
startActivity(intent);
activity.startActivity(intent);
}
return true;
});
@ -66,7 +67,7 @@ public class AboutPreferenceFragment extends PreferenceFragmentCompat {
Intent intent = new Intent(Intent.ACTION_SENDTO);
intent.setData(Uri.parse("mailto:docilealligator.app@gmail.com"));
try {
startActivity(intent);
activity.startActivity(intent);
} catch (ActivityNotFoundException e) {
Toast.makeText(activity, R.string.no_email_client, Toast.LENGTH_SHORT).show();
}
@ -78,7 +79,7 @@ public class AboutPreferenceFragment extends PreferenceFragmentCompat {
redditAccountPreference.setOnPreferenceClickListener(preference -> {
Intent intent = new Intent(activity, LinkResolverActivity.class);
intent.setData(Uri.parse("https://www.reddit.com/user/Hostilenemy"));
startActivity(intent);
activity.startActivity(intent);
return true;
});
}
@ -87,7 +88,7 @@ public class AboutPreferenceFragment extends PreferenceFragmentCompat {
subredditPreference.setOnPreferenceClickListener(preference -> {
Intent intent = new Intent(activity, LinkResolverActivity.class);
intent.setData(Uri.parse("https://www.reddit.com/r/Infinity_For_Reddit"));
startActivity(intent);
activity.startActivity(intent);
return true;
});
}
@ -98,7 +99,7 @@ public class AboutPreferenceFragment extends PreferenceFragmentCompat {
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, getString(R.string.share_this_app));
if (intent.resolveActivity(activity.getPackageManager()) != null) {
startActivity(intent);
activity.startActivity(intent);
} else {
Toast.makeText(activity, R.string.no_app, Toast.LENGTH_SHORT).show();
}
@ -106,6 +107,18 @@ public class AboutPreferenceFragment extends PreferenceFragmentCompat {
});
}
if (privacyPolicyPreference != null) {
privacyPolicyPreference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
Intent intent = new Intent(activity, LinkResolverActivity.class);
intent.setData(Uri.parse("https://docile-alligator.github.io/"));
activity.startActivity(intent);
return true;
}
});
}
if (versionPreference != null) {
versionPreference.setSummary(getString(R.string.settings_version_summary, BuildConfig.VERSION_NAME));

View File

@ -23,6 +23,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 PRIVACY_POLICY_KEY = "privacy_policy";
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";

View File

@ -441,6 +441,7 @@
<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="settings_privacy_policy_title">Privacy Policy</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>

View File

@ -46,6 +46,10 @@
app:title="@string/settings_share_title"
app:summary="@string/settings_share_summary" />
<Preference
android:key="privacy_policy"
app:title="@string/settings_privacy_policy_title" />
<Preference
android:key="version"
app:title="@string/settings_version_title"