Added notifications disabled warning

This commit is contained in:
M66B 2022-06-10 11:34:23 +02:00
parent 22ac74b4b5
commit da44c936be
4 changed files with 69 additions and 1 deletions

View File

@ -34,6 +34,7 @@ import static me.everything.android.ui.overscroll.OverScrollBounceEffectDecorato
import static me.everything.android.ui.overscroll.OverScrollBounceEffectDecoratorBase.DEFAULT_TOUCH_DRAG_MOVE_RATIO_BCK;
import static me.everything.android.ui.overscroll.OverScrollBounceEffectDecoratorBase.DEFAULT_TOUCH_DRAG_MOVE_RATIO_FWD;
import android.Manifest;
import android.animation.ObjectAnimator;
import android.app.Activity;
import android.app.Dialog;
@ -258,6 +259,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
private ViewGroup view;
private SwipeRefreshLayoutEx swipeRefresh;
private TextView tvAirplane;
private TextView tvNotifications;
private TextView tvSupport;
private ImageButton ibHintSupport;
private ImageButton ibHintSwipe;
@ -280,6 +282,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
private BottomNavigationView bottom_navigation;
private ContentLoadingProgressBar pbWait;
private Group grpAirplane;
private Group grpNotifications;
private Group grpSupport;
private Group grpHintSupport;
private Group grpHintSwipe;
@ -537,6 +540,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
// Get controls
swipeRefresh = view.findViewById(R.id.swipeRefresh);
tvAirplane = view.findViewById(R.id.tvAirplane);
tvNotifications = view.findViewById(R.id.tvNotifications);
tvSupport = view.findViewById(R.id.tvSupport);
ibHintSupport = view.findViewById(R.id.ibHintSupport);
ibHintSwipe = view.findViewById(R.id.ibHintSwipe);
@ -560,6 +564,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
pbWait = view.findViewById(R.id.pbWait);
grpAirplane = view.findViewById(R.id.grpAirplane);
grpNotifications = view.findViewById(R.id.grpNotifications);
grpSupport = view.findViewById(R.id.grpSupport);
grpHintSupport = view.findViewById(R.id.grpHintSupport);
grpHintSwipe = view.findViewById(R.id.grpHintSwipe);
@ -615,6 +620,15 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
}
});
tvNotifications.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
v.getContext().startActivity(
new Intent(v.getContext(), ActivitySetup.class)
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK));
}
});
grpSupport.setVisibility(View.GONE);
tvSupport.setOnClickListener(new View.OnClickListener() {
@Override
@ -1617,6 +1631,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
// Initialize
FragmentDialogTheme.setBackground(getContext(), view, false);
grpAirplane.setVisibility(View.GONE);
grpNotifications.setVisibility(View.GONE);
tvNoEmail.setVisibility(View.GONE);
tvNoEmailHint.setVisibility(View.GONE);
etSearch.setVisibility(View.GONE);
@ -4469,6 +4484,11 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
updateAirplaneMode(ConnectionHelper.airplaneMode(getContext()));
getContext().registerReceiver(airplanemode, new IntentFilter(Intent.ACTION_AIRPLANE_MODE_CHANGED));
boolean canNotify =
(Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU ||
hasPermission(Manifest.permission.POST_NOTIFICATIONS));
grpNotifications.setVisibility(canNotify ? View.GONE : View.VISIBLE);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
boolean compact = prefs.getBoolean("compact", false);
int zoom = prefs.getInt("view_zoom", compact ? 0 : 1);

View File

@ -0,0 +1,15 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M8,17h8v-0.24L8.34,9.1C8.12,9.68 8,10.32 8,11v6zM12,6.5c-0.19,0 -0.37,0.03 -0.55,0.06L16,11.1L16,11c0,-2.48 -1.51,-4.5 -4,-4.5z"
android:strokeAlpha="0.3"
android:fillAlpha="0.3"/>
<path
android:fillColor="@android:color/white"
android:pathData="M12,22c1.1,0 2,-0.9 2,-2h-4c0,1.1 0.9,2 2,2zM12,6.5c2.49,0 4,2.02 4,4.5v0.1l2,2L18,11c0,-3.07 -1.63,-5.64 -4.5,-6.32L13.5,4c0,-0.83 -0.67,-1.5 -1.5,-1.5s-1.5,0.67 -1.5,1.5v0.68c-0.24,0.06 -0.47,0.15 -0.69,0.23l1.64,1.64c0.18,-0.02 0.36,-0.05 0.55,-0.05zM5.41,3.35L4,4.76l2.81,2.81C6.29,8.57 6,9.74 6,11v5l-2,2v1h14.24l1.74,1.74 1.41,-1.41L5.41,3.35zM16,17L8,17v-6c0,-0.68 0.12,-1.32 0.34,-1.9L16,16.76L16,17z"/>
</vector>

View File

@ -21,6 +21,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:background="?android:attr/selectableItemBackground"
android:drawableStart="@drawable/twotone_flight_24"
android:drawablePadding="6dp"
android:drawableTint="?android:attr/textColorPrimary"
@ -40,6 +41,31 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvAirplane" />
<TextView
android:id="@+id/tvNotifications"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:background="?android:attr/selectableItemBackground"
android:drawableStart="@drawable/twotone_notifications_off_24"
android:drawablePadding="6dp"
android:drawableTint="?android:attr/textColorPrimary"
android:padding="6dp"
android:text="@string/title_hint_notification"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textColor="?android:attr/textColorPrimary"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/vSeparatorAirplane" />
<View
android:id="@+id/vSeparatorNotifications"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/colorSeparator"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvNotifications" />
<TextView
android:id="@+id/tvSupport"
android:layout_width="wrap_content"
@ -50,7 +76,7 @@
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/vSeparatorAirplane" />
app:layout_constraintTop_toBottomOf="@+id/vSeparatorNotifications" />
<View
android:id="@+id/vSeparatorSupport"
@ -430,6 +456,12 @@
android:layout_height="0dp"
app:constraint_referenced_ids="tvAirplane,vSeparatorAirplane" />
<androidx.constraintlayout.widget.Group
android:id="@+id/grpNotifications"
android:layout_width="0dp"
android:layout_height="0dp"
app:constraint_referenced_ids="tvNotifications,vSeparatorNotifications" />
<androidx.constraintlayout.widget.Group
android:id="@+id/grpSupport"
android:layout_width="0dp"

View File

@ -1826,6 +1826,7 @@
<string name="title_hint_folder_actions">Long press a folder for options, like adding a folder to the navigation menu for quick access</string>
<string name="title_hint_folder_sync">To limit battery and network usage not all folders and not all messages will be synchronized by default</string>
<string name="title_hint_airplane">Airplane mode is on</string>
<string name="title_hint_notification">Notifications are disabled</string>
<string name="title_hint_support">If you have a question or a problem, please use the support menu to get help</string>
<string name="title_hint_message_actions">Swipe left to trash; Swipe right to archive (if available); The swipe actions can be configured in the account settings</string>
<string name="title_hint_message_selection">Long press a message to start selecting multiple messages; Hold and swipe up or down to select more messages</string>