diff --git a/art/ic_action_copy.svg b/art/ic_action_copy.svg
new file mode 100644
index 00000000..485fd2ed
--- /dev/null
+++ b/art/ic_action_copy.svg
@@ -0,0 +1,108 @@
+
+
+
+
diff --git a/art/render.rb b/art/render.rb
index 5464b9f5..a78a2f47 100755
--- a/art/render.rb
+++ b/art/render.rb
@@ -1,6 +1,6 @@
#!/bin/env ruby
resolutions={'mdpi'=> 1, 'hdpi' => 1.5, 'xhdpi' => 2, 'xxhdpi' => 3}
-images = { 'conversations.svg' => ['ic_launcher',48], 'conversations_baloon.svg' => ['ic_activity', 32], 'conversations_mono.svg' => ['ic_notification',24], 'ic_received_indicator.svg' => ['ic_received_indicator',12] }
+images = { 'conversations.svg' => ['ic_launcher', 48], 'conversations_baloon.svg' => ['ic_activity', 32], 'conversations_mono.svg' => ['ic_notification', 24], 'ic_received_indicator.svg' => ['ic_received_indicator', 12], 'ic_action_copy.svg' => ['ic_action_copy', 32] }
images.each do |source, result|
resolutions.each do |name, factor|
size = factor * result[1]
diff --git a/res/drawable-hdpi/ic_action_copy.png b/res/drawable-hdpi/ic_action_copy.png
new file mode 100644
index 00000000..b47bb69c
Binary files /dev/null and b/res/drawable-hdpi/ic_action_copy.png differ
diff --git a/res/drawable-mdpi/ic_action_copy.png b/res/drawable-mdpi/ic_action_copy.png
new file mode 100644
index 00000000..75788f1f
Binary files /dev/null and b/res/drawable-mdpi/ic_action_copy.png differ
diff --git a/res/drawable-xhdpi/ic_action_copy.png b/res/drawable-xhdpi/ic_action_copy.png
new file mode 100644
index 00000000..a45423f6
Binary files /dev/null and b/res/drawable-xhdpi/ic_action_copy.png differ
diff --git a/res/drawable-xxhdpi/ic_action_copy.png b/res/drawable-xxhdpi/ic_action_copy.png
new file mode 100644
index 00000000..3a0e8449
Binary files /dev/null and b/res/drawable-xxhdpi/ic_action_copy.png differ
diff --git a/res/layout/activity_edit_account.xml b/res/layout/activity_edit_account.xml
index 04f63795..0f4bae97 100644
--- a/res/layout/activity_edit_account.xml
+++ b/res/layout/activity_edit_account.xml
@@ -180,13 +180,35 @@
android:textSize="?attr/TextSizeHeadline"
android:textStyle="bold" />
-
+ android:layout_height="match_parent"
+ android:layout_marginTop="8dp">
+
+
+
+
+
+
+
@@ -226,4 +248,4 @@
android:textColor="@color/secondarytext" />
-
\ No newline at end of file
+
diff --git a/res/values-de/strings.xml b/res/values-de/strings.xml
index 0c230ec6..6f21a71f 100644
--- a/res/values-de/strings.xml
+++ b/res/values-de/strings.xml
@@ -261,5 +261,6 @@
Sonstiges
Konferenz-Name
Konferenz-Thema statt Raum-JID als Name verwenden
+ OTR Fingerabdruck in die Zwischenablage kopiert!
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 8d976dce..b6e5e15c 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -261,5 +261,6 @@
Other
Conference name
Use room’s subject instead of JID to identify conferences
+ OTR fingerprint copied to clipboard!
-
\ No newline at end of file
+
diff --git a/src/eu/siacs/conversations/ui/EditAccountActivity.java b/src/eu/siacs/conversations/ui/EditAccountActivity.java
index bc946115..9aa8a9b4 100644
--- a/src/eu/siacs/conversations/ui/EditAccountActivity.java
+++ b/src/eu/siacs/conversations/ui/EditAccountActivity.java
@@ -1,6 +1,8 @@
package eu.siacs.conversations.ui;
import android.app.PendingIntent;
+import android.content.ClipData;
+import android.content.ClipboardManager;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
@@ -10,9 +12,11 @@ import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
+import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.TextView;
+import android.widget.Toast;
import eu.siacs.conversations.R;
import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.services.XmppConnectionService.OnAccountUpdate;
@@ -38,6 +42,7 @@ public class EditAccountActivity extends XmppActivity {
private TextView mSessionEst;
private TextView mOtrFingerprint;
private TextView mOtrFingerprintHeadline;
+ private ImageButton mOtrFingerprintToClipboardButton;
private String jidToEdit;
private Account mAccount;
@@ -228,6 +233,7 @@ public class EditAccountActivity extends XmppActivity {
this.mServerInfoPep = (TextView) findViewById(R.id.server_info_pep);
this.mOtrFingerprint = (TextView) findViewById(R.id.otr_fingerprint);
this.mOtrFingerprintHeadline = (TextView) findViewById(R.id.otr_fingerprint_headline);
+ this.mOtrFingerprintToClipboardButton = (ImageButton) findViewById(R.id.action_copy_to_clipboard);
this.mSaveButton = (Button) findViewById(R.id.save_button);
this.mCancelButton = (Button) findViewById(R.id.cancel_button);
this.mSaveButton.setOnClickListener(this.mSaveButtonClickListener);
@@ -324,13 +330,29 @@ public class EditAccountActivity extends XmppActivity {
} else {
this.mServerInfoPep.setText(R.string.server_info_unavailable);
}
- String fingerprint = this.mAccount
+ final String fingerprint = this.mAccount
.getOtrFingerprint(xmppConnectionService);
if (fingerprint != null) {
this.mOtrFingerprintHeadline.setVisibility(View.VISIBLE);
this.mOtrFingerprint.setVisibility(View.VISIBLE);
this.mOtrFingerprint.setText(fingerprint);
+ this.mOtrFingerprintToClipboardButton.setVisibility(View.VISIBLE);
+ this.mOtrFingerprintToClipboardButton
+ .setOnClickListener(new View.OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+
+ if (OtrFingerprintToClipBoard(fingerprint)) {
+ Toast.makeText(
+ EditAccountActivity.this,
+ R.string.toast_message_otr_fingerprint,
+ Toast.LENGTH_SHORT).show();
+ }
+ }
+ });
} else {
+ this.mOtrFingerprintToClipboardButton.setVisibility(View.GONE);
this.mOtrFingerprint.setVisibility(View.GONE);
this.mOtrFingerprintHeadline.setVisibility(View.GONE);
}
@@ -343,4 +365,15 @@ public class EditAccountActivity extends XmppActivity {
this.mStats.setVisibility(View.GONE);
}
}
+
+ private boolean OtrFingerprintToClipBoard(String fingerprint) {
+ ClipboardManager mClipBoardManager = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
+ String label = getResources().getString(R.string.otr_fingerprint);
+ if (mClipBoardManager != null) {
+ ClipData mClipData = ClipData.newPlainText(label, fingerprint);
+ mClipBoardManager.setPrimaryClip(mClipData);
+ return true;
+ }
+ return false;
+ }
}