Remove Utility.copyToClipboard and use ShareUtils.copyToClipboard instead
This method is not needed anymore, as ShareUtils.copyToClipboard does almost the same thing (no label is set on the ClipData used to copy text, contrary to what Utility did, but using "text" as a ClipData label doesn't seem useful). It was used in MissionAdapter.handlePopupItem to copy the SHA1 or the MD5 of a file.
This commit is contained in:
parent
ef35b36eba
commit
7b7ab3f419
|
@ -693,7 +693,7 @@ public class MissionAdapter extends Adapter<ViewHolder> implements Handler.Callb
|
||||||
.subscribeOn(Schedulers.computation())
|
.subscribeOn(Schedulers.computation())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe(result -> {
|
.subscribe(result -> {
|
||||||
Utility.copyToClipboard(mContext, result);
|
ShareUtils.copyToClipboard(mContext, result);
|
||||||
notificationManager.cancel(HASH_NOTIFICATION_ID);
|
notificationManager.cancel(HASH_NOTIFICATION_ID);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
|
@ -192,18 +192,6 @@ public class Utility {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void copyToClipboard(Context context, String str) {
|
|
||||||
ClipboardManager cm = ContextCompat.getSystemService(context, ClipboardManager.class);
|
|
||||||
|
|
||||||
if (cm == null) {
|
|
||||||
Toast.makeText(context, R.string.permission_denied, Toast.LENGTH_LONG).show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
cm.setPrimaryClip(ClipData.newPlainText("text", str));
|
|
||||||
Toast.makeText(context, R.string.msg_copied, Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String checksum(final StoredFileHelper source, final int algorithmId)
|
public static String checksum(final StoredFileHelper source, final int algorithmId)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
ByteString byteString;
|
ByteString byteString;
|
||||||
|
|
Loading…
Reference in New Issue