1.修复息屏在亮屏偶尔充电图标不动。
authorkfl_614 <kfl_614@163.com>
Fri, 10 Apr 2020 08:21:24 +0000 (16:21 +0800)
committerkfl_614 <kfl_614@163.com>
Fri, 10 Apr 2020 08:21:24 +0000 (16:21 +0800)
2.修复低电量充电下退出低电量模式。
3.加大APP列表图片和文字大小。指示器图标改小

Signed-off-by: kfl_614 <kfl_614@163.com>
13 files changed:
app/src/main/java/com/ic/launcher/FragmentManage.java
app/src/main/java/com/ic/launcher/MainActivity.java
app/src/main/java/com/ic/launcher/fragment/AppListFragment.java
app/src/main/java/com/ic/launcher/fragment/L02MainFragment.java
app/src/main/java/com/ic/launcher/fragment/LowPowerModeFragment.java
app/src/main/java/com/ic/launcher/mode/LowPowerModel.java
app/src/main/java/com/ic/launcher/presenter/BatteryPresenter.java
app/src/main/java/com/ic/launcher/widget/WidgetBatteryStateView.java
app/src/main/res/drawable/ic_transparent_circle.xml
app/src/main/res/drawable/ic_white_circle.xml
app/src/main/res/layout/item_app_layout.xml
app/src/main/res/values/strings.xml
app/version_code.properties

index 6698577..8de3867 100644 (file)
@@ -54,6 +54,10 @@ public class FragmentManage {
         addOrShowFragment(finish, fragment);
     }
 
+    Fragment getLowPowerFragment() {
+        return getFragmentList(LOW_FRAGMENT_INDEX);
+    }
+
     void showAppFragment(boolean finish, int flag) {
         Fragment fragment = getFragmentList(APP_FRAGMENT_INDEX);
         if (fragment == null) {
@@ -78,11 +82,16 @@ public class FragmentManage {
     }
 
     boolean onBackFragment(boolean finish) {
-        if (mAddFt.get(0).isVisible()) {
+
+        if(mAddFt.get(LOW_FRAGMENT_INDEX) != null){
             return true;
         }
 
-        if (mAddFt.get(1).isVisible()) {
+        if (mAddFt.get(MAIN_FRAGMENT_INDEX) != null &&  mAddFt.get(MAIN_FRAGMENT_INDEX).isVisible()) {
+            return true;
+        }
+
+        if (mAddFt.get(APP_FRAGMENT_INDEX) != null &&  mAddFt.get(APP_FRAGMENT_INDEX).isVisible()) {
             showCurrMainFragment(finish, 0);
             return true;
         }
@@ -90,7 +99,7 @@ public class FragmentManage {
         return false;
     }
 
-    void gotoLowPowerMode(boolean finish) {
+    void gotoLowPowerMode(boolean finish,String lowBatteryValue) {
 
         Fragment fragment = getFragmentList(LOW_FRAGMENT_INDEX);
 
@@ -99,8 +108,7 @@ public class FragmentManage {
             return;
         }
 
-        fragment = LowPowerModeFragment.newInstance();
-
+        fragment = LowPowerModeFragment.newInstance(lowBatteryValue);
 
         replaceLowFragment(finish, fragment);
     }
@@ -112,6 +120,7 @@ public class FragmentManage {
         if (fragment == null) {
             return;
         }
+        mAddFt.remove(LOW_FRAGMENT_INDEX);
 
         Fragment mainFt = getCurrMainFragment();
 
index d8c431f..f67c1e5 100644 (file)
@@ -1,27 +1,30 @@
 package com.ic.launcher;
 
 import androidx.appcompat.app.AppCompatActivity;
+import androidx.fragment.app.Fragment;
+import androidx.lifecycle.ViewModelProvider;
 
+import android.app.Application;
 import android.content.BroadcastReceiver;
 import android.content.Context;
 import android.content.Intent;
 import android.content.IntentFilter;
 import android.os.Bundle;
+import android.text.TextUtils;
 import android.view.KeyEvent;
 
+import com.ic.launcher.fragment.LowPowerModeFragment;
 import com.ic.launcher.listener.IChangeMainFragmentListener;
-import com.ic.launcher.listener.ILowPowerStateListener;
 import com.ic.launcher.listener.MainClockGestureDetectorImpl;
+import com.ic.launcher.mode.LowPowerModel;
 import com.ic.launcher.util.IcLog;
 import com.ic.launcher.util.ServiceUtil;
 import com.ic.launcher.util.SystemUtils;
 
 
-
 public class MainActivity extends AppCompatActivity implements
         MainClockGestureDetectorImpl.OnClockGestureFlingListener,
-        IChangeMainFragmentListener,
-        ILowPowerStateListener {
+        IChangeMainFragmentListener {
 
     private static final String TAG = "MainActivity";
 
@@ -29,37 +32,41 @@ public class MainActivity extends AppCompatActivity implements
     private boolean isLowPower = false;
 
     private FragmentManage ftManage;
-    private boolean isChangeClock=false;
+
+    private boolean isChangeClock = false;
+    private String lowBatteryValue;
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.activity_main);
-        ftManage = new FragmentManage(this,getSupportFragmentManager());
-        ftManage.showCurrMainFragment(isFinishing(),0);
+        ftManage = new FragmentManage(this, getSupportFragmentManager());
+        ftManage.showCurrMainFragment(isFinishing(), 0);
 
-        ((IcLauncherApplication)getApplication()).getBatteryPresenter().registerBatteryReceiver();
-        ((IcLauncherApplication)getApplication()).getTimeDatePresenter().registerTimeDateReceiver();
+        ((IcLauncherApplication) getApplication()).getBatteryPresenter().registerBatteryReceiver();
+        ((IcLauncherApplication) getApplication()).getTimeDatePresenter().registerTimeDateReceiver();
         registerChangeClockReceiver();
 
+        initLowPowerModel(getApplication());
+
         ServiceUtil.startServiceUtil(getApplicationContext(),
-              "com.ic.action.WORK_SERVICE", getPackageName());
+                "com.ic.action.WORK_SERVICE", getPackageName());
     }
 
     @Override
     protected void onResume() {
         super.onResume();
-        if(isChangeClock){
+        if (isChangeClock) {
             ftManage.changeMainClock(isFinishing());
-            isChangeClock=false;
+            isChangeClock = false;
         }
     }
 
     @Override
     protected void onDestroy() {
         super.onDestroy();
-        ((IcLauncherApplication)getApplication()).getBatteryPresenter().unRegisterBatteryReceiver();
-        ((IcLauncherApplication)getApplication()).getTimeDatePresenter().unRegisterTimeDateReceiver();
+        ((IcLauncherApplication) getApplication()).getBatteryPresenter().unRegisterBatteryReceiver();
+        ((IcLauncherApplication) getApplication()).getTimeDatePresenter().unRegisterTimeDateReceiver();
         unRegisterChangeClockReceiver();
     }
 
@@ -77,16 +84,7 @@ public class MainActivity extends AppCompatActivity implements
 
     @Override
     public void onChangeMain(int direction) {
-        ftManage.showCurrMainFragment(isFinishing(),direction);
-    }
-
-    @Override
-    public void onLowChange(boolean state) {
-        if (state) {
-            ftManage.gotoLowPowerMode(isFinishing());
-        } else {
-            ftManage.quitLowPowerMode(isFinishing());
-        }
+        ftManage.showCurrMainFragment(isFinishing(), direction);
     }
 
     @Override
@@ -117,6 +115,34 @@ public class MainActivity extends AppCompatActivity implements
         }
     }
 
+    private void initLowPowerModel(Application application) {
+        LowPowerModel.Factory factory = new LowPowerModel.Factory(application);
+        LowPowerModel lowPowerModel = new ViewModelProvider(this, factory).get(LowPowerModel.class);
+        onObserveModelValue(lowPowerModel);
+    }
+
+    private void onObserveModelValue(LowPowerModel baseModel) {
+        baseModel.getObservableLowPowerValue().observe(this, this::updateLowPowerValue);
+
+        //退出低电量模式
+        baseModel.getObservableLowPower().observe(this, status -> {
+            IcLog.i(TAG, "getObservableLowPower status:" + status);
+            if (status) {
+                ftManage.gotoLowPowerMode(isFinishing(),lowBatteryValue);
+            } else {
+                ftManage.quitLowPowerMode(isFinishing());
+            }
+        });
+    }
+
+    private void updateLowPowerValue(String value) {
+        Fragment fragment = ftManage.getLowPowerFragment();
+        if (fragment != null) {
+            ((LowPowerModeFragment) fragment).updateLowPowerValue(value);
+        }
+        lowBatteryValue = value;
+    }
+
     private void registerChangeClockReceiver() {
         IntentFilter filter = new IntentFilter();
         filter.addAction("com.ic.action.CHANGE_CLOCK");
@@ -136,7 +162,7 @@ public class MainActivity extends AppCompatActivity implements
         public void onReceive(Context context, Intent intent) {
             String action = intent.getAction();
             if ("com.ic.action.CHANGE_CLOCK".equals(action)) {
-                isChangeClock =true;
+                isChangeClock = true;
             }
         }
     };
index d7048ca..18f3420 100644 (file)
@@ -157,7 +157,7 @@ public class AppListFragment extends Fragment {
         indicatorAdapter = new IndicatorAdapter(state);
         LinearLayoutManager mLayoutManager = new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false);
         indicatorRv.setLayoutManager(mLayoutManager);
-        indicatorRv.addItemDecoration(new SpacesItemDecoration(4));
+        indicatorRv.addItemDecoration(new SpacesItemDecoration(6));
         indicatorRv.setAdapter(indicatorAdapter);
     }
 
index 38dd4a6..03cb64c 100644 (file)
@@ -14,10 +14,8 @@ import android.view.ViewGroup;
 
 import com.ic.launcher.configure.l02.L02Icon;
 import com.ic.launcher.databinding.FragmentL02MainBinding;
-import com.ic.launcher.listener.ILowPowerStateListener;
 import com.ic.launcher.mode.BaseModel;
 import com.ic.launcher.mode.L02MainModel;
-import com.ic.launcher.util.IcLog;
 import com.ic.launcher.util.SPUtils;
 
 
@@ -26,8 +24,7 @@ public class L02MainFragment extends BaseFragment {
     private static final String TAG = "L02MainFragment";
 
     private FragmentL02MainBinding mainBinding;
-
-    private ILowPowerStateListener lowPower;
+    private boolean chargingState;
 
     public static L02MainFragment newInstance() {
         return new L02MainFragment();
@@ -36,10 +33,6 @@ public class L02MainFragment extends BaseFragment {
     @Override
     public void onAttach(@NonNull Context context) {
         super.onAttach(context);
-
-        if (context instanceof ILowPowerStateListener) {
-            lowPower = (ILowPowerStateListener) context;
-        }
     }
 
     @Override
@@ -55,14 +48,6 @@ public class L02MainFragment extends BaseFragment {
         observeBatteryValue(mainModel);
         observeDataTimeValue(mainModel);
         observeHardwareValue(mainModel);
-
-        //进入电量模式
-        baseModel.getObservableLowPower().observe(this,status ->{
-            IcLog.i(TAG,"getObservableLowPower status"+status);
-            if(status){
-                lowPower.onLowChange(true);
-            }
-        });
     }
 
     @Override
@@ -70,12 +55,33 @@ public class L02MainFragment extends BaseFragment {
                              Bundle savedInstanceState) {
         mainBinding = FragmentL02MainBinding.inflate(inflater, container, false);
         mainBinding.setHeartValue(String.valueOf(SPUtils.getBloodHeartSP(mContext)));
+        chargingState=false;
         mainBinding.setStepValue("0");
         //监听事件
         initOnTouchListener(mainBinding.getRoot());
         return mainBinding.getRoot();
     }
 
+    @Override
+    public void onResume() {
+        super.onResume();
+        if(chargingState){
+            if(mainBinding != null){
+                mainBinding.setBatteryCharge(true);
+            }
+        }
+    }
+
+    @Override
+    public void onPause() {
+        super.onPause();
+        if(chargingState){
+            if(mainBinding != null){
+                mainBinding.setBatteryCharge(false);
+            }
+        }
+    }
+
     private void observePhoneValue(L02MainModel model) {
         model.getObservablePhoneType().observe(this, resID ->{
             if(mainBinding != null){
@@ -116,8 +122,11 @@ public class L02MainFragment extends BaseFragment {
         });
 
         model.getObservableBatteryCharging().observe(this, state -> {
-            if(mainBinding != null){
-                mainBinding.setBatteryCharge(state);
+            if(chargingState != state){
+                chargingState =state;
+                if(mainBinding != null){
+                    mainBinding.setBatteryCharge(chargingState);
+                }
             }
         });
     }
index 6acbeea..9e5187b 100644 (file)
@@ -10,20 +10,16 @@ import android.os.Bundle;
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
 import androidx.fragment.app.Fragment;
-import androidx.fragment.app.FragmentActivity;
 import androidx.lifecycle.ViewModelProvider;
 
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
 
-import com.ic.launcher.IcLauncherApplication;
 import com.ic.launcher.configure.l02.L02AppInfo;
 import com.ic.launcher.databinding.FragmentLowPowerModeBinding;
 import com.ic.launcher.entity.AppInfoEntity;
 import com.ic.launcher.listener.ILowPowerCallPhoneListener;
-import com.ic.launcher.listener.ILowPowerStateListener;
-import com.ic.launcher.mode.LowPowerModel;
 import com.ic.launcher.util.IcLog;
 
 /**
@@ -35,41 +31,35 @@ public class LowPowerModeFragment extends Fragment {
 
     private Context mContext;
 
-    private LowPowerModel lowPowerModel;
-
     private FragmentLowPowerModeBinding mPowerModeBinding;
     private String batteryValue;
 
-    private ILowPowerStateListener lowPower;
-
-    public static LowPowerModeFragment newInstance() {
-        return new LowPowerModeFragment();
+    public static LowPowerModeFragment newInstance(String battery) {
+        LowPowerModeFragment fragment = new LowPowerModeFragment();
+        Bundle args = new Bundle();
+        args.putString("battery", battery);
+        fragment.setArguments(args);
+        return fragment;
     }
 
     @Override
     public void onAttach(@NonNull Context context) {
         super.onAttach(context);
-
         mContext = context;
-        if (context instanceof ILowPowerStateListener) {
-            lowPower = (ILowPowerStateListener) context;
-        }
     }
 
     @Override
     public void onCreate(@Nullable Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
-        IcLauncherApplication mApp = (IcLauncherApplication) mContext.getApplicationContext();
-        lowPowerModel = initFragmentModel(mApp);
-        onObserveModelValue(lowPowerModel);
-        lowPowerModel.OnUiCreate();
+        Bundle bundle = getArguments();
+        if (bundle != null) {
+            batteryValue = bundle.getString("battery");
+        }
     }
 
     @Override
     public void onDestroy() {
         super.onDestroy();
-        lowPowerModel.OnUiDestroy();
-        lowPowerModel=null;
     }
 
     @Override
@@ -82,40 +72,23 @@ public class LowPowerModeFragment extends Fragment {
         return mPowerModeBinding.getRoot();
     }
 
-    private LowPowerModel initFragmentModel(Application application){
-        LowPowerModel.Factory factory = new LowPowerModel.Factory(application);
-        return new ViewModelProvider(this, factory).get(LowPowerModel.class);
-    }
-
-    private void onObserveModelValue(LowPowerModel baseModel) {
-        baseModel.getObservableLowPowerValue().observe(this, this::updateLowPowerValue);
-
-        //退出低电量模式
-        baseModel.getObservableLowPower().observe(this,status ->{
-            IcLog.i(TAG,"getObservableLowPower status"+status);
-            if(!status){
-                lowPower.onLowChange(false);
-            }
-        });
-    }
-
-    private void updateLowPowerValue(String value){
-        if(mPowerModeBinding != null){
-            mPowerModeBinding.setLowPowerValue(value);
+    public void updateLowPowerValue(String batteryValue) {
+        if (mPowerModeBinding != null) {
+            mPowerModeBinding.setLowPowerValue(batteryValue);
         }
-        batteryValue= value;
+        this.batteryValue = batteryValue;
     }
 
     private ILowPowerCallPhoneListener callListener = () -> {
         AppInfoEntity entity = L02AppInfo.mL02DefaultAppList.get(1);
-        if(entity != null){
+        if (entity != null) {
             try {
                 Intent intent = new Intent(Intent.ACTION_MAIN);
                 intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                 intent.setComponent(new ComponentName(entity.getPackageName(), entity.getActivityName()));
                 mContext.startActivity(intent);
-            }catch (Exception e){
-                IcLog.e(TAG,"ILowPowerCallPhoneListener",e);
+            } catch (Exception e) {
+                IcLog.e(TAG, "ILowPowerCallPhoneListener", e);
             }
         }
     };
index 6f15e70..db0999a 100644 (file)
@@ -21,18 +21,6 @@ public class LowPowerModel extends AndroidViewModel {
 
     }
 
-    public void OnUiCreate() {
-        if (batteryPresenter != null) {
-            batteryPresenter.onPresenterCreate();
-        }
-    }
-
-    public void OnUiDestroy() {
-        if (batteryPresenter != null) {
-            batteryPresenter.onPresenterDestroy();
-        }
-    }
-
     public LiveData<String> getObservableLowPowerValue() {
         if (batteryPresenter != null) {
             return batteryPresenter.getObsLowPowerValue();
index 9cebfde..c496cfc 100644 (file)
@@ -1,13 +1,16 @@
 package com.ic.launcher.presenter;
 
+import android.app.ActivityManager;
 import android.content.BroadcastReceiver;
 import android.content.Context;
 import android.content.Intent;
 import android.content.IntentFilter;
 import android.os.BatteryManager;
+import android.os.Build;
 import android.telephony.TelephonyManager;
 import android.text.TextUtils;
 
+import androidx.annotation.RequiresApi;
 import androidx.lifecycle.MediatorLiveData;
 
 import com.ic.launcher.configure.l02.L02Icon;
@@ -15,6 +18,8 @@ import com.ic.launcher.util.IcLog;
 import com.ic.launcher.util.SoundPlayUtils;
 import com.ic.launcher.util.VibrateUtil;
 
+import java.util.ArrayList;
+
 
 public class BatteryPresenter extends PresenterCycle {
     private static final String TAG = "BatteryPresenter";
@@ -26,9 +31,8 @@ public class BatteryPresenter extends PresenterCycle {
 
     private SoundPlayUtils playUtils;
 
-    private boolean isLowPowerState = false;
     private boolean isPlaySound;
-    private boolean isPlayFullSound=false;
+    private boolean isPlayFullSound = false;
 
     private MediatorLiveData<String> mObsBatteryValue;
     private MediatorLiveData<Boolean> mObsBatteryCharging;
@@ -69,7 +73,7 @@ public class BatteryPresenter extends PresenterCycle {
         playUtils = new SoundPlayUtils();
         playUtils.init();
 
-        isPlaySound=false;
+        isPlaySound = false;
     }
 
     /**
@@ -110,6 +114,7 @@ public class BatteryPresenter extends PresenterCycle {
                         int status = intent.getIntExtra("status", -1);
                         int rawlevel = intent.getIntExtra("level", -1);
                         int scale = intent.getIntExtra("scale", -1);
+                        IcLog.i(TAG, "ACTION_BATTERY_CHANGED,level:" + rawlevel + ",status:" + status);
                         updateBatteryValue(rawlevel, scale, status);
                         break;
                     case Intent.ACTION_POWER_DISCONNECTED:
@@ -129,56 +134,59 @@ public class BatteryPresenter extends PresenterCycle {
     };
 
     private void updateBatteryValue(int rawlevel, int scale, int status) {
+
         int level = -1;
         if (rawlevel >= 0 && scale > 0) {
             level = (rawlevel * 100) / scale;
         }
 
-        IcLog.i(TAG, "Battery Value:" + level);
-
         if (level == -1) return;
 
+        mObsBatteryValue.setValue(level + "%");
+        mObsLowPowerValue.setValue(level + "%");
+
+        switch (status) {
+            case BatteryManager.BATTERY_STATUS_CHARGING:
+                mObsLowPower.setValue(false);
+                updateBatteryChargingValue();
+                break;
+            case BatteryManager.BATTERY_STATUS_FULL:
+                updateBatteryFullValue();
+                mObsBatteryResID.setValue(L02Icon.l02BatteryResId[getBatteryLevel(level)]);
+                break;
+            default:
+                mObsBatteryResID.setValue(L02Icon.l02BatteryResId[getBatteryLevel(level)]);
+                gotoLowBatteryMode(level);
+                break;
+        }
+    }
+
+    private void gotoLowBatteryMode(int level) {
         //低于5 则直接关机
         if (level <= SHUT_DOWN_LEVEL) {
             shutDown();
         } else if (level <= LOW_LEVEL) {
             //进入低电量
-            if (!gotoLowPowerMode(level)) {
-                updateBatteryObserveValue(level, status);
-            }
-        } else {
-            //退出低电量模式
-            if (isLowPowerState) {
-                mObsLowPower.setValue(false);
-                isLowPowerState = false;
-            }
-            updateBatteryObserveValue(level, status);
+            gotoLowPowerMode(level);
         }
     }
 
-    private void updateBatteryObserveValue(int level, int status) {
-        mObsBatteryResID.setValue(L02Icon.l02BatteryResId[getBatteryLevel(level)]);
-        mObsBatteryValue.setValue(level + "%");
+    private void updateBatteryChargingValue() {
+        mObsBatteryCharging.setValue(true);
+        if (!isPlaySound) {
+            showShockAndAudio(0);
+            isPlaySound = true;
+        }
+        isPlayFullSound = false;
+    }
 
-        switch (status){
-            case BatteryManager.BATTERY_STATUS_CHARGING:
-                IcLog.i(TAG, "Battery Statu: BATTERY_STATUS_CHARGING");
-                mObsBatteryCharging.setValue(true);
-                if(!isPlaySound){
-                    showShockAndAudio(0);
-                    isPlaySound=true;
-                }
-                isPlayFullSound=false;
-                break;
-            case BatteryManager.BATTERY_STATUS_FULL:
-                IcLog.i(TAG, "Battery Statu: BATTERY_STATUS_FULL");
-                mObsBatteryCharging.setValue(false);
-                /**if(!isPlayFullSound){
-                    showShockAndAudio(2);
-                    isPlayFullSound=true;
-                }**/
-                break;
+    private void updateBatteryFullValue() {
+        mObsBatteryCharging.setValue(false);
+        if (!isPlayFullSound) {
+            showShockAndAudio(2);
+            isPlayFullSound = true;
         }
+        isPlayFullSound = false;
     }
 
     private int getBatteryLevel(int level) {
@@ -198,21 +206,15 @@ public class BatteryPresenter extends PresenterCycle {
         return index;
     }
 
-    private boolean gotoLowPowerMode(int level) {
+    @RequiresApi(api = Build.VERSION_CODES.Q)
+    private void gotoLowPowerMode(int level) {
         //判断是否在通话中,如果是 则返回
-        if (phoneIsInUse()) return false;
-
-        //是否是首次进入到低电量模式
-        if (!isLowPowerState) {
-            mObsLowPower.setValue(true);
-            getHome();
-            isLowPowerState = true;
-        }
-
+        if (phoneIsInUse()) return;
+        if (isFactoryTestTopActivity(mContext)) return;
+        getHome();
+        mObsLowPower.setValue(true);
         //更新低电量的值
         mObsLowPowerValue.setValue(level + "%");
-
-        return true;
     }
 
     private void getHome() {
@@ -243,8 +245,15 @@ public class BatteryPresenter extends PresenterCycle {
         }
     }
 
-    private void showShockAndAudio(int index){
+    private void showShockAndAudio(int index) {
         VibrateUtil.getInstance(mContext).VibrateOn(true);
         playUtils.playKeyboardSound(mContext, index);
     }
+
+    @RequiresApi(api = Build.VERSION_CODES.Q)
+    public static boolean isFactoryTestTopActivity(Context paramContext) {
+        ArrayList<String> arrayList = new ArrayList();
+        arrayList.add("mobile.miki");
+        return arrayList.contains((((ActivityManager) paramContext.getSystemService(Context.ACTIVITY_SERVICE)).getRunningTasks(1).get(0)).topActivity.getPackageName());
+    }
 }
index 07d4199..e93b89e 100644 (file)
@@ -5,6 +5,7 @@ import android.graphics.drawable.AnimationDrawable;
 import android.graphics.drawable.Drawable;
 import android.util.AttributeSet;
 import android.view.View;
+import android.view.ViewTreeObserver;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
 import android.widget.TextView;
@@ -51,7 +52,12 @@ public class WidgetBatteryStateView extends LinearLayout {
             if (animationDrawable == null) {
                 batteryIv.setImageResource(R.drawable.l02_battery_charging_anim);
                 animationDrawable = (AnimationDrawable) batteryIv.getDrawable();
-                animationDrawable.start();
+                batteryIv.getViewTreeObserver().addOnDrawListener(() -> {
+                            if (animationDrawable != null) {
+                                animationDrawable.start();
+                            }
+                        }
+                );
             }
         } else {
             if (animationDrawable != null) {
index 7fd130f..73ee1c7 100644 (file)
@@ -1,5 +1,5 @@
-<vector android:height="18dp" android:tint="#A7A5A5"
+<vector android:height="12dp" android:tint="#A7A5A5"
     android:viewportHeight="24.0" android:viewportWidth="24.0"
-    android:width="18dp" xmlns:android="http://schemas.android.com/apk/res/android">
+    android:width="12dp" xmlns:android="http://schemas.android.com/apk/res/android">
     <path android:fillColor="#A7A5A5" android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2z"/>
 </vector>
index a032825..32753d0 100644 (file)
@@ -1,5 +1,5 @@
-<vector android:height="18dp" android:tint="#FFFFFF"
+<vector android:height="12dp" android:tint="#FFFFFF"
     android:viewportHeight="24.0" android:viewportWidth="24.0"
-    android:width="18dp" xmlns:android="http://schemas.android.com/apk/res/android">
+    android:width="12dp" xmlns:android="http://schemas.android.com/apk/res/android">
     <path android:fillColor="#FFFFFF" android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2z"/>
 </vector>
index 5178faa..a31aee4 100644 (file)
 
         <ImageView
             android:id="@+id/app_icon_iv"
-            android:layout_width="180dp"
-            android:layout_height="180dp"
+            android:layout_width="200dp"
+            android:layout_height="200dp"
             android:layout_centerHorizontal="true"
-            android:layout_marginTop="30dp" />
+            android:layout_marginTop="10dp" />
 
         <TextView
             android:id="@+id/app_title_tv"
@@ -36,8 +36,7 @@
             android:layout_centerHorizontal="true"
             android:text="@{appTitle}"
             android:textColor="#FFFFFF"
-            android:textSize="52sp"
-            android:layout_marginTop="15dp"/>
+            android:textSize="62sp"/>
     </RelativeLayout>
 
 </layout>
index 83c99c5..b680f7b 100644 (file)
@@ -8,7 +8,7 @@
     <string name="app_name_motion">运动</string>
     <string name="app_name_talk">微聊</string>
     <string name="app_name_weather">天气</string>
-    <string name="app_name_heart">心率</string>
+    <string name="app_name_heart">爱健康</string>
     <string name="app_name_alipay">支付宝</string>
     <string name="app_name_camera">照相</string>
     <string name="app_name_album">相册</string>
index b4e6234..9f80442 100644 (file)
@@ -1,2 +1,2 @@
-#Wed Apr 08 10:21:39 CST 2020
-VERSION_CODE=32
+#Fri Apr 10 15:47:43 CST 2020
+VERSION_CODE=42