mirror of https://github.com/M66B/FairEmail.git
Added button to directly navigate to the notification channel settings
This commit is contained in:
parent
07106a6ef9
commit
61b8df8fa8
|
@ -37,6 +37,7 @@ import android.view.ViewGroup;
|
|||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.ImageButton;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
@ -56,6 +57,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
|
|||
private CheckBox cbNotifyActionFlag;
|
||||
private CheckBox cbNotifyActionSeen;
|
||||
private Button btnManage;
|
||||
private ImageButton ibManage;
|
||||
private SwitchCompat swLight;
|
||||
private Button btnSound;
|
||||
|
||||
|
@ -83,6 +85,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
|
|||
cbNotifyActionFlag = view.findViewById(R.id.cbNotifyActionFlag);
|
||||
cbNotifyActionSeen = view.findViewById(R.id.cbNotifyActionSeen);
|
||||
btnManage = view.findViewById(R.id.btnManage);
|
||||
ibManage = view.findViewById(R.id.ibManage);
|
||||
swLight = view.findViewById(R.id.swLight);
|
||||
btnSound = view.findViewById(R.id.btnSound);
|
||||
|
||||
|
@ -92,6 +95,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
|
|||
|
||||
// Wire controls
|
||||
|
||||
PackageManager pm = getContext().getPackageManager();
|
||||
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||
|
||||
swNotifyGroup.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
|
@ -144,7 +148,6 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
|
|||
});
|
||||
|
||||
final Intent manage = getIntentNotifications(getContext());
|
||||
PackageManager pm = getContext().getPackageManager();
|
||||
btnManage.setVisibility(manage.resolveActivity(pm) == null ? View.GONE : View.VISIBLE);
|
||||
btnManage.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -153,6 +156,17 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
|
|||
}
|
||||
});
|
||||
|
||||
final Intent channel = new Intent(Settings.ACTION_CHANNEL_NOTIFICATION_SETTINGS)
|
||||
.putExtra(Settings.EXTRA_APP_PACKAGE, getContext().getPackageName())
|
||||
.putExtra(Settings.EXTRA_CHANNEL_ID, "notification");
|
||||
ibManage.setVisibility(channel.resolveActivity(pm) == null ? View.GONE : View.VISIBLE);
|
||||
ibManage.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
startActivity(channel);
|
||||
}
|
||||
});
|
||||
|
||||
swLight.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M19,19H5V5h7V3H5c-1.11,0 -2,0.9 -2,2v14c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2v-7h-2v7zM14,3v2h3.59l-9.83,9.83 1.41,1.41L19,6.41V10h2V3h-7z"/>
|
||||
</vector>
|
|
@ -148,14 +148,22 @@
|
|||
android:id="@+id/tvManageHint"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="48dp"
|
||||
android:text="@string/title_advanced_notify_manage_hint"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
android:textStyle="italic"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/ibManage"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/btnManage" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/ibManage"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/title_setup_notifications"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tvManageHint"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:srcCompat="@drawable/baseline_launch_24" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swLight"
|
||||
android:layout_width="match_parent"
|
||||
|
|
Loading…
Reference in New Issue