[Android Client] Adding DashClock support - Help needed

Development-related discussion, including bundled plugins
mcbyte
Bear Rating Trainee
Bear Rating Trainee
Posts: 12
Joined: 20 May 2013, 21:01

[Android Client] Adding DashClock support - Help needed

Postby mcbyte » 20 May 2013, 21:15

I Forked the Android client source and started adding to it support for the DashClock app.

Making DashClock extensions is very easy, sample app is here: https://code.google.com/p/dashclock/

And I already made the first part by making the initial code, that displays a static count on the dashclock (check attachment), but how can I get the Unread count of all feeds? I can't seem to find the single location that returns the total count of unread articles.

hope someone can point me to the correct place, so that I can later make a pull request to make this an official feature.
Attachments
screenshot_2013-05-20_19-04-07.jpg
Screenshot
screenshot_2013-05-20_19-04-07.jpg (81.91 KiB) Viewed 3447 times

User avatar
fox
^ me reading your posts ^
Posts: 6318
Joined: 27 Aug 2005, 22:53
Location: Saint-Petersburg, Russia
Contact:

Re: [Android Client] Adding DashClock support - Help needed

Postby fox » 20 May 2013, 21:25

> I can't seem to find the single location that returns the total count of unread articles.

I... oh.

mcbyte
Bear Rating Trainee
Bear Rating Trainee
Posts: 12
Joined: 20 May 2013, 21:01

Re: [Android Client] Adding DashClock support - Help needed

Postby mcbyte » 21 May 2013, 11:14

I checked the most of the classes for methods that seems to do what I want, but found nothing that can be used. There is in the HeadlinesActivity a refresh method, but it is protected.

any help would be appreciated.

here is my DashClock class:

Code: Select all

package org.fox.ttrss;

import java.util.Date;
import android.content.Intent;
import com.google.android.apps.dashclock.api.DashClockExtension;
import com.google.android.apps.dashclock.api.ExtensionData;

public class DashClock extends DashClockExtension {
   @Override
   protected void onInitialize(boolean isReconnect) {
      super.onInitialize(isReconnect);
      setUpdateWhenScreenOn(true);
   }

   @Override
   protected void onUpdateData(int reason) {
      HeadlinesActivity ha = new HeadlinesActivity();
      /*
       * Do something here to get unread count, for now just a static number
       */
      int allUnread = 6;

      ExtensionData updatedData = null; // when null DashClock hides the widget

      if (allUnread > 0) {
         updatedData = new ExtensionData();
         updatedData.visible(true);

         updatedData.icon(R.drawable.icon);
         updatedData.status(String.valueOf(allUnread));

         updatedData.expandedTitle(getString(R.string.app_name));
         updatedData.expandedBody(allUnread + " new unread articles");

         updatedData.clickIntent(new Intent().setClassName("org.fox.ttrss",
               "org.fox.ttrss.OnlineActivity"));
      }
      publishUpdate(updatedData);
   }
}

User avatar
fox
^ me reading your posts ^
Posts: 6318
Joined: 27 Aug 2005, 22:53
Location: Saint-Petersburg, Russia
Contact:

Re: [Android Client] Adding DashClock support - Help needed

Postby fox » 21 May 2013, 14:30

Make an API request, parse the results.

mcbyte
Bear Rating Trainee
Bear Rating Trainee
Posts: 12
Joined: 20 May 2013, 21:01

Re: [Android Client] Adding DashClock support - Help needed

Postby mcbyte » 21 May 2013, 17:35

Ok fox, I checked how API Requests works and it seems I have a working DashClock extension.

I made a commit of my changes to my fork on the github, which can be found here. the code need some cleaning maybe, and also the icons (DashClock takes the icon and make whatever is not transparent to white, and the transparent remains transparent, currently I did a quick and dirty work on the icon to make it OK for dashclock).

Update:
and I just discovered that today you released an update that includes a 1x1 widget, which does exactly what I wanted, but I did mine by myself....
Attachments
Screenshot_2013-05-21-15-25-26.jpg
extended
Screenshot_2013-05-21-15-25-26.jpg (62.03 KiB) Viewed 3221 times
Screenshot_2013-05-21-15-25-18.jpg
Small
Screenshot_2013-05-21-15-25-18.jpg (42.09 KiB) Viewed 3221 times

fobe
Bear Rating Trainee
Bear Rating Trainee
Posts: 9
Joined: 03 Apr 2013, 00:48

Re: [Android Client] Adding DashClock support - Help needed

Postby fobe » 21 May 2013, 18:31

Would you be so kind to post it on this forum, so I can also test/check it?

mcbyte
Bear Rating Trainee
Bear Rating Trainee
Posts: 12
Joined: 20 May 2013, 21:01

Re: [Android Client] Adding DashClock support - Help needed

Postby mcbyte » 22 May 2013, 15:47

For the information, Andrew included this feature in TinyTiny RSS version 1.7.8, already downloadable from the Google Play Store.

Thanks...


Return to “Development”

Who is online

Users browsing this forum: No registered users and 2 guests