cogitare / tunesremote-plus

Automatically exported from code.google.com/p/tunesremote-plus
0 stars 0 forks source link

Provide AppWidget for TunesRemote #21

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,

Now we have rating stars, it would be neat to have the app in a widget form as 
well.

Is somebody looking at this at the moment?

cheers,
pepijn

Original issue reported on code.google.com by pepijn.k...@gmail.com on 28 Dec 2010 at 3:20

GoogleCodeExporter commented 9 years ago
No one is currently looking at this but you are more than welcome to!

Also the other issue #20 you submitted, were you able to debug that at all?

Original comment by mellowaredev on 28 Dec 2010 at 3:25

GoogleCodeExporter commented 9 years ago
I would pay a dollar for that feature to be implemented. I use WidgetLocker so 
I could put this widget on my lockscreen and rate music without unlocking my 
phone. 

Original comment by rayner...@gmail.com on 28 Dec 2010 at 6:52

GoogleCodeExporter commented 9 years ago

Original comment by mellowaredev on 29 Dec 2010 at 6:07

GoogleCodeExporter commented 9 years ago
Hi,

Please review my patch for AppWidget support. I did some relocating of 
ControlActivity's stuff to make it available for the AppWidget as well. Also 
the Status is follows now an observer pattern (for both activity and AppWidget).

Tha AppWidget does show stale rating stars! You have to click the coverart to 
go to the control activity for rating.

I've tried to be different in the layout and following the tunesRemote style as 
well. Please tell me what you think about it.

Have fun... :)

Cheers,
pepijn

Original comment by pepijn.k...@gmail.com on 18 Jan 2011 at 12:27

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by pepijn.k...@gmail.com on 18 Jan 2011 at 5:08

GoogleCodeExporter commented 9 years ago
I am getting a NullPointerException when I add this widget to the desktop in 
the emulator.

01-18 12:42:29.197: INFO/ActivityManager(59): Start proc org.tunesremote for 
service org.tunesremote/.ControlAppWidget$UpdateService: pid=346 uid=10037 
gids={3003}
01-18 12:42:29.437: INFO/ActivityThread(346): Publishing provider 
org.tunesremote.recent: org.tunesremote.util.RecentProvider
01-18 12:42:29.537: DEBUG/class org.tunesremote.BackendService(346): starting 
backend service
01-18 12:42:29.617: DEBUG/class org.tunesremote.BackendService(346): tried 
looking for lastaddr=192.168.139.59
01-18 12:42:29.667: DEBUG/class org.tunesremote.util.PairingDatabase(346): 
findCode found code=1 for address=192.168.139.59
01-18 12:42:29.667: DEBUG/class org.tunesremote.BackendService(346): Session 
with address=192.168.139.59, library=null, code=1
01-18 12:42:29.667: DEBUG/class org.tunesremote.daap.Session(346): tryign login 
for host=192.168.139.59 and guid=1
01-18 12:42:29.667: DEBUG/class org.tunesremote.daap.RequestHelper(346): 
http://192.168.139.59:3689/login?pairing-guid=0x1
01-18 12:42:29.677: DEBUG/class org.tunesremote.daap.RequestHelper(346): 
started request(remote=http://192.168.139.59:3689/login?pairing-guid=0x1)
01-18 12:42:29.847: DEBUG/class org.tunesremote.daap.ResponseParser(346): 
ResponseParser performParse...
01-18 12:42:29.867: DEBUG/class org.tunesremote.daap.Session(346): found 
session-id=657309469
01-18 12:42:29.867: DEBUG/class org.tunesremote.daap.RequestHelper(346): 
http://192.168.139.59:3689/databases?session-id=657309469
01-18 12:42:29.867: DEBUG/class org.tunesremote.daap.RequestHelper(346): 
started 
request(remote=http://192.168.139.59:3689/databases?session-id=657309469)
01-18 12:42:30.157: DEBUG/class org.tunesremote.daap.ResponseParser(346): 
ResponseParser performParse...
01-18 12:42:30.177: DEBUG/class org.tunesremote.daap.Session(346): found 
database-id=748958677
01-18 12:42:30.177: DEBUG/class org.tunesremote.daap.RequestHelper(346): 
http://192.168.139.59:3689/databases/748958677/containers?session-id=657309469&m
eta=dmap.itemname,dmap.itemcount,dmap.itemid,dmap.persistentid,daap.baseplaylist
,com.apple.itunes.special-playlist,com.apple.itunes.smart-playlist,com.apple.itu
nes.saved-genius,dmap.parentcontainerid,dmap.editcommandssupported
01-18 12:42:30.189: DEBUG/class org.tunesremote.daap.RequestHelper(346): 
started 
request(remote=http://192.168.139.59:3689/databases/748958677/containers?session
-id=657309469&meta=dmap.itemname,dmap.itemcount,dmap.itemid,dmap.persistentid,da
ap.baseplaylist,com.apple.itunes.special-playlist,com.apple.itunes.smart-playlis
t,com.apple.itunes.saved-genius,dmap.parentcontainerid,dmap.editcommandssupporte
d)
01-18 12:42:30.477: DEBUG/class org.tunesremote.daap.ResponseParser(346): 
ResponseParser performParse...
01-18 12:42:30.577: DEBUG/class org.tunesremote.daap.Session(346): found 
playlist=Favorites - 1 Audio CD Worth (74 min)
01-18 12:42:30.577: DEBUG/class org.tunesremote.daap.Session(346): found 
playlist=Favorites - 1 MP3 CD Worth (650 MB)
01-18 12:42:30.587: DEBUG/class org.tunesremote.daap.Session(346): found 
playlist=Favorites - Not Heard Recently (1 hr)
01-18 12:42:30.587: DEBUG/class org.tunesremote.daap.Session(346): found 
playlist=Favorites - Top 50
01-18 12:42:30.587: DEBUG/class org.tunesremote.daap.Session(346): found 
playlist=Last 50 played
01-18 12:42:30.587: DEBUG/class org.tunesremote.daap.Session(346): found 
music-id=99999998
01-18 12:42:30.597: DEBUG/class org.tunesremote.BackendService(346): yay found 
session!  were gonna update our db a new code maybe?
01-18 12:42:30.617: DEBUG/class org.tunesremote.daap.Status(346): Fetching 
Update From Server...
01-18 12:42:30.627: DEBUG/class org.tunesremote.util.ThreadExecutor(346): 
Creating Thread: ThreadExecutor #1
01-18 12:42:30.627: DEBUG/class org.tunesremote.util.ThreadExecutor(346): Task 
count = 0
01-18 12:42:30.637: DEBUG/AndroidRuntime(346): Shutting down VM
01-18 12:42:30.637: DEBUG/class org.tunesremote.daap.Status(346): thread 
entering paused loop
01-18 12:42:30.637: WARN/dalvikvm(346): threadid=1: thread exiting with 
uncaught exception (group=0x4001d800)
01-18 12:42:30.647: ERROR/AndroidRuntime(346): FATAL EXCEPTION: main
01-18 12:42:30.647: ERROR/AndroidRuntime(346): java.lang.NullPointerException
01-18 12:42:30.647: ERROR/AndroidRuntime(346):     at 
org.tunesremote.ControlAppWidget$UpdateService.handleIntent(ControlAppWidget.jav
a:129)
01-18 12:42:30.647: ERROR/AndroidRuntime(346):     at 
org.tunesremote.ControlAppWidget$UpdateService.initWithBackend(ControlAppWidget.
java:81)
01-18 12:42:30.647: ERROR/AndroidRuntime(346):     at 
org.tunesremote.ControlAppWidget$UpdateService.access$1(ControlAppWidget.java:75
)
01-18 12:42:30.647: ERROR/AndroidRuntime(346):     at 
org.tunesremote.ControlAppWidget$UpdateService$1.onServiceConnected(ControlAppWi
dget.java:67)
01-18 12:42:30.647: ERROR/AndroidRuntime(346):     at 
android.app.ActivityThread$PackageInfo$ServiceDispatcher.doConnected(ActivityThr
ead.java:1247)
01-18 12:42:30.647: ERROR/AndroidRuntime(346):     at 
android.app.ActivityThread$PackageInfo$ServiceDispatcher$RunConnection.run(Activ
ityThread.java:1264)
01-18 12:42:30.647: ERROR/AndroidRuntime(346):     at 
android.os.Handler.handleCallback(Handler.java:587)
01-18 12:42:30.647: ERROR/AndroidRuntime(346):     at 
android.os.Handler.dispatchMessage(Handler.java:92)
01-18 12:42:30.647: ERROR/AndroidRuntime(346):     at 
android.os.Looper.loop(Looper.java:123)
01-18 12:42:30.647: ERROR/AndroidRuntime(346):     at 
android.app.ActivityThread.main(ActivityThread.java:4627)
01-18 12:42:30.647: ERROR/AndroidRuntime(346):     at 
java.lang.reflect.Method.invokeNative(Native Method)
01-18 12:42:30.647: ERROR/AndroidRuntime(346):     at 
java.lang.reflect.Method.invoke(Method.java:521)
01-18 12:42:30.647: ERROR/AndroidRuntime(346):     at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
01-18 12:42:30.647: ERROR/AndroidRuntime(346):     at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
01-18 12:42:30.647: ERROR/AndroidRuntime(346):     at 
dalvik.system.NativeStart.main(Native Method)

Original comment by mellowaredev on 18 Jan 2011 at 5:43

GoogleCodeExporter commented 9 years ago
OK I changed it to check for NULL and I have not gotten the exception again.

 private void handleIntent() {
         if (currentIntent == null) {
            return;
         }

Original comment by mellowaredev on 18 Jan 2011 at 6:08

GoogleCodeExporter commented 9 years ago
OK next I tried to remove the widget from my screen by dragging it to the 
trashcan and got this crash...

01-18 14:54:14.487: WARN/dalvikvm(478): threadid=1: thread exiting with 
uncaught exception (group=0x4001d800)
01-18 14:54:14.517: ERROR/AndroidRuntime(478): FATAL EXCEPTION: main
01-18 14:54:14.517: ERROR/AndroidRuntime(478): java.lang.RuntimeException: 
Unable to stop service org.tunesremote.ControlAppWidget$UpdateService@43e6cfe8: 
java.lang.IllegalArgumentException: Service not registered: 
org.tunesremote.ControlAppWidget$UpdateService$1@43e6d2f0
01-18 14:54:14.517: ERROR/AndroidRuntime(478):     at 
android.app.ActivityThread.handleStopService(ActivityThread.java:3090)
01-18 14:54:14.517: ERROR/AndroidRuntime(478):     at 
android.app.ActivityThread.access$3700(ActivityThread.java:125)
01-18 14:54:14.517: ERROR/AndroidRuntime(478):     at 
android.app.ActivityThread$H.handleMessage(ActivityThread.java:2099)
01-18 14:54:14.517: ERROR/AndroidRuntime(478):     at 
android.os.Handler.dispatchMessage(Handler.java:99)
01-18 14:54:14.517: ERROR/AndroidRuntime(478):     at 
android.os.Looper.loop(Looper.java:123)
01-18 14:54:14.517: ERROR/AndroidRuntime(478):     at 
android.app.ActivityThread.main(ActivityThread.java:4627)
01-18 14:54:14.517: ERROR/AndroidRuntime(478):     at 
java.lang.reflect.Method.invokeNative(Native Method)
01-18 14:54:14.517: ERROR/AndroidRuntime(478):     at 
java.lang.reflect.Method.invoke(Method.java:521)
01-18 14:54:14.517: ERROR/AndroidRuntime(478):     at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
01-18 14:54:14.517: ERROR/AndroidRuntime(478):     at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
01-18 14:54:14.517: ERROR/AndroidRuntime(478):     at 
dalvik.system.NativeStart.main(Native Method)
01-18 14:54:14.517: ERROR/AndroidRuntime(478): Caused by: 
java.lang.IllegalArgumentException: Service not registered: 
org.tunesremote.ControlAppWidget$UpdateService$1@43e6d2f0
01-18 14:54:14.517: ERROR/AndroidRuntime(478):     at 
android.app.ActivityThread$PackageInfo.forgetServiceDispatcher(ActivityThread.ja
va:1074)
01-18 14:54:14.517: ERROR/AndroidRuntime(478):     at 
android.app.ContextImpl.unbindService(ContextImpl.java:886)
01-18 14:54:14.517: ERROR/AndroidRuntime(478):     at 
android.content.ContextWrapper.unbindService(ContextWrapper.java:352)
01-18 14:54:14.517: ERROR/AndroidRuntime(478):     at 
org.tunesremote.ControlAppWidget$UpdateService.onDestroy(ControlAppWidget.java:1
34)
01-18 14:54:14.517: ERROR/AndroidRuntime(478):     at 
android.app.ActivityThread.handleStopService(ActivityThread.java:3076)
01-18 14:54:14.517: ERROR/AndroidRuntime(478):     ... 10 more

Original comment by mellowaredev on 18 Jan 2011 at 7:56

GoogleCodeExporter commented 9 years ago
Are you running on the device?

Original comment by pepijn.k...@gmail.com on 18 Jan 2011 at 8:04

GoogleCodeExporter commented 9 years ago
Hmmm, you're right I get crashes on the emulator as well... :( I've been 
testing this on my device, so I guess it is timing related. (emulator slow)

Original comment by pepijn.k...@gmail.com on 18 Jan 2011 at 8:07

GoogleCodeExporter commented 9 years ago
There is a good chance if it crashes in the emulator it will crash on some 
users devices.   

Original comment by mellowaredev on 18 Jan 2011 at 8:34

GoogleCodeExporter commented 9 years ago
sure, it has to be tested well...

Original comment by pepijn.k...@gmail.com on 18 Jan 2011 at 8:35

GoogleCodeExporter commented 9 years ago
Also I am noticing the Thread is infinitely spitting out this message even when 
I have exited the application.

01-18 15:46:59.133: DEBUG/class org.tunesremote.daap.Status(294): thread 
entering paused loop
01-18 15:47:09.139: DEBUG/class org.tunesremote.daap.Status(294): thread 
entering paused loop
01-18 15:47:19.148: DEBUG/class org.tunesremote.daap.Status(294): thread 
entering paused loop
01-18 15:47:29.189: DEBUG/class org.tunesremote.daap.Status(294): thread 
entering paused loop
01-18 15:47:39.224: DEBUG/class org.tunesremote.daap.Status(294): thread 
entering paused loop
01-18 15:47:49.246: DEBUG/class org.tunesremote.daap.Status(294): thread 
entering paused loop
01-18 15:47:59.249: DEBUG/class org.tunesremote.daap.Status(294): thread 
entering paused loop

Aren't we concerned about battery life if there is a thread constantly running 
in the background?

Original comment by mellowaredev on 18 Jan 2011 at 8:49

GoogleCodeExporter commented 9 years ago
What application do you mean? ITUnes?

Original comment by pepijn.k...@gmail.com on 18 Jan 2011 at 9:03

GoogleCodeExporter commented 9 years ago
No after I exit TunesRemote+ in the emulator I keep seeing that log line spit 
out.  So that means the app is still really running in the background.  I don't 
think it did that in the previous version until you added the recent Widget 
stuff.

To reproduce...

1. Run the app in the emulator.

2. Press the Back button to exit TunesREmote+ and leave it on your home screen.

3. Leave it on your home screen and the above log line will repeat over and 
over every 10 seconds infinitely.

Original comment by mellowaredev on 18 Jan 2011 at 9:10

GoogleCodeExporter commented 9 years ago
OK, I will look into this. Its hard to tell when the application "exits" since 
the AppWidget uses the backend service + session + status as well.

Original comment by pepijn.k...@gmail.com on 18 Jan 2011 at 9:12

GoogleCodeExporter commented 9 years ago
Hmmm, those messages are coming from the progress thread. In theory that thread 
is not necessary when only displaying the AppWidget, so I will make that 
progress thread an optional class.

Original comment by pepijn.k...@gmail.com on 18 Jan 2011 at 9:33

GoogleCodeExporter commented 9 years ago
I have backed out this patch and just released a new TunesRemote+ 2.1.0 that 
has the upgraded jMDNS library to 3.4.0 and fixes a potential bug with Pairing 
by leaving the remote name Android Remote instead of uniquely naming it each 
time.

Original comment by mellowaredev on 25 Jan 2011 at 7:58

GoogleCodeExporter commented 9 years ago
Has there been any progress on the widget?

Original comment by theapoap...@gmail.com on 23 Mar 2011 at 5:45

GoogleCodeExporter commented 9 years ago
Hi, I haven't worked on it lately so much. Compared to the previous attempt
I have a quite stable version now. If anybody is interested in
reviewing/working together on this, please let me know.

Original comment by pepijn.k...@gmail.com on 26 Mar 2011 at 2:57

GoogleCodeExporter commented 9 years ago
OK, here's the status... After some tryouts, I've concluded that the appwidget 
is hard/hacky to implement with the current state of the framework. It should 
rely on a more android way of communicating to an App's running processes. 
Also, when using the Status implementation as it is currently done, it would 
drain your battery since of the design of BackendService/Status/Session (it is 
*always on* running some threads; the AppWidget is always on too).

As a matter of fact I did try to refactor some code to make it more suitable 
for the AppWidget extension but ended up in a huge changelist (changing 
Session.java and Status.java); but since that is in the meantime also changed 
by fixes and new features, I had some nasty merging errors and thus decided to 
revert my changes.

It was working on my local Android phone quite OK, but because my patch was 
rejected and now I'm too much diverged from the mainline I think I would pass 
this attempt on to somebody who can put more time in it for refactoring, etc.

-p

Original comment by pepijn.k...@gmail.com on 28 Mar 2011 at 10:10

GoogleCodeExporter commented 9 years ago
I totally understand and agree.  Since the Status object and this codebase is 
the way it is designing any Widget that does not drain the battery would be 
difficult without a complete refactoring/re-design with the widget in mind from 
the start

Original comment by mellowaredev on 28 Mar 2011 at 10:29