Compare commits
4 Commits
5.1.5-hotf
...
5.1.5-hotf
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
331cbec5f1 | ||
|
|
7f02284285 | ||
|
|
ac2c3a6d97 | ||
|
|
c3bc80fec6 |
6
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
6
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<profile version="1.0">
|
||||||
|
<option name="myName" value="Project Default" />
|
||||||
|
<inspection_tool class="AndroidLintNewerVersionAvailable" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
</profile>
|
||||||
|
</component>
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
*Pupil, Hitomi.la viewer for Android*
|
*Pupil, Hitomi.la viewer for Android*
|
||||||
|
|
||||||

|

|
||||||
[](https://github.com/tom5079/Pupil/releases/download/5.1.5/Pupil-v5.1.5.apk)
|
[](https://github.com/tom5079/Pupil/releases/download/5.1.5-hotfix2/Pupil-v5.1.5-hotfix2.apk)
|
||||||
[](https://discord.gg/Stj4b5v)
|
[](https://discord.gg/Stj4b5v)
|
||||||
|
|
||||||
# Features
|
# Features
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ android {
|
|||||||
minSdkVersion 16
|
minSdkVersion 16
|
||||||
targetSdkVersion 30
|
targetSdkVersion 30
|
||||||
versionCode 63
|
versionCode 63
|
||||||
versionName "5.1.5"
|
versionName "5.1.5-hotfix2"
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
vectorDrawables.useSupportLibrary = true
|
vectorDrawables.useSupportLibrary = true
|
||||||
}
|
}
|
||||||
@@ -77,8 +77,8 @@ android {
|
|||||||
dependencies {
|
dependencies {
|
||||||
implementation fileTree(dir: "libs", include: ["*.jar", "*.aar"])
|
implementation fileTree(dir: "libs", include: ["*.jar", "*.aar"])
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
|
||||||
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9"
|
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.0-M1"
|
||||||
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.0.0-RC2"
|
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.0.0"
|
||||||
|
|
||||||
implementation "androidx.appcompat:appcompat:1.2.0"
|
implementation "androidx.appcompat:appcompat:1.2.0"
|
||||||
implementation "androidx.activity:activity-ktx:1.2.0-beta01"
|
implementation "androidx.activity:activity-ktx:1.2.0-beta01"
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
"type": "SINGLE",
|
"type": "SINGLE",
|
||||||
"filters": [],
|
"filters": [],
|
||||||
"versionCode": 63,
|
"versionCode": 63,
|
||||||
"versionName": "5.1.5",
|
"versionName": "5.1.5-hotfix2",
|
||||||
"outputFile": "app-release.apk"
|
"outputFile": "app-release.apk"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -18,7 +18,10 @@
|
|||||||
|
|
||||||
package xyz.quaver.pupil
|
package xyz.quaver.pupil
|
||||||
|
|
||||||
import android.app.*
|
import android.app.Application
|
||||||
|
import android.app.Notification
|
||||||
|
import android.app.NotificationChannel
|
||||||
|
import android.app.NotificationManager
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
|
|||||||
@@ -255,13 +255,15 @@ class SettingsFragment :
|
|||||||
isEnabled = false
|
isEnabled = false
|
||||||
|
|
||||||
CoroutineScope(Dispatchers.IO).launch {
|
CoroutineScope(Dispatchers.IO).launch {
|
||||||
val languages = getAvailableLanguages().distinct().toTypedArray()
|
kotlin.runCatching {
|
||||||
|
val languages = getAvailableLanguages().distinct().toTypedArray()
|
||||||
|
|
||||||
entries = languages.map { Locale(it).let { loc -> loc.getDisplayLanguage(loc) } }.toTypedArray()
|
entries = languages.map { Locale(it).let { loc -> loc.getDisplayLanguage(loc) } }.toTypedArray()
|
||||||
entryValues = languages
|
entryValues = languages
|
||||||
|
|
||||||
launch(Dispatchers.Main) {
|
launch(Dispatchers.Main) {
|
||||||
isEnabled = true
|
isEnabled = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,10 +24,7 @@ import android.util.AttributeSet
|
|||||||
import android.util.Log
|
import android.util.Log
|
||||||
import com.google.android.material.chip.Chip
|
import com.google.android.material.chip.Chip
|
||||||
import com.google.android.material.chip.ChipGroup
|
import com.google.android.material.chip.ChipGroup
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.*
|
||||||
import kotlinx.coroutines.Dispatchers
|
|
||||||
import kotlinx.coroutines.async
|
|
||||||
import kotlinx.coroutines.launch
|
|
||||||
import xyz.quaver.pupil.R
|
import xyz.quaver.pupil.R
|
||||||
import xyz.quaver.pupil.types.Tag
|
import xyz.quaver.pupil.types.Tag
|
||||||
import xyz.quaver.pupil.types.Tags
|
import xyz.quaver.pupil.types.Tags
|
||||||
@@ -71,10 +68,12 @@ class TagChipGroup @JvmOverloads constructor(context: Context, attr: AttributeSe
|
|||||||
maxChipSize = attr.getInt(R.styleable.TagChipGroup_maxTag, Defaults.maxChipSize)
|
maxChipSize = attr.getInt(R.styleable.TagChipGroup_maxTag, Defaults.maxChipSize)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private var refreshJob: Job? = null
|
||||||
fun refresh() {
|
fun refresh() {
|
||||||
|
refreshJob?.cancel()
|
||||||
this.removeAllViews()
|
this.removeAllViews()
|
||||||
|
|
||||||
CoroutineScope(Dispatchers.Main).launch {
|
refreshJob = CoroutineScope(Dispatchers.Main).launch {
|
||||||
tags.take(maxChipSize).map {
|
tags.take(maxChipSize).map {
|
||||||
CoroutineScope(Dispatchers.Default).async {
|
CoroutineScope(Dispatchers.Default).async {
|
||||||
TagChip(context, it).apply {
|
TagChip(context, it).apply {
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import kotlinx.serialization.json.Json
|
|||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
class SavedSet <T: Any> (private val file: File, private val any: T, private val set: MutableSet<T> = Collections.synchronizedSet(mutableSetOf())) : MutableSet<T> by set {
|
class SavedSet <T: Any> (private val file: File, private val any: T, private val set: MutableSet<T> = mutableSetOf()) : MutableSet<T> by set {
|
||||||
|
|
||||||
@Suppress("UNCHECKED_CAST")
|
@Suppress("UNCHECKED_CAST")
|
||||||
@OptIn(ExperimentalSerializationApi::class)
|
@OptIn(ExperimentalSerializationApi::class)
|
||||||
@@ -39,24 +39,23 @@ class SavedSet <T: Any> (private val file: File, private val any: T, private val
|
|||||||
load()
|
load()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Synchronized
|
||||||
fun load() {
|
fun load() {
|
||||||
synchronized(this) {
|
set.clear()
|
||||||
set.clear()
|
kotlin.runCatching {
|
||||||
kotlin.runCatching {
|
Json.decodeFromString(serializer, file.readText())
|
||||||
Json.decodeFromString(serializer, file.readText())
|
}.onSuccess {
|
||||||
}.onSuccess {
|
set.addAll(it)
|
||||||
set.addAll(it)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Synchronized
|
||||||
@OptIn(ExperimentalSerializationApi::class)
|
@OptIn(ExperimentalSerializationApi::class)
|
||||||
fun save() {
|
fun save() {
|
||||||
synchronized(this) {
|
file.writeText(Json.encodeToString(serializer, set.toList()))
|
||||||
file.writeText(Json.encodeToString(serializer, set.toList()))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Synchronized
|
||||||
override fun add(element: T): Boolean {
|
override fun add(element: T): Boolean {
|
||||||
load()
|
load()
|
||||||
|
|
||||||
@@ -67,6 +66,7 @@ class SavedSet <T: Any> (private val file: File, private val any: T, private val
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Synchronized
|
||||||
override fun addAll(elements: Collection<T>): Boolean {
|
override fun addAll(elements: Collection<T>): Boolean {
|
||||||
load()
|
load()
|
||||||
|
|
||||||
@@ -77,6 +77,7 @@ class SavedSet <T: Any> (private val file: File, private val any: T, private val
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Synchronized
|
||||||
override fun remove(element: T): Boolean {
|
override fun remove(element: T): Boolean {
|
||||||
load()
|
load()
|
||||||
|
|
||||||
@@ -85,6 +86,7 @@ class SavedSet <T: Any> (private val file: File, private val any: T, private val
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Synchronized
|
||||||
override fun clear() {
|
override fun clear() {
|
||||||
set.clear()
|
set.clear()
|
||||||
save()
|
save()
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ class DownloadManager private constructor(context: Context) : ContextWrapper(con
|
|||||||
}.invoke()
|
}.invoke()
|
||||||
}
|
}
|
||||||
|
|
||||||
return downloadFolderMapInstance!!
|
return downloadFolderMapInstance ?: mutableMapOf()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -55,10 +55,12 @@ fun cleanCache(context: Context) = CoroutineScope(Dispatchers.IO).launch {
|
|||||||
while (cacheSize.invoke() > limit/2) {
|
while (cacheSize.invoke() > limit/2) {
|
||||||
val caches = cacheFolder.list() ?: return@withLock
|
val caches = cacheFolder.list() ?: return@withLock
|
||||||
|
|
||||||
(histories.toList().firstOrNull {
|
synchronized(histories) {
|
||||||
caches.contains(it.toString()) && !downloadManager.isDownloading(it)
|
(histories.firstOrNull {
|
||||||
} ?: return@withLock).let {
|
caches.contains(it.toString()) && !downloadManager.isDownloading(it)
|
||||||
Cache.delete(context, it)
|
} ?: return@withLock).let {
|
||||||
|
Cache.delete(context, it)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,11 +42,13 @@ var translations: Map<String, String> = run {
|
|||||||
@Suppress("BlockingMethodInNonBlockingContext")
|
@Suppress("BlockingMethodInNonBlockingContext")
|
||||||
fun updateTranslations() = CoroutineScope(Dispatchers.IO).launch {
|
fun updateTranslations() = CoroutineScope(Dispatchers.IO).launch {
|
||||||
translations = emptyMap()
|
translations = emptyMap()
|
||||||
translations = Json.decodeFromString<Map<String, String>>(client.newCall(
|
kotlin.runCatching {
|
||||||
Request.Builder()
|
translations = Json.decodeFromString<Map<String, String>>(client.newCall(
|
||||||
.url(contentURL + "${Preferences["tag_language", ""]}.json")
|
Request.Builder()
|
||||||
.build()
|
.url(contentURL + "${Preferences["tag_language", ""]}.json")
|
||||||
).execute().also { if (it.code() != 200) return@launch }.body()?.use { it.string() } ?: return@launch).filterValues { it.isNotEmpty() }
|
.build()
|
||||||
|
).execute().also { if (it.code() != 200) return@launch }.body()?.use { it.string() } ?: return@launch).filterValues { it.isNotEmpty() }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getAvailableLanguages(): List<String> {
|
fun getAvailableLanguages(): List<String> {
|
||||||
|
|||||||
@@ -154,4 +154,5 @@
|
|||||||
<string name="settings_cache_unlimited">制限なし</string>
|
<string name="settings_cache_unlimited">制限なし</string>
|
||||||
<string name="settings_tag_language">タグ言語</string>
|
<string name="settings_tag_language">タグ言語</string>
|
||||||
<string name="settings_tag_language_message">Githubにて翻訳に参加できます</string>
|
<string name="settings_tag_language_message">Githubにて翻訳に参加できます</string>
|
||||||
|
<string name="settings_concurrent_download">並列ダウンロード</string>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -154,4 +154,5 @@
|
|||||||
<string name="settings_cache_unlimited">무제한</string>
|
<string name="settings_cache_unlimited">무제한</string>
|
||||||
<string name="settings_tag_language">태그 언어</string>
|
<string name="settings_tag_language">태그 언어</string>
|
||||||
<string name="settings_tag_language_message">Github에서 번역에 참여하세요</string>
|
<string name="settings_tag_language_message">Github에서 번역에 참여하세요</string>
|
||||||
|
<string name="settings_concurrent_download">병렬 다운로드</string>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -176,6 +176,7 @@
|
|||||||
|
|
||||||
<string name="settings_miscellaneous_title">Miscellaneous</string>
|
<string name="settings_miscellaneous_title">Miscellaneous</string>
|
||||||
<string name="settings_tag_language">Tag Language</string>
|
<string name="settings_tag_language">Tag Language</string>
|
||||||
|
<string name="settings_concurrent_download">Concurrent Download</string>
|
||||||
<string name="settings_tag_language_message">Participate in translation on Github</string>
|
<string name="settings_tag_language_message">Participate in translation on Github</string>
|
||||||
<string name="settings_mirror_summary">Load images from mirrors</string>
|
<string name="settings_mirror_summary">Load images from mirrors</string>
|
||||||
<string name="settings_proxy_title">Proxy</string>
|
<string name="settings_proxy_title">Proxy</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user