mirror of
https://codeberg.org/r4v3r23/mysu.git
synced 2024-11-10 05:03:44 +01:00
Styling changes and optimizations
This commit is contained in:
parent
2977a5d05d
commit
28a6fbb02c
@ -113,10 +113,10 @@ public class MainActivity extends AppCompatActivity implements MoneroHandlerThre
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRefresh() {
|
public void onRefresh(long height) {
|
||||||
this.historyService.refreshHistory();
|
this.historyService.refreshHistory();
|
||||||
this.balanceService.refreshBalance();
|
this.balanceService.refreshBalance();
|
||||||
this.blockchainService.refreshBlockchain();
|
this.blockchainService.refreshBlockchain(height);
|
||||||
this.addressService.refreshAddresses();
|
this.addressService.refreshAddresses();
|
||||||
this.utxoService.refreshUtxos();
|
this.utxoService.refreshUtxos();
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,7 @@ public class ReceiveBottomSheetDialog extends BottomSheetDialogFragment {
|
|||||||
if (bitMatrix.get(j, i)) {
|
if (bitMatrix.get(j, i)) {
|
||||||
pixels[i * width + j] = night ? 0xffffffff : 0x00000000;
|
pixels[i * width + j] = night ? 0xffffffff : 0x00000000;
|
||||||
} else {
|
} else {
|
||||||
pixels[i * height + j] = night ? getResources().getColor(R.color.oled_colorBackground) : 0xffffffff;
|
pixels[i * height + j] = getResources().getColor(R.color.oled_txBackgroundColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -137,15 +137,17 @@ public class OnboardingFragment extends Fragment {
|
|||||||
PrefService.getInstance().edit().putBoolean(Constants.PREF_USES_TOR, b).apply();
|
PrefService.getInstance().edit().putBoolean(Constants.PREF_USES_TOR, b).apply();
|
||||||
if (b) {
|
if (b) {
|
||||||
String proxyString = PrefService.getInstance().getString(Constants.PREF_PROXY, "");
|
String proxyString = PrefService.getInstance().getString(Constants.PREF_PROXY, "");
|
||||||
if (proxyString.contains(":")) {
|
|
||||||
removeProxyTextListeners();
|
removeProxyTextListeners();
|
||||||
|
|
||||||
|
if (proxyString.contains(":")) {
|
||||||
String proxyAddress = proxyString.split(":")[0];
|
String proxyAddress = proxyString.split(":")[0];
|
||||||
String proxyPort = proxyString.split(":")[1];
|
String proxyPort = proxyString.split(":")[1];
|
||||||
initProxyStuff(proxyAddress, proxyPort);
|
initProxyStuff(proxyAddress, proxyPort);
|
||||||
|
} else {
|
||||||
addProxyTextListeners();
|
initProxyStuff("127.0.0.1", "9050");
|
||||||
}
|
}
|
||||||
|
addProxyTextListeners();
|
||||||
|
|
||||||
proxySettingsLayout.setVisibility(View.VISIBLE);
|
proxySettingsLayout.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
proxySettingsLayout.setVisibility(View.GONE);
|
proxySettingsLayout.setVisibility(View.GONE);
|
||||||
|
@ -14,6 +14,7 @@ public class BlockchainService extends ServiceBase {
|
|||||||
public LiveData<Wallet.ConnectionStatus> connectionStatus = _connectionStatus;
|
public LiveData<Wallet.ConnectionStatus> connectionStatus = _connectionStatus;
|
||||||
private long daemonHeight = 0;
|
private long daemonHeight = 0;
|
||||||
private long lastDaemonHeightUpdateTimeMs = 0;
|
private long lastDaemonHeightUpdateTimeMs = 0;
|
||||||
|
public static long GETHEIGHT_FETCH = -1;
|
||||||
|
|
||||||
public BlockchainService(MoneroHandlerThread thread) {
|
public BlockchainService(MoneroHandlerThread thread) {
|
||||||
super(thread);
|
super(thread);
|
||||||
@ -24,8 +25,8 @@ public class BlockchainService extends ServiceBase {
|
|||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void refreshBlockchain() {
|
public void refreshBlockchain(long height) {
|
||||||
_currentHeight.postValue(getCurrentHeight());
|
_currentHeight.postValue(height == GETHEIGHT_FETCH ? getCurrentHeight() : height);
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getCurrentHeight() {
|
public long getCurrentHeight() {
|
||||||
|
@ -51,7 +51,7 @@ public class MoneroHandlerThread extends Thread implements WalletListener {
|
|||||||
@Override
|
@Override
|
||||||
public synchronized void start() {
|
public synchronized void start() {
|
||||||
super.start();
|
super.start();
|
||||||
this.listener.onRefresh();
|
this.listener.onRefresh(BlockchainService.GETHEIGHT_FETCH);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -85,15 +85,17 @@ public class MoneroHandlerThread extends Thread implements WalletListener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void newBlock(long height) {
|
public void newBlock(long height) {
|
||||||
if(height % 100 == 0) {
|
if(isEveryNthBlock(height, 100)) { // refresh services every 100 blocks downloaded
|
||||||
refresh(false);
|
refresh(false, height);
|
||||||
|
} else if(isEveryNthBlock(height, 2160)) { // save wallet every 2160 blocks (~3 days)
|
||||||
|
wallet.store();
|
||||||
}
|
}
|
||||||
BlockchainService.getInstance().setDaemonHeight(wallet.isSynchronized() ? height : 0);
|
BlockchainService.getInstance().setDaemonHeight(wallet.isSynchronized() ? height : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updated() {
|
public void updated() {
|
||||||
refresh(false);
|
refresh(false, BlockchainService.GETHEIGHT_FETCH);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -107,21 +109,22 @@ public class MoneroHandlerThread extends Thread implements WalletListener {
|
|||||||
listener.onConnectionFail();
|
listener.onConnectionFail();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
BlockchainService.getInstance().setDaemonHeight(wallet.getDaemonBlockChainHeight());
|
long height = wallet.getDaemonBlockChainHeight();
|
||||||
|
BlockchainService.getInstance().setDaemonHeight(height);
|
||||||
wallet.setSynchronized();
|
wallet.setSynchronized();
|
||||||
wallet.store();
|
wallet.store();
|
||||||
refresh(true);
|
refresh(true, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockchainService.getInstance().setConnectionStatus(status);
|
BlockchainService.getInstance().setConnectionStatus(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void refresh(boolean refreshCoins) {
|
private void refresh(boolean refreshCoins, long height) {
|
||||||
wallet.refreshHistory();
|
wallet.refreshHistory();
|
||||||
if (refreshCoins) {
|
if (refreshCoins) {
|
||||||
wallet.refreshCoins();
|
wallet.refreshCoins();
|
||||||
}
|
}
|
||||||
listener.onRefresh();
|
listener.onRefresh(height);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PendingTransaction createTx(String address, String amountStr, boolean sendAll, PendingTransaction.Priority feePriority, ArrayList<String> selectedUtxos) throws Exception {
|
public PendingTransaction createTx(String address, String amountStr, boolean sendAll, PendingTransaction.Priority feePriority, ArrayList<String> selectedUtxos) throws Exception {
|
||||||
@ -156,8 +159,12 @@ public class MoneroHandlerThread extends Thread implements WalletListener {
|
|||||||
return pendingTx.commit("", true);
|
return pendingTx.commit("", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isEveryNthBlock(long height, long interval) {
|
||||||
|
return height % interval == 0;
|
||||||
|
}
|
||||||
|
|
||||||
public interface Listener {
|
public interface Listener {
|
||||||
void onRefresh();
|
void onRefresh(long height);
|
||||||
|
|
||||||
void onConnectionFail();
|
void onConnectionFail();
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:fillViewport="true"
|
android:fillViewport="true"
|
||||||
android:fitsSystemWindows="true"
|
android:fitsSystemWindows="true"
|
||||||
|
android:background="@color/oled_txBackgroundColor"
|
||||||
android:padding="24dp">
|
android:padding="24dp">
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:fillViewport="true"
|
android:fillViewport="true"
|
||||||
android:fitsSystemWindows="true"
|
android:fitsSystemWindows="true"
|
||||||
|
android:background="@color/oled_txBackgroundColor"
|
||||||
android:padding="24dp">
|
android:padding="24dp">
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:fillViewport="true"
|
android:fillViewport="true"
|
||||||
|
android:background="@color/oled_txBackgroundColor"
|
||||||
android:padding="24dp">
|
android:padding="24dp">
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
@ -2,7 +2,8 @@
|
|||||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/oled_txBackgroundColor">
|
||||||
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:fillViewport="true"
|
android:fillViewport="true"
|
||||||
android:fitsSystemWindows="true"
|
android:fitsSystemWindows="true"
|
||||||
|
android:background="@color/oled_txBackgroundColor"
|
||||||
android:padding="24dp">
|
android:padding="24dp">
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/oled_txBackgroundColor"
|
||||||
android:fitsSystemWindows="true">
|
android:fitsSystemWindows="true">
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="2dp"
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
android:background="@color/oled_txBackgroundColor"
|
||||||
android:layout_width="match_parent"
|
android:padding="16dp">
|
||||||
android:layout_height="match_parent">
|
|
||||||
|
|
||||||
<com.google.android.material.progressindicator.CircularProgressIndicator
|
<com.google.android.material.progressindicator.CircularProgressIndicator
|
||||||
android:id="@+id/pbConfirmations"
|
android:id="@+id/pbConfirmations"
|
||||||
@ -21,7 +21,6 @@
|
|||||||
app:indicatorInset="0dp"
|
app:indicatorInset="0dp"
|
||||||
app:indicatorSize="30dp"
|
app:indicatorSize="30dp"
|
||||||
app:trackThickness="4dp"
|
app:trackThickness="4dp"
|
||||||
android:layout_marginStart="16dp"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="@id/tx_amount"
|
app:layout_constraintTop_toTopOf="@id/tx_amount"
|
||||||
app:layout_constraintBottom_toBottomOf="@id/tx_failed"/>
|
app:layout_constraintBottom_toBottomOf="@id/tx_failed"/>
|
||||||
@ -45,7 +44,6 @@
|
|||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
tools:text="+ 999.999999"
|
tools:text="+ 999.999999"
|
||||||
android:layout_marginTop="8dp"
|
|
||||||
android:layout_marginStart="8dp"
|
android:layout_marginStart="8dp"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintStart_toEndOf="@id/pbConfirmations"
|
app:layout_constraintStart_toEndOf="@id/pbConfirmations"
|
||||||
@ -57,7 +55,6 @@
|
|||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/tx_list_failed_text"
|
android:text="@string/tx_list_failed_text"
|
||||||
android:layout_marginBottom="8dp"
|
|
||||||
android:layout_marginStart="8dp"
|
android:layout_marginStart="8dp"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintStart_toEndOf="@id/pbConfirmations"
|
app:layout_constraintStart_toEndOf="@id/pbConfirmations"
|
||||||
@ -71,7 +68,5 @@
|
|||||||
tools:text="2017-05-22 21:32"
|
tools:text="2017-05-22 21:32"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||||
android:layout_marginEnd="16dp"/>
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
</com.google.android.material.card.MaterialCardView>
|
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:fillViewport="true"
|
android:fillViewport="true"
|
||||||
android:fitsSystemWindows="true"
|
android:fitsSystemWindows="true"
|
||||||
|
android:background="@color/oled_txBackgroundColor"
|
||||||
android:padding="24dp">
|
android:padding="24dp">
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
<color name="oled_colorOnError">#ffffff</color>
|
<color name="oled_colorOnError">#ffffff</color>
|
||||||
<color name="edittext_bg_color">#202020</color>
|
<color name="edittext_bg_color">#202020</color>
|
||||||
<color name="oled_locked_utxo">#956E43</color>
|
<color name="oled_locked_utxo">#956E43</color>
|
||||||
|
<color name="oled_txBackgroundColor">#0E0E0E</color>
|
||||||
|
|
||||||
<!-- CLASSIC -->
|
<!-- CLASSIC -->
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
<color name="edittext_bg_color">#CCCCCC</color>
|
<color name="edittext_bg_color">#CCCCCC</color>
|
||||||
<color name="button_disabled_bg_color">#454545</color>
|
<color name="button_disabled_bg_color">#454545</color>
|
||||||
<color name="oled_locked_utxo">#B5895A</color>
|
<color name="oled_locked_utxo">#B5895A</color>
|
||||||
|
<color name="oled_txBackgroundColor">#F1F1F1</color>
|
||||||
|
|
||||||
<!-- CLASSIC -->
|
<!-- CLASSIC -->
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user