Optimize Utils

androidx
Zhanty 5 years ago
parent 287c94a567
commit 8bb6b52250
  1. 1
      lib_base/src/main/java/com/android/base/utils/android/TintUtils.java
  2. 20
      lib_base/src/main/java/com/android/base/utils/android/compat/SystemBarCompat.java
  3. 2
      lib_base/src/main/res/values/base_ids.xml

@ -33,6 +33,7 @@ import android.support.v4.graphics.drawable.DrawableCompat;
* bbbTv.setCompoundDrawablesWithIntrinsicBounds(null, bbbTint, null, null);
* </pre>
*/
@SuppressWarnings("unused,WeakerAccess")
public class TintUtils {
private TintUtils() {

@ -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;
}
/**

@ -1,6 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<item name="base_status_view_id" type="id"/>
<item name="base_item_tag_view_id" type="id"/>
<item name="base_tag_multi_state_view" type="id"/>

Loading…
Cancel
Save