update TitleBar

pull/32/head
Administrator 5 years ago
parent 16b4932a01
commit f8c9393405
  1. 31
      app/src/main/java/io/legado/app/ui/widget/TitleBar.kt
  2. 5
      app/src/main/res/layout/activity_book_source.xml
  3. 154
      app/src/main/res/values/attrs.xml

@ -86,6 +86,37 @@ class TitleBar(context: Context, attrs: AttributeSet?) : AppBarLayout(context, a
this.setSubtitleTextColor(a.getColor(R.styleable.TitleBar_subtitleTextColor, -0x1))
}
if (a.hasValue(R.styleable.TitleBar_contentInsetLeft)
|| a.hasValue(R.styleable.TitleBar_contentInsetRight)
) {
this.setContentInsetsAbsolute(
a.getDimensionPixelSize(R.styleable.TitleBar_contentInsetLeft, 0),
a.getDimensionPixelSize(R.styleable.TitleBar_contentInsetRight, 0)
)
}
if (a.hasValue(R.styleable.TitleBar_contentInsetStart)
|| a.hasValue(R.styleable.TitleBar_contentInsetEnd)
) {
this.setContentInsetsRelative(
a.getDimensionPixelSize(R.styleable.TitleBar_contentInsetStart, 0),
a.getDimensionPixelSize(R.styleable.TitleBar_contentInsetEnd, 0)
)
}
if (a.hasValue(R.styleable.TitleBar_contentInsetStartWithNavigation)) {
this.contentInsetStartWithNavigation = a.getDimensionPixelOffset(
R.styleable.TitleBar_contentInsetStartWithNavigation, 0
)
}
if (a.hasValue(R.styleable.TitleBar_contentInsetEndWithActions)) {
this.contentInsetEndWithActions = a.getDimensionPixelOffset(
R.styleable.TitleBar_contentInsetEndWithActions, 0
)
}
if (!titleText.isNullOrBlank()) {
this.title = titleText
}

@ -9,12 +9,13 @@
android:id="@+id/title_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:contentInsetStartWithNavigation="0dp"
app:displayHomeAsUp="true"
app:title="@string/book_source" />
app:title="@string/book_source"/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
android:layout_height="match_parent"/>
</LinearLayout>

@ -2,109 +2,115 @@
<resources>
<declare-styleable name="TitleBar">
<attr name="title" />
<attr name="subtitle" />
<attr name="titleTextAppearance" />
<attr name="titleTextColor" />
<attr name="subtitleTextAppearance" />
<attr name="subtitleTextColor" />
<attr name="attachToActivity" format="boolean" />
<attr name="displayHomeAsUp" format="boolean" />
<attr name="navigationIcon" format="reference" />
<attr name="fitStatusBar" format="boolean" />
<attr name="fitNavigationBar" format="boolean" />
<attr name="navigationContentDescription" format="reference|string" />
<attr name="navigationIconTint" format="color|reference" />
<attr name="title"/>
<attr name="subtitle"/>
<attr name="titleTextAppearance"/>
<attr name="titleTextColor"/>
<attr name="subtitleTextAppearance"/>
<attr name="subtitleTextColor"/>
<attr name="contentInsetEnd"/>
<attr name="contentInsetEndWithActions"/>
<attr name="contentInsetStart"/>
<attr name="contentInsetStartWithNavigation"/>
<attr name="contentInsetLeft"/>
<attr name="contentInsetRight"/>
<attr name="attachToActivity" format="boolean"/>
<attr name="displayHomeAsUp" format="boolean"/>
<attr name="navigationIcon" format="reference"/>
<attr name="fitStatusBar" format="boolean"/>
<attr name="fitNavigationBar" format="boolean"/>
<attr name="navigationContentDescription" format="reference|string"/>
<attr name="navigationIconTint" format="color|reference"/>
<attr name="navigationIconTintMode" format="enum">
<enum name="clear" value="0" />
<enum name="src" value="1" />
<enum name="dst" value="2" />
<enum name="src_over" value="3" />
<enum name="dst_over" value="4" />
<enum name="src_in" value="5" />
<enum name="dst_in" value="6" />
<enum name="src_out" value="7" />
<enum name="dst_out" value="8" />
<enum name="src_atop" value="9" />
<enum name="dst_atop" value="10" />
<enum name="xor" value="11" />
<enum name="darken" value="16" />
<enum name="lighten" value="17" />
<enum name="multiply" value="13" />
<enum name="screen" value="14" />
<enum name="add" value="12" />
<enum name="overlay" value="15" />
<enum name="clear" value="0"/>
<enum name="src" value="1"/>
<enum name="dst" value="2"/>
<enum name="src_over" value="3"/>
<enum name="dst_over" value="4"/>
<enum name="src_in" value="5"/>
<enum name="dst_in" value="6"/>
<enum name="src_out" value="7"/>
<enum name="dst_out" value="8"/>
<enum name="src_atop" value="9"/>
<enum name="dst_atop" value="10"/>
<enum name="xor" value="11"/>
<enum name="darken" value="16"/>
<enum name="lighten" value="17"/>
<enum name="multiply" value="13"/>
<enum name="screen" value="14"/>
<enum name="add" value="12"/>
<enum name="overlay" value="15"/>
</attr>
</declare-styleable>
<attr name="titleBarStyle" format="reference" />
<attr name="titleBarStyle" format="reference"/>
<declare-styleable name="DynamicFrameLayout">
<attr name="errorSrc" format="reference" />
<attr name="emptySrc" format="reference" />
<attr name="errorActionDescription" format="string|reference" />
<attr name="emptyActionDescription" format="string|reference" />
<attr name="emptyDescription" format="string|reference" />
<attr name="errorSrc" format="reference"/>
<attr name="emptySrc" format="reference"/>
<attr name="errorActionDescription" format="string|reference"/>
<attr name="emptyActionDescription" format="string|reference"/>
<attr name="emptyDescription" format="string|reference"/>
</declare-styleable>
<declare-styleable name="RefreshProgressBar">
<attr name="max_progress" format="integer" />
<attr name="dur_progress" format="integer" />
<attr name="second_dur_progress" format="dimension" />
<attr name="second_max_progress" format="dimension" />
<attr name="bg_color" format="color" />
<attr name="second_color" format="color" />
<attr name="font_color" format="color" />
<attr name="speed" format="dimension" />
<attr name="max_progress" format="integer"/>
<attr name="dur_progress" format="integer"/>
<attr name="second_dur_progress" format="dimension"/>
<attr name="second_max_progress" format="dimension"/>
<attr name="bg_color" format="color"/>
<attr name="second_color" format="color"/>
<attr name="font_color" format="color"/>
<attr name="speed" format="dimension"/>
</declare-styleable>
<declare-styleable name="SmoothCheckBox">
<attr name="duration" format="integer" />
<attr name="stroke_width" format="dimension" />
<attr name="color_tick" format="color" />
<attr name="color_checked" format="color" />
<attr name="color_unchecked" format="color" />
<attr name="color_unchecked_stroke" format="color" />
<attr name="duration" format="integer"/>
<attr name="stroke_width" format="dimension"/>
<attr name="color_tick" format="color"/>
<attr name="color_checked" format="color"/>
<attr name="color_unchecked" format="color"/>
<attr name="color_unchecked_stroke" format="color"/>
</declare-styleable>
<declare-styleable name="NumberPickerPreference">
<attr name="MinValue" format="integer" />
<attr name="MaxValue" format="integer" />
<attr name="android:summary" />
<attr name="MinValue" format="integer"/>
<attr name="MaxValue" format="integer"/>
<attr name="android:summary"/>
</declare-styleable>
<declare-styleable name="RefreshLayout">
<attr name="layout_refresh_empty" format="reference" />
<attr name="layout_refresh_error" format="reference" />
<attr name="layout_refresh_loading" format="reference" />
<attr name="layout_refresh_empty" format="reference"/>
<attr name="layout_refresh_error" format="reference"/>
<attr name="layout_refresh_loading" format="reference"/>
</declare-styleable>
<declare-styleable name="FastScroller">
<attr name="fadeScrollbar" format="boolean" />
<attr name="showBubble" format="boolean" />
<attr name="showTrack" format="boolean" />
<attr name="trackColor" format="color" />
<attr name="handleColor" format="color" />
<attr name="bubbleColor" format="color" />
<attr name="bubbleTextColor" format="color" />
<attr name="fadeScrollbar" format="boolean"/>
<attr name="showBubble" format="boolean"/>
<attr name="showTrack" format="boolean"/>
<attr name="trackColor" format="color"/>
<attr name="handleColor" format="color"/>
<attr name="bubbleColor" format="color"/>
<attr name="bubbleTextColor" format="color"/>
</declare-styleable>
<declare-styleable name="FilletImageView">
<attr name="radius" format="dimension" />
<attr name="left_top_radius" format="dimension" />
<attr name="right_top_radius" format="dimension" />
<attr name="right_bottom_radius" format="dimension" />
<attr name="left_bottom_radius" format="dimension" />
<attr name="radius" format="dimension"/>
<attr name="left_top_radius" format="dimension"/>
<attr name="right_top_radius" format="dimension"/>
<attr name="right_bottom_radius" format="dimension"/>
<attr name="left_bottom_radius" format="dimension"/>
</declare-styleable>
<declare-styleable name="IconListPreference">
<attr name="icons" format="reference" />
<attr name="icons" format="reference"/>
</declare-styleable>
<declare-styleable name="RotateLoading">
<attr name="loading_width" format="dimension" />
<attr name="loading_color" format="color" />
<attr name="shadow_position" format="integer" />
<attr name="loading_speed" format="integer" />
<attr name="loading_width" format="dimension"/>
<attr name="loading_color" format="color"/>
<attr name="shadow_position" format="integer"/>
<attr name="loading_speed" format="integer"/>
</declare-styleable>
</resources>
Loading…
Cancel
Save