Skip to content

Commit 7b7ab3f

Browse files
committed
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.
1 parent ef35b36 commit 7b7ab3f

2 files changed

Lines changed: 1 addition & 13 deletions

File tree

app/src/main/java/us/shandian/giga/ui/adapter/MissionAdapter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,7 @@ private boolean handlePopupItem(@NonNull ViewHolderItem h, @NonNull MenuItem opt
693693
.subscribeOn(Schedulers.computation())
694694
.observeOn(AndroidSchedulers.mainThread())
695695
.subscribe(result -> {
696-
Utility.copyToClipboard(mContext, result);
696+
ShareUtils.copyToClipboard(mContext, result);
697697
notificationManager.cancel(HASH_NOTIFICATION_ID);
698698
})
699699
);

app/src/main/java/us/shandian/giga/util/Utility.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -192,18 +192,6 @@ public static int getIconForFileType(FileType type) {
192192
}
193193
}
194194

195-
public static void copyToClipboard(Context context, String str) {
196-
ClipboardManager cm = ContextCompat.getSystemService(context, ClipboardManager.class);
197-
198-
if (cm == null) {
199-
Toast.makeText(context, R.string.permission_denied, Toast.LENGTH_LONG).show();
200-
return;
201-
}
202-
203-
cm.setPrimaryClip(ClipData.newPlainText("text", str));
204-
Toast.makeText(context, R.string.msg_copied, Toast.LENGTH_SHORT).show();
205-
}
206-
207195
public static String checksum(final StoredFileHelper source, final int algorithmId)
208196
throws IOException {
209197
ByteString byteString;

0 commit comments

Comments
 (0)