diff options
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/services/NotificationService.kt | 13 | ||||
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt | 11 | ||||
-rw-r--r-- | app/src/main/res/drawable/splash_screen.xml | 7 | ||||
-rw-r--r-- | app/src/main/res/values/colors.xml | 3 | ||||
-rw-r--r-- | app/src/main/res/values/styles.xml | 6 | ||||
-rw-r--r-- | gradle.properties | 2 |
6 files changed, 22 insertions, 20 deletions
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 3f3805a9..d357ff68 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/services/NotificationService.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/services/NotificationService.kt @@ -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()) } 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 52922822..fe56d6d6 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt @@ -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() diff --git a/app/src/main/res/drawable/splash_screen.xml b/app/src/main/res/drawable/splash_screen.xml index 16a31534..4e1c0048 100644 --- a/app/src/main/res/drawable/splash_screen.xml +++ b/app/src/main/res/drawable/splash_screen.xml @@ -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>
\ No newline at end of file diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 0a058ccf..e6dc5b24 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -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> diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 74347ddc..0adb5967 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -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"> diff --git a/gradle.properties b/gradle.properties index 7caf6972..7b523f58 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=6c6740f497 +KAU=f41eb8b14f MATERIAL_DRAWER=5.9.2 MATERIAL_DRAWER_KT=1.0.2 IICON_GOOGLE=3.0.1.0 |