diff --git a/app/build.gradle b/app/build.gradle
index da8a39ab..702199c1 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -2,6 +2,9 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlinx-serialization'
+apply plugin: 'com.google.gms.google-services'
+apply plugin: 'io.fabric'
+apply plugin: 'com.google.firebase.firebase-perf'
android {
compileSdkVersion 28
@@ -9,8 +12,8 @@ android {
applicationId "xyz.quaver.pupil"
minSdkVersion 16
targetSdkVersion 28
- versionCode 15
- versionName "2.8"
+ versionCode 16
+ versionName "2.9"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
@@ -37,15 +40,15 @@ dependencies {
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.preference:preference:1.1.0-beta01'
implementation 'com.google.android.material:material:1.0.0'
+ implementation 'com.google.firebase:firebase-core:16.0.9'
+ implementation 'com.google.firebase:firebase-perf:17.0.2'
+ implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
implementation 'com.github.arimorty:floatingsearchview:2.1.1'
implementation 'com.github.deano2390:MaterialShowcaseView:1.3.4'
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation "ru.noties.markwon:core:${markwonVersion}"
implementation 'com.github.clans:fab:1.6.4'
- implementation('com.finotes:finotescore:2.5.7@aar') {
- transitive = true
- }
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test:runner:1.2.0'
diff --git a/app/google-services.json b/app/google-services.json
new file mode 100644
index 00000000..63160fa4
--- /dev/null
+++ b/app/google-services.json
@@ -0,0 +1,40 @@
+{
+ "project_info": {
+ "project_number": "844152206517",
+ "firebase_url": "https://pupil-88795.firebaseio.com",
+ "project_id": "pupil-88795",
+ "storage_bucket": "pupil-88795.appspot.com"
+ },
+ "client": [
+ {
+ "client_info": {
+ "mobilesdk_app_id": "1:844152206517:android:ed7bdde2b57d6448",
+ "android_client_info": {
+ "package_name": "xyz.quaver.pupil"
+ }
+ },
+ "oauth_client": [
+ {
+ "client_id": "844152206517-5t8c3marg1hio8fotsip4s6qvs9bhrj0.apps.googleusercontent.com",
+ "client_type": 3
+ }
+ ],
+ "api_key": [
+ {
+ "current_key": "AIzaSyC47pCfQRw9D6bkdQzMSuCJ0xY52vK7Q8w"
+ }
+ ],
+ "services": {
+ "appinvite_service": {
+ "other_platform_oauth_client": [
+ {
+ "client_id": "844152206517-5t8c3marg1hio8fotsip4s6qvs9bhrj0.apps.googleusercontent.com",
+ "client_type": 3
+ }
+ ]
+ }
+ }
+ }
+ ],
+ "configuration_version": "1"
+}
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index e8cbecd4..294d57a0 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -3,7 +3,7 @@
package="xyz.quaver.pupil">
-
+
-
+ android:configChanges="keyboardHidden|orientation|screenSize">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/java/xyz/quaver/pupil/Pupil.kt b/app/src/main/java/xyz/quaver/pupil/Pupil.kt
index 368b183a..d40eef41 100644
--- a/app/src/main/java/xyz/quaver/pupil/Pupil.kt
+++ b/app/src/main/java/xyz/quaver/pupil/Pupil.kt
@@ -1,5 +1,6 @@
package xyz.quaver.pupil
+import android.app.Application
import android.app.Notification
import android.app.NotificationChannel
import android.app.NotificationManager
@@ -7,12 +8,10 @@ import android.content.Context
import android.os.Build
import android.preference.PreferenceManager
import androidx.core.content.ContextCompat
-import com.finotes.android.finotescore.Fn
-import com.finotes.android.finotescore.ObservableApplication
import xyz.quaver.pupil.util.Histories
import java.io.File
-class Pupil : ObservableApplication() {
+class Pupil : Application() {
lateinit var histories: Histories
lateinit var downloads: Histories
@@ -26,9 +25,6 @@ class Pupil : ObservableApplication() {
favorites = Histories(File(ContextCompat.getDataDir(this), "favorites.json"))
super.onCreate()
- Fn.init(this)
-
- Fn.enableFrameDetection()
if (!preference.getBoolean("channel_created", false)) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
diff --git a/app/src/main/java/xyz/quaver/pupil/ReaderActivity.kt b/app/src/main/java/xyz/quaver/pupil/ReaderActivity.kt
index d5d92b2f..bc379688 100644
--- a/app/src/main/java/xyz/quaver/pupil/ReaderActivity.kt
+++ b/app/src/main/java/xyz/quaver/pupil/ReaderActivity.kt
@@ -1,5 +1,6 @@
package xyz.quaver.pupil
+import android.content.Intent
import android.graphics.drawable.Animatable
import android.graphics.drawable.Drawable
import android.os.Bundle
@@ -20,11 +21,13 @@ import kotlinx.android.synthetic.main.dialog_numberpicker.view.*
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
+import kotlinx.coroutines.runBlocking
import kotlinx.io.IOException
import kotlinx.serialization.ImplicitReflectionSerializer
import kotlinx.serialization.json.Json
import kotlinx.serialization.json.JsonConfiguration
import xyz.quaver.hitomi.GalleryBlock
+import xyz.quaver.hitomi.getGalleryBlock
import xyz.quaver.pupil.adapters.ReaderAdapter
import xyz.quaver.pupil.util.GalleryDownloader
import xyz.quaver.pupil.util.Histories
@@ -39,6 +42,14 @@ class ReaderActivity : AppCompatActivity() {
private var isScroll = true
private var isFullscreen = false
+ set(value) {
+ field = value
+
+ reader_progressbar.visibility = when {
+ value -> View.VISIBLE
+ else -> View.GONE
+ }
+ }
private lateinit var downloader: GalleryDownloader
@@ -59,10 +70,7 @@ class ReaderActivity : AppCompatActivity() {
setContentView(R.layout.activity_reader)
- galleryBlock = Json(JsonConfiguration.Stable).parse(
- GalleryBlock.serializer(),
- intent.getStringExtra("galleryblock")
- )
+ handleIntent(intent)
supportActionBar?.title = galleryBlock.title
supportActionBar?.setDisplayHomeAsUpEnabled(false)
@@ -75,6 +83,40 @@ class ReaderActivity : AppCompatActivity() {
downloader.start()
}
+ override fun onNewIntent(intent: Intent) {
+ super.onNewIntent(intent)
+ handleIntent(intent)
+ }
+
+ private fun handleIntent(intent: Intent) {
+ if (intent.action == Intent.ACTION_VIEW) {
+ val uri = intent.data
+ val lastPathSegment = uri?.lastPathSegment
+ if (uri != null && lastPathSegment != null) {
+ val nonNumber = Regex("[^-?0-9]+")
+
+ val galleryID = when (uri.host) {
+ "hitomi.la" -> lastPathSegment.replace(nonNumber, "").toInt()
+ "히요비.asia" -> lastPathSegment.toInt()
+ "xn--9w3b15m8vo.asia" -> lastPathSegment.toInt()
+ "e-hentai.org" -> uri.pathSegments[1].toInt()
+ else -> return
+ }
+
+ runBlocking {
+ CoroutineScope(Dispatchers.IO).launch {
+ galleryBlock = getGalleryBlock(galleryID) ?: return@launch
+ }.join()
+ }
+ }
+ } else {
+ galleryBlock = Json(JsonConfiguration.Stable).parse(
+ GalleryBlock.serializer(),
+ intent.getStringExtra("galleryblock")
+ )
+ }
+ }
+
override fun onResume() {
val preferences = PreferenceManager.getDefaultSharedPreferences(this)
@@ -177,11 +219,13 @@ class ReaderActivity : AppCompatActivity() {
downloader = d.apply {
onReaderLoadedHandler = {
CoroutineScope(Dispatchers.Main).launch {
+ with(reader_download_progressbar) {
+ max = it.size
+ progress = 0
+ }
with(reader_progressbar) {
max = it.size
progress = 0
-
- visibility = View.VISIBLE
}
gallerySize = it.size
@@ -190,7 +234,7 @@ class ReaderActivity : AppCompatActivity() {
}
onProgressHandler = {
CoroutineScope(Dispatchers.Main).launch {
- reader_progressbar.progress = it
+ reader_download_progressbar.progress = it
menu?.findItem(R.id.reader_menu_use_hiyobi)?.isVisible = downloader.useHiyobi
}
}
@@ -213,7 +257,7 @@ class ReaderActivity : AppCompatActivity() {
}
onCompleteHandler = {
CoroutineScope(Dispatchers.Main).launch {
- reader_progressbar.visibility = View.GONE
+ reader_download_progressbar.visibility = View.GONE
}
}
onNotifyChangedHandler = { notify ->
@@ -268,6 +312,7 @@ class ReaderActivity : AppCompatActivity() {
return
currentPage = layoutManager.findFirstVisibleItemPosition()+1
menu?.findItem(R.id.reader_menu_page_indicator)?.title = "$currentPage/$gallerySize"
+ this@ReaderActivity.reader_progressbar.progress = currentPage
}
})
diff --git a/app/src/main/res/layout/activity_reader.xml b/app/src/main/res/layout/activity_reader.xml
index 9e49df68..ea646156 100644
--- a/app/src/main/res/layout/activity_reader.xml
+++ b/app/src/main/res/layout/activity_reader.xml
@@ -21,19 +21,27 @@
-
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+
+ android:progressTint="@color/material_green_a700"
+ android:visibility="gone"/>
-
+