Fixes for api<23
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package org.koitharu.kotatsu.base.ui.widgets
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.content.res.ColorStateList
|
||||
import android.content.res.TypedArray
|
||||
@@ -14,10 +15,12 @@ import androidx.annotation.AttrRes
|
||||
import androidx.appcompat.widget.AppCompatCheckedTextView
|
||||
import androidx.core.content.res.use
|
||||
import androidx.core.content.withStyledAttributes
|
||||
import com.google.android.material.ripple.RippleUtils
|
||||
import com.google.android.material.shape.MaterialShapeDrawable
|
||||
import com.google.android.material.shape.ShapeAppearanceModel
|
||||
import org.koitharu.kotatsu.R
|
||||
|
||||
@SuppressLint("RestrictedApi")
|
||||
class ListItemTextView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
@@ -33,9 +36,12 @@ class ListItemTextView @JvmOverloads constructor(
|
||||
|
||||
init {
|
||||
context.withStyledAttributes(attrs, R.styleable.ListItemTextView, defStyleAttr) {
|
||||
val itemRippleColor = getColorStateList(R.styleable.ListItemTextView_rippleColor)
|
||||
?: getRippleColorFallback(context)
|
||||
val shape = createShapeDrawable(this)
|
||||
background = RippleDrawable(
|
||||
getColorStateList(R.styleable.ListItemTextView_rippleColor) ?: getRippleColorFallback(context),
|
||||
createShapeDrawable(this),
|
||||
RippleUtils.sanitizeRippleDrawableColor(itemRippleColor),
|
||||
shape,
|
||||
ShapeDrawable(RectShape()),
|
||||
)
|
||||
checkedDrawableStart = getDrawable(R.styleable.ListItemTextView_checkedDrawableStart)
|
||||
|
||||
@@ -286,7 +286,7 @@ class ReaderActivity : BaseFullscreenActivity<ActivityReaderBinding>(),
|
||||
|
||||
private fun onPageSaved(uri: Uri?) {
|
||||
if (uri != null) {
|
||||
Snackbar.make(binding.container, R.string.page_saved, Snackbar.LENGTH_INDEFINITE)
|
||||
Snackbar.make(binding.container, R.string.page_saved, Snackbar.LENGTH_LONG)
|
||||
.setAnchorView(binding.appbarBottom)
|
||||
.setAction(R.string.share) {
|
||||
ShareHelper(this).shareImage(uri)
|
||||
|
||||
@@ -6,6 +6,7 @@ import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.viewbinding.ViewBinding
|
||||
import org.koitharu.kotatsu.core.exceptions.resolve.ExceptionResolver
|
||||
import org.koitharu.kotatsu.core.prefs.AppSettings
|
||||
import org.koitharu.kotatsu.databinding.LayoutPageInfoBinding
|
||||
import org.koitharu.kotatsu.reader.domain.PageLoader
|
||||
|
||||
abstract class BasePageHolder<B : ViewBinding>(
|
||||
@@ -16,6 +17,7 @@ abstract class BasePageHolder<B : ViewBinding>(
|
||||
) : RecyclerView.ViewHolder(binding.root), PageHolderDelegate.Callback {
|
||||
|
||||
protected val delegate = PageHolderDelegate(loader, settings, this, exceptionResolver)
|
||||
protected val bindingInfo = LayoutPageInfoBinding.bind(binding.root)
|
||||
|
||||
val context: Context
|
||||
get() = itemView.context
|
||||
|
||||
@@ -15,8 +15,7 @@ import org.koitharu.kotatsu.databinding.ItemPageBinding
|
||||
import org.koitharu.kotatsu.reader.domain.PageLoader
|
||||
import org.koitharu.kotatsu.reader.ui.pager.BasePageHolder
|
||||
import org.koitharu.kotatsu.reader.ui.pager.ReaderPage
|
||||
import org.koitharu.kotatsu.utils.ext.getDisplayMessage
|
||||
import org.koitharu.kotatsu.utils.ext.ifZero
|
||||
import org.koitharu.kotatsu.utils.ext.*
|
||||
|
||||
open class PageHolder(
|
||||
binding: ItemPageBinding,
|
||||
@@ -29,7 +28,7 @@ open class PageHolder(
|
||||
init {
|
||||
binding.ssiv.setOnImageEventListener(delegate)
|
||||
@Suppress("LeakingThis")
|
||||
binding.buttonRetry.setOnClickListener(this)
|
||||
bindingInfo.buttonRetry.setOnClickListener(this)
|
||||
binding.textViewNumber.isVisible = settings.isPagesNumbersEnabled
|
||||
}
|
||||
|
||||
@@ -45,17 +44,17 @@ open class PageHolder(
|
||||
}
|
||||
|
||||
override fun onLoadingStarted() {
|
||||
binding.layoutError.isVisible = false
|
||||
binding.progressBar.isVisible = true
|
||||
bindingInfo.layoutError.isVisible = false
|
||||
bindingInfo.progressBar.showCompat()
|
||||
binding.ssiv.recycle()
|
||||
}
|
||||
|
||||
override fun onProgressChanged(progress: Int) {
|
||||
if (progress in 0..100) {
|
||||
binding.progressBar.isIndeterminate = false
|
||||
binding.progressBar.setProgressCompat(progress, true)
|
||||
bindingInfo.progressBar.isIndeterminate = false
|
||||
bindingInfo.progressBar.setProgressCompat(progress, true)
|
||||
} else {
|
||||
binding.progressBar.isIndeterminate = true
|
||||
bindingInfo.progressBar.isIndeterminate = true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,7 +99,7 @@ open class PageHolder(
|
||||
}
|
||||
|
||||
override fun onImageShown() {
|
||||
binding.progressBar.isVisible = false
|
||||
bindingInfo.progressBar.hideCompat()
|
||||
}
|
||||
|
||||
override fun onClick(v: View) {
|
||||
@@ -110,11 +109,11 @@ open class PageHolder(
|
||||
}
|
||||
|
||||
override fun onError(e: Throwable) {
|
||||
binding.textViewError.text = e.getDisplayMessage(context.resources)
|
||||
binding.buttonRetry.setText(
|
||||
bindingInfo.textViewError.text = e.getDisplayMessage(context.resources)
|
||||
bindingInfo.buttonRetry.setText(
|
||||
ExceptionResolver.getResolveStringId(e).ifZero { R.string.try_again }
|
||||
)
|
||||
binding.layoutError.isVisible = true
|
||||
binding.progressBar.isVisible = false
|
||||
bindingInfo.layoutError.isVisible = true
|
||||
bindingInfo.progressBar.hideCompat()
|
||||
}
|
||||
}
|
||||
@@ -13,8 +13,7 @@ import org.koitharu.kotatsu.databinding.ItemPageWebtoonBinding
|
||||
import org.koitharu.kotatsu.reader.domain.PageLoader
|
||||
import org.koitharu.kotatsu.reader.ui.pager.BasePageHolder
|
||||
import org.koitharu.kotatsu.reader.ui.pager.ReaderPage
|
||||
import org.koitharu.kotatsu.utils.ext.getDisplayMessage
|
||||
import org.koitharu.kotatsu.utils.ext.ifZero
|
||||
import org.koitharu.kotatsu.utils.ext.*
|
||||
|
||||
|
||||
class WebtoonHolder(
|
||||
@@ -29,7 +28,7 @@ class WebtoonHolder(
|
||||
|
||||
init {
|
||||
binding.ssiv.setOnImageEventListener(delegate)
|
||||
binding.buttonRetry.setOnClickListener(this)
|
||||
bindingInfo.buttonRetry.setOnClickListener(this)
|
||||
}
|
||||
|
||||
override fun onBind(data: ReaderPage) {
|
||||
@@ -42,17 +41,17 @@ class WebtoonHolder(
|
||||
}
|
||||
|
||||
override fun onLoadingStarted() {
|
||||
binding.layoutError.isVisible = false
|
||||
binding.progressBar.isVisible = true
|
||||
bindingInfo.layoutError.isVisible = false
|
||||
bindingInfo.progressBar.showCompat()
|
||||
binding.ssiv.recycle()
|
||||
}
|
||||
|
||||
override fun onProgressChanged(progress: Int) {
|
||||
if (progress in 0..100) {
|
||||
binding.progressBar.isIndeterminate = false
|
||||
binding.progressBar.setProgressCompat(progress, true)
|
||||
bindingInfo.progressBar.isIndeterminate = false
|
||||
bindingInfo.progressBar.setProgressCompat(progress, true)
|
||||
} else {
|
||||
binding.progressBar.isIndeterminate = true
|
||||
bindingInfo.progressBar.isIndeterminate = true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +76,7 @@ class WebtoonHolder(
|
||||
}
|
||||
|
||||
override fun onImageShown() {
|
||||
binding.progressBar.isVisible = false
|
||||
bindingInfo.progressBar.hideCompat()
|
||||
}
|
||||
|
||||
override fun onClick(v: View) {
|
||||
@@ -87,12 +86,12 @@ class WebtoonHolder(
|
||||
}
|
||||
|
||||
override fun onError(e: Throwable) {
|
||||
binding.textViewError.text = e.getDisplayMessage(context.resources)
|
||||
binding.buttonRetry.setText(
|
||||
bindingInfo.textViewError.text = e.getDisplayMessage(context.resources)
|
||||
bindingInfo.buttonRetry.setText(
|
||||
ExceptionResolver.getResolveStringId(e).ifZero { R.string.try_again }
|
||||
)
|
||||
binding.layoutError.isVisible = true
|
||||
binding.progressBar.isVisible = false
|
||||
bindingInfo.layoutError.isVisible = true
|
||||
bindingInfo.progressBar.hideCompat()
|
||||
}
|
||||
|
||||
fun getScrollY() = binding.ssiv.getScroll()
|
||||
|
||||
@@ -42,7 +42,7 @@ class SettingsActivity :
|
||||
|
||||
override fun onTitleChanged(title: CharSequence?, color: Int) {
|
||||
super.onTitleChanged(title, color)
|
||||
binding.collapsingToolbarLayout.title = title
|
||||
binding.collapsingToolbarLayout?.title = title
|
||||
}
|
||||
|
||||
override fun onStart() {
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package org.koitharu.kotatsu.utils.ext
|
||||
|
||||
import android.os.Build
|
||||
import android.widget.ProgressBar
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.core.widget.ContentLoadingProgressBar
|
||||
import com.google.android.material.progressindicator.BaseProgressIndicator
|
||||
|
||||
fun ProgressBar.setProgressCompat(progress: Int, animate: Boolean) = when {
|
||||
this is BaseProgressIndicator<*> -> setProgressCompat(progress, animate)
|
||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.N -> setProgress(progress, animate)
|
||||
else -> setProgress(progress)
|
||||
}
|
||||
|
||||
fun ProgressBar.showCompat() = when (this) {
|
||||
is BaseProgressIndicator<*> -> show()
|
||||
is ContentLoadingProgressBar -> show()
|
||||
else -> isVisible = true
|
||||
}
|
||||
|
||||
fun ProgressBar.hideCompat() = when (this) {
|
||||
is BaseProgressIndicator<*> -> hide()
|
||||
is ContentLoadingProgressBar -> hide()
|
||||
else -> isVisible = false
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:alpha="0.3" android:color="?colorPrimary" android:state_checked="true"/>
|
||||
<item android:color="@android:color/transparent"/>
|
||||
</selector>
|
||||
4
app/src/main/res/color-v23/selector_overlay.xml
Normal file
4
app/src/main/res/color-v23/selector_overlay.xml
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:alpha="0.2" android:color="?colorPrimary" />
|
||||
</selector>
|
||||
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:alpha="0.3" android:color="?attr/colorPrimary" android:state_checked="true"/>
|
||||
<!-- https://stackoverflow.com/questions/54685474/theme-attributes-in-color-selector-for-api-22 -->
|
||||
<item android:alpha="0.3" android:color="@color/kotatsu_primary" android:state_checked="true"/>
|
||||
<item android:color="@android:color/transparent"/>
|
||||
</selector>
|
||||
@@ -1,4 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:alpha="0.2" android:color="?attr/colorPrimary" />
|
||||
<!-- https://stackoverflow.com/questions/54685474/theme-attributes-in-color-selector-for-api-22 -->
|
||||
<item android:alpha="0.2" android:color="@color/kotatsu_primary" />
|
||||
</selector>
|
||||
16
app/src/main/res/layout-v23/item_loading_footer.xml
Normal file
16
app/src/main/res/layout-v23/item_loading_footer.xml
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/list_footer_height_outer">
|
||||
|
||||
<com.google.android.material.progressindicator.CircularProgressIndicator
|
||||
android:id="@+id/progressBar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:indeterminate="true"
|
||||
app:indicatorSize="@dimen/list_footer_height_inner" />
|
||||
|
||||
</FrameLayout>
|
||||
14
app/src/main/res/layout-v23/item_loading_state.xml
Normal file
14
app/src/main/res/layout-v23/item_loading_state.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="?actionBarSize">
|
||||
|
||||
<com.google.android.material.progressindicator.CircularProgressIndicator
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:indeterminate="true" />
|
||||
|
||||
</FrameLayout>
|
||||
50
app/src/main/res/layout-v23/layout_page_info.xml
Normal file
50
app/src/main/res/layout-v23/layout_page_info.xml
Normal file
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<merge
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:parentTag="android.widget.FrameLayout">
|
||||
|
||||
<com.google.android.material.progressindicator.CircularProgressIndicator
|
||||
android:id="@+id/progressBar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:indeterminate="true"
|
||||
android:max="100"
|
||||
tools:viewBindingType="android.widget.ProgressBar" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/layout_error"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="60dp"
|
||||
android:layout_marginEnd="60dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView_error"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawablePadding="12dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:textAlignment="center"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
app:drawableTopCompat="@drawable/ic_error_large"
|
||||
tools:text="@tools:sample/lorem[6]" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_retry"
|
||||
style="@style/Widget.Material3.Button.TonalButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="@string/try_again" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</merge>
|
||||
@@ -10,29 +10,20 @@
|
||||
android:id="@+id/appbar"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:fitsSystemWindows="true"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<com.google.android.material.appbar.CollapsingToolbarLayout
|
||||
android:id="@+id/collapsingToolbarLayout"
|
||||
<com.google.android.material.appbar.MaterialToolbar
|
||||
android:id="@id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/toolbar_height_expanded"
|
||||
app:toolbarId="@id/toolbar"
|
||||
app:layout_scrollFlags="scroll|exitUntilCollapsed">
|
||||
|
||||
<com.google.android.material.appbar.MaterialToolbar
|
||||
android:id="@id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
app:layout_collapseMode="pin" />
|
||||
|
||||
</com.google.android.material.appbar.CollapsingToolbarLayout>
|
||||
|
||||
android:layout_height="?attr/actionBarSize" />
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
style="?materialCardViewOutlinedStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="12dp"
|
||||
|
||||
@@ -31,120 +31,116 @@
|
||||
tools:background="@tools:sample/backgrounds/scenic"
|
||||
tools:ignore="ContentDescription,UnusedAttribute" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView_title"
|
||||
<LinearLayout
|
||||
android:id="@+id/layout_titles"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="3"
|
||||
android:textAppearance="?attr/textAppearanceHeadlineSmall"
|
||||
android:layout_height="0dp"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toBottomOf="@id/imageView_cover"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/imageView_cover"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="@tools:sample/lorem[15]" />
|
||||
app:layout_constraintVertical_bias="0">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView_subtitle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="3"
|
||||
android:textAppearance="?attr/textAppearanceBodyMedium"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/imageView_cover"
|
||||
app:layout_constraintTop_toBottomOf="@id/textView_title"
|
||||
tools:text="@tools:sample/lorem[12]" />
|
||||
<TextView
|
||||
android:id="@+id/textView_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="3"
|
||||
android:textAppearance="?attr/textAppearanceHeadlineSmall"
|
||||
tools:text="@tools:sample/lorem[15]" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView_author"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:background="@drawable/list_selector"
|
||||
android:padding="2dp"
|
||||
android:singleLine="true"
|
||||
android:textColor="?attr/colorTertiary"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0"
|
||||
app:layout_constraintStart_toEndOf="@id/imageView_cover"
|
||||
app:layout_constraintTop_toBottomOf="@id/textView_subtitle"
|
||||
app:layout_constraintWidth_default="wrap"
|
||||
tools:text="@tools:sample/full_names" />
|
||||
<TextView
|
||||
android:id="@+id/textView_subtitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="3"
|
||||
android:textAppearance="?attr/textAppearanceBodyMedium"
|
||||
tools:text="@tools:sample/lorem[12]" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView_state"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:drawablePadding="4dp"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?attr/textAppearanceBodySmall"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/imageView_cover"
|
||||
app:layout_constraintTop_toBottomOf="@id/textView_author"
|
||||
tools:drawableStart="@drawable/ic_state_finished"
|
||||
tools:text="Finished" />
|
||||
<TextView
|
||||
android:id="@+id/textView_author"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="14dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:background="@drawable/list_selector"
|
||||
android:padding="2dp"
|
||||
android:singleLine="true"
|
||||
android:textColor="?attr/colorTertiary"
|
||||
android:textStyle="bold"
|
||||
tools:text="@tools:sample/full_names" />
|
||||
|
||||
<androidx.constraintlayout.widget.Barrier
|
||||
android:id="@+id/barrier_header"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:barrierDirection="bottom"
|
||||
app:barrierMargin="8dp"
|
||||
app:constraint_referenced_ids="imageView_cover,button_read" />
|
||||
<TextView
|
||||
android:id="@+id/textView_state"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:drawablePadding="4dp"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?attr/textAppearanceBodySmall"
|
||||
tools:drawableStart="@drawable/ic_state_finished"
|
||||
tools:text="Finished" />
|
||||
|
||||
<include
|
||||
android:id="@+id/info_layout"
|
||||
layout="@layout/layout_details_info"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/imageView_cover"
|
||||
app:layout_constraintTop_toBottomOf="@id/textView_state" />
|
||||
<Space
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/button_favorite"
|
||||
style="@style/Widget.Material3.Button.OutlinedButton"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:paddingStart="0dp"
|
||||
android:paddingEnd="0dp"
|
||||
app:icon="@drawable/ic_heart_outline"
|
||||
app:iconGravity="textTop"
|
||||
app:iconPadding="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/button_read"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:layout_constraintStart_toEndOf="@id/imageView_cover"
|
||||
app:layout_constraintTop_toTopOf="@id/button_read" />
|
||||
<include
|
||||
android:id="@+id/info_layout"
|
||||
layout="@layout/layout_details_info"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/button_read"
|
||||
style="@style/Widget.Material3.Button.TonalButton"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:enabled="false"
|
||||
android:text="@string/read"
|
||||
android:textAllCaps="false"
|
||||
app:iconGravity="textStart"
|
||||
app:iconPadding="8dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/button_favorite"
|
||||
app:layout_constraintTop_toBottomOf="@id/info_layout"
|
||||
tools:text="@string/_continue" />
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/button_favorite"
|
||||
style="@style/Widget.Material3.Button.OutlinedButton"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:paddingStart="0dp"
|
||||
android:paddingEnd="0dp"
|
||||
app:icon="@drawable/ic_heart_outline"
|
||||
app:iconGravity="textTop"
|
||||
app:iconPadding="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/button_read"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/button_read" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/button_read"
|
||||
style="@style/Widget.Material3.Button.TonalButton"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:enabled="false"
|
||||
android:text="@string/read"
|
||||
android:textAllCaps="false"
|
||||
app:iconGravity="textStart"
|
||||
app:iconPadding="8dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/button_favorite"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="@string/_continue" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<org.koitharu.kotatsu.base.ui.widgets.ChipsView
|
||||
android:id="@+id/chips_tags"
|
||||
@@ -157,7 +153,7 @@
|
||||
app:chipSpacingVertical="6dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/barrier_header" />
|
||||
app:layout_constraintTop_toBottomOf="@+id/layout_titles" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView_description"
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:visibility="gone"
|
||||
tools:listitem="@layout/item_branch"
|
||||
tools:visibility="visible" />
|
||||
@@ -73,6 +74,7 @@
|
||||
android:id="@+id/guideline"
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginBottom="6dp"
|
||||
android:background="?colorOutline"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_marginHorizontal="32dp"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
android:paddingHorizontal="32dp"
|
||||
android:paddingBottom="?actionBarSize">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon"
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp">
|
||||
android:padding="16dp"
|
||||
android:paddingBottom="?actionBarSize">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView_error"
|
||||
@@ -15,16 +16,17 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:drawablePadding="12dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:textAlignment="center"
|
||||
android:textAppearance="?attr/textAppearanceBodySmall"
|
||||
app:drawableTopCompat="@drawable/ic_error_large"
|
||||
tools:text="@tools:sample/lorem[6]" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_retry"
|
||||
style="@style/Widget.Material3.Button.TonalButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
style="@style/Widget.Material3.Button.TonalButton"
|
||||
android:text="@string/try_again" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -1,16 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/list_footer_height_outer">
|
||||
|
||||
<com.google.android.material.progressindicator.CircularProgressIndicator
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="@dimen/list_footer_height_inner"
|
||||
android:layout_height="@dimen/list_footer_height_inner"
|
||||
android:layout_gravity="center"
|
||||
android:indeterminate="true"
|
||||
app:indicatorSize="@dimen/list_footer_height_inner" />
|
||||
android:indeterminate="true" />
|
||||
|
||||
</FrameLayout>
|
||||
@@ -2,9 +2,10 @@
|
||||
<FrameLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="?actionBarSize">
|
||||
|
||||
<com.google.android.material.progressindicator.CircularProgressIndicator
|
||||
<ProgressBar
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
@@ -12,14 +11,6 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<com.google.android.material.progressindicator.CircularProgressIndicator
|
||||
android:id="@+id/progressBar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:indeterminate="true"
|
||||
android:max="100" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView_number"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -31,35 +22,6 @@
|
||||
android:textColor="?android:textColorTertiary"
|
||||
tools:text="5" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/layout_error"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="60dp"
|
||||
android:layout_marginEnd="60dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView_error"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawablePadding="12dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:textAppearance="?attr/textAppearanceBodySmall"
|
||||
app:drawableTopCompat="@drawable/ic_error_large"
|
||||
tools:text="@tools:sample/lorem[6]" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_retry"
|
||||
style="@style/Widget.Material3.Button.TonalButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="@string/try_again" />
|
||||
|
||||
</LinearLayout>
|
||||
<include layout="@layout/layout_page_info" />
|
||||
|
||||
</FrameLayout>
|
||||
@@ -2,7 +2,6 @@
|
||||
<org.koitharu.kotatsu.reader.ui.pager.webtoon.WebtoonFrameLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
@@ -14,44 +13,6 @@
|
||||
app:quickScaleEnabled="false"
|
||||
app:zoomEnabled="false" />
|
||||
|
||||
<com.google.android.material.progressindicator.CircularProgressIndicator
|
||||
android:id="@+id/progressBar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:indeterminate="true"
|
||||
android:max="100" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/layout_error"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="60dp"
|
||||
android:layout_marginEnd="60dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView_error"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawablePadding="12dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
app:drawableTopCompat="@drawable/ic_error_large"
|
||||
tools:text="@tools:sample/lorem[6]" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_retry"
|
||||
style="@style/Widget.Material3.Button.TonalButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="@string/try_again" />
|
||||
|
||||
</LinearLayout>
|
||||
<include layout="@layout/layout_page_info" />
|
||||
|
||||
</org.koitharu.kotatsu.reader.ui.pager.webtoon.WebtoonFrameLayout>
|
||||
51
app/src/main/res/layout/layout_page_info.xml
Normal file
51
app/src/main/res/layout/layout_page_info.xml
Normal file
@@ -0,0 +1,51 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<merge
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:parentTag="android.widget.FrameLayout">
|
||||
|
||||
<!-- https://github.com/material-components/material-components-android/issues/2028 -->
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:indeterminate="true"
|
||||
android:max="100"
|
||||
tools:viewBindingType="android.widget.ProgressBar" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/layout_error"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="60dp"
|
||||
android:layout_marginEnd="60dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView_error"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawablePadding="12dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:textAlignment="center"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
app:drawableTopCompat="@drawable/ic_error_large"
|
||||
tools:text="@tools:sample/lorem[6]" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_retry"
|
||||
style="@style/Widget.Material3.Button.TonalButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="@string/try_again" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</merge>
|
||||
@@ -44,7 +44,7 @@
|
||||
|
||||
<!-- Themes -->
|
||||
<item name="android:windowLightStatusBar" tools:targetApi="M">@bool/light_status_bar</item>
|
||||
<item name="android:statusBarColor">@color/surface_amoled</item>
|
||||
<item name="android:statusBarColor">@color/dim</item>
|
||||
<item name="android:navigationBarColor">@color/surface_amoled</item>
|
||||
<item name="android:navigationBarDividerColor" tools:targetApi="o_mr1">@null</item>
|
||||
<item name="android:enforceNavigationBarContrast" tools:targetApi="Q">false</item>
|
||||
|
||||
Reference in New Issue
Block a user