Refactoring

This commit is contained in:
M66B
2022-04-13 22:27:33 +02:00
parent 481ca4d2d0
commit ff3f9df450
49 changed files with 129 additions and 152 deletions

View File

@@ -4368,7 +4368,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
iff.addAction(ACTION_KEYWORDS);
lbm.registerReceiver(receiver, iff);
ConnectivityManager cm = (ConnectivityManager) getContext().getSystemService(Context.CONNECTIVITY_SERVICE);
ConnectivityManager cm = Helper.getSystemService(getContext(), ConnectivityManager.class);
NetworkRequest.Builder builder = new NetworkRequest.Builder();
builder.addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET);
cm.registerNetworkCallback(builder.build(), networkCallback);
@@ -4432,7 +4432,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
prefs.unregisterOnSharedPreferenceChangeListener(this);
ConnectivityManager cm = (ConnectivityManager) getContext().getSystemService(Context.CONNECTIVITY_SERVICE);
ConnectivityManager cm = Helper.getSystemService(getContext(), ConnectivityManager.class);
cm.unregisterNetworkCallback(networkCallback);
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(getContext());
@@ -8452,8 +8452,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
ServiceSynchronize.eval(context, "delete");
NotificationManager nm =
(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
NotificationManager nm = Helper.getSystemService(context, NotificationManager.class);
nm.cancel("send:" + id, NotificationHelper.NOTIFICATION_TAGGED);
return null;
@@ -9106,7 +9105,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
return;
}
PrintManager printManager = (PrintManager) context.getSystemService(Context.PRINT_SERVICE);
PrintManager printManager = Helper.getSystemService(context, PrintManager.class);
String jobName = getString(R.string.app_name);
if (!TextUtils.isEmpty(data[0]))
jobName += " - " + data[0];