Feeds can now be added from the miroguide
This commit is contained in:
parent
93fd0d3b2e
commit
6254053226
|
@ -196,7 +196,7 @@
|
|||
android:value=".activity.MiroGuideSearchActivity" />
|
||||
</activity>
|
||||
<activity android:name=".activity.MiroGuideCategoryActivity" android:configChanges="keyboardHidden|orientation" android:theme="@style/StyledIndicators"></activity>
|
||||
<activity android:name=".activity.MiroGuideChannelViewActivity" android:configChanges="keyboard|orientation"></activity>
|
||||
<activity android:name=".activity.MiroGuideChannelViewActivity" android:configChanges="keyboard|orientation" android:label="@string/miro_guide_label"></activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
|
@ -166,6 +166,8 @@
|
|||
<string name="miro_search_hint">Search Miro Guide</string>
|
||||
<string name="popular_label">Popular</string>
|
||||
<string name="best_rating_label">Best rating</string>
|
||||
<string name="add_feed_label">Add feed</string>
|
||||
<string name="miro_feed_added">Feed is being added</string>
|
||||
|
||||
|
||||
</resources>
|
|
@ -1,6 +1,10 @@
|
|||
package de.danoeh.antennapod.activity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
@ -10,6 +14,7 @@ import android.widget.ListView;
|
|||
import android.widget.ProgressBar;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.actionbarsherlock.app.SherlockActivity;
|
||||
import com.actionbarsherlock.view.Menu;
|
||||
|
@ -19,6 +24,7 @@ import com.actionbarsherlock.view.MenuItem;
|
|||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.adapter.MiroGuideItemlistAdapter;
|
||||
import de.danoeh.antennapod.feed.Feed;
|
||||
import de.danoeh.antennapod.feed.FeedManager;
|
||||
import de.danoeh.antennapod.miroguide.con.MiroGuideException;
|
||||
import de.danoeh.antennapod.miroguide.con.MiroGuideService;
|
||||
|
@ -122,10 +128,11 @@ public class MiroGuideChannelViewActivity extends SherlockActivity {
|
|||
@Override
|
||||
public boolean onPrepareOptionsMenu(Menu menu) {
|
||||
boolean channelLoaded = channel != null;
|
||||
boolean beingDownloaded = channelLoaded && DownloadRequester.getInstance()
|
||||
.isDownloadingFile(channel.getDownloadUrl());
|
||||
boolean notAdded = channelLoaded
|
||||
&& !((FeedManager.getInstance().feedExists(channel
|
||||
.getDownloadUrl())) || (DownloadRequester.getInstance()
|
||||
.isDownloadingFile(channel.getDownloadUrl())));
|
||||
.getDownloadUrl()) || beingDownloaded));
|
||||
menu.findItem(R.id.add_feed).setVisible(notAdded);
|
||||
menu.findItem(R.id.visit_website_item).setVisible(
|
||||
channelLoaded && channel.getWebsiteUrl() != null);
|
||||
|
@ -138,6 +145,17 @@ public class MiroGuideChannelViewActivity extends SherlockActivity {
|
|||
case android.R.id.home:
|
||||
finish();
|
||||
return true;
|
||||
case R.id.visit_website_item:
|
||||
Uri uri = Uri.parse(channel.getWebsiteUrl());
|
||||
startActivity(new Intent(Intent.ACTION_VIEW, uri));
|
||||
return true;
|
||||
case R.id.add_feed:
|
||||
DownloadRequester.getInstance().downloadFeed(this,
|
||||
new Feed(channel.getDownloadUrl(), new Date()));
|
||||
Toast toast = Toast.makeText(this, R.string.miro_feed_added, Toast.LENGTH_LONG);
|
||||
toast.show();
|
||||
invalidateOptionsMenu();
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue