release V162
authorsnickersun <scy@incartech.cn>
Tue, 13 Oct 2020 04:12:19 +0000 (12:12 +0800)
committersnickersun <scy@incartech.cn>
Tue, 13 Oct 2020 04:12:19 +0000 (12:12 +0800)
主界面添加gps状态图标

app/release/ICL02Launcher_V162_202010131210_release.apk [moved from app/release/ICL02Launcher_V161_202010122014_release.apk with 54% similarity]
app/release/output.json
app/src/main/java/com/ic/launcher/fragment/L02MainFragment.java
app/src/main/java/com/ic/launcher/mode/L02MainModel.java
app/src/main/java/com/ic/launcher/presenter/PhoneStatePresenter.java
app/src/main/java/com/ic/launcher/presenter/QueryPhoneState.java
app/src/main/java/com/ic/launcher/widget/WidgetPhoneStateView.java
app/src/main/res/layout/fragment_l02_main.xml
app/src/main/res/layout/widget_phone_state_layout.xml
app/version_code.properties

similarity index 54%
rename from app/release/ICL02Launcher_V161_202010122014_release.apk
rename to app/release/ICL02Launcher_V162_202010131210_release.apk
index a467a46..2f487f0 100644 (file)
Binary files a/app/release/ICL02Launcher_V161_202010122014_release.apk and b/app/release/ICL02Launcher_V162_202010131210_release.apk differ
index ab4c824..6cbfccc 100644 (file)
@@ -1 +1 @@
-[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":161,"versionName":"202010122014","enabled":true,"outputFile":"ICL02Launcher_V161_202010122014_release.apk","fullName":"release","baseName":"release"},"path":"ICL02Launcher_V161_202010122014_release.apk","properties":{}}]
\ No newline at end of file
+[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":162,"versionName":"202010131210","enabled":true,"outputFile":"ICL02Launcher_V162_202010131210_release.apk","fullName":"release","baseName":"release"},"path":"ICL02Launcher_V162_202010131210_release.apk","properties":{}}]
\ No newline at end of file
index 3145c5a..a4c98a0 100644 (file)
@@ -137,6 +137,11 @@ public class L02MainFragment extends BaseFragment {
                 mainBinding.setWifiStatus(wifiStatus);
             }
         });
+        model.getObservableGpsStatus().observe(this, gpsStatus ->{
+            if(mainBinding !=null){
+                mainBinding.setGpsStatus(gpsStatus);
+            }
+        });
     }
 
     private void observeBatteryValue(L02MainModel model) {
index 98a1d8f..640f9c1 100644 (file)
@@ -162,5 +162,11 @@ public class L02MainModel extends BaseModel {
         }
         return null;
     }
-
+    public LiveData<Boolean> getObservableGpsStatus() {
+        PresenterCycle state = getPresenterList(PHONE_LIST_INDEX);
+        if(state != null){
+            return ((PhoneStatePresenter)state).getGpsStatusObservable();
+        }
+        return null;
+    }
 }
index 0876060..b582ec0 100644 (file)
@@ -20,6 +20,7 @@ public class PhoneStatePresenter extends PresenterCycle {
     private MediatorLiveData<Integer> mObsPhoneSignalID;
     private MediatorLiveData<Boolean> mObsBTStatusID;
     private MediatorLiveData<Boolean> mObsWiFiStatusID;
+    private MediatorLiveData<Boolean> mObsGpsStatusID;
 
     @Override
     public void onPresenterResume() {
@@ -60,7 +61,8 @@ public class PhoneStatePresenter extends PresenterCycle {
         mObsPhoneTransportID = new MediatorLiveData<>();
         mObsBTStatusID = new MediatorLiveData<>();
         mObsWiFiStatusID = new MediatorLiveData<>();
-        queryState = new QueryPhoneState(context,mObsPhoneTypeID,mObsPhoneSignalID,mObsPhoneTransportID,mObsBTStatusID,mObsWiFiStatusID);
+        mObsGpsStatusID = new MediatorLiveData<>();
+        queryState = new QueryPhoneState(context,mObsPhoneTypeID,mObsPhoneSignalID,mObsPhoneTransportID,mObsBTStatusID,mObsWiFiStatusID,mObsGpsStatusID);
     }
 
     public LiveData<Integer> getPhoneTypeObservable() {
@@ -84,4 +86,8 @@ public class PhoneStatePresenter extends PresenterCycle {
         return mObsWiFiStatusID;
     }
 
+    public LiveData<Boolean> getGpsStatusObservable() {
+        return mObsGpsStatusID;
+    }
+
 }
index 5d7ab82..fb54fa4 100644 (file)
@@ -2,8 +2,10 @@ package com.ic.launcher.presenter;
 
 import android.bluetooth.BluetoothAdapter;
 import android.content.Context;
+import android.location.LocationManager;
 import android.net.TrafficStats;
 import android.net.wifi.WifiManager;
+import android.os.Build;
 import android.os.Message;
 import android.telephony.CellIdentityCdma;
 import android.telephony.CellInfo;
@@ -36,12 +38,13 @@ public class QueryPhoneState extends QueryThread {
     private TelephonyManager mTelephony=null;
     private BluetoothAdapter mBtAdapter=null;
     private WifiManager mWiFiManager=null;
-
+    private LocationManager locationManager=null;
     private MediatorLiveData<Integer> mObsPhoneTypeID;
     private MediatorLiveData<Integer> mObsPhoneSignalID;
     private MediatorLiveData<Integer> mObsPhoneTransportID;
     private MediatorLiveData<Boolean> mObsBTStatusID;
     private MediatorLiveData<Boolean> mObsWiFiStatusID;
+    private MediatorLiveData<Boolean> mObsGpsStatusID;
 
     private long receivedWork;
     private long sendNetWork;
@@ -54,15 +57,18 @@ public class QueryPhoneState extends QueryThread {
                            MediatorLiveData<Integer> mObsPhoneSignalID,
                            MediatorLiveData<Integer> mObsPhoneTransportID,
                            MediatorLiveData<Boolean> mObsBTStatusID,
-                           MediatorLiveData<Boolean> mObsWiFiStatusID) {
+                           MediatorLiveData<Boolean> mObsWiFiStatusID,
+                           MediatorLiveData<Boolean> mObsGpsStatusID) {
         this.mTelephony = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
         this.mWiFiManager = (WifiManager)context.getSystemService(Context.WIFI_SERVICE);
         this.mBtAdapter = BluetoothAdapter.getDefaultAdapter();
+        this.locationManager = (LocationManager)context.getSystemService(Context.LOCATION_SERVICE);
         this.mObsPhoneTypeID = mObsPhoneTypeID;
         this.mObsPhoneSignalID = mObsPhoneSignalID;
         this.mObsPhoneTransportID = mObsPhoneTransportID;
         this.mObsBTStatusID = mObsBTStatusID;
         this.mObsWiFiStatusID = mObsWiFiStatusID;
+        this.mObsGpsStatusID = mObsGpsStatusID;
     }
 
     public void destroyPhoneState() {
@@ -72,6 +78,7 @@ public class QueryPhoneState extends QueryThread {
         mObsPhoneTransportID = null;
         mObsWiFiStatusID = null;
         mObsBTStatusID = null;
+        mObsGpsStatusID = null;
     }
 
     @Override
@@ -134,6 +141,17 @@ public class QueryPhoneState extends QueryThread {
             }
         }
 
+        if(locationManager!=null) {
+            // 通过GPS卫星定位,定位级别可以精确到街(通过24颗卫星定位,在室外和空旷的地方定位准确、速度快)
+            boolean gps = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
+            // 通过WLAN或移动网络(3G/2G)确定的位置(也称作AGPS,辅助GPS定位。主要用于在室内或遮盖物(建筑群或茂密的深林等)密集的地方定位)
+//            boolean network = locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER);
+            if (gps) {
+                mObsGpsStatusID.postValue(true);
+            } else {
+                mObsGpsStatusID.postValue(false);
+            }
+        }
         return true;
     }
     private boolean querySimCardState() {
index 8223dee..7f74617 100644 (file)
@@ -21,7 +21,7 @@ public class WidgetPhoneStateView extends LinearLayout {
     private ImageView transportIv;
     private ImageView BTIV;
     private ImageView WiFiIv;
-
+    private ImageView GPSIv;
     public WidgetPhoneStateView(Context context) {
         this(context, null);
     }
@@ -42,6 +42,7 @@ public class WidgetPhoneStateView extends LinearLayout {
         transportIv = view.findViewById(R.id.transport_iv);
         BTIV = view.findViewById(R.id.status_bt);
         WiFiIv = view.findViewById(R.id.status_wifi);
+        GPSIv = view.findViewById(R.id.status_gps);
     }
 
     public void updateSinalDrawable(int signal) {
@@ -84,9 +85,15 @@ public class WidgetPhoneStateView extends LinearLayout {
         }
 
     }
-
-    @BindingAdapter(value = {"signalDrawable", "netTypeDrawable", "transportDrawable", "phoneShow","btenabled","wifienabled"}, requireAll = false)
-    public static void updatePhoneState(WidgetPhoneStateView view, int signal, int netType, int transport,boolean isShow,boolean btenabled,boolean wifienabled) {
+    public void updateGpsDrawable(boolean visable){
+        GPSIv.setImageResource(R.mipmap.qs_locate_type_gps);
+        if(visable)
+            GPSIv.setVisibility(VISIBLE);
+        else
+            GPSIv.setVisibility(GONE);
+    }
+    @BindingAdapter(value = {"signalDrawable", "netTypeDrawable", "transportDrawable", "phoneShow","btenabled","wifienabled","gpsenabled"}, requireAll = false)
+    public static void updatePhoneState(WidgetPhoneStateView view, int signal, int netType, int transport,boolean isShow,boolean btenabled,boolean wifienabled,boolean gpsenabled) {
         if (view != null) {
             view.updateSinalDrawable(signal);
             view.updateNetTypeDrawable(netType);
@@ -95,6 +102,7 @@ public class WidgetPhoneStateView extends LinearLayout {
             view.updatePhoneVisibility(isShow);
             view.updateBTDrawable(btenabled);
             view.updateWiFiDrawable(wifienabled);
+            view.updateGpsDrawable(gpsenabled);
         }
     }
 }
index 5a31933..90c2049 100644 (file)
@@ -73,6 +73,9 @@
         <variable
             name="wifiStatus"
             type="boolean" />
+        <variable
+            name="gpsStatus"
+            type="boolean" />
         <variable
             name="showTemp"
             type="int" />
                 app:transportDrawable="@{phoneTransport}"
                 app:phoneShow="@{phoneShow}"
                 app:btenabled="@{btStatus}"
-                app:wifienabled="@{wifiStatus}"/>
+                app:wifienabled="@{wifiStatus}"
+                app:gpsenabled="@{gpsStatus}"/>
 
             <com.ic.launcher.widget.WidgetBatteryStateView
                 android:layout_width="wrap_content"
index 4393cff..1754947 100644 (file)
         android:layout_height="wrap_content"
         android:layout_marginTop="5dp"
         android:layout_marginStart="2dp"/>
+    <ImageView
+        android:id="@+id/status_gps"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="5dp"
+        android:layout_marginStart="2dp"/>
 </LinearLayout>
index 6b507e5..5fec089 100644 (file)
@@ -1,2 +1,2 @@
-#Mon Oct 12 20:14:23 CST 2020\r
-VERSION_CODE=161\r
+#Tue Oct 13 12:10:25 CST 2020\r
+VERSION_CODE=162\r