Reorganize settings. Opening link in app is now available.

This commit is contained in:
Alex Ning 2020-01-31 22:09:46 +08:00
parent 119afb6084
commit 02db44e532
22 changed files with 570 additions and 407 deletions

View File

@ -154,16 +154,21 @@ public class LinkResolverActivity extends AppCompatActivity {
}
private void deepLinkError(Uri uri) {
PackageManager pm = getPackageManager();
if (mSharedPreferences.getBoolean(SharedPreferencesUtils.OPEN_LINK_IN_APP, false)) {
openInCustomTabs(uri, pm);
return;
}
String authority = uri.getAuthority();
if(authority != null && (authority.contains("reddit.com") || authority.contains("redd.it") || authority.contains("reddit.app.link"))) {
openInCustomTabs(uri, getPackageManager());
openInCustomTabs(uri, pm);
return;
}
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(uri);
PackageManager pm = getPackageManager();
List<ResolveInfo> activities = pm.queryIntentActivities(intent, 0);
ArrayList<String> packageNames = new ArrayList<>();

View File

@ -17,6 +17,7 @@ import butterknife.ButterKnife;
import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.Settings.AboutPreferenceFragment;
import ml.docilealligator.infinityforreddit.Settings.InterfacePreferenceFragment;
import ml.docilealligator.infinityforreddit.Settings.MainPreferenceFragment;
public class SettingsActivity extends BaseActivity implements
@ -66,6 +67,8 @@ public class SettingsActivity extends BaseActivity implements
setTitle(R.string.settings_activity_label);
} else if (getSupportFragmentManager().findFragmentById(R.id.frame_layout_settings_activity) instanceof AboutPreferenceFragment) {
setTitle(R.string.settings_about_master_title);
} else if (getSupportFragmentManager().findFragmentById(R.id.frame_layout_settings_activity) instanceof InterfacePreferenceFragment) {
setTitle(R.string.settings_interface_title);
}
});
}

View File

@ -2,11 +2,13 @@ package ml.docilealligator.infinityforreddit.Settings;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.preference.Preference;
import androidx.preference.PreferenceFragmentCompat;
@ -19,6 +21,8 @@ import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils;
*/
public class AboutPreferenceFragment extends PreferenceFragmentCompat {
private Activity activity;
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
setPreferencesFromResource(R.xml.about_preferences, rootKey);
@ -30,77 +34,79 @@ public class AboutPreferenceFragment extends PreferenceFragmentCompat {
Preference subredditPreference = findPreference(SharedPreferencesUtils.SUBREDDIT_KEY);
Preference sharePreference = findPreference(SharedPreferencesUtils.SHARE_KEY);
Activity activity = getActivity();
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);
return true;
});
}
if (activity != null) {
if (openSourcePreference != null) {
openSourcePreference.setOnPreferenceClickListener(preference -> {
if (reviewPreference != null) {
reviewPreference.setOnPreferenceClickListener(preference -> {
Intent playStoreIntent = new Intent(Intent.ACTION_VIEW);
playStoreIntent.setData(Uri.parse("market://details?id=ml.docilealligator.infinityforreddit"));
if (playStoreIntent.resolveActivity(activity.getPackageManager()) != null) {
activity.startActivity(playStoreIntent);
} else {
Intent intent = new Intent(activity, LinkResolverActivity.class);
intent.setData(Uri.parse("https://github.com/Docile-Alligator/Infinity-For-Reddit"));
intent.setData(Uri.parse("https://play.google.com/store/apps/details?id=ml.docilealligator.infinityforreddit"));
startActivity(intent);
return true;
});
}
}
return true;
});
}
if (reviewPreference != null) {
reviewPreference.setOnPreferenceClickListener(preference -> {
Intent playStoreIntent = new Intent(Intent.ACTION_VIEW);
playStoreIntent.setData(Uri.parse("market://details?id=ml.docilealligator.infinityforreddit"));
if (playStoreIntent.resolveActivity(activity.getPackageManager()) != null) {
activity.startActivity(playStoreIntent);
} 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);
}
return true;
});
}
if (emailPreference != null) {
emailPreference.setOnPreferenceClickListener(preference -> {
Intent intent = new Intent(Intent.ACTION_SENDTO);
intent.setData(Uri.parse("mailto:docilealligator.app@gmail.com"));
if (intent.resolveActivity(activity.getPackageManager()) != null) {
startActivity(intent);
} else {
Toast.makeText(activity, R.string.no_email_client, Toast.LENGTH_SHORT).show();
}
return true;
});
}
if (redditAccountPreference != null) {
redditAccountPreference.setOnPreferenceClickListener(preference -> {
Intent intent = new Intent(activity, LinkResolverActivity.class);
intent.setData(Uri.parse("https://www.reddit.com/user/Hostilenemy"));
if (emailPreference != null) {
emailPreference.setOnPreferenceClickListener(preference -> {
Intent intent = new Intent(Intent.ACTION_SENDTO);
intent.setData(Uri.parse("mailto:docilealligator.app@gmail.com"));
if (intent.resolveActivity(activity.getPackageManager()) != null) {
startActivity(intent);
return true;
});
}
} else {
Toast.makeText(activity, R.string.no_email_client, Toast.LENGTH_SHORT).show();
}
return true;
});
}
if (subredditPreference != null) {
subredditPreference.setOnPreferenceClickListener(preference -> {
Intent intent = new Intent(activity, LinkResolverActivity.class);
intent.setData(Uri.parse("https://www.reddit.com/r/Infinity_For_Reddit"));
if (redditAccountPreference != null) {
redditAccountPreference.setOnPreferenceClickListener(preference -> {
Intent intent = new Intent(activity, LinkResolverActivity.class);
intent.setData(Uri.parse("https://www.reddit.com/user/Hostilenemy"));
startActivity(intent);
return true;
});
}
if (subredditPreference != null) {
subredditPreference.setOnPreferenceClickListener(preference -> {
Intent intent = new Intent(activity, LinkResolverActivity.class);
intent.setData(Uri.parse("https://www.reddit.com/r/Infinity_For_Reddit"));
startActivity(intent);
return true;
});
}
if (sharePreference != null) {
sharePreference.setOnPreferenceClickListener(preference -> {
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, getString(R.string.share_this_app));
if (intent.resolveActivity(activity.getPackageManager()) != null) {
startActivity(intent);
return true;
});
}
if (sharePreference != null) {
sharePreference.setOnPreferenceClickListener(preference -> {
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, getString(R.string.share_this_app));
if (intent.resolveActivity(activity.getPackageManager()) != null) {
startActivity(intent);
} else {
Toast.makeText(activity, R.string.no_app, Toast.LENGTH_SHORT).show();
}
return true;
});
}
} else {
Toast.makeText(activity, R.string.no_app, Toast.LENGTH_SHORT).show();
}
return true;
});
}
}
@Override
public void onAttach(@NonNull Context context) {
super.onAttach(context);
activity = (Activity) context;
}
}

View File

@ -2,12 +2,14 @@ package ml.docilealligator.infinityforreddit.Settings;
import android.app.Activity;
import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
@ -23,9 +25,9 @@ import ml.docilealligator.infinityforreddit.R;
*/
public class AcknowledgementFragment extends Fragment {
@BindView(R.id.recycler_view_acknowledgement_fragment)
RecyclerView recyclerView;
private Activity activity;
public AcknowledgementFragment() {
// Required empty public constructor
@ -37,8 +39,6 @@ public class AcknowledgementFragment extends Fragment {
View rootView = inflater.inflate(R.layout.fragment_acknowledgement, container, false);
ButterKnife.bind(this, rootView);
Activity activity = getActivity();
ArrayList<Acknowledgement> acknowledgements = new ArrayList<>();
acknowledgements.add(new Acknowledgement("ExoPlayer",
"An application level media player for Android",
@ -107,4 +107,10 @@ public class AcknowledgementFragment extends Fragment {
return rootView;
}
@Override
public void onAttach(@NonNull Context context) {
super.onAttach(context);
activity = (Activity) context;
}
}

View File

@ -2,10 +2,12 @@ package ml.docilealligator.infinityforreddit.Settings;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.preference.Preference;
import androidx.preference.PreferenceFragmentCompat;
@ -18,6 +20,8 @@ import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils;
*/
public class CreditsPreferenceFragment extends PreferenceFragmentCompat {
private Activity activity;
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
setPreferencesFromResource(R.xml.credits_preferences, rootKey);
@ -30,71 +34,73 @@ public class CreditsPreferenceFragment extends PreferenceFragmentCompat {
Preference thumbtackIconPreference = findPreference(SharedPreferencesUtils.THUMBTACK_ICON_KEY);
Preference materialIconsPreference = findPreference(SharedPreferencesUtils.MATERIAL_ICONS_KEY);
Activity activity = getActivity();
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 (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 (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 (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 (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 (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 (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;
});
}
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;
});
}
}
@Override
public void onAttach(@NonNull Context context) {
super.onAttach(context);
activity = (Activity) context;
}
}

View File

@ -1,8 +1,10 @@
package ml.docilealligator.infinityforreddit.Settings;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.preference.ListPreference;
import androidx.preference.PreferenceFragmentCompat;
@ -13,37 +15,41 @@ import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils;
public class FontSizePreferenceFragment extends PreferenceFragmentCompat {
private Activity activity;
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
setPreferencesFromResource(R.xml.font_size_preferences, rootKey);
ListPreference fontSizePreference = findPreference(SharedPreferencesUtils.FONT_SIZE_KEY);
ListPreference titleFontSizePreference = findPreference(SharedPreferencesUtils.TITLE_FONT_SIZE_KEY);
ListPreference contentFontSizePreference = findPreference(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY);
Activity activity = getActivity();
if (activity != null) {
ListPreference fontSizePreference = findPreference(SharedPreferencesUtils.FONT_SIZE_KEY);
ListPreference titleFontSizePreference = findPreference(SharedPreferencesUtils.TITLE_FONT_SIZE_KEY);
ListPreference contentFontSizePreference = findPreference(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY);
if (fontSizePreference != null) {
fontSizePreference.setOnPreferenceChangeListener((preference, newValue) -> {
EventBus.getDefault().post(new RecreateActivityEvent());
activity.recreate();
return true;
});
}
if (fontSizePreference != null) {
fontSizePreference.setOnPreferenceChangeListener((preference, newValue) -> {
EventBus.getDefault().post(new RecreateActivityEvent());
activity.recreate();
return true;
});
}
if (titleFontSizePreference != null) {
titleFontSizePreference.setOnPreferenceChangeListener((preference, newValue) -> {
EventBus.getDefault().post(new RecreateActivityEvent());
return true;
});
}
if (titleFontSizePreference != null) {
titleFontSizePreference.setOnPreferenceChangeListener((preference, newValue) -> {
EventBus.getDefault().post(new RecreateActivityEvent());
return true;
});
}
if (contentFontSizePreference != null) {
contentFontSizePreference.setOnPreferenceChangeListener((preference, newValue) -> {
EventBus.getDefault().post(new RecreateActivityEvent());
return true;
});
}
if (contentFontSizePreference != null) {
contentFontSizePreference.setOnPreferenceChangeListener((preference, newValue) -> {
EventBus.getDefault().post(new RecreateActivityEvent());
return true;
});
}
}
@Override
public void onAttach(@NonNull Context context) {
super.onAttach(context);
activity = (Activity) context;
}
}

View File

@ -0,0 +1,20 @@
package ml.docilealligator.infinityforreddit.Settings;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import androidx.preference.PreferenceFragmentCompat;
import ml.docilealligator.infinityforreddit.R;
/**
* A simple {@link Fragment} subclass.
*/
public class GesturesAndButtonsPreferenceFragment extends PreferenceFragmentCompat {
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
setPreferencesFromResource(R.xml.gestures_and_buttons_preference, rootKey);
}
}

View File

@ -0,0 +1,95 @@
package ml.docilealligator.infinityforreddit.Settings;
import android.app.Activity;
import android.content.Context;
import android.os.Build;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.preference.ListPreference;
import androidx.preference.PreferenceFragmentCompat;
import androidx.preference.SwitchPreference;
import org.greenrobot.eventbus.EventBus;
import ml.docilealligator.infinityforreddit.Event.ChangePostLayoutEvent;
import ml.docilealligator.infinityforreddit.Event.ChangeShowElapsedTimeEvent;
import ml.docilealligator.infinityforreddit.Event.ChangeVoteButtonsPositionEvent;
import ml.docilealligator.infinityforreddit.Event.RecreateActivityEvent;
import ml.docilealligator.infinityforreddit.Event.ShowDividerInCompactLayoutPreferenceEvent;
import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils;
/**
* A simple {@link Fragment} subclass.
*/
public class InterfacePreferenceFragment extends PreferenceFragmentCompat {
private Activity activity;
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
setPreferencesFromResource(R.xml.interface_preference, rootKey);
SwitchPreference immersiveInterfaceSwitch = findPreference(SharedPreferencesUtils.IMMERSIVE_INTERFACE_KEY);
SwitchPreference bottomAppBarSwitch = findPreference(SharedPreferencesUtils.BOTTOM_APP_BAR_KEY);
SwitchPreference voteButtonsOnTheRightSwitch = findPreference(SharedPreferencesUtils.VOTE_BUTTONS_ON_THE_RIGHT_KEY);
SwitchPreference showElapsedTimeSwitch = findPreference(SharedPreferencesUtils.SHOW_ELAPSED_TIME_KEY);
ListPreference defaultPostLayoutSwitch = findPreference(SharedPreferencesUtils.DEFAULT_POST_LAYOUT_KEY);
SwitchPreference showDividerInCompactLayout = findPreference(SharedPreferencesUtils.SHOW_DIVIDER_IN_COMPACT_LAYOUT);
if (immersiveInterfaceSwitch != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
immersiveInterfaceSwitch.setVisible(true);
immersiveInterfaceSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
EventBus.getDefault().post(new RecreateActivityEvent());
return true;
});
} else {
immersiveInterfaceSwitch.setVisible(false);
}
}
if (bottomAppBarSwitch != null) {
bottomAppBarSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
EventBus.getDefault().post(new RecreateActivityEvent());
return true;
});
}
if (voteButtonsOnTheRightSwitch != null) {
voteButtonsOnTheRightSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
EventBus.getDefault().post(new ChangeVoteButtonsPositionEvent((Boolean) newValue));
return true;
});
}
if (showElapsedTimeSwitch != null) {
showElapsedTimeSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
EventBus.getDefault().post(new ChangeShowElapsedTimeEvent((Boolean) newValue));
return true;
});
}
if (defaultPostLayoutSwitch != null) {
defaultPostLayoutSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
EventBus.getDefault().post(new ChangePostLayoutEvent(Integer.parseInt((String) newValue)));
return true;
});
}
if (showDividerInCompactLayout != null) {
showDividerInCompactLayout.setOnPreferenceChangeListener((preference, newValue) -> {
EventBus.getDefault().post(new ShowDividerInCompactLayoutPreferenceEvent((Boolean) newValue));
return true;
});
}
}
@Override
public void onAttach(@NonNull Context context) {
super.onAttach(context);
activity = (Activity) context;
}
}

View File

@ -2,11 +2,13 @@ package ml.docilealligator.infinityforreddit.Settings;
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.os.Build;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.preference.ListPreference;
import androidx.preference.PreferenceFragmentCompat;
@ -18,12 +20,8 @@ import javax.inject.Inject;
import ml.docilealligator.infinityforreddit.Event.ChangeNSFWBlurEvent;
import ml.docilealligator.infinityforreddit.Event.ChangeNSFWEvent;
import ml.docilealligator.infinityforreddit.Event.ChangePostLayoutEvent;
import ml.docilealligator.infinityforreddit.Event.ChangeShowElapsedTimeEvent;
import ml.docilealligator.infinityforreddit.Event.ChangeSpoilerBlurEvent;
import ml.docilealligator.infinityforreddit.Event.ChangeVoteButtonsPositionEvent;
import ml.docilealligator.infinityforreddit.Event.RecreateActivityEvent;
import ml.docilealligator.infinityforreddit.Event.ShowDividerInCompactLayoutPreferenceEvent;
import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils;
@ -40,144 +38,94 @@ public class MainPreferenceFragment extends PreferenceFragmentCompat {
@Inject
SharedPreferences sharedPreferences;
private Activity activity;
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
setPreferencesFromResource(R.xml.main_preferences, rootKey);
((Infinity) activity.getApplication()).getAppComponent().inject(this);
Activity activity = getActivity();
if (activity != null) {
((Infinity) activity.getApplication()).getAppComponent().inject(this);
SwitchPreference amoledDarkSwitch = findPreference(SharedPreferencesUtils.AMOLED_DARK_KEY);
SwitchPreference nsfwSwitch = findPreference(SharedPreferencesUtils.NSFW_KEY);
SwitchPreference blurNSFWSwitch = findPreference(SharedPreferencesUtils.BLUR_NSFW_KEY);
SwitchPreference blurSpoilerSwitch = findPreference(SharedPreferencesUtils.BLUR_SPOILER_KEY);
ListPreference themePreference = findPreference(SharedPreferencesUtils.THEME_KEY);
SwitchPreference amoledDarkSwitch = findPreference(SharedPreferencesUtils.AMOLED_DARK_KEY);
SwitchPreference immersiveInterfaceSwitch = findPreference(SharedPreferencesUtils.IMMERSIVE_INTERFACE_KEY);
SwitchPreference bottomAppBarSwitch = findPreference(SharedPreferencesUtils.BOTTOM_APP_BAR_KEY);
SwitchPreference voteButtonsOnTheRightSwitch = findPreference(SharedPreferencesUtils.VOTE_BUTTONS_ON_THE_RIGHT_KEY);
SwitchPreference showElapsedTimeSwitch = findPreference(SharedPreferencesUtils.SHOW_ELAPSED_TIME_KEY);
ListPreference defaultPostLayoutSwitch = findPreference(SharedPreferencesUtils.DEFAULT_POST_LAYOUT_KEY);
SwitchPreference showDividerInCompactLayout = findPreference(SharedPreferencesUtils.SHOW_DIVIDER_IN_COMPACT_LAYOUT);
SwitchPreference nsfwSwitch = findPreference(SharedPreferencesUtils.NSFW_KEY);
SwitchPreference blurNSFWSwitch = findPreference(SharedPreferencesUtils.BLUR_NSFW_KEY);
SwitchPreference blurSpoilerSwitch = findPreference(SharedPreferencesUtils.BLUR_SPOILER_KEY);
ListPreference themePreference = findPreference(SharedPreferencesUtils.THEME_KEY);
if (amoledDarkSwitch != null) {
amoledDarkSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
if((getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_NO) {
EventBus.getDefault().post(new RecreateActivityEvent());
activity.recreate();
}
return true;
});
}
if (immersiveInterfaceSwitch != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
immersiveInterfaceSwitch.setVisible(true);
immersiveInterfaceSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
EventBus.getDefault().post(new RecreateActivityEvent());
return true;
});
} else {
immersiveInterfaceSwitch.setVisible(false);
}
}
if (bottomAppBarSwitch != null) {
bottomAppBarSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
if (amoledDarkSwitch != null) {
amoledDarkSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
if ((getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_NO) {
EventBus.getDefault().post(new RecreateActivityEvent());
return true;
});
}
if (voteButtonsOnTheRightSwitch != null) {
voteButtonsOnTheRightSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
EventBus.getDefault().post(new ChangeVoteButtonsPositionEvent((Boolean) newValue));
return true;
});
}
if (showElapsedTimeSwitch != null) {
showElapsedTimeSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
EventBus.getDefault().post(new ChangeShowElapsedTimeEvent((Boolean) newValue));
return true;
});
}
if (defaultPostLayoutSwitch != null) {
defaultPostLayoutSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
EventBus.getDefault().post(new ChangePostLayoutEvent(Integer.parseInt((String) newValue)));
return true;
});
}
if (showDividerInCompactLayout != null) {
showDividerInCompactLayout.setOnPreferenceChangeListener((preference, newValue) -> {
EventBus.getDefault().post(new ShowDividerInCompactLayoutPreferenceEvent((Boolean) newValue));
return true;
});
}
if (nsfwSwitch != null) {
nsfwSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
EventBus.getDefault().post(new ChangeNSFWEvent((Boolean) newValue));
if (blurNSFWSwitch != null) {
blurNSFWSwitch.setVisible((Boolean) newValue);
}
return true;
});
}
if (blurNSFWSwitch != null) {
boolean nsfwEnabled = sharedPreferences.getBoolean(SharedPreferencesUtils.NSFW_KEY, false);
if (nsfwEnabled) {
blurNSFWSwitch.setVisible(true);
} else {
blurNSFWSwitch.setVisible(false);
activity.recreate();
}
return true;
});
}
blurNSFWSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
EventBus.getDefault().post(new ChangeNSFWBlurEvent((Boolean) newValue));
return true;
});
}
if (blurSpoilerSwitch != null) {
blurSpoilerSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
EventBus.getDefault().post(new ChangeSpoilerBlurEvent((Boolean) newValue));
return true;
});
}
boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
if (themePreference != null) {
if (systemDefault) {
themePreference.setEntries(R.array.settings_theme_q);
} else {
themePreference.setEntries(R.array.settings_theme);
if (nsfwSwitch != null) {
nsfwSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
EventBus.getDefault().post(new ChangeNSFWEvent((Boolean) newValue));
if (blurNSFWSwitch != null) {
blurNSFWSwitch.setVisible((Boolean) newValue);
}
return true;
});
}
themePreference.setOnPreferenceChangeListener((preference, newValue) -> {
int option = Integer.parseInt((String) newValue);
switch (option) {
case 0:
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
break;
case 1:
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
break;
case 2:
if (systemDefault) {
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_FOLLOW_SYSTEM);
} else {
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO_BATTERY);
}
}
return true;
});
if (blurNSFWSwitch != null) {
boolean nsfwEnabled = sharedPreferences.getBoolean(SharedPreferencesUtils.NSFW_KEY, false);
if (nsfwEnabled) {
blurNSFWSwitch.setVisible(true);
} else {
blurNSFWSwitch.setVisible(false);
}
blurNSFWSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
EventBus.getDefault().post(new ChangeNSFWBlurEvent((Boolean) newValue));
return true;
});
}
if (blurSpoilerSwitch != null) {
blurSpoilerSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
EventBus.getDefault().post(new ChangeSpoilerBlurEvent((Boolean) newValue));
return true;
});
}
boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
if (themePreference != null) {
if (systemDefault) {
themePreference.setEntries(R.array.settings_theme_q);
} else {
themePreference.setEntries(R.array.settings_theme);
}
themePreference.setOnPreferenceChangeListener((preference, newValue) -> {
int option = Integer.parseInt((String) newValue);
switch (option) {
case 0:
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
break;
case 1:
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
break;
case 2:
if (systemDefault) {
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_FOLLOW_SYSTEM);
} else {
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO_BATTERY);
}
}
return true;
});
}
}
@Override
public void onAttach(@NonNull Context context) {
super.onAttach(context);
activity = (Activity) context;
}
}

View File

@ -2,9 +2,11 @@ package ml.docilealligator.infinityforreddit.Settings;
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.preference.ListPreference;
import androidx.preference.PreferenceFragmentCompat;
@ -34,83 +36,86 @@ public class NotificationPreferenceFragment extends PreferenceFragmentCompat {
private boolean enableNotification;
private long notificationInterval;
private WorkManager workManager;
private Activity activity;
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
setPreferencesFromResource(R.xml.notification_preferences, rootKey);
Activity activity = getActivity();
workManager = WorkManager.getInstance(activity);
if (activity != null) {
workManager = WorkManager.getInstance(activity);
((Infinity) activity.getApplication()).getAppComponent().inject(this);
((Infinity) activity.getApplication()).getAppComponent().inject(this);
SwitchPreference enableNotificationSwitchPreference = findPreference(SharedPreferencesUtils.ENABLE_NOTIFICATION_KEY);
ListPreference notificationIntervalListPreference = findPreference(SharedPreferencesUtils.NOTIFICATION_INTERVAL_KEY);
SwitchPreference enableNotificationSwitchPreference = findPreference(SharedPreferencesUtils.ENABLE_NOTIFICATION_KEY);
ListPreference notificationIntervalListPreference = findPreference(SharedPreferencesUtils.NOTIFICATION_INTERVAL_KEY);
enableNotification = sharedPreferences.getBoolean(SharedPreferencesUtils.ENABLE_NOTIFICATION_KEY, true);
notificationInterval = Long.parseLong(sharedPreferences.getString(SharedPreferencesUtils.NOTIFICATION_INTERVAL_KEY, "1"));
if (enableNotification) {
if (notificationIntervalListPreference != null) {
notificationIntervalListPreference.setVisible(true);
}
}
if (enableNotificationSwitchPreference != null) {
enableNotificationSwitchPreference.setOnPreferenceChangeListener((preference, newValue) -> {
enableNotification = ((Boolean) newValue);
if (notificationIntervalListPreference != null) {
notificationIntervalListPreference.setVisible(enableNotification);
}
if (enableNotification) {
Constraints constraints = new Constraints.Builder()
.setRequiredNetworkType(NetworkType.CONNECTED)
.build();
PeriodicWorkRequest pullNotificationRequest =
new PeriodicWorkRequest.Builder(PullNotificationWorker.class,
notificationInterval, TimeUnit.HOURS)
.setConstraints(constraints)
.setInitialDelay(notificationInterval, TimeUnit.HOURS)
.build();
workManager.enqueueUniquePeriodicWork(PullNotificationWorker.WORKER_TAG,
ExistingPeriodicWorkPolicy.REPLACE, pullNotificationRequest);
} else {
workManager.cancelUniqueWork(PullNotificationWorker.WORKER_TAG);
}
return true;
});
}
enableNotification = sharedPreferences.getBoolean(SharedPreferencesUtils.ENABLE_NOTIFICATION_KEY, true);
notificationInterval = Long.parseLong(sharedPreferences.getString(SharedPreferencesUtils.NOTIFICATION_INTERVAL_KEY, "1"));
if (enableNotification) {
if (notificationIntervalListPreference != null) {
notificationIntervalListPreference.setOnPreferenceChangeListener((preference, newValue) -> {
notificationInterval = Long.parseLong((String) newValue);
if (enableNotification) {
Constraints constraints = new Constraints.Builder()
.setRequiredNetworkType(NetworkType.CONNECTED)
.build();
PeriodicWorkRequest pullNotificationRequest =
new PeriodicWorkRequest.Builder(PullNotificationWorker.class,
notificationInterval, TimeUnit.HOURS)
.setConstraints(constraints)
.setInitialDelay(notificationInterval, TimeUnit.HOURS)
.build();
workManager.enqueueUniquePeriodicWork(PullNotificationWorker.WORKER_TAG,
ExistingPeriodicWorkPolicy.REPLACE, pullNotificationRequest);
} else {
workManager.cancelUniqueWork(PullNotificationWorker.WORKER_TAG);
}
return true;
});
notificationIntervalListPreference.setVisible(true);
}
}
if (enableNotificationSwitchPreference != null) {
enableNotificationSwitchPreference.setOnPreferenceChangeListener((preference, newValue) -> {
enableNotification = ((Boolean) newValue);
if (notificationIntervalListPreference != null) {
notificationIntervalListPreference.setVisible(enableNotification);
}
if (enableNotification) {
Constraints constraints = new Constraints.Builder()
.setRequiredNetworkType(NetworkType.CONNECTED)
.build();
PeriodicWorkRequest pullNotificationRequest =
new PeriodicWorkRequest.Builder(PullNotificationWorker.class,
notificationInterval, TimeUnit.HOURS)
.setConstraints(constraints)
.setInitialDelay(notificationInterval, TimeUnit.HOURS)
.build();
workManager.enqueueUniquePeriodicWork(PullNotificationWorker.WORKER_TAG,
ExistingPeriodicWorkPolicy.REPLACE, pullNotificationRequest);
} else {
workManager.cancelUniqueWork(PullNotificationWorker.WORKER_TAG);
}
return true;
});
}
if (notificationIntervalListPreference != null) {
notificationIntervalListPreference.setOnPreferenceChangeListener((preference, newValue) -> {
notificationInterval = Long.parseLong((String) newValue);
if (enableNotification) {
Constraints constraints = new Constraints.Builder()
.setRequiredNetworkType(NetworkType.CONNECTED)
.build();
PeriodicWorkRequest pullNotificationRequest =
new PeriodicWorkRequest.Builder(PullNotificationWorker.class,
notificationInterval, TimeUnit.HOURS)
.setConstraints(constraints)
.setInitialDelay(notificationInterval, TimeUnit.HOURS)
.build();
workManager.enqueueUniquePeriodicWork(PullNotificationWorker.WORKER_TAG,
ExistingPeriodicWorkPolicy.REPLACE, pullNotificationRequest);
} else {
workManager.cancelUniqueWork(PullNotificationWorker.WORKER_TAG);
}
return true;
});
}
}
@Override
public void onAttach(@NonNull Context context) {
super.onAttach(context);
activity = (Activity) context;
}
}

View File

@ -68,4 +68,5 @@ public class SharedPreferencesUtils {
public static final String VOLUME_KEYS_NAVIGATE_COMMENTS = "volume_keys_navigate_comments";
public static final String VOLUME_KEYS_NAVIGATE_POSTS = "volume_keys_navigate_posts";
public static final String MUTE_VIDEO = "mute_video";
public static final String OPEN_LINK_IN_APP = "open_link_in_app";
}

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M4.59,6.89c0.7,-0.71 1.4,-1.35 1.71,-1.22 0.5,0.2 0,1.03 -0.3,1.52 -0.25,0.42 -2.86,3.89 -2.86,6.31 0,1.28 0.48,2.34 1.34,2.98 0.75,0.56 1.74,0.73 2.64,0.46 1.07,-0.31 1.95,-1.4 3.06,-2.77 1.21,-1.49 2.83,-3.44 4.08,-3.44 1.63,0 1.65,1.01 1.76,1.79 -3.78,0.64 -5.38,3.67 -5.38,5.37 0,1.7 1.44,3.09 3.21,3.09 1.63,0 4.29,-1.33 4.69,-6.1L21,14.88v-2.5h-2.47c-0.15,-1.65 -1.09,-4.2 -4.03,-4.2 -2.25,0 -4.18,1.91 -4.94,2.84 -0.58,0.73 -2.06,2.48 -2.29,2.72 -0.25,0.3 -0.68,0.84 -1.11,0.84 -0.45,0 -0.72,-0.83 -0.36,-1.92 0.35,-1.09 1.4,-2.86 1.85,-3.52 0.78,-1.14 1.3,-1.92 1.3,-3.28C8.95,3.69 7.31,3 6.44,3 5.12,3 3.97,4 3.72,4.25c-0.36,0.36 -0.66,0.66 -0.88,0.93l1.75,1.71zM13.88,18.55c-0.31,0 -0.74,-0.26 -0.74,-0.72 0,-0.6 0.73,-2.2 2.87,-2.76 -0.3,2.69 -1.43,3.48 -2.13,3.48z"/>
</vector>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M20,4L4,4c-1.1,0 -1.99,0.9 -1.99,2L2,18c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L22,6c0,-1.1 -0.9,-2 -2,-2zM15,18L4,18v-4h11v4zM15,13L4,13L4,9h11v4zM20,18h-4L16,9h4v9z"/>
</vector>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF000000"
android:pathData="M4.59,6.89c0.7,-0.71 1.4,-1.35 1.71,-1.22 0.5,0.2 0,1.03 -0.3,1.52 -0.25,0.42 -2.86,3.89 -2.86,6.31 0,1.28 0.48,2.34 1.34,2.98 0.75,0.56 1.74,0.73 2.64,0.46 1.07,-0.31 1.95,-1.4 3.06,-2.77 1.21,-1.49 2.83,-3.44 4.08,-3.44 1.63,0 1.65,1.01 1.76,1.79 -3.78,0.64 -5.38,3.67 -5.38,5.37 0,1.7 1.44,3.09 3.21,3.09 1.63,0 4.29,-1.33 4.69,-6.1L21,14.88v-2.5h-2.47c-0.15,-1.65 -1.09,-4.2 -4.03,-4.2 -2.25,0 -4.18,1.91 -4.94,2.84 -0.58,0.73 -2.06,2.48 -2.29,2.72 -0.25,0.3 -0.68,0.84 -1.11,0.84 -0.45,0 -0.72,-0.83 -0.36,-1.92 0.35,-1.09 1.4,-2.86 1.85,-3.52 0.78,-1.14 1.3,-1.92 1.3,-3.28C8.95,3.69 7.31,3 6.44,3 5.12,3 3.97,4 3.72,4.25c-0.36,0.36 -0.66,0.66 -0.88,0.93l1.75,1.71zM13.88,18.55c-0.31,0 -0.74,-0.26 -0.74,-0.72 0,-0.6 0.73,-2.2 2.87,-2.76 -0.3,2.69 -1.43,3.48 -2.13,3.48z"/>
</vector>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF000000"
android:pathData="M20,4L4,4c-1.1,0 -1.99,0.9 -1.99,2L2,18c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L22,6c0,-1.1 -0.9,-2 -2,-2zM15,18L4,18v-4h11v4zM15,13L4,13L4,9h11v4zM20,18h-4L16,9h4v9z"/>
</vector>

View File

@ -293,6 +293,9 @@
<string name="settings_theme_dark_theme_summary">Dark Theme</string>
<string name="settings_theme_system_default_summary">Device default</string>
<string name="settings_amoled_dark_title">Amoled Dark</string>
<string name="settings_interface_title">Interface</string>
<string name="settings_gestures_and_buttons_title">Gestures &amp; Buttons</string>
<string name="settings_open_link_in_app_title">Open Link In App</string>
<string name="settings_immersive_interface_title">Immersive Interface</string>
<string name="settings_enable_bottom_app_bar_title">Enable Bottom Navigation</string>
<string name="settings_vote_buttons_on_the_right_title">Vote Buttons on the Right</string>
@ -302,7 +305,7 @@
<string name="settings_show_elapsed_time">Show Elapsed Time in Posts and Comments</string>
<string name="settings_default_post_layout">Default Post Layout</string>
<string name="settings_show_divider_in_compact_layout">Show Divider in Compact Layout</string>
<string name="swipe_to_go_back_from_post_detail">Swipe Right to Go Back From Comments</string>
<string name="settings_swipe_to_go_back_from_post_detail_title">Swipe Right to Go Back From Comments</string>
<string name="settings_lazy_mode_interval_title">Lazy Mode Interval</string>
<string name="settings_font_size_title">Font Size</string>
<string name="settings_title_font_size_title">Title Font Size</string>
@ -414,4 +417,7 @@
<string name="save_comment">Save comment</string>
<string name="unsave_comment">Unsave comment</string>
<!-- TODO: Remove or change this placeholder text -->
<string name="hello_blank_fragment">Hello blank fragment</string>
</resources>

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:app="http://schemas.android.com/apk/res-auto">
<SwitchPreference
app:defaultValue="true"
app:key="swipe_to_go_back_from_post_detail"
app:title="@string/settings_swipe_to_go_back_from_post_detail_title" />
<SwitchPreference
app:defaultValue="false"
app:key="volume_keys_navigate_comments"
app:title="@string/settings_volume_keys_navigate_comments_title" />
<SwitchPreference
app:defaultValue="false"
app:key="volume_keys_navigate_posts"
app:title="@string/settings_volume_keys_navigate_posts_title" />
</PreferenceScreen>

View File

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<Preference
app:title="@string/settings_font_size_title"
app:icon="@drawable/ic_font_size_24dp"
app:fragment="ml.docilealligator.infinityforreddit.Settings.FontSizePreferenceFragment" />
<SwitchPreference
app:defaultValue="true"
app:key="immersive_interface"
app:title="@string/settings_immersive_interface_title"
app:isPreferenceVisible="false" />
<SwitchPreference
app:defaultValue="false"
app:key="bottom_app_bar"
app:title="@string/settings_enable_bottom_app_bar_title" />
<SwitchPreference
app:defaultValue="false"
app:key="vote_buttons_on_the_right"
app:title="@string/settings_vote_buttons_on_the_right_title" />
<SwitchPreference
app:defaultValue="false"
app:key="show_elapsed_time"
app:title="@string/settings_show_elapsed_time" />
<ListPreference
app:defaultValue="0"
android:entries="@array/settings_default_post_layout"
app:entryValues="@array/settings_default_post_layout_values"
app:key="default_post_layout"
app:title="@string/settings_default_post_layout"
app:useSimpleSummaryProvider="true" />
<SwitchPreference
app:defaultValue="true"
app:key="show_divider_in_compact_layout"
app:title="@string/settings_show_divider_in_compact_layout" />
</PreferenceScreen>

View File

@ -3,7 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto">
<Preference
app:icon="@drawable/ic_outline_notifications_24px"
app:icon="@drawable/ic_outline_notifications_24dp"
app:title="@string/settings_notification_master_title"
app:fragment="ml.docilealligator.infinityforreddit.Settings.NotificationPreferenceFragment" />
@ -20,59 +20,21 @@
app:key="amoled_dark"
app:title="@string/settings_amoled_dark_title" />
<SwitchPreference
app:defaultValue="true"
app:key="immersive_interface"
app:title="@string/settings_immersive_interface_title"
app:isPreferenceVisible="false" />
<Preference
app:icon="@drawable/ic_interface_24dp"
app:title="@string/settings_interface_title"
app:fragment="ml.docilealligator.infinityforreddit.Settings.InterfacePreferenceFragment" />
<Preference
app:icon="@drawable/ic_gesture_24dp"
app:title="@string/settings_gestures_and_buttons_title"
app:fragment="ml.docilealligator.infinityforreddit.Settings.GesturesAndButtonsPreferenceFragment" />
<SwitchPreference
app:defaultValue="false"
app:key="bottom_app_bar"
app:title="@string/settings_enable_bottom_app_bar_title" />
<SwitchPreference
app:defaultValue="false"
app:key="vote_buttons_on_the_right"
app:title="@string/settings_vote_buttons_on_the_right_title" />
<SwitchPreference
app:defaultValue="false"
app:key="show_elapsed_time"
app:title="@string/settings_show_elapsed_time" />
<ListPreference
app:defaultValue="0"
android:entries="@array/settings_default_post_layout"
app:entryValues="@array/settings_default_post_layout_values"
app:key="default_post_layout"
app:title="@string/settings_default_post_layout"
app:useSimpleSummaryProvider="true" />
<SwitchPreference
app:defaultValue="true"
app:key="show_divider_in_compact_layout"
app:title="@string/settings_show_divider_in_compact_layout" />
<SwitchPreference
app:defaultValue="true"
app:key="swipe_to_go_back_from_post_detail"
app:title="@string/swipe_to_go_back_from_post_detail" />
<SwitchPreference
app:defaultValue="true"
app:key="swipe_to_go_back_from_post_detail"
app:title="@string/swipe_to_go_back_from_post_detail" />
<SwitchPreference
app:defaultValue="false"
app:key="volume_keys_navigate_comments"
app:title="@string/settings_volume_keys_navigate_comments_title" />
<SwitchPreference
app:defaultValue="false"
app:key="volume_keys_navigate_posts"
app:title="@string/settings_volume_keys_navigate_posts_title" />
app:icon="@drawable/ic_link"
app:key="open_link_in_app"
app:title="@string/settings_open_link_in_app_title" />
<SwitchPreference
app:defaultValue="false"
@ -80,11 +42,6 @@
android:icon="@drawable/ic_mute_preferences_24dp"
app:title="@string/settings_mute_video_title" />
<Preference
app:title="@string/settings_font_size_title"
app:icon="@drawable/ic_font_size_24dp"
app:fragment="ml.docilealligator.infinityforreddit.Settings.FontSizePreferenceFragment" />
<ListPreference
app:defaultValue="2.5"
android:entries="@array/settings_lazy_mode_interval"

View File

@ -5,7 +5,7 @@
<SwitchPreference
app:defaultValue="true"
app:key="enable_notification"
app:icon="@drawable/ic_outline_notifications_24px"
app:icon="@drawable/ic_outline_notifications_24dp"
app:title="@string/settings_notification_enable_notification_title"/>
<ListPreference