From 5f28b1eda4096d3da17c280f78b4b491f9134f32 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=90=B4=E6=B3=A2?= <349637011@qq.com>
Date: Sat, 6 Mar 2021 09:04:05 +0800
Subject: [PATCH] fix round background
---
.../com/pichs/app/xwidget/MainActivity.java | 90 +++++------
app/src/main/res/layout/activity_main.xml | 146 ++++++++++--------
.../widget/utils/XRoundBackgroundHelper.java | 4 +-
3 files changed, 128 insertions(+), 112 deletions(-)
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 9e23336..8f510b7 100644
--- a/app/src/main/java/com/pichs/app/xwidget/MainActivity.java
+++ b/app/src/main/java/com/pichs/app/xwidget/MainActivity.java
@@ -31,55 +31,55 @@ protected void onCreate(Bundle savedInstanceState) {
XStatusBarHelper.setStatusBarDarkMode(this);
setContentView(R.layout.activity_main);
- XCardButton btn = findViewById(R.id.btn1);
- XCheckBox checkbox = findViewById(R.id.checkbox);
- checkbox.setOnCheckedChangeListener(new XCheckBox.OnCheckedChangeListener() {
- @Override
- public void onCheckedChanged(boolean isChecked) {
- Toast.makeText(getApplicationContext(), "ischecked:" + isChecked, Toast.LENGTH_LONG).show();
- }
- });
+// XCardButton btn = findViewById(R.id.btn1);
+// XCheckBox checkbox = findViewById(R.id.checkbox);
+// checkbox.setOnCheckedChangeListener(new XCheckBox.OnCheckedChangeListener() {
+// @Override
+// public void onCheckedChanged(boolean isChecked) {
+// Toast.makeText(getApplicationContext(), "ischecked:" + isChecked, Toast.LENGTH_LONG).show();
+// }
+// });
- XSwitchButton swb = findViewById(R.id.swb);
- swb.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
- @Override
- public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
-
- if (isChecked) {
- checkbox.setImageDrawable(new ColorDrawable(Color.BLACK));
- checkbox.setCheckedDrawable(new ColorDrawable(Color.RED));
-
- } else {
- checkbox.setImageDrawable(new ColorDrawable(Color.GREEN));
- checkbox.setCheckedDrawable(new ColorDrawable(Color.BLUE));
-
- }
-
- }
- });
- swb.setThumbColor(Color.BLACK, Color.BLACK, Color.BLACK, Color.BLACK);
- swb.setBackgroundColor(Color.GREEN, Color.CYAN);
- btn.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- XTypefaceHelper.setGlobalTypefaceFromAssets(getApplicationContext(), "leihong.ttf");
- XTypefaceHelper.setGlobalTypefaceStyle(getApplicationContext(), XTypefaceHelper.NONE);
- }
- });
- XButton normalBtn = findViewById(R.id.normalBtn);
-
- normalBtn.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
+// XSwitchButton swb = findViewById(R.id.swb);
+// swb.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+// @Override
+// public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+//
+// if (isChecked) {
+// checkbox.setImageDrawable(new ColorDrawable(Color.BLACK));
+// checkbox.setCheckedDrawable(new ColorDrawable(Color.RED));
+//
+// } else {
+// checkbox.setImageDrawable(new ColorDrawable(Color.GREEN));
+// checkbox.setCheckedDrawable(new ColorDrawable(Color.BLUE));
+//
+// }
+//
+// }
+// });
+// swb.setThumbColor(Color.BLACK, Color.BLACK, Color.BLACK, Color.BLACK);
+// swb.setBackgroundColor(Color.GREEN, Color.CYAN);
+// btn.setOnClickListener(new View.OnClickListener() {
+// @Override
+// public void onClick(View v) {
// XTypefaceHelper.setGlobalTypefaceFromAssets(getApplicationContext(), "leihong.ttf");
-// XTypefaceHelper.clearObserver();
-
-// XTypefaceHelper.setGlobalTypeface(getApplicationContext(), XTypefaceHelper.TYPEFACE_BOLD);
- XTypefaceHelper.resetTypeface(MainActivity.this);
// XTypefaceHelper.setGlobalTypefaceStyle(getApplicationContext(), XTypefaceHelper.NONE);
- }
- });
+// }
+// });
+// XButton normalBtn = findViewById(R.id.normalBtn);
+
+// normalBtn.setOnClickListener(new View.OnClickListener() {
+// @Override
+// public void onClick(View v) {
+//// XTypefaceHelper.setGlobalTypefaceFromAssets(getApplicationContext(), "leihong.ttf");
+//// XTypefaceHelper.clearObserver();
+//
+//// XTypefaceHelper.setGlobalTypeface(getApplicationContext(), XTypefaceHelper.TYPEFACE_BOLD);
+// XTypefaceHelper.resetTypeface(MainActivity.this);
+//// XTypefaceHelper.setGlobalTypefaceStyle(getApplicationContext(), XTypefaceHelper.NONE);
+// }
+// });
}
}
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index cfb170e..3770301 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -74,20 +74,20 @@
app:layout_constraintTop_toBottomOf="@+id/btn1"
app:xp_ignoreGlobalTypeface="true" />
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+