diff options
author | Allan Wang <me@allanwang.ca> | 2018-03-21 17:36:53 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-21 17:36:53 -0400 |
commit | f1275cbc38f1819c852f810905c300ae8f64bba4 (patch) | |
tree | 794d0ffe19f09387d5979c710b1b4a6ffe24104d /app/src/main/kotlin | |
parent | d36dfe98a52ced46c5106b28304ae5d245180a7f (diff) | |
download | frost-f1275cbc38f1819c852f810905c300ae8f64bba4.tar.gz frost-f1275cbc38f1819c852f810905c300ae8f64bba4.tar.bz2 frost-f1275cbc38f1819c852f810905c300ae8f64bba4.zip |
Update buildsdk (#808)
* Update changelog
* Add build sdk check
* Remove play store affiliate
* Ignore Overdraw
* Remove theme background
* Add back for transparent
* Fix restart button
Diffstat (limited to 'app/src/main/kotlin')
6 files changed, 39 insertions, 16 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt b/app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt index 16e23d53..118f7eac 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt @@ -7,6 +7,7 @@ import android.net.Uri import android.os.Bundle import android.widget.ImageView import ca.allanwang.kau.logging.KL +import ca.allanwang.kau.utils.buildIsLollipopAndUp import com.bugsnag.android.Bugsnag import com.bumptech.glide.request.RequestOptions import com.bumptech.glide.signature.ApplicationVersionSignature @@ -51,6 +52,11 @@ class FrostApp : Application() { .build()) override fun onCreate() { + if (!buildIsLollipopAndUp) { // not supported + super.onCreate() + return + } + FlowManager.init(FlowConfig.Builder(this) .withDatabase(CookiesDb.NAME, CookiesDb::class) .withDatabase(FbTabsDb.NAME, FbTabsDb::class) diff --git a/app/src/main/kotlin/com/pitchedapps/frost/StartActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/StartActivity.kt index c0f4eb85..54a48112 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/StartActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/StartActivity.kt @@ -1,9 +1,16 @@ package com.pitchedapps.frost import android.content.Intent +import android.graphics.Color +import android.os.Build import android.os.Bundle +import android.widget.ImageView +import android.widget.TextView import ca.allanwang.kau.internal.KauBaseActivity +import ca.allanwang.kau.utils.buildIsLollipopAndUp +import ca.allanwang.kau.utils.setIcon import ca.allanwang.kau.utils.startActivity +import com.mikepenz.google_material_typeface_library.GoogleMaterial import com.pitchedapps.frost.activities.LoginActivity import com.pitchedapps.frost.activities.MainActivity import com.pitchedapps.frost.activities.SelectorActivity @@ -13,6 +20,7 @@ import com.pitchedapps.frost.utils.EXTRA_COOKIES import com.pitchedapps.frost.utils.L import com.pitchedapps.frost.utils.Prefs import com.pitchedapps.frost.utils.launchNewTask +import java.util.* /** * Created by Allan Wang on 2017-05-28. @@ -21,6 +29,12 @@ class StartActivity : KauBaseActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) + + if (!buildIsLollipopAndUp) { // not supported + showInvalidSdkView() + return + } + FbCookie.switchBackUser { loadFbCookiesAsync { val cookies = ArrayList(it) @@ -30,7 +44,7 @@ class StartActivity : KauBaseActivity() { if (Prefs.userId != -1L) startActivity<MainActivity>(intentBuilder = { putParcelableArrayListExtra(EXTRA_COOKIES, cookies) - flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK + flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP }) else launchNewTask<SelectorActivity>(cookies) @@ -38,5 +52,20 @@ class StartActivity : KauBaseActivity() { launchNewTask<LoginActivity>() } } + + } + + private fun showInvalidSdkView() { + setContentView(R.layout.activity_invalid_sdk) + findViewById<ImageView>(R.id.invalid_icon) + .setIcon(GoogleMaterial.Icon.gmd_adb, -1, Color.WHITE) + + findViewById<TextView>(R.id.invalid_text).apply { + try { + text = String.format(getString(R.string.error_sdk), Build.VERSION.SDK_INT) + } catch (e: IllegalFormatException) { + setText(R.string.error_sdk) + } + } } }
\ No newline at end of file diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/AboutActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/AboutActivity.kt index 8e6677f9..ce306acc 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/AboutActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/AboutActivity.kt @@ -18,7 +18,6 @@ import com.mikepenz.aboutlibraries.entity.License import com.mikepenz.community_material_typeface_library.CommunityMaterial import com.mikepenz.fastadapter.IItem import com.mikepenz.fastadapter.items.AbstractItem -import com.mikepenz.google_material_typeface_library.GoogleMaterial import com.mikepenz.iconics.typeface.IIcon import com.pitchedapps.frost.BuildConfig import com.pitchedapps.frost.R diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt index 8b584112..21bc2354 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt @@ -2,9 +2,6 @@ package com.pitchedapps.frost.activities import android.annotation.SuppressLint import android.app.ActivityOptions -import android.app.AlarmManager -import android.app.PendingIntent -import android.content.Context import android.content.Intent import android.content.res.ColorStateList import android.graphics.PointF @@ -356,15 +353,8 @@ abstract class BaseMainActivity : BaseActivity(), MainActivityContract, if (resultCode and REQUEST_RESTART_APPLICATION > 0) { //completely restart application L.d { "Restart Application Requested" } val intent = packageManager.getLaunchIntentForPackage(packageName) - intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK or Intent.FLAG_ACTIVITY_NEW_TASK) - val pending = PendingIntent.getActivity(this, 666, intent, PendingIntent.FLAG_CANCEL_CURRENT) - val alarm = getSystemService(Context.ALARM_SERVICE) as AlarmManager - if (buildIsMarshmallowAndUp) - alarm.setExactAndAllowWhileIdle(AlarmManager.RTC, System.currentTimeMillis() + 100, pending) - else - alarm.setExact(AlarmManager.RTC, System.currentTimeMillis() + 100, pending) - finish() - System.exit(0) + Intent.makeRestartActivityTask(intent.component) + Runtime.getRuntime().exit(0) return } if (resultCode and REQUEST_RESTART > 0) return restart() 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 9afca21e..7e989fc6 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/LoginActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/LoginActivity.kt @@ -89,7 +89,7 @@ class LoginActivity : BaseActivity() { } textview.text = String.format(getString(R.string.welcome), name) textview.fadeIn() - frostEvent("Login" , "success" to true ) + frostEvent("Login", "success" to true) /* * The user may have logged into an account that is already in the database * We will let the db handle duplicates and load it now after the new account has been saved diff --git a/app/src/main/kotlin/com/pitchedapps/frost/settings/Debug.kt b/app/src/main/kotlin/com/pitchedapps/frost/settings/Debug.kt index 5dc0edab..7ca7d778 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/settings/Debug.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/settings/Debug.kt @@ -12,7 +12,6 @@ import com.pitchedapps.frost.activities.SettingsActivity.Companion.ACTIVITY_REQU import com.pitchedapps.frost.debugger.OfflineWebsite import com.pitchedapps.frost.facebook.FB_URL_BASE import com.pitchedapps.frost.facebook.FbCookie -import com.pitchedapps.frost.facebook.FbItem import com.pitchedapps.frost.parsers.FrostParser import com.pitchedapps.frost.parsers.MessageParser import com.pitchedapps.frost.parsers.NotifParser |