├── jars ├── commons-io-1.4.jar ├── guice-2.0-no_aop.jar ├── roboguice-1.1.1.jar ├── MyID3_for_Android.jar ├── jackson-core-asl-1.4.3.jar └── jackson-mapper-asl-1.4.3.jar ├── res ├── drawable-hdpi │ ├── cd.png │ └── icon.png ├── drawable-ldpi │ ├── cd.png │ └── icon.png ├── drawable-mdpi │ ├── cd.png │ └── icon.png ├── menu │ ├── podcastmanager.xml │ └── menu.xml ├── values │ └── strings.xml └── layout │ ├── podcast_list_item.xml │ ├── archiveview.xml │ ├── select_device.xml │ ├── main.xml │ ├── download_progress.xml │ ├── subscribe.xml │ ├── downloadview.xml │ ├── accountsettings.xml │ ├── podcast_manager.xml │ └── playerview.xml ├── .gitignore ├── src └── com │ └── unitedcoders │ ├── android │ └── gpodroid │ │ ├── services │ │ ├── IPlaybackControl.java │ │ ├── PlayerService.java │ │ ├── UpdateService.java │ │ ├── RSSService.java │ │ └── DownloadService.java │ │ ├── PlayPodcastReceiver.java │ │ ├── PlaybackState.java │ │ ├── activity │ │ ├── IncomingCallReceiver.java │ │ ├── DownloadList.java │ │ ├── DownloadProgress.java │ │ ├── AccountSettings.java │ │ ├── Subscribe.java │ │ ├── SelectDevice.java │ │ ├── Player.java │ │ └── PodcastManager.java │ │ ├── Episode.java │ │ ├── database │ │ ├── GpodDBHelper.java │ │ └── GpodDB.java │ │ ├── GpodRoid.java │ │ ├── PodcastElement.java │ │ ├── PodcastListAdapter.java │ │ ├── Preferences.java │ │ ├── RoboActivityDefaultMenu.java │ │ ├── ShowProvider.java │ │ └── tools │ │ └── Tools.java │ └── gpodder │ ├── GpodderUpdates.java │ ├── GpodderSubscriptions.java │ ├── GpodderPodcast.java │ └── GpodderAPI.java ├── default.properties ├── .classpath ├── .project ├── GpodRoid.iml ├── AndroidManifest.xml └── LICENSE.txt /jars/commons-io-1.4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpodder/GpodRoid/HEAD/jars/commons-io-1.4.jar -------------------------------------------------------------------------------- /jars/guice-2.0-no_aop.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpodder/GpodRoid/HEAD/jars/guice-2.0-no_aop.jar -------------------------------------------------------------------------------- /jars/roboguice-1.1.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpodder/GpodRoid/HEAD/jars/roboguice-1.1.1.jar -------------------------------------------------------------------------------- /res/drawable-hdpi/cd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpodder/GpodRoid/HEAD/res/drawable-hdpi/cd.png -------------------------------------------------------------------------------- /res/drawable-ldpi/cd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpodder/GpodRoid/HEAD/res/drawable-ldpi/cd.png -------------------------------------------------------------------------------- /res/drawable-mdpi/cd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpodder/GpodRoid/HEAD/res/drawable-mdpi/cd.png -------------------------------------------------------------------------------- /jars/MyID3_for_Android.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpodder/GpodRoid/HEAD/jars/MyID3_for_Android.jar -------------------------------------------------------------------------------- /res/drawable-hdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpodder/GpodRoid/HEAD/res/drawable-hdpi/icon.png -------------------------------------------------------------------------------- /res/drawable-ldpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpodder/GpodRoid/HEAD/res/drawable-ldpi/icon.png -------------------------------------------------------------------------------- /res/drawable-mdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpodder/GpodRoid/HEAD/res/drawable-mdpi/icon.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | gen 2 | bin 3 | local.properties 4 | .project 5 | .directory 6 | .classpath 7 | out 8 | .idea 9 | -------------------------------------------------------------------------------- /jars/jackson-core-asl-1.4.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpodder/GpodRoid/HEAD/jars/jackson-core-asl-1.4.3.jar -------------------------------------------------------------------------------- /jars/jackson-mapper-asl-1.4.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpodder/GpodRoid/HEAD/jars/jackson-mapper-asl-1.4.3.jar -------------------------------------------------------------------------------- /src/com/unitedcoders/android/gpodroid/services/IPlaybackControl.java: -------------------------------------------------------------------------------- 1 | package com.unitedcoders.android.gpodroid.services; 2 | 3 | public interface IPlaybackControl { 4 | 5 | public void next(); 6 | 7 | } 8 | -------------------------------------------------------------------------------- /src/com/unitedcoders/android/gpodroid/PlayPodcastReceiver.java: -------------------------------------------------------------------------------- 1 | package com.unitedcoders.android.gpodroid; 2 | 3 | import android.content.BroadcastReceiver; 4 | import android.content.Context; 5 | import android.content.Intent; 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/com/unitedcoders/android/gpodroid/PlaybackState.java: -------------------------------------------------------------------------------- 1 | package com.unitedcoders.android.gpodroid; 2 | 3 | public class PlaybackState { 4 | 5 | public void saveState(){ 6 | 7 | } 8 | 9 | public void getState(){ 10 | 11 | } 12 | 13 | 14 | } 15 | -------------------------------------------------------------------------------- /default.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system use, 7 | # "build.properties", and override values to adapt the script to your 8 | # project structure. 9 | 10 | # Project target. 11 | target=android-10 12 | -------------------------------------------------------------------------------- /res/menu/podcastmanager.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Hello World, GpodRoid! 4 | GpodRoid 5 | 6 | %2$d:%5$02d 7 | 8 | 9 | %1$d:%3$02d:%5$02d 10 | 11 | 12 | -------------------------------------------------------------------------------- /res/layout/podcast_list_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 12 | 13 | -------------------------------------------------------------------------------- /res/layout/archiveview.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /res/layout/select_device.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 9 | 10 | 23 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /GpodRoid.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /src/com/unitedcoders/android/gpodroid/PodcastElement.java: -------------------------------------------------------------------------------- 1 | //package com.unitedcoders.android.gpodroid; 2 | // 3 | //import java.io.File; 4 | // 5 | // 6 | //public class PodcastElement implements Comparable { 7 | // 8 | // private String title = ""; 9 | // private String downloadUrl; 10 | // private String album; 11 | // private String file; 12 | // private int seekPosition = 0; 13 | // 14 | // 15 | // public PodcastElement(String title, String downloadUrl) { 16 | // this.title = title; 17 | // this.downloadUrl = downloadUrl; 18 | // 19 | // } 20 | // 21 | // public PodcastElement(File file) { 22 | // 23 | // } 24 | // 25 | // public int getSeekPosition() { 26 | // return seekPosition; 27 | // } 28 | // 29 | // public void setSeekPosition(int seekPosition) { 30 | // this.seekPosition = seekPosition; 31 | // } 32 | // 33 | // public String getFile() { 34 | // return file; 35 | // } 36 | // 37 | // public void setFile(String file) { 38 | // this.file = file; 39 | // } 40 | // 41 | // public String getAlbum() { 42 | // return album; 43 | // } 44 | // 45 | // public void setAlbum(String album) { 46 | // this.album = album; 47 | // } 48 | // 49 | // private boolean checked = false; 50 | // 51 | // public String getDownloadurl() { 52 | // return downloadUrl; 53 | // } 54 | // 55 | // public void setDownloadurl(String downloadurl) { 56 | // this.downloadUrl = downloadurl; 57 | // 58 | // } 59 | // 60 | // 61 | // @Override 62 | // public int compareTo(PodcastElement another) { 63 | // // TODO Auto-generated method stub 64 | // return 0; 65 | // } 66 | // 67 | // public String getTitle() { 68 | // return title; 69 | // } 70 | // 71 | // public void setTitle(String title) { 72 | // this.title = title; 73 | // } 74 | // 75 | // public boolean isChecked() { 76 | // return checked; 77 | // } 78 | // 79 | // public void setChecked(boolean checked) { 80 | // this.checked = checked; 81 | // } 82 | // 83 | //} 84 | -------------------------------------------------------------------------------- /src/com/unitedcoders/gpodder/GpodderSubscriptions.java: -------------------------------------------------------------------------------- 1 | package com.unitedcoders.gpodder; 2 | 3 | public class GpodderSubscriptions { 4 | 5 | private String title; 6 | private String url; 7 | private String description; 8 | private String subscribers; 9 | private String subscribers_last_week; 10 | private String logo_url; 11 | private String website; 12 | private String mygpo_link; 13 | private String scaled_logo_url; 14 | 15 | public String getTitle() { 16 | return title; 17 | } 18 | public void setTitle(String title) { 19 | this.title = title; 20 | } 21 | public String getUrl() { 22 | return url; 23 | } 24 | public void setUrl(String url) { 25 | this.url = url; 26 | } 27 | public String getDescription() { 28 | return description; 29 | } 30 | public void setDescription(String description) { 31 | this.description = description; 32 | } 33 | public String getSubscribers() { 34 | return subscribers; 35 | } 36 | public void setSubscribers(String subscribers) { 37 | this.subscribers = subscribers; 38 | } 39 | public String getSubscribers_last_week() { 40 | return subscribers_last_week; 41 | } 42 | public void setSubscribers_last_week(String subscribers_last_week) { 43 | this.subscribers_last_week = subscribers_last_week; 44 | } 45 | public String getLogo_url() { 46 | return logo_url; 47 | } 48 | public void setLogo_url(String logoUrl) { 49 | logo_url = logoUrl; 50 | } 51 | public String getScaled_logo_url(){ 52 | return scaled_logo_url; 53 | } 54 | public void setScaled_logo_url(String scaledLogoUrl){ 55 | scaled_logo_url = scaledLogoUrl; 56 | } 57 | public String getWebsite() { 58 | return website; 59 | } 60 | public void setWebsite(String website) { 61 | this.website = website; 62 | } 63 | public String getMygpo_link() { 64 | return mygpo_link; 65 | } 66 | public void setMygpo_link(String mygpoLink) { 67 | mygpo_link = mygpoLink; 68 | } 69 | } -------------------------------------------------------------------------------- /src/com/unitedcoders/android/gpodroid/PodcastListAdapter.java: -------------------------------------------------------------------------------- 1 | package com.unitedcoders.android.gpodroid; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import android.content.Context; 7 | import android.graphics.Color; 8 | import android.view.LayoutInflater; 9 | import android.view.View; 10 | import android.view.ViewGroup; 11 | import android.widget.BaseAdapter; 12 | import android.widget.TextView; 13 | import com.unitedcoders.gpodder.GpodderPodcast; 14 | 15 | public class PodcastListAdapter extends BaseAdapter { 16 | 17 | private List episodes; 18 | private Context context; 19 | 20 | // public PodcastListAdapter(Context context) { 21 | // this.context = context; 22 | // } 23 | 24 | public PodcastListAdapter(Context context, List episodes) { 25 | this.context = context; 26 | this.episodes = episodes; 27 | } 28 | 29 | @Override 30 | public int getCount() { 31 | return episodes.size(); 32 | } 33 | 34 | @Override 35 | public Object getItem(int i) { 36 | return episodes.get(i); 37 | } 38 | 39 | @Override 40 | public long getItemId(int arg0) { 41 | return 0; 42 | } 43 | 44 | public void addItem(Episode episode) { 45 | episodes.add(episode); 46 | } 47 | 48 | @Override 49 | public View getView(int position, View convertView, ViewGroup parent) { 50 | 51 | Episode episode = episodes.get(position); 52 | if (convertView == null) { 53 | LayoutInflater inflater = (LayoutInflater) context 54 | .getSystemService(Context.LAYOUT_INFLATER_SERVICE); 55 | convertView = inflater.inflate(R.layout.podcast_list_item, null); 56 | } 57 | 58 | TextView tvEpisode = (TextView) convertView.findViewById(R.id.tv_podcastitem); 59 | tvEpisode.setText(episode.getTitle()); 60 | if (episode.getDownloaded() == 0) { 61 | tvEpisode.setTextColor(Color.RED); 62 | } else { 63 | tvEpisode.setTextColor(Color.GREEN); 64 | } 65 | 66 | 67 | return convertView; 68 | 69 | } 70 | 71 | 72 | } 73 | -------------------------------------------------------------------------------- /src/com/unitedcoders/gpodder/GpodderPodcast.java: -------------------------------------------------------------------------------- 1 | package com.unitedcoders.gpodder; 2 | 3 | public class GpodderPodcast { 4 | 5 | private int id; 6 | private String title; 7 | private String podcast_url; 8 | private String podcast_title; 9 | private String description; 10 | private String website; 11 | private String mygpo_link; 12 | private String released; 13 | private String status; 14 | private String url; 15 | private boolean checked = false; 16 | 17 | public boolean isChecked() { 18 | return checked; 19 | } 20 | 21 | public void setChecked(boolean checked) { 22 | this.checked = checked; 23 | } 24 | 25 | public int getId() { 26 | return id; 27 | } 28 | 29 | public void setId(int id) { 30 | this.id = id; 31 | } 32 | 33 | public String getUrl() { 34 | return url; 35 | } 36 | 37 | public void setUrl(String url) { 38 | this.url = url; 39 | } 40 | 41 | public String getTitle() { 42 | return title; 43 | } 44 | 45 | public void setTitle(String title) { 46 | this.title = title; 47 | } 48 | 49 | public String getPodcast_url() { 50 | return podcast_url; 51 | } 52 | 53 | public void setPodcast_url(String podcastUrl) { 54 | podcast_url = podcastUrl; 55 | } 56 | 57 | public String getPodcast_title() { 58 | return podcast_title; 59 | } 60 | 61 | public void setPodcast_title(String podcastTitle) { 62 | podcast_title = podcastTitle; 63 | } 64 | 65 | public String getDescription() { 66 | return description; 67 | } 68 | 69 | public void setDescription(String description) { 70 | this.description = description; 71 | } 72 | 73 | public String getWebsite() { 74 | return website; 75 | } 76 | 77 | public void setWebsite(String website) { 78 | this.website = website; 79 | } 80 | 81 | public String getMygpo_link() { 82 | return mygpo_link; 83 | } 84 | 85 | public void setMygpo_link(String mygpoLink) { 86 | mygpo_link = mygpoLink; 87 | } 88 | 89 | public String getReleased() { 90 | return released; 91 | } 92 | 93 | public void setReleased(String released) { 94 | this.released = released; 95 | } 96 | 97 | public String getStatus() { 98 | return status; 99 | } 100 | 101 | public void setStatus(String status) { 102 | this.status = status; 103 | } 104 | 105 | } 106 | -------------------------------------------------------------------------------- /src/com/unitedcoders/android/gpodroid/Preferences.java: -------------------------------------------------------------------------------- 1 | package com.unitedcoders.android.gpodroid; 2 | 3 | import android.content.SharedPreferences; 4 | 5 | /** 6 | * Saves and loads the user preferences 7 | * @author Nico Heid 8 | * 9 | */ 10 | public class Preferences { 11 | 12 | private final static String USERNAME_COL = "USERNAME"; 13 | private final static String ENCRYPTED_AUTHENTICATION_COL = "ENCRYPTED_AUTHENTICATION"; 14 | private final static String DEVICE_COL = "DEVICE"; 15 | 16 | private static final String PREFS_NAME = "gpodroidPrefs"; 17 | private static String username = ""; 18 | private static String encryptedAuthentication = ""; 19 | private static String device = ""; 20 | 21 | public Preferences() { 22 | super(); //To change body of overridden methods use File | Settings | File Templates. 23 | } 24 | 25 | public static String getUsername() { 26 | return username; 27 | } 28 | 29 | public static void setUsernameAndPassword(String username, String password) { 30 | Preferences.username = username; 31 | String auth = Preferences.getUsername() + ":" + password; 32 | encryptedAuthentication = Base64.encodeBytes(auth.getBytes()); 33 | } 34 | 35 | public static void setNewPassword(String password) { 36 | setUsernameAndPassword(username, password); 37 | } 38 | 39 | public static String getDevice() { 40 | return device; 41 | } 42 | 43 | public static void setDevice(String device) { 44 | Preferences.device = device; 45 | } 46 | 47 | public static Boolean hasAuthentication(){ 48 | return Preferences.encryptedAuthentication.equals(""); 49 | } 50 | 51 | public static String getEncryptedAuthentication(){ 52 | return encryptedAuthentication; 53 | } 54 | 55 | public static void save() { 56 | SharedPreferences settings = GpodRoid.context.getSharedPreferences(PREFS_NAME, 0); 57 | SharedPreferences.Editor editor = settings.edit(); 58 | 59 | editor.putString(USERNAME_COL, username); 60 | editor.putString(ENCRYPTED_AUTHENTICATION_COL, encryptedAuthentication); 61 | editor.putString(DEVICE_COL, device); 62 | 63 | editor.commit(); 64 | } 65 | 66 | public static void initPreferences() { 67 | SharedPreferences settings = GpodRoid.context.getSharedPreferences(PREFS_NAME, 0); 68 | 69 | username = settings.getString(USERNAME_COL, ""); 70 | encryptedAuthentication = settings.getString(ENCRYPTED_AUTHENTICATION_COL, ""); 71 | device = settings.getString(DEVICE_COL, ""); 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /src/com/unitedcoders/android/gpodroid/services/PlayerService.java: -------------------------------------------------------------------------------- 1 | package com.unitedcoders.android.gpodroid.services; 2 | 3 | import java.io.IOException; 4 | 5 | import android.app.Service; 6 | import android.content.Intent; 7 | import android.media.MediaPlayer; 8 | import android.os.Binder; 9 | import android.os.IBinder; 10 | import android.widget.Toast; 11 | 12 | /** 13 | * Service for Playing the podcasts Is a singleton 14 | * 15 | * @author Nico Heid 16 | * 17 | */ 18 | public class PlayerService extends Service { 19 | 20 | private static MediaPlayer player; 21 | private PlayerServiceBinder playerServiceBinder = new PlayerServiceBinder(); 22 | 23 | public class PlayerServiceBinder extends Binder { 24 | PlayerService getService() { 25 | return PlayerService.this; 26 | } 27 | 28 | } 29 | 30 | @Override 31 | public IBinder onBind(Intent intent) { 32 | return playerServiceBinder; 33 | } 34 | 35 | @Override 36 | public void onCreate() { 37 | super.onCreate(); 38 | if (player == null) { 39 | player = new MediaPlayer(); 40 | Toast.makeText(this, "player created", Toast.LENGTH_LONG).show(); 41 | } 42 | 43 | 44 | } 45 | 46 | @Override 47 | public void onDestroy() { 48 | player.stop(); 49 | 50 | Toast.makeText(this, "player stopped", Toast.LENGTH_LONG).show(); 51 | super.onDestroy(); 52 | } 53 | 54 | @Override 55 | public void onStart(Intent intent, int startId) { 56 | super.onStart(intent, startId); 57 | Toast.makeText(this, "player started", Toast.LENGTH_LONG).show(); 58 | 59 | nextPodcast(); 60 | 61 | } 62 | 63 | public void nextPodcast() { 64 | // PodcastElement pce = GpodRoid.getNextPlayback(); 65 | // File podcastFile = new File(pce.getFile()); 66 | 67 | try { 68 | player.reset(); 69 | // player.setDataSource(podcastFile.getAbsolutePath()); 70 | player.prepare(); 71 | player.start(); 72 | } catch (IllegalArgumentException e) { 73 | e.printStackTrace(); 74 | } catch (IllegalStateException e) { 75 | e.printStackTrace(); 76 | } catch (IOException e) { 77 | e.printStackTrace(); 78 | } 79 | 80 | // Intent intent = new Intent(this, com.unitedcoders.android.gpodroid.activity.Player.PlayPodcastReceiver.class); 81 | // intent.putExtra("title", "helloworld"); 82 | // sendBroadcast(intent); 83 | } 84 | 85 | } 86 | -------------------------------------------------------------------------------- /src/com/unitedcoders/android/gpodroid/activity/DownloadList.java: -------------------------------------------------------------------------------- 1 | //package com.unitedcoders.android.gpodroid.activity; 2 | // 3 | //import java.util.List; 4 | // 5 | //import android.app.ListActivity; 6 | //import android.content.Intent; 7 | //import android.os.Bundle; 8 | //import android.view.View; 9 | //import android.view.View.OnClickListener; 10 | //import android.widget.Button; 11 | //import android.widget.Toast; 12 | // 13 | //import com.unitedcoders.android.gpodroid.GpodRoid; 14 | //import com.unitedcoders.android.gpodroid.PodcastListAdapter; 15 | //import com.unitedcoders.android.gpodroid.Preferences; 16 | //import com.unitedcoders.android.gpodroid.R; 17 | //import com.unitedcoders.android.gpodroid.services.DownloadService; 18 | //import com.unitedcoders.gpodder.GpodderAPI; 19 | //import com.unitedcoders.gpodder.GpodderUpdates; 20 | // 21 | ///** 22 | // * Shows a list of available downloads 23 | // * 24 | // * @author Nico Heid 25 | // */ 26 | //public class DownloadList extends ListActivity { 27 | // 28 | // @Override 29 | // protected void onCreate(Bundle savedInstanceState) { 30 | // // TODO Auto-generated method stub 31 | // super.onCreate(savedInstanceState); 32 | // setContentView(R.layout.downloadview); 33 | // 34 | // final PodcastListAdapter pcla = new PodcastListAdapter(this); 35 | // pcla.setShowCheckbox(true); 36 | // 37 | // // get preferences 38 | // Preferences pref = GpodRoid.prefs; 39 | // if (pref.getUsername().equals("") || pref.getPassword().equals("") || pref.getDevice().equals("")) { 40 | // 41 | // Toast toast = Toast.makeText(getApplicationContext(), "please enter your settings first", 42 | // Toast.LENGTH_SHORT); 43 | // toast.show(); 44 | // 45 | // return; 46 | // 47 | // } 48 | // 49 | // GpodderUpdates podcast = GpodderAPI.getDownloadList(); 50 | // 51 | // // add items to download list 52 | // for (int i = 0; i < podcast.getUpdates().size(); i++) { 53 | //// pcla.addItem(new PodcastElement(podcast.getUpdates().get(i).getTitle(), podcast.getUpdates().get(i) 54 | //// .getUrl())); 55 | // } 56 | // 57 | // setListAdapter(pcla); 58 | // 59 | // Button downloadButton = (Button) findViewById(R.id.downloadButton); 60 | // final Intent intent = new Intent(this, DownloadService.class); 61 | // downloadButton.setOnClickListener(new OnClickListener() { 62 | // 63 | // @Override 64 | // public void onClick(View v) { 65 | // 66 | // String download = null; 67 | // 68 | //// List checkedItems = pcla.getCheckedItems(); 69 | //// for (PodcastElement pce : checkedItems) { 70 | //// GpodRoid.addDownloadQueue(pce); 71 | //// } 72 | // 73 | // intent.putExtra("podcast", download); 74 | // startService(intent); 75 | // 76 | // } 77 | // }); 78 | // } 79 | // 80 | //} 81 | -------------------------------------------------------------------------------- /src/com/unitedcoders/android/gpodroid/activity/DownloadProgress.java: -------------------------------------------------------------------------------- 1 | package com.unitedcoders.android.gpodroid.activity; 2 | 3 | import com.unitedcoders.android.gpodroid.GpodRoid; 4 | import com.unitedcoders.android.gpodroid.R; 5 | 6 | import android.app.Activity; 7 | import android.app.Notification; 8 | import android.app.NotificationManager; 9 | import android.app.PendingIntent; 10 | import android.content.Context; 11 | import android.content.Intent; 12 | import android.os.Bundle; 13 | import android.widget.ProgressBar; 14 | import android.widget.RemoteViews; 15 | 16 | /** 17 | * Download of podcasts with ProgressBar 18 | * @author Nico Heid 19 | * 20 | */ 21 | public class DownloadProgress extends Activity { 22 | 23 | ProgressBar progressBar; 24 | private int progress = 10; 25 | 26 | @Override 27 | protected void onCreate(Bundle savedInstanceState) { 28 | // TODO Auto-generated method stub 29 | super.onCreate(savedInstanceState); 30 | // setContentView(R.layout.download_progress); 31 | 32 | final Notification notification = new Notification(R.drawable.icon, "downloading podcast", System.currentTimeMillis()); 33 | notification.flags = notification.flags | Notification.FLAG_ONGOING_EVENT; 34 | notification.contentView = new RemoteViews(getApplicationContext().getPackageName(), R.layout.download_progress); 35 | 36 | Intent intent = new Intent(this, DownloadProgress.class); 37 | final PendingIntent pendingIntent = PendingIntent.getActivity(getApplicationContext(), 0, intent, 0); 38 | 39 | notification.contentIntent = pendingIntent; 40 | 41 | notification.contentView.setImageViewResource(R.id.status_icon, android.R.drawable.ic_menu_save); 42 | notification.contentView.setTextViewText(R.id.status_text, "downloading podcast"); 43 | 44 | notification.contentView.setProgressBar(R.id.status_progress, 100, progress, false); 45 | 46 | 47 | final NotificationManager notificationManager = (NotificationManager) getApplicationContext().getSystemService( 48 | Context.NOTIFICATION_SERVICE); 49 | 50 | notificationManager.notify(42, notification); 51 | 52 | Thread download = new Thread() { 53 | 54 | @Override 55 | public void run() { 56 | // TODO Auto-generated method stub 57 | 58 | for (int i = 1; i < 100; i++) { 59 | progress++; 60 | notification.contentView.setProgressBar(R.id.status_progress, 100, progress, false); 61 | notificationManager.notify(42, notification); 62 | try { 63 | Thread.sleep(100); 64 | } catch (InterruptedException e) { 65 | // TODO Auto-generated catch block 66 | e.printStackTrace(); 67 | } 68 | } 69 | 70 | notificationManager.cancel(42); 71 | 72 | } 73 | }; 74 | 75 | download.run(); 76 | // 77 | 78 | } 79 | 80 | } -------------------------------------------------------------------------------- /src/com/unitedcoders/android/gpodroid/RoboActivityDefaultMenu.java: -------------------------------------------------------------------------------- 1 | package com.unitedcoders.android.gpodroid; 2 | 3 | import android.content.Intent; 4 | import android.content.pm.PackageManager; 5 | import android.os.Build; 6 | import android.util.Log; 7 | import android.view.Menu; 8 | import android.view.MenuInflater; 9 | import android.view.MenuItem; 10 | import com.unitedcoders.android.gpodroid.activity.AccountSettings; 11 | import com.unitedcoders.android.gpodroid.services.UpdateService; 12 | import roboguice.activity.RoboActivity; 13 | 14 | /** 15 | * Activity with default menu 16 | * 17 | * @author nheid 18 | */ 19 | public class RoboActivityDefaultMenu extends RoboActivity { 20 | 21 | public boolean onCreateOptionsMenu(Menu menu) { 22 | MenuInflater inflater = getMenuInflater(); 23 | inflater.inflate(R.menu.menu, menu); 24 | return true; 25 | } 26 | 27 | @Override 28 | public boolean onOptionsItemSelected(MenuItem item) { 29 | // Handle item selection 30 | switch (item.getItemId()) { 31 | case R.id.account: 32 | Intent account = new Intent(getApplicationContext(), AccountSettings.class); 33 | startActivity(account); 34 | return true; 35 | // case R.id.subscriptions: 36 | // Intent subscriptions = new Intent(getApplicationContext(), Subscribe.class); 37 | // startActivity(subscriptions); 38 | // return true; 39 | case R.id.fetch_updates: 40 | startService(new Intent(getApplicationContext(), UpdateService.class)); 41 | return true; 42 | case R.id.send_feedback: 43 | sendFeedback(); 44 | return true; 45 | default: 46 | return super.onOptionsItemSelected(item); 47 | } 48 | } 49 | 50 | 51 | /** 52 | * Start intend to send a feedback email via installed mail application 53 | */ 54 | private void sendFeedback() { 55 | String version = null; 56 | 57 | try { 58 | version = getPackageManager().getPackageInfo(getPackageName(), 0).versionName; 59 | } catch (PackageManager.NameNotFoundException e) { 60 | Log.e(GpodRoid.LOGTAG, "could not determin version", e); 61 | } 62 | 63 | String message = String.format("\n\n--DEVELOPER INFO -- \nthis feedback is from version: %s on device: %s with android: %s", 64 | version , Build.MODEL, Build.VERSION.RELEASE); 65 | 66 | 67 | /* Create the Intent */ 68 | final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); 69 | 70 | /* Fill it with Data */ 71 | emailIntent.setType("plain/text"); 72 | emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{"gpodroid@united-coders.com"}); 73 | emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "feedback from GPodRoid"); 74 | emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, message); 75 | 76 | /* Send it off to the Activity-Chooser */ 77 | GpodRoid.context.startActivity(Intent.createChooser(emailIntent, "Send mail...") 78 | .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /res/layout/podcast_manager.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 10 | 12 | 13 | 14 | 16 | 17 | 19 | 21 | 26 | 27 | 28 | 29 | 30 | 31 | 34 | 36 | 37 | 38 | 39 | 43 | 44 | 47 | 50 | 51 | 52 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /src/com/unitedcoders/android/gpodroid/activity/AccountSettings.java: -------------------------------------------------------------------------------- 1 | package com.unitedcoders.android.gpodroid.activity; 2 | 3 | import android.app.Activity; 4 | import android.content.Intent; 5 | import android.net.Uri; 6 | import android.os.Bundle; 7 | import android.view.View; 8 | import android.view.View.OnClickListener; 9 | import android.view.View.OnKeyListener; 10 | import android.view.KeyEvent; 11 | import android.widget.Button; 12 | import android.widget.EditText; 13 | import android.widget.Toast; 14 | import com.unitedcoders.android.gpodroid.GpodRoid; 15 | import com.unitedcoders.android.gpodroid.Preferences; 16 | import com.unitedcoders.android.gpodroid.R; 17 | import com.unitedcoders.android.gpodroid.R.layout; 18 | import com.unitedcoders.gpodder.GpodderAPI; 19 | 20 | /** 21 | * This class will present the user with an interface to enter their username and password and then login 22 | * or register a new user name and password 23 | * 24 | * @author Brian Bourke-Martin 25 | */ 26 | public class AccountSettings extends Activity { 27 | 28 | @Override 29 | protected void onCreate(Bundle savedInstanceState) { 30 | super.onCreate(savedInstanceState); 31 | 32 | setContentView(layout.accountsettings); 33 | final EditText etUsername = (EditText) findViewById(R.id.in_username); 34 | final EditText etPassword = (EditText) findViewById(R.id.in_password); 35 | final Button save = (Button) findViewById(R.id.btn_save); 36 | final Button register = (Button) findViewById(R.id.btn_register); 37 | 38 | etUsername.setText(Preferences.getUsername()); 39 | etPassword.setText(""); 40 | 41 | etUsername.setOnKeyListener(new OnKeyListener() { 42 | public boolean onKey(View v, int keyCode, KeyEvent event) { 43 | switch(keyCode){ 44 | case KeyEvent.KEYCODE_ENTER: 45 | case KeyEvent.KEYCODE_TAB: 46 | etPassword.requestFocus(); 47 | return true; 48 | default: 49 | return false; 50 | } 51 | } 52 | }); 53 | 54 | save.setOnClickListener(new OnClickListener() { 55 | @Override 56 | public void onClick(View v) { 57 | Preferences.setUsernameAndPassword(etUsername.getText().toString(), etPassword.getText().toString()); 58 | Preferences.save(); 59 | 60 | // check to see if the user name and password function to get a list of devices as an check 61 | SelectDevice.devices = GpodderAPI.getDevices(); 62 | if(SelectDevice.devices == null){ 63 | // this is a failure to login using this user name and password so lets reset and continue 64 | Toast.makeText(GpodRoid.context, "Could not authenticate this username and password.", Toast.LENGTH_SHORT).show(); 65 | } 66 | else{ 67 | startActivity(new Intent(GpodRoid.context, SelectDevice.class)); 68 | finish(); 69 | } 70 | } 71 | }); 72 | 73 | register.setOnClickListener(new OnClickListener() { 74 | @Override 75 | public void onClick(View view) { 76 | Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("http://gpodder.net/register/")); 77 | startActivity(i); 78 | } 79 | }); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /src/com/unitedcoders/android/gpodroid/services/UpdateService.java: -------------------------------------------------------------------------------- 1 | package com.unitedcoders.android.gpodroid.services; 2 | 3 | import android.app.Service; 4 | import android.content.Intent; 5 | import android.os.Handler; 6 | import android.os.IBinder; 7 | import android.os.Looper; 8 | import android.util.Log; 9 | import android.widget.Toast; 10 | import com.unitedcoders.android.gpodroid.GpodRoid; 11 | import com.unitedcoders.android.gpodroid.Preferences; 12 | import com.unitedcoders.android.gpodroid.activity.AccountSettings; 13 | import com.unitedcoders.android.gpodroid.database.GpodDB; 14 | import com.unitedcoders.gpodder.GpodderAPI; 15 | import com.unitedcoders.gpodder.GpodderPodcast; 16 | import com.unitedcoders.gpodder.GpodderUpdates; 17 | 18 | import java.util.List; 19 | 20 | /** 21 | * Get updates from gpodder 22 | */ 23 | public class UpdateService extends Service { 24 | 25 | private Handler handler = new Handler(); 26 | 27 | private Thread downloadUpdatesThread = null; 28 | 29 | @Override 30 | public IBinder onBind(Intent intent) { 31 | return null; //To change body of implemented methods use File | Settings | File Templates. 32 | } 33 | 34 | @Override 35 | public void onStart(Intent intent, int startId) { 36 | super.onStart(intent, startId); 37 | downloadProcessing(); 38 | } 39 | 40 | public synchronized void downloadProcessing() { 41 | if (Preferences.getUsername().equals("") || Preferences.hasAuthentication() || Preferences.getDevice().equals("")) { 42 | 43 | Toast.makeText(getApplicationContext(), "please enter your settings first", Toast.LENGTH_SHORT).show(); 44 | 45 | Intent intent = new Intent(getApplicationContext(), AccountSettings.class); 46 | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 47 | 48 | startActivity(intent); 49 | 50 | return; 51 | 52 | } 53 | 54 | if(downloadUpdatesThread == null){ 55 | downloadUpdatesThread = new Thread(null, doGetPodcastDownloadInfo, "Background"); 56 | downloadUpdatesThread.start(); 57 | } 58 | } 59 | 60 | private Runnable doUpdateDownloadList = new Runnable() { 61 | public void run() { 62 | 63 | } 64 | }; 65 | 66 | private Runnable doGetPodcastDownloadInfo = new Runnable() { 67 | public void run() { 68 | Looper.prepare(); 69 | backgroundPodcastInfoFetcher(); 70 | Looper.loop(); 71 | 72 | // now that the fetching is done, reset the download thread reference 73 | downloadUpdatesThread = null; 74 | } 75 | }; 76 | 77 | private void backgroundPodcastInfoFetcher() { 78 | Log.d(GpodRoid.LOGTAG, "Starting background thread to get info."); 79 | GpodderUpdates podcast = GpodderAPI.getDownloadList(); 80 | Log.d(GpodRoid.LOGTAG, "Got podcast updates."); 81 | 82 | if (podcast == null) { 83 | Toast.makeText(GpodRoid.context, "Failed to fetch updates", Toast.LENGTH_LONG); 84 | Log.e(GpodRoid.LOGTAG, "cant display downloads, got empty result"); 85 | return; 86 | } 87 | 88 | List pcl = podcast.getUpdates(); 89 | if(pcl != null && pcl.size()>0){ 90 | GpodDB.addPodcasts(pcl); 91 | } 92 | 93 | handler.post(doUpdateDownloadList); 94 | 95 | // notify views of new content 96 | Log.d(GpodRoid.LOGTAG, "UpdateService broadcasting changes"); 97 | Intent subscriptionChanged = new Intent(); 98 | subscriptionChanged.setAction(GpodRoid.BROADCAST_SUBSCRIPTION_CHANGE); 99 | sendBroadcast(subscriptionChanged); 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /src/com/unitedcoders/android/gpodroid/ShowProvider.java: -------------------------------------------------------------------------------- 1 | package com.unitedcoders.android.gpodroid; 2 | 3 | import android.content.ContentProvider; 4 | import android.content.ContentUris; 5 | import android.content.ContentValues; 6 | import android.content.Context; 7 | import android.database.Cursor; 8 | import android.database.sqlite.SQLiteDatabase; 9 | import android.database.sqlite.SQLiteOpenHelper; 10 | import android.net.Uri; 11 | import android.os.ParcelFileDescriptor; 12 | import com.unitedcoders.android.gpodroid.database.GpodDB; 13 | import com.unitedcoders.android.gpodroid.database.GpodDBHelper; 14 | 15 | import java.io.File; 16 | import java.io.FileNotFoundException; 17 | 18 | /** 19 | * Created by IntelliJ IDEA. 20 | * User: nheid 21 | * Date: 3/5/11 22 | * Time: 10:55 AM 23 | * To change this template use File | Settings | File Templates. 24 | */ 25 | public class ShowProvider extends ContentProvider { 26 | 27 | private GpodDBHelper dbHelper; 28 | SQLiteDatabase db3; 29 | 30 | public static final String PROVIDER = "com.unitedcoders.android.gpodroid.Provider"; 31 | 32 | @Override 33 | public boolean onCreate() { 34 | 35 | Context c = getContext(); 36 | dbHelper = new GpodDBHelper(c); 37 | db3 = dbHelper.getWritableDatabase(); 38 | 39 | return true; 40 | } 41 | 42 | @Override 43 | public Cursor query(Uri uri, String[] projection, String selection, 44 | String[] selectionArgs, String sortOrder) { 45 | 46 | 47 | SQLiteDatabase db = dbHelper.getReadableDatabase(); 48 | Cursor c = db.query(GpodDB.DATABASE_TABLE, projection, selection, selectionArgs, null, null, sortOrder); 49 | c.setNotificationUri(getContext().getContentResolver(), uri); 50 | return c; 51 | } 52 | 53 | @Override 54 | public ParcelFileDescriptor openFile(Uri uri, String mode) throws FileNotFoundException { 55 | 56 | SQLiteDatabase db = dbHelper.getReadableDatabase(); 57 | 58 | Cursor c = db.query(GpodDB.DATABASE_TABLE, new String[]{"file"}, 59 | "_id=?", new String[]{"281"}, null, null, null); 60 | 61 | c.moveToFirst(); 62 | 63 | 64 | String filePath = c.getString(0); 65 | File file = new File(filePath); 66 | int imode = 0; 67 | if (mode.contains("r")) imode |= ParcelFileDescriptor.MODE_READ_ONLY; 68 | if (mode.contains("+")) imode |= ParcelFileDescriptor.MODE_APPEND; 69 | 70 | return ParcelFileDescriptor.open(file, imode); 71 | 72 | } 73 | 74 | @Override 75 | public String getType(Uri uri) { 76 | return null; //To change body of implemented methods use File | Settings | File Templates. 77 | } 78 | 79 | 80 | @Override 81 | public Uri insert(Uri uri, ContentValues contentValues) { 82 | SQLiteDatabase db = null; 83 | try { 84 | db = dbHelper.getWritableDatabase(); 85 | } catch (Exception e) { 86 | e.printStackTrace(); 87 | } 88 | 89 | long rowId = db.insert(GpodDB.DATABASE_TABLE, "show", contentValues); 90 | 91 | if (rowId > 0) { 92 | Uri curi = Uri.parse("content://" + PROVIDER + "/show"); 93 | Uri _uri = ContentUris.withAppendedId(curi, rowId); 94 | getContext().getContentResolver().notifyChange(_uri, null); 95 | return _uri; 96 | } 97 | 98 | 99 | return null; 100 | } 101 | 102 | @Override 103 | public int delete(Uri uri, String s, String[] strings) { 104 | return 0; //To change body of implemented methods use File | Settings | File Templates. 105 | } 106 | 107 | @Override 108 | public int update(Uri uri, ContentValues contentValues, String s, String[] strings) { 109 | return 0; //To change body of implemented methods use File | Settings | File Templates. 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /src/com/unitedcoders/android/gpodroid/services/RSSService.java: -------------------------------------------------------------------------------- 1 | /*Copyright 2010 NetCatch Team 2 | *Licensed under the Apache License, Version 2.0 (the "License"); 3 | *you may not use this file except in compliance with the License. 4 | *You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | *Unless required by applicable law or agreed to in writing, software 9 | *distributed under the License is distributed on an "AS IS" BASIS, 10 | *WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | *See the License for the specific language governing permissions and 12 | *limitations under the License. 13 | */ 14 | package com.unitedcoders.android.gpodroid.services; 15 | 16 | import com.unitedcoders.android.gpodroid.tools.Tools; 17 | 18 | import android.app.Notification; 19 | import android.app.NotificationManager; 20 | import android.app.PendingIntent; 21 | import android.app.Service; 22 | import android.content.ContentValues; 23 | import android.content.Context; 24 | import android.content.Intent; 25 | import android.content.SharedPreferences; 26 | import android.database.Cursor; 27 | import android.net.Uri; 28 | import android.os.Environment; 29 | import android.os.IBinder; 30 | import android.preference.PreferenceManager; 31 | import android.util.Log; 32 | 33 | import org.apache.http.HttpResponse; 34 | import org.apache.http.client.methods.HttpGet; 35 | import org.apache.http.impl.client.DefaultHttpClient; 36 | import org.w3c.dom.Document; 37 | import org.w3c.dom.Element; 38 | import org.w3c.dom.NodeList; 39 | import org.xml.sax.SAXException; 40 | 41 | import javax.xml.parsers.DocumentBuilder; 42 | import javax.xml.parsers.DocumentBuilderFactory; 43 | import java.io.IOException; 44 | 45 | /** 46 | * A simple service that takes an RSS feed and saves the data from the RSS feed. 47 | *

48 | * Requires either the show object to be pased in, or just a feed, 49 | * which will create a new show object 50 | * 51 | * @author Leif Andersen 52 | */ 53 | public class RSSService { 54 | 55 | 56 | private static String getImageUrlFromFeed(Context context, String url) { 57 | 58 | try { 59 | Document doc; 60 | DocumentBuilder builder = DocumentBuilderFactory.newInstance() 61 | .newDocumentBuilder(); 62 | DefaultHttpClient client = new DefaultHttpClient(); 63 | HttpGet request = new HttpGet(url); 64 | HttpResponse response = client.execute(request); 65 | doc = builder.parse(response.getEntity().getContent()); 66 | // return doc; 67 | 68 | // get Image 69 | NodeList item = doc.getElementsByTagName("channel"); 70 | Element el = (Element) item.item(0); 71 | 72 | String imageUrl; 73 | NodeList imagNode = el.getElementsByTagName("image"); 74 | if (imagNode != null) { 75 | Element ima = (Element) imagNode.item(0); 76 | if (ima != null) { 77 | NodeList urlNode = ima.getElementsByTagName("url"); 78 | if (urlNode == null || urlNode.getLength() < 1) 79 | imageUrl = null; 80 | else 81 | imageUrl = 82 | urlNode.item(0).getFirstChild().getNodeValue(); 83 | } else 84 | imageUrl = null; 85 | } else 86 | imageUrl = null; 87 | 88 | return imageUrl; 89 | 90 | } catch (IOException e) { 91 | return null; // The network probably died, just return null 92 | } catch (SAXException e) { 93 | // Problem parsing the XML, log and return nothing 94 | Log.e("NCRSS", "Error parsing XML", e); 95 | return null; 96 | } catch (Exception e) { 97 | // Anything else was probably another network problem, fail silently 98 | return null; 99 | } 100 | } 101 | } 102 | 103 | -------------------------------------------------------------------------------- /res/layout/playerview.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 10 | 13 | 14 | 15 | 18 | 19 | 22 | 25 | 26 | 27 | 31 | 32 | 33 | 35 | 37 | 39 | 40 | 41 | 42 | 43 | 45 | 46 | 49 | 50 | 51 | 53 | 57 | 61 | 62 |