Allow the widget to start the music service
This commit is contained in:
parent
1a259e714a
commit
a456aa8c04
@ -2,7 +2,9 @@
|
|||||||
<TextView
|
<TextView
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:id="@+id/stopped_text"
|
android:id="@+id/stopped_text"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="wrap_content"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="wrap_content"
|
||||||
android:gravity="center"
|
android:layout_gravity="center"
|
||||||
android:text="Service stopped." />
|
android:background="#000"
|
||||||
|
android:textColor="#fff"
|
||||||
|
android:text="@string/widget_start_service" />
|
@ -11,6 +11,7 @@
|
|||||||
<string name="stop_service">Stop Service</string>
|
<string name="stop_service">Stop Service</string>
|
||||||
<string name="connect_to_service">Connect to Service</string>
|
<string name="connect_to_service">Connect to Service</string>
|
||||||
<string name="paused">(Paused)</string>
|
<string name="paused">(Paused)</string>
|
||||||
|
<string name="widget_start_service">Click to start the music service.</string>
|
||||||
|
|
||||||
<string name="headset_only_title">Headset only</string>
|
<string name="headset_only_title">Headset only</string>
|
||||||
<string name="headset_only_summary_on">Audio only plays when a headset is plugged in</string>
|
<string name="headset_only_summary_on">Audio only plays when a headset is plugged in</string>
|
||||||
|
@ -12,6 +12,7 @@ public class OneCellWidget extends AppWidgetProvider {
|
|||||||
@Override
|
@Override
|
||||||
public void onUpdate(Context context, AppWidgetManager manager, int[] ids)
|
public void onUpdate(Context context, AppWidgetManager manager, int[] ids)
|
||||||
{
|
{
|
||||||
|
reset(context);
|
||||||
context.sendBroadcast(new Intent(PlaybackService.APPWIDGET_SMALL_UPDATE));
|
context.sendBroadcast(new Intent(PlaybackService.APPWIDGET_SMALL_UPDATE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,6 +37,7 @@ public class OneCellWidget extends AppWidgetProvider {
|
|||||||
public static void reset(Context context)
|
public static void reset(Context context)
|
||||||
{
|
{
|
||||||
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.default_widget);
|
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.default_widget);
|
||||||
|
views.setOnClickPendingIntent(R.id.stopped_text, PendingIntent.getService(context, 0, new Intent(context, PlaybackService.class), 0));
|
||||||
sendUpdate(context, views);
|
sendUpdate(context, views);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user