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" />
|
android:value=".activity.MiroGuideSearchActivity" />
|
||||||
</activity>
|
</activity>
|
||||||
<activity android:name=".activity.MiroGuideCategoryActivity" android:configChanges="keyboardHidden|orientation" android:theme="@style/StyledIndicators"></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>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
|
@ -166,6 +166,8 @@
|
||||||
<string name="miro_search_hint">Search Miro Guide</string>
|
<string name="miro_search_hint">Search Miro Guide</string>
|
||||||
<string name="popular_label">Popular</string>
|
<string name="popular_label">Popular</string>
|
||||||
<string name="best_rating_label">Best rating</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>
|
</resources>
|
|
@ -1,6 +1,10 @@
|
||||||
package de.danoeh.antennapod.activity;
|
package de.danoeh.antennapod.activity;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.net.Uri;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
@ -10,6 +14,7 @@ import android.widget.ListView;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.RelativeLayout;
|
import android.widget.RelativeLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.actionbarsherlock.app.SherlockActivity;
|
import com.actionbarsherlock.app.SherlockActivity;
|
||||||
import com.actionbarsherlock.view.Menu;
|
import com.actionbarsherlock.view.Menu;
|
||||||
|
@ -19,6 +24,7 @@ import com.actionbarsherlock.view.MenuItem;
|
||||||
import de.danoeh.antennapod.AppConfig;
|
import de.danoeh.antennapod.AppConfig;
|
||||||
import de.danoeh.antennapod.R;
|
import de.danoeh.antennapod.R;
|
||||||
import de.danoeh.antennapod.adapter.MiroGuideItemlistAdapter;
|
import de.danoeh.antennapod.adapter.MiroGuideItemlistAdapter;
|
||||||
|
import de.danoeh.antennapod.feed.Feed;
|
||||||
import de.danoeh.antennapod.feed.FeedManager;
|
import de.danoeh.antennapod.feed.FeedManager;
|
||||||
import de.danoeh.antennapod.miroguide.con.MiroGuideException;
|
import de.danoeh.antennapod.miroguide.con.MiroGuideException;
|
||||||
import de.danoeh.antennapod.miroguide.con.MiroGuideService;
|
import de.danoeh.antennapod.miroguide.con.MiroGuideService;
|
||||||
|
@ -122,10 +128,11 @@ public class MiroGuideChannelViewActivity extends SherlockActivity {
|
||||||
@Override
|
@Override
|
||||||
public boolean onPrepareOptionsMenu(Menu menu) {
|
public boolean onPrepareOptionsMenu(Menu menu) {
|
||||||
boolean channelLoaded = channel != null;
|
boolean channelLoaded = channel != null;
|
||||||
|
boolean beingDownloaded = channelLoaded && DownloadRequester.getInstance()
|
||||||
|
.isDownloadingFile(channel.getDownloadUrl());
|
||||||
boolean notAdded = channelLoaded
|
boolean notAdded = channelLoaded
|
||||||
&& !((FeedManager.getInstance().feedExists(channel
|
&& !((FeedManager.getInstance().feedExists(channel
|
||||||
.getDownloadUrl())) || (DownloadRequester.getInstance()
|
.getDownloadUrl()) || beingDownloaded));
|
||||||
.isDownloadingFile(channel.getDownloadUrl())));
|
|
||||||
menu.findItem(R.id.add_feed).setVisible(notAdded);
|
menu.findItem(R.id.add_feed).setVisible(notAdded);
|
||||||
menu.findItem(R.id.visit_website_item).setVisible(
|
menu.findItem(R.id.visit_website_item).setVisible(
|
||||||
channelLoaded && channel.getWebsiteUrl() != null);
|
channelLoaded && channel.getWebsiteUrl() != null);
|
||||||
|
@ -138,6 +145,17 @@ public class MiroGuideChannelViewActivity extends SherlockActivity {
|
||||||
case android.R.id.home:
|
case android.R.id.home:
|
||||||
finish();
|
finish();
|
||||||
return true;
|
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:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue