Dependency update

This commit is contained in:
tom5079
2021-11-25 10:17:05 +09:00
parent 14c64299ec
commit 70452ba7a6
16 changed files with 43 additions and 617 deletions

View File

@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="deploymentTargetDropDown">
<runningDeviceTargetSelectedWithDropDown>
<targetSelectedWithDropDown>
<Target>
<type value="RUNNING_DEVICE_TARGET" />
<type value="QUICK_BOOT_TARGET" />
<deviceKey>
<Key>
<type value="SERIAL_NUMBER" />
<value value="ce021712e3b19b2b04" />
<type value="VIRTUAL_DEVICE_PATH" />
<value value="$USER_HOME$/.android/avd/Pixel_3a_API_30_x86.avd" />
</Key>
</deviceKey>
</Target>
</runningDeviceTargetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2021-09-17T13:27:59.107239Z" />
</targetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2021-11-25T00:59:48.587692Z" />
</component>
</project>

3
.idea/misc.xml generated
View File

@@ -27,9 +27,12 @@
<entry key="../../../../layout/compose-model-1631838314391.xml" value="2.0" />
<entry key="../../../../layout/custom_preview.xml" value="0.518974358974359" />
<entry key="app/src/main/res/drawable/avd_star.xml" value="0.2722222222222222" />
<entry key="app/src/main/res/layout/gallery_dialog.xml" value="0.30052083333333335" />
<entry key="app/src/main/res/layout/main_activity.xml" value="0.2953125" />
<entry key="app/src/main/res/layout/main_activity_content.xml" value="0.2953125" />
<entry key="app/src/main/res/layout/progress_card_view.xml" value="0.2953125" />
<entry key="app/src/main/res/layout/reader_activity.xml" value="0.3" />
<entry key="app/src/main/res/layout/reader_item.xml" value="0.1" />
<entry key="app/src/main/res/layout/search_result_item.xml" value="0.2489868287740628" />
</map>
</option>

View File

@@ -63,18 +63,18 @@ dependencies {
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.aar"))))
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2-native-mt")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.2.2")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.1")
implementation("androidx.compose.ui:ui:1.0.2")
implementation("androidx.compose.ui:ui-tooling:1.0.2")
implementation("androidx.compose.foundation:foundation:1.0.2")
implementation("androidx.compose.material:material:1.0.2")
implementation("androidx.compose.material:material-icons-core:1.0.2")
implementation("androidx.compose.material:material-icons-extended:1.0.2")
implementation("androidx.compose.runtime:runtime-livedata:1.0.2")
implementation("androidx.compose.material:material-icons-extended:1.0.2")
implementation("androidx.activity:activity-compose:1.3.1")
implementation("androidx.navigation:navigation-compose:2.4.0-alpha09")
implementation("androidx.compose.ui:ui:1.0.5")
implementation("androidx.compose.ui:ui-tooling:1.0.5")
implementation("androidx.compose.foundation:foundation:1.0.5")
implementation("androidx.compose.material:material:1.0.5")
implementation("androidx.compose.material:material-icons-core:1.0.5")
implementation("androidx.compose.material:material-icons-extended:1.0.5")
implementation("androidx.compose.runtime:runtime-livedata:1.0.5")
implementation("androidx.compose.material:material-icons-extended:1.0.5")
implementation("androidx.activity:activity-compose:1.4.0")
implementation("androidx.navigation:navigation-compose:2.4.0-beta02")
implementation("com.google.accompanist:accompanist-flowlayout:0.16.1")
implementation("com.google.accompanist:accompanist-appcompat-theme:0.16.0")
@@ -83,27 +83,27 @@ dependencies {
implementation("io.coil-kt:coil-compose:1.3.2")
implementation("io.ktor:ktor-client-core:1.6.3")
implementation("io.ktor:ktor-client-okhttp:1.6.3")
implementation("io.ktor:ktor-client-serialization:1.6.3")
implementation("io.ktor:ktor-client-core:1.6.5")
implementation("io.ktor:ktor-client-okhttp:1.6.5")
implementation("io.ktor:ktor-client-serialization:1.6.5")
implementation("androidx.appcompat:appcompat:1.3.1")
implementation("androidx.activity:activity-ktx:1.3.1")
implementation("androidx.fragment:fragment-ktx:1.3.6")
implementation("androidx.appcompat:appcompat:1.4.0")
implementation("androidx.activity:activity-ktx:1.4.0")
implementation("androidx.fragment:fragment-ktx:1.4.0")
implementation("androidx.preference:preference-ktx:1.1.1")
implementation("androidx.recyclerview:recyclerview:1.2.1")
implementation("androidx.constraintlayout:constraintlayout:2.1.0")
implementation("androidx.constraintlayout:constraintlayout:2.1.2")
implementation("androidx.gridlayout:gridlayout:1.0.0")
implementation("androidx.biometric:biometric:1.1.0")
implementation("androidx.work:work-runtime-ktx:2.6.0")
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:1.0.0-alpha07")
implementation("androidx.work:work-runtime-ktx:2.7.1")
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.4.0")
implementation("androidx.room:room-runtime:2.3.0")
annotationProcessor("androidx.room:room-compiler:2.3.0")
kapt("androidx.room:room-compiler:2.3.0")
implementation("androidx.room:room-ktx:2.3.0")
implementation("org.kodein.di:kodein-di-framework-compose:7.7.0")
implementation("org.kodein.di:kodein-di-framework-compose:7.9.0")
implementation("com.daimajia.swipelayout:library:1.2.0@aar")
@@ -120,11 +120,7 @@ dependencies {
//implementation("com.quiph.ui:recyclerviewfastscroller:0.2.1")
implementation("com.github.piasy:BigImageViewer:1.8.1")
implementation("com.github.piasy:FrescoImageLoader:1.8.1")
implementation("com.github.piasy:FrescoImageViewFactory:1.8.1")
implementation("org.jsoup:jsoup:1.14.1")
implementation("org.jsoup:jsoup:1.14.3")
implementation("com.tbuonomo:dotsindicator:4.2")
@@ -133,20 +129,21 @@ dependencies {
implementation("ru.noties.markwon:core:3.1.0")
implementation("xyz.quaver:libpupil:2.1.6")
implementation("xyz.quaver:documentfilex:0.6.1")
implementation("xyz.quaver:libpupil:2.1.11")
implementation("xyz.quaver:documentfilex:0.7.1")
implementation("xyz.quaver:floatingsearchview:1.1.7")
implementation("xyz.quaver:subsampledimage:0.0.1-alpha01-SNAPSHOT")
implementation("org.kodein.log:kodein-log:0.11.1")
debugImplementation("com.squareup.leakcanary:leakcanary-android:2.6")
debugImplementation("com.squareup.leakcanary:leakcanary-android:2.7")
testImplementation("junit:junit:4.13.2")
testImplementation("org.mockito:mockito-inline:3.12.4")
testImplementation("org.mockito:mockito-inline:4.1.0")
androidTestImplementation("androidx.test.ext:junit:1.1.3")
androidTestImplementation("androidx.test:rules:1.4.0")
androidTestImplementation("androidx.test:runner:1.4.0")
androidTestImplementation("androidx.test.espresso:espresso-core:3.4.0")
androidTestImplementation("androidx.compose.ui:ui-test-junit4:1.1.0-alpha03")
androidTestImplementation("androidx.compose.ui:ui-test-junit4:1.1.0-beta03")
}

View File

@@ -27,10 +27,7 @@ import android.content.Intent
import android.net.Uri
import android.os.Build
import androidx.appcompat.app.AppCompatDelegate
import androidx.core.content.ContextCompat
import androidx.preference.PreferenceManager
import com.github.piasy.biv.BigImageViewer
import com.github.piasy.biv.loader.fresco.FrescoImageLoader
import com.google.android.gms.common.GooglePlayServicesNotAvailableException
import com.google.android.gms.common.GooglePlayServicesRepairableException
import com.google.android.gms.security.ProviderInstaller
@@ -117,8 +114,6 @@ class Pupil : Application(), DIAware {
e.printStackTrace()
}
BigImageViewer.initialize(FrescoImageLoader.with(this))
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
val manager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager

View File

@@ -1,238 +0,0 @@
/*
* Pupil, Hitomi.la viewer for Android
* Copyright (C) 2019 tom5079
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package xyz.quaver.pupil.adapters
import android.content.Context
import android.graphics.drawable.Animatable
import android.net.Uri
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.ViewGroup.LayoutParams.MATCH_PARENT
import android.view.ViewGroup.LayoutParams.WRAP_CONTENT
import android.widget.ImageView
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.ListAdapter
import androidx.recyclerview.widget.RecyclerView
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView
import com.facebook.drawee.backends.pipeline.Fresco
import com.facebook.drawee.controller.BaseControllerListener
import com.facebook.drawee.drawable.ScalingUtils
import com.facebook.drawee.interfaces.DraweeController
import com.facebook.drawee.view.SimpleDraweeView
import com.facebook.imagepipeline.image.ImageInfo
import com.github.piasy.biv.view.BigImageView
import com.github.piasy.biv.view.ImageShownCallback
import com.github.piasy.biv.view.ImageViewFactory
import xyz.quaver.pupil.R
import xyz.quaver.pupil.databinding.ReaderItemBinding
import java.io.File
import kotlin.math.roundToInt
data class ReaderItem(
val progress: Float,
val image: Uri?
)
class ReaderAdapter : ListAdapter<ReaderItem, ReaderAdapter.ViewHolder>(ReaderItemDiffCallback()) {
var onItemClickListener : (() -> (Unit))? = null
var fullscreen = false
inner class ViewHolder(private val binding: ReaderItemBinding) : RecyclerView.ViewHolder(binding.root) {
init {
with (binding.image) {
setImageViewFactory(FrescoImageViewFactory().apply {
updateView = { imageInfo ->
if (!fullscreen) {
binding.root.layoutParams.height = imageInfo.height
layoutParams.height = imageInfo.height
(mainView as? SimpleDraweeView)?.aspectRatio = imageInfo.width / imageInfo.height.toFloat()
}
}
})
setImageShownCallback(object: ImageShownCallback {
override fun onMainImageShown() {
binding.progressGroup.visibility = View.INVISIBLE
binding.root.layoutParams.height = if (fullscreen)
MATCH_PARENT
else
WRAP_CONTENT
}
override fun onThumbnailShown() {}
})
setFailureImage(ContextCompat.getDrawable(itemView.context, R.drawable.image_broken_variant))
setOnClickListener {
onItemClickListener?.invoke()
}
}
binding.root.setOnClickListener {
onItemClickListener?.invoke()
}
binding.readerItemProgressbar.max = 100
}
fun bind(position: Int) {
recycle()
binding.root.layoutParams.height = MATCH_PARENT
binding.readerIndex.text = (position+1).toString()
val (progress, image) = getItem(position)
binding.progressGroup.visibility = View.VISIBLE
if (image != null) {
binding.root.background = null
binding.image.showImage(image)
} else {
binding.root.setBackgroundResource(R.drawable.reader_item_boundary)
if (progress == Float.NEGATIVE_INFINITY)
binding.image.showImage(Uri.EMPTY)
else
binding.readerItemProgressbar.progress = progress.roundToInt()
}
}
fun recycle() {
binding.image.mainView.run {
when (this) {
is SubsamplingScaleImageView -> recycle()
is SimpleDraweeView -> recycle()
is ImageView -> setImageBitmap(null)
}
}
}
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
return ViewHolder(ReaderItemBinding.inflate(LayoutInflater.from(parent.context), parent, false))
}
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
holder.bind(position)
}
override fun onViewRecycled(holder: ViewHolder) {
super.onViewRecycled(holder)
holder.recycle()
}
}
class ReaderItemDiffCallback : DiffUtil.ItemCallback<ReaderItem>() {
override fun areItemsTheSame(oldItem: ReaderItem, newItem: ReaderItem) =
true
override fun areContentsTheSame(oldItem: ReaderItem, newItem: ReaderItem) =
oldItem == newItem
}
class FrescoImageViewFactory : ImageViewFactory() {
var updateView: ((ImageInfo) -> Unit)? = null
override fun createAnimatedImageView(
context: Context, imageType: Int,
initScaleType: Int
): View {
val view = SimpleDraweeView(context)
view.hierarchy.actualImageScaleType = scaleType(initScaleType)
return view
}
override fun loadAnimatedContent(
view: View, imageType: Int,
imageFile: File
) {
if (view is SimpleDraweeView) {
val controller: DraweeController = Fresco.newDraweeControllerBuilder()
.setOldController(view.controller)
.setUri(Uri.parse("file://" + imageFile.absolutePath))
.setAutoPlayAnimations(true)
.setControllerListener(object: BaseControllerListener<ImageInfo>() {
override fun onIntermediateImageSet(id: String?, imageInfo: ImageInfo?) {
imageInfo?.let { updateView?.invoke(it) }
}
override fun onFinalImageSet(id: String?, imageInfo: ImageInfo?, animatable: Animatable?) {
imageInfo?.let { updateView?.invoke(it) }
}
})
.build()
view.controller = controller
}
}
override fun createThumbnailView(
context: Context,
scaleType: ImageView.ScaleType, willLoadFromNetwork: Boolean
): View {
return if (willLoadFromNetwork) {
val thumbnailView = SimpleDraweeView(context)
thumbnailView.hierarchy.actualImageScaleType = scaleType(scaleType)
thumbnailView
} else {
super.createThumbnailView(context, scaleType, false)
}
}
override fun loadThumbnailContent(view: View, thumbnail: Uri) {
if (view is SimpleDraweeView) {
val controller: DraweeController = Fresco.newDraweeControllerBuilder()
.setOldController(view.controller)
.setUri(thumbnail)
.build()
view.controller = controller
}
}
private fun scaleType(value: Int): ScalingUtils.ScaleType {
return when (value) {
BigImageView.INIT_SCALE_TYPE_CENTER -> ScalingUtils.ScaleType.CENTER
BigImageView.INIT_SCALE_TYPE_CENTER_CROP -> ScalingUtils.ScaleType.CENTER_CROP
BigImageView.INIT_SCALE_TYPE_CENTER_INSIDE -> ScalingUtils.ScaleType.CENTER_INSIDE
BigImageView.INIT_SCALE_TYPE_FIT_END -> ScalingUtils.ScaleType.FIT_END
BigImageView.INIT_SCALE_TYPE_FIT_START -> ScalingUtils.ScaleType.FIT_START
BigImageView.INIT_SCALE_TYPE_FIT_XY -> ScalingUtils.ScaleType.FIT_XY
BigImageView.INIT_SCALE_TYPE_FIT_CENTER -> ScalingUtils.ScaleType.FIT_CENTER
else -> ScalingUtils.ScaleType.FIT_CENTER
}
}
private fun scaleType(scaleType: ImageView.ScaleType): ScalingUtils.ScaleType {
return when (scaleType) {
ImageView.ScaleType.CENTER -> ScalingUtils.ScaleType.CENTER
ImageView.ScaleType.CENTER_CROP -> ScalingUtils.ScaleType.CENTER_CROP
ImageView.ScaleType.CENTER_INSIDE -> ScalingUtils.ScaleType.CENTER_INSIDE
ImageView.ScaleType.FIT_END -> ScalingUtils.ScaleType.FIT_END
ImageView.ScaleType.FIT_START -> ScalingUtils.ScaleType.FIT_START
ImageView.ScaleType.FIT_XY -> ScalingUtils.ScaleType.FIT_XY
ImageView.ScaleType.FIT_CENTER -> ScalingUtils.ScaleType.FIT_CENTER
else -> ScalingUtils.ScaleType.FIT_CENTER
}
}
}

View File

@@ -1,63 +0,0 @@
/*
* Pupil, Hitomi.la viewer for Android
* Copyright (C) 2019 tom5079
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package xyz.quaver.pupil.adapters
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.facebook.drawee.drawable.ScalingUtils
import com.facebook.drawee.view.SimpleDraweeView
import xyz.quaver.pupil.R
class ThumbnailAdapter(var thumbnails: List<String>) : RecyclerView.Adapter<ThumbnailAdapter.ViewHolder>() {
class ViewHolder(val view: SimpleDraweeView) : RecyclerView.ViewHolder(view) {
init {
view.hierarchy.actualImageScaleType = ScalingUtils.ScaleType.FIT_CENTER
}
fun bind(image: String) {
view.setImageURI(image)
}
fun clear() {
view.controller = null
}
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
return ViewHolder(SimpleDraweeView(parent.context).apply {
layoutParams = ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
resources.getDimensionPixelSize(R.dimen.gallery_dialog_preview_height)
)
})
}
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
holder.bind(thumbnails[position])
}
override fun getItemCount() = thumbnails.size
override fun onViewRecycled(holder: ViewHolder) {
holder.clear()
}
}

View File

@@ -1,47 +0,0 @@
/*
* Pupil, Hitomi.la viewer for Android
* Copyright (C) 2020 tom5079
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package xyz.quaver.pupil.adapters
import android.view.ViewGroup
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView
import kotlin.math.min
class ThumbnailPageAdapter(private val thumbnails: List<String>) : RecyclerView.Adapter<ThumbnailPageAdapter.ViewHolder>() {
class ViewHolder(val view: RecyclerView) : RecyclerView.ViewHolder(view)
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
return ViewHolder(RecyclerView(parent.context).apply {
this.layoutManager = GridLayoutManager(parent.context, 3)
this.adapter = ThumbnailAdapter(listOf())
layoutParams = ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)
})
}
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
(holder.view.adapter as ThumbnailAdapter).apply {
thumbnails = this@ThumbnailPageAdapter.thumbnails.slice(9*position until min(9*position+9, this@ThumbnailPageAdapter.thumbnails.size))
notifyDataSetChanged()
}
}
override fun getItemCount() = if (thumbnails.isEmpty()) 0 else thumbnails.size/9 + if (thumbnails.size%9 != 0) 1 else 0
}

View File

@@ -6,7 +6,7 @@ import androidx.room.Room
import androidx.room.RoomDatabase
import org.kodein.di.*
@Database(entities = [History::class, Bookmark::class], version = 1)
@Database(entities = [History::class, Bookmark::class], version = 1, exportSchema = false)
abstract class AppDatabase : RoomDatabase() {
abstract fun historyDao(): HistoryDao
abstract fun bookmarkDao(): BookmarkDao

View File

@@ -21,9 +21,6 @@ package xyz.quaver.pupil.sources
import android.app.Application
import android.os.Parcelable
import androidx.compose.runtime.Composable
import androidx.lifecycle.*
import io.ktor.http.*
import kotlinx.coroutines.*
import kotlinx.coroutines.channels.Channel
import kotlinx.parcelize.Parcelize
import org.kodein.di.*

View File

@@ -19,11 +19,6 @@
package xyz.quaver.pupil.sources
import android.app.Application
import io.ktor.client.*
import io.ktor.client.features.*
import io.ktor.client.features.get
import io.ktor.client.request.*
import io.ktor.client.statement.*
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.launch

View File

@@ -52,6 +52,7 @@ import org.kodein.di.DIAware
import org.kodein.di.android.closestDI
import org.kodein.log.LoggerFactory
import org.kodein.log.newLogger
import xyz.quaver.graphics.subsampledimage.SubSampledImage
import xyz.quaver.pupil.R
import xyz.quaver.pupil.ui.composable.FloatingActionButtonState
import xyz.quaver.pupil.ui.composable.MultipleFloatingActionButton
@@ -134,29 +135,8 @@ class ReaderActivity : ComponentActivity(), DIAware {
verticalArrangement = Arrangement.spacedBy(32.dp)
) {
items(images) { image ->
Image(
modifier = Modifier.fillMaxWidth().heightIn(128.dp, 1000.dp),
painter = rememberImagePainter(
ImageRequest.Builder(this@ReaderActivity)
.data(image)
.headers(
Headers.headersOf(
*(source!!.getHeadersForImage(model.itemID.value!!, image).entries.fold(arrayOf()) { acc, entry ->
acc + entry.key + entry.value
})
).also {
logger.debug {
image
}
logger.debug {
it.toString()
}
}
)
.transformations(BlurTransformation(this@ReaderActivity, 1f))
.build()
),
contentDescription = null
SubSampledImage(
modifier = Modifier.fillMaxWidth().heightIn(128.dp, 1000.dp)
)
}
}

View File

@@ -21,10 +21,7 @@ package xyz.quaver.pupil.ui.viewmodel
import android.app.Application
import android.content.Intent
import android.net.Uri
import androidx.constraintlayout.widget.ConstraintSet
import androidx.lifecycle.*
import io.ktor.client.request.*
import kotlinx.coroutines.*
import org.kodein.di.DIAware
import org.kodein.di.android.x.closestDI
@@ -32,12 +29,10 @@ import org.kodein.di.direct
import org.kodein.di.instance
import org.kodein.log.LoggerFactory
import org.kodein.log.newLogger
import xyz.quaver.pupil.adapters.ReaderItem
import xyz.quaver.pupil.db.AppDatabase
import xyz.quaver.pupil.db.Bookmark
import xyz.quaver.pupil.db.History
import xyz.quaver.pupil.sources.Source
import xyz.quaver.pupil.util.notify
import xyz.quaver.pupil.util.source
@Suppress("UNCHECKED_CAST")
@@ -66,9 +61,6 @@ class ReaderViewModel(app: Application) : AndroidViewModel(app), DIAware {
private val _images = MutableLiveData<List<String>>()
val images: LiveData<List<String>> = _images
private var _readerItems = MutableLiveData<MutableList<ReaderItem>>()
val readerItems = _readerItems as LiveData<List<ReaderItem>>
val isBookmarked = Transformations.switchMap(MediatorLiveData<Pair<Source, String>>().apply {
addSource(source) { source -> itemID.value?.let { itemID -> source to itemID } }
addSource(itemID) { itemID -> source.value?.let { source -> source to itemID } }
@@ -129,7 +121,7 @@ class ReaderViewModel(app: Application) : AndroidViewModel(app), DIAware {
viewModelScope.launch {
_images.postValue(withContext(Dispatchers.IO) {
source.images(itemID)
}!!)
})
}
}

View File

@@ -39,24 +39,12 @@
android:layout_height="wrap_content"
android:padding="8dp">
<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/cover"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/title"
tools:ignore="ContentDescription" />
<TextView
android:id="@+id/title"
style="@style/TextAppearance.AppCompat.Headline"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toRightOf="@id/cover"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"/>
@@ -67,7 +55,6 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/title"
app:layout_constraintLeft_toRightOf="@id/cover"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"/>
@@ -83,7 +70,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@id/cover"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"/>

View File

@@ -1,99 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Pupil, Hitomi.la viewer for Android
~ Copyright (C) 2019 tom5079
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<androidx.coordinatorlayout.widget.CoordinatorLayout 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/root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/darker_gray"
tools:context=".ui.ReaderActivity">
<com.qtalk.recyclerviewfastscroller.RecyclerViewFastScroller
android:id="@+id/scroller"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:handleDrawable="@drawable/thumb"
app:handleHeight="72dp"
app:handleWidth="24dp"
app:disableTrack="true"
app:hideHandleAfter="1000"
app:handleHasFixedSize="true"
app:addLastItemPadding="true"
app:popupDrawable="@android:color/transparent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerview"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:listitem="@layout/reader_item"/>
</com.qtalk.recyclerviewfastscroller.RecyclerViewFastScroller>
<include layout="@layout/reader_eye_card"
android:id="@+id/eye_card"
android:visibility="gone"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="8dp"/>
<ProgressBar
android:id="@+id/download_progressbar"
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
android:layout_width="match_parent"
android:layout_height="4dp"/>
<com.github.clans.fab.FloatingActionMenu
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
app:menu_colorNormal="@color/colorAccent">
<com.github.clans.fab.FloatingActionButton
android:id="@+id/download_fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:srcCompat="@drawable/ic_download"
app:fab_label="@string/reader_fab_download"
app:fab_size="mini"/>
<com.github.clans.fab.FloatingActionButton
android:id="@+id/retry_fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:srcCompat="@drawable/refresh"
app:fab_label="@string/reader_fab_retry"
app:fab_size="mini"/>
<com.github.clans.fab.FloatingActionButton
android:id="@+id/fullscreen_fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:srcCompat="@drawable/ic_fullscreen"
app:fab_label="@string/reader_fab_fullscreen"
app:fab_size="mini"/>
</com.github.clans.fab.FloatingActionMenu>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@@ -1,72 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Pupil, Hitomi.la viewer for Android
~ Copyright (C) 2019 tom5079
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<androidx.constraintlayout.widget.ConstraintLayout 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="match_parent"
android:layout_marginBottom="8dp"
android:background="@drawable/reader_item_boundary">
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline_center_vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.5"/>
<ProgressBar
android:id="@+id/reader_item_progressbar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="?android:progressBarStyleHorizontal"
android:indeterminate="false"
android:progress="0"
android:max="100"
android:visibility="visible"
app:layout_constraintBottom_toTopOf="@id/guideline_center_vertical"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"/>
<TextView
android:id="@+id/reader_index"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/guideline_center_vertical"
app:layout_constraintLeft_toLeftOf="@id/reader_item_progressbar"
app:layout_constraintRight_toRightOf="@id/reader_item_progressbar"
style="@style/TextAppearance.AppCompat.Caption"/>
<androidx.constraintlayout.widget.Group
android:id="@+id/progress_group"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="visible"
app:constraint_referenced_ids="reader_item_progressbar, reader_index"/>
<com.github.piasy.biv.view.BigImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:initScaleType="centerInside"
app:optimizeDisplay="true"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -6,7 +6,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:7.0.2")
classpath("com.android.tools.build:gradle:7.0.3")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.10")
classpath("org.jetbrains.kotlin:kotlin-android-extensions:1.5.21")
classpath("org.jetbrains.kotlin:kotlin-serialization:1.5.21")