Skip to content

Commit

Permalink
Merge pull request #40 from fxdqe/master
Browse files Browse the repository at this point in the history
Add copy sms in code record
  • Loading branch information
tianma8023 authored May 24, 2022
2 parents 4043f9c + 67ca335 commit b852ffd
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@
<string name="some_items_removed">已删除%d项记录</string>
<string name="message_details">短信详情</string>
<string name="copy_smscode">复制验证码</string>
<string name="copy_sms">复制短信</string>
<string name="prompt_sms_copied">已复制短信</string>
<string name="pref_enable_code_records_title">保存验证码记录</string>
<!-- preference code records end -->

Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-zh-rTW/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@
<string name="some_items_removed">已刪除%d項記錄</string>
<string name="message_details">簡訊詳情</string>
<string name="copy_smscode">複製驗證碼</string>
<string name="copy_sms">複製簡訊</string>
<string name="prompt_sms_copied">已複製簡訊</string>
<string name="pref_enable_code_records_title">保存驗證碼記錄</string>
<!-- preference code records end -->

Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@
<string name="some_items_removed">Removed %d record(s)</string>
<string name="message_details">Message Details</string>
<string name="copy_smscode">Copy Code</string>
<string name="copy_sms">Copy Message</string>
<string name="prompt_sms_copied">SMS copied</string>
<string name="pref_enable_code_records_title">Reserve SMS code records</string>
<!-- preference code records end -->

Expand Down

0 comments on commit b852ffd

Please sign in to comment.