mirror of
https://codeberg.org/r4v3r23/mysu.git
synced 2024-11-10 05:03:44 +01:00
Display viewkey and restore height on wallet keys dialog
This commit is contained in:
parent
6be5d2a504
commit
92c41c2501
@ -13,11 +13,11 @@ import androidx.annotation.Nullable;
|
|||||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
||||||
|
|
||||||
import net.mynero.wallet.R;
|
import net.mynero.wallet.R;
|
||||||
|
import net.mynero.wallet.model.Wallet;
|
||||||
|
import net.mynero.wallet.model.WalletManager;
|
||||||
import net.mynero.wallet.util.Helper;
|
import net.mynero.wallet.util.Helper;
|
||||||
|
|
||||||
public class WalletKeysBottomSheetDialog extends BottomSheetDialogFragment {
|
public class WalletKeysBottomSheetDialog extends BottomSheetDialogFragment {
|
||||||
public boolean showCopyButton = false;
|
|
||||||
public String information = "";
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
@ -27,14 +27,19 @@ public class WalletKeysBottomSheetDialog extends BottomSheetDialogFragment {
|
|||||||
@Override
|
@Override
|
||||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||||
super.onViewCreated(view, savedInstanceState);
|
super.onViewCreated(view, savedInstanceState);
|
||||||
ImageButton copyInformationImageButton = view.findViewById(R.id.copy_information_imagebutton);
|
ImageButton copyViewKeyImageButton = view.findViewById(R.id.copy_viewkey_imagebutton);
|
||||||
if (showCopyButton) {
|
TextView informationTextView = view.findViewById(R.id.information_textview); // seed
|
||||||
copyInformationImageButton.setVisibility(View.VISIBLE);
|
TextView viewKeyTextView = view.findViewById(R.id.viewkey_textview);
|
||||||
} else {
|
TextView restoreHeightTextView = view.findViewById(R.id.restore_height_textview);
|
||||||
copyInformationImageButton.setVisibility(View.INVISIBLE);
|
|
||||||
}
|
Wallet wallet = WalletManager.getInstance().getWallet();
|
||||||
TextView informationTextView = view.findViewById(R.id.information_textview);
|
String seed = wallet.getSeed("");
|
||||||
informationTextView.setText(information);
|
String privateViewKey = wallet.getSecretViewKey();
|
||||||
copyInformationImageButton.setOnClickListener(view1 -> Helper.clipBoardCopy(getContext(), "information", information));
|
|
||||||
|
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() {
|
private void displaySeedDialog() {
|
||||||
WalletKeysBottomSheetDialog informationDialog = new WalletKeysBottomSheetDialog();
|
WalletKeysBottomSheetDialog informationDialog = new WalletKeysBottomSheetDialog();
|
||||||
informationDialog.showCopyButton = false;
|
|
||||||
informationDialog.information = WalletManager.getInstance().getWallet().getSeed("");
|
|
||||||
informationDialog.show(getActivity().getSupportFragmentManager(), "information_seed_dialog");
|
informationDialog.show(getActivity().getSupportFragmentManager(), "information_seed_dialog");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,26 +21,84 @@
|
|||||||
android:text="@string/wallet_keys_label"
|
android:text="@string/wallet_keys_label"
|
||||||
android:textSize="32sp"
|
android:textSize="32sp"
|
||||||
android:textStyle="bold"
|
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_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="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
|
<TextView
|
||||||
android:id="@+id/information_textview"
|
android:id="@+id/information_textview"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="8dp"
|
android:layout_marginTop="4dp"
|
||||||
android:textAlignment="center"
|
android:textSize="14sp"
|
||||||
android:textSize="16sp"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
android:textStyle="bold"
|
|
||||||
app:layout_constraintEnd_toStartOf="@id/copy_information_imagebutton"
|
|
||||||
app:layout_constraintStart_toStartOf="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" />
|
tools:text="INFORMATION" />
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/copy_information_imagebutton"
|
android:id="@+id/copy_viewkey_imagebutton"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@android:color/transparent"
|
android:background="@android:color/transparent"
|
||||||
@ -48,10 +106,30 @@
|
|||||||
android:minHeight="24dp"
|
android:minHeight="24dp"
|
||||||
android:padding="8dp"
|
android:padding="8dp"
|
||||||
android:src="@drawable/ic_content_copy_24dp"
|
android:src="@drawable/ic_content_copy_24dp"
|
||||||
app:layout_constraintBottom_toBottomOf="@id/information_textview"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toEndOf="@id/information_textview"
|
app:layout_constraintStart_toEndOf="@id/viewkey_textview"
|
||||||
app:layout_constraintTop_toTopOf="@id/information_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>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
</ScrollView>
|
</ScrollView>
|
@ -104,4 +104,9 @@
|
|||||||
<string name="cant_edit_current_node">Cannot edit current node.</string>
|
<string name="cant_edit_current_node">Cannot edit current node.</string>
|
||||||
<string name="cant_edit_default_nodes">Cannot edit default node.</string>
|
<string name="cant_edit_default_nodes">Cannot edit default node.</string>
|
||||||
<string name="edit_node">Edit 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>
|
</resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user