Commit 7c55c051c27ffe21bc3ad1133d9b0b396ac4f2e0

Authored by YangShuai
1 parent aefd8b15

1 优化基类

core/base/src/main/java/com/cnlive/core/libs/base/frame/activity/BaseActivity.java
... ... @@ -21,6 +21,7 @@ import android.view.Window;
21 21 import android.view.WindowManager;
22 22 import android.view.inputmethod.InputMethodManager;
23 23  
  24 +import androidx.annotation.ColorInt;
24 25 import androidx.annotation.ColorRes;
25 26 import androidx.annotation.DrawableRes;
26 27 import androidx.annotation.IntRange;
... ... @@ -315,12 +316,16 @@ public abstract class BaseActivity<V extends BaseView, P extends BasePresenter<V
315 316 StatusBarUtil.setColor(this, ContextCompat.getColor(this, color), statusBarAlpha);
316 317 }
317 318  
318   - public void setTransparentForWindow(Activity activity) {
319   - StatusBarUtil.setTransparentForWindow(activity);
  319 + public void setTransparentForWindow() {
  320 + StatusBarUtil.setTransparentForWindow(this);
320 321 }
321 322  
322   - public void addTranslucentView(Activity activity, @IntRange(from = 0, to = 255) int statusBarAlpha) {
323   - StatusBarUtil.addTranslucentView(activity, statusBarAlpha);
  323 + public void addTranslucentView(@IntRange(from = 0, to = 255) int statusBarAlpha) {
  324 + StatusBarUtil.addTranslucentView(this, statusBarAlpha);
  325 + }
  326 +
  327 + public void setDecorViewBgColor(@ColorInt int color) {
  328 + getWindow().getDecorView().setBackgroundColor(color);
324 329 }
325 330  
326 331 /**
... ...
core/base/src/main/java/com/cnlive/core/libs/base/frame/fragment/BaseFragment.java
... ... @@ -9,6 +9,7 @@ import android.view.ViewGroup;
9 9 import android.view.animation.Animation;
10 10 import android.view.inputmethod.InputMethodManager;
11 11  
  12 +import androidx.annotation.ColorInt;
12 13 import androidx.annotation.ColorRes;
13 14 import androidx.annotation.FloatRange;
14 15 import androidx.annotation.IntRange;
... ... @@ -189,12 +190,16 @@ public abstract class BaseFragment<V extends BaseView, P extends BasePresenter<V
189 190 me.setStatusBarColor(color, statusBarAlpha);
190 191 }
191 192  
192   - public void setTransparentForWindow(Activity activity) {
193   - me.setTransparentForWindow(activity);
  193 + public void setTransparentForWindow() {
  194 + me.setTransparentForWindow();
194 195 }
195 196  
196   - public void addTranslucentView(Activity activity, @IntRange(from = 0, to = 255) int statusBarAlpha) {
197   - me.addTranslucentView(activity, statusBarAlpha);
  197 + public void addTranslucentView(@IntRange(from = 0, to = 255) int statusBarAlpha) {
  198 + me.addTranslucentView(statusBarAlpha);
  199 + }
  200 +
  201 + public void setDecorViewBgColor(@ColorInt int color) {
  202 + me.setDecorViewBgColor(color);
198 203 }
199 204  
200 205 @Override
... ...