Browse Source

Fixing indent, improving delete logic

pull/222/head
Kumaresan Rajeswaran 9 years ago
parent
commit
91552322be
  1. 7
      app/src/main/java/org/transdroid/core/gui/ConfirmRemoveDialog.java
  2. 14
      app/src/main/java/org/transdroid/core/gui/TorrentsActivity.java
  3. 2
      app/src/main/java/org/transdroid/core/gui/navigation/NavigationHelper.java

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

@ -6,6 +6,7 @@ import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener; import android.content.DialogInterface.OnClickListener;
import org.transdroid.R; import org.transdroid.R;
import org.transdroid.daemon.Daemon;
import org.transdroid.daemon.Torrent; import org.transdroid.daemon.Torrent;
import java.util.List; import java.util.List;
@ -13,7 +14,7 @@ import java.util.List;
public class ConfirmRemoveDialog { public class ConfirmRemoveDialog {
/** /**
* Opens a dialog that confirms the removal of a torrent, along with an option for with deleting downloaded files * Opens a dialog that confirms the removal of a torrent, along with an option for deleting downloaded files
* @param activity The torrents activity from which the dialog is started (and which received the callback) * @param activity The torrents activity from which the dialog is started (and which received the callback)
* @param torrents List of torrents to be removed * @param torrents List of torrents to be removed
*/ */
@ -34,7 +35,9 @@ public class ConfirmRemoveDialog {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
for (Torrent torrent : torrents) { for (Torrent torrent : torrents) {
activity.removeTorrent(torrent, isRemoveDataChecked[0]); boolean shouldRemoveData = isRemoveDataChecked[0] &&
Daemon.supportsRemoveWithData(torrent.getDaemon());
activity.removeTorrent(torrent, shouldRemoveData);
} }
dialog.dismiss(); dialog.dismiss();
} }

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

@ -238,13 +238,13 @@ public class TorrentsActivity extends ActionBarActivity implements TorrentTasksE
torrentsToolbar.addView(serverSelectionView); torrentsToolbar.addView(serverSelectionView);
} }
actionsToolbar.addView(serverStatusView); actionsToolbar.addView(serverStatusView);
// actionsToolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() { actionsToolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {
// @Override @Override
// public boolean onMenuItemClick(MenuItem menuItem) { public boolean onMenuItemClick(MenuItem menuItem) {
// // Redirect to the classic activity implementation so we can use @OptionsItem methods // Redirect to the classic activity implementation so we can use @OptionsItem methods
// return onOptionsItemSelected(menuItem); return onOptionsItemSelected(menuItem);
// } }
// }); });
setSupportActionBar(torrentsToolbar); // For direct menu item inflation by the contained fragments setSupportActionBar(torrentsToolbar); // For direct menu item inflation by the contained fragments
getSupportActionBar().setDisplayShowTitleEnabled(false); getSupportActionBar().setDisplayShowTitleEnabled(false);

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

@ -123,8 +123,6 @@ public class NavigationHelper {
if (imageCache == null) { if (imageCache == null) {
imageCache = ImageLoader.getInstance(); imageCache = ImageLoader.getInstance();
try { try {
// LruDiskCache diskCache =
// new LruDiskCache(context.getCacheDir(), null, new Md5FileNameGenerator(), 640000, 25);
LruDiscCache diskCache = new LruDiscCache(context.getCacheDir(), null, new Md5FileNameGenerator(), 640000, 25); LruDiscCache diskCache = new LruDiscCache(context.getCacheDir(), null, new Md5FileNameGenerator(), 640000, 25);
// @formatter:off // @formatter:off
Builder imageCacheBuilder = new Builder(context) Builder imageCacheBuilder = new Builder(context)

Loading…
Cancel
Save