summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--res/layout/cell_broadcast_alert.xml7
-rw-r--r--src/com/android/cellbroadcastreceiver/CellBroadcastAlertFullScreen.java12
-rw-r--r--src/com/android/cellbroadcastreceiver/CellBroadcastAlertService.java2
-rw-r--r--src/com/android/cellbroadcastreceiver/CellBroadcastListItem.java2
-rw-r--r--src/com/android/cellbroadcastreceiver/CellBroadcastResources.java5
5 files changed, 24 insertions, 4 deletions
diff --git a/res/layout/cell_broadcast_alert.xml b/res/layout/cell_broadcast_alert.xml
index 2ac634bd..5108b2bd 100644
--- a/res/layout/cell_broadcast_alert.xml
+++ b/res/layout/cell_broadcast_alert.xml
@@ -29,6 +29,7 @@
<LinearLayout android:id="@+id/topPanel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:gravity="center_horizontal"
android:orientation="vertical">
<View android:id="@+id/titleDividerTop"
android:layout_width="match_parent"
@@ -55,6 +56,12 @@
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
+ <TextView android:id="@+id/timestamp"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textSize="13sp"
+ android:visibility="gone"
+ />
<View android:id="@+id/titleDivider"
android:layout_width="match_parent"
android:layout_height="2dip"
diff --git a/src/com/android/cellbroadcastreceiver/CellBroadcastAlertFullScreen.java b/src/com/android/cellbroadcastreceiver/CellBroadcastAlertFullScreen.java
index 8110e1e2..e941f7cc 100644
--- a/src/com/android/cellbroadcastreceiver/CellBroadcastAlertFullScreen.java
+++ b/src/com/android/cellbroadcastreceiver/CellBroadcastAlertFullScreen.java
@@ -43,7 +43,9 @@ import android.widget.ImageView;
import android.widget.TextView;
import java.util.ArrayList;
+import java.util.Date;
import java.util.concurrent.atomic.AtomicInteger;
+import java.text.SimpleDateFormat;
/**
* Full-screen emergency alert with flashing warning icon.
@@ -370,8 +372,16 @@ public class CellBroadcastAlertFullScreen extends Activity {
/** Update alert text when a new emergency alert arrives. */
private void updateAlertText(CellBroadcastMessage message) {
- int titleId = CellBroadcastResources.getDialogTitleResource(message);
+ int titleId = CellBroadcastResources.getDialogTitleResource(this, message);
setTitle(titleId);
+ if (getResources().getBoolean(R.bool.enable_colombia_channels)) {
+ SimpleDateFormat formatter = new SimpleDateFormat("hh:mm:ss dd/MM/yyyy");
+ String timestampStr = formatter.format(new Date(message.getDeliveryTime()));
+
+ TextView timestampView = (TextView) findViewById(R.id.timestamp);
+ timestampView.setVisibility(View.VISIBLE);
+ timestampView.setText(timestampStr);
+ }
((TextView) findViewById(R.id.alertTitle)).setText(titleId);
((TextView) findViewById(R.id.message)).setText(message.getMessageBody());
diff --git a/src/com/android/cellbroadcastreceiver/CellBroadcastAlertService.java b/src/com/android/cellbroadcastreceiver/CellBroadcastAlertService.java
index 13cf28e8..a5de6def 100644
--- a/src/com/android/cellbroadcastreceiver/CellBroadcastAlertService.java
+++ b/src/com/android/cellbroadcastreceiver/CellBroadcastAlertService.java
@@ -466,7 +466,7 @@ public class CellBroadcastAlertService extends Service {
* @param message the alert to display
*/
private void addToNotificationBar(CellBroadcastMessage message) {
- int channelTitleId = CellBroadcastResources.getDialogTitleResource(message);
+ int channelTitleId = CellBroadcastResources.getDialogTitleResource(this, message);
CharSequence channelName = getText(channelTitleId);
String messageBody = message.getMessageBody();
diff --git a/src/com/android/cellbroadcastreceiver/CellBroadcastListItem.java b/src/com/android/cellbroadcastreceiver/CellBroadcastListItem.java
index 7db5fd2a..45b5f0a0 100644
--- a/src/com/android/cellbroadcastreceiver/CellBroadcastListItem.java
+++ b/src/com/android/cellbroadcastreceiver/CellBroadcastListItem.java
@@ -69,7 +69,7 @@ public class CellBroadcastListItem extends RelativeLayout {
setBackground(background);
- mChannelView.setText(CellBroadcastResources.getDialogTitleResource(message));
+ mChannelView.setText(CellBroadcastResources.getDialogTitleResource(getContext(), message));
mDateView.setText(message.getDateString(getContext()));
mMessageView.setText(formatMessage(message));
}
diff --git a/src/com/android/cellbroadcastreceiver/CellBroadcastResources.java b/src/com/android/cellbroadcastreceiver/CellBroadcastResources.java
index 76d4b42b..eaf8bcba 100644
--- a/src/com/android/cellbroadcastreceiver/CellBroadcastResources.java
+++ b/src/com/android/cellbroadcastreceiver/CellBroadcastResources.java
@@ -236,7 +236,7 @@ public class CellBroadcastResources {
}
}
- public static int getDialogTitleResource(CellBroadcastMessage cbm) {
+ public static int getDialogTitleResource(Context context, CellBroadcastMessage cbm) {
// ETWS warning types
SmsCbEtwsInfo etwsInfo = cbm.getEtwsWarningInfo();
if (etwsInfo != null) {
@@ -264,6 +264,9 @@ public class CellBroadcastResources {
if (cmasInfo != null) {
switch (cmasInfo.getMessageClass()) {
case SmsCbCmasInfo.CMAS_CLASS_PRESIDENTIAL_LEVEL_ALERT:
+ if (context.getResources().getBoolean(R.bool.enable_colombia_channels)) {
+ return R.string.etws_other_emergency_type;
+ }
return R.string.cmas_presidential_level_alert;
case SmsCbCmasInfo.CMAS_CLASS_EXTREME_THREAT: