mirror of
https://codeberg.org/anoncontributorxmr/mysu.git
synced 2024-11-22 07:22:26 +00:00
Display viewkey and restore height on wallet keys dialog
This commit is contained in:
parent
6be5d2a504
commit
92c41c2501
4 changed files with 110 additions and 24 deletions
|
@ -13,11 +13,11 @@ import androidx.annotation.Nullable;
|
|||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
||||
|
||||
import net.mynero.wallet.R;
|
||||
import net.mynero.wallet.model.Wallet;
|
||||
import net.mynero.wallet.model.WalletManager;
|
||||
import net.mynero.wallet.util.Helper;
|
||||
|
||||
public class WalletKeysBottomSheetDialog extends BottomSheetDialogFragment {
|
||||
public boolean showCopyButton = false;
|
||||
public String information = "";
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
|
@ -27,14 +27,19 @@ public class WalletKeysBottomSheetDialog extends BottomSheetDialogFragment {
|
|||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
ImageButton copyInformationImageButton = view.findViewById(R.id.copy_information_imagebutton);
|
||||
if (showCopyButton) {
|
||||
copyInformationImageButton.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
copyInformationImageButton.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
TextView informationTextView = view.findViewById(R.id.information_textview);
|
||||
informationTextView.setText(information);
|
||||
copyInformationImageButton.setOnClickListener(view1 -> Helper.clipBoardCopy(getContext(), "information", information));
|
||||
ImageButton copyViewKeyImageButton = view.findViewById(R.id.copy_viewkey_imagebutton);
|
||||
TextView informationTextView = view.findViewById(R.id.information_textview); // seed
|
||||
TextView viewKeyTextView = view.findViewById(R.id.viewkey_textview);
|
||||
TextView restoreHeightTextView = view.findViewById(R.id.restore_height_textview);
|
||||
|
||||
Wallet wallet = WalletManager.getInstance().getWallet();
|
||||
String seed = wallet.getSeed("");
|
||||
String privateViewKey = wallet.getSecretViewKey();
|
||||
|
||||
informationTextView.setText(seed);
|
||||
viewKeyTextView.setText(privateViewKey);
|
||||
restoreHeightTextView.setText(wallet.getRestoreHeight()+"");
|
||||
|
||||
copyViewKeyImageButton.setOnClickListener(view1 -> Helper.clipBoardCopy(getContext(), "private view-key", privateViewKey));
|
||||
}
|
||||
}
|
|
@ -185,8 +185,6 @@ public class SettingsFragment extends Fragment implements PasswordBottomSheetDia
|
|||
|
||||
private void displaySeedDialog() {
|
||||
WalletKeysBottomSheetDialog informationDialog = new WalletKeysBottomSheetDialog();
|
||||
informationDialog.showCopyButton = false;
|
||||
informationDialog.information = WalletManager.getInstance().getWallet().getSeed("");
|
||||
informationDialog.show(getActivity().getSupportFragmentManager(), "information_seed_dialog");
|
||||
}
|
||||
|
||||
|
|
|
@ -21,26 +21,84 @@
|
|||
android:text="@string/wallet_keys_label"
|
||||
android:textSize="32sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toTopOf="@id/information_textview"
|
||||
app:layout_constraintBottom_toTopOf="@id/recv_monero_textview"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/wallet_seed_label_textview"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold"
|
||||
android:text="@string/wallet_seed_label"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/recv_monero_textview" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/wallet_seed_desc_textview"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:textSize="12sp"
|
||||
android:textColor="#f00"
|
||||
android:text="@string/wallet_seed_desc"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/wallet_seed_label_textview" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/information_textview"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:textAlignment="center"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toStartOf="@id/copy_information_imagebutton"
|
||||
android:layout_marginTop="4dp"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/recv_monero_textview"
|
||||
app:layout_constraintTop_toBottomOf="@id/wallet_seed_desc_textview"
|
||||
tools:text="INFORMATION" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/wallet_viewkey_label_textview"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold"
|
||||
android:text="@string/wallet_viewkey_label"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/information_textview" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/wallet_viewkey_desc_textview"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:textSize="12sp"
|
||||
android:textColor="#f80"
|
||||
android:text="@string/wallet_viewkey_desc"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/wallet_viewkey_label_textview" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/viewkey_textview"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintEnd_toStartOf="@id/copy_viewkey_imagebutton"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/copy_viewkey_imagebutton"
|
||||
app:layout_constraintBottom_toBottomOf="@id/copy_viewkey_imagebutton"
|
||||
tools:text="INFORMATION" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/copy_information_imagebutton"
|
||||
android:id="@+id/copy_viewkey_imagebutton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@android:color/transparent"
|
||||
|
@ -48,10 +106,30 @@
|
|||
android:minHeight="24dp"
|
||||
android:padding="8dp"
|
||||
android:src="@drawable/ic_content_copy_24dp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/information_textview"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/information_textview"
|
||||
app:layout_constraintTop_toTopOf="@id/information_textview" />
|
||||
app:layout_constraintStart_toEndOf="@id/viewkey_textview"
|
||||
app:layout_constraintTop_toBottomOf="@id/wallet_viewkey_desc_textview" />
|
||||
<TextView
|
||||
android:id="@+id/wallet_restore_height_label_textview"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold"
|
||||
android:text="@string/wallet_restore_height_label"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/copy_viewkey_imagebutton" />
|
||||
<TextView
|
||||
android:id="@+id/restore_height_textview"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/wallet_restore_height_label_textview"
|
||||
tools:text="INFORMATION" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</ScrollView>
|
|
@ -104,4 +104,9 @@
|
|||
<string name="cant_edit_current_node">Cannot edit current node.</string>
|
||||
<string name="cant_edit_default_nodes">Cannot edit default node.</string>
|
||||
<string name="edit_node">Edit Node</string>
|
||||
<string name="wallet_seed_label">Recovery phrase</string>
|
||||
<string name="wallet_seed_desc">Anyone with your recovery phrase can spend ALL coins in this wallet!</string>
|
||||
<string name="wallet_viewkey_label">Private view-key</string>
|
||||
<string name="wallet_viewkey_desc">Anyone with your private view-key can see all incoming transactions!</string>
|
||||
<string name="wallet_restore_height_label">Restore height</string>
|
||||
</resources>
|
||||
|
|
Loading…
Reference in a new issue