pull/43/head
kunfei 5 years ago
parent 43888434d5
commit 18929ae2d0
  1. 2
      app/src/main/java/io/legado/app/ui/main/explore/ExploreAdapter.kt
  2. 17
      app/src/main/java/io/legado/app/ui/widget/anima/RotateLoading.kt
  3. 1
      app/src/main/res/layout/item_find_book.xml
  4. 1
      app/src/main/res/layout/view_load_more.xml
  5. 6
      app/src/main/res/values/attrs.xml

@ -92,7 +92,7 @@ class ExploreAdapter(context: Context, private val scope: CoroutineScope, val ca
}
} else {
iv_status.setImageResource(R.drawable.ic_add)
rotate_loading.hide()
rotate_loading.hide(View.GONE)
gl_child.gone()
}
}

@ -34,6 +34,8 @@ class RotateLoading : View {
private var shadowPosition: Int = 0
var hideMode = GONE
var isStarted = false
private set
@ -49,7 +51,7 @@ class RotateLoading : View {
private val shown = Runnable { this.startInternal() }
private val hidden = Runnable { this.stopInternal(GONE) }
private val hidden = Runnable { this.stopInternal() }
constructor(context: Context) : super(context) {
initView(context, null)
@ -78,6 +80,7 @@ class RotateLoading : View {
)
shadowPosition = typedArray.getInt(R.styleable.RotateLoading_shadow_position, DEFAULT_SHADOW_POSITION)
speedOfDegree = typedArray.getInt(R.styleable.RotateLoading_loading_speed, DEFAULT_SPEED_OF_DEGREE)
hideMode = typedArray.getInt(R.styleable.RotateLoading_hide_mode, GONE)
typedArray.recycle()
}
speedOfArc = (speedOfDegree / 4).toFloat()
@ -176,10 +179,10 @@ class RotateLoading : View {
post(shown)
}
fun hide(visibility: Int = INVISIBLE) {
fun hide() {
removeCallbacks(shown)
removeCallbacks(hidden)
stopInternal(visibility)
stopInternal()
}
private fun startInternal() {
@ -188,8 +191,8 @@ class RotateLoading : View {
invalidate()
}
private fun stopInternal(visibility: Int = INVISIBLE) {
stopAnimator(visibility)
private fun stopInternal() {
stopAnimator()
invalidate()
}
@ -205,10 +208,10 @@ class RotateLoading : View {
.start()
}
private fun stopAnimator(visibility: Int = INVISIBLE) {
private fun stopAnimator() {
animate().cancel()
isStarted = false
this.visibility = visibility
this.visibility = hideMode
}
companion object {

@ -64,6 +64,7 @@
android:layout_height="36dp"
android:visibility="gone"
android:layout_gravity="center"
app:hide_mode="gone"
app:loading_width="2dp" />
</FrameLayout>

@ -12,6 +12,7 @@
android:layout_margin="6dp"
android:layout_gravity="center"
android:visibility="invisible"
app:hide_mode="invisible"
app:loading_width="2dp" />
<TextView

@ -113,6 +113,12 @@
<attr name="loading_color" format="color"/>
<attr name="shadow_position" format="integer"/>
<attr name="loading_speed" format="integer"/>
<attr name="hide_mode">
<!-- Not displayed, but taken into account during layout (space is left for it). -->
<enum name="invisible" value="1" />
<!-- Completely hidden, as if the view had not been added. -->
<enum name="gone" value="2" />
</attr>
</declare-styleable>
<declare-styleable name="CircleImageView">

Loading…
Cancel
Save