调整了点复制按钮

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

View File

@ -69,11 +69,22 @@ public class PassWordListAdapter extends RecyclerView.Adapter<PassWordListAdapte
holder.copy.setOnClickListener(new View.OnClickListener() { holder.copy.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
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); ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText("", data.getPassword()); ClipData clip = ClipData.newPlainText("", response);
clipboard.setPrimaryClip(clip); clipboard.setPrimaryClip(clip);
Toast.makeText(context, ResTools.getString(context, R.string.toast_copy_password), Toast.LENGTH_LONG).show(); 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() { holder.item_layout.setOnClickListener(new View.OnClickListener() {
@Override @Override