In Android 13+, remove icon and text from status notification
This commit is contained in:
@ -1139,12 +1139,22 @@ class BaresipService: Service() {
|
|||||||
.setSmallIcon(R.drawable.ic_stat)
|
.setSmallIcon(R.drawable.ic_stat)
|
||||||
.setContentIntent(pi)
|
.setContentIntent(pi)
|
||||||
.setOngoing(true)
|
.setOngoing(true)
|
||||||
.setContent(RemoteViews(packageName, R.layout.status_notification))
|
.setContent(RemoteViews(packageName,
|
||||||
|
if (VERSION.SDK_INT >= 33)
|
||||||
|
R.layout.status_notification_33
|
||||||
|
else
|
||||||
|
R.layout.status_notification)
|
||||||
|
)
|
||||||
startForeground(STATUS_NOTIFICATION_ID, snb.build())
|
startForeground(STATUS_NOTIFICATION_ID, snb.build())
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateStatusNotification() {
|
private fun updateStatusNotification() {
|
||||||
val contentView = RemoteViews(packageName, R.layout.status_notification)
|
val contentView = RemoteViews(packageName,
|
||||||
|
if (VERSION.SDK_INT >= 33)
|
||||||
|
R.layout.status_notification_33
|
||||||
|
else
|
||||||
|
R.layout.status_notification
|
||||||
|
)
|
||||||
for (i: Int in 0..3) {
|
for (i: Int in 0..3) {
|
||||||
val resId = when (i) {
|
val resId = when (i) {
|
||||||
0-> R.id.status0
|
0-> R.id.status0
|
||||||
|
|||||||
49
app/src/main/res/layout/status_notification_33.xml
Normal file
49
app/src/main/res/layout/status_notification_33.xml
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/mainRow"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal" >
|
||||||
|
|
||||||
|
<ImageView android:id="@+id/status0"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:contentDescription="@string/status" />
|
||||||
|
|
||||||
|
<ImageView android:id="@+id/status1"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:paddingStart="10dp"
|
||||||
|
android:paddingEnd="0dp"
|
||||||
|
android:contentDescription="@string/status" />
|
||||||
|
|
||||||
|
<ImageView android:id="@+id/status2"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:paddingStart="10dp"
|
||||||
|
android:paddingEnd="0dp"
|
||||||
|
android:contentDescription="@string/status" />
|
||||||
|
|
||||||
|
<ImageView android:id="@+id/status3"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:paddingStart="10dp"
|
||||||
|
android:paddingEnd="0dp"
|
||||||
|
android:contentDescription="@string/status" />
|
||||||
|
|
||||||
|
<TextView android:id="@+id/etc"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginBottom="14dp"
|
||||||
|
android:paddingStart="5dp"
|
||||||
|
android:paddingEnd="0dp"
|
||||||
|
android:text="@string/dots"
|
||||||
|
android:textColor="#000000"
|
||||||
|
style = "@android:style/TextAppearance.Medium" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
Reference in New Issue
Block a user