From 67ca3358af72897975d9ffe6840f6d265ce1ba08 Mon Sep 17 00:00:00 2001 From: fxdqe <1037852407@qq.com> Date: Tue, 24 May 2022 03:26:52 +0800 Subject: [PATCH] Add copy sms in code record --- .../tianma/xsmscode/ui/record/CodeRecordFragment.java | 9 +++++++++ app/src/main/res/values-zh-rCN/strings.xml | 2 ++ app/src/main/res/values-zh-rTW/strings.xml | 2 ++ app/src/main/res/values/strings.xml | 2 ++ 4 files changed, 15 insertions(+) diff --git a/app/src/main/java/com/tianma/xsmscode/ui/record/CodeRecordFragment.java b/app/src/main/java/com/tianma/xsmscode/ui/record/CodeRecordFragment.java index 8bb713d..3f138b7 100644 --- a/app/src/main/java/com/tianma/xsmscode/ui/record/CodeRecordFragment.java +++ b/app/src/main/java/com/tianma/xsmscode/ui/record/CodeRecordFragment.java @@ -154,9 +154,18 @@ private void showSmsDetails(final RecordItem recordItem) { .positiveText(R.string.copy_smscode) .onPositive((dialog, which) -> copySmsCode(recordItem)) .negativeText(R.string.cancel) + .neutralText(R.string.copy_sms) + .onNeutral((dialog, which) -> copySms(recordItem)) .show(); } + private void copySms(RecordItem item) { + String sms = item.getSmsMsg().getBody(); + ClipboardUtils.copyToClipboard(mActivity, sms); + String prompt = getString(R.string.prompt_sms_copied); + SnackbarHelper.makeShort(mRecyclerView, prompt).show(); + } + private void copySmsCode(RecordItem item) { String smsCode = item.getSmsMsg().getSmsCode(); ClipboardUtils.copyToClipboard(mActivity, smsCode); diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index b127a79..e108ded 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -75,6 +75,8 @@ 已删除%d项记录 短信详情 复制验证码 + 复制短信 + 已复制短信 保存验证码记录 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index cc89ee2..cbda5e6 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -75,6 +75,8 @@ 已刪除%d項記錄 簡訊詳情 複製驗證碼 + 複製簡訊 + 已複製簡訊 保存驗證碼記錄 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index c35fe0c..e966805 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -76,6 +76,8 @@ Removed %d record(s) Message Details Copy Code + Copy Message + SMS copied Reserve SMS code records