Skip to content
This repository has been archived by the owner on Dec 15, 2023. It is now read-only.

Commit

Permalink
Test against proguard and fix minor details (#67)
Browse files Browse the repository at this point in the history
* Reenable enum in proguard rules

* Add missing permission and upload to beta

* Use kau permission const
  • Loading branch information
AllanWang authored Jul 17, 2017
1 parent d90cb9b commit 7bf93ea
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 30 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ apply plugin: 'com.github.triplet.play'

play {
jsonFile = file('../files/gplay-keys.json')
track = 'alpha'
track = 'beta'
errorOnSizeLimit = true
uploadImages = false
untrackOld = true
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<!--<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />-->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<!--<uses-permission android:name="android.permission.VIBRATE" />-->
<!--<uses-permission android:name="android.permission.USE_FINGERPRINT" />-->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class ImageActivity : AppCompatActivity() {
setContentView(if (!text.isNullOrBlank()) R.layout.activity_image else R.layout.activity_image_textless)
container.setBackgroundColor(Prefs.bgColor.withMinAlpha(222))
caption?.setTextColor(Prefs.textColor)
caption?.setBackgroundColor(Prefs.bgColor.colorToForeground(0.1f).withAlpha(255))
caption?.setBackgroundColor(Prefs.bgColor.colorToForeground(0.2f).withAlpha(255))
caption?.text = text
progress.tint(Prefs.accentColor)
panel?.addPanelSlideListener(object : SlidingUpPanelLayout.SimplePanelSlideListener() {
Expand Down Expand Up @@ -174,16 +174,13 @@ class ImageActivity : AppCompatActivity() {
val timeStamp = SimpleDateFormat("yyyyMMdd_HHmmss").format(Date())
val imageFileName = "Frost_" + timeStamp + "_"
val storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES)
return File.createTempFile(
imageFileName, /* prefix */
".png", /* suffix */
storageDir /* directory */
)
return File.createTempFile(imageFileName, ".png", storageDir)
}

internal fun downloadImage() {
kauRequestPermissions(PERMISSION_WRITE_EXTERNAL_STORAGE) {
granted, _ ->
L.d("Download image callback granted: $granted")
if (granted) {
doAsync {
val timeStamp = SimpleDateFormat("yyyyMMdd_HHmmss").format(Date())
Expand All @@ -199,6 +196,7 @@ class ImageActivity : AppCompatActivity() {
} catch (e: Exception) {
success = false
} finally {
L.d("Download image async finished: $success")
uiThread {
snackbar(if (success) R.string.image_download_success else R.string.image_download_fail)
if (success) {
Expand Down Expand Up @@ -230,7 +228,7 @@ class ImageActivity : AppCompatActivity() {
}
}

internal enum class FabStates(val iicon: IIcon, val iconColor: Int = Prefs.textColor, val backgroundTint: Int = Prefs.accentBackgroundColor.withAlpha(255)) {
internal enum class FabStates(val iicon: IIcon, val iconColor: Int = Prefs.iconColor, val backgroundTint: Int = Prefs.iconBackgroundColor.withAlpha(255)) {
ERROR(GoogleMaterial.Icon.gmd_error, Color.WHITE, Color.RED) {
override fun onClick(activity: ImageActivity) {
//todo add something
Expand All @@ -240,9 +238,7 @@ internal enum class FabStates(val iicon: IIcon, val iconColor: Int = Prefs.textC
override fun onClick(activity: ImageActivity) {}
},
DOWNLOAD(GoogleMaterial.Icon.gmd_file_download) {
override fun onClick(activity: ImageActivity) {
activity.downloadImage()
}
override fun onClick(activity: ImageActivity) = activity.downloadImage()
},
SHARE(GoogleMaterial.Icon.gmd_share) {
override fun onClick(activity: ImageActivity) {
Expand Down
12 changes: 3 additions & 9 deletions app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,10 @@ object Prefs : KPref() {
get() = if (headerColor.isColorVisibleOn(bgColor, 100)) headerColor else textColor

/**
* Ensures that the color is visible against both the foreground and background
* Ensures that the color is visible against the background
*/
val accentBackgroundColor: Int
get() {
if (headerColor.isColorVisibleOn(textColor, 100)) {
if (headerColor.isColorVisibleOn(bgColor, 100)) return headerColor
else return headerColor.colorToForeground(0.2f)
}
return bgColor.colorToForeground(0.2f)
}
val iconBackgroundColor: Int
get() = if (headerColor.isColorVisibleOn(bgColor)) headerColor else headerColor.colorToForeground(0.2f)

val themeInjector: InjectorContract
get() = t.injector
Expand Down
19 changes: 12 additions & 7 deletions app/src/main/kotlin/com/pitchedapps/frost/utils/iab/IAB.kt
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,18 @@ private fun SettingsActivity.finishRestore(snackbar: Snackbar, hasPro: Boolean)
*/
fun Activity.validatePro() {
L.d("Play Store Validate pro")
getInventory(Prefs.pro, false, { if (Prefs.pro) playStoreNoLongerPro() }) {
inv, helper ->
val proSku = inv.hasPurchase(FROST_PRO)
L.d("Play Store Validation finished: ${Prefs.pro} should be $proSku")
if (!proSku && Prefs.pro) playStoreNoLongerPro()
else if (proSku && !Prefs.pro) playStoreFoundPro()
helper.disposeWhenFinished()
try {
getInventory(Prefs.pro, false, { if (Prefs.pro) playStoreNoLongerPro() }) {
inv, helper ->
val proSku = inv.hasPurchase(FROST_PRO)
L.d("Play Store Validation finished: ${Prefs.pro} should be $proSku")
if (!proSku && Prefs.pro) playStoreNoLongerPro()
else if (proSku && !Prefs.pro) playStoreFoundPro()
IAB.dispose(helper)
}
} catch (e: Exception) {
L.e(e, "Play store validation exception")
IAB.dispose()
}
}

Expand Down
3 changes: 2 additions & 1 deletion docs/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

## Beta Updates
* Update IAB helper
* Implemented image viewing and downloading; long press any image!
* Create image viewing and downloading; long press any image!
* Start filtering out unnecessary loads

## v1.3
* Create toggle for notifications only from primary account
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ MIN_SDK=21
TARGET_SDK=26
BUILD_TOOLS=26.0.0

KAU=e6daff7
KAU=eddaded
KOTLIN=1.1.3-2
CRASHLYTICS=2.6.8
DBFLOW=4.0.4
Expand Down

0 comments on commit 7bf93ea

Please sign in to comment.