diff --git a/library/build.gradle b/library/build.gradle index 58282a8..309b31b 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -10,8 +10,8 @@ android { defaultConfig { minSdkVersion 14 targetSdkVersion 28 - versionCode 222 - versionName "2.2.2" + versionCode 223 + versionName "2.2.3" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" diff --git a/library/src/main/java/com/allen/library/SuperTextView.java b/library/src/main/java/com/allen/library/SuperTextView.java index 7fce111..5836a9c 100644 --- a/library/src/main/java/com/allen/library/SuperTextView.java +++ b/library/src/main/java/com/allen/library/SuperTextView.java @@ -1849,6 +1849,18 @@ public SuperTextView setCbChecked(boolean checked) { return this; } + /** + * @param clickable 是否允许点击 + * @return 返回值 + */ + public SuperTextView setCbClickable(boolean clickable) { + if (rightCheckBox != null) { + rightCheckBox.setClickable(clickable); + } + return this; + } + + /** * 设置checkbox的背景图 * @@ -1888,6 +1900,17 @@ public SuperTextView setSwitchIsChecked(boolean checked) { return this; } + /** + * @param clickable Switch是否允许点击 + * @return 返回值 + */ + public SuperTextView setSwitchClickable(boolean clickable) { + if (mSwitch != null) { + mSwitch.setClickable(clickable); + } + return this; + } + /** * 获取switch状态 * @@ -1901,6 +1924,15 @@ public boolean getSwitchIsChecked() { return isChecked; } + /** + * 获取switchView + * + * @return Switch + */ + public Switch getSwitch() { + return mSwitch; + } + /** * 设置左边tv的左侧图片 * @@ -2039,11 +2071,10 @@ public SuperTextView setSBackground(Drawable drawable) { * @return textView */ public AppCompatTextView getLeftTopTextView() { - AppCompatTextView textView = null; - if (leftView != null) { - textView = leftView.getTopTextView(); + if (leftView == null) { + initLeftTextView(); } - return textView; + return leftView.getTopTextView(); } /** @@ -2052,11 +2083,10 @@ public AppCompatTextView getLeftTopTextView() { * @return textView */ public AppCompatTextView getLeftTextView() { - AppCompatTextView textView = null; - if (leftView != null) { - textView = leftView.getCenterTextView(); + if (leftView == null) { + initLeftTextView(); } - return textView; + return leftView.getCenterTextView(); } /** @@ -2065,11 +2095,10 @@ public AppCompatTextView getLeftTextView() { * @return textView */ public AppCompatTextView getLeftBottomTextView() { - AppCompatTextView textView = null; - if (leftView != null) { - textView = leftView.getBottomTextView(); + if (leftView == null) { + initLeftTextView(); } - return textView; + return leftView.getBottomTextView(); } /** @@ -2078,11 +2107,10 @@ public AppCompatTextView getLeftBottomTextView() { * @return textView */ public AppCompatTextView getCenterTopTextView() { - AppCompatTextView textView = null; - if (centerView != null) { - textView = centerView.getTopTextView(); + if (centerView == null) { + initCenterTextView(); } - return textView; + return centerView.getTopTextView(); } /** @@ -2091,11 +2119,10 @@ public AppCompatTextView getCenterTopTextView() { * @return textView */ public AppCompatTextView getCenterTextView() { - AppCompatTextView textView = null; - if (centerView != null) { - textView = centerView.getCenterTextView(); + if (centerView == null) { + initCenterTextView(); } - return textView; + return centerView.getCenterTextView(); } /** @@ -2104,11 +2131,10 @@ public AppCompatTextView getCenterTextView() { * @return textView */ public AppCompatTextView getCenterBottomTextView() { - AppCompatTextView textView = null; - if (centerView != null) { - textView = centerView.getBottomTextView(); + if (centerView == null) { + initCenterTextView(); } - return textView; + return centerView.getBottomTextView(); } /** @@ -2117,11 +2143,10 @@ public AppCompatTextView getCenterBottomTextView() { * @return textView */ public AppCompatTextView getRightTopTextView() { - AppCompatTextView textView = null; - if (rightView != null) { - textView = rightView.getTopTextView(); + if (rightView == null) { + initRightTextView(); } - return textView; + return rightView.getTopTextView(); } /** @@ -2130,11 +2155,10 @@ public AppCompatTextView getRightTopTextView() { * @return textView */ public AppCompatTextView getRightTextView() { - AppCompatTextView textView = null; - if (rightView != null) { - textView = rightView.getCenterTextView(); + if (rightView == null) { + initRightTextView(); } - return textView; + return rightView.getCenterTextView(); } /** @@ -2143,11 +2167,10 @@ public AppCompatTextView getRightTextView() { * @return textView */ public AppCompatTextView getRightBottomTextView() { - AppCompatTextView textView = null; - if (rightView != null) { - textView = rightView.getBottomTextView(); + if (rightView == null) { + initRightTextView(); } - return textView; + return rightView.getBottomTextView(); } /** @@ -2199,6 +2222,7 @@ private void setTextGravity(BaseTextView baseTextView, int gravity) { /** * 代码动态设置分割线显示类型 + * * @param dividerType TOP、BOTTOM、BOTH、NONE * @return this */