From b27b809d018665d25512f9707d49941667cbc21c Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Mon, 3 Jun 2013 21:09:41 -0700 Subject: Finished adding 4x1-4x4 widgets (Thanks archrival) --- .../daneren2005/dsub/provider/DSubWidget4x1.java | 1 - .../daneren2005/dsub/provider/DSubWidget4x2.java | 1 - .../daneren2005/dsub/provider/DSubWidget4x3.java | 29 ++++++++++++++++++++++ .../daneren2005/dsub/provider/DSubWidget4x4.java | 29 ++++++++++++++++++++++ .../dsub/provider/DSubWidgetProvider.java | 12 ++++++++- 5 files changed, 69 insertions(+), 3 deletions(-) create mode 100644 subsonic-android/src/github/daneren2005/dsub/provider/DSubWidget4x3.java create mode 100644 subsonic-android/src/github/daneren2005/dsub/provider/DSubWidget4x4.java (limited to 'subsonic-android/src') diff --git a/subsonic-android/src/github/daneren2005/dsub/provider/DSubWidget4x1.java b/subsonic-android/src/github/daneren2005/dsub/provider/DSubWidget4x1.java index 5461d076..e00bf02d 100644 --- a/subsonic-android/src/github/daneren2005/dsub/provider/DSubWidget4x1.java +++ b/subsonic-android/src/github/daneren2005/dsub/provider/DSubWidget4x1.java @@ -19,7 +19,6 @@ package github.daneren2005.dsub.provider; import android.appwidget.AppWidgetManager; -import android.content.Context; import github.daneren2005.dsub.R; public class DSubWidget4x1 extends DSubWidgetProvider { diff --git a/subsonic-android/src/github/daneren2005/dsub/provider/DSubWidget4x2.java b/subsonic-android/src/github/daneren2005/dsub/provider/DSubWidget4x2.java index 376a3084..4908f632 100644 --- a/subsonic-android/src/github/daneren2005/dsub/provider/DSubWidget4x2.java +++ b/subsonic-android/src/github/daneren2005/dsub/provider/DSubWidget4x2.java @@ -19,7 +19,6 @@ package github.daneren2005.dsub.provider; import android.appwidget.AppWidgetManager; -import android.content.Context; import github.daneren2005.dsub.R; public class DSubWidget4x2 extends DSubWidgetProvider { diff --git a/subsonic-android/src/github/daneren2005/dsub/provider/DSubWidget4x3.java b/subsonic-android/src/github/daneren2005/dsub/provider/DSubWidget4x3.java new file mode 100644 index 00000000..f1908d0d --- /dev/null +++ b/subsonic-android/src/github/daneren2005/dsub/provider/DSubWidget4x3.java @@ -0,0 +1,29 @@ +/* + This file is part of Subsonic. + + Subsonic is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Subsonic is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Subsonic. If not, see . + + Copyright 2010 (C) Sindre Mehus + */ +package github.daneren2005.dsub.provider; + +import android.appwidget.AppWidgetManager; +import github.daneren2005.dsub.R; + +public class DSubWidget4x3 extends DSubWidgetProvider { + @Override + protected int getLayout() { + return R.layout.appwidget4x3; + } +} diff --git a/subsonic-android/src/github/daneren2005/dsub/provider/DSubWidget4x4.java b/subsonic-android/src/github/daneren2005/dsub/provider/DSubWidget4x4.java new file mode 100644 index 00000000..7fee2747 --- /dev/null +++ b/subsonic-android/src/github/daneren2005/dsub/provider/DSubWidget4x4.java @@ -0,0 +1,29 @@ +/* + This file is part of Subsonic. + + Subsonic is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Subsonic is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Subsonic. If not, see . + + Copyright 2010 (C) Sindre Mehus + */ +package github.daneren2005.dsub.provider; + +import android.appwidget.AppWidgetManager; +import github.daneren2005.dsub.R; + +public class DSubWidget4x4 extends DSubWidgetProvider { + @Override + protected int getLayout() { + return R.layout.appwidget4x4; + } +} diff --git a/subsonic-android/src/github/daneren2005/dsub/provider/DSubWidgetProvider.java b/subsonic-android/src/github/daneren2005/dsub/provider/DSubWidgetProvider.java index be91fe17..321b0f88 100644 --- a/subsonic-android/src/github/daneren2005/dsub/provider/DSubWidgetProvider.java +++ b/subsonic-android/src/github/daneren2005/dsub/provider/DSubWidgetProvider.java @@ -59,6 +59,8 @@ public class DSubWidgetProvider extends AppWidgetProvider { private static final String TAG = DSubWidgetProvider.class.getSimpleName(); private static DSubWidget4x1 instance4x1; private static DSubWidget4x2 instance4x2; + private static DSubWidget4x3 instance4x3; + private static DSubWidget4x4 instance4x4; public static synchronized void notifyInstances(Context context, DownloadService service, boolean playing) { if(instance4x1 == null) { @@ -67,9 +69,17 @@ public class DSubWidgetProvider extends AppWidgetProvider { if(instance4x2 == null) { instance4x2 = new DSubWidget4x2(); } + if(instance4x3 == null) { + instance4x3 = new DSubWidget4x3(); + } + if(instance4x4 == null) { + instance4x4 = new DSubWidget4x4(); + } instance4x1.notifyChange(context, service, playing); instance4x2.notifyChange(context, service, playing); + instance4x3.notifyChange(context, service, playing); + instance4x4.notifyChange(context, service, playing); } @Override @@ -90,7 +100,7 @@ public class DSubWidgetProvider extends AppWidgetProvider { final RemoteViews views = new RemoteViews(context.getPackageName(), getLayout()); views.setTextViewText(R.id.artist, res.getText(R.string.widget_initial_text)); - if(getLayout() != R.layout.appwidget4x1) { + if(getLayout() == R.layout.appwidget4x2) { views.setTextViewText(R.id.album, ""); } -- cgit v1.2.3