@ -250,6 +250,7 @@ public class FragmentMessages extends FragmentBase
private SwipeRefreshLayoutEx swipeRefresh ;
private TextView tvAirplane ;
private TextView tvNotifications ;
private TextView tvBatteryOptimizations ;
private TextView tvSupport ;
private ImageButton ibHintSupport ;
private ImageButton ibHintSwipe ;
@ -273,6 +274,7 @@ public class FragmentMessages extends FragmentBase
private ContentLoadingProgressBar pbWait ;
private Group grpAirplane ;
private Group grpNotifications ;
private Group grpBatteryOptimizations ;
private Group grpSupport ;
private Group grpHintSupport ;
private Group grpHintSwipe ;
@ -554,6 +556,7 @@ public class FragmentMessages extends FragmentBase
swipeRefresh = view . findViewById ( R . id . swipeRefresh ) ;
tvAirplane = view . findViewById ( R . id . tvAirplane ) ;
tvNotifications = view . findViewById ( R . id . tvNotifications ) ;
tvBatteryOptimizations = view . findViewById ( R . id . tvBatteryOptimizations ) ;
tvSupport = view . findViewById ( R . id . tvSupport ) ;
ibHintSupport = view . findViewById ( R . id . ibHintSupport ) ;
ibHintSwipe = view . findViewById ( R . id . ibHintSwipe ) ;
@ -578,6 +581,7 @@ public class FragmentMessages extends FragmentBase
pbWait = view . findViewById ( R . id . pbWait ) ;
grpAirplane = view . findViewById ( R . id . grpAirplane ) ;
grpNotifications = view . findViewById ( R . id . grpNotifications ) ;
grpBatteryOptimizations = view . findViewById ( R . id . grpBatteryOptimizations ) ;
grpSupport = view . findViewById ( R . id . grpSupport ) ;
grpHintSupport = view . findViewById ( R . id . grpHintSupport ) ;
grpHintSwipe = view . findViewById ( R . id . grpHintSwipe ) ;
@ -644,6 +648,15 @@ public class FragmentMessages extends FragmentBase
}
} ) ;
tvBatteryOptimizations . setOnClickListener ( new View . OnClickListener ( ) {
@Override
public void onClick ( View v ) {
Intent intent = new Intent ( v . getContext ( ) , ActivitySetup . class )
. addFlags ( Intent . FLAG_ACTIVITY_NEW_TASK | Intent . FLAG_ACTIVITY_CLEAR_TASK ) ;
v . getContext ( ) . startActivity ( intent ) ;
}
} ) ;
grpSupport . setVisibility ( View . GONE ) ;
tvSupport . setOnClickListener ( new View . OnClickListener ( ) {
@Override
@ -1847,6 +1860,7 @@ public class FragmentMessages extends FragmentBase
FragmentDialogTheme . setBackground ( getContext ( ) , view , false ) ;
grpAirplane . setVisibility ( View . GONE ) ;
grpNotifications . setVisibility ( View . GONE ) ;
grpBatteryOptimizations . setVisibility ( View . GONE ) ;
tvNoEmail . setVisibility ( View . GONE ) ;
tvNoEmailHint . setVisibility ( View . GONE ) ;
etSearch . setVisibility ( View . GONE ) ;
@ -5039,6 +5053,8 @@ public class FragmentMessages extends FragmentBase
lbm . registerReceiver ( receiver , iff ) ;
final Context context = getContext ( ) ;
SharedPreferences prefs = PreferenceManager . getDefaultSharedPreferences ( context ) ;
ConnectivityManager cm = Helper . getSystemService ( context , ConnectivityManager . class ) ;
NetworkRequest . Builder builder = new NetworkRequest . Builder ( ) ;
builder . addCapability ( NetworkCapabilities . NET_CAPABILITY_INTERNET ) ;
@ -5052,7 +5068,12 @@ public class FragmentMessages extends FragmentBase
hasPermission ( Manifest . permission . POST_NOTIFICATIONS ) ) ;
grpNotifications . setVisibility ( canNotify ? View . GONE : View . VISIBLE ) ;
SharedPreferences prefs = PreferenceManager . getDefaultSharedPreferences ( context ) ;
boolean isIgnoring = ( Build . VERSION . SDK_INT < Build . VERSION_CODES . UPSIDE_DOWN_CAKE | |
Boolean . TRUE . equals ( Helper . isIgnoringOptimizations ( context ) ) ) ;
boolean enabled = prefs . getBoolean ( "enabled" , true ) ;
boolean reminder = prefs . getBoolean ( "setup_reminder" , true ) ;
grpBatteryOptimizations . setVisibility ( ! isIgnoring & & enabled & & reminder ? View . VISIBLE : View . GONE ) ;
boolean compact = prefs . getBoolean ( "compact" , false ) ;
int zoom = prefs . getInt ( "view_zoom" , compact ? 0 : 1 ) ;
adapter . setCompact ( compact ) ;