Verified Commit 08b8f242 authored by Sarath's avatar Sarath
Browse files

Improved progress animation in balance activity

parent 5cb915f4
package com.samourai.wallet.home;
import android.Manifest;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.app.Activity;
import android.app.ProgressDialog;
......@@ -159,7 +161,7 @@ public class BalanceActivity extends SamouraiActivity {
if (ACTION_INTENT.equals(intent.getAction())) {
if (progressBar != null) {
progressBar.setVisibility(View.VISIBLE);
showProgress();
}
final boolean notifTx = intent.getBooleanExtra("notifTx", false);
final boolean fetch = intent.getBooleanExtra("fetch", false);
......@@ -395,7 +397,7 @@ public class BalanceActivity extends SamouraiActivity {
txSwipeLayout.setOnRefreshListener(() -> {
refreshTx(false, true, false);
txSwipeLayout.setRefreshing(false);
progressBar.setVisibility(View.VISIBLE);
showProgress();
});
IntentFilter filter = new IntentFilter(ACTION_INTENT);
......@@ -435,7 +437,7 @@ public class BalanceActivity extends SamouraiActivity {
}
setUpTor();
initViewModel();
progressBar.setVisibility(View.VISIBLE);
showProgress();
if (account == 0) {
final Handler delayedHandler = new Handler();
......@@ -493,6 +495,15 @@ public class BalanceActivity extends SamouraiActivity {
checkDeepLinks();
}
private void hideProgress() {
progressBar.hide();
}
private void showProgress() {
progressBar.setIndeterminate(true);
progressBar.show();
}
private void checkDeepLinks() {
Bundle bundle = getIntent().getExtras();
if (bundle == null) {
......@@ -853,7 +864,7 @@ public class BalanceActivity extends SamouraiActivity {
}
if (resultCode == Activity.RESULT_OK && requestCode == UTXO_REQUESTCODE) {
refreshTx(false, false, false);
progressBar.setVisibility(View.VISIBLE);
showProgress();
} else {
;
}
......@@ -926,7 +937,7 @@ public class BalanceActivity extends SamouraiActivity {
}
if (progressBar.getVisibility() == View.VISIBLE && fromRefreshService) {
progressBar.setVisibility(View.INVISIBLE);
hideProgress();
}
});
......
......@@ -45,13 +45,13 @@
android:id="@+id/progressBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:indicatorColor="@color/accent"
app:indicatorCornerRadius="5dp"
app:indicatorSize="5dp"
android:layout_marginBottom="-2dp"
app:indicatorSize="3dp"
app:growMode="bidirectional"
app:linearSeamless="true"
app:trackColor="@android:color/transparent"
android:indeterminate="true"
android:visibility="invisible" />
android:visibility="visible" />
</com.google.android.material.appbar.AppBarLayout>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment