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:
AudricV 2022-11-08 20:40:09 +01:00
parent ef35b36eba
commit 7b7ab3f419
No known key found for this signature in database
GPG Key ID: DA92EC7905614198
2 changed files with 1 additions and 13 deletions

View File

@ -693,7 +693,7 @@ public class MissionAdapter extends Adapter<ViewHolder> implements Handler.Callb
.subscribeOn(Schedulers.computation())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(result -> {
Utility.copyToClipboard(mContext, result);
ShareUtils.copyToClipboard(mContext, result);
notificationManager.cancel(HASH_NOTIFICATION_ID);
})
);

View File

@ -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)
throws IOException {
ByteString byteString;