diff --git a/LocationRinger/AndroidManifest.xml b/LocationRinger/AndroidManifest.xml
index 47d4171..1e600cc 100644
--- a/LocationRinger/AndroidManifest.xml
+++ b/LocationRinger/AndroidManifest.xml
@@ -77,6 +77,7 @@
android:label="@string/app_name" >
+
@@ -9,8 +10,21 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
- android:layout_marginBottom="15dip"
android:background="@drawable/icon"
android:contentDescription="@string/start_location_service" />
+
+
+
+
\ No newline at end of file
diff --git a/LocationRinger/res/values/strings.xml b/LocationRinger/res/values/strings.xml
index d659e55..ecba304 100644
--- a/LocationRinger/res/values/strings.xml
+++ b/LocationRinger/res/values/strings.xml
@@ -92,5 +92,6 @@
Mark my location
My location
Map Mode
+ Current Ringer:
\ No newline at end of file
diff --git a/LocationRinger/res/values/styles.xml b/LocationRinger/res/values/styles.xml
index 883174d..374501b 100644
--- a/LocationRinger/res/values/styles.xml
+++ b/LocationRinger/res/values/styles.xml
@@ -74,4 +74,7 @@ Copyright (C) 2011 Jake Wharton Licensed under the Apache License, Version 2.0 (
- @dimen/default_title_indicator_text_size
- @dimen/default_title_indicator_title_padding
+
diff --git a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/receivers/GetLocationWidget.java b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/receivers/GetLocationWidget.java
index 83f3975..9d35b31 100644
--- a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/receivers/GetLocationWidget.java
+++ b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/receivers/GetLocationWidget.java
@@ -9,6 +9,7 @@ package com.TwentyCodes.android.LocationRinger.receivers;
import android.app.PendingIntent;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider;
+import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
@@ -26,7 +27,9 @@ import com.TwentyCodes.android.debug.LocationLibraryConstants;
*/
public class GetLocationWidget extends AppWidgetProvider {
-public final String TAG = "GetLocationWidget";
+ public final String TAG = "GetLocationWidget";
+
+ public static final String ACTION_UPDATE = "action_update";
/**
* Called in response to the ACTION_APPWIDGET_UPDATE broadcast when this AppWidget provider is being asked to provide RemoteViews for a set of AppWidgets.
@@ -57,6 +60,8 @@ public final String TAG = "GetLocationWidget";
// Get the layout for the App Widget and attach an on-click listener to the button
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.get_location_widget);
views.setOnClickPendingIntent(R.id.widget_get_location_button, pendingIntent);
+
+ views.setTextViewText(R.id.widget_label, context.getSharedPreferences(SettingsActivity.SETTINGS, Debug.SHARED_PREFS_MODE).getString(SettingsActivity.CURRENT, context.getString(R.string.default_ringer)));
// Tell the AppWidgetManager to perform an update on the current App Widget
appWidgetManager.updateAppWidget(appWidgetId, views);
@@ -79,14 +84,19 @@ public final String TAG = "GetLocationWidget";
Log.v(TAG, "onReceive");
// v1.5 fix that doesn't call onDelete Action
final String action = intent.getAction();
+
+ if(action.equals(ACTION_UPDATE)){
+ AppWidgetManager mgr=AppWidgetManager.getInstance(context);
+ onUpdate(context, mgr, mgr.getAppWidgetIds(new ComponentName(context, GetLocationWidget.class)));
+ }
+
if (AppWidgetManager.ACTION_APPWIDGET_DELETED.equals(action)) {
final int appWidgetId = intent.getExtras().getInt(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID);
if (appWidgetId != AppWidgetManager.INVALID_APPWIDGET_ID) {
this.onDeleted(context, new int[] { appWidgetId });
}
- } else {
- super.onReceive(context, intent);
- }
+ }
+ super.onReceive(context, intent);
}
/**
diff --git a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/services/RingerProcessingService.java b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/services/RingerProcessingService.java
index c97e920..3200613 100644
--- a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/services/RingerProcessingService.java
+++ b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/services/RingerProcessingService.java
@@ -31,6 +31,7 @@ import android.widget.Toast;
import com.TwentyCodes.android.LocationRinger.db.RingerDatabase;
import com.TwentyCodes.android.LocationRinger.debug.Debug;
+import com.TwentyCodes.android.LocationRinger.receivers.GetLocationWidget;
import com.TwentyCodes.android.LocationRinger.ui.SettingsActivity;
import com.TwentyCodes.android.debug.LocationLibraryConstants;
import com.TwentyCodes.android.exception.ExceptionHandler;
@@ -64,6 +65,10 @@ public class RingerProcessingService extends Service {
final String name = values.getAsString(RingerDatabase.KEY_RINGER_NAME);
+ this.getSharedPreferences(SettingsActivity.SETTINGS, Debug.SHARED_PREFS_MODE).edit().putString(SettingsActivity.CURRENT, name).commit();
+
+ this.sendBroadcast(new Intent(this, GetLocationWidget.class).setAction(GetLocationWidget.ACTION_UPDATE));
+
/*
* Make it toasty if the user wants to be notified.
* This will display a toast msg "Applying "
diff --git a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/SettingsActivity.java b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/SettingsActivity.java
index 40f8377..7ce36ff 100644
--- a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/SettingsActivity.java
+++ b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/SettingsActivity.java
@@ -50,6 +50,7 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
public static final String IS_DEFAULT = "is_default";
public static final String RESTORE = "restore";
public static final String BACKUP = "backup";
+ public static final String CURRENT = "current";
/**
* Backs up the database