diff options
author | Allan Wang <me@allanwang.ca> | 2017-06-19 20:25:58 -0700 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2017-06-19 20:25:58 -0700 |
commit | ab61f2afd887d772426bda9d9aea829557e2e39d (patch) | |
tree | f715f9441679126bf1ace3603a7a1538ed43e092 /app/src | |
parent | a3b5b647e2651c9768a4056852aff36074590e94 (diff) | |
download | frost-ab61f2afd887d772426bda9d9aea829557e2e39d.tar.gz frost-ab61f2afd887d772426bda9d9aea829557e2e39d.tar.bz2 frost-ab61f2afd887d772426bda9d9aea829557e2e39d.zip |
Update kau and show changelog on version change
Diffstat (limited to 'app/src')
11 files changed, 58 insertions, 33 deletions
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> |