Browse Source

Added options to use a RSS item as new search, to follow its link or to view the item description. Fixes #45.

pull/148/merge
Eric Kok 11 years ago
parent
commit
1fe4e9b642
  1. BIN
      core/res/drawable-hdpi/ic_action_info_dark.png
  2. BIN
      core/res/drawable-hdpi/ic_action_info_light.png
  3. BIN
      core/res/drawable-mdpi/ic_action_info_dark.png
  4. BIN
      core/res/drawable-mdpi/ic_action_info_light.png
  5. BIN
      core/res/drawable-xhdpi/ic_action_info_dark.png
  6. BIN
      core/res/drawable-xhdpi/ic_action_info_light.png
  7. BIN
      core/res/drawable-xxhdpi/ic_action_info_dark.png
  8. BIN
      core/res/drawable-xxhdpi/ic_action_info_light.png
  9. 18
      core/res/menu/fragment_rssitems_cab.xml
  10. 12
      core/res/menu/fragment_searchresults_cab.xml
  11. 3
      core/res/values/attrs.xml
  12. 3
      core/res/values/strings.xml
  13. 2
      core/res/values/styles.xml
  14. 41
      core/src/org/transdroid/core/gui/rss/RssitemsFragment.java
  15. 2
      core/src/org/transdroid/core/service/AppUpdateService.java

BIN
core/res/drawable-hdpi/ic_action_info_dark.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 911 B

BIN
core/res/drawable-hdpi/ic_action_info_light.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 994 B

BIN
core/res/drawable-mdpi/ic_action_info_dark.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 550 B

BIN
core/res/drawable-mdpi/ic_action_info_light.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 656 B

BIN
core/res/drawable-xhdpi/ic_action_info_dark.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
core/res/drawable-xhdpi/ic_action_info_light.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
core/res/drawable-xxhdpi/ic_action_info_dark.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
core/res/drawable-xxhdpi/ic_action_info_light.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

18
core/res/menu/fragment_rssitems_cab.xml

@ -22,4 +22,22 @@ @@ -22,4 +22,22 @@
android:showAsAction="always"
android:title="@string/action_addall" />
<item
android:id="@+id/action_showdetails"
android:icon="?attr/ic_action_info"
android:showAsAction="ifRoom"
android:title="@string/action_showdetails" />
<item
android:id="@+id/action_openwebsite"
android:icon="?attr/ic_action_website"
android:showAsAction="ifRoom"
android:title="@string/action_openwebsite" />
<item
android:id="@+id/action_useassearch"
android:icon="?attr/ic_action_search"
android:showAsAction="ifRoom"
android:title="@string/action_useassearch" />
</menu>

12
core/res/menu/fragment_searchresults_cab.xml

@ -16,16 +16,16 @@ @@ -16,16 +16,16 @@
-->
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/action_showdetails"
android:icon="?attr/ic_action_website"
android:showAsAction="always"
android:title="@string/action_showdetails" />
<item
android:id="@+id/action_addall"
android:icon="?attr/ic_action_new"
android:showAsAction="always"
android:title="@string/action_addall" />
<item
android:id="@+id/action_showdetails"
android:icon="?attr/ic_action_website"
android:showAsAction="always"
android:title="@string/action_showdetails" />
</menu>

3
core/res/values/attrs.xml

@ -23,7 +23,9 @@ @@ -23,7 +23,9 @@
<!-- Themeable drawables, such as action bar icons -->
<attr name="ic_action_discard" format="reference"/>
<attr name="ic_action_done" format="reference"/>
<attr name="ic_action_filter" format="reference"/>
<attr name="ic_action_info" format="reference"/>
<attr name="ic_action_labels" format="reference"/>
<attr name="ic_action_new" format="reference"/>
<attr name="ic_action_pause" format="reference"/>
@ -43,7 +45,6 @@ @@ -43,7 +45,6 @@
<attr name="ic_action_stop" format="reference"/>
<attr name="ic_action_trackers" format="reference"/>
<attr name="ic_action_website" format="reference"/>
<attr name="ic_action_done" format="reference"/>
<attr name="loading_progress" format="reference"/>
<attr name="activatable_background_transdroid" format="reference"/>
<attr name="selectable_background_transdroid" format="reference"/>

3
core/res/values/strings.xml

@ -62,8 +62,11 @@ @@ -62,8 +62,11 @@
<string name="action_remoteplay">Remote play in VLC</string>
<string name="action_download">Download using FTP(S)</string>
<string name="action_showdetails">Show details</string>
<string name="action_openwebsite">Open website</string>
<string name="action_useassearch">Use as new search</string>
<string name="action_removesettings">Remove settings</string>
<string name="action_visitwebsite">Visit transdroid.org</string>
<string name="action_close">Close</string>
<string name="navigation_nosettings">%1$s allows you to monitor and manage the torrent client you run at home or on your seedbox. Setting things up can be a bit tricky, but we offer step-by-step guides and promise it\'ll be worth it!</string>
<string name="navigation_emptytorrents">Connected, but no torrents are active within the current filter</string>

2
core/res/values/styles.xml

@ -24,6 +24,7 @@ @@ -24,6 +24,7 @@
<item name="ic_action_discard">@drawable/ic_action_discard_light</item>
<item name="ic_action_done">@drawable/ic_action_done_light</item>
<item name="ic_action_filter">@drawable/ic_action_filter_light</item>
<item name="ic_action_info">@drawable/ic_action_info_light</item>
<item name="ic_action_labels">@drawable/ic_action_labels_light</item>
<item name="ic_action_new">@drawable/ic_action_new_light</item>
<item name="ic_action_pause">@drawable/ic_action_pause_light</item>
@ -58,6 +59,7 @@ @@ -58,6 +59,7 @@
<item name="ic_action_discard">@drawable/ic_action_discard_dark</item>
<item name="ic_action_done">@drawable/ic_action_done_dark</item>
<item name="ic_action_filter">@drawable/ic_action_filter_dark</item>
<item name="ic_action_info">@drawable/ic_action_info_dark</item>
<item name="ic_action_labels">@drawable/ic_action_labels_dark</item>
<item name="ic_action_new">@drawable/ic_action_new_dark</item>
<item name="ic_action_pause">@drawable/ic_action_pause_dark</item>

41
core/src/org/transdroid/core/gui/rss/RssitemsFragment.java

@ -27,13 +27,23 @@ import org.androidannotations.annotations.ItemClick; @@ -27,13 +27,23 @@ import org.androidannotations.annotations.ItemClick;
import org.androidannotations.annotations.ViewById;
import org.transdroid.core.R;
import org.transdroid.core.gui.TorrentsActivity_;
import org.transdroid.core.gui.navigation.NavigationHelper;
import org.transdroid.core.gui.navigation.SelectionManagerMode;
import org.transdroid.core.gui.search.SearchActivity_;
import org.transdroid.core.rssparser.Channel;
import org.transdroid.core.rssparser.Item;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.SearchManager;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
import com.actionbarsherlock.app.SherlockFragment;
import com.actionbarsherlock.view.ActionMode;
@ -42,6 +52,8 @@ import com.actionbarsherlock.view.MenuItem; @@ -42,6 +52,8 @@ import com.actionbarsherlock.view.MenuItem;
import com.actionbarsherlock.view.SherlockListView;
import com.actionbarsherlock.view.SherlockListView.MultiChoiceModeListenerCompat;
import de.keyboardsurfer.android.widget.crouton.Crouton;
/**
* Fragment that lists the items in a specific RSS feed
* @author Eric Kok
@ -151,6 +163,35 @@ public class RssitemsFragment extends SherlockFragment { @@ -151,6 +163,35 @@ public class RssitemsFragment extends SherlockFragment {
mode.finish();
return true;
} else {
// The other items only operate on one (the first) selected item
if (checked.size() < 1)
return false;
final Item first = checked.get(0);
if (itemId == R.id.action_showdetails) {
// Show a dialog box with the RSS item description text
new DialogFragment() {
public Dialog onCreateDialog(Bundle savedInstanceState) {
return new AlertDialog.Builder(getActivity()).setMessage(first.getDescription())
.setPositiveButton(R.string.action_close, null).create();
};
}.show(getFragmentManager(), "RssItemDescription");
} else if (itemId == R.id.action_openwebsite) {
// Open the browser to show the website contained in the item's link tag
Toast.makeText(getActivity(), getString(R.string.search_openingdetails, first.getTitle()),
Toast.LENGTH_LONG).show();
if (!TextUtils.isEmpty(first.getLink())) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(first.getLink())));
} else {
// No URL was specified in the RSS feed item link tag (or no link tag was present)
Crouton.showText(getActivity(), R.string.error_no_link, NavigationHelper.CROUTON_ERROR_STYLE);
}
} else if (itemId == R.id.action_useassearch) {
// Use the RSS item title to start a new search (mimicking the search manager style)
Intent search = SearchActivity_.intent(getActivity()).get();
search.setAction(Intent.ACTION_SEARCH);
search.putExtra(SearchManager.QUERY, first.getTitle());
startActivity(search);
}
return false;
}
}

2
core/src/org/transdroid/core/service/AppUpdateService.java

@ -87,7 +87,7 @@ public class AppUpdateService extends IntentService { @@ -87,7 +87,7 @@ public class AppUpdateService extends IntentService {
Calendar lastDay = Calendar.getInstance();
lastDay.add(Calendar.DAY_OF_MONTH, -1);
if (lastChecked != null && lastChecked.after(lastDay.getTime())) {
Log.d(this, "Ship the update service, as we already checked the last 24 hours (or to be exact at "
Log.d(this, "Skip the update service, as we already checked the last 24 hours (or to be exact at "
+ lastChecked.toString() + ").");
return;
}

Loading…
Cancel
Save