From 52bfdb66ca8d44986b3f1ae51c921a939db17ac6 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Fri, 18 Aug 2017 14:40:08 -0700 Subject: Misc (#190) * Update play store description * Finalize description * Update kotlin and bg2 for custom themes * Update to Android Studio 3.0 beta 2 * Update test dependencies and add logging to image activity * Rename throwable to errorRef * Update searchview and media picker through kau --- app/build.gradle | 15 ++++++++----- .../pitchedapps/frost/activities/ImageActivity.kt | 26 +++++++++------------- .../pitchedapps/frost/activities/LoginActivity.kt | 1 - .../pitchedapps/frost/activities/MainActivity.kt | 1 + .../frost/activities/MediaPickerActivity.kt | 24 ++++++++++++++++---- .../com/pitchedapps/frost/injectors/CssAssets.kt | 7 ++---- .../kotlin/com/pitchedapps/frost/utils/Utils.kt | 2 ++ .../com/pitchedapps/frost/web/LoginWebView.kt | 1 - app/src/main/play/en-CA/listing/fulldescription | 23 ++++++++++++------- app/src/main/res/xml/frost_changelog.xml | 8 ++++--- build.gradle | 2 +- docs/Changelog.md | 3 +++ gradle.properties | 8 +++++-- 13 files changed, 75 insertions(+), 46 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 920b9fd1..4658f263 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -104,6 +104,7 @@ android { sourceSets { main.java.srcDirs += 'src/main/kotlin' test.java.srcDirs += 'src/test/kotlin' + androidTest.java.srcDirs += 'src/androidTest/kotlin' } packagingOptions { @@ -119,11 +120,15 @@ repositories { } dependencies { - androidTestImplementation('com.android.support.test.espresso:espresso-core:2.3-alpha', { + androidTestImplementation("com.android.support.test:runner:${TEST_RUNNER}") { exclude group: 'com.android.support', module: 'support-annotations' - }) - testImplementation 'junit:junit:4.12' - testImplementation "org.robolectric:robolectric:${ROBOELECTRIC}" + } + androidTestImplementation "org.jetbrains.kotlin:kotlin-test-junit:${KOTLIN}" + androidTestImplementation "com.android.support.test:rules:${TEST_RULE}" + testImplementation "org.jetbrains.kotlin:kotlin-test-junit:${KOTLIN}" + testImplementation "junit:junit:${JUNIT}" + + implementation "org.jetbrains.kotlin:kotlin-stdlib:${KOTLIN}" //noinspection GradleDependency implementation "ca.allanwang.kau:adapter:$KAU" @@ -142,8 +147,6 @@ dependencies { //noinspection GradleDependency implementation "ca.allanwang.kau:core-ui:$KAU" - testImplementation "org.jetbrains.kotlin:kotlin-test-junit:${KOTLIN}" - debugImplementation "com.squareup.leakcanary:leakcanary-android:${LEAK_CANARY}" releaseTestImplementation "com.squareup.leakcanary:leakcanary-android-no-op:${LEAK_CANARY}" releaseImplementation "com.squareup.leakcanary:leakcanary-android-no-op:${LEAK_CANARY}" diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt index 31479d54..3593f6b5 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt @@ -15,6 +15,7 @@ import android.widget.ProgressBar import android.widget.TextView import ca.allanwang.kau.email.sendEmail import ca.allanwang.kau.internal.KauBaseActivity +import ca.allanwang.kau.mediapicker.scanMedia import ca.allanwang.kau.permissions.PERMISSION_WRITE_EXTERNAL_STORAGE import ca.allanwang.kau.permissions.kauRequestPermissions import ca.allanwang.kau.utils.* @@ -47,6 +48,7 @@ class ImageActivity : KauBaseActivity() { val photo: SubsamplingScaleImageView by bindView(R.id.image_photo) val caption: TextView? by bindOptionalView(R.id.image_text) val fab: FloatingActionButton by bindView(R.id.image_fab) + var errorRef: Throwable? = null /** * Reference to the temporary file path @@ -85,17 +87,16 @@ class ImageActivity : KauBaseActivity() { caption?.text = text progress.tint(Prefs.accentColor) panel?.addPanelSlideListener(object : SlidingUpPanelLayout.SimplePanelSlideListener() { - override fun onPanelSlide(panel: View, slideOffset: Float) { if (slideOffset == 0f && !fab.isShown) fab.show() else if (slideOffset != 0f && fab.isShown) fab.hide() caption?.alpha = slideOffset / 2 + 0.5f } - }) fab.setOnClickListener { fabAction.onClick(this) } photo.setOnImageEventListener(object : SubsamplingScaleImageView.DefaultOnImageEventListener() { override fun onImageLoadError(e: Exception?) { + errorRef = e e.logFrostAnswers("Image load error") imageCallback(null, false) } @@ -145,7 +146,8 @@ class ImageActivity : KauBaseActivity() { var photoFile: File? = null try { photoFile = createPrivateMediaFile(".png") - } catch (ignored: IOException) { + } catch (e: IOException) { + errorRef = e } finally { if (photoFile == null) { callback(null) @@ -173,8 +175,9 @@ class ImageActivity : KauBaseActivity() { var success = true try { File(tempFilePath).copyTo(destination, true) - scanFile(destination) + scanMedia(destination) } catch (e: Exception) { + errorRef = e success = false } finally { L.d("Download image async finished: $success") @@ -189,17 +192,6 @@ class ImageActivity : KauBaseActivity() { } } - /** - * See Docs - */ - internal fun scanFile(file: File) { - if (!file.exists()) return - val mediaScanIntent = Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE) - val contentUri = Uri.fromFile(file) - mediaScanIntent.data = contentUri - this.sendBroadcast(mediaScanIntent) - } - internal fun deleteTempFile() { if (tempFilePath != null) { File(tempFilePath!!).delete() @@ -221,8 +213,11 @@ internal enum class FabStates(val iicon: IIcon, val iconColor: Int = Prefs.iconC content(R.string.bad_image_overlay) positiveText(R.string.kau_yes) onPositive { _, _ -> + if (activity.errorRef != null) + L.e(activity.errorRef, "ImageActivity error report") activity.sendEmail(R.string.dev_email, R.string.debug_image_link_subject) { addItem("Url", activity.imageUrl) + addItem("Message", activity.errorRef?.message ?: "Null") } } negativeText(R.string.kau_no) @@ -248,6 +243,7 @@ internal enum class FabStates(val iicon: IIcon, val iconColor: Int = Prefs.iconC } activity.startActivity(intent) } catch (e: Exception) { + activity.errorRef = e e.logFrostAnswers("Image share failed") activity.snackbar(R.string.image_share_failed) } diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/LoginActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/LoginActivity.kt index 67f07635..6b1f2c5c 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/LoginActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/LoginActivity.kt @@ -1,6 +1,5 @@ package com.pitchedapps.frost.activities -import android.content.Intent import android.graphics.drawable.Drawable import android.os.Bundle import android.os.Handler diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/MainActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/MainActivity.kt index 759be983..45488c94 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/MainActivity.kt @@ -368,6 +368,7 @@ class MainActivity : BaseActivity(), SearchWebView.SearchContract, if (firstLoadFinished && hiddenSearchView == null) hiddenSearchView = SearchWebView(this, this) if (searchView == null) searchView = bindSearchView(menu, R.id.action_search, Prefs.iconColor) { textCallback = { query, _ -> runOnUiThread { hiddenSearchView?.query(query) } } + searchCallback = { query, _ -> launchWebOverlay("${FbItem.SEARCH.url}/?q=$query"); true } foregroundColor = Prefs.textColor backgroundColor = Prefs.bgColor.withMinAlpha(200) openListener = { hiddenSearchView?.pauseLoad = false } diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/MediaPickerActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/MediaPickerActivity.kt index 0d041e7a..9b73f9b7 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/MediaPickerActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/MediaPickerActivity.kt @@ -1,10 +1,26 @@ package com.pitchedapps.frost.activities -import ca.allanwang.kau.mediapicker.MediaPickerActivityOverlayBase -import ca.allanwang.kau.mediapicker.MediaType +import android.content.Context +import android.net.Uri +import android.support.v4.content.FileProvider +import ca.allanwang.kau.mediapicker.* +import com.pitchedapps.frost.BuildConfig +import com.pitchedapps.frost.utils.Prefs +import java.io.File /** * Created by Allan Wang on 2017-07-23. */ -class ImagePickerActivity : MediaPickerActivityOverlayBase(MediaType.IMAGE) -class VideoPickerActivity : MediaPickerActivityOverlayBase(MediaType.VIDEO) \ No newline at end of file +private fun actions() = listOf(object : MediaActionCamera(Prefs.accentColor) { + + override fun createFile(context: Context): File + = createMediaFile("Frost", ".jpg") + + override fun createUri(context: Context, file: File): Uri + = FileProvider.getUriForFile(context, BuildConfig.APPLICATION_ID + ".provider", file) + +}, MediaActionGallery(color = Prefs.accentColor)) + +class ImagePickerActivity : MediaPickerActivityOverlayBase(MediaType.IMAGE, actions()) + +class VideoPickerActivity : MediaPickerActivityOverlayBase(MediaType.VIDEO, actions()) \ No newline at end of file diff --git a/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssAssets.kt b/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssAssets.kt index 733bc151..e979f8ce 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssAssets.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssAssets.kt @@ -25,13 +25,10 @@ enum class CssAssets(val folder: String = "themes") : InjectorContract { try { var content = webView.context.assets.open("css/$folder/$file").bufferedReader().use { it.readText() } if (this == CUSTOM) { - var bbt = Prefs.bgColor val bt: String - if (Color.alpha(bbt) == 255) { - bbt = bbt.adjustAlpha(0.2f).colorToForeground(0.35f) + if (Color.alpha(Prefs.bgColor) == 255) { bt = Prefs.bgColor.toRgbaString() } else { - bbt = bbt.adjustAlpha(0.05f).colorToForeground(0.5f) bt = "transparent" } content = content @@ -39,7 +36,7 @@ enum class CssAssets(val folder: String = "themes") : InjectorContract { .replace("\$TT\$", Prefs.textColor.colorToBackground(0.05f).toRgbaString()) .replace("\$B\$", Prefs.bgColor.toRgbaString()) .replace("\$BT\$", bt) - .replace("\$BBT\$", bbt.toRgbaString()) + .replace("\$BBT\$", Prefs.bgColor.withAlpha(51).colorToForeground(0.35f).toRgbaString()) .replace("\$O\$", Prefs.bgColor.withAlpha(255).toRgbaString()) .replace("\$OO\$", Prefs.bgColor.colorToForeground(0.35f).withAlpha(255).toRgbaString()) .replace("\$D\$", Prefs.textColor.adjustAlpha(0.3f).toRgbaString()) diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt index 4094a3ab..74e800df 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt @@ -13,6 +13,8 @@ import android.support.v7.widget.Toolbar import android.view.View import android.widget.FrameLayout import android.widget.TextView +import ca.allanwang.kau.mediapicker.createMediaFile +import ca.allanwang.kau.mediapicker.createPrivateMediaFile import ca.allanwang.kau.utils.* import com.afollestad.materialdialogs.MaterialDialog import com.bumptech.glide.RequestBuilder diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/LoginWebView.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/LoginWebView.kt index 038eaaad..dd8e2390 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/web/LoginWebView.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/web/LoginWebView.kt @@ -8,7 +8,6 @@ import android.webkit.* import ca.allanwang.kau.utils.fadeIn import ca.allanwang.kau.utils.isVisible import com.pitchedapps.frost.dbflow.CookieModel -import com.pitchedapps.frost.facebook.FACEBOOK_COM import com.pitchedapps.frost.facebook.FB_URL_BASE import com.pitchedapps.frost.facebook.FbCookie import com.pitchedapps.frost.injectors.CssHider diff --git a/app/src/main/play/en-CA/listing/fulldescription b/app/src/main/play/en-CA/listing/fulldescription index 16b0e8f7..ee70ea9d 100644 --- a/app/src/main/play/en-CA/listing/fulldescription +++ b/app/src/main/play/en-CA/listing/fulldescription @@ -1,12 +1,18 @@ +Welcome to Frost for Facebook! + Frost is a fully themable, fully functional alternative to the official Facebook app. While being a web wrapper, Frost contains many unique and native features such as: -• True multi user interactions - More than just an option in a settings menu, Frost's account switcher is right in the drawer. You are one tap away from switching accounts, and everything refreshes on the switch so that you can view other accounts instantaneously. Furthermore, the notification service will fetch notifications from all accounts, and will let you know which account has the new notification. -• Better multitasking - Frost contains an overlaying web browser that can be drawn on top of your foreground task. Open links and notifications with a full screen view, then swipe away to get back to your previous task. -• Contextual awareness - Frost integrates additional features via long presses. Need to copy a block of text or share a link? Long press the text. Need to zoom into an image or download it? Long press the image! -• Material Design - Built for lollipop and up, Frost focuses strongly on a good UI, and embraces material transitions and dimensions. -• Complete theme engine - Frost contains very comprehensive themes that customize all components of the app. Frost is also the only app to support transparent themes. -• Fully opened - Nothing speaks for privacy more than being open sourced. Frost is proud to be one of those apps, and can be found on github (Link in the app's about section) +• True multi user interactions - More than just an option in a settings menu, Frost's account switcher is right in the drawer. You are one tap away from switching accounts, and everything refreshes on the switch so that you can view other accounts instantaneously. Furthermore, the notification service will fetch notifications from all accounts, and will let you know which account has the new notification. +• Better multitasking - Frost contains an overlaying web browser that can be drawn on top of your foreground task. Open links and notifications with a full screen view, then swipe away to get back to your previous task. +• Contextual awareness - Frost integrates additional features via long presses. Need to copy a block of text or share a link? Long press the text. Need to zoom into an image or download it? Long press the image! +• Material Design - Built for lollipop and up, Frost focuses strongly on a beautiful and functional UI, and embraces material transitions and dimensions. +• Complete theme engine - Frost contains very comprehensive themes that customize all components of the app. Frost is also the only app to support transparent themes. +• Fully opened - Nothing speaks for privacy more than being open sourced. Frost is proud to be one of those apps, and can be found on github (Link in the app's about section) +• Fixes the little things - Frost is community driven, and many tweaks are added to address minor inconveniences and give a full native experience, despite being a web app. To list a few: +   • Focusing on a text input will prevent refreshing, so you don't accidentally swipe and lose your progress. +   • Horizontal swipe can be enabled along side the viewpager swipe with a simple long press +   • Automatic bug reports are sent when a crash is detected, so even if you don't contact the devs, you are helping contribute by using the app. Mandatory permissions used and why: @@ -16,13 +22,14 @@ Mandatory permissions used and why: • Billing - For purchasing pro and unlocking all of Frost's features Optional permissions used and why: -(these are only requested when they have to be, and are disabled until then) +(these are only requested when they have to be, and are disabled until then) + • Read/write external storage - Needed to upload photos in a new status and save photos when prompted • Fine/coarse location - Needed for the check in option if users wish to search for their location • That's it! No privacy intrusion and no extra demands. -Permissions NOT used and why: +Permissions NOT used and why: • Wakelock - Frost takes advantage of Android's Job Scheduler, and lets the framework decide when to run background services. Frost therefore doesn't need to constantly run in the background, nor does it force your phone to stay awake. • Retrieve running apps - Frost has no need to access external apps or see what else is running diff --git a/app/src/main/res/xml/frost_changelog.xml b/app/src/main/res/xml/frost_changelog.xml index a1fedd42..6bfcadab 100644 --- a/app/src/main/res/xml/frost_changelog.xml +++ b/app/src/main/res/xml/frost_changelog.xml @@ -11,14 +11,16 @@ - + + + + + - - diff --git a/build.gradle b/build.gradle index dd400eac..cbff1b2a 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { maven { url 'https://maven.fabric.io/public' } } dependencies { - classpath 'com.android.tools.build:gradle:3.0.0-alpha9' + classpath 'com.android.tools.build:gradle:3.0.0-beta2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${KOTLIN}" classpath 'io.fabric.tools:gradle:1.+' classpath 'com.github.triplet.gradle:play-publisher:1.2.0' diff --git a/docs/Changelog.md b/docs/Changelog.md index 61d5a984..866b142f 100644 --- a/docs/Changelog.md +++ b/docs/Changelog.md @@ -1,6 +1,9 @@ # Changelog ## Beta Updates +* Update secondary background for transparent themes to be more visible. + +## v1.4.5 * Create more robust IM notification fetcher with a timeout * Add hidden debugging options for certain views * Separate IM and general notification groups diff --git a/gradle.properties b/gradle.properties index 9c9fe04c..5a8a03c4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,8 +17,8 @@ MIN_SDK=21 TARGET_SDK=26 BUILD_TOOLS=26.0.1 -KAU=4d3d570 -KOTLIN=1.1.3-2 +KAU=caab9d5 +KOTLIN=1.1.4 CRASHLYTICS=2.6.8 DBFLOW=4.0.5 @@ -39,4 +39,8 @@ RX_NETWORK=0.11.0 SCALE_IMAGE_VIEW=3.6.0 SLIDING_PANEL=3.3.1 +JUNIT=4.12 +TEST_RULE=0.5 +TEST_RUNNER=1.0.0 + android.enableAapt2=false \ No newline at end of file -- cgit v1.2.3