Compare commits
8 Commits
4.19-hotfi
...
4.20-hotfi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6ebc386474 | ||
|
|
3e657bdc09 | ||
|
|
0b0adb76a1 | ||
|
|
17b3e010aa | ||
|
|
20003acd73 | ||
|
|
2ab7672092 | ||
|
|
c317abe64b | ||
|
|
bc33ce1ebc |
55
.idea/jarRepositories.xml
generated
Normal file
55
.idea/jarRepositories.xml
generated
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="RemoteRepositoriesConfiguration">
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="central" />
|
||||||
|
<option name="name" value="Maven Central repository" />
|
||||||
|
<option name="url" value="https://repo1.maven.org/maven2" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="jboss.community" />
|
||||||
|
<option name="name" value="JBoss Community repository" />
|
||||||
|
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="maven2" />
|
||||||
|
<option name="name" value="maven2" />
|
||||||
|
<option name="url" value="http://guardian.github.com/maven/repo-releases" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="BintrayJCenter" />
|
||||||
|
<option name="name" value="BintrayJCenter" />
|
||||||
|
<option name="url" value="https://jcenter.bintray.com/" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="maven" />
|
||||||
|
<option name="name" value="maven" />
|
||||||
|
<option name="url" value="https://jitpack.io" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="Google" />
|
||||||
|
<option name="name" value="Google" />
|
||||||
|
<option name="url" value="https://dl.google.com/dl/android/maven2/" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="MavenRepo" />
|
||||||
|
<option name="name" value="MavenRepo" />
|
||||||
|
<option name="url" value="https://repo.maven.apache.org/maven2/" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="maven2" />
|
||||||
|
<option name="name" value="maven2" />
|
||||||
|
<option name="url" value="https://guardian.github.com/maven/repo-releases" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="maven3" />
|
||||||
|
<option name="name" value="maven3" />
|
||||||
|
<option name="url" value="https://s3.amazonaws.com/fabric-artifacts-private/internal-snapshots" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="maven4" />
|
||||||
|
<option name="name" value="maven4" />
|
||||||
|
<option name="url" value="https://maven.fabric.io/public" />
|
||||||
|
</remote-repository>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
@@ -20,7 +20,7 @@ android {
|
|||||||
minSdkVersion 16
|
minSdkVersion 16
|
||||||
targetSdkVersion 29
|
targetSdkVersion 29
|
||||||
versionCode 57
|
versionCode 57
|
||||||
versionName "4.19-hotfix2"
|
versionName "4.20-hotfix1"
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
multiDexEnabled true
|
multiDexEnabled true
|
||||||
vectorDrawables.useSupportLibrary = true
|
vectorDrawables.useSupportLibrary = true
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
"filters": [],
|
"filters": [],
|
||||||
"properties": [],
|
"properties": [],
|
||||||
"versionCode": 57,
|
"versionCode": 57,
|
||||||
"versionName": "4.19-hotfix2",
|
"versionName": "4.20-hotfix1",
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"outputFile": "app-release.apk"
|
"outputFile": "app-release.apk"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,6 @@
|
|||||||
package xyz.quaver.pupil
|
package xyz.quaver.pupil
|
||||||
|
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import androidx.core.content.ContextCompat
|
|
||||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||||
import androidx.test.platform.app.InstrumentationRegistry
|
import androidx.test.platform.app.InstrumentationRegistry
|
||||||
import androidx.test.rule.ActivityTestRule
|
import androidx.test.rule.ActivityTestRule
|
||||||
@@ -36,6 +35,8 @@ import xyz.quaver.hiyobi.user_agent
|
|||||||
import xyz.quaver.pupil.ui.LockActivity
|
import xyz.quaver.pupil.ui.LockActivity
|
||||||
import xyz.quaver.pupil.util.download.Cache
|
import xyz.quaver.pupil.util.download.Cache
|
||||||
import xyz.quaver.pupil.util.download.DownloadWorker
|
import xyz.quaver.pupil.util.download.DownloadWorker
|
||||||
|
import xyz.quaver.pupil.util.getDownloadDirectory
|
||||||
|
import java.io.InputStreamReader
|
||||||
import java.net.URL
|
import java.net.URL
|
||||||
import javax.net.ssl.HttpsURLConnection
|
import javax.net.ssl.HttpsURLConnection
|
||||||
|
|
||||||
@@ -58,8 +59,10 @@ class ExampleInstrumentedTest {
|
|||||||
val activityTestRule = ActivityTestRule(LockActivity::class.java)
|
val activityTestRule = ActivityTestRule(LockActivity::class.java)
|
||||||
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
|
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
|
||||||
|
|
||||||
ContextCompat.getExternalFilesDirs(appContext, null).forEachIndexed { index, file ->
|
Runtime.getRuntime().exec("du -hs " + getDownloadDirectory(appContext)).let {
|
||||||
Log.i("PUPILD", "$index: ${file?.absolutePath}")
|
InputStreamReader(it.inputStream).readLines().forEach { res ->
|
||||||
|
Log.i("PUPILD", res)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -98,6 +98,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
setText(query, TextView.BufferType.EDITABLE)
|
setText(query, TextView.BufferType.EDITABLE)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private var queryStack = mutableListOf<String>()
|
||||||
|
|
||||||
private var mode = Mode.SEARCH
|
private var mode = Mode.SEARCH
|
||||||
private var sortMode = SortMode.NEWEST
|
private var sortMode = SortMode.NEWEST
|
||||||
@@ -159,11 +160,12 @@ class MainActivity : AppCompatActivity() {
|
|||||||
initView()
|
initView()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OptIn(ExperimentalStdlibApi::class)
|
||||||
override fun onBackPressed() {
|
override fun onBackPressed() {
|
||||||
when {
|
when {
|
||||||
main_drawer_layout.isDrawerOpen(GravityCompat.START) -> main_drawer_layout.closeDrawer(GravityCompat.START)
|
main_drawer_layout.isDrawerOpen(GravityCompat.START) -> main_drawer_layout.closeDrawer(GravityCompat.START)
|
||||||
query.isNotEmpty() -> runOnUiThread {
|
queryStack.removeLastOrNull() != null && queryStack.isNotEmpty() -> runOnUiThread {
|
||||||
query = ""
|
query = queryStack.last()
|
||||||
|
|
||||||
cancelFetch()
|
cancelFetch()
|
||||||
clearGalleries()
|
clearGalleries()
|
||||||
@@ -278,6 +280,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
clearGalleries()
|
clearGalleries()
|
||||||
currentPage = 0
|
currentPage = 0
|
||||||
query = ""
|
query = ""
|
||||||
|
queryStack.clear()
|
||||||
mode = Mode.SEARCH
|
mode = Mode.SEARCH
|
||||||
fetchGalleries(query, sortMode)
|
fetchGalleries(query, sortMode)
|
||||||
loadBlocks()
|
loadBlocks()
|
||||||
@@ -287,6 +290,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
clearGalleries()
|
clearGalleries()
|
||||||
currentPage = 0
|
currentPage = 0
|
||||||
query = ""
|
query = ""
|
||||||
|
queryStack.clear()
|
||||||
mode = Mode.HISTORY
|
mode = Mode.HISTORY
|
||||||
fetchGalleries(query, sortMode)
|
fetchGalleries(query, sortMode)
|
||||||
loadBlocks()
|
loadBlocks()
|
||||||
@@ -296,6 +300,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
clearGalleries()
|
clearGalleries()
|
||||||
currentPage = 0
|
currentPage = 0
|
||||||
query = ""
|
query = ""
|
||||||
|
queryStack.clear()
|
||||||
mode = Mode.DOWNLOAD
|
mode = Mode.DOWNLOAD
|
||||||
fetchGalleries(query, sortMode)
|
fetchGalleries(query, sortMode)
|
||||||
loadBlocks()
|
loadBlocks()
|
||||||
@@ -305,6 +310,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
clearGalleries()
|
clearGalleries()
|
||||||
currentPage = 0
|
currentPage = 0
|
||||||
query = ""
|
query = ""
|
||||||
|
queryStack.clear()
|
||||||
mode = Mode.FAVORITE
|
mode = Mode.FAVORITE
|
||||||
fetchGalleries(query, sortMode)
|
fetchGalleries(query, sortMode)
|
||||||
loadBlocks()
|
loadBlocks()
|
||||||
@@ -377,13 +383,24 @@ class MainActivity : AppCompatActivity() {
|
|||||||
if (it?.isEmpty() == false) {
|
if (it?.isEmpty() == false) {
|
||||||
val galleryID = it.random()
|
val galleryID = it.random()
|
||||||
|
|
||||||
val intent = Intent(this@MainActivity, ReaderActivity::class.java).apply {
|
GalleryDialog(
|
||||||
putExtra("galleryID", galleryID)
|
this@MainActivity,
|
||||||
|
Glide.with(this@MainActivity),
|
||||||
|
galleryID
|
||||||
|
).apply {
|
||||||
|
onChipClickedHandler.add {
|
||||||
|
runOnUiThread {
|
||||||
|
query = it.toQuery()
|
||||||
|
currentPage = 0
|
||||||
|
|
||||||
|
cancelFetch()
|
||||||
|
clearGalleries()
|
||||||
|
fetchGalleries(query, sortMode)
|
||||||
|
loadBlocks()
|
||||||
}
|
}
|
||||||
|
dismiss()
|
||||||
startActivity(intent)
|
}
|
||||||
|
}.show()
|
||||||
histories.add(galleryID)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -979,6 +996,11 @@ class MainActivity : AppCompatActivity() {
|
|||||||
val preference = PreferenceManager.getDefaultSharedPreferences(this)
|
val preference = PreferenceManager.getDefaultSharedPreferences(this)
|
||||||
val defaultQuery = preference.getString("default_query", "")!!
|
val defaultQuery = preference.getString("default_query", "")!!
|
||||||
|
|
||||||
|
if (query != queryStack.lastOrNull()) {
|
||||||
|
queryStack.remove(query)
|
||||||
|
queryStack.add(query)
|
||||||
|
}
|
||||||
|
|
||||||
galleryIDs = null
|
galleryIDs = null
|
||||||
|
|
||||||
if (galleryIDs?.isActive == true)
|
if (galleryIDs?.isActive == true)
|
||||||
|
|||||||
@@ -33,6 +33,9 @@ import androidx.preference.PreferenceCategory
|
|||||||
import androidx.preference.PreferenceFragmentCompat
|
import androidx.preference.PreferenceFragmentCompat
|
||||||
import androidx.preference.PreferenceManager
|
import androidx.preference.PreferenceManager
|
||||||
import com.google.android.material.snackbar.Snackbar
|
import com.google.android.material.snackbar.Snackbar
|
||||||
|
import kotlinx.coroutines.CoroutineScope
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
import net.rdrei.android.dirchooser.DirectoryChooserActivity
|
import net.rdrei.android.dirchooser.DirectoryChooserActivity
|
||||||
import net.rdrei.android.dirchooser.DirectoryChooserConfig
|
import net.rdrei.android.dirchooser.DirectoryChooserConfig
|
||||||
import xyz.quaver.pupil.Pupil
|
import xyz.quaver.pupil.Pupil
|
||||||
@@ -44,7 +47,9 @@ import xyz.quaver.pupil.ui.dialog.DownloadLocationDialog
|
|||||||
import xyz.quaver.pupil.ui.dialog.MirrorDialog
|
import xyz.quaver.pupil.ui.dialog.MirrorDialog
|
||||||
import xyz.quaver.pupil.ui.dialog.ProxyDialog
|
import xyz.quaver.pupil.ui.dialog.ProxyDialog
|
||||||
import xyz.quaver.pupil.util.*
|
import xyz.quaver.pupil.util.*
|
||||||
|
import java.io.BufferedReader
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
import java.io.InputStreamReader
|
||||||
|
|
||||||
|
|
||||||
class SettingsFragment :
|
class SettingsFragment :
|
||||||
@@ -74,9 +79,13 @@ class SettingsFragment :
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun getDirSize(dir: File) : String {
|
private fun getDirSize(dir: File) : String {
|
||||||
val size = dir.walk().map { it.length() }.sum()
|
return getString(R.string.settings_storage_usage,
|
||||||
|
Runtime.getRuntime().exec("du -hs " + dir.absolutePath).let {
|
||||||
return getString(R.string.settings_clear_summary, byteToString(size))
|
BufferedReader(InputStreamReader(it.inputStream)).use { reader ->
|
||||||
|
reader.readLine()?.split('\t')?.firstOrNull() ?: "0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPreferenceClick(preference: Preference?): Boolean {
|
override fun onPreferenceClick(preference: Preference?): Boolean {
|
||||||
@@ -97,7 +106,15 @@ class SettingsFragment :
|
|||||||
if (dir.exists())
|
if (dir.exists())
|
||||||
dir.deleteRecursively()
|
dir.deleteRecursively()
|
||||||
|
|
||||||
summary = getDirSize(dir)
|
summary = getString(R.string.settings_storage_usage_loading)
|
||||||
|
|
||||||
|
CoroutineScope(Dispatchers.IO).launch {
|
||||||
|
getDirSize(dir).let {
|
||||||
|
launch(Dispatchers.Main) {
|
||||||
|
this@with.summary = getDirSize(dir)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
setNegativeButton(android.R.string.no) { _, _ -> }
|
setNegativeButton(android.R.string.no) { _, _ -> }
|
||||||
}.show()
|
}.show()
|
||||||
@@ -112,7 +129,15 @@ class SettingsFragment :
|
|||||||
if (dir.exists())
|
if (dir.exists())
|
||||||
dir.deleteRecursively()
|
dir.deleteRecursively()
|
||||||
|
|
||||||
summary = getDirSize(dir)
|
summary = getString(R.string.settings_storage_usage_loading)
|
||||||
|
|
||||||
|
CoroutineScope(Dispatchers.IO).launch {
|
||||||
|
getDirSize(dir).let {
|
||||||
|
launch(Dispatchers.Main) {
|
||||||
|
this@with.summary = getDirSize(dir)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
setNegativeButton(android.R.string.no) { _, _ -> }
|
setNegativeButton(android.R.string.no) { _, _ -> }
|
||||||
}.show()
|
}.show()
|
||||||
@@ -276,13 +301,27 @@ class SettingsFragment :
|
|||||||
}
|
}
|
||||||
"delete_cache" -> {
|
"delete_cache" -> {
|
||||||
val dir = File(requireContext().cacheDir, "imageCache")
|
val dir = File(requireContext().cacheDir, "imageCache")
|
||||||
summary = getDirSize(dir)
|
|
||||||
|
CoroutineScope(Dispatchers.IO).launch {
|
||||||
|
summary = getString(R.string.settings_storage_usage_loading)
|
||||||
|
|
||||||
|
launch(Dispatchers.Main) {
|
||||||
|
this@with.summary = getDirSize(dir)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onPreferenceClickListener = this@SettingsFragment
|
onPreferenceClickListener = this@SettingsFragment
|
||||||
}
|
}
|
||||||
"delete_downloads" -> {
|
"delete_downloads" -> {
|
||||||
val dir = getDownloadDirectory(requireContext())
|
val dir = getDownloadDirectory(requireContext())
|
||||||
summary = getDirSize(dir)
|
|
||||||
|
CoroutineScope(Dispatchers.IO).launch {
|
||||||
|
summary = getString(R.string.settings_storage_usage_loading)
|
||||||
|
|
||||||
|
launch(Dispatchers.Main) {
|
||||||
|
this@with.summary = getDirSize(dir)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onPreferenceClickListener = this@SettingsFragment
|
onPreferenceClickListener = this@SettingsFragment
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,8 @@
|
|||||||
<string name="search_hint_with_page">ギャラリー検索</string>
|
<string name="search_hint_with_page">ギャラリー検索</string>
|
||||||
<string name="settings_clear_cache">キャッシュクリア</string>
|
<string name="settings_clear_cache">キャッシュクリア</string>
|
||||||
<string name="settings_clear_cache_alert_message">キャッシュをクリアするとイメージのロード速度に影響を与えます。実行しますか?</string>
|
<string name="settings_clear_cache_alert_message">キャッシュをクリアするとイメージのロード速度に影響を与えます。実行しますか?</string>
|
||||||
<string name="settings_clear_summary">サイズ: %s</string>
|
<string name="settings_storage_usage">%s使用中</string>
|
||||||
|
<string name="settings_storage_usage_loading">ストレージ使用量読み込み中…</string>
|
||||||
<string name="settings_default_query">デフォルトキーワード</string>
|
<string name="settings_default_query">デフォルトキーワード</string>
|
||||||
<string name="settings_galleries_per_page">一回にロードするギャラリー数</string>
|
<string name="settings_galleries_per_page">一回にロードするギャラリー数</string>
|
||||||
<string name="settings_search_title">検索設定</string>
|
<string name="settings_search_title">検索設定</string>
|
||||||
|
|||||||
@@ -8,7 +8,8 @@
|
|||||||
<string name="settings_default_query">기본 검색어</string>
|
<string name="settings_default_query">기본 검색어</string>
|
||||||
<string name="settings_clear_cache">캐시 정리하기</string>
|
<string name="settings_clear_cache">캐시 정리하기</string>
|
||||||
<string name="settings_clear_cache_alert_message">캐시를 정리하면 이미지 로딩속도가 느려질 수 있습니다. 계속하시겠습니까?</string>
|
<string name="settings_clear_cache_alert_message">캐시를 정리하면 이미지 로딩속도가 느려질 수 있습니다. 계속하시겠습니까?</string>
|
||||||
<string name="settings_clear_summary">사용량: %s</string>
|
<string name="settings_storage_usage">%s 사용중</string>
|
||||||
|
<string name="settings_storage_usage_loading">저장공간 사용량 계산 중…</string>
|
||||||
<string name="settings_galleries_per_page">한 번에 로드할 갤러리 수</string>
|
<string name="settings_galleries_per_page">한 번에 로드할 갤러리 수</string>
|
||||||
<string name="settings_search_title">검색 설정</string>
|
<string name="settings_search_title">검색 설정</string>
|
||||||
<string name="settings_title">설정</string>
|
<string name="settings_title">설정</string>
|
||||||
|
|||||||
@@ -142,9 +142,10 @@
|
|||||||
<!-- SETTINGS/STORAGE -->
|
<!-- SETTINGS/STORAGE -->
|
||||||
|
|
||||||
<string name="settings_storage">Storage</string>
|
<string name="settings_storage">Storage</string>
|
||||||
|
<string name="settings_storage_usage">Currently using %s</string>
|
||||||
|
<string name="settings_storage_usage_loading">Calculating storage usage…</string>
|
||||||
<string name="settings_clear_cache">Clear cache</string>
|
<string name="settings_clear_cache">Clear cache</string>
|
||||||
<string name="settings_clear_cache_alert_message">Deleting cache can affect image loading speed. Do you want to continue?</string>
|
<string name="settings_clear_cache_alert_message">Deleting cache can affect image loading speed. Do you want to continue?</string>
|
||||||
<string name="settings_clear_summary">Currently using %s</string>
|
|
||||||
<string name="settings_clear_downloads">Clear downloads</string>
|
<string name="settings_clear_downloads">Clear downloads</string>
|
||||||
<string name="settings_clear_downloads_alert_message">Delete all downloaded galleries.\nDo you want to continue?</string>
|
<string name="settings_clear_downloads_alert_message">Delete all downloaded galleries.\nDo you want to continue?</string>
|
||||||
<string name="settings_clear_history">Clear history</string>
|
<string name="settings_clear_history">Clear history</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user