Skip to content

Commit

Permalink
fetch button for updates in podcastmanager
Browse files Browse the repository at this point in the history
  • Loading branch information
nheid committed Jun 14, 2011
1 parent 0068217 commit c0b0651
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 16 deletions.
2 changes: 1 addition & 1 deletion GpodRoid.iml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/gen" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="jdk" jdkName="Android 2.2 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
Expand Down
4 changes: 2 additions & 2 deletions res/menu/podcastmanager.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns:android="http://schemas.android.com/apk/res/android">


<item android:id="@+id/subscriptions" android:icon="@drawable/android:ic_menu_agenda" android:title="subscriptions" />
<item android:id="@+id/fetch_updates" android:icon="@drawable/android:ic_menu_agenda" android:title="subscriptions" />
<item android:id="@+id/fetch_updates" android:icon="@drawable/android:ic_popup_sync" android:title="fetch updates" />
<!--<item android:id="@+id/fetch_updates" android:icon="@drawable/android:ic_menu_agenda" android:title="subscriptions" />-->

</menu>
50 changes: 37 additions & 13 deletions src/com/unitedcoders/android/gpodroid/activity/PodcastManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,14 @@
import android.content.*;
import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.*;
import android.view.View.OnClickListener;
import android.widget.*;
import android.widget.AdapterView.OnItemClickListener;
import com.unitedcoders.android.gpodroid.*;
import com.unitedcoders.android.gpodroid.database.GpodDB;
import com.unitedcoders.android.gpodroid.services.DownloadService;
import com.unitedcoders.android.gpodroid.services.UpdateService;
import roboguice.activity.RoboTabActivity;
import roboguice.inject.InjectView;

Expand All @@ -27,12 +25,16 @@ public class PodcastManager extends RoboTabActivity implements OnClickListener {
private TabHost mTabHost;

// podcasts in archive
@InjectView(R.id.lv_shows) private ListView lvShows;
@InjectView(R.id.lv_podcasts) private ListView lvPodcasts;
@InjectView(R.id.lv_downloads) private ListView lvDownloads;
@InjectView(R.id.lv_shows)
private ListView lvShows;
@InjectView(R.id.lv_podcasts)
private ListView lvPodcasts;
@InjectView(R.id.lv_downloads)
private ListView lvDownloads;
// private ListView lvDownloads;

@InjectView(R.id.tabmgr_sdcard) private ViewFlipper sdcardFlipper;
@InjectView(R.id.tabmgr_sdcard)
private ViewFlipper sdcardFlipper;
private PodcastListAdapter podcastAdapter;
private PodcastListAdapter downloadAdapter;
private ArrayAdapter showAdapter;
Expand Down Expand Up @@ -65,13 +67,10 @@ protected void onCreate(Bundle savedInstanceState) {

mTabHost.addTab(mTabHost.newTabSpec("tab_test1").setIndicator("Podcasts").setContent(R.id.tabmgr_sdcard));
mTabHost.addTab(mTabHost.newTabSpec("tab_test3").setIndicator("New")
.setContent(R.id.tabmgr_subscriptions));
.setContent(R.id.tabmgr_subscriptions));

mTabHost.setCurrentTab(0);

// showShows();
// showDownloads();


}

Expand Down Expand Up @@ -105,7 +104,9 @@ public boolean onKeyDown(int keyCode, KeyEvent event) {
return super.onKeyDown(keyCode, event);
}
}
return true;


return super.onKeyDown(keyCode, event);
}


Expand Down Expand Up @@ -277,4 +278,27 @@ public void onReceive(Context context, Intent intent) {
};


@Override
public boolean onCreateOptionsMenu(Menu menu) {
// super.onCreateOptionsMenu(menu);
if (getParent() != null) {
return getParent().onCreateOptionsMenu(menu);
}

MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.podcastmanager, menu);
return true;
}

/**
* fetch new subscriptions
* @param item
* @return
*/
@Override
public boolean onOptionsItemSelected(MenuItem item) {
startService(new Intent(getApplicationContext(), UpdateService.class));
return super.onOptionsItemSelected(item);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ public void run() {
Looper.prepare();
devices = GpodderAPI.getDevices();
handler.post(displayResults);
Looper.loop();
}
};
t.start();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public void run() {
public void run() {
Looper.prepare();
backgroundPodcastInfoFetcher();
Looper.loop();
}
};

Expand Down

0 comments on commit c0b0651

Please sign in to comment.