summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKonsta <konsta09@gmail.com>2013-07-16 19:15:42 +0300
committerBruno Martins <bgcngm@gmail.com>2017-09-14 08:43:54 +0100
commitb1ed7a395db4fe4eed6491171044f7fe467a1334 (patch)
treea4c7ee87c4d9d8d2cb5822e0ad2b2869955919df
parentd83dc9709547acee0534d89aad2273c74a34f17b (diff)
downloadandroid_hardware_qcom_fm-b1ed7a395db4fe4eed6491171044f7fe467a1334.tar.gz
android_hardware_qcom_fm-b1ed7a395db4fe4eed6491171044f7fe467a1334.tar.bz2
android_hardware_qcom_fm-b1ed7a395db4fe4eed6491171044f7fe467a1334.zip
FM2: Revamp notifications
Make FM notifications look like something from this decade. :P Change-Id: Ib0e310a320c49e92224d8d4fc2fab530ff28d974
-rw-r--r--fmapp2/res/layout/statusbar.xml56
-rw-r--r--fmapp2/res/values/strings.xml2
-rw-r--r--fmapp2/res/values/transmit_strings.xml2
-rw-r--r--fmapp2/src/com/caf/fmradio/FMRadioService.java13
-rw-r--r--fmapp2/src/com/caf/fmradio/FMTransmitterService.java13
5 files changed, 6 insertions, 80 deletions
diff --git a/fmapp2/res/layout/statusbar.xml b/fmapp2/res/layout/statusbar.xml
deleted file mode 100644
index 47e1a91..0000000
--- a/fmapp2/res/layout/statusbar.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
- * Copyright (C) 2012, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * * Neither the name of The Linux Foundation, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
- -->
-
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:orientation="horizontal">
-
- <ImageView android:id="@+id/icon"
- android:layout_gravity="center_vertical"
- android:paddingLeft="10dp"
- android:paddingRight="10dp"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content">
- </ImageView>
-
- <TextView android:id="@+id/frequency"
- android:textAppearance="?android:attr/textAppearanceMediumInverse"
- android:textColor="@android:color/black"
- android:focusable="true"
- android:ellipsize="marquee"
- android:singleLine="true"
- android:layout_gravity="center"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content" />
-
-</LinearLayout>
diff --git a/fmapp2/res/values/strings.xml b/fmapp2/res/values/strings.xml
index b37fe27..788e744 100644
--- a/fmapp2/res/values/strings.xml
+++ b/fmapp2/res/values/strings.xml
@@ -62,7 +62,7 @@
<string name="preset_delete">Delete</string>
<string name="preset_search">Search for \'<xliff:g id="preset_pi">%1$s</xliff:g>\'</string>
- <string name="stat_notif_frequency">FM Radio Station \'<xliff:g id="frequency">%1$s</xliff:g>\' MHz</string>
+ <string name="stat_notif_frequency">\'<xliff:g id="frequency">%1$s</xliff:g>\' MHz</string>
<string name="regional_band">Regional band</string>
diff --git a/fmapp2/res/values/transmit_strings.xml b/fmapp2/res/values/transmit_strings.xml
index e6531b6..566af1d 100644
--- a/fmapp2/res/values/transmit_strings.xml
+++ b/fmapp2/res/values/transmit_strings.xml
@@ -34,7 +34,7 @@
<string name="msg_callactive">FM transmit is not supported when there is an active voice call</string>
<string name="fmtx_autoselect_name">Auto-select will delete all the presets, continue?</string>
- <string name="stat_notif_tx_frequency">FM Transmitting at: \'<xliff:g id="frequency">%1$s</xliff:g>\' MHz</string>
+ <string name="stat_notif_tx_frequency">Transmitting at: \'<xliff:g id="frequency">%1$s</xliff:g>\' MHz</string>
<string name="transmit_msg_string">Transmitting at:</string>
</resources>
diff --git a/fmapp2/src/com/caf/fmradio/FMRadioService.java b/fmapp2/src/com/caf/fmradio/FMRadioService.java
index aa18131..aa6bf3f 100644
--- a/fmapp2/src/com/caf/fmradio/FMRadioService.java
+++ b/fmapp2/src/com/caf/fmradio/FMRadioService.java
@@ -1779,16 +1779,6 @@ public class FMRadioService extends Service
public void startNotification() {
Log.d(LOGTAG,"startNotification");
- RemoteViews views = new RemoteViews(getPackageName(), R.layout.statusbar);
- views.setImageViewResource(R.id.icon, R.drawable.stat_notify_fm);
- if (isFmOn())
- {
- views.setTextViewText(R.id.frequency, getTunedFrequencyString());
- } else
- {
- views.setTextViewText(R.id.frequency, "");
- }
-
Context context = getApplicationContext();
Notification notification;
NotificationManager notificationManager =
@@ -1801,8 +1791,9 @@ public class FMRadioService extends Service
notificationManager.createNotificationChannel(notificationChannel);
notification = new Notification.Builder(context, FMRADIO_NOTIFICATION_CHANNEL)
- .setCustomContentView(views)
.setSmallIcon(R.drawable.stat_notify_fm)
+ .setContentTitle(isFmOn() ? getString(R.string.app_name) : "")
+ .setContentText(isFmOn() ? getTunedFrequencyString() : "")
.setContentIntent(PendingIntent.getActivity(this,
0, new Intent("com.caf.fmradio.FMRADIO_ACTIVITY"), 0))
.setOngoing(true)
diff --git a/fmapp2/src/com/caf/fmradio/FMTransmitterService.java b/fmapp2/src/com/caf/fmradio/FMTransmitterService.java
index e72b783..54daf20 100644
--- a/fmapp2/src/com/caf/fmradio/FMTransmitterService.java
+++ b/fmapp2/src/com/caf/fmradio/FMTransmitterService.java
@@ -283,16 +283,6 @@ public class FMTransmitterService extends Service
public void startNotification() {
Log.d(LOGTAG,"startNotification");
- RemoteViews views = new RemoteViews(getPackageName(), R.layout.statusbar);
- views.setImageViewResource(R.id.icon, R.drawable.ic_status_fm_tx);
- if (isFmOn())
- {
- views.setTextViewText(R.id.frequency, getTunedFrequencyString());
- } else
- {
- views.setTextViewText(R.id.frequency, "");
- }
-
Context context = getApplicationContext();
Notification notification;
NotificationManager notificationManager =
@@ -305,8 +295,9 @@ public class FMTransmitterService extends Service
notificationManager.createNotificationChannel(notificationChannel);
notification = new Notification.Builder(context, FMTRANSMITTER_NOTIFICATION_CHANNEL)
- .setCustomContentView(views)
.setSmallIcon(R.drawable.stat_notify_fm)
+ .setContentTitle(isFmOn() ? getString(R.string.app_name) : "")
+ .setContentText(isFmOn() ? getTunedFrequencyString() : "")
.setContentIntent(PendingIntent.getActivity(this,
0, new Intent("com.caf.fmradio.FMTRANSMITTER_ACTIVITY"), 0))
.setOngoing(true)