feat: 优化代码

pull/103/head
kunfei 5 years ago
parent 6f2b8d59b0
commit 7f0a484693
  1. 2
      app/src/main/java/io/legado/app/ui/widget/text/AccentBgTextView.kt
  2. 2
      app/src/main/java/io/legado/app/ui/widget/text/BadgeView.kt
  3. 8
      app/src/main/res/layout/activity_book_info.xml
  4. 2
      app/src/main/res/layout/item_bookshelf_grid.xml
  5. 2
      app/src/main/res/layout/item_import_book.xml
  6. 6
      app/src/main/res/layout/item_search.xml
  7. 8
      app/src/main/res/values/attrs.xml

@ -15,7 +15,7 @@ class AccentBgTextView(context: Context, attrs: AttributeSet) :
init {
val typedArray = context.obtainStyledAttributes(attrs, R.styleable.AccentBgTextView)
val radios =
typedArray.getDimensionPixelOffset(R.styleable.AccentBgTextView_bg_radius, 0)
typedArray.getDimensionPixelOffset(R.styleable.AccentBgTextView_radius, 0)
typedArray.recycle()
background = Selector.shapeBuild()
.setCornerRadius(radios)

@ -77,7 +77,7 @@ class BadgeView @JvmOverloads constructor(
init {
val typedArray = context.obtainStyledAttributes(attrs, R.styleable.BadgeView)
val radios =
typedArray.getDimensionPixelOffset(R.styleable.BadgeView_bv_radius, 8)
typedArray.getDimensionPixelOffset(R.styleable.BadgeView_radius, 8)
flatangle =
typedArray.getBoolean(R.styleable.BadgeView_up_flat_angle, false)
typedArray.recycle()

@ -96,7 +96,7 @@
android:paddingRight="5dp"
android:text="@string/change_origin"
android:textSize="16sp"
app:bg_radius="2dp" />
app:radius="2dp" />
</LinearLayout>
@ -118,7 +118,7 @@
android:singleLine="true"
android:text="@string/app_name"
android:textSize="14sp"
app:bg_radius="2dp" />
app:radius="2dp" />
<io.legado.app.ui.widget.text.AccentBgTextView
android:id="@+id/tv_kind_1"
@ -129,7 +129,7 @@
android:singleLine="true"
android:text="@string/app_name"
android:textSize="14sp"
app:bg_radius="2dp" />
app:radius="2dp" />
<io.legado.app.ui.widget.text.AccentBgTextView
android:id="@+id/tv_kind_2"
@ -141,7 +141,7 @@
android:singleLine="true"
android:text="@string/app_name"
android:textSize="14sp"
app:bg_radius="2dp" />
app:radius="2dp" />
</LinearLayout>

@ -55,7 +55,7 @@
android:layout_gravity="center"
android:includeFontPadding="false"
android:singleLine="true"
app:bv_radius="1dp"
app:radius="1dp"
app:up_flat_angle="true"
app:layout_constraintLeft_toLeftOf="@id/iv_cover"
app:layout_constraintBottom_toBottomOf="@id/iv_cover"

@ -68,7 +68,7 @@
android:text="TXT"
android:maxLines="1"
android:maxWidth="50dp"
app:bg_radius="2dp"
app:radius="2dp"
tools:ignore="HardcodedText,RtlHardcoded" />
<TextView

@ -74,7 +74,7 @@
android:singleLine="true"
android:text="@string/app_name"
android:textSize="12sp"
app:bg_radius="2dp" />
app:radius="2dp" />
<io.legado.app.ui.widget.text.AccentBgTextView
android:id="@+id/tv_kind_1"
@ -86,7 +86,7 @@
android:singleLine="true"
android:text="@string/app_name"
android:textSize="12sp"
app:bg_radius="2dp" />
app:radius="2dp" />
<io.legado.app.ui.widget.text.AccentBgTextView
android:id="@+id/tv_kind_2"
@ -98,7 +98,7 @@
android:singleLine="true"
android:text="@string/app_name"
android:textSize="12sp"
app:bg_radius="2dp" />
app:radius="2dp" />
</LinearLayout>

@ -1,6 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<attr name="radius" format="dimension" />
<declare-styleable name="TitleBar">
<attr name="title"/>
<attr name="subtitle"/>
@ -102,7 +104,7 @@
</declare-styleable>
<declare-styleable name="FilletImageView">
<attr name="radius" format="dimension"/>
<attr name="radius" />
<attr name="left_top_radius" format="dimension"/>
<attr name="right_top_radius" format="dimension"/>
<attr name="right_bottom_radius" format="dimension"/>
@ -145,11 +147,11 @@
</declare-styleable>
<declare-styleable name="AccentBgTextView">
<attr name="bg_radius" format="dimension" />
<attr name="radius" />
</declare-styleable>
<declare-styleable name="BadgeView">
<attr name="bv_radius" format="dimension" />
<attr name="radius" />
<attr name="up_flat_angle" format="boolean" />
</declare-styleable>
</resources>
Loading…
Cancel
Save