更新 library 改为 com.ic.xxx [虽然暂时并不用]
authorSnickerSun <scy@incartech.cn>
Mon, 16 Aug 2021 02:59:09 +0000 (10:59 +0800)
committerSnickerSun <scy@incartech.cn>
Mon, 16 Aug 2021 02:59:09 +0000 (10:59 +0800)
library/src/main/AndroidManifest.xml
library/src/main/java/com/ic/watch_lib/LauncherCtrl.java [moved from library/src/main/java/com/eiot/watch_lib/LauncherCtrl.java with 96% similarity]

index 85a5bf8..71e78e4 100644 (file)
@@ -1,5 +1,5 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"\r
-          package="com.eiot.watch_lib"\r
+          package="com.ic.watch_lib"\r
           android:versionCode="1"\r
           android:versionName="1.0">\r
 \r
-package com.eiot.watch_lib;\r
-\r
-import android.content.ContentResolver;\r
-import android.content.ContentValues;\r
-import android.content.Context;\r
-import android.database.Cursor;\r
-import android.net.Uri;\r
-import android.text.TextUtils;\r
-import android.util.Log;\r
-\r
-public class LauncherCtrl {\r
-    private static final String TAG = "LauncherCtrl";\r
-    private static final boolean DEBUG = false;//BuildConfig.DEBUG;\r
-\r
-    private static final String AUTHORITY = "com.ic.db.watchProvider";\r
-    private static final String STATUS_BAR_TABLE = "status_bar";\r
-    public static final Uri AUTHORITY_URI = Uri.parse("content://" + AUTHORITY);\r
-    public static final Uri STATUS_BAR_URI = Uri.withAppendedPath(AUTHORITY_URI, STATUS_BAR_TABLE);\r
-\r
-    /// 来自 FragmentQuickSettings @{\r
-    // 状态栏图标名称, 根据此名称控制状态栏图标是否显示\r
-//    public static final String STATUS_BAR_SIGNAL = "signal";\r
-//    public static final String STATUS_BAR_BATTERY = "battery";\r
-//    public static final String STATUS_BAR_SIM_OPERATOR_NAME = "sim_operator_name";\r
-    public static final String STATUS_BAR_LOCATE_TYPE = "locate_type";\r
-    //    public static final String STATUS_BAR_SMS = "sms";\r
-    public static final String STATUS_BAR_SERVER_CONNECTED = "server_connected";\r
-    //    public static final String STATUS_BAR_SOUND_MODE = "sound_mode";\r
-//    public static final String STATUS_BAR_LOCKER = "locker";\r
-//    public static final String STATUS_BAR_ALARM_CLOCK = "alarm_clock";\r
-\r
-    // 状态栏,普通图标状态值,只表示隐藏或显示\r
-    public static final int STATUS_BAR_STATE_HIDE = 0;\r
-    public static final int STATUS_BAR_STATE_SHOW = 1;\r
-\r
-    // 状态栏,"定位类型"图标状态值\r
-    public static final int STATUS_BAR_STATE_LOCATE_TYPE_GPS = 1;\r
-    public static final int STATUS_BAR_STATE_LOCATE_TYPE_LBS = 2;\r
-    public static final int STATUS_BAR_STATE_LOCATE_TYPE_WIFI = 3;\r
-\r
-    // 状态栏,"服务器连接状态"图标状态值\r
-    public static final int STATUS_BAR_STATE_SERVER_CONNECTED_OFF = 1;\r
-    public static final int STATUS_BAR_STATE_SERVER_CONNECTED_ON = 2;\r
-    /// @}\r
-\r
-\r
-    private static LauncherCtrl instance;\r
-    private static Context mContext;\r
-\r
-\r
-\r
-\r
-    private static void log(String funcName, String msg) {\r
-        if (DEBUG) {\r
-            Log.i(TAG, "[" + funcName + "]" + msg);\r
-        }\r
-    }\r
-\r
-    private static void log(String funcName) {\r
-        if (DEBUG) {\r
-            Log.i(TAG, "[" + funcName + "]");\r
-        }\r
-    }\r
-\r
-    private LauncherCtrl(Context context) {\r
-        mContext = context;\r
-    }\r
-\r
-    public synchronized static LauncherCtrl getInstance(Context context) {\r
-        if (instance == null) {\r
-            instance = new LauncherCtrl(context);\r
-        }\r
-        return instance;\r
-    }\r
-\r
-    public void setStatusBarIcon(String name, int state) {\r
-        ContentResolver contentResolver = mContext.getContentResolver();\r
-        Uri uri = Uri.withAppendedPath(STATUS_BAR_URI, "update");\r
-\r
-//        Log.i(TAG, "setStatusBarIcon: " + uri.toString());\r
-\r
-        if (!TextUtils.isEmpty(name)) {\r
-            ContentValues values = new ContentValues();\r
-            values.put("name", name);\r
-            values.put("state", state);\r
-\r
-            String where = "name=?";\r
-            String[] args = new String[]{name};\r
-            contentResolver.update(uri, values, where, args);\r
-        }\r
-\r
-        Log.i(TAG, name + " icon set state: " + state);\r
-    }\r
-\r
-\r
-    public int getStatusBarIconState(String whereName) {\r
-        int retValue = 0;\r
-        ContentResolver contentResolver = mContext.getContentResolver();\r
-        Uri uri = Uri.withAppendedPath(STATUS_BAR_URI, "query");\r
-\r
-\r
-        String where = null;\r
-        String[] args = null;\r
-        if (whereName != null) {\r
-            where = "name=?";\r
-            args = new String[]{whereName};\r
-        }\r
-\r
-        Cursor cursor = contentResolver.query(uri, new String[]{"id", "name", "state"}, where, args, null);\r
-\r
-        if (cursor != null) {\r
-            if (cursor.moveToNext()) {\r
-                int id = cursor.getInt(0);\r
-                String name = cursor.getString(1);\r
-                retValue = cursor.getShort(2);\r
-//                Log.i(TAG, "statusBarIconIsVisible, id:" + id + ", name:" + name + ", state:" + state);\r
-            }\r
-            cursor.close();\r
-        }\r
-\r
-        Log.i(TAG, whereName + " icon state: " + retValue);\r
-\r
-        return retValue;\r
-    }\r
-\r
-}\r
+package com.ic.watch_lib;
+
+import android.content.ContentResolver;
+import android.content.ContentValues;
+import android.content.Context;
+import android.database.Cursor;
+import android.net.Uri;
+import android.text.TextUtils;
+import android.util.Log;
+
+public class LauncherCtrl {
+    private static final String TAG = "LauncherCtrl";
+    private static final boolean DEBUG = false;//BuildConfig.DEBUG;
+
+    private static final String AUTHORITY = "com.ic.db.watchProvider";
+    private static final String STATUS_BAR_TABLE = "status_bar";
+    public static final Uri AUTHORITY_URI = Uri.parse("content://" + AUTHORITY);
+    public static final Uri STATUS_BAR_URI = Uri.withAppendedPath(AUTHORITY_URI, STATUS_BAR_TABLE);
+
+    /// 来自 FragmentQuickSettings @{
+    // 状态栏图标名称, 根据此名称控制状态栏图标是否显示
+//    public static final String STATUS_BAR_SIGNAL = "signal";
+//    public static final String STATUS_BAR_BATTERY = "battery";
+//    public static final String STATUS_BAR_SIM_OPERATOR_NAME = "sim_operator_name";
+    public static final String STATUS_BAR_LOCATE_TYPE = "locate_type";
+    //    public static final String STATUS_BAR_SMS = "sms";
+    public static final String STATUS_BAR_SERVER_CONNECTED = "server_connected";
+    //    public static final String STATUS_BAR_SOUND_MODE = "sound_mode";
+//    public static final String STATUS_BAR_LOCKER = "locker";
+//    public static final String STATUS_BAR_ALARM_CLOCK = "alarm_clock";
+
+    // 状态栏,普通图标状态值,只表示隐藏或显示
+    public static final int STATUS_BAR_STATE_HIDE = 0;
+    public static final int STATUS_BAR_STATE_SHOW = 1;
+
+    // 状态栏,"定位类型"图标状态值
+    public static final int STATUS_BAR_STATE_LOCATE_TYPE_GPS = 1;
+    public static final int STATUS_BAR_STATE_LOCATE_TYPE_LBS = 2;
+    public static final int STATUS_BAR_STATE_LOCATE_TYPE_WIFI = 3;
+
+    // 状态栏,"服务器连接状态"图标状态值
+    public static final int STATUS_BAR_STATE_SERVER_CONNECTED_OFF = 1;
+    public static final int STATUS_BAR_STATE_SERVER_CONNECTED_ON = 2;
+    /// @}
+
+
+    private static LauncherCtrl instance;
+    private static Context mContext;
+
+
+
+
+    private static void log(String funcName, String msg) {
+        if (DEBUG) {
+            Log.i(TAG, "[" + funcName + "]" + msg);
+        }
+    }
+
+    private static void log(String funcName) {
+        if (DEBUG) {
+            Log.i(TAG, "[" + funcName + "]");
+        }
+    }
+
+    private LauncherCtrl(Context context) {
+        mContext = context;
+    }
+
+    public synchronized static LauncherCtrl getInstance(Context context) {
+        if (instance == null) {
+            instance = new LauncherCtrl(context);
+        }
+        return instance;
+    }
+
+    public void setStatusBarIcon(String name, int state) {
+        ContentResolver contentResolver = mContext.getContentResolver();
+        Uri uri = Uri.withAppendedPath(STATUS_BAR_URI, "update");
+
+//        Log.i(TAG, "setStatusBarIcon: " + uri.toString());
+
+        if (!TextUtils.isEmpty(name)) {
+            ContentValues values = new ContentValues();
+            values.put("name", name);
+            values.put("state", state);
+
+            String where = "name=?";
+            String[] args = new String[]{name};
+            contentResolver.update(uri, values, where, args);
+        }
+
+        Log.i(TAG, name + " icon set state: " + state);
+    }
+
+
+    public int getStatusBarIconState(String whereName) {
+        int retValue = 0;
+        ContentResolver contentResolver = mContext.getContentResolver();
+        Uri uri = Uri.withAppendedPath(STATUS_BAR_URI, "query");
+
+
+        String where = null;
+        String[] args = null;
+        if (whereName != null) {
+            where = "name=?";
+            args = new String[]{whereName};
+        }
+
+        Cursor cursor = contentResolver.query(uri, new String[]{"id", "name", "state"}, where, args, null);
+
+        if (cursor != null) {
+            if (cursor.moveToNext()) {
+                int id = cursor.getInt(0);
+                String name = cursor.getString(1);
+                retValue = cursor.getShort(2);
+//                Log.i(TAG, "statusBarIconIsVisible, id:" + id + ", name:" + name + ", state:" + state);
+            }
+            cursor.close();
+        }
+
+        Log.i(TAG, whereName + " icon state: " + retValue);
+
+        return retValue;
+    }
+
+}