Does not work
This commit is contained in:
5
.idea/jarRepositories.xml
generated
5
.idea/jarRepositories.xml
generated
@@ -66,5 +66,10 @@
|
|||||||
<option name="name" value="maven3" />
|
<option name="name" value="maven3" />
|
||||||
<option name="url" value="https://dl.bintray.com/tom5079/maven" />
|
<option name="url" value="https://dl.bintray.com/tom5079/maven" />
|
||||||
</remote-repository>
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="maven3" />
|
||||||
|
<option name="name" value="maven3" />
|
||||||
|
<option name="url" value="http://dl.bintray.com/piasy/maven" />
|
||||||
|
</remote-repository>
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
@@ -14,6 +14,23 @@ if (file("google-services.json").exists() && file("src/debug/google-services.jso
|
|||||||
logger.lifecycle("Firebase Disabled")
|
logger.lifecycle("Firebase Disabled")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ext {
|
||||||
|
okhttp_version = "3.12.12"
|
||||||
|
}
|
||||||
|
|
||||||
|
configurations {
|
||||||
|
all {
|
||||||
|
resolutionStrategy {
|
||||||
|
eachDependency { DependencyResolveDetails details ->
|
||||||
|
if (details.requested.group == "com.squareup.okhttp3" && details.requested.name == "okhttp") {
|
||||||
|
// OkHttp drops support before 5.0 since 3.13.0
|
||||||
|
details.useVersion okhttp_version
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 30
|
compileSdkVersion 30
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
@@ -65,6 +82,7 @@ dependencies {
|
|||||||
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9"
|
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9"
|
||||||
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9"
|
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9"
|
||||||
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.0.0-RC2"
|
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.0.0-RC2"
|
||||||
|
|
||||||
implementation "androidx.appcompat:appcompat:1.2.0"
|
implementation "androidx.appcompat:appcompat:1.2.0"
|
||||||
implementation "androidx.activity:activity-ktx:1.2.0-alpha08"
|
implementation "androidx.activity:activity-ktx:1.2.0-alpha08"
|
||||||
implementation "androidx.fragment:fragment-ktx:1.3.0-alpha08"
|
implementation "androidx.fragment:fragment-ktx:1.3.0-alpha08"
|
||||||
@@ -72,41 +90,48 @@ dependencies {
|
|||||||
implementation "androidx.constraintlayout:constraintlayout:2.0.1"
|
implementation "androidx.constraintlayout:constraintlayout:2.0.1"
|
||||||
implementation "androidx.gridlayout:gridlayout:1.0.0"
|
implementation "androidx.gridlayout:gridlayout:1.0.0"
|
||||||
implementation "androidx.biometric:biometric:1.0.1"
|
implementation "androidx.biometric:biometric:1.0.1"
|
||||||
|
|
||||||
implementation "com.daimajia.swipelayout:library:1.2.0@aar"
|
implementation "com.daimajia.swipelayout:library:1.2.0@aar"
|
||||||
|
|
||||||
implementation "com.google.android.material:material:1.3.0-alpha02"
|
implementation "com.google.android.material:material:1.3.0-alpha02"
|
||||||
|
|
||||||
implementation "com.google.firebase:firebase-core:17.5.0"
|
implementation "com.google.firebase:firebase-core:17.5.0"
|
||||||
implementation "com.google.firebase:firebase-analytics:17.5.0"
|
implementation "com.google.firebase:firebase-analytics:17.5.0"
|
||||||
implementation "com.google.firebase:firebase-crashlytics:17.2.1"
|
implementation "com.google.firebase:firebase-crashlytics:17.2.1"
|
||||||
implementation "com.google.firebase:firebase-perf:19.0.8"
|
implementation "com.google.firebase:firebase-perf:19.0.8"
|
||||||
|
|
||||||
implementation "com.google.android.gms:play-services-oss-licenses:17.0.0"
|
implementation "com.google.android.gms:play-services-oss-licenses:17.0.0"
|
||||||
implementation "com.google.android.gms:play-services-mlkit-face-detection:16.1.1"
|
implementation "com.google.android.gms:play-services-mlkit-face-detection:16.1.1"
|
||||||
|
|
||||||
implementation "com.github.clans:fab:1.6.4"
|
implementation "com.github.clans:fab:1.6.4"
|
||||||
|
|
||||||
//implementation "com.quiph.ui:recyclerviewfastscroller:0.2.1"
|
//implementation "com.quiph.ui:recyclerviewfastscroller:0.2.1"
|
||||||
|
|
||||||
|
implementation 'com.github.piasy:BigImageViewer:1.6.7'
|
||||||
|
implementation 'com.github.piasy:FrescoImageLoader:1.6.7'
|
||||||
|
implementation 'com.github.piasy:FrescoImageViewFactory:1.6.7'
|
||||||
|
|
||||||
//noinspection GradleDependency
|
//noinspection GradleDependency
|
||||||
implementation "com.squareup.okhttp3:okhttp:3.12.12"
|
implementation "com.squareup.okhttp3:okhttp:$okhttp_version"
|
||||||
implementation "com.github.bumptech.glide:glide:4.11.0"
|
implementation "com.github.bumptech.glide:glide:4.11.0"
|
||||||
implementation ("com.github.bumptech.glide:okhttp3-integration:4.11.0") {
|
implementation ("com.github.bumptech.glide:okhttp3-integration:4.11.0") {
|
||||||
transitive = false
|
transitive = false
|
||||||
}
|
}
|
||||||
implementation ("com.github.bumptech.glide:recyclerview-integration:4.11.0") {
|
|
||||||
transitive = false
|
|
||||||
}
|
|
||||||
implementation "com.github.bumptech.glide:annotations:4.11.0"
|
|
||||||
annotationProcessor "com.github.bumptech.glide:compiler:4.11.0"
|
|
||||||
kapt "com.github.bumptech.glide:compiler:4.11.0"
|
|
||||||
implementation ("com.github.bumptech.glide:recyclerview-integration:4.11.0") {
|
|
||||||
transitive = false
|
|
||||||
}
|
|
||||||
implementation "com.tbuonomo.andrui:viewpagerdotsindicator:4.1.2"
|
implementation "com.tbuonomo.andrui:viewpagerdotsindicator:4.1.2"
|
||||||
implementation "com.gu:option:1.3"
|
|
||||||
implementation "net.rdrei.android.dirchooser:library:3.2@aar"
|
implementation "net.rdrei.android.dirchooser:library:3.2@aar"
|
||||||
implementation "com.github.chrisbanes:PhotoView:2.3.0"
|
implementation "com.gu:option:1.3"
|
||||||
|
|
||||||
implementation "com.andrognito.patternlockview:patternlockview:1.0.0"
|
implementation "com.andrognito.patternlockview:patternlockview:1.0.0"
|
||||||
//implementation "com.andrognito.pinlockview:pinlockview:2.1.0"
|
//implementation "com.andrognito.pinlockview:pinlockview:2.1.0"
|
||||||
|
|
||||||
implementation "ru.noties.markwon:core:3.1.0"
|
implementation "ru.noties.markwon:core:3.1.0"
|
||||||
|
|
||||||
implementation "xyz.quaver:libpupil:1.7.2"
|
implementation "xyz.quaver:libpupil:1.7.2"
|
||||||
implementation "xyz.quaver:documentfilex:0.2.15"
|
implementation "xyz.quaver:documentfilex:0.2.15"
|
||||||
implementation "xyz.quaver:floatingsearchview:1.0.5"
|
implementation "xyz.quaver:floatingsearchview:1.0.5"
|
||||||
|
|
||||||
testImplementation "junit:junit:4.13"
|
testImplementation "junit:junit:4.13"
|
||||||
androidTestImplementation "androidx.test.ext:junit:1.1.2"
|
androidTestImplementation "androidx.test.ext:junit:1.1.2"
|
||||||
androidTestImplementation "androidx.test:rules:1.3.0"
|
androidTestImplementation "androidx.test:rules:1.3.0"
|
||||||
|
|||||||
@@ -25,7 +25,6 @@
|
|||||||
android:theme="@style/AppTheme"
|
android:theme="@style/AppTheme"
|
||||||
android:networkSecurityConfig="@xml/network_security_config"
|
android:networkSecurityConfig="@xml/network_security_config"
|
||||||
tools:replace="android:theme"
|
tools:replace="android:theme"
|
||||||
android:largeHeap="true"
|
|
||||||
tools:ignore="UnusedAttribute">
|
tools:ignore="UnusedAttribute">
|
||||||
|
|
||||||
<meta-data
|
<meta-data
|
||||||
|
|||||||
@@ -26,14 +26,13 @@ import android.os.Build
|
|||||||
import androidx.appcompat.app.AppCompatDelegate
|
import androidx.appcompat.app.AppCompatDelegate
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import androidx.preference.PreferenceManager
|
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.GooglePlayServicesNotAvailableException
|
||||||
import com.google.android.gms.common.GooglePlayServicesRepairableException
|
import com.google.android.gms.common.GooglePlayServicesRepairableException
|
||||||
import com.google.android.gms.security.ProviderInstaller
|
import com.google.android.gms.security.ProviderInstaller
|
||||||
import com.google.firebase.analytics.FirebaseAnalytics
|
import com.google.firebase.analytics.FirebaseAnalytics
|
||||||
import com.google.firebase.crashlytics.FirebaseCrashlytics
|
import com.google.firebase.crashlytics.FirebaseCrashlytics
|
||||||
import kotlinx.coroutines.CoroutineScope
|
|
||||||
import kotlinx.coroutines.Dispatchers
|
|
||||||
import kotlinx.coroutines.launch
|
|
||||||
import okhttp3.Interceptor
|
import okhttp3.Interceptor
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
import okhttp3.Response
|
import okhttp3.Response
|
||||||
@@ -118,20 +117,6 @@ class Pupil : Application() {
|
|||||||
favoriteTags = SavedSet(File(ContextCompat.getDataDir(this), "favorites_tags.json"), Tag.parse(""))
|
favoriteTags = SavedSet(File(ContextCompat.getDataDir(this), "favorites_tags.json"), Tag.parse(""))
|
||||||
searchHistory = SavedSet(File(ContextCompat.getDataDir(this), "search_histories.json"), "")
|
searchHistory = SavedSet(File(ContextCompat.getDataDir(this), "search_histories.json"), "")
|
||||||
|
|
||||||
if (Preferences["new_history"]) {
|
|
||||||
CoroutineScope(Dispatchers.IO).launch {
|
|
||||||
histories.reversed().let {
|
|
||||||
histories.clear()
|
|
||||||
histories.addAll(it)
|
|
||||||
}
|
|
||||||
favorites.reversed().let {
|
|
||||||
favorites.clear()
|
|
||||||
favorites.addAll(it)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Preferences["new_history"] = true
|
|
||||||
}
|
|
||||||
|
|
||||||
if (BuildConfig.DEBUG)
|
if (BuildConfig.DEBUG)
|
||||||
FirebaseAnalytics.getInstance(this).setAnalyticsCollectionEnabled(false)
|
FirebaseAnalytics.getInstance(this).setAnalyticsCollectionEnabled(false)
|
||||||
|
|
||||||
@@ -143,6 +128,8 @@ class Pupil : Application() {
|
|||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BigImageViewer.initialize(FrescoImageLoader.with(this))
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
val manager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
val manager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
||||||
|
|
||||||
|
|||||||
@@ -1,41 +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
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import com.bumptech.glide.Glide
|
|
||||||
import com.bumptech.glide.Registry
|
|
||||||
import com.bumptech.glide.annotation.GlideModule
|
|
||||||
import com.bumptech.glide.integration.okhttp3.OkHttpUrlLoader
|
|
||||||
import com.bumptech.glide.load.model.GlideUrl
|
|
||||||
import com.bumptech.glide.module.AppGlideModule
|
|
||||||
import java.io.InputStream
|
|
||||||
|
|
||||||
@GlideModule
|
|
||||||
class PupilGlideModule : AppGlideModule() {
|
|
||||||
|
|
||||||
override fun registerComponents(context: Context, glide: Glide, registry: Registry) {
|
|
||||||
registry.append(
|
|
||||||
GlideUrl::class.java,
|
|
||||||
InputStream::class.java,
|
|
||||||
OkHttpUrlLoader.Factory(client)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -80,7 +80,7 @@ class GalleryBlockAdapter(private val glide: RequestManager, private val galleri
|
|||||||
val cache = Cache.getInstance(context, galleryID)
|
val cache = Cache.getInstance(context, galleryID)
|
||||||
|
|
||||||
CoroutineScope(Dispatchers.Main).launch {
|
CoroutineScope(Dispatchers.Main).launch {
|
||||||
if (cache.metadata.reader == null || Preferences["cache_disable"]) {
|
if (cache.metadata.reader == null) {
|
||||||
view.galleryblock_progressbar_layout.visibility = View.GONE
|
view.galleryblock_progressbar_layout.visibility = View.GONE
|
||||||
view.galleryblock_progress_complete.visibility = View.INVISIBLE
|
view.galleryblock_progress_complete.visibility = View.INVISIBLE
|
||||||
return@launch
|
return@launch
|
||||||
|
|||||||
@@ -18,34 +18,23 @@
|
|||||||
|
|
||||||
package xyz.quaver.pupil.adapters
|
package xyz.quaver.pupil.adapters
|
||||||
|
|
||||||
import android.graphics.drawable.Drawable
|
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.constraintlayout.widget.ConstraintLayout
|
import androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
import androidx.core.view.updateLayoutParams
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.bumptech.glide.Glide
|
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView
|
||||||
import com.bumptech.glide.load.DataSource
|
import com.facebook.drawee.view.SimpleDraweeView
|
||||||
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
import com.github.piasy.biv.view.FrescoImageViewFactory
|
||||||
import com.bumptech.glide.load.engine.GlideException
|
import com.github.piasy.biv.view.ImageShownCallback
|
||||||
import com.bumptech.glide.load.model.GlideUrl
|
|
||||||
import com.bumptech.glide.load.model.LazyHeaders
|
|
||||||
import com.bumptech.glide.request.RequestListener
|
|
||||||
import com.bumptech.glide.request.target.Target
|
|
||||||
import kotlinx.android.synthetic.main.item_reader.view.*
|
import kotlinx.android.synthetic.main.item_reader.view.*
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import xyz.quaver.Code
|
|
||||||
import xyz.quaver.hitomi.Reader
|
import xyz.quaver.hitomi.Reader
|
||||||
import xyz.quaver.hitomi.getReferer
|
|
||||||
import xyz.quaver.hitomi.imageUrlFromImage
|
|
||||||
import xyz.quaver.hiyobi.createImgList
|
|
||||||
import xyz.quaver.pupil.BuildConfig
|
|
||||||
import xyz.quaver.pupil.R
|
import xyz.quaver.pupil.R
|
||||||
import xyz.quaver.pupil.services.DownloadService
|
|
||||||
import xyz.quaver.pupil.ui.ReaderActivity
|
import xyz.quaver.pupil.ui.ReaderActivity
|
||||||
import xyz.quaver.pupil.util.Preferences
|
|
||||||
import xyz.quaver.pupil.util.downloader.Cache
|
import xyz.quaver.pupil.util.downloader.Cache
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import kotlin.concurrent.schedule
|
import kotlin.concurrent.schedule
|
||||||
@@ -57,18 +46,45 @@ class ReaderAdapter(private val activity: ReaderActivity,
|
|||||||
var reader: Reader? = null
|
var reader: Reader? = null
|
||||||
val timer = Timer()
|
val timer = Timer()
|
||||||
|
|
||||||
private val glide = Glide.with(activity)
|
|
||||||
|
|
||||||
var isFullScreen = false
|
var isFullScreen = false
|
||||||
|
|
||||||
var onItemClickListener : ((Int) -> (Unit))? = null
|
var onItemClickListener : (() -> (Unit))? = null
|
||||||
|
|
||||||
class ViewHolder(val view: View) : RecyclerView.ViewHolder(view)
|
class ViewHolder(val view: View) : RecyclerView.ViewHolder(view) {
|
||||||
|
fun clear() {
|
||||||
|
view.image.mainView.let {
|
||||||
|
when (it) {
|
||||||
|
is SubsamplingScaleImageView ->
|
||||||
|
it.recycle()
|
||||||
|
is SimpleDraweeView ->
|
||||||
|
it.controller = null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||||
return LayoutInflater.from(parent.context).inflate(
|
return LayoutInflater.from(parent.context).inflate(
|
||||||
R.layout.item_reader, parent, false
|
R.layout.item_reader, parent, false
|
||||||
).let {
|
).let {
|
||||||
|
with (it) {
|
||||||
|
image.setImageViewFactory(FrescoImageViewFactory())
|
||||||
|
image.setImageShownCallback(object: ImageShownCallback {
|
||||||
|
override fun onThumbnailShown() {}
|
||||||
|
override fun onMainImageShown() {
|
||||||
|
placeholder.updateLayoutParams<ConstraintLayout.LayoutParams> {
|
||||||
|
dimensionRatio = null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
image.setOnClickListener {
|
||||||
|
onItemClickListener?.invoke()
|
||||||
|
}
|
||||||
|
setOnClickListener {
|
||||||
|
onItemClickListener?.invoke()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ViewHolder(it)
|
ViewHolder(it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -80,121 +96,43 @@ class ReaderAdapter(private val activity: ReaderActivity,
|
|||||||
if (cache == null)
|
if (cache == null)
|
||||||
cache = Cache.getInstance(holder.view.context, galleryID)
|
cache = Cache.getInstance(holder.view.context, galleryID)
|
||||||
|
|
||||||
if (isFullScreen) {
|
holder.view.layoutParams.height =
|
||||||
holder.view.layoutParams.height = ConstraintLayout.LayoutParams.MATCH_PARENT
|
if (isFullScreen)
|
||||||
} else {
|
ConstraintLayout.LayoutParams.MATCH_PARENT
|
||||||
holder.view.layoutParams.height = ConstraintLayout.LayoutParams.WRAP_CONTENT
|
else
|
||||||
|
ConstraintLayout.LayoutParams.WRAP_CONTENT
|
||||||
|
|
||||||
(holder.view.progress_layout.layoutParams as ConstraintLayout.LayoutParams)
|
holder.view.image.layoutParams.height =
|
||||||
.dimensionRatio = "${reader!!.galleryInfo.files[position].width}:${reader!!.galleryInfo.files[position].height}"
|
if (isFullScreen)
|
||||||
}
|
ConstraintLayout.LayoutParams.MATCH_PARENT
|
||||||
|
else
|
||||||
|
ConstraintLayout.LayoutParams.WRAP_CONTENT
|
||||||
|
|
||||||
holder.view.image.setOnPhotoTapListener { _, _, _ ->
|
holder.view.placeholder.updateLayoutParams<ConstraintLayout.LayoutParams> {
|
||||||
onItemClickListener?.invoke(position)
|
dimensionRatio = "${reader!!.galleryInfo.files[position].width}:${reader!!.galleryInfo.files[position].height}"
|
||||||
}
|
|
||||||
|
|
||||||
holder.view.setOnClickListener {
|
|
||||||
onItemClickListener?.invoke(position)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
holder.view.reader_index.text = (position+1).toString()
|
holder.view.reader_index.text = (position+1).toString()
|
||||||
|
|
||||||
if (Preferences["cache_disable"]) {
|
val image = cache!!.getImage(position)
|
||||||
val lowQuality: Boolean = Preferences["low_quality"]
|
val progress = activity.downloader?.progress?.get(galleryID)?.get(position)
|
||||||
|
|
||||||
val url = when (reader!!.code) {
|
if (progress?.isInfinite() == true && image != null) {
|
||||||
Code.HITOMI ->
|
holder.view.progress_group.visibility = View.INVISIBLE
|
||||||
GlideUrl(
|
holder.view.image.showImage(image.uri)
|
||||||
imageUrlFromImage(
|
|
||||||
galleryID,
|
|
||||||
reader!!.galleryInfo.files[position],
|
|
||||||
!lowQuality
|
|
||||||
)
|
|
||||||
, LazyHeaders.Builder().addHeader("Referer", getReferer(galleryID)).build())
|
|
||||||
Code.HIYOBI ->
|
|
||||||
GlideUrl(createImgList(galleryID, reader!!, lowQuality)[position].path)
|
|
||||||
else -> null
|
|
||||||
}
|
|
||||||
holder.view.image.post {
|
|
||||||
glide
|
|
||||||
.load(url!!)
|
|
||||||
.diskCacheStrategy(DiskCacheStrategy.NONE)
|
|
||||||
.skipMemoryCache(false)
|
|
||||||
.error(R.drawable.image_broken_variant)
|
|
||||||
.apply {
|
|
||||||
if (BuildConfig.CENSOR)
|
|
||||||
override(5, 8)
|
|
||||||
else
|
|
||||||
override(
|
|
||||||
holder.view.context.resources.displayMetrics.widthPixels,
|
|
||||||
holder.view.context.resources.getDimensionPixelSize(R.dimen.reader_max_height)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
.error(R.drawable.image_broken_variant)
|
|
||||||
.into(holder.view.image)
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
val image = cache!!.getImage(position)
|
holder.view.progress_group.visibility = View.VISIBLE
|
||||||
val progress = activity.downloader?.progress?.get(galleryID)?.get(position)
|
holder.view.reader_item_progressbar.progress =
|
||||||
|
if (progress?.isInfinite() == true)
|
||||||
|
100
|
||||||
|
else
|
||||||
|
progress?.roundToInt() ?: 0
|
||||||
|
|
||||||
if (progress?.isInfinite() == true && image != null) {
|
holder.clear()
|
||||||
holder.view.reader_item_progressbar.visibility = View.INVISIBLE
|
|
||||||
|
|
||||||
CoroutineScope(Dispatchers.IO).launch {
|
timer.schedule(1000) {
|
||||||
glide
|
CoroutineScope(Dispatchers.Main).launch {
|
||||||
.load(image.uri)
|
notifyItemChanged(position)
|
||||||
.diskCacheStrategy(DiskCacheStrategy.NONE)
|
|
||||||
.skipMemoryCache(true)
|
|
||||||
.apply {
|
|
||||||
if (BuildConfig.CENSOR)
|
|
||||||
override(5, 8)
|
|
||||||
else
|
|
||||||
override(
|
|
||||||
holder.view.context.resources.displayMetrics.widthPixels,
|
|
||||||
holder.view.context.resources.getDimensionPixelSize(R.dimen.reader_max_height)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
.error(R.drawable.image_broken_variant)
|
|
||||||
.listener(object: RequestListener<Drawable> {
|
|
||||||
override fun onLoadFailed(
|
|
||||||
e: GlideException?,
|
|
||||||
model: Any?,
|
|
||||||
target: Target<Drawable>?,
|
|
||||||
isFirstResource: Boolean
|
|
||||||
): Boolean {
|
|
||||||
cache!!.metadata.imageList?.set(position, null)
|
|
||||||
image.delete()
|
|
||||||
DownloadService.cancel(holder.view.context, galleryID)
|
|
||||||
DownloadService.download(holder.view.context, galleryID, true)
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onResourceReady(
|
|
||||||
resource: Drawable?,
|
|
||||||
model: Any?,
|
|
||||||
target: Target<Drawable>?,
|
|
||||||
dataSource: DataSource?,
|
|
||||||
isFirstResource: Boolean
|
|
||||||
) = false
|
|
||||||
}).let { launch(Dispatchers.Main) { it.into(holder.view.image) } }
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
holder.view.reader_item_progressbar.visibility = View.VISIBLE
|
|
||||||
|
|
||||||
glide.clear(holder.view.image)
|
|
||||||
|
|
||||||
holder.view.reader_item_progressbar.progress =
|
|
||||||
if (progress?.isInfinite() == true)
|
|
||||||
100
|
|
||||||
else
|
|
||||||
progress?.roundToInt() ?: 0
|
|
||||||
|
|
||||||
holder.view.image.setImageDrawable(null)
|
|
||||||
|
|
||||||
timer.schedule(1000) {
|
|
||||||
CoroutineScope(Dispatchers.Main).launch {
|
|
||||||
notifyItemChanged(position)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -202,4 +140,8 @@ class ReaderAdapter(private val activity: ReaderActivity,
|
|||||||
|
|
||||||
override fun getItemCount() = reader?.galleryInfo?.files?.size ?: 0
|
override fun getItemCount() = reader?.galleryInfo?.files?.size ?: 0
|
||||||
|
|
||||||
|
override fun onViewRecycled(holder: ViewHolder) {
|
||||||
|
holder.clear()
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -332,16 +332,13 @@ class MainActivity :
|
|||||||
}
|
}
|
||||||
onDownloadClickedHandler = { position ->
|
onDownloadClickedHandler = { position ->
|
||||||
val galleryID = galleries[position]
|
val galleryID = galleries[position]
|
||||||
if (Preferences["cache_disable"])
|
|
||||||
Toast.makeText(context, R.string.settings_download_when_cache_disable_warning, Toast.LENGTH_SHORT).show()
|
if (DownloadManager.getInstance(context).isDownloading(galleryID)) { //download in progress
|
||||||
|
DownloadService.cancel(this@MainActivity, galleryID)
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
if (DownloadManager.getInstance(context).isDownloading(galleryID)) { //download in progress
|
DownloadManager.getInstance(context).addDownloadFolder(galleryID)
|
||||||
DownloadService.cancel(this@MainActivity, galleryID)
|
DownloadService.download(this@MainActivity, galleryID)
|
||||||
}
|
|
||||||
else {
|
|
||||||
DownloadManager.getInstance(context).addDownloadFolder(galleryID)
|
|
||||||
DownloadService.download(this@MainActivity, galleryID)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
closeAllItems()
|
closeAllItems()
|
||||||
|
|||||||
@@ -139,38 +139,7 @@ class ReaderActivity : BaseActivity() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Preferences["cache_disable"]) {
|
initDownloadListener()
|
||||||
reader_download_progressbar.visibility = View.GONE
|
|
||||||
CoroutineScope(Dispatchers.IO).launch {
|
|
||||||
val reader = cache.getReader()
|
|
||||||
|
|
||||||
launch(Dispatchers.Main) initDownloader@{
|
|
||||||
if (reader == null) {
|
|
||||||
Snackbar
|
|
||||||
.make(reader_layout, R.string.reader_failed_to_find_gallery, Snackbar.LENGTH_INDEFINITE)
|
|
||||||
.show()
|
|
||||||
return@initDownloader
|
|
||||||
}
|
|
||||||
|
|
||||||
histories.add(galleryID)
|
|
||||||
(reader_recyclerview.adapter as ReaderAdapter).apply {
|
|
||||||
this.reader = reader
|
|
||||||
notifyDataSetChanged()
|
|
||||||
}
|
|
||||||
title = reader.galleryInfo.title ?: ""
|
|
||||||
menu?.findItem(R.id.reader_menu_page_indicator)?.title = "$currentPage/${reader.galleryInfo.files.size}"
|
|
||||||
|
|
||||||
menu?.findItem(R.id.reader_type)?.icon = ContextCompat.getDrawable(this@ReaderActivity,
|
|
||||||
when (reader.code) {
|
|
||||||
Code.HITOMI -> R.drawable.hitomi
|
|
||||||
Code.HIYOBI -> R.drawable.ic_hiyobi
|
|
||||||
else -> android.R.color.transparent
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
initDownloadListener()
|
|
||||||
|
|
||||||
initView()
|
initView()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -396,19 +365,15 @@ class ReaderActivity : BaseActivity() {
|
|||||||
animateDownloadFAB(DownloadManager.getInstance(this@ReaderActivity).getDownloadFolder(galleryID) != null) //If download in progress, animate button
|
animateDownloadFAB(DownloadManager.getInstance(this@ReaderActivity).getDownloadFolder(galleryID) != null) //If download in progress, animate button
|
||||||
|
|
||||||
setOnClickListener {
|
setOnClickListener {
|
||||||
if (PreferenceManager.getDefaultSharedPreferences(context).getBoolean("cache_disable", false))
|
val downloadManager = DownloadManager.getInstance(this@ReaderActivity)
|
||||||
Toast.makeText(context, R.string.settings_download_when_cache_disable_warning, Toast.LENGTH_SHORT).show()
|
|
||||||
else {
|
|
||||||
val downloadManager = DownloadManager.getInstance(this@ReaderActivity)
|
|
||||||
|
|
||||||
if (downloadManager.isDownloading(galleryID)) {
|
if (downloadManager.isDownloading(galleryID)) {
|
||||||
downloadManager.deleteDownloadFolder(galleryID)
|
downloadManager.deleteDownloadFolder(galleryID)
|
||||||
animateDownloadFAB(false)
|
animateDownloadFAB(false)
|
||||||
} else {
|
} else {
|
||||||
downloadManager.addDownloadFolder(galleryID)
|
downloadManager.addDownloadFolder(galleryID)
|
||||||
DownloadService.download(context, galleryID, true)
|
DownloadService.download(context, galleryID, true)
|
||||||
animateDownloadFAB(true)
|
animateDownloadFAB(true)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -110,7 +110,7 @@
|
|||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/galleryblock_thumbnail"
|
android:id="@+id/galleryblock_thumbnail"
|
||||||
android:layout_width="150dp"
|
android:layout_width="150dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="0dp"
|
||||||
android:contentDescription="@string/galleryblock_thumbnail_description"
|
android:contentDescription="@string/galleryblock_thumbnail_description"
|
||||||
android:adjustViewBounds="true"
|
android:adjustViewBounds="true"
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
@@ -188,7 +188,7 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:barrierDirection="bottom"
|
app:barrierDirection="bottom"
|
||||||
app:constraint_referenced_ids="galleryblock_thumbnail,galleryblock_tag_group"/>
|
app:constraint_referenced_ids="galleryblock_tag_group"/>
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:id="@+id/divider"
|
android:id="@+id/divider"
|
||||||
|
|||||||
@@ -21,47 +21,60 @@
|
|||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:layout_constraintHeight_max="2000dp"
|
android:layout_marginBottom="8dp"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
android:paddingBottom="8dp"
|
|
||||||
android:background="@drawable/reader_item_boundary">
|
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"/>
|
||||||
|
|
||||||
<LinearLayout
|
<ProgressBar
|
||||||
android:id="@+id/progress_layout"
|
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"/>
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.Placeholder
|
||||||
|
android:id="@+id/placeholder"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
android:gravity="center"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<ProgressBar
|
<com.github.piasy.biv.view.BigImageView
|
||||||
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"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/reader_index"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
style="@style/TextAppearance.AppCompat.Caption"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<com.github.chrisbanes.photoview.PhotoView
|
|
||||||
android:id="@+id/image"
|
android:id="@+id/image"
|
||||||
android:adjustViewBounds="true"
|
|
||||||
android:scaleType="fitCenter"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
app:initScaleType="fitCenter"
|
||||||
|
app:failureImage="@drawable/image_broken_variant"
|
||||||
|
app:optimizeDisplay="true"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||||
|
|
||||||
|
|||||||
@@ -127,8 +127,6 @@
|
|||||||
<string name="settings_lock_fingerprint_prompt">Pupil指紋ロック™</string>
|
<string name="settings_lock_fingerprint_prompt">Pupil指紋ロック™</string>
|
||||||
<string name="settings_lock_fingerprint_prompt_subtitle">こうかはばつぐんだ!</string>
|
<string name="settings_lock_fingerprint_prompt_subtitle">こうかはばつぐんだ!</string>
|
||||||
<string name="default_query_dialog_filter_loli">登場人物を全て18歳以上にする</string>
|
<string name="default_query_dialog_filter_loli">登場人物を全て18歳以上にする</string>
|
||||||
<string name="settings_cache_disable">キャッシュを使用しない</string>
|
|
||||||
<string name="settings_download_when_cache_disable_warning">キャッシュを使用しないため、ダウンロードできません</string>
|
|
||||||
<string name="settings_user_id">ユーザーID</string>
|
<string name="settings_user_id">ユーザーID</string>
|
||||||
<string name="settings_user_id_toast">ユーザーIDをクリップボードにコピーしました</string>
|
<string name="settings_user_id_toast">ユーザーIDをクリップボードにコピーしました</string>
|
||||||
<string name="reader_fab_retry">リトライ</string>
|
<string name="reader_fab_retry">リトライ</string>
|
||||||
|
|||||||
@@ -127,8 +127,6 @@
|
|||||||
<string name="settings_lock_fingerprint_prompt">Pupil 지문 인식™</string>
|
<string name="settings_lock_fingerprint_prompt">Pupil 지문 인식™</string>
|
||||||
<string name="settings_lock_fingerprint_prompt_subtitle">힘세고 강한 지문 인식</string>
|
<string name="settings_lock_fingerprint_prompt_subtitle">힘세고 강한 지문 인식</string>
|
||||||
<string name="default_query_dialog_filter_loli">판사님 저는 페도가 아닙니다</string>
|
<string name="default_query_dialog_filter_loli">판사님 저는 페도가 아닙니다</string>
|
||||||
<string name="settings_cache_disable">캐시 비활성화</string>
|
|
||||||
<string name="settings_download_when_cache_disable_warning">캐시를 활성화 해야 다운로드를 진행할 수 있습니다</string>
|
|
||||||
<string name="settings_user_id">유저 ID</string>
|
<string name="settings_user_id">유저 ID</string>
|
||||||
<string name="settings_user_id_toast">유저 ID를 클립보드에 복사했습니다</string>
|
<string name="settings_user_id_toast">유저 ID를 클립보드에 복사했습니다</string>
|
||||||
<string name="reader_fab_retry">재시도</string>
|
<string name="reader_fab_retry">재시도</string>
|
||||||
|
|||||||
@@ -155,8 +155,6 @@
|
|||||||
<string name="settings_download_folder_available">%s available</string>
|
<string name="settings_download_folder_available">%s available</string>
|
||||||
<string name="settings_download_folder_custom">Custom Location</string>
|
<string name="settings_download_folder_custom">Custom Location</string>
|
||||||
<string name="settings_download_folder_not_writable">This folder is not writable. Please select another folder.</string>
|
<string name="settings_download_folder_not_writable">This folder is not writable. Please select another folder.</string>
|
||||||
<string name="settings_cache_disable">Disable Cache</string>
|
|
||||||
<string name="settings_download_when_cache_disable_warning">Download is disabled when the cache is disabled</string>
|
|
||||||
<string name="settings_low_quality">Low quality images</string>
|
<string name="settings_low_quality">Low quality images</string>
|
||||||
<string name="settings_low_quality_summary">Load low quality images to improve load speed and data usage</string>
|
<string name="settings_low_quality_summary">Load low quality images to improve load speed and data usage</string>
|
||||||
|
|
||||||
|
|||||||
@@ -44,10 +44,6 @@
|
|||||||
app:key="download_folder"
|
app:key="download_folder"
|
||||||
app:title="@string/settings_download_folder"/>
|
app:title="@string/settings_download_folder"/>
|
||||||
|
|
||||||
<SwitchPreferenceCompat
|
|
||||||
app:key="cache_disable"
|
|
||||||
app:title="@string/settings_cache_disable"/>
|
|
||||||
|
|
||||||
<SwitchPreferenceCompat
|
<SwitchPreferenceCompat
|
||||||
app:key="nomedia"
|
app:key="nomedia"
|
||||||
app:title="@string/settings_nomedia_title"/>
|
app:title="@string/settings_nomedia_title"/>
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ buildscript {
|
|||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
repositories {
|
repositories {
|
||||||
|
maven { url "http://dl.bintray.com/piasy/maven" }
|
||||||
google()
|
google()
|
||||||
jcenter()
|
jcenter()
|
||||||
maven { url "https://jitpack.io" }
|
maven { url "https://jitpack.io" }
|
||||||
|
|||||||
5555
dependencies.txt
5555
dependencies.txt
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user