调整了点复制按钮

This commit is contained in:
zlzw 2024-08-28 17:53:57 +08:00
parent de339d31f7
commit a0982360ec

View File

@ -69,10 +69,21 @@ public class PassWordListAdapter extends RecyclerView.Adapter<PassWordListAdapte
holder.copy.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText("", data.getPassword());
clipboard.setPrimaryClip(clip);
Toast.makeText(context, ResTools.getString(context, R.string.toast_copy_password), Toast.LENGTH_LONG).show();
NetTools.getApi().getPassword(data.getId()).enqueue(new HttpCallback<String>() {
@Override
public void onResponse(int code, String status, String response) {
ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText("", response);
clipboard.setPrimaryClip(clip);
Toast.makeText(context, ResTools.getString(context, R.string.toast_copy_password), Toast.LENGTH_LONG).show();
}
@Override
public void onFailure(Throwable throwable) {
}
});
}
});
holder.item_layout.setOnClickListener(new View.OnClickListener() {