mirror of
https://github.com/AllanWang/Frost-for-Facebook.git
synced 2024-11-10 04:52:38 +01:00
Clean up notifications and animations
This commit is contained in:
parent
ab61f2afd8
commit
7b90fa9819
@ -18,6 +18,7 @@ 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.L
|
||||
import com.pitchedapps.frost.utils.frostNotification
|
||||
import org.jetbrains.anko.doAsync
|
||||
import org.jsoup.Jsoup
|
||||
import org.jsoup.nodes.Element
|
||||
@ -90,11 +91,9 @@ class NotificationService : JobService() {
|
||||
|
||||
private fun Context.debugNotification(text: String) {
|
||||
if (BuildConfig.DEBUG) {
|
||||
val notifBuilder = NotificationCompat.Builder(this)
|
||||
.setSmallIcon(R.drawable.frost_f_24)
|
||||
val notifBuilder = frostNotification
|
||||
.setContentTitle(string(R.string.app_name))
|
||||
.setContentText(text)
|
||||
.setAutoCancel(true)
|
||||
|
||||
NotificationManagerCompat.from(this).notify(999, notifBuilder.build())
|
||||
}
|
||||
@ -106,15 +105,13 @@ class NotificationService : JobService() {
|
||||
intent.data = Uri.parse("$FB_URL_BASE$href")
|
||||
val group = "frost_${data.id}"
|
||||
val pendingIntent = PendingIntent.getActivity(context, 0, intent, 0)
|
||||
val notifBuilder = NotificationCompat.Builder(context)
|
||||
.setSmallIcon(R.drawable.frost_f_24)
|
||||
val notifBuilder = context.frostNotification
|
||||
.setContentTitle(context.string(R.string.app_name))
|
||||
.setContentText(text)
|
||||
.setContentIntent(pendingIntent)
|
||||
.setCategory(Notification.CATEGORY_SOCIAL)
|
||||
.setSubText(data.name)
|
||||
.setGroup(group)
|
||||
.setAutoCancel(true)
|
||||
|
||||
if (timestamp != -1L) notifBuilder.setWhen(timestamp * 1000)
|
||||
|
||||
@ -124,13 +121,11 @@ class NotificationService : JobService() {
|
||||
|
||||
fun summaryNotification(userId: Long, count: Int) {
|
||||
if (count <= 1) return
|
||||
val notifBuilder = NotificationCompat.Builder(this)
|
||||
.setSmallIcon(R.drawable.frost_f_24)
|
||||
val notifBuilder = frostNotification
|
||||
.setContentTitle(string(R.string.app_name))
|
||||
.setContentText("$count notifications")
|
||||
.setGroup("frost_$userId")
|
||||
.setGroupSummary(true)
|
||||
.setAutoCancel(true)
|
||||
|
||||
NotificationManagerCompat.from(this).notify("frost_$userId", userId.toInt(), notifBuilder.build())
|
||||
}
|
||||
|
@ -8,12 +8,14 @@ import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.graphics.Color
|
||||
import android.graphics.drawable.ColorDrawable
|
||||
import android.support.v4.app.NotificationCompat
|
||||
import android.support.v4.content.ContextCompat
|
||||
import android.support.v7.widget.Toolbar
|
||||
import android.view.View
|
||||
import android.widget.TextView
|
||||
import ca.allanwang.kau.utils.*
|
||||
import com.afollestad.materialdialogs.MaterialDialog
|
||||
import com.pitchedapps.frost.BuildConfig
|
||||
import com.pitchedapps.frost.LoginActivity
|
||||
import com.pitchedapps.frost.R
|
||||
import com.pitchedapps.frost.WebOverlayActivity
|
||||
@ -53,9 +55,7 @@ fun Context.launchWebOverlay(url: String) {
|
||||
val argUrl = url.formattedFbUrl
|
||||
L.i("Launch web overlay: $argUrl")
|
||||
val intent = Intent(this, 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, argUrl)
|
||||
// val bundle = ActivityOptionsCompat.makeCustomAnimation(this, R.anim.slide_in_right, R.anim.slide_out_right).toBundle()
|
||||
ContextCompat.startActivity(this, intent, null)
|
||||
}
|
||||
|
||||
@ -63,6 +63,13 @@ fun WebOverlayActivity.url(): String {
|
||||
return intent.extras?.getString(ARG_URL) ?: FbTab.FEED.url
|
||||
}
|
||||
|
||||
val Context.frostNotification: NotificationCompat.Builder
|
||||
get() = NotificationCompat.Builder(this, BuildConfig.APPLICATION_ID).apply {
|
||||
setSmallIcon(R.drawable.frost_f_24)
|
||||
setAutoCancel(true)
|
||||
color = color(R.color.frost_notification_accent)
|
||||
}
|
||||
|
||||
|
||||
fun Activity.materialDialogThemed(action: MaterialDialog.Builder.() -> Unit): MaterialDialog {
|
||||
val builder = MaterialDialog.Builder(this).theme()
|
||||
|
@ -1,11 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:opacity="opaque">
|
||||
<item android:drawable="@color/splashBackground"/>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@color/frost_splash_background" />
|
||||
<item android:bottom="@dimen/splash_logo">
|
||||
<bitmap
|
||||
android:gravity="center"
|
||||
android:src="@drawable/splash_logo"/>
|
||||
android:src="@drawable/splash_logo" />
|
||||
</item>
|
||||
</layer-list>
|
@ -3,7 +3,8 @@
|
||||
<color name="colorPrimary">@color/facebook_blue</color>
|
||||
<color name="colorPrimaryDark">@color/facebook_blue_dark</color>
|
||||
<color name="colorAccent">#FF4081</color>
|
||||
<color name="splashBackground">@color/facebook_blue</color>
|
||||
<color name="frost_splash_background">@color/facebook_blue</color>
|
||||
<color name="facebook_blue">#3b5998</color>
|
||||
<color name="facebook_blue_dark">#2e4b86</color>
|
||||
<color name="frost_notification_accent">@color/facebook_blue</color>
|
||||
</resources>
|
||||
|
@ -36,9 +36,9 @@
|
||||
|
||||
<style name="FrostTheme.Splash" parent="Theme.AppCompat.NoActionBar">
|
||||
<item name="android:windowBackground">@drawable/splash_screen</item>
|
||||
<item name="android:navigationBarColor">@color/splashBackground</item>
|
||||
<item name="colorPrimaryDark">@color/splashBackground</item>
|
||||
<item name="colorAccent">@color/splashBackground</item>
|
||||
<item name="android:navigationBarColor">@color/frost_splash_background</item>
|
||||
<item name="colorPrimaryDark">@color/frost_splash_background</item>
|
||||
<item name="colorAccent">@color/frost_splash_background</item>
|
||||
</style>
|
||||
|
||||
<style name="FrostProgressBar" parent="Widget.AppCompat.ProgressBar.Horizontal">
|
||||
|
@ -20,7 +20,7 @@ VERSION_CODE=2
|
||||
VERSION_NAME=0.2
|
||||
ANDROID_SUPPORT_LIBS=26.0.0-alpha1
|
||||
|
||||
KAU=6c6740f497
|
||||
KAU=f41eb8b14f
|
||||
MATERIAL_DRAWER=5.9.2
|
||||
MATERIAL_DRAWER_KT=1.0.2
|
||||
IICON_GOOGLE=3.0.1.0
|
||||
|
Loading…
Reference in New Issue
Block a user