diff --git a/lib_base/src/main/java/com/android/base/utils/android/TintUtils.java b/lib_base/src/main/java/com/android/base/utils/android/TintUtils.java index 75e1c89..aeb1a9e 100644 --- a/lib_base/src/main/java/com/android/base/utils/android/TintUtils.java +++ b/lib_base/src/main/java/com/android/base/utils/android/TintUtils.java @@ -33,6 +33,7 @@ import android.support.v4.graphics.drawable.DrawableCompat; * bbbTv.setCompoundDrawablesWithIntrinsicBounds(null, bbbTint, null, null); * */ +@SuppressWarnings("unused,WeakerAccess") public class TintUtils { private TintUtils() { diff --git a/lib_base/src/main/java/com/android/base/utils/android/compat/SystemBarCompat.java b/lib_base/src/main/java/com/android/base/utils/android/compat/SystemBarCompat.java index 19c4468..b63c1d6 100644 --- a/lib_base/src/main/java/com/android/base/utils/android/compat/SystemBarCompat.java +++ b/lib_base/src/main/java/com/android/base/utils/android/compat/SystemBarCompat.java @@ -22,6 +22,8 @@ import android.view.Window; import android.view.WindowManager; import android.widget.FrameLayout; +import com.android.base.R; + import timber.log.Timber; /** @@ -172,13 +174,17 @@ public class SystemBarCompat { */ @SuppressWarnings("WeakerAccess,unused") public static View setupStatusBarView(Context context, ViewGroup rootView, @ColorInt int color) { - View mStatusBarTintView = new View(context); - mStatusBarTintView.setBackgroundColor(color); - FrameLayout.LayoutParams mStatusBarParams = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, getStatusBarHeight(context)); - mStatusBarParams.gravity = Gravity.TOP; - mStatusBarTintView.setLayoutParams(mStatusBarParams); - rootView.addView(mStatusBarTintView, 0); - return mStatusBarTintView; + View statusBarTintView = rootView.findViewById(R.id.base_status_view_id); + if (statusBarTintView == null) { + statusBarTintView = new View(context); + statusBarTintView.setId(R.id.base_status_view_id); + FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, getStatusBarHeight(context)); + layoutParams.gravity = Gravity.TOP; + statusBarTintView.setLayoutParams(layoutParams); + rootView.addView(statusBarTintView, 0); + } + statusBarTintView.setBackgroundColor(color); + return statusBarTintView; } /** diff --git a/lib_base/src/main/res/values/base_ids.xml b/lib_base/src/main/res/values/base_ids.xml index 7256f19..f96d775 100644 --- a/lib_base/src/main/res/values/base_ids.xml +++ b/lib_base/src/main/res/values/base_ids.xml @@ -1,6 +1,8 @@ + +