Skip to content

Commit

Permalink
Merge branch 'dev' into master
Browse files Browse the repository at this point in the history
# Conflicts:
#	app/release/app-release.apk
#	app/release/output-metadata.json
  • Loading branch information
tom5079 committed Sep 14, 2020
2 parents be6903c + b907d36 commit 265473a
Show file tree
Hide file tree
Showing 32 changed files with 656 additions and 803 deletions.
9 changes: 6 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ android {
minSdkVersion 16
targetSdkVersion 30
versionCode 59
versionName "5.0.2"
versionName "5.0.3"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
Expand Down Expand Up @@ -66,18 +66,20 @@ dependencies {
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9"
//implementation "org.jetbrains.kotlinx:kotlinx-serialization-core:1.0.0-RC"
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
implementation "androidx.activity:activity-ktx:1.2.0-alpha08"
implementation 'androidx.fragment:fragment-ktx:1.3.0-alpha08'
implementation 'androidx.preference:preference:1.1.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
implementation 'androidx.gridlayout:gridlayout:1.0.0'
implementation "androidx.biometric:biometric:1.0.1"
implementation 'androidx.fragment:fragment-ktx:1.2.5'
implementation "com.daimajia.swipelayout:library:1.2.0@aar"
implementation 'com.google.android.material:material:1.3.0-alpha02'
implementation 'com.google.firebase:firebase-core: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-perf:19.0.8'
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.github.arimorty:floatingsearchview:2.1.1'
implementation 'com.github.clans:fab:1.6.4'
//implementation 'com.quiph.ui:recyclerviewfastscroller:0.2.1'
Expand All @@ -94,6 +96,7 @@ dependencies {
transitive = false
}
implementation 'com.tbuonomo.andrui:viewpagerdotsindicator:4.1.2'
implementation 'com.gu:option:1.3'
implementation 'net.rdrei.android.dirchooser:library:3.2@aar'
implementation 'com.github.chrisbanes:PhotoView:2.3.0'
implementation 'com.andrognito.patternlockview:patternlockview:1.0.0'
Expand Down
Binary file modified app/libs/recyclerviewfastscroller-release.aar
Binary file not shown.
2 changes: 1 addition & 1 deletion app/release/output-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"filters": [],
"properties": [],
"versionCode": 59,
"versionName": "5.0.2",
"versionName": "5.0.3",
"enabled": true,
"outputFile": "app-release.apk"
}
Expand Down
11 changes: 9 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.USE_BIOMETRIC" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="21"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="21" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.CAMERA" />

<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />

<application
android:name=".Pupil"
Expand All @@ -24,6 +27,10 @@
tools:replace="android:theme"
tools:ignore="UnusedAttribute">

<meta-data
android:name="com.google.mlkit.vision.DEPENDENCIES"
android:value="face" />

<provider
android:authorities="${applicationId}.provider"
android:name="androidx.core.content.FileProvider"
Expand Down
19 changes: 9 additions & 10 deletions app/src/main/java/xyz/quaver/pupil/adapters/GalleryBlockAdapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ class GalleryBlockAdapter(private val glide: RequestManager, private val galleri

CoroutineScope(Dispatchers.Main).launch {
if (cache.metadata.reader == null || Preferences["cache_disable"]) {
view.galleryblock_progressbar.visibility = View.GONE
view.galleryblock_progress_complete.visibility = View.GONE
view.galleryblock_progressbar_layout.visibility = View.GONE
view.galleryblock_progress_complete.visibility = View.INVISIBLE
return@launch
}

Expand All @@ -91,8 +91,10 @@ class GalleryBlockAdapter(private val glide: RequestManager, private val galleri
progress = imageList.filterNotNull().size
max = imageList.size

if (visibility == View.GONE)
visibility = View.VISIBLE
with(view.galleryblock_progressbar_layout) {
if (visibility == View.GONE)
visibility = View.VISIBLE
}

if (progress == max) {
val downloadManager = DownloadManager.getInstance(context)
Expand Down Expand Up @@ -126,8 +128,6 @@ class GalleryBlockAdapter(private val glide: RequestManager, private val galleri
}

fun bind(galleryID: Int) {
val time = System.currentTimeMillis()

val cache = Cache.getInstance(view.context, galleryID)

val galleryBlock = cache.metadata.galleryBlock ?: return
Expand Down Expand Up @@ -223,14 +223,14 @@ class GalleryBlockAdapter(private val glide: RequestManager, private val galleri

galleryblock_tag_group.removeAllViews()
CoroutineScope(Dispatchers.Default).launch {
galleryBlock.relatedTags.forEach {
galleryBlock.relatedTags.map {
TagChip(context, Tag.parse(it)).apply {
setOnClickListener { view ->
for (callback in onChipClickedHandler)
callback.invoke((view as TagChip).tag)
}
}.let { launch(Dispatchers.Main) { galleryblock_tag_group.addView(it) } }
}
}
}.let { launch(Dispatchers.Main) { it.forEach { galleryblock_tag_group.addView(it) } } }
}

galleryblock_id.text = galleryBlock.id.toString()
Expand Down Expand Up @@ -279,7 +279,6 @@ class GalleryBlockAdapter(private val glide: RequestManager, private val galleri
galleryblock_tag_group.visibility = View.GONE
}
}
Log.i("PUPILD", "${System.currentTimeMillis() - time}")
}
}
class NextViewHolder(view: LinearLayout) : RecyclerView.ViewHolder(view)
Expand Down
16 changes: 15 additions & 1 deletion app/src/main/java/xyz/quaver/pupil/services/DownloadService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import androidx.core.app.NotificationCompat
import androidx.core.app.NotificationManagerCompat
import androidx.core.app.TaskStackBuilder
import androidx.core.content.ContextCompat
import com.google.firebase.crashlytics.FirebaseCrashlytics
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
Expand All @@ -42,6 +43,7 @@ import xyz.quaver.pupil.R
import xyz.quaver.pupil.client
import xyz.quaver.pupil.interceptors
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.DownloadManager
import xyz.quaver.pupil.util.ellipsize
Expand Down Expand Up @@ -309,6 +311,18 @@ class DownloadService : Service() {

progress.put(galleryID, MutableList(reader.galleryInfo.files.size) { 0F })

FirebaseCrashlytics.getInstance().log(
"""
GALLERYID: $galleryID
CACHE: ${cache.findFile(".metadata")}
PATTERN: ${Preferences["download_folder_name", ""]}
READER ID: ${reader.galleryInfo.id}
READER SIZE: ${reader.galleryInfo.files.size}
CACHE READER ID: ${cache.metadata.reader?.galleryInfo?.id}}
CACHE READER SIZE: ${cache.metadata.reader?.galleryInfo?.files?.size}
""".trimIndent()
)

cache.metadata.imageList?.let {
if (progress[galleryID]?.size != it.size) {
cache.metadata.imageList?.filterNotNull()?.forEach { file ->
Expand All @@ -325,7 +339,7 @@ class DownloadService : Service() {

if (isCompleted(galleryID)) {
if (DownloadManager.getInstance(this@DownloadService)
.getDownloadFolder(galleryID) != null)
.getDownloadFolder(galleryID) != null )
Cache.getInstance(this@DownloadService, galleryID).moveToDownload()

notificationManager.cancel(galleryID)
Expand Down
Loading

0 comments on commit 265473a

Please sign in to comment.