修复图片显示
This commit is contained in:
5 files changed
+61
-19
No files matched your search
@@ -1412,6 +1412,7 @@ class ReadBookActivity : BaseReadBookActivity(),
|
|||||||
*/
|
*/
|
||||||
@SuppressLint("RtlHardcoded")
|
@SuppressLint("RtlHardcoded")
|
||||||
override fun onImageLongPress(x: Float, y: Float, src: String) {
|
override fun onImageLongPress(x: Float, y: Float, src: String) {
|
||||||
|
binding.root.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS)
|
||||||
popupAction.setItems(
|
popupAction.setItems(
|
||||||
listOf(
|
listOf(
|
||||||
SelectItem(getString(R.string.show), "show"),
|
SelectItem(getString(R.string.show), "show"),
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package io.legato.kazusa.ui.widget
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.PopupWindow
|
import android.widget.PopupWindow
|
||||||
|
import io.legato.kazusa.R
|
||||||
import io.legato.kazusa.base.adapter.ItemViewHolder
|
import io.legato.kazusa.base.adapter.ItemViewHolder
|
||||||
import io.legato.kazusa.base.adapter.RecyclerAdapter
|
import io.legato.kazusa.base.adapter.RecyclerAdapter
|
||||||
import io.legato.kazusa.databinding.ItemTextBinding
|
import io.legato.kazusa.databinding.ItemTextBinding
|
||||||
@@ -22,6 +23,7 @@ class PopupAction(private val context: Context) :
|
|||||||
var onActionClick: ((action: String) -> Unit)? = null
|
var onActionClick: ((action: String) -> Unit)? = null
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
animationStyle = R.style.TextActionMenuAnimation
|
||||||
contentView = binding.root
|
contentView = binding.root
|
||||||
|
|
||||||
isTouchable = true
|
isTouchable = true
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy
|
|||||||
import com.bumptech.glide.load.resource.bitmap.DownsampleStrategy
|
import com.bumptech.glide.load.resource.bitmap.DownsampleStrategy
|
||||||
import com.bumptech.glide.request.RequestOptions
|
import com.bumptech.glide.request.RequestOptions
|
||||||
import io.legato.kazusa.R
|
import io.legato.kazusa.R
|
||||||
|
import io.legato.kazusa.base.BaseBottomSheetDialogFragment
|
||||||
import io.legato.kazusa.base.BaseDialogFragment
|
import io.legato.kazusa.base.BaseDialogFragment
|
||||||
import io.legato.kazusa.databinding.DialogPhotoViewBinding
|
import io.legato.kazusa.databinding.DialogPhotoViewBinding
|
||||||
import io.legato.kazusa.help.book.BookHelp
|
import io.legato.kazusa.help.book.BookHelp
|
||||||
@@ -22,7 +23,7 @@ import io.legato.kazusa.utils.viewbindingdelegate.viewBinding
|
|||||||
/**
|
/**
|
||||||
* 显示图片
|
* 显示图片
|
||||||
*/
|
*/
|
||||||
class PhotoDialog() : BaseDialogFragment(R.layout.dialog_photo_view) {
|
class PhotoDialog() : BaseBottomSheetDialogFragment(R.layout.dialog_photo_view) {
|
||||||
|
|
||||||
constructor(src: String, sourceOrigin: String? = null) : this() {
|
constructor(src: String, sourceOrigin: String? = null) : this() {
|
||||||
arguments = Bundle().apply {
|
arguments = Bundle().apply {
|
||||||
@@ -33,11 +34,6 @@ class PhotoDialog() : BaseDialogFragment(R.layout.dialog_photo_view) {
|
|||||||
|
|
||||||
private val binding by viewBinding(DialogPhotoViewBinding::bind)
|
private val binding by viewBinding(DialogPhotoViewBinding::bind)
|
||||||
|
|
||||||
override fun onStart() {
|
|
||||||
super.onStart()
|
|
||||||
setLayout(1f, ViewGroup.LayoutParams.MATCH_PARENT)
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressLint("CheckResult")
|
@SuppressLint("CheckResult")
|
||||||
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
val arguments = arguments ?: return
|
val arguments = arguments ?: return
|
||||||
|
|||||||
@@ -1,12 +1,44 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingHorizontal="16dp"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/header_layout"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:gravity="center"
|
||||||
|
android:paddingHorizontal="16dp"
|
||||||
|
android:paddingBottom="8dp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<com.google.android.material.bottomsheet.BottomSheetDragHandleView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_horizontal" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/bottom_sheet_title"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="图片显示"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<io.legato.kazusa.ui.widget.image.PhotoView
|
<io.legato.kazusa.ui.widget.image.PhotoView
|
||||||
android:id="@+id/photo_view"
|
android:id="@+id/photo_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/header_layout"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
android:scaleType="centerInside" />
|
android:scaleType="centerInside" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|||||||
@@ -1,19 +1,30 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<com.google.android.material.card.MaterialCardView
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
app:strokeWidth="0dp"
|
||||||
|
app:cardBackgroundColor="?attr/colorSurfaceContainer">
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<LinearLayout
|
||||||
android:id="@+id/recycler_view"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:padding="8dp"
|
||||||
android:orientation="horizontal"
|
android:orientation="vertical">
|
||||||
app:flexDirection="row"
|
|
||||||
app:flexWrap="wrap"
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
app:layoutManager="com.google.android.flexbox.FlexboxLayoutManager" />
|
android:id="@+id/recycler_view"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
app:flexDirection="row"
|
||||||
|
app:flexWrap="wrap"
|
||||||
|
app:layoutManager="com.google.android.flexbox.FlexboxLayoutManager" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</com.google.android.material.card.MaterialCardView>
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
Reference in new issue
Block a user