aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/Settings
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2019-08-27 08:46:46 +0000
committerAlex Ning <chineseperson5@gmail.com>2019-08-27 08:46:46 +0000
commit3b0eb15646cc9ac60a7661cf25d5a1a528bae404 (patch)
tree51061820cd68d27e7024061a71aed026d141f3ac /app/src/main/java/Settings
parentfe82b5686e271183771bb801e99f24f88c872fbe (diff)
downloadinfinity-for-reddit-3b0eb15646cc9ac60a7661cf25d5a1a528bae404.tar
infinity-for-reddit-3b0eb15646cc9ac60a7661cf25d5a1a528bae404.tar.gz
infinity-for-reddit-3b0eb15646cc9ac60a7661cf25d5a1a528bae404.tar.bz2
infinity-for-reddit-3b0eb15646cc9ac60a7661cf25d5a1a528bae404.tar.lz
infinity-for-reddit-3b0eb15646cc9ac60a7661cf25d5a1a528bae404.tar.xz
infinity-for-reddit-3b0eb15646cc9ac60a7661cf25d5a1a528bae404.tar.zst
infinity-for-reddit-3b0eb15646cc9ac60a7661cf25d5a1a528bae404.zip
This app now has an icon (finally)git statusgit statusgit status Add a credits page in settings. Use another error view and no comment placeholder.
Diffstat (limited to 'app/src/main/java/Settings')
-rw-r--r--app/src/main/java/Settings/AboutPreferenceFragment.java19
-rw-r--r--app/src/main/java/Settings/CreditsPreferenceFragment.java110
-rw-r--r--app/src/main/java/Settings/MainPreferenceFragment.java1
3 files changed, 130 insertions, 0 deletions
diff --git a/app/src/main/java/Settings/AboutPreferenceFragment.java b/app/src/main/java/Settings/AboutPreferenceFragment.java
new file mode 100644
index 00000000..40873284
--- /dev/null
+++ b/app/src/main/java/Settings/AboutPreferenceFragment.java
@@ -0,0 +1,19 @@
+package Settings;
+
+
+import android.os.Bundle;
+
+import androidx.preference.PreferenceFragmentCompat;
+
+import ml.docilealligator.infinityforreddit.R;
+
+/**
+ * A simple {@link PreferenceFragmentCompat} subclass.
+ */
+public class AboutPreferenceFragment extends PreferenceFragmentCompat {
+
+ @Override
+ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
+ setPreferencesFromResource(R.xml.about_preferences, rootKey);
+ }
+}
diff --git a/app/src/main/java/Settings/CreditsPreferenceFragment.java b/app/src/main/java/Settings/CreditsPreferenceFragment.java
new file mode 100644
index 00000000..6bc3b467
--- /dev/null
+++ b/app/src/main/java/Settings/CreditsPreferenceFragment.java
@@ -0,0 +1,110 @@
+package Settings;
+
+
+import android.app.Activity;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Bundle;
+
+import androidx.preference.Preference;
+import androidx.preference.PreferenceFragmentCompat;
+
+import ml.docilealligator.infinityforreddit.LinkResolverActivity;
+import ml.docilealligator.infinityforreddit.R;
+import ml.docilealligator.infinityforreddit.SharedPreferencesUtils;
+
+/**
+ * A simple {@link PreferenceFragmentCompat} subclass.
+ */
+public class CreditsPreferenceFragment extends PreferenceFragmentCompat {
+
+ @Override
+ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
+ setPreferencesFromResource(R.xml.credits_preferences, rootKey);
+
+ Preference iconForegroundPreference = findPreference(SharedPreferencesUtils.ICON_FOREGROUND_KEY);
+ Preference iconBackgroundPreference = findPreference(SharedPreferencesUtils.ICON_BACKGROUND_KEY);
+ Preference errorImagePreference = findPreference(SharedPreferencesUtils.ERROR_IMAGE_KEY);
+ Preference placeholderPreference = findPreference(SharedPreferencesUtils.SUBREDDIT_AND_USER_PLACEHOLDER_KEY);
+ Preference gildedIconPreference = findPreference(SharedPreferencesUtils.GILDED_ICON_KEY);
+ Preference crosspostIconPreference = findPreference(SharedPreferencesUtils.CROSSPOST_ICON_KEY);
+ Preference thumbtackIconPreference = findPreference(SharedPreferencesUtils.THUMBTACK_ICON_KEY);
+ Preference materialIconsPreference = findPreference(SharedPreferencesUtils.MATERIAL_ICONS_KEY);
+
+ Activity activity = getActivity();
+
+ if(activity != null) {
+ if(iconForegroundPreference != null) {
+ iconForegroundPreference.setOnPreferenceClickListener(preference -> {
+ Intent intent = new Intent(activity, LinkResolverActivity.class);
+ intent.setData(Uri.parse("https://www.freepik.com/free-photos-vectors/technology"));
+ startActivity(intent);
+ return true;
+ });
+ }
+
+ if(iconBackgroundPreference != null) {
+ iconBackgroundPreference.setOnPreferenceClickListener(preference -> {
+ Intent intent = new Intent(activity, LinkResolverActivity.class);
+ intent.setData(Uri.parse("https://www.freepik.com/free-photos-vectors/background"));
+ startActivity(intent);
+ return true;
+ });
+ }
+
+ if(errorImagePreference != null) {
+ errorImagePreference.setOnPreferenceClickListener(preference -> {
+ Intent intent = new Intent(activity, LinkResolverActivity.class);
+ intent.setData(Uri.parse("https://www.freepik.com/free-photos-vectors/technology"));
+ startActivity(intent);
+ return true;
+ });
+ }
+
+ if(placeholderPreference != null) {
+ placeholderPreference.setOnPreferenceClickListener(preference -> {
+ Intent intent = new Intent(activity, LinkResolverActivity.class);
+ intent.setData(Uri.parse("https://www.freepik.com/free-photos-vectors/technology"));
+ startActivity(intent);
+ return true;
+ });
+ }
+
+ if(gildedIconPreference != null) {
+ gildedIconPreference.setOnPreferenceClickListener(preference -> {
+ Intent intent = new Intent(activity, LinkResolverActivity.class);
+ intent.setData(Uri.parse("https://br.flaticon.com/icone-gratis/medalha_1007239"));
+ startActivity(intent);
+ return true;
+ });
+ }
+
+ if(crosspostIconPreference != null) {
+ crosspostIconPreference.setOnPreferenceClickListener(preference -> {
+ Intent intent = new Intent(activity, LinkResolverActivity.class);
+ intent.setData(Uri.parse("https://www.flaticon.com/free-icon/crossed-arrows_2291"));
+ startActivity(intent);
+ return true;
+ });
+ }
+
+ if(thumbtackIconPreference != null) {
+ thumbtackIconPreference.setOnPreferenceClickListener(preference -> {
+ Intent intent = new Intent(activity, LinkResolverActivity.class);
+ intent.setData(Uri.parse("https://www.flaticon.com/free-icon/tack-save-button_61845#term=thumbtack&page=1&position=3"));
+ startActivity(intent);
+ return true;
+ });
+ }
+
+ if(materialIconsPreference != null) {
+ materialIconsPreference.setOnPreferenceClickListener(preference -> {
+ Intent intent = new Intent(activity, LinkResolverActivity.class);
+ intent.setData(Uri.parse("https://material.io/resources/icons/"));
+ startActivity(intent);
+ return true;
+ });
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/Settings/MainPreferenceFragment.java b/app/src/main/java/Settings/MainPreferenceFragment.java
index c8234fb5..fbe97347 100644
--- a/app/src/main/java/Settings/MainPreferenceFragment.java
+++ b/app/src/main/java/Settings/MainPreferenceFragment.java
@@ -24,6 +24,7 @@ import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES;
* A simple {@link PreferenceFragmentCompat} subclass.
*/
public class MainPreferenceFragment extends PreferenceFragmentCompat {
+
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
setPreferencesFromResource(R.xml.main_preferences, rootKey);