Skip to content

Commit

Permalink
Merge pull request #51 from tom5079/development
Browse files Browse the repository at this point in the history
Version 4.3
  • Loading branch information
tom5079 authored Jan 13, 2020
2 parents 1d3d78b + ee87122 commit 63e07f5
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 24 deletions.
1 change: 1 addition & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlinx-serialization'

if (file("google-services.json").exists()) {
logger.lifecycle("Firebase Enabled")
apply plugin: 'com.google.gms.google-services'
apply plugin: 'io.fabric'
apply plugin: 'com.google.firebase.firebase-perf'
} else {
logger.lifecycle("Firebase Disabled")
}

android {
Expand All @@ -16,8 +19,8 @@ android {
applicationId "xyz.quaver.pupil"
minSdkVersion 16
targetSdkVersion 29
versionCode 31
versionName "4.2"
versionCode 32
versionName "4.3"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
Expand Down
13 changes: 0 additions & 13 deletions app/src/main/java/xyz/quaver/pupil/ui/ReaderActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

package xyz.quaver.pupil.ui

import android.Manifest
import android.content.Intent
import android.graphics.drawable.Animatable
import android.graphics.drawable.Drawable
Expand Down Expand Up @@ -50,7 +49,6 @@ import xyz.quaver.pupil.adapters.ReaderAdapter
import xyz.quaver.pupil.util.GalleryDownloader
import xyz.quaver.pupil.util.Histories
import xyz.quaver.pupil.util.ItemClickSupport
import xyz.quaver.pupil.util.hasPermission

class ReaderActivity : AppCompatActivity() {

Expand Down Expand Up @@ -373,17 +371,6 @@ class ReaderActivity : AppCompatActivity() {
with(reader_fab_download) {
setImageResource(R.drawable.ic_download)
setOnClickListener {

if (!this@ReaderActivity.hasPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
AlertDialog.Builder(this@ReaderActivity).apply {
setTitle(R.string.warning)
setMessage(R.string.update_no_permission)
setPositiveButton(android.R.string.ok) { _, _ -> }
}.show()

return@setOnClickListener
}

downloader.download = !downloader.download

if (!downloader.download)
Expand Down
10 changes: 1 addition & 9 deletions app/src/main/java/xyz/quaver/pupil/util/misc.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,16 @@

package xyz.quaver.pupil.util

import android.content.Context
import android.content.pm.PackageManager
import android.os.Build
import androidx.core.content.ContextCompat
import java.util.*
import kotlin.collections.ArrayList
import kotlin.math.round

//Android Q+ uses scoped storage thus not requiring permission
fun Context.hasPermission(permission: String) =
Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q || ContextCompat.checkSelfPermission(this, permission) == PackageManager.PERMISSION_GRANTED

@UseExperimental(ExperimentalStdlibApi::class)
fun String.wordCapitalize() : String {
val result = ArrayList<String>()

for (word in this.split(" "))
result.add(word.capitalize(Locale.getDefault()))
result.add(word.capitalize(Locale.US))

return result.joinToString(" ")
}
Expand Down

0 comments on commit 63e07f5

Please sign in to comment.