fixed status bar signal view issues.
authorTrillGates <williamtrillgates@gmail.com>
Mon, 28 Jun 2021 11:42:57 +0000 (19:42 +0800)
committerTrillGates <williamtrillgates@gmail.com>
Mon, 28 Jun 2021 11:42:57 +0000 (19:42 +0800)
app/release/ICLoopPageLauncher_V16_202106281530_release.apk [moved from app/release/ICLoopPageLauncher_V15_202106281146_release.apk with 53% similarity]
app/release/output-metadata.json
app/src/main/java/com/ic/launcher/MainActivity.java
app/src/main/java/com/ic/launcher/presenter/MainPagePresenter.java
app/src/main/java/com/ic/launcher/view/SignalView.java
app/src/main/res/layout/item_status_bar.xml
app/src/main/res/values-ja/strings.xml [moved from app/src/main/res/values-ja-rJP/strings.xml with 100% similarity]
app/version_code.properties

similarity index 53%
rename from app/release/ICLoopPageLauncher_V15_202106281146_release.apk
rename to app/release/ICLoopPageLauncher_V16_202106281530_release.apk
index cda5f6d..fadbbb0 100644 (file)
Binary files a/app/release/ICLoopPageLauncher_V15_202106281146_release.apk and b/app/release/ICLoopPageLauncher_V16_202106281530_release.apk differ
index 4580aae..66551fa 100644 (file)
@@ -12,7 +12,7 @@
       "filters": [],
       "versionCode": 1,
       "versionName": "1.0",
-      "outputFile": "ICLoopPageLauncher_V15_202106281146_release.apk"
+      "outputFile": "ICLoopPageLauncher_V16_202106281530_release.apk"
     }
   ]
 }
\ No newline at end of file
index 0606839..8aaf5e9 100644 (file)
@@ -13,6 +13,7 @@ import androidx.viewpager2.widget.ViewPager2;
 import com.ic.iclooger.ICLogger;
 import com.ic.launcher.adapter.MainPageAdapter;
 import com.ic.launcher.presenter.LauncherPresenter;
+import com.ic.launcher.presenter.MainPagePresenter;
 import com.ic.launcher.view.SimpleStatusBarView;
 import com.ic.launcher.view.StatusBarView;
 
@@ -93,7 +94,7 @@ public class MainActivity extends AppCompatActivity {
             if (mainPagePresenter != null) {
                 mainPagePresenter.initAppList();
                 //更新星期列表
-                //TODO:
+                MainPagePresenter.getInstance(MainActivity.this).updateTime(null);
             }
         }
     }
index 888aa16..ccfc448 100644 (file)
@@ -96,7 +96,7 @@ public class MainPagePresenter extends BasePresenter {
         mContext.registerReceiver(mIntentReceiver, filter);
     }
 
-    private void updateTime(String timeZoom) {
+    public void updateTime(String timeZoom) {
         LocalDateTime currDateTime;
         if (!TextUtils.isEmpty(timeZoom)) {
             ZoneId zone = ZoneId.of(timeZoom).getRules().getOffset(Instant.now());
index 45f2d24..50f5f68 100644 (file)
@@ -14,10 +14,16 @@ import android.view.View;
 
 import androidx.annotation.Nullable;
 
-import com.ic.iclooger.ICLogger;
 import com.ic.launcher.R;
 
 
+/**
+ * 对外只暴露三个方法:
+ * 是否有sim卡
+ * 更新状态,内容为无sim卡
+ * 设置信号级别
+ * 网路数据类型
+ */
 public class SignalView extends View {
 
     private Bitmap defaultSignalPic;
@@ -54,7 +60,6 @@ public class SignalView extends View {
         defaultSignalPic = BitmapFactory.decodeResource(getResources(), R.mipmap.top_signal_0, options);
         targetHeight = defaultSignalPic.getHeight();
         width = defaultSignalPic.getWidth();
-        retestSize();
         //绘制图片的画笔
         picPaint = new Paint();
         picPaint.setFlags(Paint.ANTI_ALIAS_FLAG);
@@ -62,21 +67,25 @@ public class SignalView extends View {
     }
 
     private void retestSize() {
-        ICLogger.d("showText ==>  " + showText);
+        //ICLogger.d("showText ==>  " + showText);
         //不同size
-        if (noSimCard || showText.equals(getContext().getString(R.string.no_sim_service))) {
+        boolean justText = showText.equals(getContext().getString(R.string.no_sim_car)) || showText.equals
+                (getContext().getString(R.string.no_sim_service));
+        if (justText) {
             textPaint.setTextSize(no_sim_card_size);
         } else {
             textPaint.setTextSize(type_size);
         }
         textWidth = textPaint.measureText(showText);
         //如果没有信号的时候,宽度则为文字的宽度
-        if (noSimCard) {
+        if (justText) {
             totalWidth = (int) textWidth;
         } else {
+            //图片宽度
             totalWidth = width;
         }
         //ICLogger.d("textWidth == > " + textWidth + " totalWidth == > " + totalWidth);
+        requestLayout();
     }
 
     private final int[] picsResArray = new int[5];
@@ -109,33 +118,30 @@ public class SignalView extends View {
         }
         if (!showText.equals(text)) {
             showText = text;
-            retestSize();
-            invalidate();
         }
+        retestSize();
+        invalidate();
     }
 
     public void updateLev(int lev) {
-        //如果没有sim卡返回
-        if (this.noSimCard) {
-            return;
-        }
-        this.lastLev = lev;
-        ICLogger.d("update level..." + lev);
+        //ICLogger.d("update level..." + lev);
         if (lev < 0 || lev > 5 || noSimCard) {
             return;
         }
+        this.lastLev = lev;
         //根据信号去显示对应的图标
         //把lev转成Index
         currentPic = picsResArray[lev - 1];
         updateBitMap();
+        retestSize();
         invalidate();
     }
 
     @Override
     protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
-        ICLogger.d("onMeasure...");
+        //ICLogger.d("onMeasure..." + totalWidth);
         int size = MeasureSpec.getSize(heightMeasureSpec);
-        setMeasuredDimension(totalWidth, noSimCard ? size : targetHeight);
+        setMeasuredDimension(totalWidth, size);
     }
 
     private PaintFlagsDrawFilter mPaintFlagsFilter = new PaintFlagsDrawFilter(0,
@@ -146,7 +152,6 @@ public class SignalView extends View {
     public static final float type_size = 12.0f;
     public static final float no_sim_card_size = 16.0f;
 
-
     @Override
     protected void onDraw(Canvas canvas) {
         if (bitmap == null) {
@@ -185,8 +190,8 @@ public class SignalView extends View {
             this.currentPic = R.mipmap.top_no_sim_card;
             //清空文字
             this.showText = getContext().getString(R.string.no_sim_car);
-            retestSize();
             updateBitMap();
+            retestSize();
             invalidate();
         } else {
             this.noSimCard = false;
index df468ce..8c516ee 100644 (file)
@@ -11,7 +11,6 @@
         android:layout_height="match_parent"
         android:layout_alignParentLeft="true" />
 
-
     <com.ic.launcher.view.MarqueeView
         android:id="@+id/mar_queue_view"
         android:layout_width="match_parent"
index 8994805..a6e20cb 100644 (file)
@@ -1,2 +1,2 @@
-#Mon Jun 28 11:46:21 CST 2021
-VERSION_CODE=15
+#Mon Jun 28 15:30:41 CST 2021
+VERSION_CODE=16