diff --git a/app/src/main/java/net/mynero/wallet/MainActivity.java b/app/src/main/java/net/mynero/wallet/MainActivity.java index 9886403..e59a2b5 100644 --- a/app/src/main/java/net/mynero/wallet/MainActivity.java +++ b/app/src/main/java/net/mynero/wallet/MainActivity.java @@ -113,10 +113,10 @@ public class MainActivity extends AppCompatActivity implements MoneroHandlerThre } @Override - public void onRefresh() { + public void onRefresh(long height) { this.historyService.refreshHistory(); this.balanceService.refreshBalance(); - this.blockchainService.refreshBlockchain(); + this.blockchainService.refreshBlockchain(height); this.addressService.refreshAddresses(); this.utxoService.refreshUtxos(); } diff --git a/app/src/main/java/net/mynero/wallet/fragment/dialog/ReceiveBottomSheetDialog.java b/app/src/main/java/net/mynero/wallet/fragment/dialog/ReceiveBottomSheetDialog.java index a787c20..63ac848 100644 --- a/app/src/main/java/net/mynero/wallet/fragment/dialog/ReceiveBottomSheetDialog.java +++ b/app/src/main/java/net/mynero/wallet/fragment/dialog/ReceiveBottomSheetDialog.java @@ -89,7 +89,7 @@ public class ReceiveBottomSheetDialog extends BottomSheetDialogFragment { if (bitMatrix.get(j, i)) { pixels[i * width + j] = night ? 0xffffffff : 0x00000000; } else { - pixels[i * height + j] = night ? getResources().getColor(R.color.oled_colorBackground) : 0xffffffff; + pixels[i * height + j] = getResources().getColor(R.color.oled_txBackgroundColor); } } } diff --git a/app/src/main/java/net/mynero/wallet/fragment/onboarding/OnboardingFragment.java b/app/src/main/java/net/mynero/wallet/fragment/onboarding/OnboardingFragment.java index ff7074f..41c8a81 100644 --- a/app/src/main/java/net/mynero/wallet/fragment/onboarding/OnboardingFragment.java +++ b/app/src/main/java/net/mynero/wallet/fragment/onboarding/OnboardingFragment.java @@ -137,15 +137,17 @@ public class OnboardingFragment extends Fragment { PrefService.getInstance().edit().putBoolean(Constants.PREF_USES_TOR, b).apply(); if (b) { String proxyString = PrefService.getInstance().getString(Constants.PREF_PROXY, ""); - if (proxyString.contains(":")) { - removeProxyTextListeners(); + removeProxyTextListeners(); + if (proxyString.contains(":")) { String proxyAddress = proxyString.split(":")[0]; String proxyPort = proxyString.split(":")[1]; initProxyStuff(proxyAddress, proxyPort); - - addProxyTextListeners(); + } else { + initProxyStuff("127.0.0.1", "9050"); } + addProxyTextListeners(); + proxySettingsLayout.setVisibility(View.VISIBLE); } else { proxySettingsLayout.setVisibility(View.GONE); diff --git a/app/src/main/java/net/mynero/wallet/service/BlockchainService.java b/app/src/main/java/net/mynero/wallet/service/BlockchainService.java index 0897cf8..ad14d63 100644 --- a/app/src/main/java/net/mynero/wallet/service/BlockchainService.java +++ b/app/src/main/java/net/mynero/wallet/service/BlockchainService.java @@ -14,6 +14,7 @@ public class BlockchainService extends ServiceBase { public LiveData connectionStatus = _connectionStatus; private long daemonHeight = 0; private long lastDaemonHeightUpdateTimeMs = 0; + public static long GETHEIGHT_FETCH = -1; public BlockchainService(MoneroHandlerThread thread) { super(thread); @@ -24,8 +25,8 @@ public class BlockchainService extends ServiceBase { return instance; } - public void refreshBlockchain() { - _currentHeight.postValue(getCurrentHeight()); + public void refreshBlockchain(long height) { + _currentHeight.postValue(height == GETHEIGHT_FETCH ? getCurrentHeight() : height); } public long getCurrentHeight() { diff --git a/app/src/main/java/net/mynero/wallet/service/MoneroHandlerThread.java b/app/src/main/java/net/mynero/wallet/service/MoneroHandlerThread.java index 5958914..36cc8f4 100644 --- a/app/src/main/java/net/mynero/wallet/service/MoneroHandlerThread.java +++ b/app/src/main/java/net/mynero/wallet/service/MoneroHandlerThread.java @@ -51,7 +51,7 @@ public class MoneroHandlerThread extends Thread implements WalletListener { @Override public synchronized void start() { super.start(); - this.listener.onRefresh(); + this.listener.onRefresh(BlockchainService.GETHEIGHT_FETCH); } @Override @@ -85,15 +85,17 @@ public class MoneroHandlerThread extends Thread implements WalletListener { @Override public void newBlock(long height) { - if(height % 100 == 0) { - refresh(false); + if(isEveryNthBlock(height, 100)) { // refresh services every 100 blocks downloaded + refresh(false, height); + } else if(isEveryNthBlock(height, 2160)) { // save wallet every 2160 blocks (~3 days) + wallet.store(); } BlockchainService.getInstance().setDaemonHeight(wallet.isSynchronized() ? height : 0); } @Override public void updated() { - refresh(false); + refresh(false, BlockchainService.GETHEIGHT_FETCH); } @Override @@ -107,21 +109,22 @@ public class MoneroHandlerThread extends Thread implements WalletListener { listener.onConnectionFail(); } } else { - BlockchainService.getInstance().setDaemonHeight(wallet.getDaemonBlockChainHeight()); + long height = wallet.getDaemonBlockChainHeight(); + BlockchainService.getInstance().setDaemonHeight(height); wallet.setSynchronized(); wallet.store(); - refresh(true); + refresh(true, height); } BlockchainService.getInstance().setConnectionStatus(status); } - private void refresh(boolean refreshCoins) { + private void refresh(boolean refreshCoins, long height) { wallet.refreshHistory(); if (refreshCoins) { wallet.refreshCoins(); } - listener.onRefresh(); + listener.onRefresh(height); } public PendingTransaction createTx(String address, String amountStr, boolean sendAll, PendingTransaction.Priority feePriority, ArrayList selectedUtxos) throws Exception { @@ -156,8 +159,12 @@ public class MoneroHandlerThread extends Thread implements WalletListener { return pendingTx.commit("", true); } + private boolean isEveryNthBlock(long height, long interval) { + return height % interval == 0; + } + public interface Listener { - void onRefresh(); + void onRefresh(long height); void onConnectionFail(); } diff --git a/app/src/main/res/layout/add_node_bottom_sheet_dialog.xml b/app/src/main/res/layout/add_node_bottom_sheet_dialog.xml index 5078055..a2e6b02 100644 --- a/app/src/main/res/layout/add_node_bottom_sheet_dialog.xml +++ b/app/src/main/res/layout/add_node_bottom_sheet_dialog.xml @@ -6,6 +6,7 @@ android:layout_height="match_parent" android:fillViewport="true" android:fitsSystemWindows="true" + android:background="@color/oled_txBackgroundColor" android:padding="24dp"> diff --git a/app/src/main/res/layout/edit_node_bottom_sheet_dialog.xml b/app/src/main/res/layout/edit_node_bottom_sheet_dialog.xml index 33ffe15..86664ea 100644 --- a/app/src/main/res/layout/edit_node_bottom_sheet_dialog.xml +++ b/app/src/main/res/layout/edit_node_bottom_sheet_dialog.xml @@ -6,6 +6,7 @@ android:layout_height="match_parent" android:fillViewport="true" android:fitsSystemWindows="true" + android:background="@color/oled_txBackgroundColor" android:padding="24dp"> diff --git a/app/src/main/res/layout/node_selection_bottom_sheet_dialog.xml b/app/src/main/res/layout/node_selection_bottom_sheet_dialog.xml index aa702e0..f0c31ac 100644 --- a/app/src/main/res/layout/node_selection_bottom_sheet_dialog.xml +++ b/app/src/main/res/layout/node_selection_bottom_sheet_dialog.xml @@ -5,6 +5,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:fillViewport="true" + android:background="@color/oled_txBackgroundColor" android:padding="24dp"> + android:layout_height="match_parent" + android:background="@color/oled_txBackgroundColor"> diff --git a/app/src/main/res/layout/send_bottom_sheet_dialog.xml b/app/src/main/res/layout/send_bottom_sheet_dialog.xml index 652bdde..06477ce 100644 --- a/app/src/main/res/layout/send_bottom_sheet_dialog.xml +++ b/app/src/main/res/layout/send_bottom_sheet_dialog.xml @@ -4,6 +4,7 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" + android:background="@color/oled_txBackgroundColor" android:fitsSystemWindows="true"> diff --git a/app/src/main/res/layout/transaction_history_item.xml b/app/src/main/res/layout/transaction_history_item.xml index 190ed0e..f7acf33 100644 --- a/app/src/main/res/layout/transaction_history_item.xml +++ b/app/src/main/res/layout/transaction_history_item.xml @@ -1,77 +1,72 @@ - + android:layout_height="wrap_content" + android:layout_marginTop="2dp" + android:background="@color/oled_txBackgroundColor" + android:padding="16dp"> - + - + - + - + - - - - - + + \ No newline at end of file diff --git a/app/src/main/res/layout/wallet_keys_bottom_sheet_dialog.xml b/app/src/main/res/layout/wallet_keys_bottom_sheet_dialog.xml index 9df0da0..4300a09 100644 --- a/app/src/main/res/layout/wallet_keys_bottom_sheet_dialog.xml +++ b/app/src/main/res/layout/wallet_keys_bottom_sheet_dialog.xml @@ -6,6 +6,7 @@ android:layout_height="match_parent" android:fillViewport="true" android:fitsSystemWindows="true" + android:background="@color/oled_txBackgroundColor" android:padding="24dp"> diff --git a/app/src/main/res/values-night/colors.xml b/app/src/main/res/values-night/colors.xml index 505d11a..9ec2d42 100644 --- a/app/src/main/res/values-night/colors.xml +++ b/app/src/main/res/values-night/colors.xml @@ -30,6 +30,7 @@ #ffffff #202020 #956E43 + #0E0E0E diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index f2fbd3d..c8366f6 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -31,6 +31,7 @@ #CCCCCC #454545 #B5895A + #F1F1F1