mirror of
https://codeberg.org/r4v3r23/mysu.git
synced 2024-11-22 22:02:25 +00:00
add copy button to receive popup
This commit is contained in:
parent
67ab38d91f
commit
21a81a271a
2 changed files with 21 additions and 4 deletions
|
@ -5,6 +5,7 @@ import android.os.Bundle;
|
|||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
|
@ -21,6 +22,7 @@ import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
|
|||
import com.m2049r.xmrwallet.R;
|
||||
import com.m2049r.xmrwallet.data.Subaddress;
|
||||
import com.m2049r.xmrwallet.service.AddressService;
|
||||
import com.m2049r.xmrwallet.util.Helper;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
@ -39,10 +41,12 @@ public class ReceiveBottomSheetDialog extends BottomSheetDialogFragment {
|
|||
super.onViewCreated(view, savedInstanceState);
|
||||
ImageView addressImageView = view.findViewById(R.id.monero_qr_imageview);
|
||||
TextView addressTextView = view.findViewById(R.id.address_textview);
|
||||
ImageButton copyAddressImageButton = view.findViewById(R.id.copy_address_imagebutton);
|
||||
|
||||
Subaddress addr = AddressService.getInstance().getLatestSubaddress();
|
||||
addressTextView.setText(addr.getAddress());
|
||||
addressImageView.setImageBitmap(generate(addr.getAddress(), 256, 256));
|
||||
copyAddressImageButton.setOnClickListener(view1 -> Helper.clipBoardCopy(getContext(), "address", addr.getAddress()));
|
||||
}
|
||||
|
||||
public Bitmap generate(String text, int width, int height) {
|
||||
|
|
|
@ -35,17 +35,30 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/address_textview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:textAlignment="center"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
tools:text="ADDRESS"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/copy_address_imagebutton"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/monero_qr_imageview" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/copy_address_imagebutton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@android:color/transparent"
|
||||
android:padding="8dp"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:src="@drawable/ic_content_copy_24dp"
|
||||
app:layout_constraintTop_toTopOf="@id/address_textview"
|
||||
app:layout_constraintBottom_toBottomOf="@id/address_textview"
|
||||
app:layout_constraintStart_toEndOf="@id/address_textview"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</ScrollView>
|
Loading…
Reference in a new issue