|
|
@ -90,6 +90,8 @@ public class FragmentSetup extends FragmentEx { |
|
|
|
|
|
|
|
private Button btnData; |
|
|
|
|
|
|
|
private Button btnNotifications; |
|
|
|
|
|
|
|
private ToggleButton tbDarkTheme; |
|
|
|
|
|
|
|
private Button btnOptions; |
|
|
@ -136,6 +138,8 @@ public class FragmentSetup extends FragmentEx { |
|
|
|
btnDoze = view.findViewById(R.id.btnDoze); |
|
|
|
tvDozeDone = view.findViewById(R.id.tvDozeDone); |
|
|
|
|
|
|
|
btnNotifications = view.findViewById(R.id.btnNotifications); |
|
|
|
|
|
|
|
btnData = view.findViewById(R.id.btnData); |
|
|
|
|
|
|
|
tbDarkTheme = view.findViewById(R.id.tbDarkTheme); |
|
|
@ -209,6 +213,15 @@ public class FragmentSetup extends FragmentEx { |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
PackageManager pm = getContext().getPackageManager(); |
|
|
|
btnNotifications.setVisibility(getIntentNotifications(getContext()).resolveActivity(pm) == null ? View.GONE : View.VISIBLE); |
|
|
|
btnNotifications.setOnClickListener(new View.OnClickListener() { |
|
|
|
@Override |
|
|
|
public void onClick(View v) { |
|
|
|
startActivity(getIntentNotifications(getContext())); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext()); |
|
|
|
|
|
|
|
String theme = prefs.getString("theme", "light"); |
|
|
@ -499,6 +512,13 @@ public class FragmentSetup extends FragmentEx { |
|
|
|
return intent; |
|
|
|
} |
|
|
|
|
|
|
|
private static Intent getIntentNotifications(Context context) { |
|
|
|
return new Intent(Settings.ACTION_APP_NOTIFICATION_SETTINGS) |
|
|
|
.putExtra("app_package", context.getPackageName()) |
|
|
|
.putExtra("app_uid", context.getApplicationInfo().uid) |
|
|
|
.putExtra(Settings.EXTRA_APP_PACKAGE, context.getPackageName()); |
|
|
|
} |
|
|
|
|
|
|
|
private void handleExport(Intent data) { |
|
|
|
Bundle args = new Bundle(); |
|
|
|
args.putParcelable("uri", data.getData()); |
|
|
|