konklone / congress-android

Congress for Android, an app for tracking Congress.
https://play.google.com/store/apps/details?id=com.sunlightlabs.android.congress
Other
157 stars 42 forks source link

Support 'add to contacts' for legislator offices #514

Closed konklone closed 12 years ago

konklone commented 12 years ago

http://developer.android.com/resources/articles/contacts.html

konklone commented 12 years ago

Not as easy to support as I thought.

smoak commented 12 years ago

I've done some work on adding contacts with Android. How were you thinking this would work? Perhaps a menu item on the legislators detail page that says "Add to contacts"?

Also, as an aside, I'd love to help out with this but I can't seem to get the project to compile. Should I open a new issue to discuss that?

konklone commented 12 years ago

If you want to add this, that would be a huge help, by all means! I was intimidated by the API for integrating with the contacts ContentProvider.

Maybe the easiest way to do this would be for you to add it as a menu item in res/menus/legislator.xml. I'll want to give it more prominence, and then as I redesign the legislators detail page (whose design I hate) I can work it into it in a nice way.

As for compiling, I mention in the README that you have to copy keys.xml.example to res/values/keys.xml to get it working. This is so that I can have a file of strings with API keys and the like that's gitignore'd out of the repo. I'm open to how I can make this more clear.

smoak commented 12 years ago

For compiling, this is what I am getting:

$ ant debug

YouTubeFragment.java:134: cannot find symbol
[javac] symbol  : class Video
[javac] location: class com.sunlightlabs.android.congress.fragments.YouTubeFragment
[javac]     protected class VideoAdapter extends ArrayAdapter<Video> {
[javac]                                                       ^

As well as many more errors like it. I'm not sure why I'm getting those errors though. I have all the files checked out and everything. Once I get over this small hurdle I'll be able to work on the contact stuff :)

konklone commented 12 years ago

Ooh, I think that's my mistake, I must have not merged the video branch over correctly. I just pushed some additional commits which should hopefully resolve it - let me know if it doesn't.

smoak commented 12 years ago

That mostly worked. I still get the same error as above, but I managed to fix it by moving the import up:

diff --git a/src/com/sunlightlabs/android/congress/fragments/YouTubeFragment.java b/src/com/sunlightlabs/android/congress/fragments/YouTubeFragment.java
index d3425be..4f0f21d 100644
--- a/src/com/sunlightlabs/android/congress/fragments/YouTubeFragment.java
+++ b/src/com/sunlightlabs/android/congress/fragments/YouTubeFragment.java
@@ -21,6 +21,7 @@ import android.widget.ListView;
 import android.widget.TextView;

 import com.sunlightlabs.android.congress.R;
+import com.sunlightlabs.youtube.Video;
 import com.sunlightlabs.android.congress.fragments.YouTubeFragment.VideoAdapter.VideoHolder;
 import com.sunlightlabs.android.congress.notifications.Footer;
 import com.sunlightlabs.android.congress.notifications.Subscriber;
@@ -33,7 +34,6 @@ import com.sunlightlabs.android.congress.utils.FragmentUtils;
 import com.sunlightlabs.android.congress.utils.ImageUtils;
 import com.sunlightlabs.android.congress.utils.Utils;
 import com.sunlightlabs.congress.models.Legislator;
-import com.sunlightlabs.youtube.Video;

 public class YouTubeFragment extends ListFragment implements LoadsThumb, LoadsYoutubeVideos {
        private List<Video> videos;

I think this is due to a bug in the sun java compiler (which I am using) and not the one Eclipse uses:

http://bugs.sun.com/bugdatabase/view_bug.do;jsessionid=75fc24d972c23e4c8c426b8f3?bug_id=6431987

So it's all fixed on my machine now after moving the import statement up. Pretty strange

konklone commented 12 years ago

It's probably because I added a new Video class, for congressional video, in another package in some recent commits, that is separate from the Video class I use for YouTube videos.

smoak commented 12 years ago

One thing I forgot to ask, do we want older devices (android < 2.0) to be able to add them to their contacts?

konklone commented 12 years ago

If this is the feature that means dropping support for 1.6, that's fine with me. I already dropped 1.5 support a while back, and all of 0.27% of the app's usage in the last month came from 1.6.

konklone commented 12 years ago

This inspired me to go tally up the analytics for the app, so, just in case you're curious, I'll post them here. This is as reported in Google Analytics through actual usage - so this is as % of the "visits" for the last 30 days.

1.5 - 0.35% 1.6 - 0.27% 2.1 - 4.38% 2.2 - 17.24% 2.3 - 67.06% 3.x - 5.06% 4.x - 5.57%

This is completely different than what the Android Market shows me in the statistics page for my app. The Market has much higher numbers for older versions of Android, and lower numbers for higher versions. This makes me think the "active installs" number is flawed, and is counting phones that have been abandoned as people have upgraded. Hard to say, but very worth knowing.

smoak commented 12 years ago

That's very interesting. I think you're right about the "active installs" metric.

It's a lot easier to drop support for 1.6 since the new Contacts API is 2.0+ However, it's not a huge deal if you still want to support 1.6