Browse Source

Added manage notifications button

main
M66B 6 years ago
parent
commit
d2d3917ab2
3 changed files with 34 additions and 3 deletions
  1. +20
    -0
      app/src/main/java/eu/faircode/email/FragmentSetup.java
  2. +13
    -3
      app/src/main/res/layout/fragment_setup.xml
  3. +1
    -0
      app/src/main/res/values/strings.xml

+ 20
- 0
app/src/main/java/eu/faircode/email/FragmentSetup.java View File

@ -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());


+ 13
- 3
app/src/main/res/layout/fragment_setup.xml View File

@ -200,13 +200,23 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="9dp"
android:minHeight="0dp"
android:minWidth="0dp"
android:minHeight="0dp"
android:text="@string/title_setup_data"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/vSeparatorDoze" />
<Button
android:id="@+id/btnNotifications"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="9dp"
android:text="@string/title_setup_notifications"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/btnData" />
<ToggleButton
android:id="@+id/tbDarkTheme"
android:layout_width="wrap_content"
@ -216,7 +226,7 @@
android:textOn="@string/title_setup_light_theme"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/btnData" />
app:layout_constraintTop_toBottomOf="@id/btnNotifications" />
<Button
android:id="@+id/btnOptions"
@ -224,8 +234,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="18dp"
android:minHeight="0dp"
android:minWidth="0dp"
android:minHeight="0dp"
android:text="@string/title_advanced"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"


+ 1
- 0
app/src/main/res/values/strings.xml View File

@ -73,6 +73,7 @@
<string name="title_setup_data">Disable data saving</string>
<string name="title_setup_permissions">Grant permissions</string>
<string name="title_setup_permissions_remark">To get contact information (optional)</string>
<string name="title_setup_notifications">Manage notifications</string>
<string name="title_setup_to_do">To do</string>
<string name="title_setup_done">Done</string>
<string name="title_setup_light_theme">Light theme</string>


Loading…
Cancel
Save