let's own otr-fingerprint copy to clipboard.
This commit is contained in:
parent
d51b41590c
commit
9a4b48d1ec
108
art/ic_action_copy.svg
Normal file
108
art/ic_action_copy.svg
Normal file
|
@ -0,0 +1,108 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="128"
|
||||
height="128"
|
||||
id="svg4066"
|
||||
version="1.1"
|
||||
inkscape:version="0.48.5 r10040"
|
||||
sodipodi:docname="ic_action_copy.svg">
|
||||
<defs
|
||||
id="defs4068" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#000000"
|
||||
borderopacity="0.54117647"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="2.67"
|
||||
inkscape:cx="51.750573"
|
||||
inkscape:cy="57.547291"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="false"
|
||||
borderlayer="false"
|
||||
inkscape:window-width="1035"
|
||||
inkscape:window-height="853"
|
||||
inkscape:window-x="369"
|
||||
inkscape:window-y="3"
|
||||
inkscape:window-maximized="0" />
|
||||
<metadata
|
||||
id="metadata4071">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(0,-924.36218)">
|
||||
<rect
|
||||
ry="0"
|
||||
height="91.708199"
|
||||
width="71.625328"
|
||||
stroke-miterlimit="4"
|
||||
y="952.36743"
|
||||
x="42.730034"
|
||||
id="rect10"
|
||||
style="fill:none;stroke:#000000;stroke-width:8.6679945;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:0.54117647;stroke-dasharray:none"
|
||||
inkscape:transform-center-x="-21.391573"
|
||||
inkscape:transform-center-y="28.294015" />
|
||||
<path
|
||||
style="fill:#000000;fill-opacity:0.5411765;fill-rule:evenodd;stroke:#000000;stroke-width:0.41999999999999998;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:0.54117649999999995;stroke-miterlimit:4;stroke-dasharray:none"
|
||||
d="m 20.552281,933.36985 0,0.0209 -0.128276,0 -0.399078,99.83215 0.213792,0 0,0.1463 13.212333,-0.021 0.05701,-8.1392 -4.076297,0.011 0.327814,-84.87039 58.436429,0 0.0285,3.427 11.10293,0 -0.0855,-9.25707 -0.057,0 0,-1.1493 -78.63263,0 z"
|
||||
id="rect12-6"
|
||||
inkscape:connector-curvature="0" />
|
||||
<rect
|
||||
height="4.7259107"
|
||||
width="37.242958"
|
||||
y="967.49921"
|
||||
x="50.137043"
|
||||
id="rect12"
|
||||
style="fill:#000000;fill-opacity:0.54117647;fill-rule:evenodd;stroke:#000000;stroke-width:0.23799089px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:0.54117647" />
|
||||
<rect
|
||||
style="fill:#000000;fill-opacity:0.54117647000000002;fill-rule:evenodd;stroke:#000000;stroke-width:0.274;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:0.54117647000000002;stroke-miterlimit:4;stroke-dasharray:none"
|
||||
id="rect4272"
|
||||
x="50.137043"
|
||||
y="982.49921"
|
||||
width="49.452484"
|
||||
height="4.7259107" />
|
||||
<rect
|
||||
height="4.7259107"
|
||||
width="43.542446"
|
||||
y="997.49921"
|
||||
x="50.137043"
|
||||
id="rect4274"
|
||||
style="fill:#000000;fill-opacity:0.54117647;fill-rule:evenodd;stroke:#000000;stroke-width:0.2573325px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:0.54117647" />
|
||||
<rect
|
||||
style="fill:#000000;fill-opacity:0.54117647;fill-rule:evenodd;stroke:#000000;stroke-width:0.25050664px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:0.54117647"
|
||||
id="rect4276"
|
||||
x="50.137043"
|
||||
y="1012.4992"
|
||||
width="41.263123"
|
||||
height="4.7259107" />
|
||||
<rect
|
||||
height="4.7259107"
|
||||
width="49.397911"
|
||||
y="1027.4993"
|
||||
x="50.137043"
|
||||
id="rect4278"
|
||||
style="fill:#000000;fill-opacity:0.54117647;fill-rule:evenodd;stroke:#000000;stroke-width:0.27408957px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:0.54117647" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 4.1 KiB |
|
@ -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]
|
||||
|
|
BIN
res/drawable-hdpi/ic_action_copy.png
Normal file
BIN
res/drawable-hdpi/ic_action_copy.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 717 B |
BIN
res/drawable-mdpi/ic_action_copy.png
Normal file
BIN
res/drawable-mdpi/ic_action_copy.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 585 B |
BIN
res/drawable-xhdpi/ic_action_copy.png
Normal file
BIN
res/drawable-xhdpi/ic_action_copy.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 763 B |
BIN
res/drawable-xxhdpi/ic_action_copy.png
Normal file
BIN
res/drawable-xxhdpi/ic_action_copy.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1 KiB |
|
@ -180,13 +180,35 @@
|
|||
android:textSize="?attr/TextSizeHeadline"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/otr_fingerprint"
|
||||
<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:textSize="?attr/TextSizeBody"
|
||||
android:typeface="monospace" />
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="8dp">
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_toLeftOf="@+id/action_copy_to_clipboard"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/otr_fingerprint"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="?attr/TextSizeBody"
|
||||
android:typeface="monospace" />
|
||||
</LinearLayout>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/action_copy_to_clipboard"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:src="@drawable/ic_action_copy"
|
||||
android:visibility="invisible" />
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
|
|
@ -261,5 +261,6 @@
|
|||
<string name="pref_expert_options_other">Sonstiges</string>
|
||||
<string name="pref_conference_name">Konferenz-Name</string>
|
||||
<string name="pref_conference_name_summary">Konferenz-Thema statt Raum-JID als Name verwenden</string>
|
||||
<string name="toast_message_otr_fingerprint">OTR Fingerabdruck in die Zwischenablage kopiert!</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -261,5 +261,6 @@
|
|||
<string name="pref_expert_options_other">Other</string>
|
||||
<string name="pref_conference_name">Conference name</string>
|
||||
<string name="pref_conference_name_summary">Use room’s subject instead of JID to identify conferences</string>
|
||||
<string name="toast_message_otr_fingerprint">OTR fingerprint copied to clipboard!</string>
|
||||
|
||||
</resources>
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue