aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations/ui/EditAccountActivity.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/eu/siacs/conversations/ui/EditAccountActivity.java')
-rw-r--r--src/eu/siacs/conversations/ui/EditAccountActivity.java27
1 files changed, 6 insertions, 21 deletions
diff --git a/src/eu/siacs/conversations/ui/EditAccountActivity.java b/src/eu/siacs/conversations/ui/EditAccountActivity.java
index 0ec38547..58ca49cc 100644
--- a/src/eu/siacs/conversations/ui/EditAccountActivity.java
+++ b/src/eu/siacs/conversations/ui/EditAccountActivity.java
@@ -1,8 +1,6 @@
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.text.Editable;
@@ -17,6 +15,7 @@ import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.CompoundButton.OnCheckedChangeListener;
+import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import eu.siacs.conversations.R;
@@ -43,7 +42,7 @@ public class EditAccountActivity extends XmppActivity {
private TextView mServerInfoPep;
private TextView mSessionEst;
private TextView mOtrFingerprint;
- private TextView mOtrFingerprintHeadline;
+ private RelativeLayout mOtrFingerprintBox;
private ImageButton mOtrFingerprintToClipboardButton;
private String jidToEdit;
@@ -277,7 +276,7 @@ public class EditAccountActivity extends XmppActivity {
this.mServerInfoSm = (TextView) findViewById(R.id.server_info_sm);
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.mOtrFingerprintBox = (RelativeLayout) findViewById(R.id.otr_fingerprint_box);
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);
@@ -378,8 +377,7 @@ public class EditAccountActivity extends XmppActivity {
final String fingerprint = this.mAccount
.getOtrFingerprint(xmppConnectionService);
if (fingerprint != null) {
- this.mOtrFingerprintHeadline.setVisibility(View.VISIBLE);
- this.mOtrFingerprint.setVisibility(View.VISIBLE);
+ this.mOtrFingerprintBox.setVisibility(View.VISIBLE);
this.mOtrFingerprint.setText(fingerprint);
this.mOtrFingerprintToClipboardButton
.setVisibility(View.VISIBLE);
@@ -389,7 +387,7 @@ public class EditAccountActivity extends XmppActivity {
@Override
public void onClick(View v) {
- if (OtrFingerprintToClipBoard(fingerprint)) {
+ if (copyTextToClipboard(fingerprint,R.string.otr_fingerprint)) {
Toast.makeText(
EditAccountActivity.this,
R.string.toast_message_otr_fingerprint,
@@ -398,9 +396,7 @@ public class EditAccountActivity extends XmppActivity {
}
});
} else {
- this.mOtrFingerprintToClipboardButton.setVisibility(View.GONE);
- this.mOtrFingerprint.setVisibility(View.GONE);
- this.mOtrFingerprintHeadline.setVisibility(View.GONE);
+ this.mOtrFingerprintBox.setVisibility(View.GONE);
}
} else {
if (this.mAccount.errorStatus()) {
@@ -411,15 +407,4 @@ 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;
- }
}