Merge remote-tracking branch 'origin/next' into next
This commit is contained in:
@@ -0,0 +1,135 @@
|
||||
package org.koitharu.kotatsu.core.ui.widgets
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Outline
|
||||
import android.graphics.Rect
|
||||
import android.graphics.RectF
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewOutlineProvider
|
||||
import android.widget.LinearLayout
|
||||
import androidx.annotation.DrawableRes
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.content.withStyledAttributes
|
||||
import androidx.core.view.setPadding
|
||||
import com.google.android.material.shape.MaterialShapeDrawable
|
||||
import com.google.android.material.shape.ShapeAppearanceModel
|
||||
import org.koitharu.kotatsu.R
|
||||
import org.koitharu.kotatsu.core.util.ext.drawableStart
|
||||
import org.koitharu.kotatsu.core.util.ext.getDrawableCompat
|
||||
import org.koitharu.kotatsu.core.util.ext.getThemeColorStateList
|
||||
import org.koitharu.kotatsu.core.util.ext.setTextAndVisible
|
||||
import org.koitharu.kotatsu.core.util.ext.textAndVisible
|
||||
import org.koitharu.kotatsu.databinding.ViewTipBinding
|
||||
import com.google.android.material.R as materialR
|
||||
|
||||
class TipView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = R.attr.tipViewStyle,
|
||||
) : LinearLayout(context, attrs, defStyleAttr), View.OnClickListener {
|
||||
|
||||
private val binding = ViewTipBinding.inflate(LayoutInflater.from(context), this)
|
||||
|
||||
var title: CharSequence?
|
||||
get() = binding.textViewTitle.text
|
||||
set(value) {
|
||||
binding.textViewTitle.text = value
|
||||
}
|
||||
|
||||
var text: CharSequence?
|
||||
get() = binding.textViewBody.text
|
||||
set(value) {
|
||||
binding.textViewBody.text = value
|
||||
}
|
||||
|
||||
var icon: Drawable?
|
||||
get() = binding.textViewTitle.drawableStart
|
||||
set(value) {
|
||||
binding.textViewTitle.drawableStart = value
|
||||
}
|
||||
|
||||
var primaryButtonText: CharSequence?
|
||||
get() = binding.buttonPrimary.textAndVisible
|
||||
set(value) {
|
||||
binding.buttonPrimary.textAndVisible = value
|
||||
}
|
||||
|
||||
var secondaryButtonText: CharSequence?
|
||||
get() = binding.buttonSecondary.textAndVisible
|
||||
set(value) {
|
||||
binding.buttonSecondary.textAndVisible = value
|
||||
}
|
||||
|
||||
var onButtonClickListener: OnButtonClickListener? = null
|
||||
|
||||
init {
|
||||
orientation = VERTICAL
|
||||
setPadding(context.resources.getDimensionPixelOffset(R.dimen.margin_normal))
|
||||
context.withStyledAttributes(attrs, R.styleable.TipView, defStyleAttr) {
|
||||
title = getText(R.styleable.TipView_title)
|
||||
text = getText(R.styleable.TipView_android_text)
|
||||
icon = getDrawableCompat(context, R.styleable.TipView_icon)
|
||||
primaryButtonText = getString(R.styleable.TipView_primaryButtonText)
|
||||
secondaryButtonText = getString(R.styleable.TipView_secondaryButtonText)
|
||||
val shapeAppearanceModel = ShapeAppearanceModel.builder(context, attrs, defStyleAttr, 0).build()
|
||||
background = MaterialShapeDrawable(shapeAppearanceModel).also {
|
||||
it.fillColor = getColorStateList(R.styleable.TipView_cardBackgroundColor)
|
||||
?: context.getThemeColorStateList(materialR.attr.colorBackgroundFloating)
|
||||
it.strokeWidth = getDimension(R.styleable.TipView_strokeWidth, 0f)
|
||||
it.strokeColor = getColorStateList(R.styleable.TipView_strokeColor)
|
||||
it.elevation = getDimension(R.styleable.TipView_elevation, 0f)
|
||||
}
|
||||
outlineProvider = OutlineProvider(shapeAppearanceModel)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onClick(v: View) {
|
||||
when (v.id) {
|
||||
R.id.button_primary -> onButtonClickListener?.onPrimaryButtonClick(this)
|
||||
R.id.button_secondary -> onButtonClickListener?.onSecondaryButtonClick(this)
|
||||
}
|
||||
}
|
||||
|
||||
fun setTitle(@StringRes resId: Int) {
|
||||
binding.textViewTitle.setText(resId)
|
||||
}
|
||||
|
||||
fun setText(@StringRes resId: Int) {
|
||||
binding.textViewBody.setText(resId)
|
||||
}
|
||||
|
||||
fun setPrimaryButtonText(@StringRes resId: Int) {
|
||||
binding.buttonPrimary.setTextAndVisible(resId)
|
||||
}
|
||||
|
||||
fun setSecondaryButtonText(@StringRes resId: Int) {
|
||||
binding.buttonSecondary.setTextAndVisible(resId)
|
||||
}
|
||||
|
||||
fun setIcon(@DrawableRes resId: Int) {
|
||||
icon = ContextCompat.getDrawable(context, resId)
|
||||
}
|
||||
|
||||
interface OnButtonClickListener {
|
||||
|
||||
fun onPrimaryButtonClick(tipView: TipView)
|
||||
|
||||
fun onSecondaryButtonClick(tipView: TipView)
|
||||
}
|
||||
|
||||
private class OutlineProvider(
|
||||
shapeAppearanceModel: ShapeAppearanceModel,
|
||||
) : ViewOutlineProvider() {
|
||||
|
||||
private val shapeDrawable = MaterialShapeDrawable(shapeAppearanceModel)
|
||||
override fun getOutline(view: View, outline: Outline) {
|
||||
shapeDrawable.setBounds(0, 0, view.width, view.height)
|
||||
shapeDrawable.getOutline(outline)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,11 +1,16 @@
|
||||
package org.koitharu.kotatsu.core.util.ext
|
||||
|
||||
import android.content.Context
|
||||
import android.content.res.TypedArray
|
||||
import android.graphics.Color
|
||||
import android.graphics.drawable.Drawable
|
||||
import androidx.annotation.AttrRes
|
||||
import androidx.annotation.ColorInt
|
||||
import androidx.annotation.FloatRange
|
||||
import androidx.annotation.Px
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.content.res.ResourcesCompat
|
||||
import androidx.core.content.res.TypedArrayUtils
|
||||
import androidx.core.content.res.use
|
||||
import androidx.core.graphics.ColorUtils
|
||||
|
||||
@@ -60,3 +65,8 @@ fun Context.getThemeColorStateList(
|
||||
) = obtainStyledAttributes(intArrayOf(resId)).use {
|
||||
it.getColorStateList(0)
|
||||
}
|
||||
|
||||
fun TypedArray.getDrawableCompat(context: Context, index: Int): Drawable? {
|
||||
val resId = getResourceId(index, 0)
|
||||
return if (resId != 0) ContextCompat.getDrawable(context, resId) else null
|
||||
}
|
||||
|
||||
@@ -52,6 +52,7 @@ import org.koitharu.kotatsu.parsers.model.MangaState
|
||||
import org.koitharu.kotatsu.parsers.model.MangaTag
|
||||
import org.koitharu.kotatsu.reader.ui.ReaderActivity
|
||||
import org.koitharu.kotatsu.scrobbling.common.domain.model.ScrobblingInfo
|
||||
import org.koitharu.kotatsu.scrobbling.common.ui.selector.ScrobblingSelectorSheet
|
||||
import org.koitharu.kotatsu.search.ui.MangaListActivity
|
||||
import org.koitharu.kotatsu.search.ui.SearchActivity
|
||||
import javax.inject.Inject
|
||||
@@ -80,6 +81,9 @@ class DetailsFragment :
|
||||
super.onViewBindingCreated(binding, savedInstanceState)
|
||||
binding.textViewAuthor.setOnClickListener(this)
|
||||
binding.imageViewCover.setOnClickListener(this)
|
||||
binding.buttonDescriptionMore.setOnClickListener(this)
|
||||
binding.buttonBookmarksMore.setOnClickListener(this)
|
||||
binding.buttonScrobblingMore.setOnClickListener(this)
|
||||
binding.infoLayout.textViewSource.setOnClickListener(this)
|
||||
binding.textViewDescription.movementMethod = LinkMovementMethod.getInstance()
|
||||
binding.chipsTags.onChipClickListener = this
|
||||
@@ -217,7 +221,7 @@ class DetailsFragment :
|
||||
|
||||
private fun onScrobblingInfoChanged(scrobblings: List<ScrobblingInfo>) {
|
||||
var adapter = requireViewBinding().recyclerViewScrobbling.adapter as? ScrollingInfoAdapter
|
||||
requireViewBinding().recyclerViewScrobbling.isGone = scrobblings.isEmpty()
|
||||
requireViewBinding().groupScrobbling.isGone = scrobblings.isEmpty()
|
||||
if (adapter != null) {
|
||||
adapter.items = scrobblings
|
||||
} else {
|
||||
@@ -260,6 +264,10 @@ class DetailsFragment :
|
||||
scaleUpActivityOptionsOf(v),
|
||||
)
|
||||
}
|
||||
|
||||
R.id.button_scrobbling_more -> {
|
||||
ScrobblingSelectorSheet.show(parentFragmentManager, manga, null)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ fun scrobblingInfoAD(
|
||||
error(R.drawable.ic_error_placeholder)
|
||||
enqueueWith(coil)
|
||||
}
|
||||
binding.textViewTitle.text = item.title
|
||||
binding.textViewTitle.setCompoundDrawablesRelativeWithIntrinsicBounds(0, 0, item.scrobbler.iconResId, 0)
|
||||
binding.textViewTitle.setText(item.scrobbler.titleResId)
|
||||
binding.imageViewIcon.setImageResource(item.scrobbler.iconResId)
|
||||
binding.ratingBar.rating = item.rating * binding.ratingBar.numStars
|
||||
binding.textViewStatus.text = item.status?.let {
|
||||
context.resources.getStringArray(R.array.scrobbling_statuses).getOrNull(it.ordinal)
|
||||
|
||||
@@ -1,223 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.core.widget.NestedScrollView
|
||||
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:id="@+id/scrollView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:clipToPadding="false"
|
||||
android:scrollbars="vertical"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
android:id="@+id/imageView_cover"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:background="?colorSecondaryContainer"
|
||||
android:foreground="?selectableItemBackground"
|
||||
android:scaleType="centerCrop"
|
||||
app:layout_constraintDimensionRatio="H,13:18"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintWidth_percent="0.3"
|
||||
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.Kotatsu.Cover"
|
||||
tools:background="@tools:sample/backgrounds/scenic"
|
||||
tools:ignore="ContentDescription,UnusedAttribute" />
|
||||
|
||||
<org.koitharu.kotatsu.history.ui.util.ReadingProgressView
|
||||
android:id="@+id/progressView"
|
||||
android:layout_width="@dimen/card_indicator_size"
|
||||
android:layout_height="@dimen/card_indicator_size"
|
||||
android:layout_margin="@dimen/card_indicator_offset"
|
||||
app:layout_constraintBottom_toBottomOf="@id/imageView_cover"
|
||||
app:layout_constraintEnd_toEndOf="@id/imageView_cover" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/layout_titles"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingHorizontal="16dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/imageView_cover"
|
||||
app:layout_constraintTop_toTopOf="@+id/imageView_cover">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="4"
|
||||
android:padding="4dp"
|
||||
android:textAppearance="?attr/textAppearanceHeadlineSmall"
|
||||
tools:text="@tools:sample/lorem[15]" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView_subtitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="3"
|
||||
android:padding="4dp"
|
||||
android:textAppearance="?attr/textAppearanceBodyMedium"
|
||||
tools:text="@tools:sample/lorem[12]" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView_author"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/list_selector"
|
||||
android:padding="4dp"
|
||||
android:singleLine="true"
|
||||
android:textColor="?attr/colorTertiary"
|
||||
android:textStyle="bold"
|
||||
tools:text="@tools:sample/full_names" />
|
||||
|
||||
<RatingBar
|
||||
android:id="@+id/rating_bar"
|
||||
style="?ratingBarStyleSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:isIndicator="true"
|
||||
android:max="1"
|
||||
android:numStars="5"
|
||||
android:padding="4dp"
|
||||
android:stepSize="0.5"
|
||||
tools:rating="4" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<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="layout_titles,imageView_cover" />
|
||||
|
||||
<include
|
||||
android:id="@+id/info_layout"
|
||||
layout="@layout/layout_details_info"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/barrier_header" />
|
||||
|
||||
<org.koitharu.kotatsu.core.ui.widgets.ChipsView
|
||||
android:id="@+id/chips_tags"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
app:chipSpacingHorizontal="6dp"
|
||||
app:chipSpacingVertical="6dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/info_layout" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView_bookmarks"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:gravity="center_vertical|start"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:singleLine="true"
|
||||
android:text="@string/bookmarks"
|
||||
android:textAppearance="@style/TextAppearance.Kotatsu.SectionHeader"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/chips_tags" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerView_bookmarks"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginBottom="6dp"
|
||||
android:clipToPadding="false"
|
||||
android:nestedScrollingEnabled="false"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="12dp"
|
||||
android:paddingEnd="12dp"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/textView_bookmarks"
|
||||
tools:listitem="@layout/item_bookmark" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerView_scrobbling"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:nestedScrollingEnabled="false"
|
||||
android:orientation="vertical"
|
||||
android:overScrollMode="never"
|
||||
android:scrollbars="none"
|
||||
android:visibility="gone"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/recyclerView_bookmarks"
|
||||
tools:itemCount="2"
|
||||
tools:listitem="@layout/item_scrobbling_info"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<org.koitharu.kotatsu.core.ui.widgets.SelectableTextView
|
||||
android:id="@+id/textView_description"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/margin_normal"
|
||||
android:layout_marginTop="@dimen/margin_small"
|
||||
android:layout_marginEnd="@dimen/margin_normal"
|
||||
android:lineSpacingMultiplier="1.2"
|
||||
android:paddingBottom="@dimen/margin_normal"
|
||||
android:textAppearance="?attr/textAppearanceBodyMedium"
|
||||
android:textIsSelectable="true"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/recyclerView_scrobbling"
|
||||
tools:ignore="UnusedAttribute"
|
||||
tools:text="@tools:sample/lorem/random[250]" />
|
||||
|
||||
<com.google.android.material.progressindicator.LinearProgressIndicator
|
||||
android:id="@+id/progressBar"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:indeterminate="true"
|
||||
android:visibility="gone"
|
||||
app:hideAnimationBehavior="outward"
|
||||
app:layout_constraintBottom_toTopOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:showAnimationBehavior="inward"
|
||||
app:trackCornerRadius="0dp"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:id="@+id/group_bookmarks"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
app:constraint_referenced_ids="recyclerView_bookmarks,textView_bookmarks"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
@@ -139,25 +139,79 @@
|
||||
app:layout_constraintTop_toBottomOf="@+id/info_layout" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView_bookmarks"
|
||||
android:id="@+id/textView_description_title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginStart="@dimen/margin_small"
|
||||
android:layout_marginTop="@dimen/margin_small"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical|start"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:padding="@dimen/grid_spacing"
|
||||
android:singleLine="true"
|
||||
android:text="@string/description"
|
||||
android:textAppearance="@style/TextAppearance.Kotatsu.SectionHeader"
|
||||
app:layout_constraintEnd_toStartOf="@id/button_description_more"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/chips_tags" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_description_more"
|
||||
style="@style/Widget.Kotatsu.Button.More"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:text="@string/more"
|
||||
app:layout_constraintBaseline_toBaselineOf="@id/textView_description_title"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView_description"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/margin_normal"
|
||||
android:layout_marginTop="@dimen/margin_small"
|
||||
android:layout_marginEnd="@dimen/margin_normal"
|
||||
android:ellipsize="end"
|
||||
android:lineSpacingMultiplier="1.2"
|
||||
android:maxLines="5"
|
||||
android:paddingBottom="@dimen/margin_normal"
|
||||
android:textAppearance="?attr/textAppearanceBodyMedium"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/textView_description_title"
|
||||
tools:ignore="UnusedAttribute"
|
||||
tools:text="@tools:sample/lorem/random" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView_bookmarks_title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/margin_small"
|
||||
android:layout_marginTop="@dimen/margin_small"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical|start"
|
||||
android:padding="@dimen/grid_spacing"
|
||||
android:singleLine="true"
|
||||
android:text="@string/bookmarks"
|
||||
android:textAppearance="@style/TextAppearance.Kotatsu.SectionHeader"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/button_bookmarks_more"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/chips_tags" />
|
||||
app:layout_constraintTop_toBottomOf="@id/textView_description" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_bookmarks_more"
|
||||
style="@style/Widget.Kotatsu.Button.More"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:text="@string/show_all"
|
||||
app:layout_constraintBaseline_toBaselineOf="@id/textView_bookmarks_title"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerView_bookmarks"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginBottom="6dp"
|
||||
android:clipToPadding="false"
|
||||
android:nestedScrollingEnabled="false"
|
||||
@@ -167,9 +221,35 @@
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/textView_bookmarks"
|
||||
app:layout_constraintTop_toBottomOf="@id/textView_bookmarks_title"
|
||||
tools:listitem="@layout/item_bookmark" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView_scrobbling_title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/margin_small"
|
||||
android:layout_marginTop="@dimen/margin_small"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical|start"
|
||||
android:padding="@dimen/grid_spacing"
|
||||
android:singleLine="true"
|
||||
android:text="@string/tracking"
|
||||
android:textAppearance="@style/TextAppearance.Kotatsu.SectionHeader"
|
||||
app:layout_constraintEnd_toStartOf="@id/button_scrobbling_more"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/recyclerView_bookmarks" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_scrobbling_more"
|
||||
style="@style/Widget.Kotatsu.Button.More"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:text="@string/manage"
|
||||
app:layout_constraintBaseline_toBaselineOf="@id/textView_scrobbling_title"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerView_scrobbling"
|
||||
android:layout_width="0dp"
|
||||
@@ -185,28 +265,11 @@
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/recyclerView_bookmarks"
|
||||
app:layout_constraintTop_toBottomOf="@id/textView_scrobbling_title"
|
||||
tools:itemCount="2"
|
||||
tools:listitem="@layout/item_scrobbling_info"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<org.koitharu.kotatsu.core.ui.widgets.SelectableTextView
|
||||
android:id="@+id/textView_description"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/margin_normal"
|
||||
android:layout_marginTop="@dimen/margin_small"
|
||||
android:layout_marginEnd="@dimen/margin_normal"
|
||||
android:lineSpacingMultiplier="1.2"
|
||||
android:paddingBottom="@dimen/margin_normal"
|
||||
android:textAppearance="?attr/textAppearanceBodyMedium"
|
||||
android:textIsSelectable="true"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/recyclerView_scrobbling"
|
||||
tools:ignore="UnusedAttribute"
|
||||
tools:text="@tools:sample/lorem/random[250]" />
|
||||
|
||||
<com.google.android.material.progressindicator.LinearProgressIndicator
|
||||
android:id="@+id/progressBar"
|
||||
android:layout_width="0dp"
|
||||
@@ -227,7 +290,15 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
app:constraint_referenced_ids="recyclerView_bookmarks,textView_bookmarks"
|
||||
app:constraint_referenced_ids="recyclerView_bookmarks,textView_bookmarks_title,button_bookmarks_more"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:id="@+id/group_scrobbling"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
app:constraint_referenced_ids="recyclerView_scrobbling,textView_scrobbling_title,button_scrobbling_more"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_more"
|
||||
style="@style/Widget.Material3.Button.TextButton"
|
||||
style="@style/Widget.Kotatsu.Button.More"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/manage" />
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_more"
|
||||
style="@style/Widget.Material3.Button.TextButton"
|
||||
style="@style/Widget.Kotatsu.Button.More"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBaseline="@id/textView_title"
|
||||
|
||||
@@ -3,65 +3,80 @@
|
||||
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"
|
||||
style="@style/Widget.Material3.CardView.Filled"
|
||||
style="@style/Widget.Material3.CardView.Outlined"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:contentPadding="8dp">
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<RelativeLayout
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="2dp">
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
android:id="@+id/imageView_cover"
|
||||
android:layout_width="46dp"
|
||||
android:layout_height="46dp"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:contentDescription="@null"
|
||||
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.Kotatsu.Cover.Small"
|
||||
tools:src="@tools:sample/backgrounds/scenic[7]" />
|
||||
android:id="@+id/imageView_icon"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginVertical="20dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:background="?colorPrimary"
|
||||
android:scaleType="center"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.Kotatsu.Circle"
|
||||
app:tint="?colorOnPrimary"
|
||||
tools:src="@drawable/ic_shikimori" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView_title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:layout_toEndOf="@id/imageView_cover"
|
||||
android:drawablePadding="8dp"
|
||||
android:gravity="center_vertical"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="@style/TextAppearance.Material3.TitleSmall"
|
||||
app:drawableTint="?colorControlNormal"
|
||||
tools:drawableEndCompat="@drawable/ic_shikimori"
|
||||
tools:text="@tools:sample/lorem" />
|
||||
app:layout_constraintBottom_toTopOf="@id/textView_status"
|
||||
app:layout_constraintEnd_toStartOf="@id/imageView_cover"
|
||||
app:layout_constraintStart_toEndOf="@id/imageView_icon"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_chainStyle="packed"
|
||||
tools:text="@string/shikimori" />
|
||||
|
||||
<RatingBar
|
||||
android:id="@+id/ratingBar"
|
||||
style="?ratingBarStyleSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/textView_title"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_toEndOf="@id/imageView_cover"
|
||||
android:isIndicator="true"
|
||||
android:max="1"
|
||||
android:numStars="5" />
|
||||
android:layout_marginStart="6dp"
|
||||
android:numStars="5"
|
||||
app:layout_constraintBottom_toBottomOf="@id/textView_status"
|
||||
app:layout_constraintStart_toEndOf="@id/textView_status"
|
||||
app:layout_constraintTop_toTopOf="@id/textView_status" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView_status"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBottom="@id/ratingBar"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_marginBottom="-2dp"
|
||||
android:layout_toEndOf="@id/ratingBar"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/imageView_icon"
|
||||
app:layout_constraintTop_toBottomOf="@id/textView_title"
|
||||
tools:text="Reading" />
|
||||
|
||||
</RelativeLayout>
|
||||
<ImageView
|
||||
android:id="@+id/imageView_cover"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:scaleType="centerCrop"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:src="@tools:sample/backgrounds/scenic[7]" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
14
app/src/main/res/layout/item_tip2.xml
Normal file
14
app/src/main/res/layout/item_tip2.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<org.koitharu.kotatsu.core.ui.widgets.TipView
|
||||
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"
|
||||
app:cardBackgroundColor="@color/background_mamimi"
|
||||
app:shapeAppearance="?shapeAppearanceCornerExtraLarge"
|
||||
tools:icon="@drawable/ic_notification"
|
||||
tools:primaryButtonText="@string/settings"
|
||||
tools:secondaryButtonText="@string/close"
|
||||
tools:text="Включите их, чтобы ничего не пропускать. Откройте настройки системы и разрешите их отправку."
|
||||
tools:title="Уведомления отключены" />
|
||||
64
app/src/main/res/layout/view_tip.xml
Normal file
64
app/src/main/res/layout/view_tip.xml
Normal file
@@ -0,0 +1,64 @@
|
||||
<?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"
|
||||
android:padding="@dimen/margin_normal"
|
||||
tools:background="@drawable/bg_appwidget_card"
|
||||
tools:backgroundTint="?colorBackgroundFloating"
|
||||
tools:layout_height="wrap_content"
|
||||
tools:layout_margin="16dp"
|
||||
tools:layout_width="match_parent"
|
||||
tools:orientation="vertical"
|
||||
tools:parentTag="android.widget.LinearLayout">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawablePadding="10dp"
|
||||
android:gravity="center_vertical"
|
||||
android:textAppearance="?textAppearanceTitleMedium"
|
||||
tools:drawableStartCompat="@drawable/ic_app_update"
|
||||
tools:text="Уведомления отключены" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView_body"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:textAppearance="?textAppearanceBodyMedium"
|
||||
tools:text="Включите их, чтобы ничего не пропускать. Откройте настройки системы и разрешите их отправку." />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_weight="2"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/button_primary"
|
||||
style="@style/Widget.Material3.Button.UnelevatedButton"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:layout_weight="1"
|
||||
android:paddingHorizontal="8dp"
|
||||
android:singleLine="true"
|
||||
tools:text="Открыть настройки" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_secondary"
|
||||
style="@style/Widget.Material3.Button.TonalButton"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_weight="1"
|
||||
android:paddingHorizontal="8dp"
|
||||
android:singleLine="true"
|
||||
tools:text="Отмена" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</merge>
|
||||
@@ -7,12 +7,7 @@
|
||||
<attr name="themeChooserPreferenceStyle" />
|
||||
<attr name="listItemTextViewStyle" />
|
||||
<attr name="fastScrollerStyle" />
|
||||
|
||||
<declare-styleable name="Theme">
|
||||
<attr name="navigationBarDividerColor" format="color" />
|
||||
<attr name="colorControlLight" format="color" />
|
||||
<attr name="colorSurfaceSecondary" format="color" />
|
||||
</declare-styleable>
|
||||
<attr name="tipViewStyle" />
|
||||
|
||||
<!--CoverImageView attrs-->
|
||||
<declare-styleable name="CoverImageView">
|
||||
@@ -112,4 +107,18 @@
|
||||
<attr name="android:entries" />
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="TipView">
|
||||
<attr name="icon" />
|
||||
<attr name="title" />
|
||||
<attr name="android:text" />
|
||||
<attr name="primaryButtonText" format="string" />
|
||||
<attr name="secondaryButtonText" format="string" />
|
||||
<attr name="shapeAppearance" />
|
||||
<attr name="shapeAppearanceOverlay" />
|
||||
<attr name="cardBackgroundColor" />
|
||||
<attr name="strokeWidth"/>
|
||||
<attr name="strokeColor" />
|
||||
<attr name="elevation" />
|
||||
</declare-styleable>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -449,4 +449,5 @@
|
||||
<string name="pick_custom_directory">Pick custom directory</string>
|
||||
<string name="no_access_to_file">You have no access to this file or directory</string>
|
||||
<string name="local_manga_directories">Local manga directories</string>
|
||||
<string name="description">Description</string>
|
||||
</resources>
|
||||
|
||||
@@ -114,6 +114,10 @@
|
||||
<item name="chipMinTouchTargetSize">28dp</item>
|
||||
</style>
|
||||
|
||||
<style name="Widget.Kotatsu.Button.More" parent="Widget.Material3.Button.TextButton">
|
||||
<item name="android:minWidth">48dp</item>
|
||||
</style>
|
||||
|
||||
<style name="Widget.Kotatsu.ToggleButton" parent="Widget.Material3.Button.OutlinedButton">
|
||||
<item name="android:checkable">true</item>
|
||||
<item name="android:textAlignment">textStart</item>
|
||||
|
||||
Reference in New Issue
Block a user