Copy EmailDestinations to clipboard
This commit is contained in:
@ -2,6 +2,7 @@ package i2p.bote.android.util;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Point;
|
||||
@ -25,6 +26,7 @@ import android.view.animation.AlphaAnimation;
|
||||
import android.view.animation.DecelerateInterpolator;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.nineoldandroids.animation.Animator;
|
||||
import com.nineoldandroids.animation.AnimatorListenerAdapter;
|
||||
@ -90,6 +92,23 @@ public abstract class ViewAddressFragment extends Fragment {
|
||||
mAddressQrCode = (ImageView) view.findViewById(R.id.email_dest_qr_code);
|
||||
mExpandedQrCode = (ImageView) view.findViewById(R.id.expanded_qr_code);
|
||||
|
||||
view.findViewById(R.id.copy_key).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Object clipboardService = getActivity().getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
|
||||
android.text.ClipboardManager clipboard = (android.text.ClipboardManager) clipboardService;
|
||||
clipboard.setText(mAddress);
|
||||
} else {
|
||||
android.content.ClipboardManager clipboard = (android.content.ClipboardManager) clipboardService;
|
||||
android.content.ClipData clip = android.content.ClipData.newPlainText(
|
||||
getString(R.string.bote_dest_for, getPublicName()), mAddress);
|
||||
clipboard.setPrimaryClip(clip);
|
||||
}
|
||||
Toast.makeText(getActivity(), R.string.copied_to_clipboard, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
|
||||
if (mAddress != null) {
|
||||
loadAddress();
|
||||
}
|
||||
|
BIN
app/src/main/res/drawable-hdpi/ic_content_copy_grey600_24dp.png
Normal file
BIN
app/src/main/res/drawable-hdpi/ic_content_copy_grey600_24dp.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 287 B |
BIN
app/src/main/res/drawable-mdpi/ic_content_copy_grey600_24dp.png
Normal file
BIN
app/src/main/res/drawable-mdpi/ic_content_copy_grey600_24dp.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 217 B |
BIN
app/src/main/res/drawable-xhdpi/ic_content_copy_grey600_24dp.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/ic_content_copy_grey600_24dp.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 320 B |
Binary file not shown.
After Width: | Height: | Size: 435 B |
@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout
|
||||
android:id="@+id/container"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
@ -67,16 +67,16 @@
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin">
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title_address_info"
|
||||
@ -100,13 +100,35 @@
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="8dp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/email_dest"
|
||||
android:layout_width="wrap_content"
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="Key"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Secondary"/>
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/email_dest"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="Key"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Secondary"/>
|
||||
|
||||
<View
|
||||
style="@style/Divider.Vertical"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_marginStart="8dp"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/copy_key"
|
||||
android:layout_width="@dimen/listitem_picture_size"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_content_copy_grey600_24dp"/>
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title_fingerprint"
|
||||
|
@ -209,5 +209,7 @@
|
||||
<string name="no_identities_found_maybe_encrypted">No identities were found. Is the file encrypted?</string>
|
||||
<string name="identities_imported">Identities imported</string>
|
||||
<string name="this_field_is_required">This field is required</string>
|
||||
<string name="bote_dest_for">Bote address for %s</string>
|
||||
<string name="copied_to_clipboard">Copied to clipboard</string>
|
||||
|
||||
</resources>
|
||||
|
Reference in New Issue
Block a user