Skip to content

Commit

Permalink
Use icon without tint for quick tile
Browse files Browse the repository at this point in the history
  • Loading branch information
mueller-ma committed May 11, 2024
1 parent dd7ea4f commit 186efcd
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 7 deletions.
4 changes: 2 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@

<service
android:name=".tiles.ToggleTile"
android:icon="@drawable/ic_twotone_free_breakfast_24"
android:icon="@drawable/ic_twotone_free_breakfast_24_white"
android:label="@string/toggle_coffee"
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE"
android:exported="true">
Expand All @@ -69,7 +69,7 @@

<service
android:name=".tiles.TimeoutTile"
android:icon="@drawable/ic_twotone_free_breakfast_24"
android:icon="@drawable/ic_twotone_free_breakfast_24_white"
android:label="@string/timeout_next"
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE"
android:exported="true">
Expand Down
21 changes: 17 additions & 4 deletions app/src/main/java/com/github/muellerma/coffee/ForegroundService.kt
Original file line number Diff line number Diff line change
@@ -1,16 +1,29 @@
package com.github.muellerma.coffee

import android.annotation.SuppressLint
import android.app.*
import android.content.*
import android.app.Notification
import android.app.NotificationChannel
import android.app.NotificationManager
import android.app.PendingIntent
import android.app.Service
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.content.SharedPreferences
import android.os.Build
import android.os.IBinder
import android.os.PowerManager
import android.util.Log
import androidx.core.app.NotificationCompat
import androidx.core.content.ContextCompat
import androidx.core.content.getSystemService
import kotlinx.coroutines.*
import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlin.time.Duration.Companion.minutes
import kotlin.time.Duration.Companion.seconds

Expand Down Expand Up @@ -155,7 +168,7 @@ class ForegroundService : Service(), ServiceStatusObserver {
return NotificationCompat.Builder(this, NOTIFICATION_CHANNEL_ID)
.setContentTitle(title)
.setTicker(title)
.setSmallIcon(R.drawable.ic_twotone_free_breakfast_24)
.setSmallIcon(R.drawable.ic_twotone_free_breakfast_24_accent)
.setOngoing(true)
.setShowWhen(false)
.setColor(ContextCompat.getColor(applicationContext, R.color.coffee_brown))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class MainActivity : AppCompatActivity(), ServiceStatusObserver {
statusBarManager.requestAddTileService(
ComponentName(this@MainActivity, ToggleTile::class.java),
getString(R.string.app_name),
Icon.createWithResource(this@MainActivity, R.drawable.ic_twotone_free_breakfast_24),
Icon.createWithResource(this@MainActivity, R.drawable.ic_twotone_free_breakfast_24_accent),
Executor { Log.d(TAG, "Executor") }
) { resultCode -> Log.e(TAG, "Error adding tile $resultCode") }
}
Expand Down
14 changes: 14 additions & 0 deletions app/src/main/res/drawable/ic_twotone_free_breakfast_24_white.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillAlpha="0.3"
android:fillColor="#ffffff"
android:pathData="M6,13c0,1.1 0.9,2 2,2h6c1.1,0 2,-0.9 2,-2V5H6v8z"
android:strokeAlpha="0.3" />
<path
android:fillColor="#ffffff"
android:pathData="M4,19h16v2L4,21zM20,3L4,3v10c0,2.21 1.79,4 4,4h6c2.21,0 4,-1.79 4,-4v-3h2c1.11,0 2,-0.9 2,-2L22,5c0,-1.11 -0.89,-2 -2,-2zM16,13c0,1.1 -0.9,2 -2,2L8,15c-1.1,0 -2,-0.9 -2,-2L6,5h10v8zM20,8h-2L18,5h2v3z" />
</vector>

0 comments on commit 186efcd

Please sign in to comment.