public RedirectionDialog(String title, AppCompatActivity activity, final RedirectionDialogListener listener){ super(activity); final View view = LayoutInflater.from(activity).inflate(R.layout.plugin_mitm_redirect_dialog, null); this.setTitle(title); this.setView(view); this.setButton(BUTTON_POSITIVE, "Ok", new DialogInterface.OnClickListener(){ public void onClick(DialogInterface dialog, int id){ assert view != null; String address = ((EditText) view.findViewById(R.id.redirAddress)).getText() + "".trim(), port = ((EditText) view.findViewById(R.id.redirPort)).getText() + "".trim(); listener.onInputEntered(address, port); } }); this.setButton(BUTTON_NEGATIVE, activity.getString(R.string.cancel_dialog), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.dismiss(); } }); }
this.setButton(BUTTON_NEGATIVE, activity.getString(R.string.cancel_dialog), new DialogInterface.OnClickListener(){ public void onClick(DialogInterface dialog, int id){ dialog.dismiss();
private void updatePieceCounter() { String piecesTemplate = activity.getString(R.string.torrent_pieces_template); String pieceLength = Formatter.formatFileSize(activity, pieceSize); piecesCounter.setText(String.format(piecesTemplate, downloadedPieces, allPiecesCount, pieceLength)); } }
return; String speedTemplate = activity.getString(R.string.download_upload_speed_template); String downloadSpeed = Formatter.formatFileSize(activity, basicState.downloadSpeed); String uploadSpeed = Formatter.formatFileSize(activity, basicState.uploadSpeed); downloadUploadSpeed.setText(String.format(speedTemplate, downloadSpeed, uploadSpeed)); String counterTemplate = activity.getString(R.string.download_counter_template); String totalBytes = Formatter.formatFileSize(activity, basicState.totalBytes); String receivedBytes; textViewETA.setText(ETA); String seedsTemplate = activity.getString(R.string.torrent_peers_template); textViewSeeds.setText(String.format(seedsTemplate, advanceState.seeds, advanceState.totalSeeds)); String peersTemplate = activity.getString(R.string.torrent_peers_template); int leechers = Math.abs(basicState.peers - advanceState.seeds); int totalLeechers = basicState.totalPeers - advanceState.totalSeeds; String piecesTemplate = activity.getString(R.string.torrent_pieces_template); String pieceLength = Formatter.formatFileSize(activity, info.pieceLength); textViewPieces.setText(String.format(piecesTemplate, advanceState.downloadedPieces,
if (position != -1 && position < columns.length) { String column = columns[position]; pref.edit().putString(activity.getString(R.string.pref_key_sort_torrent_by), column).apply(); direction = TorrentSorting.Direction.DESC.name(); pref.edit().putString(activity.getString(R.string.pref_key_sort_torrent_direction), direction).apply(); if (adapter != null) adapter.setSorting(new TorrentSortingComparator(