diff --git a/app/src/main/java/com/m2049r/xmrwallet/MainActivity.java b/app/src/main/java/com/m2049r/xmrwallet/MainActivity.java
index d59d95f..d8579c7 100644
--- a/app/src/main/java/com/m2049r/xmrwallet/MainActivity.java
+++ b/app/src/main/java/com/m2049r/xmrwallet/MainActivity.java
@@ -90,7 +90,7 @@ public class MainActivity extends AppCompatActivity implements MoneroHandlerThre
@Override
public void onConnectionFail() {
- System.out.println("CONNECT FAILED");
+ Toast.makeText(this, R.string.connection_failed, Toast.LENGTH_SHORT).show();
}
@Override
diff --git a/app/src/main/java/com/m2049r/xmrwallet/fragment/settings/SettingsFragment.java b/app/src/main/java/com/m2049r/xmrwallet/fragment/settings/SettingsFragment.java
index 439752a..3bf5883 100644
--- a/app/src/main/java/com/m2049r/xmrwallet/fragment/settings/SettingsFragment.java
+++ b/app/src/main/java/com/m2049r/xmrwallet/fragment/settings/SettingsFragment.java
@@ -45,6 +45,7 @@ public class SettingsFragment extends Fragment implements PasswordBottomSheetDia
Button displaySeedButton = view.findViewById(R.id.display_seed_button);
TextView walletInfoTextView = view.findViewById(R.id.wallet_info_textview);
SwitchCompat nightModeSwitch = view.findViewById(R.id.day_night_switch);
+ SwitchCompat torSwitch = view.findViewById(R.id.tor_switch);
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("Private view-key: " + wallet.getSecretViewKey()+"\n\n");
@@ -62,6 +63,15 @@ public class SettingsFragment extends Fragment implements PasswordBottomSheetDia
}
});
+ torSwitch.setChecked(PrefService.getInstance().getBoolean(Constants.PREF_USES_TOR, false));
+ torSwitch.setOnCheckedChangeListener((compoundButton, b) -> {
+ PrefService.getInstance().edit().putBoolean(Constants.PREF_USES_TOR, b).apply();
+
+ String proxy = b ? "127.0.0.1:9050" : "";
+ WalletManager.getInstance().setProxy(proxy);
+ WalletManager.getInstance().getWallet().setProxy(proxy);
+ });
+
displaySeedButton.setOnClickListener(view1 -> {
boolean usesPassword = PrefService.getInstance().getBoolean(Constants.PREF_USES_PASSWORD, false);
if(usesPassword) {
diff --git a/app/src/main/java/com/m2049r/xmrwallet/service/MoneroHandlerThread.java b/app/src/main/java/com/m2049r/xmrwallet/service/MoneroHandlerThread.java
index 0570530..4474f1f 100644
--- a/app/src/main/java/com/m2049r/xmrwallet/service/MoneroHandlerThread.java
+++ b/app/src/main/java/com/m2049r/xmrwallet/service/MoneroHandlerThread.java
@@ -26,6 +26,7 @@ import com.m2049r.xmrwallet.model.PendingTransaction;
import com.m2049r.xmrwallet.model.Wallet;
import com.m2049r.xmrwallet.model.WalletListener;
import com.m2049r.xmrwallet.model.WalletManager;
+import com.m2049r.xmrwallet.util.Constants;
import java.io.File;
@@ -55,9 +56,15 @@ public class MoneroHandlerThread extends Thread implements WalletListener {
@Override
public void run() {
- WalletManager.getInstance().setProxy("127.0.0.1:9050");
- WalletManager.getInstance().setDaemon(Node.fromString(DefaultNodes.MONERUJO_ONION.getUri()));
- wallet.setProxy("127.0.0.1:9050");
+ boolean usesTor = PrefService.getInstance().getBoolean(Constants.PREF_USES_TOR, false);
+ if(usesTor) {
+ String proxy = "127.0.0.1:9050";
+ WalletManager.getInstance().setProxy(proxy);
+ WalletManager.getInstance().setDaemon(Node.fromString(DefaultNodes.MONERUJO_ONION.getUri()));
+ wallet.setProxy(proxy);
+ } else {
+ WalletManager.getInstance().setDaemon(Node.fromString(DefaultNodes.XMRTW.getUri()));
+ }
wallet.init(0);
wallet.setListener(this);
wallet.startRefresh();
diff --git a/app/src/main/java/com/m2049r/xmrwallet/util/Constants.java b/app/src/main/java/com/m2049r/xmrwallet/util/Constants.java
index 859ec8e..c819cb5 100644
--- a/app/src/main/java/com/m2049r/xmrwallet/util/Constants.java
+++ b/app/src/main/java/com/m2049r/xmrwallet/util/Constants.java
@@ -4,4 +4,5 @@ public class Constants {
public static final String WALLET_NAME = "xmr_wallet";
public static final String MNEMONIC_LANGUAGE = "English";
public static final String PREF_USES_PASSWORD = "pref_uses_password";
+ public static final String PREF_USES_TOR = "pref_uses_tor";
}
diff --git a/app/src/main/res/layout/fragment_settings.xml b/app/src/main/res/layout/fragment_settings.xml
index c4e8a19..5984809 100644
--- a/app/src/main/res/layout/fragment_settings.xml
+++ b/app/src/main/res/layout/fragment_settings.xml
@@ -20,14 +20,14 @@
android:id="@+id/display_seed_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:text="Display recovery phrase"
+ android:text="@string/display_recovery_phrase"
android:layout_marginTop="16dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
-
-
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 65137df..3e31183 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -546,4 +546,7 @@
Invalid mnemonic
Copied to clipboard
Night mode
+ Display recovery phrase
+ Enable Tor (requires Orbot or similar app)
+ Connection failed