Browse Source

Working contextual action modes, working menus.

material
Eric Kok 9 years ago
parent
commit
c91e79f9d3
  1. 2
      README.md
  2. 2
      app/build.gradle
  3. 16
      app/src/main/java/org/transdroid/core/gui/DetailsActivity.java
  4. 46
      app/src/main/java/org/transdroid/core/gui/DetailsFragment.java
  5. 7
      app/src/main/java/org/transdroid/core/gui/ServerStatusView.java
  6. 3
      app/src/main/java/org/transdroid/core/gui/TorrentTasksExecutor.java
  7. 92
      app/src/main/java/org/transdroid/core/gui/TorrentsActivity.java
  8. 45
      app/src/main/java/org/transdroid/core/gui/TorrentsFragment.java
  9. 11
      app/src/main/java/org/transdroid/core/gui/navigation/NavigationHelper.java
  10. 14
      app/src/main/java/org/transdroid/core/gui/navigation/SelectionManagerMode.java
  11. 69
      app/src/main/java/org/transdroid/core/gui/navigation/SetLabelDialog.java
  12. 4
      app/src/main/java/org/transdroid/core/gui/rss/RssfeedView.java
  13. 9
      app/src/main/java/org/transdroid/core/gui/rss/RssfeedsActivity.java
  14. 12
      app/src/main/java/org/transdroid/core/gui/rss/RssitemsFragment.java
  15. 8
      app/src/main/java/org/transdroid/core/gui/search/SearchActivity.java
  16. 2
      app/src/main/java/org/transdroid/core/gui/search/SearchHistoryProvider.java
  17. 13
      app/src/main/java/org/transdroid/core/gui/search/SearchResultsFragment.java
  18. 43
      app/src/main/java/org/transdroid/core/gui/settings/SystemSettingsActivity.java
  19. 46
      app/src/main/java/org/transdroid/core/seedbox/XirvikSharedSettingsActivity.java
  20. BIN
      app/src/main/res/drawable-hdpi/btn_cab_done_default_transdroid2.9.png
  21. BIN
      app/src/main/res/drawable-hdpi/btn_cab_done_focused_transdroid2.9.png
  22. BIN
      app/src/main/res/drawable-hdpi/btn_cab_done_pressed_transdroid2.9.png
  23. BIN
      app/src/main/res/drawable-hdpi/ic_action_copy.png
  24. BIN
      app/src/main/res/drawable-hdpi/ic_action_download.png
  25. BIN
      app/src/main/res/drawable-hdpi/ic_action_filter.png
  26. 0
      app/src/main/res/drawable-hdpi/ic_action_rss.png
  27. BIN
      app/src/main/res/drawable-hdpi/ic_action_turtle_disabled_light.png
  28. BIN
      app/src/main/res/drawable-hdpi/ic_btn_sort.png
  29. BIN
      app/src/main/res/drawable-xhdpi/btn_cab_done_default_transdroid2.9.png
  30. BIN
      app/src/main/res/drawable-xhdpi/btn_cab_done_focused_transdroid2.9.png
  31. BIN
      app/src/main/res/drawable-xhdpi/btn_cab_done_pressed_transdroid2.9.png
  32. BIN
      app/src/main/res/drawable-xhdpi/ic_action_copy.png
  33. BIN
      app/src/main/res/drawable-xhdpi/ic_action_download.png
  34. BIN
      app/src/main/res/drawable-xhdpi/ic_action_filter.png
  35. BIN
      app/src/main/res/drawable-xhdpi/ic_action_info_dark.png
  36. BIN
      app/src/main/res/drawable-xhdpi/ic_action_info_light.png
  37. BIN
      app/src/main/res/drawable-xhdpi/ic_btn_sort.png
  38. BIN
      app/src/main/res/drawable-xhdpi/ic_storage_white_24dp.png
  39. BIN
      app/src/main/res/drawable-xxhdpi/ic_action_copy.png
  40. BIN
      app/src/main/res/drawable-xxhdpi/ic_action_download.png
  41. BIN
      app/src/main/res/drawable-xxhdpi/ic_action_filter.png
  42. BIN
      app/src/main/res/drawable-xxhdpi/ic_action_forcerecheck_dark.png
  43. BIN
      app/src/main/res/drawable-xxhdpi/ic_action_forcerecheck_light.png
  44. BIN
      app/src/main/res/drawable-xxhdpi/ic_action_info_dark.png
  45. BIN
      app/src/main/res/drawable-xxhdpi/ic_action_info_light.png
  46. BIN
      app/src/main/res/drawable-xxhdpi/ic_action_save_dark.png
  47. BIN
      app/src/main/res/drawable-xxhdpi/ic_action_save_light.png
  48. 0
      app/src/main/res/drawable-xxhdpi/ic_action_sort.png
  49. BIN
      app/src/main/res/drawable-xxhdpi/ic_insert_link_white_24dp.png
  50. BIN
      app/src/main/res/drawable-xxxhdpi/ic_action_link.png
  51. BIN
      app/src/main/res/drawable-xxxhdpi/ic_action_search.png
  52. BIN
      app/src/main/res/drawable-xxxhdpi/ic_action_white.png
  53. BIN
      app/src/main/res/drawable-xxxhdpi/ic_btn_sort.png
  54. 27
      app/src/main/res/drawable/btn_cab_done_transdroid2.xml
  55. 84
      app/src/main/res/layout-w600dp/activity_search.xml
  56. 20
      app/src/main/res/layout-w600dp/activity_torrents.xml
  57. 22
      app/src/main/res/layout-w900dp/activity_torrents.xml
  58. 7
      app/src/main/res/layout/actionbar_searchsite.xml
  59. 58
      app/src/main/res/layout/activity_search.xml
  60. 25
      app/src/main/res/layout/activity_torrents.xml
  61. 16
      app/src/main/res/layout/fragment_details.xml
  62. 9
      app/src/main/res/layout/fragment_searchresults.xml
  63. 2
      app/src/main/res/layout/list_item_filter.xml
  64. 6
      app/src/main/res/layout/list_item_rssfeed.xml
  65. 35
      app/src/main/res/layout/list_item_searchresult.xml
  66. 6
      app/src/main/res/layout/list_item_searchsite.xml
  67. 2
      app/src/main/res/layout/list_item_separator.xml
  68. 6
      app/src/main/res/layout/list_item_simple.xml
  69. 32
      app/src/main/res/layout/list_item_torrent.xml
  70. 14
      app/src/main/res/layout/list_item_torrentfile.xml
  71. 15
      app/src/main/res/menu/fragment_details_cab_main.xml
  72. 26
      app/src/main/res/menu/fragment_details_cab_secondary.xml
  73. 12
      app/src/main/res/menu/fragment_torrents_cab.xml
  74. 2
      app/src/main/res/values-v21/styles.xml
  75. 1
      app/src/main/res/values/dimens.xml

2
README.md

@ -20,7 +20,7 @@ Please respect the coding standards for easier merging. master contains the curr
Code structure Code structure
============== ==============
Starting with version 2.3.0, Transdroid is developed in Android Studio, fully integrating with the Gradle build system. It is compiled against Android 4.4 (API level 19) and since version 2.2.0 supporting ICS (API level 15) and up only. To support lite (Transdrone, specially for the Play Store) and full (Transdroid) versions of the app, build flavours are defined in gradle, which contain version-specific resources. Dependencies are managed via Maven Central in the app's build.gradle file. Starting with version 2.3.0, Transdroid is developed in Android Studio, fully integrating with the Gradle build system. It is (since version 2.5.0) compiled against Android 5.1 (API level 22) and (since version 2.2.0) supporting ICS (API level 15) and up only. To support lite (Transdrone, specially for the Play Store) and full (Transdroid) versions of the app, build flavours are defined in gradle, which contain version-specific resources. Dependencies are managed via JCentral in the app's build.gradle file.
Developed By Developed By
============ ============

2
app/build.gradle

@ -36,12 +36,12 @@ dependencies {
compile 'org.androidannotations:androidannotations-api:3.2' compile 'org.androidannotations:androidannotations-api:3.2'
compile 'com.j256.ormlite:ormlite-core:4.48' compile 'com.j256.ormlite:ormlite-core:4.48'
compile 'com.j256.ormlite:ormlite-android:4.48' compile 'com.j256.ormlite:ormlite-android:4.48'
compile 'de.keyboardsurfer.android.widget:crouton:1.8.5@aar'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.3' compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.3'
compile 'com.android.support:appcompat-v7:22.0.0' compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.android.support:support-annotations:20.0.0' compile 'com.android.support:support-annotations:20.0.0'
compile 'com.getbase:floatingactionbutton:1.8.0' compile 'com.getbase:floatingactionbutton:1.8.0'
compile 'com.afollestad:material-dialogs:0.6.3.3' compile 'com.afollestad:material-dialogs:0.6.3.3'
compile 'com.nispok:snackbar:2.10.6'
apt 'org.androidannotations:androidannotations:3.2' apt 'org.androidannotations:androidannotations:3.2'
} }

16
app/src/main/java/org/transdroid/core/gui/DetailsActivity.java

@ -24,6 +24,9 @@ import android.support.v7.app.ActionBarActivity;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.widget.Toast; import android.widget.Toast;
import com.nispok.snackbar.Snackbar;
import com.nispok.snackbar.SnackbarManager;
import org.androidannotations.annotations.AfterViews; import org.androidannotations.annotations.AfterViews;
import org.androidannotations.annotations.Background; import org.androidannotations.annotations.Background;
import org.androidannotations.annotations.Bean; import org.androidannotations.annotations.Bean;
@ -74,8 +77,6 @@ import org.transdroid.daemon.task.StopTask;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import de.keyboardsurfer.android.widget.crouton.Crouton;
/** /**
* An activity that holds a single torrents details fragment. It is used on devices (i.e. phones) where there is no room to show details in the {@link * An activity that holds a single torrents details fragment. It is used on devices (i.e. phones) where there is no room to show details in the {@link
* TorrentsActivity} directly. Task execution, such as loading of more details and updating file priorities, is performed in this activity via * TorrentsActivity} directly. Task execution, such as loading of more details and updating file priorities, is performed in this activity via
@ -144,12 +145,6 @@ public class DetailsActivity extends ActionBarActivity implements TorrentTasksEx
} }
@Override
protected void onDestroy() {
Crouton.cancelAllCroutons();
super.onDestroy();
}
@TargetApi(Build.VERSION_CODES.HONEYCOMB) @TargetApi(Build.VERSION_CODES.HONEYCOMB)
@OptionsItem(android.R.id.home) @OptionsItem(android.R.id.home)
protected void navigateUp() { protected void navigateUp() {
@ -333,7 +328,7 @@ public class DetailsActivity extends ActionBarActivity implements TorrentTasksEx
// Refresh the screen as well // Refresh the screen as well
refreshTorrent(); refreshTorrent();
refreshTorrentDetails(torrent); refreshTorrentDetails(torrent);
Crouton.showText(this, successMessage, NavigationHelper.CROUTON_INFO_STYLE); SnackbarManager.show(Snackbar.with(this).text(successMessage));
} }
@UiThread @UiThread
@ -353,7 +348,8 @@ public class DetailsActivity extends ActionBarActivity implements TorrentTasksEx
log.i(this, result.getException().toString()); log.i(this, result.getException().toString());
String error = getString(LocalTorrent.getResourceForDaemonException(result.getException())); String error = getString(LocalTorrent.getResourceForDaemonException(result.getException()));
fragmentDetails.updateIsLoading(false, isCritical ? error : null); fragmentDetails.updateIsLoading(false, isCritical ? error : null);
Crouton.showText(this, getString(LocalTorrent.getResourceForDaemonException(result.getException())), NavigationHelper.CROUTON_ERROR_STYLE); SnackbarManager.show(Snackbar.with(this).text(getString(LocalTorrent.getResourceForDaemonException(result.getException())))
.colorResource(R.color.crouton_error));
} }
@UiThread @UiThread

46
app/src/main/java/org/transdroid/core/gui/DetailsFragment.java

@ -24,6 +24,7 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import android.support.v4.widget.SwipeRefreshLayout; import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.widget.ActionMenuView; import android.support.v7.widget.ActionMenuView;
import android.view.ActionMode; import android.view.ActionMode;
import android.view.Menu; import android.view.Menu;
@ -34,6 +35,9 @@ import android.widget.ListView;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.TextView; import android.widget.TextView;
import com.nispok.snackbar.Snackbar;
import com.nispok.snackbar.SnackbarManager;
import org.androidannotations.annotations.AfterViews; import org.androidannotations.annotations.AfterViews;
import org.androidannotations.annotations.Click; import org.androidannotations.annotations.Click;
import org.androidannotations.annotations.EFragment; import org.androidannotations.annotations.EFragment;
@ -47,7 +51,6 @@ import org.transdroid.core.app.settings.SystemSettings_;
import org.transdroid.core.gui.lists.DetailsAdapter; import org.transdroid.core.gui.lists.DetailsAdapter;
import org.transdroid.core.gui.lists.SimpleListItemAdapter; import org.transdroid.core.gui.lists.SimpleListItemAdapter;
import org.transdroid.core.gui.navigation.Label; import org.transdroid.core.gui.navigation.Label;
import org.transdroid.core.gui.navigation.NavigationHelper;
import org.transdroid.core.gui.navigation.NavigationHelper_; import org.transdroid.core.gui.navigation.NavigationHelper_;
import org.transdroid.core.gui.navigation.RefreshableActivity; import org.transdroid.core.gui.navigation.RefreshableActivity;
import org.transdroid.core.gui.navigation.SelectionManagerMode; import org.transdroid.core.gui.navigation.SelectionManagerMode;
@ -67,8 +70,6 @@ import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import de.keyboardsurfer.android.widget.crouton.Crouton;
/** /**
* Fragment that shows detailed statistics about some torrent. These come from some already fetched {@link Torrent} object, but it also retrieves * Fragment that shows detailed statistics about some torrent. These come from some already fetched {@link Torrent} object, but it also retrieves
* further detailed statistics. The actual execution of tasks is performed by the activity that contains this fragment, as per the {@link * further detailed statistics. The actual execution of tasks is performed by the activity that contains this fragment, as per the {@link
@ -100,6 +101,8 @@ public class DetailsFragment extends Fragment implements OnTrackersUpdatedListen
protected View detailsContainer; protected View detailsContainer;
@ViewById(R.id.details_menu) @ViewById(R.id.details_menu)
protected ActionMenuView detailsMenu; protected ActionMenuView detailsMenu;
@ViewById(R.id.contextual_menu)
protected ActionMenuView contextualMenu;
@ViewById @ViewById
protected SwipeRefreshLayout swipeRefreshLayout; protected SwipeRefreshLayout swipeRefreshLayout;
@ViewById @ViewById
@ -415,7 +418,7 @@ public class DetailsFragment extends Fragment implements OnTrackersUpdatedListen
@OptionsItem(R.id.action_updatetrackers) @OptionsItem(R.id.action_updatetrackers)
protected void updateTrackers() { protected void updateTrackers() {
if (torrentDetails == null) { if (torrentDetails == null) {
Crouton.showText(getActivity(), R.string.error_stillloadingdetails, NavigationHelper.CROUTON_INFO_STYLE); SnackbarManager.show(Snackbar.with(getActivity()).text(R.string.error_stillloadingdetails));
return; return;
} }
new SetTrackersDialog().setOnTrackersUpdated(this).setCurrentTrackers(torrentDetails.getTrackersText()) new SetTrackersDialog().setOnTrackersUpdated(this).setCurrentTrackers(torrentDetails.getTrackersText())
@ -473,10 +476,22 @@ public class DetailsFragment extends Fragment implements OnTrackersUpdatedListen
SelectionManagerMode selectionManagerMode; SelectionManagerMode selectionManagerMode;
@Override @Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) { public boolean onCreateActionMode(final ActionMode mode, Menu menu) {
// Show contextual action bar to start/stop/remove/etc. torrents in batch mode // Show contextual action bar to start/stop/remove/etc. torrents in batch mode
mode.getMenuInflater().inflate(R.menu.fragment_details_cab, menu); detailsMenu.setEnabled(false);
selectionManagerMode = new SelectionManagerMode(detailsList, R.plurals.navigation_filesselected); contextualMenu.setVisibility(View.VISIBLE);
contextualMenu.setOnMenuItemClickListener(new ActionMenuView.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem menuItem) {
return onActionItemClicked(mode, menuItem);
}
});
if (contextualMenu.getMenu().size() == 0) {
getActivity().getMenuInflater().inflate(R.menu.fragment_details_cab_main, contextualMenu.getMenu());
}
Context themedContext = ((ActionBarActivity) getActivity()).getSupportActionBar().getThemedContext();
mode.getMenuInflater().inflate(R.menu.fragment_details_cab_secondary, menu);
selectionManagerMode = new SelectionManagerMode(themedContext, detailsList, R.plurals.navigation_filesselected);
selectionManagerMode.setOnlyCheckClass(TorrentFile.class); selectionManagerMode.setOnlyCheckClass(TorrentFile.class);
selectionManagerMode.onCreateActionMode(mode, menu); selectionManagerMode.onCreateActionMode(mode, menu);
return true; return true;
@ -484,19 +499,20 @@ public class DetailsFragment extends Fragment implements OnTrackersUpdatedListen
@Override @Override
public boolean onPrepareActionMode(ActionMode mode, Menu menu) { public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
selectionManagerMode.onPrepareActionMode(mode, menu);
// Pause autorefresh // Pause autorefresh
if (getActivity() != null && getActivity() instanceof TorrentsActivity) { if (getActivity() != null && getActivity() instanceof TorrentsActivity) {
((TorrentsActivity) getActivity()).stopRefresh = true; ((TorrentsActivity) getActivity()).stopRefresh = true;
((TorrentsActivity) getActivity()).stopAutoRefresh(); ((TorrentsActivity) getActivity()).stopAutoRefresh();
} }
boolean filePaths = currentServerSettings != null && Daemon.supportsFilePaths(currentServerSettings.getType()); boolean filePaths = currentServerSettings != null && Daemon.supportsFilePaths(currentServerSettings.getType());
menu.findItem(R.id.action_download).setVisible(filePaths); contextualMenu.getMenu().findItem(R.id.action_download).setVisible(filePaths);
boolean filePriorities = currentServerSettings != null && Daemon.supportsFilePrioritySetting(currentServerSettings.getType()); boolean filePriorities = currentServerSettings != null && Daemon.supportsFilePrioritySetting(currentServerSettings.getType());
menu.findItem(R.id.action_priority_off).setVisible(filePriorities); contextualMenu.getMenu().findItem(R.id.action_priority_off).setVisible(filePriorities);
menu.findItem(R.id.action_priority_low).setVisible(filePriorities); contextualMenu.getMenu().findItem(R.id.action_priority_low).setVisible(filePriorities);
menu.findItem(R.id.action_priority_normal).setVisible(filePriorities); contextualMenu.getMenu().findItem(R.id.action_priority_normal).setVisible(filePriorities);
menu.findItem(R.id.action_priority_high).setVisible(filePriorities); contextualMenu.getMenu().findItem(R.id.action_priority_high).setVisible(filePriorities);
return selectionManagerMode.onPrepareActionMode(mode, menu); return true;
} }
@SuppressLint("SdCardPath") @SuppressLint("SdCardPath")
@ -569,7 +585,7 @@ public class DetailsFragment extends Fragment implements OnTrackersUpdatedListen
} }
// No app is available that can handle FTP downloads // No app is available that can handle FTP downloads
Crouton.showText(getActivity(), getString(R.string.error_noftpapp, url), NavigationHelper.CROUTON_ERROR_STYLE); SnackbarManager.show(Snackbar.with(getActivity()).text(R.string.error_noftpapp).colorResource(R.color.crouton_error));
mode.finish(); mode.finish();
return true; return true;
@ -617,6 +633,8 @@ public class DetailsFragment extends Fragment implements OnTrackersUpdatedListen
((TorrentsActivity) getActivity()).startAutoRefresh(); ((TorrentsActivity) getActivity()).startAutoRefresh();
} }
selectionManagerMode.onDestroyActionMode(mode); selectionManagerMode.onDestroyActionMode(mode);
contextualMenu.setVisibility(View.GONE);
detailsMenu.setEnabled(true);
} }
}; };

7
app/src/main/java/org/transdroid/core/gui/ServerStatusView.java

@ -21,6 +21,9 @@ import android.view.View;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;
import com.nispok.snackbar.Snackbar;
import com.nispok.snackbar.SnackbarManager;
import org.androidannotations.annotations.EViewGroup; import org.androidannotations.annotations.EViewGroup;
import org.androidannotations.annotations.ViewById; import org.androidannotations.annotations.ViewById;
import org.transdroid.R; import org.transdroid.R;
@ -32,8 +35,6 @@ import org.transdroid.daemon.util.FileSizeConverter;
import java.util.List; import java.util.List;
import de.keyboardsurfer.android.widget.crouton.Crouton;
@EViewGroup(R.layout.actionbar_serverstatus) @EViewGroup(R.layout.actionbar_serverstatus)
public class ServerStatusView extends RelativeLayout implements OnRatesPickedListener { public class ServerStatusView extends RelativeLayout implements OnRatesPickedListener {
@ -115,7 +116,7 @@ public class ServerStatusView extends RelativeLayout implements OnRatesPickedLis
@Override @Override
public void onInvalidNumber() { public void onInvalidNumber() {
Crouton.showText(activity, R.string.error_notanumber, NavigationHelper.CROUTON_ERROR_STYLE); SnackbarManager.show(Snackbar.with(activity).text(R.string.error_notanumber).colorResource(R.color.crouton_error));
} }
} }

3
app/src/main/java/org/transdroid/core/gui/TorrentTasksExecutor.java

@ -16,6 +16,9 @@
*/ */
package org.transdroid.core.gui; package org.transdroid.core.gui;
import android.support.v7.widget.ActionMenuView;
import android.support.v7.widget.Toolbar;
import org.transdroid.daemon.Priority; import org.transdroid.daemon.Priority;
import org.transdroid.daemon.Torrent; import org.transdroid.daemon.Torrent;
import org.transdroid.daemon.TorrentFile; import org.transdroid.daemon.TorrentFile;

92
app/src/main/java/org/transdroid/core/gui/TorrentsActivity.java

@ -26,9 +26,9 @@ import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.view.MenuItemCompat; import android.support.v4.view.MenuItemCompat;
import android.support.v4.widget.DrawerLayout; import android.support.v4.widget.DrawerLayout;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.ActionBarDrawerToggle; import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.widget.ActionMenuView;
import android.support.v7.widget.SearchView; import android.support.v7.widget.SearchView;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.text.TextUtils; import android.text.TextUtils;
@ -43,6 +43,8 @@ import android.widget.ListView;
import com.getbase.floatingactionbutton.FloatingActionButton; import com.getbase.floatingactionbutton.FloatingActionButton;
import com.getbase.floatingactionbutton.FloatingActionsMenu; import com.getbase.floatingactionbutton.FloatingActionsMenu;
import com.nispok.snackbar.Snackbar;
import com.nispok.snackbar.SnackbarManager;
import org.androidannotations.annotations.AfterViews; import org.androidannotations.annotations.AfterViews;
import org.androidannotations.annotations.Background; import org.androidannotations.annotations.Background;
@ -135,8 +137,6 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import de.keyboardsurfer.android.widget.crouton.Crouton;
/** /**
* Main activity that holds the fragment that shows the torrents list, presents a way to filter the list (via an action bar spinner or list side list) * Main activity that holds the fragment that shows the torrents list, presents a way to filter the list (via an action bar spinner or list side list)
* and potentially shows a torrent details fragment too, if there is room. Task execution such as loading of and adding torrents is performs in this * and potentially shows a torrent details fragment too, if there is room. Task execution such as loading of and adding torrents is performs in this
@ -166,6 +166,8 @@ public class TorrentsActivity extends ActionBarActivity implements TorrentTasksE
protected Toolbar torrentsToolbar; protected Toolbar torrentsToolbar;
@ViewById @ViewById
protected Toolbar actionsToolbar; protected Toolbar actionsToolbar;
@ViewById(R.id.contextual_menu)
protected ActionMenuView contextualMenu;
@ViewById @ViewById
protected FloatingActionsMenu addmenuButton; protected FloatingActionsMenu addmenuButton;
@ViewById @ViewById
@ -404,12 +406,6 @@ public class TorrentsActivity extends ActionBarActivity implements TorrentTasksE
autoRefreshTask = null; autoRefreshTask = null;
} }
@Override
protected void onDestroy() {
Crouton.cancelAllCroutons();
super.onDestroy();
}
@Override @Override
public boolean onCreateOptionsMenu(Menu menu) { public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu); super.onCreateOptionsMenu(menu);
@ -418,35 +414,35 @@ public class TorrentsActivity extends ActionBarActivity implements TorrentTasksE
if (actionsToolbar.getMenu().size() == 0) { if (actionsToolbar.getMenu().size() == 0) {
actionsToolbar.inflateMenu(R.menu.activity_torrents_secondary); actionsToolbar.inflateMenu(R.menu.activity_torrents_secondary);
} }
if (navigationHelper.enableSearchUi()) { if (navigationHelper.enableSearchUi()) {
// Add an expandable SearchView to the action bar // Add an expandable SearchView to the action bar
MenuItem item = menu.findItem(R.id.action_search); MenuItem item = menu.findItem(R.id.action_search);
SearchView searchView = new SearchView(this); SearchView searchView = new SearchView(torrentsToolbar.getContext());
searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
searchView.setQueryRefinementEnabled(true); searchView.setQueryRefinementEnabled(true);
searchView.setOnSearchClickListener(new OnClickListener() { searchView.setOnSearchClickListener(new OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
// Pause autorefresh // Pause autorefresh
stopRefresh = true; stopRefresh = true;
stopAutoRefresh(); stopAutoRefresh();
} }
}); });
MenuItemCompat.setOnActionExpandListener(item, new MenuItemCompat.OnActionExpandListener() { MenuItemCompat.setOnActionExpandListener(item, new MenuItemCompat.OnActionExpandListener() {
@Override @Override
public boolean onMenuItemActionExpand(MenuItem item) { public boolean onMenuItemActionExpand(MenuItem item) {
return true; return true;
} }
@Override @Override
public boolean onMenuItemActionCollapse(MenuItem item) { public boolean onMenuItemActionCollapse(MenuItem item) {
stopRefresh = false; stopRefresh = false;
startAutoRefresh(); startAutoRefresh();
return true; return true;
} }
}); });
MenuItemCompat.setActionView(item, searchView); MenuItemCompat.setActionView(item, searchView);
searchMenu = item; searchMenu = item;
} }
return true; return true;
} }
@ -652,7 +648,7 @@ public class TorrentsActivity extends ActionBarActivity implements TorrentTasksE
return; return;
} }
if (dataUri.getScheme() == null) { if (dataUri.getScheme() == null) {
Crouton.showText(this, R.string.error_invalid_url_form, NavigationHelper.CROUTON_ERROR_STYLE); SnackbarManager.show(Snackbar.with(this).text(R.string.error_invalid_url_form).colorResource(R.color.crouton_error));
return; return;
} }
@ -768,7 +764,7 @@ public class TorrentsActivity extends ActionBarActivity implements TorrentTasksE
protected void onBarcodeScanHandled(String barcode, String result) { protected void onBarcodeScanHandled(String barcode, String result) {
log.d(this, "Scanned barcode " + barcode + " and got " + result); log.d(this, "Scanned barcode " + barcode + " and got " + result);
if (TextUtils.isEmpty(result)) { if (TextUtils.isEmpty(result)) {
Crouton.showText(this, R.string.error_noproductforcode, NavigationHelper.CROUTON_ERROR_STYLE); SnackbarManager.show(Snackbar.with(this).text(R.string.error_noproductforcode).colorResource(R.color.crouton_error));
} else if (result.startsWith("http") || result.startsWith("https")) { } else if (result.startsWith("http") || result.startsWith("https")) {
addTorrentByUrl(result, "QR code result"); // No torrent title known addTorrentByUrl(result, "QR code result"); // No torrent title known
} else if (navigationHelper.enableSearchUi()) { } else if (navigationHelper.enableSearchUi()) {
@ -1030,10 +1026,10 @@ public class TorrentsActivity extends ActionBarActivity implements TorrentTasksE
} catch (SecurityException e) { } catch (SecurityException e) {
// No longer access to this file // No longer access to this file
log.e(this, "No access given to " + contentUri.toString() + ": " + e.toString()); log.e(this, "No access given to " + contentUri.toString() + ": " + e.toString());
Crouton.showText(this, R.string.error_torrentfile, NavigationHelper.CROUTON_ERROR_STYLE); SnackbarManager.show(Snackbar.with(this).text(R.string.error_torrentfile).colorResource(R.color.crouton_error));
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
log.e(this, contentUri.toString() + " does not exist: " + e.toString()); log.e(this, contentUri.toString() + " does not exist: " + e.toString());
Crouton.showText(this, R.string.error_torrentfile, NavigationHelper.CROUTON_ERROR_STYLE); SnackbarManager.show(Snackbar.with(this).text(R.string.error_torrentfile).colorResource(R.color.crouton_error));
} }
} }
@ -1045,7 +1041,7 @@ public class TorrentsActivity extends ActionBarActivity implements TorrentTasksE
addTorrentFromStream(input, title); addTorrentFromStream(input, title);
} catch (Exception e) { } catch (Exception e) {
log.e(this, "Can't download private site torrent " + url + " from " + source + ": " + e.toString()); log.e(this, "Can't download private site torrent " + url + " from " + source + ": " + e.toString());
Crouton.showText(this, R.string.error_torrentfile, NavigationHelper.CROUTON_ERROR_STYLE); SnackbarManager.show(Snackbar.with(this).text(R.string.error_torrentfile).colorResource(R.color.crouton_error));
} }
} }
@ -1073,14 +1069,14 @@ public class TorrentsActivity extends ActionBarActivity implements TorrentTasksE
response.getStatusLine().getStatusCode() == HttpStatus.SC_NOT_FOUND) { response.getStatusLine().getStatusCode() == HttpStatus.SC_NOT_FOUND) {
log.e(this, "Can't retrieve web torrent " + url + ": Unexpected HTTP response status code " + log.e(this, "Can't retrieve web torrent " + url + ": Unexpected HTTP response status code " +
response.getStatusLine().toString()); response.getStatusLine().toString());
Crouton.showText(this, R.string.error_401, NavigationHelper.CROUTON_ERROR_STYLE); SnackbarManager.show(Snackbar.with(this).text(R.string.error_401).colorResource(R.color.crouton_error));
return; return;
} }
InputStream input = response.getEntity().getContent(); InputStream input = response.getEntity().getContent();
addTorrentFromStream(input, title); addTorrentFromStream(input, title);
} catch (Exception e) { } catch (Exception e) {
log.e(this, "Can't retrieve web torrent " + url + ": " + e.toString()); log.e(this, "Can't retrieve web torrent " + url + ": " + e.toString());
Crouton.showText(this, R.string.error_torrentfile, NavigationHelper.CROUTON_ERROR_STYLE); SnackbarManager.show(Snackbar.with(this).text(R.string.error_torrentfile).colorResource(R.color.crouton_error));
} }
} }
@ -1106,7 +1102,7 @@ public class TorrentsActivity extends ActionBarActivity implements TorrentTasksE
} }
} catch (IOException e) { } catch (IOException e) {
log.e(this, "Can't write input stream to " + tempFile.toString() + ": " + e.toString()); log.e(this, "Can't write input stream to " + tempFile.toString() + ": " + e.toString());
Crouton.showText(this, R.string.error_torrentfile, NavigationHelper.CROUTON_ERROR_STYLE); SnackbarManager.show(Snackbar.with(this).text(R.string.error_torrentfile).colorResource(R.color.crouton_error));
} finally { } finally {
try { try {
if (input != null) { if (input != null) {
@ -1114,7 +1110,7 @@ public class TorrentsActivity extends ActionBarActivity implements TorrentTasksE
} }
} catch (IOException e) { } catch (IOException e) {
log.e(this, "Error closing the input stream " + tempFile.toString() + ": " + e.toString()); log.e(this, "Error closing the input stream " + tempFile.toString() + ": " + e.toString());
Crouton.showText(this, R.string.error_torrentfile, NavigationHelper.CROUTON_ERROR_STYLE); SnackbarManager.show(Snackbar.with(this).text(R.string.error_torrentfile).colorResource(R.color.crouton_error));
} }
} }
} }
@ -1251,7 +1247,7 @@ public class TorrentsActivity extends ActionBarActivity implements TorrentTasksE
protected void onTaskSucceeded(DaemonTaskSuccessResult result, String successMessage) { protected void onTaskSucceeded(DaemonTaskSuccessResult result, String successMessage) {
// Refresh the screen as well // Refresh the screen as well
refreshScreen(); refreshScreen();
Crouton.showText(this, successMessage, NavigationHelper.CROUTON_INFO_STYLE); SnackbarManager.show(Snackbar.with(this).text(successMessage));
} }
@UiThread @UiThread
@ -1259,7 +1255,7 @@ public class TorrentsActivity extends ActionBarActivity implements TorrentTasksE
//noinspection ThrowableResultOfMethodCallIgnored //noinspection ThrowableResultOfMethodCallIgnored
log.i(this, result.getException().toString()); log.i(this, result.getException().toString());
String error = getString(LocalTorrent.getResourceForDaemonException(result.getException())); String error = getString(LocalTorrent.getResourceForDaemonException(result.getException()));
Crouton.showText(this, error, NavigationHelper.CROUTON_ERROR_STYLE); SnackbarManager.show(Snackbar.with(this).text(error).colorResource(R.color.crouton_error));
fragmentTorrents.updateIsLoading(false); fragmentTorrents.updateIsLoading(false);
if (isCritical) { if (isCritical) {
fragmentTorrents.updateError(error); fragmentTorrents.updateError(error);

45
app/src/main/java/org/transdroid/core/gui/TorrentsFragment.java

@ -17,7 +17,11 @@
package org.transdroid.core.gui; package org.transdroid.core.gui;
import android.app.Fragment; import android.app.Fragment;
import android.content.Context;
import android.support.v4.widget.SwipeRefreshLayout; import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.widget.ActionMenuView;
import android.support.v7.widget.Toolbar;
import android.view.ActionMode; import android.view.ActionMode;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
@ -27,6 +31,8 @@ import android.widget.ListView;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.TextView; import android.widget.TextView;
import com.getbase.floatingactionbutton.FloatingActionsMenu;
import org.androidannotations.annotations.AfterViews; import org.androidannotations.annotations.AfterViews;
import org.androidannotations.annotations.Bean; import org.androidannotations.annotations.Bean;
import org.androidannotations.annotations.Click; import org.androidannotations.annotations.Click;
@ -251,13 +257,33 @@ public class TorrentsFragment extends Fragment implements OnLabelPickedListener
private MultiChoiceModeListener onTorrentsSelected = new MultiChoiceModeListener() { private MultiChoiceModeListener onTorrentsSelected = new MultiChoiceModeListener() {
SelectionManagerMode selectionManagerMode; private SelectionManagerMode selectionManagerMode;
private ActionMenuView actionsMenu;
private Toolbar actionsToolbar;
private FloatingActionsMenu addmenuButton;
@Override @Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) { public boolean onCreateActionMode(final ActionMode mode, Menu menu) {
// Show contextual action bar to start/stop/remove/etc. torrents in batch mode // Show contextual action bars to start/stop/remove/etc. torrents in batch mode
mode.getMenuInflater().inflate(R.menu.fragment_torrents_cab, menu); if (actionsMenu == null) {
selectionManagerMode = new SelectionManagerMode(torrentsList, R.plurals.navigation_torrentsselected); actionsMenu = ((TorrentsActivity) getActivity()).contextualMenu;
actionsToolbar = ((TorrentsActivity) getActivity()).actionsToolbar;
addmenuButton = ((TorrentsActivity) getActivity()).addmenuButton;
}
actionsToolbar.setEnabled(false);
actionsMenu.setVisibility(View.VISIBLE);
addmenuButton.setVisibility(View.GONE);
actionsMenu.setOnMenuItemClickListener(new ActionMenuView.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem menuItem) {
return onActionItemClicked(mode, menuItem);
}
});
if (actionsMenu.getMenu().size() == 0) {
getActivity().getMenuInflater().inflate(R.menu.fragment_torrents_cab, actionsMenu.getMenu());
}
Context themedContext = ((ActionBarActivity) getActivity()).getSupportActionBar().getThemedContext();
selectionManagerMode = new SelectionManagerMode(themedContext, torrentsList, R.plurals.navigation_torrentsselected);
selectionManagerMode.onCreateActionMode(mode, menu); selectionManagerMode.onCreateActionMode(mode, menu);
return true; return true;
} }
@ -267,9 +293,9 @@ public class TorrentsFragment extends Fragment implements OnLabelPickedListener
selectionManagerMode.onPrepareActionMode(mode, menu); selectionManagerMode.onPrepareActionMode(mode, menu);
// Hide/show options depending on the type of server we are connected to // Hide/show options depending on the type of server we are connected to
if (daemonType != null) { if (daemonType != null) {
menu.findItem(R.id.action_start).setVisible(Daemon.supportsStoppingStarting(daemonType)); actionsMenu.getMenu().findItem(R.id.action_start).setVisible(Daemon.supportsStoppingStarting(daemonType));
menu.findItem(R.id.action_stop).setVisible(Daemon.supportsStoppingStarting(daemonType)); actionsMenu.getMenu().findItem(R.id.action_stop).setVisible(Daemon.supportsStoppingStarting(daemonType));
menu.findItem(R.id.action_setlabel).setVisible(Daemon.supportsSetLabel(daemonType)); actionsMenu.getMenu().findItem(R.id.action_setlabel).setVisible(Daemon.supportsSetLabel(daemonType));
} }
// Pause autorefresh // Pause autorefresh
if (getActivity() != null && getActivity() instanceof TorrentsActivity) { if (getActivity() != null && getActivity() instanceof TorrentsActivity) {
@ -352,6 +378,9 @@ public class TorrentsFragment extends Fragment implements OnLabelPickedListener
((TorrentsActivity) getActivity()).startAutoRefresh(); ((TorrentsActivity) getActivity()).startAutoRefresh();
} }
selectionManagerMode.onDestroyActionMode(mode); selectionManagerMode.onDestroyActionMode(mode);
actionsMenu.setVisibility(View.GONE);
actionsToolbar.setEnabled(true);
addmenuButton.setVisibility(View.VISIBLE);
} }
}; };

11
app/src/main/java/org/transdroid/core/gui/navigation/NavigationHelper.java

@ -38,9 +38,6 @@ import org.transdroid.R;
import java.io.IOException; import java.io.IOException;
import de.keyboardsurfer.android.widget.crouton.Crouton;
import de.keyboardsurfer.android.widget.crouton.Style;
/** /**
* Helper for activities to make navigation-related decisions, such as when a device can display a larger, tablet style layout or how to display * Helper for activities to make navigation-related decisions, such as when a device can display a larger, tablet style layout or how to display
* errors. * errors.
@ -50,14 +47,6 @@ import de.keyboardsurfer.android.widget.crouton.Style;
@EBean @EBean
public class NavigationHelper { public class NavigationHelper {
/**
* Use with {@link Crouton#showText(android.app.Activity, int, Style)} (and variants) to display error messages.
*/
public static Style CROUTON_ERROR_STYLE = new Style.Builder().setBackgroundColor(R.color.crouton_error).setTextSize(13).build();
/**
* Use with {@link Crouton#showText(android.app.Activity, int, Style)} (and variants) to display info messages.
*/
public static Style CROUTON_INFO_STYLE = new Style.Builder().setBackgroundColor(R.color.crouton_info).setTextSize(13).build();
private static ImageLoader imageCache; private static ImageLoader imageCache;
@RootContext @RootContext
protected Context context; protected Context context;

14
app/src/main/java/org/transdroid/core/gui/navigation/SelectionManagerMode.java

@ -19,6 +19,7 @@ package org.transdroid.core.gui.navigation;
import org.transdroid.core.gui.navigation.SelectionModificationSpinner.OnModificationActionSelectedListener; import org.transdroid.core.gui.navigation.SelectionModificationSpinner.OnModificationActionSelectedListener;
import org.transdroid.daemon.Finishable; import org.transdroid.daemon.Finishable;
import android.content.Context;
import android.util.SparseBooleanArray; import android.util.SparseBooleanArray;
import android.view.ActionMode; import android.view.ActionMode;
import android.view.Menu; import android.view.Menu;
@ -35,18 +36,21 @@ import android.widget.ListView;
*/ */
public class SelectionManagerMode implements MultiChoiceModeListener, OnModificationActionSelectedListener { public class SelectionManagerMode implements MultiChoiceModeListener, OnModificationActionSelectedListener {
private ListView managedList; private final Context themedContext;
private int titleTemplateResource; private final ListView managedList;
private final int titleTemplateResource;
private Class<?> onlyCheckClass = null; private Class<?> onlyCheckClass = null;
/** /**
* Instantiates the helper by binding it to a specific {@link ListView} and providing the text resource to display * Instantiates the helper by binding it to a specific {@link ListView} and providing the text resource to display
* as title in the spinner. * as title in the spinner.
* @param themedContext The context which is associated with the correct theme to apply when inflating views, i.e. the toolbar context
* @param managedList The list to manage the selection for and execute selection action to * @param managedList The list to manage the selection for and execute selection action to
* @param titleTemplateResource The string resource id to show as the spinners title; the number of selected items * @param titleTemplateResource The string resource id to show as the spinners title; the number of selected items
* will be supplied as numeric formatting argument * will be supplied as numeric formatting argument
*/ */
public SelectionManagerMode(ListView managedList, int titleTemplateResource) { public SelectionManagerMode(Context themedContext, ListView managedList, int titleTemplateResource) {
this.themedContext = themedContext;
this.managedList = managedList; this.managedList = managedList;
this.titleTemplateResource = titleTemplateResource; this.titleTemplateResource = titleTemplateResource;
} }
@ -63,7 +67,7 @@ public class SelectionManagerMode implements MultiChoiceModeListener, OnModifica
@Override @Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) { public boolean onCreateActionMode(ActionMode mode, Menu menu) {
// Allow modification of selection through a spinner // Allow modification of selection through a spinner
SelectionModificationSpinner selectionSpinner = new SelectionModificationSpinner(managedList.getContext()); SelectionModificationSpinner selectionSpinner = new SelectionModificationSpinner(themedContext);
selectionSpinner.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, selectionSpinner.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.MATCH_PARENT)); ViewGroup.LayoutParams.MATCH_PARENT));
selectionSpinner.setOnModificationActionSelectedListener(this); selectionSpinner.setOnModificationActionSelectedListener(this);
@ -85,7 +89,7 @@ public class SelectionManagerMode implements MultiChoiceModeListener, OnModifica
.getCheckedItemPositions().keyAt(i))))) .getCheckedItemPositions().keyAt(i)))))
checkedCount++; checkedCount++;
} }
((SelectionModificationSpinner) mode.getCustomView()).updateTitle(managedList.getContext().getResources() ((SelectionModificationSpinner) mode.getCustomView()).updateTitle(themedContext.getResources()
.getQuantityString(titleTemplateResource, checkedCount, checkedCount)); .getQuantityString(titleTemplateResource, checkedCount, checkedCount));
} }

69
app/src/main/java/org/transdroid/core/gui/navigation/SetLabelDialog.java

@ -16,13 +16,6 @@
*/ */
package org.transdroid.core.gui.navigation; package org.transdroid.core.gui.navigation;
import java.security.InvalidParameterException;
import java.util.Iterator;
import java.util.List;
import org.transdroid.R;
import org.transdroid.core.gui.lists.SimpleListItem;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Dialog; import android.app.Dialog;
import android.app.DialogFragment; import android.app.DialogFragment;
@ -34,7 +27,16 @@ import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener; import android.widget.AdapterView.OnItemClickListener;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ListView; import android.widget.ListView;
import de.keyboardsurfer.android.widget.crouton.Crouton;
import com.nispok.snackbar.Snackbar;
import com.nispok.snackbar.SnackbarManager;
import org.transdroid.R;
import org.transdroid.core.gui.lists.SimpleListItem;
import java.security.InvalidParameterException;
import java.util.Iterator;
import java.util.List;
/** /**
* A dialog fragment that allows picking a label or entering a new label to set this new label to the torrent. * A dialog fragment that allows picking a label or entering a new label to set this new label to the torrent.
@ -60,16 +62,17 @@ public class SetLabelDialog extends DialogFragment {
} }
/** /**
* Sets the list of currently known labels as are active on the server. These are offered to the user to pick a new * Sets the list of currently known labels as are active on the server. These are offered to the user to pick a new label for the target
* label for the target torrents. * torrents.
* @param currentLabels The list of torrent labels * @param currentLabels The list of torrent labels
* @return This dialog, for method chaining * @return This dialog, for method chaining
*/ */
public SetLabelDialog setCurrentLabels(List<Label> currentLabels) { public SetLabelDialog setCurrentLabels(List<Label> currentLabels) {
// Discard the empty label in this list before storing it locally // Discard the empty label in this list before storing it locally
for (Iterator<Label> iter = currentLabels.iterator(); iter.hasNext();) { for (Iterator<Label> iter = currentLabels.iterator(); iter.hasNext(); ) {
if (iter.next().isEmptyLabel()) if (iter.next().isEmptyLabel()) {
iter.remove(); iter.remove();
}
} }
this.currentLabels = currentLabels; this.currentLabels = currentLabels;
return this; return this;
@ -77,12 +80,13 @@ public class SetLabelDialog extends DialogFragment {
@Override @Override
public Dialog onCreateDialog(Bundle savedInstanceState) { public Dialog onCreateDialog(Bundle savedInstanceState) {
if (onLabelPickedListener == null) if (onLabelPickedListener == null) {
throw new InvalidParameterException( throw new InvalidParameterException("Please first set the callback listener using setOnLabelPickedListener before opening the dialog.");
"Please first set the callback listener using setOnLabelPickedListener before opening the dialog."); }
if (currentLabels == null) if (currentLabels == null) {
throw new InvalidParameterException( throw new InvalidParameterException(
"Please first set the list of currently known labels before opening the dialog, even if the list is empty."); "Please first set the list of currently known labels before opening the dialog, even if the list is empty.");
}
final View setlabelFrame = getActivity().getLayoutInflater().inflate(R.layout.dialog_setlabel, null, false); final View setlabelFrame = getActivity().getLayoutInflater().inflate(R.layout.dialog_setlabel, null, false);
final ListView labelsList = (ListView) setlabelFrame.findViewById(R.id.labels_list); final ListView labelsList = (ListView) setlabelFrame.findViewById(R.id.labels_list);
final EditText newlabelEdit = (EditText) setlabelFrame.findViewById(R.id.newlabel_edit); final EditText newlabelEdit = (EditText) setlabelFrame.findViewById(R.id.newlabel_edit);
@ -102,23 +106,22 @@ public class SetLabelDialog extends DialogFragment {
} }
}); });
} }
return new AlertDialog.Builder(getActivity()).setView(setlabelFrame) return new AlertDialog.Builder(getActivity()).setView(setlabelFrame).setPositiveButton(R.string.status_update, new OnClickListener() {
.setPositiveButton(R.string.status_update, new OnClickListener() { @Override
@Override public void onClick(DialogInterface dialog, int which) {
public void onClick(DialogInterface dialog, int which) { // User should have provided a new label
// User should have provided a new label if (newlabelEdit.getText().toString().equals("")) {
if (newlabelEdit.getText().toString().equals("")) { SnackbarManager.show(Snackbar.with(getActivity()).text(R.string.error_notalabel).colorResource(R.color.crouton_error));
Crouton.showText(getActivity(), R.string.error_notalabel, return;
NavigationHelper.CROUTON_ERROR_STYLE); }
} onLabelPickedListener.onLabelPicked(newlabelEdit.getText().toString());
onLabelPickedListener.onLabelPicked(newlabelEdit.getText().toString()); }
} }).setNeutralButton(R.string.status_label_remove, new OnClickListener() {
}).setNeutralButton(R.string.status_label_remove, new OnClickListener() { @Override
@Override public void onClick(DialogInterface dialog, int which) {
public void onClick(DialogInterface dialog, int which) { onLabelPickedListener.onLabelPicked(null);
onLabelPickedListener.onLabelPicked(null); }
} }).setNegativeButton(android.R.string.cancel, null).show();
}).setNegativeButton(android.R.string.cancel, null).show();
} }
public interface OnLabelPickedListener { public interface OnLabelPickedListener {

4
app/src/main/java/org/transdroid/core/gui/rss/RssfeedView.java

@ -38,7 +38,7 @@ import org.transdroid.core.gui.navigation.NavigationHelper;
@EViewGroup(R.layout.list_item_rssfeed) @EViewGroup(R.layout.list_item_rssfeed)
public class RssfeedView extends LinearLayout { public class RssfeedView extends LinearLayout {
private static final String GETFVO_URL = "http://g.etfv.co/%1$s"; private static final String GRABICON_URL = "http://grabicon.com/icon?origin=www.transdroid.org&domain=%1$s";
@Bean @Bean
protected NavigationHelper navigationHelper; protected NavigationHelper navigationHelper;
@ -71,7 +71,7 @@ public class RssfeedView extends LinearLayout {
// Clear and then asynchronously load the RSS feed site' favicon // Clear and then asynchronously load the RSS feed site' favicon
// Uses the g.etfv.co service to resolve the favicon of any feed URL // Uses the g.etfv.co service to resolve the favicon of any feed URL
faviconImage.setImageDrawable(null); faviconImage.setImageDrawable(null);
navigationHelper.getImageCache().displayImage(String.format(GETFVO_URL, rssfeedLoader.getSetting().getUrl()), faviconImage); navigationHelper.getImageCache().displayImage(String.format(GRABICON_URL, rssfeedLoader.getSetting().getUrl()), faviconImage);
} }

9
app/src/main/java/org/transdroid/core/gui/rss/RssfeedsActivity.java

@ -25,6 +25,9 @@ import android.support.v7.app.ActionBarActivity;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.text.TextUtils; import android.text.TextUtils;
import com.nispok.snackbar.Snackbar;
import com.nispok.snackbar.SnackbarManager;
import org.androidannotations.annotations.AfterViews; import org.androidannotations.annotations.AfterViews;
import org.androidannotations.annotations.Background; import org.androidannotations.annotations.Background;
import org.androidannotations.annotations.Bean; import org.androidannotations.annotations.Bean;
@ -47,8 +50,6 @@ import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import de.keyboardsurfer.android.widget.crouton.Crouton;
@EActivity(R.layout.activity_rssfeeds) @EActivity(R.layout.activity_rssfeeds)
public class RssfeedsActivity extends ActionBarActivity { public class RssfeedsActivity extends ActionBarActivity {
@ -167,11 +168,11 @@ public class RssfeedsActivity extends ActionBarActivity {
// Error message or not yet loaded? Show a toast message instead of opening the items activity // Error message or not yet loaded? Show a toast message instead of opening the items activity
if (loader.hasError()) { if (loader.hasError()) {
Crouton.showText(this, R.string.rss_error, NavigationHelper.CROUTON_INFO_STYLE); SnackbarManager.show(Snackbar.with(this).text(R.string.rss_error).colorResource(R.color.crouton_error));
return; return;
} }
if (loader.getChannel() == null || loader.getChannel().getItems().size() == 0) { if (loader.getChannel() == null || loader.getChannel().getItems().size() == 0) {
Crouton.showText(this, R.string.rss_notloaded, NavigationHelper.CROUTON_INFO_STYLE); SnackbarManager.show(Snackbar.with(this).text(R.string.rss_notloaded).colorResource(R.color.crouton_error));
return; return;
} }

12
app/src/main/java/org/transdroid/core/gui/rss/RssitemsFragment.java

@ -27,6 +27,7 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.ActionMode; import android.view.ActionMode;
import android.view.Menu; import android.view.Menu;
@ -37,6 +38,9 @@ import android.widget.ListView;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import com.nispok.snackbar.Snackbar;
import com.nispok.snackbar.SnackbarManager;
import org.androidannotations.annotations.AfterViews; import org.androidannotations.annotations.AfterViews;
import org.androidannotations.annotations.Bean; import org.androidannotations.annotations.Bean;
import org.androidannotations.annotations.EFragment; import org.androidannotations.annotations.EFragment;
@ -45,7 +49,6 @@ import org.androidannotations.annotations.ItemClick;
import org.androidannotations.annotations.ViewById; import org.androidannotations.annotations.ViewById;
import org.transdroid.R; import org.transdroid.R;
import org.transdroid.core.gui.TorrentsActivity_; 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.navigation.SelectionManagerMode;
import org.transdroid.core.gui.search.SearchActivity_; import org.transdroid.core.gui.search.SearchActivity_;
import org.transdroid.core.rssparser.Channel; import org.transdroid.core.rssparser.Channel;
@ -54,8 +57,6 @@ import org.transdroid.core.rssparser.Item;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import de.keyboardsurfer.android.widget.crouton.Crouton;
/** /**
* Fragment that lists the items in a specific RSS feed * Fragment that lists the items in a specific RSS feed
* @author Eric Kok * @author Eric Kok
@ -79,7 +80,8 @@ public class RssitemsFragment extends Fragment {
public boolean onCreateActionMode(ActionMode mode, Menu menu) { public boolean onCreateActionMode(ActionMode mode, Menu menu) {
// Show contextual action bar to add items in batch mode // Show contextual action bar to add items in batch mode
mode.getMenuInflater().inflate(R.menu.fragment_rssitems_cab, menu); mode.getMenuInflater().inflate(R.menu.fragment_rssitems_cab, menu);
selectionManagerMode = new SelectionManagerMode(rssitemsList, R.plurals.rss_itemsselected); Context themedContext = ((ActionBarActivity) getActivity()).getSupportActionBar().getThemedContext();
selectionManagerMode = new SelectionManagerMode(themedContext, rssitemsList, R.plurals.rss_itemsselected);
selectionManagerMode.onCreateActionMode(mode, menu); selectionManagerMode.onCreateActionMode(mode, menu);
return true; return true;
} }
@ -153,7 +155,7 @@ public class RssitemsFragment extends Fragment {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(first.getLink()))); startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(first.getLink())));
} else { } else {
// No URL was specified in the RSS feed item link tag (or no link tag was present) // 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); SnackbarManager.show(Snackbar.with(getActivity()).text(R.string.error_no_link).colorResource(R.color.crouton_error));
} }
} else if (itemId == R.id.action_useassearch) { } else if (itemId == R.id.action_useassearch) {
// Use the RSS item title to start a new search (mimicking the search manager style) // Use the RSS item title to start a new search (mimicking the search manager style)

8
app/src/main/java/org/transdroid/core/gui/search/SearchActivity.java

@ -25,6 +25,7 @@ import android.os.Bundle;
import android.provider.SearchRecentSuggestions; import android.provider.SearchRecentSuggestions;
import android.support.v7.app.ActionBar; import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBarActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
@ -62,6 +63,8 @@ import java.util.List;
@OptionsMenu(R.menu.activity_search) @OptionsMenu(R.menu.activity_search)
public class SearchActivity extends ActionBarActivity implements ActionBar.OnNavigationListener { public class SearchActivity extends ActionBarActivity implements ActionBar.OnNavigationListener {
@ViewById
protected Toolbar searchToolbar;
@FragmentById(R.id.searchresults_fragment) @FragmentById(R.id.searchresults_fragment)
protected SearchResultsFragment fragmentResults; protected SearchResultsFragment fragmentResults;
@ViewById @ViewById
@ -125,6 +128,7 @@ public class SearchActivity extends ActionBarActivity implements ActionBar.OnNav
} }
// Allow site selection via list (on large screens) or action bar spinner // Allow site selection via list (on large screens) or action bar spinner
setSupportActionBar(searchToolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
if (searchsitesList != null) { if (searchsitesList != null) {
// The current layout has a dedicated list view to select the search site // The current layout has a dedicated list view to select the search site
@ -140,7 +144,7 @@ public class SearchActivity extends ActionBarActivity implements ActionBar.OnNav
// Use the action bar spinner to select sites // Use the action bar spinner to select sites
getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
getSupportActionBar().setDisplayShowTitleEnabled(false); getSupportActionBar().setDisplayShowTitleEnabled(false);
getSupportActionBar().setListNavigationCallbacks(new SearchSettingsDropDownAdapter(this, searchSites), this); getSupportActionBar().setListNavigationCallbacks(new SearchSettingsDropDownAdapter(searchToolbar.getContext(), searchSites), this);
// Select the last used site; this also starts the search! // Select the last used site; this also starts the search!
if (lastUsedPosition >= 0) { if (lastUsedPosition >= 0) {
getSupportActionBar().setSelectedNavigationItem(lastUsedPosition); getSupportActionBar().setSelectedNavigationItem(lastUsedPosition);
@ -155,7 +159,7 @@ public class SearchActivity extends ActionBarActivity implements ActionBar.OnNav
if (navigationHelper.enableSearchUi()) { if (navigationHelper.enableSearchUi()) {
// Add an expandable SearchView to the action bar // Add an expandable SearchView to the action bar
MenuItem item = menu.findItem(R.id.action_search); MenuItem item = menu.findItem(R.id.action_search);
final SearchView searchView = new SearchView(this); final SearchView searchView = new SearchView(searchToolbar.getContext());
searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
searchView.setQueryRefinementEnabled(true); searchView.setQueryRefinementEnabled(true);
item.setActionView(searchView); item.setActionView(searchView);

2
app/src/main/java/org/transdroid/core/gui/search/SearchHistoryProvider.java

@ -28,7 +28,7 @@ import org.transdroid.BuildConfig;
*/ */
public class SearchHistoryProvider extends SearchRecentSuggestionsProvider { public class SearchHistoryProvider extends SearchRecentSuggestionsProvider {
public final static String AUTHORITY = BuildConfig.PACKAGE_NAME + ".search.SearchHistoryProvider"; public final static String AUTHORITY = BuildConfig.APPLICATION_ID + ".search.SearchHistoryProvider";
public final static int MODE = DATABASE_MODE_QUERIES; public final static int MODE = DATABASE_MODE_QUERIES;
public SearchHistoryProvider() { public SearchHistoryProvider() {

13
app/src/main/java/org/transdroid/core/gui/search/SearchResultsFragment.java

@ -17,8 +17,10 @@
package org.transdroid.core.gui.search; package org.transdroid.core.gui.search;
import android.app.Fragment; import android.app.Fragment;
import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import android.support.v7.app.ActionBarActivity;
import android.view.ActionMode; import android.view.ActionMode;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
@ -29,6 +31,9 @@ import android.widget.ProgressBar;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import com.nispok.snackbar.Snackbar;
import com.nispok.snackbar.SnackbarManager;
import org.androidannotations.annotations.AfterViews; import org.androidannotations.annotations.AfterViews;
import org.androidannotations.annotations.Background; import org.androidannotations.annotations.Background;
import org.androidannotations.annotations.Bean; import org.androidannotations.annotations.Bean;
@ -44,15 +49,12 @@ import org.transdroid.core.app.search.SearchResult;
import org.transdroid.core.app.search.SearchSite; import org.transdroid.core.app.search.SearchSite;
import org.transdroid.core.app.settings.SystemSettings_; import org.transdroid.core.app.settings.SystemSettings_;
import org.transdroid.core.gui.TorrentsActivity_; import org.transdroid.core.gui.TorrentsActivity_;
import org.transdroid.core.gui.navigation.NavigationHelper;
import org.transdroid.core.gui.navigation.NavigationHelper_; import org.transdroid.core.gui.navigation.NavigationHelper_;
import org.transdroid.core.gui.navigation.SelectionManagerMode; import org.transdroid.core.gui.navigation.SelectionManagerMode;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import de.keyboardsurfer.android.widget.crouton.Crouton;
/** /**
* Fragment that lists the items in a specific RSS feed * Fragment that lists the items in a specific RSS feed
* @author Eric Kok * @author Eric Kok
@ -129,7 +131,7 @@ public class SearchResultsFragment extends Fragment {
@ItemClick(R.id.searchresults_list) @ItemClick(R.id.searchresults_list)
protected void onItemClicked(SearchResult item) { protected void onItemClicked(SearchResult item) {
if (item.getTorrentUrl() == null) { if (item.getTorrentUrl() == null) {
Crouton.showText(getActivity(), R.string.error_notorrentfile, NavigationHelper.CROUTON_ERROR_STYLE); SnackbarManager.show(Snackbar.with(getActivity()).text(R.string.error_notorrentfile).colorResource(R.color.crouton_error));
return; return;
} }
// Don't broadcast this intent; we can safely assume this is intended for Transdroid only // Don't broadcast this intent; we can safely assume this is intended for Transdroid only
@ -150,7 +152,8 @@ public class SearchResultsFragment extends Fragment {
public boolean onCreateActionMode(ActionMode mode, Menu menu) { public boolean onCreateActionMode(ActionMode mode, Menu menu) {
// Show contextual action bar to add items in batch mode // Show contextual action bar to add items in batch mode
mode.getMenuInflater().inflate(R.menu.fragment_searchresults_cab, menu); mode.getMenuInflater().inflate(R.menu.fragment_searchresults_cab, menu);
selectionManagerMode = new SelectionManagerMode(resultsList, R.plurals.search_resutlsselected); Context themedContext = ((ActionBarActivity) getActivity()).getSupportActionBar().getThemedContext();
selectionManagerMode = new SelectionManagerMode(themedContext, resultsList, R.plurals.search_resutlsselected);
selectionManagerMode.onCreateActionMode(mode, menu); selectionManagerMode.onCreateActionMode(mode, menu);
return true; return true;
} }

43
app/src/main/java/org/transdroid/core/gui/settings/SystemSettingsActivity.java

@ -32,6 +32,9 @@ import android.preference.PreferenceActivity;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.text.TextUtils; import android.text.TextUtils;
import com.nispok.snackbar.Snackbar;
import com.nispok.snackbar.SnackbarManager;
import org.androidannotations.annotations.Bean; import org.androidannotations.annotations.Bean;
import org.androidannotations.annotations.EActivity; import org.androidannotations.annotations.EActivity;
import org.androidannotations.annotations.OnActivityResult; import org.androidannotations.annotations.OnActivityResult;
@ -49,8 +52,6 @@ import org.transdroid.core.service.BootReceiver;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import de.keyboardsurfer.android.widget.crouton.Crouton;
@EActivity @EActivity
public class SystemSettingsActivity extends PreferenceActivity { public class SystemSettingsActivity extends PreferenceActivity {
@ -95,8 +96,7 @@ public class SystemSettingsActivity extends PreferenceActivity {
@Override @Override
public boolean onPreferenceClick(Preference preference) { public boolean onPreferenceClick(Preference preference) {
SearchHistoryProvider.clearHistory(getApplicationContext()); SearchHistoryProvider.clearHistory(getApplicationContext());
Crouton.showText(SystemSettingsActivity.this, R.string.pref_clearsearch_success, SnackbarManager.show(Snackbar.with(SystemSettingsActivity.this).text(R.string.pref_clearsearch_success));
NavigationHelper.CROUTON_INFO_STYLE);
return true; return true;
} }
}; };
@ -106,15 +106,13 @@ public class SystemSettingsActivity extends PreferenceActivity {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(SystemSettingsActivity.this); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(SystemSettingsActivity.this);
try { try {
settingsPersistence.importSettingsFromFile(prefs, SettingsPersistence.DEFAULT_SETTINGS_FILE); settingsPersistence.importSettingsFromFile(prefs, SettingsPersistence.DEFAULT_SETTINGS_FILE);
Crouton.showText(SystemSettingsActivity.this, R.string.pref_import_success, SnackbarManager.show(Snackbar.with(SystemSettingsActivity.this).text(R.string.pref_import_success));
NavigationHelper.CROUTON_INFO_STYLE);
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
Crouton.showText(SystemSettingsActivity.this, R.string.error_file_not_found, SnackbarManager
NavigationHelper.CROUTON_ERROR_STYLE); .show(Snackbar.with(SystemSettingsActivity.this).text(R.string.error_file_not_found).colorResource(R.color.crouton_error));
} catch (JSONException e) { } catch (JSONException e) {
Crouton.showText(SystemSettingsActivity.this, SnackbarManager.show(Snackbar.with(SystemSettingsActivity.this)
getString(R.string.error_no_valid_settings_file, getString(R.string.app_name)), .text(getString(R.string.error_no_valid_settings_file, getString(R.string.app_name))).colorResource(R.color.crouton_error));
NavigationHelper.CROUTON_ERROR_STYLE);
} }
} }
}; };
@ -130,14 +128,10 @@ public class SystemSettingsActivity extends PreferenceActivity {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(SystemSettingsActivity.this); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(SystemSettingsActivity.this);
try { try {
settingsPersistence.exportSettingsToFile(prefs, SettingsPersistence.DEFAULT_SETTINGS_FILE); settingsPersistence.exportSettingsToFile(prefs, SettingsPersistence.DEFAULT_SETTINGS_FILE);
Crouton.showText(SystemSettingsActivity.this, R.string.pref_export_success, SnackbarManager.show(Snackbar.with(SystemSettingsActivity.this).text(R.string.pref_export_success));
NavigationHelper.CROUTON_INFO_STYLE); } catch (JSONException | IOException e) {
} catch (JSONException e) { SnackbarManager.show(Snackbar.with(SystemSettingsActivity.this).text(R.string.error_cant_write_settings_file)
Crouton.showText(SystemSettingsActivity.this, R.string.error_cant_write_settings_file, .colorResource(R.color.crouton_error));
NavigationHelper.CROUTON_ERROR_STYLE);
} catch (IOException e) {
Crouton.showText(SystemSettingsActivity.this, R.string.error_cant_write_settings_file,
NavigationHelper.CROUTON_ERROR_STYLE);
} }
} }
}; };
@ -149,8 +143,8 @@ public class SystemSettingsActivity extends PreferenceActivity {
String settings = settingsPersistence.exportSettingsAsString(prefs); String settings = settingsPersistence.exportSettingsAsString(prefs);
BarcodeHelper.shareContentBarcode(SystemSettingsActivity.this, settings); BarcodeHelper.shareContentBarcode(SystemSettingsActivity.this, settings);
} catch (JSONException e) { } catch (JSONException e) {
Crouton.showText(SystemSettingsActivity.this, R.string.error_cant_write_settings_file, SnackbarManager.show(Snackbar.with(SystemSettingsActivity.this).text(R.string.error_cant_write_settings_file)
NavigationHelper.CROUTON_ERROR_STYLE); .colorResource(R.color.crouton_error));
} }
} }
}; };
@ -191,11 +185,10 @@ public class SystemSettingsActivity extends PreferenceActivity {
if (formatName != null && formatName.equals("QR_CODE") && !TextUtils.isEmpty(contents)) { if (formatName != null && formatName.equals("QR_CODE") && !TextUtils.isEmpty(contents)) {
try { try {
settingsPersistence.importSettingsAsString(prefs, contents); settingsPersistence.importSettingsAsString(prefs, contents);
Crouton.showText(SystemSettingsActivity.this, R.string.pref_import_success, SnackbarManager.show(Snackbar.with(SystemSettingsActivity.this).text(R.string.pref_import_success));
NavigationHelper.CROUTON_INFO_STYLE);
} catch (JSONException e) { } catch (JSONException e) {
Crouton.showText(SystemSettingsActivity.this, R.string.error_file_not_found, SnackbarManager
NavigationHelper.CROUTON_ERROR_STYLE); .show(Snackbar.with(SystemSettingsActivity.this).text(R.string.error_file_not_found).colorResource(R.color.crouton_error));
} }
} }
} }

46
app/src/main/java/org/transdroid/core/seedbox/XirvikSharedSettingsActivity.java

@ -16,7 +16,18 @@
*/ */
package org.transdroid.core.seedbox; package org.transdroid.core.seedbox;
import java.io.InputStream; import android.annotation.TargetApi;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.preference.EditTextPreference;
import android.preference.PreferenceManager;
import com.nispok.snackbar.Snackbar;
import com.nispok.snackbar.SnackbarManager;
import org.androidannotations.annotations.Bean; import org.androidannotations.annotations.Bean;
import org.androidannotations.annotations.EActivity; import org.androidannotations.annotations.EActivity;
@ -27,25 +38,15 @@ import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.impl.client.DefaultHttpClient;
import org.transdroid.R; import org.transdroid.R;
import org.transdroid.core.gui.log.Log; import org.transdroid.core.gui.log.Log;
import org.transdroid.core.gui.navigation.NavigationHelper;
import org.transdroid.core.gui.settings.KeyBoundPreferencesActivity; import org.transdroid.core.gui.settings.KeyBoundPreferencesActivity;
import org.transdroid.core.gui.settings.*; import org.transdroid.core.gui.settings.MainSettingsActivity_;
import org.transdroid.daemon.util.HttpHelper; import org.transdroid.daemon.util.HttpHelper;
import android.annotation.TargetApi; import java.io.InputStream;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.preference.EditTextPreference;
import android.preference.PreferenceManager;
import de.keyboardsurfer.android.widget.crouton.Crouton;
/** /**
* Activity that allows for the configuration of a Xirvik shared seedbox. The key can be supplied to update an existing * Activity that allows for the configuration of a Xirvik shared seedbox. The key can be supplied to update an existing server setting instead of
* server setting instead of creating a new one. * creating a new one.
* @author Eric Kok * @author Eric Kok
*/ */
@EActivity @EActivity
@ -63,8 +64,7 @@ public class XirvikSharedSettingsActivity extends KeyBoundPreferencesActivity {
// Load the raw preferences to show in this screen // Load the raw preferences to show in this screen
init(R.xml.pref_seedbox_xirvikshared, init(R.xml.pref_seedbox_xirvikshared,
SeedboxProvider.XirvikShared.getSettings().getMaxSeedboxOrder( SeedboxProvider.XirvikShared.getSettings().getMaxSeedboxOrder(PreferenceManager.getDefaultSharedPreferences(this)));
PreferenceManager.getDefaultSharedPreferences(this)));
initTextPreference("seedbox_xirvikshared_name"); initTextPreference("seedbox_xirvikshared_name");
initTextPreference("seedbox_xirvikshared_server"); initTextPreference("seedbox_xirvikshared_server");
initTextPreference("seedbox_xirvikshared_user"); initTextPreference("seedbox_xirvikshared_user");
@ -82,15 +82,14 @@ public class XirvikSharedSettingsActivity extends KeyBoundPreferencesActivity {
try { try {
// When the shared server settings change, we also have to update the RPC mount point to use // When the shared server settings change, we also have to update the RPC mount point to use
SharedPreferences prefs = PreferenceManager SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(XirvikSharedSettingsActivity.this);
.getDefaultSharedPreferences(XirvikSharedSettingsActivity.this);
String server = prefs.getString("seedbox_xirvikshared_server_" + key, null); String server = prefs.getString("seedbox_xirvikshared_server_" + key, null);
String user = prefs.getString("seedbox_xirvikshared_user_" + key, null); String user = prefs.getString("seedbox_xirvikshared_user_" + key, null);
String pass = prefs.getString("seedbox_xirvikshared_pass_" + key, null); String pass = prefs.getString("seedbox_xirvikshared_pass_" + key, null);
// Retrieve the RPC mount point setting from the server itself // Retrieve the RPC mount point setting from the server itself
DefaultHttpClient httpclient = HttpHelper.createStandardHttpClient(true, user, pass, true, null, DefaultHttpClient httpclient =
HttpHelper.DEFAULT_CONNECTION_TIMEOUT, server, 443); HttpHelper.createStandardHttpClient(true, user, pass, true, null, HttpHelper.DEFAULT_CONNECTION_TIMEOUT, server, 443);
String url = "https://" + server + ":443/browsers_addons/transdroid_autoconf.txt"; String url = "https://" + server + ":443/browsers_addons/transdroid_autoconf.txt";
HttpResponse request = httpclient.execute(new HttpGet(url)); HttpResponse request = httpclient.execute(new HttpGet(url));
InputStream stream = request.getEntity().getContent(); InputStream stream = request.getEntity().getContent();
@ -103,8 +102,7 @@ public class XirvikSharedSettingsActivity extends KeyBoundPreferencesActivity {
} catch (Exception e) { } catch (Exception e) {
log.d(XirvikSharedSettingsActivity.this, log.d(XirvikSharedSettingsActivity.this, "Could not retrieve the Xirvik shared seedbox RPC mount point setting: " + e.toString());
"Could not retrieve the Xirvik shared seedbox RPC mount point setting: " + e.toString());
return null; return null;
} }
@ -123,7 +121,7 @@ public class XirvikSharedSettingsActivity extends KeyBoundPreferencesActivity {
Editor edit = PreferenceManager.getDefaultSharedPreferences(XirvikSharedSettingsActivity.this).edit(); Editor edit = PreferenceManager.getDefaultSharedPreferences(XirvikSharedSettingsActivity.this).edit();
EditTextPreference pref = (EditTextPreference) findPreference("seedbox_xirvikshared_rpc_" + key); EditTextPreference pref = (EditTextPreference) findPreference("seedbox_xirvikshared_rpc_" + key);
if (result == null) { if (result == null) {
Crouton.showText(this, R.string.pref_seedbox_xirviknofolder, NavigationHelper.CROUTON_ERROR_STYLE); SnackbarManager.show(Snackbar.with(this).text(R.string.pref_seedbox_xirviknofolder).colorResource(R.color.crouton_error));
edit.remove("seedbox_xirvikshared_rpc_" + key); edit.remove("seedbox_xirvikshared_rpc_" + key);
pref.setSummary(""); pref.setSummary("");
} else { } else {

BIN
app/src/main/res/drawable-hdpi/btn_cab_done_default_transdroid2.9.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 B

BIN
app/src/main/res/drawable-hdpi/btn_cab_done_focused_transdroid2.9.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 118 B

BIN
app/src/main/res/drawable-hdpi/btn_cab_done_pressed_transdroid2.9.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 118 B

BIN
app/src/main/res/drawable-hdpi/ic_action_copy.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 287 B

BIN
app/src/main/res/drawable-hdpi/ic_action_download.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 277 B

BIN
app/src/main/res/drawable-hdpi/ic_action_filter.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 B

0
app/src/main/res/drawable-hdpi/ic_action_rss.png.png → app/src/main/res/drawable-hdpi/ic_action_rss.png

Before

Width:  |  Height:  |  Size: 759 B

After

Width:  |  Height:  |  Size: 759 B

BIN
app/src/main/res/drawable-hdpi/ic_action_turtle_disabled_light.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

BIN
app/src/main/res/drawable-hdpi/ic_btn_sort.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 209 B

BIN
app/src/main/res/drawable-xhdpi/btn_cab_done_default_transdroid2.9.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 120 B

BIN
app/src/main/res/drawable-xhdpi/btn_cab_done_focused_transdroid2.9.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 B

BIN
app/src/main/res/drawable-xhdpi/btn_cab_done_pressed_transdroid2.9.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 B

BIN
app/src/main/res/drawable-xhdpi/ic_action_copy.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 330 B

BIN
app/src/main/res/drawable-xhdpi/ic_action_download.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 282 B

BIN
app/src/main/res/drawable-xhdpi/ic_action_filter.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 202 B

BIN
app/src/main/res/drawable-xhdpi/ic_action_info_dark.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

BIN
app/src/main/res/drawable-xhdpi/ic_action_info_light.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

BIN
app/src/main/res/drawable-xhdpi/ic_btn_sort.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 198 B

BIN
app/src/main/res/drawable-xhdpi/ic_storage_white_24dp.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 199 B

BIN
app/src/main/res/drawable-xxhdpi/ic_action_copy.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 436 B

BIN
app/src/main/res/drawable-xxhdpi/ic_action_download.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 351 B

BIN
app/src/main/res/drawable-xxhdpi/ic_action_filter.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 B

BIN
app/src/main/res/drawable-xxhdpi/ic_action_forcerecheck_dark.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

BIN
app/src/main/res/drawable-xxhdpi/ic_action_forcerecheck_light.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

BIN
app/src/main/res/drawable-xxhdpi/ic_action_info_dark.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

BIN
app/src/main/res/drawable-xxhdpi/ic_action_info_light.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

BIN
app/src/main/res/drawable-xxhdpi/ic_action_save_dark.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 495 B

BIN
app/src/main/res/drawable-xxhdpi/ic_action_save_light.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 500 B

0
app/src/main/res/drawable-xxhdpi/ic_btn_sort.png → app/src/main/res/drawable-xxhdpi/ic_action_sort.png

Before

Width:  |  Height:  |  Size: 218 B

After

Width:  |  Height:  |  Size: 218 B

BIN
app/src/main/res/drawable-xxhdpi/ic_insert_link_white_24dp.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 670 B

BIN
app/src/main/res/drawable-xxxhdpi/ic_action_link.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 865 B

BIN
app/src/main/res/drawable-xxxhdpi/ic_action_search.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

BIN
app/src/main/res/drawable-xxxhdpi/ic_action_white.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 269 B

BIN
app/src/main/res/drawable-xxxhdpi/ic_btn_sort.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 253 B

27
app/src/main/res/drawable/btn_cab_done_transdroid2.xml

@ -1,27 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- File created by the Android Action Bar Style Generator
Copyright (C) 2011 The Android Open Source Project
Copyright (C) 2012 readyState Software Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"
android:drawable="@drawable/btn_cab_done_pressed_transdroid2" />
<item android:state_focused="true" android:state_enabled="true"
android:drawable="@drawable/btn_cab_done_focused_transdroid2" />
<item android:state_enabled="true"
android:drawable="@drawable/btn_cab_done_default_transdroid2" />
</selector>

84
app/src/main/res/layout-w600dp/activity_search.xml

@ -15,42 +15,62 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with Transdroid. If not, see <http://www.gnu.org/licenses/>. along with Transdroid. If not, see <http://www.gnu.org/licenses/>.
--> -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="horizontal"
android:baselineAligned="false" android:baselineAligned="false"
tools:context=".SearchActivity" > android:orientation="horizontal"
tools:context=".core.gui.search.SearchActivity_">
<ListView <android.support.v7.widget.Toolbar
android:id="@+id/searchsites_list" android:id="@+id/search_toolbar"
android:layout_width="0dip" style="@style/DefaultToolbar"
android:layout_height="match_parent" android:layout_width="match_parent"
android:layout_weight="1" android:layout_height="wrap_content"
android:choiceMode="singleChoice" android:minHeight="?attr/actionBarSize" />
android:listSelector="?attr/activatable_background" />
<LinearLayout
<fragment android:layout_width="match_parent"
android:id="@+id/searchresults_fragment"
android:layout_width="0dip"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="2" android:layout_below="@id/search_toolbar"
class="org.transdroid.core.gui.search.SearchResultsFragment_" android:orientation="horizontal">
tools:layout="@layout/fragment_searchresults" />
<TextView <ListView
android:id="@+id/installmodule_text" android:id="@+id/searchsites_list"
android:layout_width="wrap_content" android:layout_width="0dip"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:layout_gravity="center" android:layout_weight="1"
android:drawablePadding="8dip" android:choiceMode="singleChoice"
android:drawableTop="?attr/loading_progress" android:listSelector="?attr/activatable_background"
android:gravity="center" tools:listitem="@layout/list_item_searchsite" />
android:maxWidth="400dip"
android:padding="@dimen/margin_default" <fragment
android:text="@string/search_installsearch" android:id="@+id/searchresults_fragment"
android:textIsSelectable="false" class="org.transdroid.core.gui.search.SearchResultsFragment_"
android:visibility="gone" /> android:layout_width="0dip"
android:layout_height="match_parent"
</LinearLayout> android:layout_weight="2"
tools:layout="@layout/fragment_searchresults" />
<TextView
android:id="@+id/installmodule_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:drawablePadding="8dip"
android:drawableTop="?attr/loading_progress"
android:gravity="center"
android:maxWidth="400dip"
android:padding="@dimen/margin_default"
android:text="@string/search_installsearch"
android:textIsSelectable="false"
android:visibility="gone" />
</LinearLayout>
<View
style="@style/DefaultToolbarShadow"
android:layout_below="@id/search_toolbar" />
</RelativeLayout>

20
app/src/main/res/layout-w600dp/activity_torrents.xml

@ -37,7 +37,19 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:minHeight="?attr/actionBarSize" /> android:minHeight="?attr/actionBarSize"
android:paddingEnd="@dimen/ui_actions_padding"
android:paddingRight="@dimen/ui_actions_padding" />
<android.support.v7.widget.ActionMenuView
android:id="@+id/contextual_menu"
style="@style/SplitToolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:minHeight="?attr/actionBarSize"
android:visibility="gone"
tools:visibility="visible" />
<android.support.v7.widget.SearchView <android.support.v7.widget.SearchView
android:id="@+id/filter_search" android:id="@+id/filter_search"
@ -46,7 +58,11 @@
android:layout_above="@id/actions_toolbar" android:layout_above="@id/actions_toolbar"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" android:layout_alignParentStart="true"
android:layout_margin="5dp" android:layout_marginBottom="5dp"
android:layout_marginEnd="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
app:searchIcon="@drawable/ic_action_filter"
app:queryHint="@string/action_filter" app:queryHint="@string/action_filter"
app:iconifiedByDefault="false" /> app:iconifiedByDefault="false" />

22
app/src/main/res/layout-w900dp/activity_torrents.xml

@ -17,8 +17,8 @@
--> -->
<!-- This layout is for 7" and 10" tablets in landscape shows torrents, filters and details. --> <!-- This layout is for 7" and 10" tablets in landscape shows torrents, filters and details. -->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".core.gui.TorrentsActivity_"> tools:context=".core.gui.TorrentsActivity_">
@ -41,9 +41,13 @@
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" android:layout_alignParentStart="true"
android:layout_margin="5dp" android:layout_marginBottom="5dp"
android:layout_marginEnd="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
app:iconifiedByDefault="false"
app:queryHint="@string/action_filter" app:queryHint="@string/action_filter"
app:iconifiedByDefault="false" /> app:searchIcon="@drawable/ic_action_filter" />
<ListView <ListView
android:id="@+id/filters_list" android:id="@+id/filters_list"
@ -78,6 +82,18 @@
android:layout_toStartOf="@id/fragments_divider" android:layout_toStartOf="@id/fragments_divider"
android:minHeight="?attr/actionBarSize" /> android:minHeight="?attr/actionBarSize" />
<android.support.v7.widget.ActionMenuView
android:id="@+id/contextual_toolbar"
style="@style/SplitToolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toLeftOf="@id/fragments_divider"
android:layout_toStartOf="@id/fragments_divider"
android:layout_alignParentBottom="true"
android:minHeight="?attr/actionBarSize"
android:visibility="gone"
tools:visibility="visible" />
<android.support.v7.widget.Toolbar <android.support.v7.widget.Toolbar
android:id="@+id/torrents_toolbar" android:id="@+id/torrents_toolbar"
style="@style/DefaultToolbar" style="@style/DefaultToolbar"

7
app/src/main/res/layout/actionbar_searchsite.xml

@ -19,15 +19,16 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical" android:orientation="vertical"
android:paddingRight="@dimen/margin_half" > android:paddingEnd="@dimen/margin_half"
android:paddingRight="@dimen/margin_half">
<TextView <TextView
android:id="@+id/searchsite_text" android:id="@+id/searchsite_text"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:fontFamily="sans-serif-condensed"
android:textColor="?attr/text_actionbar" android:textColor="?attr/text_actionbar"
android:textIsSelectable="false" android:textIsSelectable="false"
android:textSize="18sp" android:textSize="18sp" />
android:fontFamily="sans-serif-condensed" />
</FrameLayout> </FrameLayout>

58
app/src/main/res/layout/activity_search.xml

@ -15,31 +15,49 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with Transdroid. If not, see <http://www.gnu.org/licenses/>. along with Transdroid. If not, see <http://www.gnu.org/licenses/>.
--> -->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".SearchActivity" > tools:context=".core.gui.search.SearchActivity_">
<fragment <android.support.v7.widget.Toolbar
android:id="@+id/searchresults_fragment" android:id="@+id/search_toolbar"
style="@style/DefaultToolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize" />
<FrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
class="org.transdroid.core.gui.search.SearchResultsFragment_" android:layout_below="@id/search_toolbar">
tools:layout="@layout/fragment_searchresults" />
<TextView <fragment
android:id="@+id/installmodule_text" android:id="@+id/searchresults_fragment"
android:layout_width="wrap_content" class="org.transdroid.core.gui.search.SearchResultsFragment_"
android:layout_height="wrap_content" android:layout_width="match_parent"
android:layout_gravity="center" android:layout_height="match_parent"
android:drawablePadding="8dip" tools:layout="@layout/fragment_searchresults" />
android:drawableTop="?attr/loading_progress"
android:gravity="center" <TextView
android:maxWidth="400dip" android:id="@+id/installmodule_text"
android:padding="@dimen/margin_default" android:layout_width="wrap_content"
android:text="@string/search_installsearch" android:layout_height="wrap_content"
android:textIsSelectable="false" android:layout_gravity="center"
android:visibility="gone" /> android:drawablePadding="8dip"
android:drawableTop="?attr/loading_progress"
android:gravity="center"
android:maxWidth="400dip"
android:padding="@dimen/margin_default"
android:text="@string/search_installsearch"
android:textIsSelectable="false"
android:visibility="gone" />
</FrameLayout>
<View
style="@style/DefaultToolbarShadow"
android:layout_below="@id/search_toolbar" />
</FrameLayout> </RelativeLayout>

25
app/src/main/res/layout/activity_torrents.xml

@ -19,11 +19,11 @@
<android.support.v4.widget.DrawerLayout <android.support.v4.widget.DrawerLayout
android:id="@+id/drawer_layout" android:id="@+id/drawer_layout"
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".core.gui.TorrentsActivity_" tools:context=".core.gui.TorrentsActivity_">
xmlns:app="http://schemas.android.com/apk/res-auto">
<!-- The main content view --> <!-- The main content view -->
<RelativeLayout <RelativeLayout
@ -45,8 +45,18 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:minHeight="?attr/actionBarSize" android:minHeight="?attr/actionBarSize"
android:paddingRight="85dp" android:paddingEnd="@dimen/ui_actions_padding"
android:paddingEnd="85dp" /> android:paddingRight="@dimen/ui_actions_padding" />
<android.support.v7.widget.ActionMenuView
android:id="@+id/contextual_menu"
style="@style/SplitToolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:minHeight="?attr/actionBarSize"
android:visibility="gone"
tools:visibility="visible"/>
<fragment <fragment
android:id="@+id/torrents_fragment" android:id="@+id/torrents_fragment"
@ -101,12 +111,13 @@
android:id="@+id/filter_search" android:id="@+id/filter_search"
android:layout_width="@dimen/ui_filters_list" android:layout_width="@dimen/ui_filters_list"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp" android:layout_marginBottom="5dp"
android:layout_marginEnd="5dp"
android:layout_marginRight="10dp" android:layout_marginRight="10dp"
android:layout_marginEnd="10dp" android:layout_marginTop="5dp"
app:iconifiedByDefault="false"
app:queryHint="@string/action_filter" app:queryHint="@string/action_filter"
app:iconifiedByDefault="false" /> app:searchIcon="@drawable/ic_action_filter" />
</LinearLayout> </LinearLayout>

16
app/src/main/res/layout/fragment_details.xml

@ -31,6 +31,16 @@
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:minHeight="?attr/actionBarSize" /> android:minHeight="?attr/actionBarSize" />
<android.support.v7.widget.ActionMenuView
android:id="@+id/contextual_menu"
style="@style/SplitToolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:minHeight="?attr/actionBarSize"
android:visibility="gone"
tools:visibility="visible"/>
<android.support.v4.widget.SwipeRefreshLayout <android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swipe_refresh_layout" android:id="@+id/swipe_refresh_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -52,12 +62,12 @@
android:id="@+id/loading_progress" android:id="@+id/loading_progress"
android:layout_width="128dp" android:layout_width="128dp"
android:layout_height="128dp" android:layout_height="128dp"
android:layout_gravity="center" android:layout_centerInParent="true"
android:layout_above="@id/details_menu"
android:indeterminate="true" android:indeterminate="true"
android:indeterminateDrawable="?attr/loading_progress" android:indeterminateDrawable="?attr/loading_progress"
android:indeterminateOnly="true" android:indeterminateOnly="true"
android:visibility="gone" /> android:visibility="gone"
tools:visibility="visible" />
<TextView <TextView
android:id="@+id/empty_text" android:id="@+id/empty_text"

9
app/src/main/res/layout/fragment_searchresults.xml

@ -16,15 +16,18 @@
along with Transdroid. If not, see <http://www.gnu.org/licenses/>. along with Transdroid. If not, see <http://www.gnu.org/licenses/>.
--> -->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" > android:layout_height="match_parent">
<ListView <ListView
android:id="@+id/searchresults_list" android:id="@+id/searchresults_list"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:choiceMode="multipleChoiceModal" android:choiceMode="multipleChoiceModal"
android:visibility="gone" /> android:visibility="gone"
tools:listitem="@layout/list_item_searchresult"
tools:visibility="visible" />
<ProgressBar <ProgressBar
android:id="@+id/loading_progress" android:id="@+id/loading_progress"
@ -34,7 +37,7 @@
android:indeterminate="true" android:indeterminate="true"
android:indeterminateDrawable="?attr/loading_progress" android:indeterminateDrawable="?attr/loading_progress"
android:indeterminateOnly="true" /> android:indeterminateOnly="true" />
<TextView <TextView
android:id="@+id/empty_text" android:id="@+id/empty_text"
android:layout_width="wrap_content" android:layout_width="wrap_content"

2
app/src/main/res/layout/list_item_filter.xml

@ -22,7 +22,7 @@
android:paddingBottom="@dimen/margin_half" android:paddingBottom="@dimen/margin_half"
android:paddingLeft="@dimen/margin_default" android:paddingLeft="@dimen/margin_default"
android:paddingRight="@dimen/margin_default" android:paddingRight="@dimen/margin_default"
android:paddingTop="@dimen/margin_half" > android:paddingTop="@dimen/margin_half">
<TextView <TextView
android:id="@+id/item_text" android:id="@+id/item_text"

6
app/src/main/res/layout/list_item_rssfeed.xml

@ -21,16 +21,14 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/activatable_background" android:background="?attr/activatable_background"
android:orientation="horizontal" android:orientation="horizontal"
android:paddingBottom="@dimen/margin_default" android:padding="@dimen/margin_default" >
android:paddingLeft="@dimen/margin_default"
android:paddingRight="@dimen/margin_default"
android:paddingTop="@dimen/margin_default" >
<ImageView <ImageView
android:id="@+id/favicon_image" android:id="@+id/favicon_image"
android:layout_width="24dip" android:layout_width="24dip"
android:layout_height="24dip" android:layout_height="24dip"
android:layout_marginRight="@dimen/margin_default" android:layout_marginRight="@dimen/margin_default"
android:layout_marginEnd="@dimen/margin_default"
android:scaleType="centerCrop" android:scaleType="centerCrop"
tools:src="@drawable/ic_launcher" tools:src="@drawable/ic_launcher"
tools:ignore="contentDescription" /> tools:ignore="contentDescription" />

35
app/src/main/res/layout/list_item_searchresult.xml

@ -16,13 +16,14 @@
along with Transdroid. If not, see <http://www.gnu.org/licenses/>. along with Transdroid. If not, see <http://www.gnu.org/licenses/>.
--> -->
<org.transdroid.core.gui.rss.RssitemStatusLayout xmlns:android="http://schemas.android.com/apk/res/android" <org.transdroid.core.gui.rss.RssitemStatusLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/activatable_background" android:background="?attr/activatable_background"
android:paddingBottom="@dimen/margin_half" android:paddingBottom="@dimen/margin_half"
android:paddingLeft="@dimen/margin_default" android:paddingLeft="@dimen/margin_default"
android:paddingRight="@dimen/margin_default" android:paddingRight="@dimen/margin_default"
android:paddingTop="@dimen/margin_half" > android:paddingTop="@dimen/margin_half">
<TextView <TextView
android:id="@+id/name_text" android:id="@+id/name_text"
@ -31,44 +32,54 @@
android:fontFamily="sans-serif-condensed" android:fontFamily="sans-serif-condensed"
android:textColor="?attr/text_bright" android:textColor="?attr/text_bright"
android:textIsSelectable="false" android:textIsSelectable="false"
android:textSize="@dimen/text_enlarged" /> android:textSize="@dimen/text_enlarged"
tools:text="Torrent.Title.2016.1080p.mkv" />
<TextView <TextView
android:id="@+id/leechers_text" android:id="@+id/leechers_text"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@id/name_text" android:layout_alignParentEnd="true"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_below="@id/name_text"
android:layout_marginTop="4dip" android:layout_marginTop="4dip"
android:textIsSelectable="false" android:textIsSelectable="false"
android:textSize="@dimen/text_small" /> android:textSize="@dimen/text_small"
tools:text="@string/search_seeders" />
<TextView <TextView
android:id="@+id/seeders_text" android:id="@+id/seeders_text"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignBaseline="@id/leechers_text" android:layout_alignBaseline="@id/leechers_text"
android:layout_toLeftOf="@id/leechers_text" android:layout_marginEnd="@dimen/margin_default"
android:layout_marginRight="@dimen/margin_default" android:layout_marginRight="@dimen/margin_default"
android:layout_toLeftOf="@id/leechers_text"
android:layout_toStartOf="@id/leechers_text"
android:textIsSelectable="false" android:textIsSelectable="false"
android:textSize="@dimen/text_small" /> android:textSize="@dimen/text_small"
tools:text="@string/search_leechers" />
<TextView <TextView
android:id="@+id/size_text" android:id="@+id/size_text"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignBaseline="@id/leechers_text" android:layout_alignBaseline="@id/leechers_text"
android:textIsSelectable="false" android:textIsSelectable="false"
android:textSize="@dimen/text_small" /> android:textSize="@dimen/text_small"
tools:text="1.5GB" />
<TextView <TextView
android:id="@+id/date_text" android:id="@+id/date_text"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignBaseline="@id/leechers_text" android:layout_alignBaseline="@id/leechers_text"
android:layout_toRightOf="@id/size_text"
android:layout_marginLeft="@dimen/margin_default" android:layout_marginLeft="@dimen/margin_default"
android:layout_marginStart="@dimen/margin_default"
android:layout_toEndOf="@id/size_text"
android:layout_toRightOf="@id/size_text"
android:textIsSelectable="false" android:textIsSelectable="false"
android:textSize="@dimen/text_small" /> android:textSize="@dimen/text_small"
tools:text="0 weeks ago" />
</org.transdroid.core.gui.rss.RssitemStatusLayout> </org.transdroid.core.gui.rss.RssitemStatusLayout>

6
app/src/main/res/layout/list_item_searchsite.xml

@ -24,12 +24,13 @@
android:paddingBottom="@dimen/margin_half" android:paddingBottom="@dimen/margin_half"
android:paddingLeft="@dimen/margin_default" android:paddingLeft="@dimen/margin_default"
android:paddingRight="@dimen/margin_default" android:paddingRight="@dimen/margin_default"
android:paddingTop="@dimen/margin_half" > android:paddingTop="@dimen/margin_half">
<ImageView <ImageView
android:id="@+id/favicon_image" android:id="@+id/favicon_image"
android:layout_width="24dip" android:layout_width="24dip"
android:layout_height="24dip" android:layout_height="24dip"
android:layout_marginEnd="@dimen/margin_half"
android:layout_marginRight="@dimen/margin_half" android:layout_marginRight="@dimen/margin_half"
android:scaleType="centerCrop" android:scaleType="centerCrop"
tools:ignore="contentDescription" /> tools:ignore="contentDescription" />
@ -40,6 +41,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="1dip" android:layout_marginTop="1dip"
android:layout_weight="1" android:layout_weight="1"
android:textIsSelectable="false" /> android:textIsSelectable="false"
tools:text="Mininova" />
</LinearLayout> </LinearLayout>

2
app/src/main/res/layout/list_item_separator.xml

@ -19,7 +19,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:paddingLeft="@dimen/margin_default" android:paddingLeft="@dimen/margin_default"
android:paddingRight="@dimen/margin_default" > android:paddingRight="@dimen/margin_default">
<TextView <TextView
android:id="@+id/separator_text" android:id="@+id/separator_text"

6
app/src/main/res/layout/list_item_simple.xml

@ -21,13 +21,13 @@
android:paddingBottom="4dip" android:paddingBottom="4dip"
android:paddingLeft="@dimen/margin_default" android:paddingLeft="@dimen/margin_default"
android:paddingRight="@dimen/margin_default" android:paddingRight="@dimen/margin_default"
android:paddingTop="4dip" > android:paddingTop="4dip">
<TextView <TextView
android:id="@+id/item_text" android:id="@+id/item_text"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textSize="@dimen/text_default" android:textIsSelectable="false"
android:textIsSelectable="false" /> android:textSize="@dimen/text_default" />
</FrameLayout> </FrameLayout>

32
app/src/main/res/layout/list_item_torrent.xml

@ -16,34 +16,41 @@
along with Transdroid. If not, see <http://www.gnu.org/licenses/>. along with Transdroid. If not, see <http://www.gnu.org/licenses/>.
--> -->
<org.transdroid.core.gui.lists.TorrentStatusLayout xmlns:android="http://schemas.android.com/apk/res/android" <org.transdroid.core.gui.lists.TorrentStatusLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/activatable_background" android:background="?attr/activatable_background"
android:orientation="vertical" android:orientation="vertical"
android:paddingRight="@dimen/margin_default" android:paddingRight="@dimen/margin_default"
android:paddingBottom="@dimen/margin_half" > android:paddingEnd="@dimen/margin_default"
android:paddingBottom="@dimen/margin_half">
<TextView <TextView
android:id="@+id/name_text" android:id="@+id/name_text"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/margin_torrentlistleft" android:layout_marginLeft="@dimen/margin_torrentlistleft"
android:layout_marginStart="@dimen/margin_torrentlistleft"
android:fontFamily="sans-serif-condensed" android:fontFamily="sans-serif-condensed"
android:paddingTop="@dimen/margin_half" android:paddingTop="@dimen/margin_half"
android:textColor="?attr/text_bright" android:textColor="?attr/text_bright"
android:textIsSelectable="false" android:textIsSelectable="false"
android:textSize="@dimen/text_enlarged" /> android:textSize="@dimen/text_enlarged"
tools:text="Torrent.Title.That.Can-Be.Long.2015.1080p.Group.Release.mkv" />
<TextView <TextView
android:id="@+id/ratio_text" android:id="@+id/ratio_text"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_below="@id/name_text" android:layout_below="@id/name_text"
android:layout_marginLeft="@dimen/margin_half" android:layout_marginLeft="@dimen/margin_half"
android:layout_marginStart="@dimen/margin_half"
android:layout_marginTop="4.0dip" android:layout_marginTop="4.0dip"
android:textIsSelectable="false" android:textIsSelectable="false"
android:textSize="@dimen/text_small" /> android:textSize="@dimen/text_small"
tools:text="RATIO 2.3" />
<ImageView <ImageView
android:id="@+id/priority_image" android:id="@+id/priority_image"
@ -51,7 +58,9 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignBottom="@id/ratio_text" android:layout_alignBottom="@id/ratio_text"
android:layout_marginLeft="@dimen/margin_half" android:layout_marginLeft="@dimen/margin_half"
android:layout_marginStart="@dimen/margin_half"
android:layout_toLeftOf="@id/ratio_text" android:layout_toLeftOf="@id/ratio_text"
android:layout_toStartOf="@id/ratio_text"
android:contentDescription="@string/status_priority_normal" /> android:contentDescription="@string/status_priority_normal" />
<TextView <TextView
@ -60,10 +69,14 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignBaseline="@id/ratio_text" android:layout_alignBaseline="@id/ratio_text"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="@dimen/margin_torrentlistleft" android:layout_marginLeft="@dimen/margin_torrentlistleft"
android:layout_marginStart="@dimen/margin_torrentlistleft"
android:layout_toLeftOf="@id/priority_image" android:layout_toLeftOf="@id/priority_image"
android:layout_toStartOf="@id/priority_image"
android:textIsSelectable="false" android:textIsSelectable="false"
android:textSize="@dimen/text_small" /> android:textSize="@dimen/text_small"
tools:text="6.6GB, UPLOADED 15GB"/>
<org.transdroid.core.gui.lists.TorrentProgressBar <org.transdroid.core.gui.lists.TorrentProgressBar
android:id="@+id/torrent_progressbar" android:id="@+id/torrent_progressbar"
@ -78,11 +91,14 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_below="@id/torrent_progressbar" android:layout_below="@id/torrent_progressbar"
android:layout_marginLeft="@dimen/margin_half" android:layout_marginLeft="@dimen/margin_half"
android:layout_marginStart="@dimen/margin_half"
android:paddingTop="@dimen/margin_half" android:paddingTop="@dimen/margin_half"
android:textIsSelectable="false" android:textIsSelectable="false"
android:textSize="@dimen/text_small" /> android:textSize="@dimen/text_small"
tools:text="280 KB/s" />
<TextView <TextView
android:id="@+id/peers_text" android:id="@+id/peers_text"
@ -90,10 +106,14 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignBaseline="@id/speed_text" android:layout_alignBaseline="@id/speed_text"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="@dimen/margin_torrentlistleft" android:layout_marginLeft="@dimen/margin_torrentlistleft"
android:layout_marginStart="@dimen/margin_torrentlistleft"
android:layout_toLeftOf="@id/speed_text" android:layout_toLeftOf="@id/speed_text"
android:layout_toStartOf="@id/speed_text"
android:paddingTop="@dimen/margin_half" android:paddingTop="@dimen/margin_half"
android:textIsSelectable="false" android:textIsSelectable="false"
android:textSize="@dimen/text_small" /> android:textSize="@dimen/text_small"
tools:text="28 OF 102 SEEDERS" />
</org.transdroid.core.gui.lists.TorrentStatusLayout> </org.transdroid.core.gui.lists.TorrentStatusLayout>

14
app/src/main/res/layout/list_item_torrentfile.xml

@ -16,6 +16,7 @@
along with Transdroid. If not, see <http://www.gnu.org/licenses/>. along with Transdroid. If not, see <http://www.gnu.org/licenses/>.
--> -->
<org.transdroid.core.gui.lists.TorrentFilePriorityLayout xmlns:android="http://schemas.android.com/apk/res/android" <org.transdroid.core.gui.lists.TorrentFilePriorityLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/activatable_background" android:background="?attr/activatable_background"
@ -23,7 +24,7 @@
android:paddingBottom="@dimen/margin_half" android:paddingBottom="@dimen/margin_half"
android:paddingLeft="@dimen/margin_default" android:paddingLeft="@dimen/margin_default"
android:paddingRight="@dimen/margin_default" android:paddingRight="@dimen/margin_default"
android:paddingTop="@dimen/margin_half" > android:paddingTop="@dimen/margin_half">
<TextView <TextView
android:id="@+id/name_text" android:id="@+id/name_text"
@ -32,18 +33,22 @@
android:fontFamily="sans-serif-condensed" android:fontFamily="sans-serif-condensed"
android:textColor="?attr/text_bright" android:textColor="?attr/text_bright"
android:textIsSelectable="false" android:textIsSelectable="false"
android:textSize="@dimen/text_enlarged" /> android:textSize="@dimen/text_enlarged"
tools:text="File.In.Torrent.Title.Which.Can.Be.Long.2016.1080p.Release.mkv" />
<TextView <TextView
android:id="@+id/progress_text" android:id="@+id/progress_text"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_below="@id/name_text" android:layout_below="@id/name_text"
android:layout_marginLeft="@dimen/margin_half" android:layout_marginLeft="@dimen/margin_half"
android:layout_marginStart="@dimen/margin_half"
android:layout_marginTop="4dip" android:layout_marginTop="4dip"
android:textIsSelectable="false" android:textIsSelectable="false"
android:textSize="@dimen/text_small" /> android:textSize="@dimen/text_small"
tools:text="41%" />
<TextView <TextView
android:id="@+id/sizes_text" android:id="@+id/sizes_text"
@ -51,6 +56,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/progress_text" android:layout_alignBaseline="@+id/progress_text"
android:textIsSelectable="false" android:textIsSelectable="false"
android:textSize="@dimen/text_small" /> android:textSize="@dimen/text_small"
tools:text="3.4GB / 8.2GB" />
</org.transdroid.core.gui.lists.TorrentFilePriorityLayout> </org.transdroid.core.gui.lists.TorrentFilePriorityLayout>

15
app/src/main/res/menu/fragment_details_cab.xml → app/src/main/res/menu/fragment_details_cab_main.xml

@ -21,29 +21,26 @@
android:id="@+id/action_priority_off" android:id="@+id/action_priority_off"
android:icon="@drawable/ic_action_priority_off" android:icon="@drawable/ic_action_priority_off"
android:title="@string/action_priority_off" android:title="@string/action_priority_off"
app:showAsAction="ifRoom" /> app:showAsAction="always" />
<item <item
android:id="@+id/action_priority_low" android:id="@+id/action_priority_low"
android:icon="@drawable/ic_action_priority_low" android:icon="@drawable/ic_action_priority_low"
android:title="@string/action_priority_low" android:title="@string/action_priority_low"
app:showAsAction="ifRoom" /> app:showAsAction="always" />
<item <item
android:id="@+id/action_priority_normal" android:id="@+id/action_priority_normal"
android:icon="@drawable/ic_action_priority_medium" android:icon="@drawable/ic_action_priority_medium"
android:title="@string/action_priority_normal" android:title="@string/action_priority_normal"
app:showAsAction="ifRoom" /> app:showAsAction="always" />
<item <item
android:id="@+id/action_priority_high" android:id="@+id/action_priority_high"
android:icon="@drawable/ic_action_priority_high" android:icon="@drawable/ic_action_priority_high"
android:title="@string/action_priority_high" android:title="@string/action_priority_high"
app:showAsAction="ifRoom" /> app:showAsAction="always" />
<item <item
android:id="@+id/action_download" android:id="@+id/action_download"
android:icon="@drawable/ic_action_download"
android:title="@string/action_download" android:title="@string/action_download"
app:showAsAction="ifRoom" /> app:showAsAction="always" />
<item
android:id="@+id/action_copytoclipboard"
android:title="@string/action_copytoclipboard"
app:showAsAction="never" />
</menu> </menu>

26
app/src/main/res/menu/fragment_details_cab_secondary.xml

@ -0,0 +1,26 @@
<!--
Copyright 2010-2013 Eric Kok et al.
Transdroid is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Transdroid is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Transdroid. If not, see <http://www.gnu.org/licenses/>.
-->
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_copytoclipboard"
android:icon="@drawable/ic_action_copy"
android:title="@string/action_copytoclipboard"
app:showAsAction="always" />
</menu>

12
app/src/main/res/menu/fragment_torrents_cab.xml

@ -21,27 +21,27 @@
android:id="@+id/action_resume" android:id="@+id/action_resume"
android:icon="@drawable/ic_action_resume" android:icon="@drawable/ic_action_resume"
android:title="@string/action_resume" android:title="@string/action_resume"
app:showAsAction="ifRoom" /> app:showAsAction="always" />
<item <item
android:id="@+id/action_pause" android:id="@+id/action_pause"
android:icon="@drawable/ic_action_pause" android:icon="@drawable/ic_action_pause"
android:title="@string/action_pause" android:title="@string/action_pause"
app:showAsAction="ifRoom" /> app:showAsAction="always" />
<item <item
android:id="@+id/action_start" android:id="@+id/action_start"
android:icon="@drawable/ic_action_start" android:icon="@drawable/ic_action_start"
android:title="@string/action_start" android:title="@string/action_start"
app:showAsAction="ifRoom" /> app:showAsAction="always" />
<item <item
android:id="@+id/action_stop" android:id="@+id/action_stop"
android:icon="@drawable/ic_action_stop" android:icon="@drawable/ic_action_stop"
android:title="@string/action_stop" android:title="@string/action_stop"
app:showAsAction="ifRoom" /> app:showAsAction="always" />
<item <item
android:id="@+id/action_remove" android:id="@+id/action_remove"
android:icon="@drawable/ic_action_remove" android:icon="@drawable/ic_action_remove"
android:title="@string/action_remove" android:title="@string/action_remove"
app:showAsAction="ifRoom"> app:showAsAction="always">
<menu> <menu>
<item <item
android:id="@+id/action_remove_default" android:id="@+id/action_remove_default"
@ -55,6 +55,6 @@
android:id="@+id/action_setlabel" android:id="@+id/action_setlabel"
android:icon="@drawable/ic_action_labels" android:icon="@drawable/ic_action_labels"
android:title="@string/action_setlabel" android:title="@string/action_setlabel"
app:showAsAction="ifRoom" /> app:showAsAction="always" />
</menu> </menu>

2
app/src/main/res/values-v21/styles.xml

@ -17,7 +17,7 @@
<resources xmlns:android="http://schemas.android.com/apk/res/android"> <resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="TransdroidTheme" parent="Theme.Transdroid.Light"> <style name="TransdroidTheme" parent="Theme.Transdroid.Light">
<item name="activatable_background">?android:attr/selectableItemBackground</item> <item name="activatable_background">?android:attr/activatedBackgroundIndicator</item>
</style> </style>
<style name="TransdroidTheme.Dark" parent="Theme.Transdroid.Dark"> <style name="TransdroidTheme.Dark" parent="Theme.Transdroid.Dark">

1
app/src/main/res/values/dimens.xml

@ -34,6 +34,7 @@
<dimen name="ui_filters_list">220dp</dimen> <dimen name="ui_filters_list">220dp</dimen>
<dimen name="ui_navigation_filter">17sp</dimen> <dimen name="ui_navigation_filter">17sp</dimen>
<dimen name="ui_navigation_server">14sp</dimen> <dimen name="ui_navigation_server">14sp</dimen>
<dimen name="ui_actions_padding">75dp</dimen>
<dimen name="ui_details_seperator">105dp</dimen> <dimen name="ui_details_seperator">105dp</dimen>
<dimen name="ui_serverstatus_margin">2dp</dimen> <dimen name="ui_serverstatus_margin">2dp</dimen>
<dimen name="ui_serverstatus_signmargin">3dp</dimen> <dimen name="ui_serverstatus_signmargin">3dp</dimen>

Loading…
Cancel
Save