Skip to content

Commit

Permalink
Remove Utility.copyToClipboard and use ShareUtils.copyToClipboard ins…
Browse files Browse the repository at this point in the history
…tead

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.
  • Loading branch information
AudricV committed Nov 8, 2022
1 parent ef35b36 commit 7b7ab3f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ private boolean handlePopupItem(@NonNull ViewHolderItem h, @NonNull MenuItem opt
.subscribeOn(Schedulers.computation())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(result -> {
Utility.copyToClipboard(mContext, result);
ShareUtils.copyToClipboard(mContext, result);
notificationManager.cancel(HASH_NOTIFICATION_ID);
})
);
Expand Down
12 changes: 0 additions & 12 deletions app/src/main/java/us/shandian/giga/util/Utility.java
Original file line number Diff line number Diff line change
Expand Up @@ -192,18 +192,6 @@ public static int getIconForFileType(FileType type) {
}
}

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;
Expand Down

0 comments on commit 7b7ab3f

Please sign in to comment.