Commit 043403ec authored by Fahim Salam Chowdhury's avatar Fahim Salam Chowdhury 👽
Browse files

301-Update_small_notification_icons

issue: https://gitlab.e.foundation/e/os/backlog/-/issues/301

- Notification shown wrong small icons. This commit replace the icons
  with our icons.
- Refactor code, use `ContextCompat.getColor` to ensure backward support.
- Remove unused `ic_blocking_manager_qksms.png` icon
parent 091cefb4
......@@ -36,6 +36,7 @@ import androidx.core.app.NotificationManagerCompat
import androidx.core.app.Person
import androidx.core.app.RemoteInput
import androidx.core.app.TaskStackBuilder
import androidx.core.content.ContextCompat
import androidx.core.content.getSystemService
import androidx.core.graphics.drawable.IconCompat
import com.moez.QKSMS.R
......@@ -131,7 +132,7 @@ class NotificationManagerImpl @Inject constructor(
val notification = NotificationCompat.Builder(context, getChannelIdForNotification(threadId))
.setCategory(NotificationCompat.CATEGORY_MESSAGE)
.setColor(context.getColor(R.color.tools_theme))
.setColor(ContextCompat.getColor(context, R.color.tools_theme))
.setPriority(NotificationCompat.PRIORITY_MAX)
.setSmallIcon(R.drawable.ic_notification)
.setNumber(messages.size)
......@@ -342,7 +343,7 @@ class NotificationManagerImpl @Inject constructor(
val notification = NotificationCompat.Builder(context, getChannelIdForNotification(threadId))
.setContentTitle(context.getString(R.string.notification_message_failed_title))
.setContentText(context.getString(R.string.notification_message_failed_text, conversation.getTitle()))
.setColor(context.getColor(R.color.tools_theme))
.setColor(ContextCompat.getColor(context, R.color.tools_theme))
.setPriority(NotificationManagerCompat.IMPORTANCE_MAX)
.setSmallIcon(R.drawable.ic_notification_failed)
.setAutoCancel(true)
......@@ -467,7 +468,7 @@ class NotificationManagerImpl @Inject constructor(
.setShowWhen(false)
.setWhen(System.currentTimeMillis()) // Set this anyway in case it's shown
.setSmallIcon(R.drawable.ic_file_download_black_24dp)
.setColor(context.getColor(R.color.tools_theme))
.setColor(ContextCompat.getColor(context, R.color.tools_theme))
.setCategory(NotificationCompat.CATEGORY_PROGRESS)
.setPriority(NotificationCompat.PRIORITY_MIN)
.setProgress(0, 0, true)
......
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2022 E FOUNDATION
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with this program. If not, see <https://www.gnu.org/licenses/>.
~
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M18.969,3.167H5.031C4.502,3.167 3.978,3.271 3.489,3.473C3,3.676 2.555,3.973 2.181,4.347C1.807,4.721 1.51,5.165 1.307,5.654C1.104,6.143 1,6.667 1,7.197V13.985C1,14.514 1.104,15.038 1.307,15.527C1.51,16.016 1.807,16.461 2.181,16.835C2.555,17.209 3,17.506 3.489,17.708C3.978,17.91 4.502,18.014 5.031,18.014V20.833L7.848,18.014H18.969C19.498,18.014 20.022,17.91 20.511,17.708C21,17.506 21.445,17.209 21.819,16.835C22.194,16.461 22.49,16.016 22.693,15.527C22.896,15.038 23,14.514 23,13.985V7.197C23,6.667 22.896,6.143 22.693,5.654C22.49,5.165 22.194,4.721 21.819,4.347C21.445,3.973 21,3.676 20.511,3.473C20.022,3.271 19.498,3.167 18.969,3.167Z" />
</vector>
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2022 E FOUNDATION
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with this program. If not, see <https://www.gnu.org/licenses/>.
~
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M5.031,3.167H18.969C19.498,3.167 20.022,3.271 20.511,3.473C21,3.676 21.445,3.973 21.819,4.347C22.194,4.721 22.49,5.165 22.693,5.654C22.896,6.143 23,6.667 23,7.197V13.985C23,14.514 22.896,15.038 22.693,15.527C22.49,16.016 22.194,16.461 21.819,16.835C21.445,17.209 21,17.506 20.511,17.708C20.022,17.91 19.498,18.014 18.969,18.014H7.848L5.031,20.833V18.014C4.502,18.014 3.978,17.91 3.489,17.708C3,17.506 2.555,17.209 2.181,16.835C1.807,16.461 1.51,16.016 1.307,15.527C1.104,15.038 1,14.514 1,13.985V7.197C1,6.667 1.104,6.143 1.307,5.654C1.51,5.165 1.807,4.721 2.181,4.347C2.555,3.973 3,3.676 3.489,3.473C3.978,3.271 4.502,3.167 5.031,3.167ZM12.519,11.866L12.771,6.036H10.662L10.914,11.866H12.519ZM10.914,12.979C10.711,13.167 10.609,13.401 10.609,13.682C10.609,13.964 10.711,14.2 10.914,14.391C11.117,14.579 11.381,14.672 11.705,14.672C12.029,14.672 12.291,14.579 12.49,14.391C12.693,14.2 12.795,13.964 12.795,13.682C12.795,13.401 12.693,13.167 12.49,12.979C12.291,12.788 12.029,12.692 11.705,12.692C11.381,12.692 11.117,12.788 10.914,12.979Z" />
</vector>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment