aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-06-19 20:25:58 -0700
committerAllan Wang <me@allanwang.ca>2017-06-19 20:25:58 -0700
commitab61f2afd887d772426bda9d9aea829557e2e39d (patch)
treef715f9441679126bf1ace3603a7a1538ed43e092
parenta3b5b647e2651c9768a4056852aff36074590e94 (diff)
downloadfrost-ab61f2afd887d772426bda9d9aea829557e2e39d.tar.gz
frost-ab61f2afd887d772426bda9d9aea829557e2e39d.tar.bz2
frost-ab61f2afd887d772426bda9d9aea829557e2e39d.zip
Update kau and show changelog on version change
-rw-r--r--app/build.gradle13
-rw-r--r--app/src/main/AndroidManifest.xml11
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt17
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/FrostWebActivity.kt27
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/LoginActivity.kt1
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt4
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/WebOverlayActivity.kt7
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/services/NotificationService.kt17
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/views/BadgedIcon.kt2
-rw-r--r--app/src/main/res/drawable/splash_screen.xml2
-rw-r--r--app/src/main/res/values/strings.xml1
-rw-r--r--gradle.properties6
13 files changed, 60 insertions, 50 deletions
diff --git a/app/build.gradle b/app/build.gradle
index fed4ad32..7c6956b0 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -91,12 +91,10 @@ dependencies {
compile "com.github.Raizlabs.DBFlow:dbflow-kotlinextensions:${DBFLOW}"
compile "com.github.Raizlabs.DBFlow:dbflow-rx2:${DBFLOW}"
compile "com.github.Raizlabs.DBFlow:dbflow-rx2-kotlinextensions:${DBFLOW}"
-// compile "com.github.Raizlabs.DBFlow:dbflow-sqlcipher:${DBFLOW}"
-// compile "net.zetetic:android-database-sqlcipher:${SQL_CIPHER}@aar"
testCompile "org.robolectric:robolectric:${ROBOELECTRIC}"
- compile "org.greenrobot:eventbus:${EVENTBUS}"
+// compile "org.greenrobot:eventbus:${EVENTBUS}"
//Icons
compile "com.mikepenz:google-material-typeface:${IICON_GOOGLE}.original@aar"
@@ -114,18 +112,9 @@ dependencies {
compile "org.jetbrains.anko:anko:${ANKO}"
-// compile "com.squareup.retrofit2:retrofit:${RETROFIT}"
-// compile "com.squareup.retrofit2:adapter-rxjava2:${RETROFIT}"
-// compile "com.squareup.retrofit2:converter-gson:${RETROFIT}"
-// compile "com.squareup.okhttp3:logging-interceptor:${OKHTTP_INTERCEPTOR}"
-
compile "com.github.bumptech.glide:glide:${GLIDE}"
annotationProcessor "com.github.bumptech.glide:compiler:${GLIDE}"
-// compile "com.google.auto.value:auto-value:${AUTO}"
-// annotationProcessor "com.google.auto.value:auto-value:${AUTO}"
-// annotationProcessor "com.ryanharter.auto.value:auto-value-parcel:${AUTO_VALUE_PARCEL}"
-
compile "com.f2prateek.rx.preferences2:rx-preferences:${RX_PREFS}"
compile("com.mikepenz:materialdrawer:${MATERIAL_DRAWER}@aar") {
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index b59e5041..e715dc54 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
package="com.pitchedapps.frost">
<uses-permission android:name="android.permission.INTERNET" />
@@ -38,13 +39,21 @@
android:theme="@style/FrostTheme" />
<activity
android:name=".WebOverlayActivity"
+ android:hardwareAccelerated="true"
+ android:label="@string/app_name"
+ android:theme="@style/FrostTheme.Overlay" />
+
+ <activity
+ android:name=".FrostWebActivity"
android:autoRemoveFromRecents="true"
android:exported="true"
+ android:label="@string/frost_web"
android:hardwareAccelerated="true"
android:launchMode="singleInstance"
android:taskAffinity="com.pitchedapps.frost.single.web"
android:theme="@style/FrostTheme.Overlay">
- <intent-filter android:autoVerify="true">
+ <intent-filter android:autoVerify="true"
+ tools:ignore="UnusedAttribute">
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.VIEW" />
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt b/app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt
index 3a559bc2..dc9f0c11 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt
@@ -48,18 +48,11 @@ class FrostApp : Application() {
FbCookie()
super.onCreate()
//Drawer profile loading logic
-// DrawerImageLoader.init(object : AbstractDrawerImageLoader() {
-// override fun set(imageView: ImageView, uri: Uri, placeholder: Drawable, tag: String) {
-// Glide.with(imageView.context).load(uri).apply(RequestOptions().placeholder(placeholder)).into(imageView)
-// }
-//
-// override fun placeholder(ctx: Context, tag: String): Drawable {
-// when (tag) {
-// DrawerImageLoader.Tags.PROFILE.name, DrawerImageLoader.Tags.ACCOUNT_HEADER.name -> DrawerUIUtils.getPlaceHolder(ctx)
-// }
-// return super.placeholder(ctx, tag);
-// }
-// })
+ DrawerImageLoader.init(object : AbstractDrawerImageLoader() {
+ override fun set(imageView: ImageView, uri: Uri, placeholder: Drawable, tag: String) {
+ Glide.with(imageView.context).load(uri).apply(RequestOptions().placeholder(placeholder)).into(imageView)
+ }
+ })
}
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/FrostWebActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/FrostWebActivity.kt
new file mode 100644
index 00000000..31ebfda2
--- /dev/null
+++ b/app/src/main/kotlin/com/pitchedapps/frost/FrostWebActivity.kt
@@ -0,0 +1,27 @@
+package com.pitchedapps.frost
+
+import android.os.Bundle
+import android.support.design.widget.CoordinatorLayout
+import android.support.v7.app.AppCompatActivity
+import android.support.v7.widget.Toolbar
+import ca.allanwang.kau.utils.*
+import com.jude.swipbackhelper.SwipeBackHelper
+import com.pitchedapps.frost.facebook.FbTab
+import com.pitchedapps.frost.utils.ARG_URL
+import com.pitchedapps.frost.utils.Prefs
+import com.pitchedapps.frost.utils.formattedFbUrl
+import com.pitchedapps.frost.utils.setFrostColors
+import com.pitchedapps.frost.web.FrostWebView
+
+
+/**
+ * Created by Allan Wang on 2017-06-19.
+ *
+ * Replica of [WebOverlayActivity] with a different base url
+ * Didn't use activity-alias because it causes issues when only one activity has the singleInstance mode
+ */
+class FrostWebActivity:WebOverlayActivity() {
+ override val url: String
+ get() = intent.dataString!!.formattedFbUrl
+
+} \ No newline at end of file
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/LoginActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/LoginActivity.kt
index 303b9987..ecc27946 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/LoginActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/LoginActivity.kt
@@ -87,7 +87,6 @@ class LoginActivity : BaseActivity() {
.observeOn(AndroidSchedulers.mainThread()).subscribe {
(foundImage, name) ->
refresh = false
- L.d("Zip done")
if (!foundImage) L.e("Could not get profile photo; Invalid userId?\n\t$cookie")
textview.setTextWithFade(String.format(getString(R.string.welcome), name), duration = 500)
/*
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt
index b4320ba3..f7648243 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt
@@ -61,6 +61,10 @@ class MainActivity : BaseActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
+ if (BuildConfig.VERSION_CODE > Prefs.versionCode) {
+ Prefs.versionCode = BuildConfig.VERSION_CODE
+ showChangelog(R.xml.changelog, { theme() })
+ }
setContentView(R.layout.activity_main)
setSupportActionBar(toolbar)
adapter = SectionsPagerAdapter(supportFragmentManager, loadFbTabs())
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/WebOverlayActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/WebOverlayActivity.kt
index 260db298..320e4028 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/WebOverlayActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/WebOverlayActivity.kt
@@ -6,7 +6,6 @@ import android.support.v7.app.AppCompatActivity
import android.support.v7.widget.Toolbar
import ca.allanwang.kau.utils.*
import com.jude.swipbackhelper.SwipeBackHelper
-import com.pitchedapps.frost.facebook.FbTab
import com.pitchedapps.frost.utils.ARG_URL
import com.pitchedapps.frost.utils.Prefs
import com.pitchedapps.frost.utils.formattedFbUrl
@@ -17,14 +16,14 @@ import com.pitchedapps.frost.web.FrostWebView
/**
* Created by Allan Wang on 2017-06-01.
*/
-class WebOverlayActivity : AppCompatActivity() {
+open class WebOverlayActivity : AppCompatActivity() {
val toolbar: Toolbar by bindView(R.id.overlay_toolbar)
val frostWeb: FrostWebView by bindView(R.id.overlay_frost_webview)
val coordinator: CoordinatorLayout by bindView(R.id.overlay_main_content)
- val url: String
- get() = (intent.extras?.getString(ARG_URL) ?: intent.dataString)?.formattedFbUrl ?: FbTab.FEED.url
+ open val url: String
+ get() = intent.extras!!.getString(ARG_URL).formattedFbUrl
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/services/NotificationService.kt b/app/src/main/kotlin/com/pitchedapps/frost/services/NotificationService.kt
index cd66b9c2..3f3805a9 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/services/NotificationService.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/services/NotificationService.kt
@@ -6,20 +6,17 @@ import android.app.job.JobParameters
import android.app.job.JobService
import android.content.Context
import android.content.Intent
-import android.os.Looper
-import android.support.v4.app.ActivityOptionsCompat
+import android.net.Uri
import android.support.v4.app.NotificationCompat
import android.support.v4.app.NotificationManagerCompat
-import ca.allanwang.kau.utils.checkThread
import ca.allanwang.kau.utils.string
import com.pitchedapps.frost.BuildConfig
+import com.pitchedapps.frost.FrostWebActivity
import com.pitchedapps.frost.R
-import com.pitchedapps.frost.WebOverlayActivity
import com.pitchedapps.frost.dbflow.*
import com.pitchedapps.frost.facebook.FACEBOOK_COM
import com.pitchedapps.frost.facebook.FB_URL_BASE
import com.pitchedapps.frost.facebook.FbTab
-import com.pitchedapps.frost.utils.ARG_URL
import com.pitchedapps.frost.utils.L
import org.jetbrains.anko.doAsync
import org.jsoup.Jsoup
@@ -105,13 +102,10 @@ class NotificationService : JobService() {
data class NotificationContent(val data: CookieModel, val notifId: Int, val href: String, val text: String, val timestamp: Long) {
fun createNotification(context: Context) {
- val intent = Intent(context, WebOverlayActivity::class.java)
- intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP or Intent.FLAG_ACTIVITY_NEW_TASK)
- intent.putExtra(ARG_URL, "$FB_URL_BASE$href")
- intent.action = System.currentTimeMillis().toString() //dummy action
+ val intent = Intent(context, FrostWebActivity::class.java)
+ intent.data = Uri.parse("$FB_URL_BASE$href")
val group = "frost_${data.id}"
- val bundle = ActivityOptionsCompat.makeCustomAnimation(context, R.anim.slide_in_right, R.anim.slide_out_right).toBundle()
- val pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_ONE_SHOT, bundle)
+ val pendingIntent = PendingIntent.getActivity(context, 0, intent, 0)
val notifBuilder = NotificationCompat.Builder(context)
.setSmallIcon(R.drawable.frost_f_24)
.setContentTitle(context.string(R.string.app_name))
@@ -121,7 +115,6 @@ class NotificationService : JobService() {
.setSubText(data.name)
.setGroup(group)
.setAutoCancel(true)
-// .setColor(context.color(R.color.facebook_blue))
if (timestamp != -1L) notifBuilder.setWhen(timestamp * 1000)
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt
index b319fcc3..62ed3cdd 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt
@@ -33,6 +33,8 @@ object Prefs : KPref() {
var notificationFreq: Long by kpref("notification_freq", -1L)
+ var versionCode:Int by kpref("version_code", -1)
+
private val loader = lazyResettable { Theme.values[Prefs.theme] }
private val t: Theme by loader
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/views/BadgedIcon.kt b/app/src/main/kotlin/com/pitchedapps/frost/views/BadgedIcon.kt
index bc932480..cc96758b 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/views/BadgedIcon.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/views/BadgedIcon.kt
@@ -24,7 +24,7 @@ class BadgedIcon @JvmOverloads constructor(
init {
inflate(context, R.layout.view_badged_icon, this)
- val badgeColor = Prefs.headerColor.withAlpha(255).colorToForeground(0.1f)
+ val badgeColor = Prefs.headerColor.withAlpha(255).colorToForeground(0.2f)
val badgeBackground = GradientDrawable(GradientDrawable.Orientation.BOTTOM_TOP, intArrayOf(badgeColor, badgeColor))
badgeBackground.cornerRadius = 13.dpToPx.toFloat()
badgeTextView.background = badgeBackground
diff --git a/app/src/main/res/drawable/splash_screen.xml b/app/src/main/res/drawable/splash_screen.xml
index 58469632..16a31534 100644
--- a/app/src/main/res/drawable/splash_screen.xml
+++ b/app/src/main/res/drawable/splash_screen.xml
@@ -2,9 +2,7 @@
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
android:opacity="opaque">
- <!-- The background color, preferably the same as your normal theme -->
<item android:drawable="@color/splashBackground"/>
- <!-- Your product logo - 288px x 288px color version of your app badgeImage -->
<item android:bottom="@dimen/splash_logo">
<bitmap
android:gravity="center"
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index f05d2ce5..6fd465c2 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1,4 +1,5 @@
<resources>
+ <string name="frost_web">Frost Web</string>
<string name="action_settings">Settings</string>
<string name="section_format">Hello World from section: %1$d</string>
diff --git a/gradle.properties b/gradle.properties
index 533e22df..7caf6972 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -20,7 +20,7 @@ VERSION_CODE=2
VERSION_NAME=0.2
ANDROID_SUPPORT_LIBS=26.0.0-alpha1
-KAU=94defc1ab5
+KAU=6c6740f497
MATERIAL_DRAWER=5.9.2
MATERIAL_DRAWER_KT=1.0.2
IICON_GOOGLE=3.0.1.0
@@ -36,11 +36,7 @@ GLIDE=4.0.0-RC0
RETROFIT=2.2.0
EVENTBUS=3.0.0
DBFLOW=4.0.2
-SQL_CIPHER=3.5.7
-OKHTTP_INTERCEPTOR=3.6.0
ROBOELECTRIC=3.3.2
-AUTO=1.4.1
-AUTO_VALUE_PARCEL=0.2.5
RX_PREFS=2.0.0-RC2
PAPER_PARCEL=2.0.1
SWIPE_BACK=3.1.2