mirror of
https://codeberg.org/r4v3r23/mysu.git
synced 2024-11-22 22:02:25 +00:00
Styling changes and optimizations
This commit is contained in:
parent
2977a5d05d
commit
28a6fbb02c
15 changed files with 101 additions and 87 deletions
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -14,6 +14,7 @@ public class BlockchainService extends ServiceBase {
|
|||
public LiveData<Wallet.ConnectionStatus> 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() {
|
||||
|
|
|
@ -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<String> 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();
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
android:layout_height="match_parent"
|
||||
android:fillViewport="true"
|
||||
android:fitsSystemWindows="true"
|
||||
android:background="@color/oled_txBackgroundColor"
|
||||
android:padding="24dp">
|
||||
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
android:layout_height="match_parent"
|
||||
android:fillViewport="true"
|
||||
android:fitsSystemWindows="true"
|
||||
android:background="@color/oled_txBackgroundColor"
|
||||
android:padding="24dp">
|
||||
|
||||
|
||||
|
|
|
@ -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">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/oled_txBackgroundColor">
|
||||
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
android:layout_height="match_parent"
|
||||
android:fillViewport="true"
|
||||
android:fitsSystemWindows="true"
|
||||
android:background="@color/oled_txBackgroundColor"
|
||||
android:padding="24dp">
|
||||
|
||||
|
||||
|
|
|
@ -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">
|
||||
|
||||
|
||||
|
|
|
@ -1,77 +1,72 @@
|
|||
<?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:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="2dp"
|
||||
android:background="@color/oled_txBackgroundColor"
|
||||
android:padding="16dp">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<com.google.android.material.progressindicator.CircularProgressIndicator
|
||||
android:id="@+id/pbConfirmations"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:indeterminate="false"
|
||||
android:max="10"
|
||||
android:progress="8"
|
||||
android:visibility="visible"
|
||||
app:indicatorInset="0dp"
|
||||
app:indicatorSize="30dp"
|
||||
app:trackThickness="4dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/tx_amount"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tx_failed"/>
|
||||
|
||||
<com.google.android.material.progressindicator.CircularProgressIndicator
|
||||
android:id="@+id/pbConfirmations"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:indeterminate="false"
|
||||
android:max="10"
|
||||
android:progress="8"
|
||||
android:visibility="visible"
|
||||
app:indicatorInset="0dp"
|
||||
app:indicatorSize="30dp"
|
||||
app:trackThickness="4dp"
|
||||
android:layout_marginStart="16dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/tx_amount"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tx_failed"/>
|
||||
<TextView
|
||||
android:id="@+id/tvConfirmations"
|
||||
style="@style/MoneroText.Small"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="1dp"
|
||||
android:text="8"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintTop_toTopOf="@id/pbConfirmations"
|
||||
app:layout_constraintBottom_toBottomOf="@id/pbConfirmations"
|
||||
app:layout_constraintStart_toStartOf="@id/pbConfirmations"
|
||||
app:layout_constraintEnd_toEndOf="@id/pbConfirmations"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvConfirmations"
|
||||
style="@style/MoneroText.Small"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="1dp"
|
||||
android:text="8"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintTop_toTopOf="@id/pbConfirmations"
|
||||
app:layout_constraintBottom_toBottomOf="@id/pbConfirmations"
|
||||
app:layout_constraintStart_toStartOf="@id/pbConfirmations"
|
||||
app:layout_constraintEnd_toEndOf="@id/pbConfirmations"/>
|
||||
<TextView
|
||||
android:id="@+id/tx_amount"
|
||||
style="@style/MoneroText.PosAmount"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
tools:text="+ 999.999999"
|
||||
android:layout_marginStart="8dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/pbConfirmations"
|
||||
app:layout_constraintEnd_toStartOf="@id/tx_datetime"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tx_amount"
|
||||
style="@style/MoneroText.PosAmount"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
tools:text="+ 999.999999"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginStart="8dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/pbConfirmations"
|
||||
app:layout_constraintEnd_toStartOf="@id/tx_datetime"/>
|
||||
<TextView
|
||||
android:id="@+id/tx_failed"
|
||||
style="@style/MoneroText.PosFee"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/tx_list_failed_text"
|
||||
android:layout_marginStart="8dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/pbConfirmations"
|
||||
app:layout_constraintTop_toBottomOf="@id/tx_amount"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tx_failed"
|
||||
style="@style/MoneroText.PosFee"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/tx_list_failed_text"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_marginStart="8dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/pbConfirmations"
|
||||
app:layout_constraintTop_toBottomOf="@id/tx_amount"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tx_datetime"
|
||||
style="@style/MoneroText.PosDate"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
tools:text="2017-05-22 21:32"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_marginEnd="16dp"/>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
<TextView
|
||||
android:id="@+id/tx_datetime"
|
||||
style="@style/MoneroText.PosDate"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
tools:text="2017-05-22 21:32"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -6,6 +6,7 @@
|
|||
android:layout_height="match_parent"
|
||||
android:fillViewport="true"
|
||||
android:fitsSystemWindows="true"
|
||||
android:background="@color/oled_txBackgroundColor"
|
||||
android:padding="24dp">
|
||||
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
<color name="oled_colorOnError">#ffffff</color>
|
||||
<color name="edittext_bg_color">#202020</color>
|
||||
<color name="oled_locked_utxo">#956E43</color>
|
||||
<color name="oled_txBackgroundColor">#0E0E0E</color>
|
||||
|
||||
<!-- CLASSIC -->
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
<color name="edittext_bg_color">#CCCCCC</color>
|
||||
<color name="button_disabled_bg_color">#454545</color>
|
||||
<color name="oled_locked_utxo">#B5895A</color>
|
||||
<color name="oled_txBackgroundColor">#F1F1F1</color>
|
||||
|
||||
<!-- CLASSIC -->
|
||||
|
||||
|
|
Loading…
Reference in a new issue