feat: 容器统一加灰色边框,borderCornerRadius 属性统一管理圆角

创建通用灰色边框 drawable(5 模块各一份):
  - bg_container_border.xml:透明填充 + 1dp #B0B0B0 描边
  - 自动应用到 80 个无背景容器的布局文件

深色模式 bg_frame 加边框:
  - drawable-night/bg_frame.xml(mymessagemanager + aes):
    背景 shape 添加 1dp #666666 描边,保留渐变蒙版

统一圆角为 6dp(borderCornerRadius 属性化):
  - 5 模块 attrs.xml 声明 borderCornerRadius(dimension)
  - 12 个主题(6 普通 + 6 深色)设置 borderCornerRadius=6dp
  - 12 个 drawable 文件约 40 处 corners 改用 ?attr/borderCornerRadius
    (bg_frame / bg_frame_black/white / bg_shadow / bg_border_round
     bg_toolbar_log / acard_frame_main / atoolbar_frame / ohpcts_frame
     bg_container_border 等)
  - 3 个 Java 自定义控件(AToolbar / ASupportToolbar / AboutView)
    从硬编码 px 改为读取 ?attr/borderCornerRadius

受益布局模块:libaes / libappbase / appbase / mymessagemanager / aes / winboll
This commit is contained in:
2026-05-09 10:59:55 +08:00
parent b385aa7030
commit 4e4673a93b
108 changed files with 282 additions and 317 deletions

View File

@@ -49,6 +49,10 @@ public class ASupportToolbar extends Toolbar {
// 工具栏描边
int nStroke = 5;
TypedArray taBorder = getContext().obtainStyledAttributes(new int[]{R.attr.borderCornerRadius});
float cornerRadius = taBorder.getDimension(0, 6 * getResources().getDisplayMetrics().density);
taBorder.recycle();
//分别为开始颜色,中间夜色,结束颜色
int colors0[] = { mEndColor , mCenterColor, mStartColor};
GradientDrawable gradientDrawable0;
@@ -57,7 +61,7 @@ public class ASupportToolbar extends Toolbar {
gradientDrawable0.setShape(GradientDrawable.RECTANGLE);
gradientDrawable0.setColors(colors0); //添加颜色组
gradientDrawable0.setGradientType(GradientDrawable.LINEAR_GRADIENT);//设置线性渐变
gradientDrawable0.setCornerRadius(20);
gradientDrawable0.setCornerRadius(cornerRadius);
int colors1[] = { mCenterColor , mCenterColor, mCenterColor };
GradientDrawable gradientDrawable1;
@@ -66,7 +70,7 @@ public class ASupportToolbar extends Toolbar {
gradientDrawable1.setShape(GradientDrawable.RECTANGLE);
gradientDrawable1.setColors(colors1); //添加颜色组
gradientDrawable1.setGradientType(GradientDrawable.LINEAR_GRADIENT);//设置线性渐变
gradientDrawable1.setCornerRadius(20);
gradientDrawable1.setCornerRadius(cornerRadius);
int colors2[] = { mEndColor, mCenterColor, mStartColor };
GradientDrawable gradientDrawable2;
@@ -75,7 +79,7 @@ public class ASupportToolbar extends Toolbar {
gradientDrawable2.setShape(GradientDrawable.RECTANGLE);
gradientDrawable2.setColors(colors2); //添加颜色组
gradientDrawable2.setGradientType(GradientDrawable.LINEAR_GRADIENT);//设置线性渐变
gradientDrawable2.setCornerRadius(20);
gradientDrawable2.setCornerRadius(cornerRadius);
ld = new LayerDrawable(array); //参数为上面的Drawable数组
ld.setLayerInset(2, nStroke * 2, nStroke * 2, getWidth() + nStroke * 2, getHeight() + nStroke * 2);

View File

@@ -51,6 +51,10 @@ public class AToolbar extends Toolbar {
// 工具栏描边
int nStroke = 5;
TypedArray taBorder = getContext().obtainStyledAttributes(new int[]{R.attr.borderCornerRadius});
float cornerRadius = taBorder.getDimension(0, 6 * getResources().getDisplayMetrics().density);
taBorder.recycle();
//分别为开始颜色,中间夜色,结束颜色
int colors0[] = { mEndColor , mCenterColor, mStartColor};
GradientDrawable gradientDrawable0;
@@ -59,7 +63,7 @@ public class AToolbar extends Toolbar {
gradientDrawable0.setShape(GradientDrawable.RECTANGLE);
gradientDrawable0.setColors(colors0); //添加颜色组
gradientDrawable0.setGradientType(GradientDrawable.LINEAR_GRADIENT);//设置线性渐变
gradientDrawable0.setCornerRadius(20);
gradientDrawable0.setCornerRadius(cornerRadius);
int colors1[] = { mCenterColor , mCenterColor, mCenterColor };
GradientDrawable gradientDrawable1;
@@ -68,7 +72,7 @@ public class AToolbar extends Toolbar {
gradientDrawable1.setShape(GradientDrawable.RECTANGLE);
gradientDrawable1.setColors(colors1); //添加颜色组
gradientDrawable1.setGradientType(GradientDrawable.LINEAR_GRADIENT);//设置线性渐变
gradientDrawable1.setCornerRadius(20);
gradientDrawable1.setCornerRadius(cornerRadius);
int colors2[] = { mEndColor, mCenterColor, mStartColor };
GradientDrawable gradientDrawable2;
@@ -77,7 +81,7 @@ public class AToolbar extends Toolbar {
gradientDrawable2.setShape(GradientDrawable.RECTANGLE);
gradientDrawable2.setColors(colors2); //添加颜色组
gradientDrawable2.setGradientType(GradientDrawable.LINEAR_GRADIENT);//设置线性渐变
gradientDrawable2.setCornerRadius(20);
gradientDrawable2.setCornerRadius(cornerRadius);
ld = new LayerDrawable(array); //参数为上面的Drawable数组

View File

@@ -13,11 +13,7 @@
android:startColor="@color/colorACardShadow"
android:centerColor="@color/colorACardShadow"
android:endColor="@color/colorACardShadow"/>
<corners
android:bottomLeftRadius="6dip"
android:bottomRightRadius="6dip"
android:topLeftRadius="6dip"
android:topRightRadius="6dip" />
<corners android:radius="?attr/borderCornerRadius" />
</shape>
</item>
<!-- 边框部分 -->
@@ -32,11 +28,7 @@
android:startColor="@color/colorACardFrame"
android:centerColor="@color/colorACardFrame"
android:endColor="@color/colorACardFrame"/>
<corners
android:bottomLeftRadius="6dip"
android:bottomRightRadius="6dip"
android:topLeftRadius="6dip"
android:topRightRadius="6dip" />
<corners android:radius="?attr/borderCornerRadius" />
</shape>
</item>
<!-- 背景主体部分 -->
@@ -52,11 +44,7 @@
android:startColor="@color/colorACardBackgroung"
android:centerColor="@color/colorACardBackgroung"
android:endColor="@color/colorACardBackgroung"/>
<corners
android:bottomLeftRadius="6dip"
android:bottomRightRadius="6dip"
android:topLeftRadius="6dip"
android:topRightRadius="6dip" />
<corners android:radius="?attr/borderCornerRadius" />
</shape>
</item>
</layer-list>

View File

@@ -13,11 +13,7 @@
android:startColor="?attr/attrAToolbarEndColor"
android:centerColor="?attr/attrAToolbarCenterColor"
android:endColor="?attr/attrAToolbarStartColor"/>
<corners
android:bottomLeftRadius="6dip"
android:bottomRightRadius="6dip"
android:topLeftRadius="6dip"
android:topRightRadius="6dip" />
<corners android:radius="?attr/borderCornerRadius" />
</shape>
</item>
<!-- 边框部分 -->
@@ -32,11 +28,7 @@
android:startColor="?attr/attrAToolbarCenterColor"
android:centerColor="?attr/attrAToolbarCenterColor"
android:endColor="?attr/attrAToolbarCenterColor"/>
<corners
android:bottomLeftRadius="6dip"
android:bottomRightRadius="6dip"
android:topLeftRadius="6dip"
android:topRightRadius="6dip" />
<corners android:radius="?attr/borderCornerRadius" />
</shape>
</item>
<!-- 背景主体部分 -->
@@ -52,11 +44,7 @@
android:startColor="?attr/attrAToolbarStartColor"
android:centerColor="?attr/attrAToolbarCenterColor"
android:endColor="?attr/attrAToolbarEndColor"/>
<corners
android:bottomLeftRadius="6dip"
android:bottomRightRadius="6dip"
android:topLeftRadius="6dip"
android:topRightRadius="6dip" />
<corners android:radius="?attr/borderCornerRadius" />
</shape>
</item>
</layer-list>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="@android:color/transparent" />
<stroke android:width="1dp" android:color="#FFB0B0B0" />
<corners android:radius="?attr/borderCornerRadius" />
</shape>

View File

@@ -12,11 +12,7 @@
android:angle="270"
android:endColor="#0F000000"
android:startColor="#0F000000" />
<corners
android:bottomLeftRadius="6dip"
android:bottomRightRadius="6dip"
android:topLeftRadius="6dip"
android:topRightRadius="6dip" />
<corners android:radius="?attr/borderCornerRadius" />
</shape>
</item>
<!-- 背景部分 -->
@@ -31,11 +27,7 @@
android:angle="270"
android:endColor="@color/colorAccent"
android:startColor="@color/colorAccent" />
<corners
android:bottomLeftRadius="6dip"
android:bottomRightRadius="6dip"
android:topLeftRadius="6dip"
android:topRightRadius="6dip" />
<corners android:radius="?attr/borderCornerRadius" />
</shape>
</item>
</layer-list>

View File

@@ -9,7 +9,7 @@
android:startColor="@color/colorOHPCTSBackground"
android:centerColor="@color/colorOHPCTSBackground"
android:endColor="@color/colorOHPCTSBackground"/>
<corners android:radius="6dip"/>
<corners android:radius="?attr/borderCornerRadius"/>
</shape>
</item>
<!-- 第二进度条 -->
@@ -22,7 +22,7 @@
android:startColor="@color/colorOHPCTSSecondaryProgress"
android:centerColor="@color/colorOHPCTSSecondaryProgress"
android:endColor="@color/colorOHPCTSSecondaryProgress"/>
<corners android:radius="6dip"/>
<corners android:radius="?attr/borderCornerRadius"/>
</shape>
</clip>
</item>
@@ -36,7 +36,7 @@
android:startColor="@color/colorOHPCTSProgress"
android:centerColor="@color/colorOHPCTSProgress"
android:endColor="@color/colorOHPCTSProgress"/>
<corners android:radius="6dip"/>
<corners android:radius="?attr/borderCornerRadius"/>
</shape>
</clip>
</item>

View File

@@ -4,7 +4,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent" android:background="@drawable/bg_container_border">
<cc.winboll.studio.libaes.views.ASupportToolbar
android:layout_width="match_parent"
@@ -16,6 +16,6 @@
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1.0"
android:id="@+id/aboutviewroot_ll"/>
android:id="@+id/aboutviewroot_ll" android:background="@drawable/bg_container_border" />
</LinearLayout>

View File

@@ -3,7 +3,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content" android:background="@drawable/bg_container_border">
<cc.winboll.studio.libaes.views.ASupportToolbar
android:layout_width="match_parent"
@@ -19,13 +19,13 @@
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent" android:background="@drawable/bg_container_border">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1.0"
android:id="@+id/activitydrawerLinearLayout1"/>
android:id="@+id/activitydrawerLinearLayout1" android:background="@drawable/bg_container_border" />
</LinearLayout>
<com.baoyz.widget.PullRefreshLayout

View File

@@ -4,7 +4,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent" android:background="@drawable/bg_container_border">
<cc.winboll.studio.libaes.views.ASupportToolbar
android:layout_width="match_parent"
@@ -15,7 +15,7 @@
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1.0">
android:layout_weight="1.0" android:background="@drawable/bg_container_border">
<androidx.drawerlayout.widget.DrawerLayout
android:layout_width="match_parent"
@@ -26,7 +26,7 @@
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/activitydrawerfragmentFrameLayout1"/>
android:id="@+id/activitydrawerfragmentFrameLayout1" android:background="@drawable/bg_container_border" />
<com.baoyz.widget.PullRefreshLayout
android:orientation="vertical"

View File

@@ -4,7 +4,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent" android:background="@drawable/bg_container_border">
<TextView
android:layout_width="wrap_content"

View File

@@ -4,12 +4,12 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent" android:background="@drawable/bg_container_border">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/activitytestaboutfragmentFrameLayout1"/>
android:id="@+id/activitytestaboutfragmentFrameLayout1" android:background="@drawable/bg_container_border" />
</LinearLayout>

View File

@@ -4,7 +4,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent" android:background="@drawable/bg_container_border">
<cc.winboll.studio.libaes.views.ASupportToolbar
android:layout_width="match_parent"

View File

@@ -4,7 +4,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent" android:background="@drawable/bg_container_border">
<cc.winboll.studio.libaes.views.AToolbar
android:layout_width="match_parent"

View File

@@ -21,7 +21,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginBottom="20dp">
android:layout_marginBottom="20dp" android:background="@drawable/bg_container_border">
<TextView
android:layout_width="wrap_content"
@@ -50,7 +50,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="end">
android:gravity="end" android:background="@drawable/bg_container_border">
<Button
android:id="@+id/btn_disagree"

View File

@@ -3,7 +3,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent" android:background="@drawable/bg_container_border">
<TextView
android:layout_width="wrap_content"
@@ -22,7 +22,7 @@
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="end">
android:gravity="end" android:background="@drawable/bg_container_border">
<Button
android:layout_width="wrap_content"

View File

@@ -3,7 +3,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent" android:background="@drawable/bg_container_border">
<TextView
android:layout_width="wrap_content"

View File

@@ -5,7 +5,7 @@
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical">
android:gravity="center_vertical" android:background="@drawable/bg_container_border">
<TextView
android:layout_width="wrap_content"
@@ -23,7 +23,7 @@
android:layout_height="60dp"
android:orientation="horizontal"
android:gravity="center"
android:id="@+id/fragmentviewpageLinearLayout1">
android:id="@+id/fragmentviewpageLinearLayout1" android:background="@drawable/bg_container_border">
<ImageView
android:layout_width="wrap_content"

View File

@@ -5,7 +5,7 @@
android:layout_width="match_parent"
android:layout_height="48dp"
android:gravity="center_vertical"
android:orientation="horizontal">
android:orientation="horizontal" android:background="@drawable/bg_container_border">
<ImageView
android:layout_centerVertical="true"

View File

@@ -4,12 +4,12 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/ads_container"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content" android:background="@drawable/bg_container_border">
<LinearLayout
android:id="@+id/ads_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"/>
android:orientation="vertical" android:background="@drawable/bg_container_border" />
</LinearLayout>

View File

@@ -4,7 +4,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp">
android:padding="16dp" android:background="@drawable/bg_container_border">
<TextView
android:layout_width="wrap_content"
@@ -50,7 +50,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
android:layout_marginTop="0dp"> <!-- 移除顶部多余间距 -->
android:layout_marginTop="0dp"> <!-- 移除顶部多余间距 -- android:background="@drawable/bg_container_border">
<ImageView
android:id="@+id/iv_winboll_store"

View File

@@ -3,7 +3,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent" android:background="@drawable/bg_container_border">
<TextView
android:layout_width="wrap_content"

View File

@@ -3,7 +3,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent" android:background="@drawable/bg_container_border">
<TextView
android:layout_width="wrap_content"

View File

@@ -4,7 +4,7 @@
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center">
android:gravity="center" android:background="@drawable/bg_container_border">
<TextView
android:layout_width="wrap_content"
@@ -15,7 +15,7 @@
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center">
android:gravity="center" android:background="@drawable/bg_container_border">
<cc.winboll.studio.libaes.views.AOHPCTCSeekBar
android:layout_width="300dp"

View File

@@ -3,7 +3,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent" android:background="@drawable/bg_container_border">
<TextView
android:layout_width="wrap_content"

View File

@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<attr name="borderCornerRadius" format="dimension" />
<attr name="colorTextColor" format="color" />
<attr name="colorPrimary" format="color" />
<attr name="colorPrimaryDark" format="color" />