mirror of
https://github.com/beemdevelopment/Aegis.git
synced 2025-05-17 07:22:50 +00:00
Copy the version to the clipboard when tapped in AboutActivity
This commit is contained in:
parent
cbe3697d68
commit
5677bd4112
3 changed files with 19 additions and 1 deletions
|
@ -1,11 +1,14 @@
|
|||
package com.beemdevelopment.aegis.ui;
|
||||
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.beemdevelopment.aegis.BuildConfig;
|
||||
import com.beemdevelopment.aegis.R;
|
||||
|
@ -16,6 +19,7 @@ import com.mikepenz.iconics.Iconics;
|
|||
import com.mikepenz.iconics.context.IconicsLayoutInflater2;
|
||||
import com.mikepenz.material_design_iconic_typeface_library.MaterialDesignIconic;
|
||||
|
||||
import androidx.annotation.StringRes;
|
||||
import androidx.core.view.LayoutInflaterCompat;
|
||||
|
||||
import de.psdev.licensesdialog.LicenseResolver;
|
||||
|
@ -47,6 +51,11 @@ public class AboutActivity extends AegisActivity {
|
|||
TextView appVersion = findViewById(R.id.app_version);
|
||||
appVersion.setText(getCurrentAppVersion());
|
||||
|
||||
View btnAppVersion = findViewById(R.id.btn_app_version);
|
||||
btnAppVersion.setOnClickListener(v -> {
|
||||
copyToClipboard(getCurrentAppVersion(), R.string.version_copied);
|
||||
});
|
||||
|
||||
View btnGithub = findViewById(R.id.btn_github);
|
||||
btnGithub.setOnClickListener(v -> openUrl(GITHUB));
|
||||
|
||||
|
@ -87,6 +96,13 @@ public class AboutActivity extends AegisActivity {
|
|||
startActivity(browserIntent);
|
||||
}
|
||||
|
||||
private void copyToClipboard(String text, @StringRes int messageId) {
|
||||
ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
ClipData data = ClipData.newPlainText("text/plain", text);
|
||||
clipboard.setPrimaryClip(data);
|
||||
Toast.makeText(this, messageId, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
private void openMail(String mailaddress) {
|
||||
Intent mailIntent = new Intent(Intent.ACTION_SENDTO);
|
||||
mailIntent.setData(Uri.parse("mailto:" + mailaddress));
|
||||
|
|
|
@ -67,6 +67,7 @@
|
|||
app:ico_size="16dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/btn_app_version"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="32dp"
|
||||
|
|
|
@ -104,6 +104,7 @@
|
|||
<string name="vault_not_found">Vault not found, starting setup…</string>
|
||||
<string name="code_copied">Code copied to the clipboard</string>
|
||||
<string name="errors_copied">Errors copied to the clipboard</string>
|
||||
<string name="version_copied">Version copied to the clipboard</string>
|
||||
<string name="decryption_error">An error occurred while trying to unlock the vault</string>
|
||||
<string name="saving_error">An error occurred while trying to save the vault</string>
|
||||
<string name="disable_encryption">Disable encryption</string>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue