mirror of
https://codeberg.org/anoncontributorxmr/mysu.git
synced 2024-11-22 07:22:26 +00:00
Merge branch 'feature/node-in-onboarding' into dev
This commit is contained in:
commit
064eada022
6 changed files with 66 additions and 11 deletions
|
@ -24,6 +24,9 @@ import androidx.lifecycle.ViewModelProvider;
|
||||||
import net.mynero.wallet.MainActivity;
|
import net.mynero.wallet.MainActivity;
|
||||||
import net.mynero.wallet.MoneroApplication;
|
import net.mynero.wallet.MoneroApplication;
|
||||||
import net.mynero.wallet.R;
|
import net.mynero.wallet.R;
|
||||||
|
import net.mynero.wallet.data.Node;
|
||||||
|
import net.mynero.wallet.fragment.dialog.AddNodeBottomSheetDialog;
|
||||||
|
import net.mynero.wallet.fragment.dialog.NodeSelectionBottomSheetDialog;
|
||||||
import net.mynero.wallet.model.Wallet;
|
import net.mynero.wallet.model.Wallet;
|
||||||
import net.mynero.wallet.model.WalletManager;
|
import net.mynero.wallet.model.WalletManager;
|
||||||
import net.mynero.wallet.service.PrefService;
|
import net.mynero.wallet.service.PrefService;
|
||||||
|
@ -33,7 +36,7 @@ import net.mynero.wallet.util.RestoreHeight;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
|
||||||
public class OnboardingFragment extends Fragment {
|
public class OnboardingFragment extends Fragment implements NodeSelectionBottomSheetDialog.NodeSelectionDialogListener, AddNodeBottomSheetDialog.AddNodeListener {
|
||||||
private boolean useOffset = true;
|
private boolean useOffset = true;
|
||||||
private OnboardingViewModel mViewModel;
|
private OnboardingViewModel mViewModel;
|
||||||
TextWatcher proxyAddressListener = new TextWatcher() {
|
TextWatcher proxyAddressListener = new TextWatcher() {
|
||||||
|
@ -82,6 +85,7 @@ public class OnboardingFragment extends Fragment {
|
||||||
private ConstraintLayout proxySettingsLayout;
|
private ConstraintLayout proxySettingsLayout;
|
||||||
private ImageView moreOptionsChevronImageView;
|
private ImageView moreOptionsChevronImageView;
|
||||||
private CheckBox seedOffsetCheckbox;
|
private CheckBox seedOffsetCheckbox;
|
||||||
|
private Button selectNodeButton;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
|
||||||
|
@ -93,6 +97,7 @@ public class OnboardingFragment extends Fragment {
|
||||||
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);
|
||||||
mViewModel = new ViewModelProvider(this).get(OnboardingViewModel.class);
|
mViewModel = new ViewModelProvider(this).get(OnboardingViewModel.class);
|
||||||
|
selectNodeButton = view.findViewById(R.id.select_node_button);
|
||||||
walletPasswordEditText = view.findViewById(R.id.wallet_password_edittext);
|
walletPasswordEditText = view.findViewById(R.id.wallet_password_edittext);
|
||||||
walletPasswordConfirmEditText = view.findViewById(R.id.wallet_password_confirm_edittext);
|
walletPasswordConfirmEditText = view.findViewById(R.id.wallet_password_confirm_edittext);
|
||||||
walletSeedEditText = view.findViewById(R.id.wallet_seed_edittext);
|
walletSeedEditText = view.findViewById(R.id.wallet_seed_edittext);
|
||||||
|
@ -201,6 +206,14 @@ public class OnboardingFragment extends Fragment {
|
||||||
|
|
||||||
mViewModel.updateProxy(((MoneroApplication)getActivity().getApplication()));
|
mViewModel.updateProxy(((MoneroApplication)getActivity().getApplication()));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Node node = PrefService.getInstance().getNode(); // should be using default here
|
||||||
|
selectNodeButton.setText(getString(R.string.node_button_text, node.getAddress()));
|
||||||
|
selectNodeButton.setOnClickListener(view1 -> {
|
||||||
|
NodeSelectionBottomSheetDialog dialog = new NodeSelectionBottomSheetDialog();
|
||||||
|
dialog.listener = this;
|
||||||
|
dialog.show(getActivity().getSupportFragmentManager(), "node_selection_dialog");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void prepareDefaultNode() {
|
private void prepareDefaultNode() {
|
||||||
|
@ -286,4 +299,28 @@ public class OnboardingFragment extends Fragment {
|
||||||
private boolean checkMnemonic(String seed) {
|
private boolean checkMnemonic(String seed) {
|
||||||
return (seed.split("\\s").length == 25);
|
return (seed.split("\\s").length == 25);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNodeSelected() {
|
||||||
|
Node node = PrefService.getInstance().getNode();
|
||||||
|
selectNodeButton.setText(getString(R.string.node_button_text, node.getAddress()));
|
||||||
|
mViewModel.updateProxy(((MoneroApplication)getActivity().getApplication()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClickedEditNode(String nodeString) { }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClickedAddNode() {
|
||||||
|
AddNodeBottomSheetDialog addNodeDialog = new AddNodeBottomSheetDialog();
|
||||||
|
addNodeDialog.listener = this;
|
||||||
|
addNodeDialog.show(getActivity().getSupportFragmentManager(), "add_node_dialog");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNodeAdded() {
|
||||||
|
NodeSelectionBottomSheetDialog dialog = new NodeSelectionBottomSheetDialog();
|
||||||
|
dialog.listener = this;
|
||||||
|
dialog.show(getActivity().getSupportFragmentManager(), "node_selection_dialog");
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -15,11 +15,28 @@
|
||||||
android:text="@string/create_wallet"
|
android:text="@string/create_wallet"
|
||||||
android:textSize="32sp"
|
android:textSize="32sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
app:layout_constraintBottom_toTopOf="@id/wallet_password_edittext"
|
app:layout_constraintBottom_toTopOf="@id/select_node_button"
|
||||||
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" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/select_node_button"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:paddingStart="16dp"
|
||||||
|
android:paddingEnd="16dp"
|
||||||
|
tools:text="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
||||||
|
android:background="@drawable/button_bg"
|
||||||
|
android:ellipsize="middle"
|
||||||
|
android:singleLine="true"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.0"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/create_wallet_textview"
|
||||||
|
tools:ignore="SpeakableTextPresentCheck" />
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/wallet_password_edittext"
|
android:id="@+id/wallet_password_edittext"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
@ -27,10 +44,11 @@
|
||||||
android:background="@drawable/edittext_bg"
|
android:background="@drawable/edittext_bg"
|
||||||
android:hint="@string/password_optional"
|
android:hint="@string/password_optional"
|
||||||
android:inputType="textPassword"
|
android:inputType="textPassword"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
app:layout_constraintBottom_toTopOf="@id/wallet_password_confirm_edittext"
|
app:layout_constraintBottom_toTopOf="@id/wallet_password_confirm_edittext"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/create_wallet_textview"
|
app:layout_constraintTop_toBottomOf="@id/select_node_button"
|
||||||
tools:visibility="visible" />
|
tools:visibility="visible" />
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
|
|
|
@ -80,8 +80,8 @@ RUN set -x \
|
||||||
&& ./b2 --build-type=minimal link=static runtime-link=static --with-chrono --with-date_time --with-filesystem --with-program_options --with-regex --with-serialization --with-system --with-thread --with-locale --build-dir=android --stagedir=android toolset=clang threading=multi threadapi=pthread target-os=android -sICONV_PATH=${PREFIX} install -j${NPROC}
|
&& ./b2 --build-type=minimal link=static runtime-link=static --with-chrono --with-date_time --with-filesystem --with-program_options --with-regex --with-serialization --with-system --with-thread --with-locale --build-dir=android --stagedir=android toolset=clang threading=multi threadapi=pthread target-os=android -sICONV_PATH=${PREFIX} install -j${NPROC}
|
||||||
|
|
||||||
# download, configure and make Zlib
|
# download, configure and make Zlib
|
||||||
ENV ZLIB_VERSION 1.2.12
|
ENV ZLIB_VERSION 1.2.13
|
||||||
ENV ZLIB_HASH 91844808532e5ce316b3c010929493c0244f3d37593afd6de04f71821d5136d9
|
ENV ZLIB_HASH b3a24de97a8fdbc835b9833169501030b8977031bcb54b3b3ac13740f846ab30
|
||||||
RUN set -x \
|
RUN set -x \
|
||||||
&& curl -O https://zlib.net/zlib-${ZLIB_VERSION}.tar.gz \
|
&& curl -O https://zlib.net/zlib-${ZLIB_VERSION}.tar.gz \
|
||||||
&& echo "${ZLIB_HASH} zlib-${ZLIB_VERSION}.tar.gz" | sha256sum -c \
|
&& echo "${ZLIB_HASH} zlib-${ZLIB_VERSION}.tar.gz" | sha256sum -c \
|
||||||
|
|
|
@ -80,8 +80,8 @@ RUN set -x \
|
||||||
&& ./b2 --build-type=minimal link=static runtime-link=static --with-chrono --with-date_time --with-filesystem --with-program_options --with-regex --with-serialization --with-system --with-thread --with-locale --build-dir=android --stagedir=android toolset=clang threading=multi threadapi=pthread target-os=android -sICONV_PATH=${PREFIX} install -j${NPROC}
|
&& ./b2 --build-type=minimal link=static runtime-link=static --with-chrono --with-date_time --with-filesystem --with-program_options --with-regex --with-serialization --with-system --with-thread --with-locale --build-dir=android --stagedir=android toolset=clang threading=multi threadapi=pthread target-os=android -sICONV_PATH=${PREFIX} install -j${NPROC}
|
||||||
|
|
||||||
# download, configure and make Zlib
|
# download, configure and make Zlib
|
||||||
ENV ZLIB_VERSION 1.2.12
|
ENV ZLIB_VERSION 1.2.13
|
||||||
ENV ZLIB_HASH 91844808532e5ce316b3c010929493c0244f3d37593afd6de04f71821d5136d9
|
ENV ZLIB_HASH b3a24de97a8fdbc835b9833169501030b8977031bcb54b3b3ac13740f846ab30
|
||||||
RUN set -x \
|
RUN set -x \
|
||||||
&& curl -O https://zlib.net/zlib-${ZLIB_VERSION}.tar.gz \
|
&& curl -O https://zlib.net/zlib-${ZLIB_VERSION}.tar.gz \
|
||||||
&& echo "${ZLIB_HASH} zlib-${ZLIB_VERSION}.tar.gz" | sha256sum -c \
|
&& echo "${ZLIB_HASH} zlib-${ZLIB_VERSION}.tar.gz" | sha256sum -c \
|
||||||
|
|
|
@ -80,8 +80,8 @@ RUN set -x \
|
||||||
&& ./b2 --build-type=minimal link=static runtime-link=static --with-chrono --with-date_time --with-filesystem --with-program_options --with-regex --with-serialization --with-system --with-thread --with-locale --build-dir=android --stagedir=android toolset=clang threading=multi threadapi=pthread target-os=android -sICONV_PATH=${PREFIX} install -j${NPROC}
|
&& ./b2 --build-type=minimal link=static runtime-link=static --with-chrono --with-date_time --with-filesystem --with-program_options --with-regex --with-serialization --with-system --with-thread --with-locale --build-dir=android --stagedir=android toolset=clang threading=multi threadapi=pthread target-os=android -sICONV_PATH=${PREFIX} install -j${NPROC}
|
||||||
|
|
||||||
# download, configure and make Zlib
|
# download, configure and make Zlib
|
||||||
ENV ZLIB_VERSION 1.2.12
|
ENV ZLIB_VERSION 1.2.13
|
||||||
ENV ZLIB_HASH 91844808532e5ce316b3c010929493c0244f3d37593afd6de04f71821d5136d9
|
ENV ZLIB_HASH b3a24de97a8fdbc835b9833169501030b8977031bcb54b3b3ac13740f846ab30
|
||||||
RUN set -x \
|
RUN set -x \
|
||||||
&& curl -O https://zlib.net/zlib-${ZLIB_VERSION}.tar.gz \
|
&& curl -O https://zlib.net/zlib-${ZLIB_VERSION}.tar.gz \
|
||||||
&& echo "${ZLIB_HASH} zlib-${ZLIB_VERSION}.tar.gz" | sha256sum -c \
|
&& echo "${ZLIB_HASH} zlib-${ZLIB_VERSION}.tar.gz" | sha256sum -c \
|
||||||
|
|
|
@ -80,8 +80,8 @@ RUN set -x \
|
||||||
&& ./b2 --build-type=minimal link=static runtime-link=static --with-chrono --with-date_time --with-filesystem --with-program_options --with-regex --with-serialization --with-system --with-thread --with-locale --build-dir=android --stagedir=android toolset=clang threading=multi threadapi=pthread target-os=android -sICONV_PATH=${PREFIX} install -j${NPROC}
|
&& ./b2 --build-type=minimal link=static runtime-link=static --with-chrono --with-date_time --with-filesystem --with-program_options --with-regex --with-serialization --with-system --with-thread --with-locale --build-dir=android --stagedir=android toolset=clang threading=multi threadapi=pthread target-os=android -sICONV_PATH=${PREFIX} install -j${NPROC}
|
||||||
|
|
||||||
# download, configure and make Zlib
|
# download, configure and make Zlib
|
||||||
ENV ZLIB_VERSION 1.2.12
|
ENV ZLIB_VERSION 1.2.13
|
||||||
ENV ZLIB_HASH 91844808532e5ce316b3c010929493c0244f3d37593afd6de04f71821d5136d9
|
ENV ZLIB_HASH b3a24de97a8fdbc835b9833169501030b8977031bcb54b3b3ac13740f846ab30
|
||||||
RUN set -x \
|
RUN set -x \
|
||||||
&& curl -O https://zlib.net/zlib-${ZLIB_VERSION}.tar.gz \
|
&& curl -O https://zlib.net/zlib-${ZLIB_VERSION}.tar.gz \
|
||||||
&& echo "${ZLIB_HASH} zlib-${ZLIB_VERSION}.tar.gz" | sha256sum -c \
|
&& echo "${ZLIB_HASH} zlib-${ZLIB_VERSION}.tar.gz" | sha256sum -c \
|
||||||
|
|
Loading…
Reference in a new issue