diff --git a/src/org/kde/kdeconnect/Plugins/NotificationsPlugin/AppDatabase.java b/src/org/kde/kdeconnect/Plugins/NotificationsPlugin/AppDatabase.java --- a/src/org/kde/kdeconnect/Plugins/NotificationsPlugin/AppDatabase.java +++ b/src/org/kde/kdeconnect/Plugins/NotificationsPlugin/AppDatabase.java @@ -28,33 +28,33 @@ import java.util.HashSet; -public class AppDatabase { +class AppDatabase { static final private HashSet disabledByDefault = new HashSet<>(); static { disabledByDefault.add("com.android.messaging"); //We already have sms notifications in the telephony plugin disabledByDefault.add("com.google.android.googlequicksearchbox"); //Google Now notifications re-spawn every few minutes } - static final String KEY_PACKAGE_NAME = "packageName"; - static final String KEY_IS_ENABLED = "isEnabled"; + private static final String KEY_PACKAGE_NAME = "packageName"; + private static final String KEY_IS_ENABLED = "isEnabled"; - static final String DATABASE_NAME = "Applications"; - static final String DATABASE_TABLE = "Applications"; - static final int DATABASE_VERSION = 2; + private static final String DATABASE_NAME = "Applications"; + private static final String DATABASE_TABLE = "Applications"; + private static final int DATABASE_VERSION = 2; - final Context ourContext; - SQLiteDatabase ourDatabase; - DbHelper ourHelper; + private final Context ourContext; + private SQLiteDatabase ourDatabase; + private DbHelper ourHelper; - public AppDatabase(Context c) { + AppDatabase(Context c) { ourContext = c; } private static class DbHelper extends SQLiteOpenHelper { - public DbHelper(Context context) { + DbHelper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); } @@ -80,7 +80,7 @@ ourHelper.close(); } - public void setEnabled(String packageName, boolean isEnabled) { + void setEnabled(String packageName, boolean isEnabled) { String[] columns = new String[]{KEY_IS_ENABLED}; Cursor res = ourDatabase.query(DATABASE_TABLE, columns, KEY_PACKAGE_NAME + " =? ", new String[]{packageName}, null, null, null); @@ -95,7 +95,7 @@ res.close(); } - public boolean isEnabled(String packageName) { + boolean isEnabled(String packageName) { String[] columns = new String[]{KEY_IS_ENABLED}; Cursor res = ourDatabase.query(DATABASE_TABLE, columns, KEY_PACKAGE_NAME + " =? ", new String[]{packageName}, null, null, null); boolean result; diff --git a/src/org/kde/kdeconnect/Plugins/NotificationsPlugin/NotificationFilterActivity.java b/src/org/kde/kdeconnect/Plugins/NotificationsPlugin/NotificationFilterActivity.java --- a/src/org/kde/kdeconnect/Plugins/NotificationsPlugin/NotificationFilterActivity.java +++ b/src/org/kde/kdeconnect/Plugins/NotificationsPlugin/NotificationFilterActivity.java @@ -47,16 +47,16 @@ public class NotificationFilterActivity extends AppCompatActivity { - AppDatabase appDatabase; + private AppDatabase appDatabase; static class AppListInfo { String pkg; String name; Drawable icon; boolean isEnabled; } - AppListInfo[] apps; + private AppListInfo[] apps; class AppListAdapter extends BaseAdapter { @@ -134,7 +134,7 @@ } - void displayAppList() { + private void displayAppList() { final ListView listView = (ListView) findViewById(R.id.lvFilterApps); AppListAdapter adapter = new AppListAdapter(); @@ -172,7 +172,7 @@ BackgroundService.removeGuiInUseCounter(this); } - Drawable resizeIcon(Drawable icon, int maxSize) { + private Drawable resizeIcon(Drawable icon, int maxSize) { Resources res = getResources(); //Convert to display pixels diff --git a/src/org/kde/kdeconnect/Plugins/NotificationsPlugin/NotificationsPlugin.java b/src/org/kde/kdeconnect/Plugins/NotificationsPlugin/NotificationsPlugin.java --- a/src/org/kde/kdeconnect/Plugins/NotificationsPlugin/NotificationsPlugin.java +++ b/src/org/kde/kdeconnect/Plugins/NotificationsPlugin/NotificationsPlugin.java @@ -53,9 +53,9 @@ @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2) public class NotificationsPlugin extends Plugin implements NotificationReceiver.NotificationListener { - public final static String PACKAGE_TYPE_NOTIFICATION = "kdeconnect.notification"; - public final static String PACKAGE_TYPE_NOTIFICATION_REQUEST = "kdeconnect.notification.request"; - public final static String PACKAGE_TYPE_NOTIFICATION_REPLY = "kdeconnect.notification.reply"; + private final static String PACKAGE_TYPE_NOTIFICATION = "kdeconnect.notification"; + private final static String PACKAGE_TYPE_NOTIFICATION_REQUEST = "kdeconnect.notification.request"; + private final static String PACKAGE_TYPE_NOTIFICATION_REPLY = "kdeconnect.notification.reply"; private Map pendingIntents; @@ -145,7 +145,7 @@ sendNotification(statusBarNotification, false); } - public void sendNotification(StatusBarNotification statusBarNotification, boolean requestAnswer) { + private void sendNotification(StatusBarNotification statusBarNotification, boolean requestAnswer) { Notification notification = statusBarNotification.getNotification(); AppDatabase appDatabase = new AppDatabase(context); @@ -233,7 +233,7 @@ } @RequiresApi(api = Build.VERSION_CODES.KITKAT_WATCH) - void replyToNotification(String id, String message) { + private void replyToNotification(String id, String message) { if (pendingIntents.isEmpty() || !pendingIntents.containsKey(id)) { Log.e("NotificationsPlugin", "No such notification"); return; @@ -493,7 +493,7 @@ } //For compat with API<21, because lollipop changed the way to cancel notifications - public static void cancelNotificationCompat(NotificationReceiver service, String compatKey) { + private static void cancelNotificationCompat(NotificationReceiver service, String compatKey) { if (Build.VERSION.SDK_INT >= 21) { service.cancelNotification(compatKey); } else { @@ -517,7 +517,7 @@ } } - public static String getNotificationKeyCompat(StatusBarNotification statusBarNotification) { + private static String getNotificationKeyCompat(StatusBarNotification statusBarNotification) { String result; // first check if it's one of our remoteIds String tag = statusBarNotification.getTag(); @@ -535,7 +535,7 @@ return result; } - public String getChecksum(byte[] data) { + private String getChecksum(byte[] data) { try { MessageDigest md = MessageDigest.getInstance("MD5"); @@ -548,7 +548,7 @@ } - public static String bytesToHex(byte[] bytes) { + private static String bytesToHex(byte[] bytes) { char[] hexArray = "0123456789ABCDEF".toCharArray(); char[] hexChars = new char[bytes.length * 2]; for (int j = 0; j < bytes.length; j++) { diff --git a/src/org/kde/kdeconnect/Plugins/NotificationsPlugin/RepliableNotification.java b/src/org/kde/kdeconnect/Plugins/NotificationsPlugin/RepliableNotification.java --- a/src/org/kde/kdeconnect/Plugins/NotificationsPlugin/RepliableNotification.java +++ b/src/org/kde/kdeconnect/Plugins/NotificationsPlugin/RepliableNotification.java @@ -1,16 +1,14 @@ package org.kde.kdeconnect.Plugins.NotificationsPlugin; -import android.app.Notification; import android.app.PendingIntent; -import android.os.Bundle; import java.util.ArrayList; import java.util.UUID; -public class RepliableNotification { - public String id = UUID.randomUUID().toString(); - public PendingIntent pendingIntent; - public ArrayList remoteInputs = new ArrayList<>(); - public String packageName; - public String tag; +class RepliableNotification { + String id = UUID.randomUUID().toString(); + PendingIntent pendingIntent; + ArrayList remoteInputs = new ArrayList<>(); + String packageName; + String tag; }