调整了点复制按钮

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() { holder.copy.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); NetTools.getApi().getPassword(data.getId()).enqueue(new HttpCallback<String>() {
ClipData clip = ClipData.newPlainText("", data.getPassword()); @Override
clipboard.setPrimaryClip(clip); public void onResponse(int code, String status, String response) {
Toast.makeText(context, ResTools.getString(context, R.string.toast_copy_password), Toast.LENGTH_LONG).show(); 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() { holder.item_layout.setOnClickListener(new View.OnClickListener() {