From cb7bf83ec60f891e8866d37b5dc4f9269e3f17cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E6=B3=A2?= <349637011@qq.com> Date: Tue, 2 Mar 2021 17:43:43 +0800 Subject: [PATCH] add statusbarspace --- .../com/pichs/app/xwidget/MainActivity.java | 5 +- app/src/main/res/layout/activity_main.xml | 28 +++++++-- app/src/main/res/values-night/themes.xml | 2 +- app/src/main/res/values/themes.xml | 2 +- .../common/widget/space/XStatusBarSpace.java | 63 +++++++++++++++++++ .../common/widget/utils/XDisplayHelper.java | 3 - .../common/widget/view/XStatusBarView.java | 61 ++++++++++++++++++ widget/src/main/res/values/attrs.xml | 35 +++++++++++ 8 files changed, 189 insertions(+), 10 deletions(-) create mode 100644 widget/src/main/java/com/pichs/common/widget/space/XStatusBarSpace.java create mode 100644 widget/src/main/java/com/pichs/common/widget/view/XStatusBarView.java diff --git a/app/src/main/java/com/pichs/app/xwidget/MainActivity.java b/app/src/main/java/com/pichs/app/xwidget/MainActivity.java index a19bdda..04054e9 100644 --- a/app/src/main/java/com/pichs/app/xwidget/MainActivity.java +++ b/app/src/main/java/com/pichs/app/xwidget/MainActivity.java @@ -14,6 +14,7 @@ import com.pichs.common.widget.cardview.XCardButton; import com.pichs.common.widget.switcher.XSwitchButton; +import com.pichs.common.widget.utils.XStatusBarHelper; import com.pichs.common.widget.utils.XTypefaceHelper; import com.pichs.common.widget.view.XButton; @@ -22,12 +23,14 @@ public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + XStatusBarHelper.translucent(this); + XStatusBarHelper.setStatusBarDarkMode(this); setContentView(R.layout.activity_main); XCardButton btn = findViewById(R.id.btn1); XSwitchButton swb = findViewById(R.id.swb); - swb.setThumbColor(Color.BLACK, Color.BLACK, Color.BLACK, Color.BLACK ); + swb.setThumbColor(Color.BLACK, Color.BLACK, Color.BLACK, Color.BLACK); swb.setBackgroundColor(Color.GREEN, Color.CYAN); btn.setOnClickListener(new View.OnClickListener() { @Override diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 7ba1689..a28c6b6 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -5,6 +5,7 @@ android:layout_width="match_parent" android:layout_height="match_parent"> + + + + + + + + + + + + app:xp_shine_normal_color="#C71FEA" + app:xp_shine_small_shine_color="#3CC63C" /> -