mirror of
https://codeberg.org/r4v3r23/mysu.git
synced 2024-11-09 23:50:02 +00:00
Update node button text when selected node changes
This commit is contained in:
parent
e197cc038d
commit
35634b43ee
2 changed files with 13 additions and 1 deletions
|
@ -2,6 +2,7 @@ package com.m2049r.xmrwallet.fragment.dialog;
|
|||
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.util.Patterns;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -83,9 +84,11 @@ public class NodeSelectionBottomSheetDialog extends BottomSheetDialogFragment im
|
|||
PrefService.getInstance().edit().putString(Constants.PREF_NODE, node.getAddress()).apply();
|
||||
WalletManager.getInstance().setDaemon(node);
|
||||
adapter.updateSelectedNode();
|
||||
listener.onNodeSelected();
|
||||
}
|
||||
|
||||
public interface NodeSelectionDialogListener {
|
||||
void onNodeSelected();
|
||||
void onClickedAddNode();
|
||||
}
|
||||
}
|
|
@ -60,6 +60,7 @@ public class SettingsFragment extends Fragment implements PasswordBottomSheetDia
|
|||
};
|
||||
private EditText walletProxyAddressEditText;
|
||||
private EditText walletProxyPortEditText;
|
||||
private Button selectNodeButton;
|
||||
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
|
@ -72,7 +73,7 @@ public class SettingsFragment extends Fragment implements PasswordBottomSheetDia
|
|||
super.onViewCreated(view, savedInstanceState);
|
||||
mViewModel = new ViewModelProvider(this).get(SettingsViewModel.class);
|
||||
Button displaySeedButton = view.findViewById(R.id.display_seed_button);
|
||||
Button selectNodeButton = view.findViewById(R.id.select_node_button);
|
||||
selectNodeButton = view.findViewById(R.id.select_node_button);
|
||||
SwitchCompat nightModeSwitch = view.findViewById(R.id.day_night_switch);
|
||||
SwitchCompat torSwitch = view.findViewById(R.id.tor_switch);
|
||||
ConstraintLayout proxySettingsLayout = view.findViewById(R.id.wallet_proxy_settings_layout);
|
||||
|
@ -192,6 +193,14 @@ public class SettingsFragment extends Fragment implements PasswordBottomSheetDia
|
|||
walletProxyPortEditText.addTextChangedListener(proxyPortListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNodeSelected() {
|
||||
Node node = Node.fromString(PrefService.getInstance().getString(Constants.PREF_NODE, DefaultNodes.XMRTW.getAddress()));
|
||||
selectNodeButton.setText(getString(R.string.node_button_text, node.getAddress()));
|
||||
mViewModel.updateProxy();
|
||||
WalletManager.getInstance().getWallet().startRefresh();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClickedAddNode() {
|
||||
AddNodeBottomSheetDialog addNodeDialog = new AddNodeBottomSheetDialog();
|
||||
|
|
Loading…
Reference in a new issue