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. 2
      app/src/main/java/org/transdroid/core/gui/DetailsFragment.java
  3. 14
      app/src/main/java/org/transdroid/core/gui/TorrentsActivity.java
  4. 2
      app/src/main/java/org/transdroid/core/gui/TorrentsFragment.java
  5. 2
      app/src/main/java/org/transdroid/core/gui/navigation/NavigationHelper.java
  6. 10
      app/src/main/java/org/transdroid/core/gui/settings/PreferenceCompatActivity.java
  7. 2
      app/src/main/res/menu/fragment_torrents_cab.xml
  8. 4
      app/src/main/res/values/strings.xml

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

@ -6,6 +6,7 @@ import android.content.DialogInterface; @@ -6,6 +6,7 @@ import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import org.transdroid.R;
import org.transdroid.daemon.Daemon;
import org.transdroid.daemon.Torrent;
import java.util.List;
@ -13,7 +14,7 @@ import java.util.List; @@ -13,7 +14,7 @@ import java.util.List;
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 torrents List of torrents to be removed
*/
@ -34,7 +35,9 @@ public class ConfirmRemoveDialog { @@ -34,7 +35,9 @@ public class ConfirmRemoveDialog {
@Override
public void onClick(DialogInterface dialog, int which) {
for (Torrent torrent : torrents) {
activity.removeTorrent(torrent, isRemoveDataChecked[0]);
boolean shouldRemoveData = isRemoveDataChecked[0] &&
Daemon.supportsRemoveWithData(torrent.getDaemon());
activity.removeTorrent(torrent, shouldRemoveData);
}
dialog.dismiss();
}

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

@ -391,7 +391,7 @@ public class DetailsFragment extends Fragment implements OnTrackersUpdatedListen @@ -391,7 +391,7 @@ public class DetailsFragment extends Fragment implements OnTrackersUpdatedListen
@OptionsItem(resName = "action_remove")
protected void removeTorrent() {
ConfirmRemoveDialog.startConfirmRemove((TorrentsActivity) getActivity(), Arrays.asList(torrent));
ConfirmRemoveDialog.startConfirmRemove((TorrentsActivity) getActivity(), Arrays.asList(torrent));
}
@OptionsItem(R.id.action_setlabel)

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

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

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

@ -340,7 +340,7 @@ public class TorrentsFragment extends Fragment implements OnLabelPickedListener @@ -340,7 +340,7 @@ public class TorrentsFragment extends Fragment implements OnLabelPickedListener
mode.finish();
return true;
} else if (itemId == R.id.action_remove) {
ConfirmRemoveDialog.startConfirmRemove((TorrentsActivity) getActivity(), checked);
ConfirmRemoveDialog.startConfirmRemove((TorrentsActivity) getActivity(), checked);
mode.finish();
return true;
} else if (itemId == R.id.action_setlabel) {

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

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

10
app/src/main/java/org/transdroid/core/gui/settings/PreferenceCompatActivity.java

@ -64,9 +64,9 @@ public class PreferenceCompatActivity extends PreferenceActivity implements AppC @@ -64,9 +64,9 @@ public class PreferenceCompatActivity extends PreferenceActivity implements AppC
}
@Nullable
@Override
public ActionMode onWindowStartingSupportActionMode(ActionMode.Callback callback) {
return null;
}
@Nullable
@Override
public ActionMode onWindowStartingSupportActionMode(ActionMode.Callback callback) {
return null;
}
}

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

@ -39,7 +39,7 @@ @@ -39,7 +39,7 @@
app:showAsAction="always" />
<item
android:id="@+id/action_remove"
android:icon="@drawable/ic_action_remove"
android:icon="@drawable/ic_action_remove"
android:showAsAction="always"
android:title="@string/action_remove">
</item>

4
app/src/main/res/values/strings.xml

@ -96,8 +96,8 @@ @@ -96,8 +96,8 @@
<string name="navigation_selectfinished">Select finished</string>
<string name="navigation_invertselection">Invert selection</string>
<string name="navigation_pickserver">Add torrent to&#8230;</string>
<string name="navigation_confirmremove">Confirm torrent removal?</string>
<string name="navigation_confirmdataremoval">Also remove downloaded files?</string>
<string name="navigation_confirmremove">Confirm torrent removal?</string>
<string name="navigation_confirmdataremoval">Also remove downloaded files?</string>
<string name="navigation_url_hint" translatable="false">http://…</string>
<string name="status_status">STATUS: %1$s</string>

Loading…
Cancel
Save