blob: 55fb3363ee550802f8adb90f7f52d437da20e693 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
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 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(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;
});
}
}
}
}
|