Commit ca484e32 authored by T Dev. D's avatar T Dev. D 😎
Browse files

Merge branch 'staging' of https://code.samourai.io/wallet/samourai-wallet-android into staging

parents 39e357a0 b0fb5fed
......@@ -238,11 +238,12 @@
<activity
android:name=".whirlpool.WhirlpoolMain"
android:label=""
android:theme="@style/SamouraiAppWhirlpoolTheme" />
android:theme="@style/Theme.Samourai.Whirlpool.Material" />
<activity
android:name=".whirlpool.newPool.NewPoolActivity"
android:label=""
android:theme="@style/SamouraiAppWhirlpoolTheme" />
android:theme="@style/Theme.Samourai.Whirlpool.Material" />
<activity
android:name=".whirlpool.CycleDetail"
android:label=""
......
......@@ -13,6 +13,7 @@ import androidx.appcompat.app.AppCompatActivity;
import android.text.InputType;
import android.transition.ChangeBounds;
import android.transition.TransitionManager;
import android.view.HapticFeedbackConstants;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
......@@ -54,10 +55,6 @@ public class PinEntryActivity extends AppCompatActivity {
private ImageButton tsend = null;
private ImageButton tback = null;
private Vibrator vibrator;
// private TextView tvPrompt = null;
// private TextView tvUserInput = null;
private StringBuilder userInput = null;
......@@ -90,11 +87,8 @@ public class PinEntryActivity extends AppCompatActivity {
setSupportActionBar(findViewById(R.id.toolbar_pinEntry));
pinEntryMaskLayout = findViewById(R.id.pin_entry_mask_layout);
progressBar = findViewById(R.id.progress_pin_entry);
// tvUserInput = (TextView) findViewById(R.id.userInput);
// tvUserInput.setText("");
vibrator = (Vibrator) this.getSystemService(VIBRATOR_SERVICE);
pinEntryView.setEntryListener((key, view) -> {
if (userInput.length() <= (AccessFactory.MAX_PIN_LENGTH - 1)){
userInput = userInput.append(key);
......@@ -243,9 +237,9 @@ public class PinEntryActivity extends AppCompatActivity {
}
public void OnNumberPadClick(View view) {
if (PrefsUtil.getInstance(PinEntryActivity.this).getValue(PrefsUtil.HAPTIC_PIN, true) == true) {
vibrator.vibrate(55);
}
if (PrefsUtil.getInstance(PinEntryActivity.this).getValue(PrefsUtil.HAPTIC_PIN, true)) {
view.performHapticFeedback(HapticFeedbackConstants.CLOCK_TICK,HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
}
userInput.append(((Button) view).getText().toString());
displayUserInput();
}
......
......@@ -737,7 +737,7 @@ public class APIFactory {
}
if(jsonObject.has("txs")) {
xpub_txs.clear();
List<String> seenHashes = new ArrayList<String>();
JSONArray txArray = (JSONArray)jsonObject.get("txs");
......@@ -2615,7 +2615,7 @@ public class APIFactory {
}
if(jsonObject.has("txs")) {
postmix_txs.clear();
JSONArray txArray = (JSONArray)jsonObject.get("txs");
JSONObject txObj = null;
for(int i = 0; i < txArray.length(); i++) {
......
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();
}
});
......
......@@ -9,6 +9,7 @@ import android.content.IntentFilter;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
......@@ -16,6 +17,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
......@@ -278,7 +280,7 @@ public class WhirlpoolMain extends AppCompatActivity {
} catch (Exception ex) {
Toast.makeText(this, ex.getMessage(), Toast.LENGTH_LONG).show();
ex.printStackTrace();
AlertDialog.Builder builder = new AlertDialog.Builder(this);
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(this);
builder.setMessage("Tx0 is not possible with selected utxo.")
.setCancelable(true);
builder.setPositiveButton(R.string.ok, (dialogInterface, i) -> dialogInterface.dismiss());
......@@ -286,7 +288,7 @@ public class WhirlpoolMain extends AppCompatActivity {
return;
}
if (tx0.getTx0() == null) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
MaterialAlertDialogBuilder builder= new MaterialAlertDialogBuilder(this);
builder.setMessage("Tx0 is not possible with selected utxo.")
.setCancelable(true);
builder.setPositiveButton(R.string.ok, (dialogInterface, i) -> dialogInterface.dismiss());
......@@ -465,7 +467,7 @@ public class WhirlpoolMain extends AppCompatActivity {
scode.setText(strCurrentCode);
}
new AlertDialog.Builder(WhirlpoolMain.this)
new MaterialAlertDialogBuilder(WhirlpoolMain.this)
.setTitle(R.string.app_name)
.setMessage(R.string.enter_scode)
.setView(scode)
......
......@@ -3,8 +3,13 @@ package com.samourai.wallet.whirlpool.newPool;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.res.ColorStateList;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
import com.google.android.material.button.MaterialButton;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.android.material.snackbar.Snackbar;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
......@@ -84,7 +89,7 @@ public class NewPoolActivity extends AppCompatActivity {
private ReviewPoolFragment reviewPoolFragment;
private ViewPager newPoolViewPager;
private int account = 0;
private Button confirmButton;
private MaterialButton confirmButton;
private CompositeDisposable disposables = new CompositeDisposable();
private List<UTXOCoin> selectedCoins = new ArrayList<>();
......@@ -178,7 +183,8 @@ public class NewPoolActivity extends AppCompatActivity {
calculateTx0(selectedPoolViewModel.getDenomination(),selectedPoolViewModel.getMinerFee());
newPoolViewPager.setCurrentItem(2);
confirmButton.setText(getString(R.string.begin_cycle));
confirmButton.setBackgroundResource(R.drawable.button_green);
confirmButton.setBackgroundTintList(ContextCompat.getColorStateList(getApplicationContext(),R.color.green_ui_2));
reviewPoolFragment.setTx0(tx0,tx0FeeTarget,selectedPoolViewModel);
break;
}
......@@ -394,7 +400,7 @@ public class NewPoolActivity extends AppCompatActivity {
switch (position) {
case 0: {
enableStep1(true);
confirmButton.setBackgroundResource(R.drawable.whirlpool_btn_blue);
confirmButton.setBackgroundTintList(ContextCompat.getColorStateList(getApplicationContext(),R.color.blue_ui_2));
confirmButton.setText(R.string.next);
break;
}
......@@ -437,7 +443,8 @@ public class NewPoolActivity extends AppCompatActivity {
reviewMessage.length() - 1, spannable.length(),
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
);
confirmButton.setBackgroundResource(R.drawable.whirlpool_btn_blue);
confirmButton.setBackgroundTintList(ContextCompat.getColorStateList(getApplicationContext(),R.color.blue_ui_2));
confirmButton.setText(spannable);
}
......@@ -462,8 +469,8 @@ public class NewPoolActivity extends AppCompatActivity {
public void onBackPressed() {
switch (newPoolViewPager.getCurrentItem()) {
case 0: {
new androidx.appcompat.app.AlertDialog
.Builder(this)
new MaterialAlertDialogBuilder(this)
.setTitle(R.string.confirm)
.setMessage("Are you sure want to cancel?")
.setPositiveButton(R.string.yes, (dialogInterface, i) -> super.onBackPressed())
.setNegativeButton(R.string.no, (dialogInterface, i) -> {
......@@ -473,8 +480,7 @@ public class NewPoolActivity extends AppCompatActivity {
}
case 1: {
if (account == WhirlpoolMeta.getInstance(getApplicationContext()).getWhirlpoolPostmix()) {
new androidx.appcompat.app.AlertDialog
.Builder(this)
new MaterialAlertDialogBuilder(this)
.setMessage("Are you sure want to cancel?")
.setPositiveButton(R.string.yes, (dialogInterface, i) -> super.onBackPressed())
.setNegativeButton(R.string.no, (dialogInterface, i) -> {
......@@ -496,19 +502,23 @@ public class NewPoolActivity extends AppCompatActivity {
private void enableConfirmButton(boolean enable) {
if (enable) {
confirmButton.setEnabled(true);
confirmButton.setBackgroundResource(R.drawable.button_blue);
confirmButton.setBackgroundTintList(ContextCompat.getColorStateList(getApplicationContext(),R.color.blue_ui_2));
} else {
confirmButton.setEnabled(false);
confirmButton.setBackgroundResource(R.drawable.disabled_grey_button);
confirmButton.setBackgroundTintList(ContextCompat.getColorStateList(getApplicationContext(),R.color.disabled_grey));
}
}
private void enableBroadcastButton(boolean enable) {
if (enable) {
confirmButton.setEnabled(true);
confirmButton.setBackgroundResource(R.drawable.button_green);
confirmButton.setBackgroundTintList(ContextCompat.getColorStateList(getApplicationContext(),R.color.green_ui_2));
} else {
confirmButton.setEnabled(false);
confirmButton.setBackgroundResource(R.drawable.disabled_grey_button);
confirmButton.setBackgroundTintList(ContextCompat.getColorStateList(getApplicationContext(),R.color.disabled_grey));
}
}
......
......@@ -68,6 +68,7 @@ class ReviewPoolFragment : Fragment() {
poolFees.text = ""
uncycledAmount.text = ""
amountToCycle.text = ""
poolTotalFees.text = ""
totalPoolAmount.text = ""
poolAmount.text = getBTCDisplayAmount(tx0.pool)
totalUtxoCreated.text = "${tx0.premixRequested}";
......
......@@ -21,6 +21,7 @@ import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import com.google.android.material.button.MaterialButton;
import com.samourai.wallet.R;
import com.samourai.wallet.utxos.models.UTXOCoin;
import com.samourai.wallet.whirlpool.adapters.PoolsAdapter;
......@@ -48,7 +49,7 @@ public class SelectPoolFragment extends Fragment {
private RecyclerView recyclerView;
private PoolsAdapter poolsAdapter;
private ArrayList<PoolViewModel> poolViewModels = new ArrayList<PoolViewModel>();
private Button feeNormalBtn, feeLowBtn, feeHighBtn;
private MaterialButton feeNormalBtn, feeLowBtn, feeHighBtn;
private TextView poolFee;
private PoolCyclePriority poolCyclePriority = PoolCyclePriority.NORMAL;
private OnPoolSelectionComplete onPoolSelectionComplete;
......@@ -171,9 +172,9 @@ public class SelectPoolFragment extends Fragment {
switch (poolCyclePriority) {
case LOW: {
feeNormalBtn.setBackgroundResource(R.drawable.whirlpool_btn_inactive);
feeHighBtn.setBackgroundResource(R.drawable.whirlpool_btn_inactive);
feeLowBtn.setBackgroundResource(R.drawable.whirlpool_btn_blue);
setButtonColor(feeNormalBtn,R.color.window);
setButtonColor(feeHighBtn,R.color.window);
setButtonColor(feeLowBtn,R.color.blue_ui_2);
if (fees.size() >= 1)
poolFee.setText(String.valueOf(fees.get(0)).concat(" ").concat(getString(R.string.sat_b)));
if (fees.size() >= 1)
......@@ -181,9 +182,9 @@ public class SelectPoolFragment extends Fragment {
break;
}
case NORMAL: {
feeNormalBtn.setBackgroundResource(R.drawable.whirlpool_btn_blue);
feeHighBtn.setBackgroundResource(R.drawable.whirlpool_btn_inactive);
feeLowBtn.setBackgroundResource(R.drawable.whirlpool_btn_inactive);
setButtonColor(feeLowBtn,R.color.window);
setButtonColor(feeHighBtn,R.color.window);
setButtonColor(feeNormalBtn,R.color.blue_ui_2);
if (fees.size() >= 2)
poolFee.setText(String.valueOf(fees.get(1)).concat(" ").concat(getString(R.string.sat_b)));
if (fees.size() >= 2)
......@@ -192,9 +193,9 @@ public class SelectPoolFragment extends Fragment {
}
case HIGH: {
feeNormalBtn.setBackgroundResource(R.drawable.whirlpool_btn_inactive);
feeHighBtn.setBackgroundResource(R.drawable.whirlpool_btn_blue);
feeLowBtn.setBackgroundResource(R.drawable.whirlpool_btn_inactive);
setButtonColor(feeLowBtn,R.color.window);
setButtonColor(feeNormalBtn,R.color.window);
setButtonColor(feeHighBtn,R.color.blue_ui_2);
if (fees.size() >= 2)
poolFee.setText(String.valueOf(fees.get(2)).concat(" ").concat(getString(R.string.sat_b)));
if (fees.size() >= 2)
......@@ -207,6 +208,9 @@ public class SelectPoolFragment extends Fragment {
}
void setButtonColor(MaterialButton button, int color){
button.setBackgroundTintList(ContextCompat.getColorStateList(getContext(),color));
}
@Override
public void onDetach() {
this.onPoolSelectionComplete = null;
......
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="100"
android:interpolator="@android:interpolator/accelerate_quint">
android:interpolator="@android:interpolator/fast_out_linear_in">
<alpha
android:fromAlpha="0.0"
android:toAlpha="1.0" />
......
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="200"
android:interpolator="@android:interpolator/accelerate_quint">
android:duration="100"
android:interpolator="@android:interpolator/fast_out_linear_in">
<alpha
android:fromAlpha="1.0"
android:toAlpha="0.0" />
......
......@@ -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>
......
......@@ -72,12 +72,14 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/utxo_selection_confirm_btn" />
<Button
<com.google.android.material.button.MaterialButton
android:id="@+id/utxo_selection_confirm_btn"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="@drawable/button_blue"
style="@style/Widget.MaterialComponents.Button.TextButton"
app:backgroundTint="@color/blue_ui_2"
android:text="@string/next"
app:rippleColor="@color/white"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
......@@ -89,6 +91,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.92" />
app:layout_constraintGuide_percent="0.9" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
......@@ -29,37 +29,51 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
<com.google.android.material.button.MaterialButton
android:id="@+id/pool_fee_low_btn"
android:layout_width="wrap_content"
android:layout_height="42dp"
android:layout_height="54dp"
android:layout_marginTop="16dp"
android:background="@drawable/whirlpool_btn_inactive"
android:text="LOW"
android:textAllCaps="true"
android:textColor="@color/txt_grey"
app:backgroundTint="@color/windowDark"
app:layout_constraintEnd_toStartOf="@+id/pool_fee_normal_btn"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView22" />
app:layout_constraintTop_toBottomOf="@+id/textView22"
app:rippleColor="@color/white"
app:strokeWidth="1dp"
app:cornerRadius="4dp"
app:strokeColor="@color/white" />
<Button
<com.google.android.material.button.MaterialButton
android:id="@+id/pool_fee_normal_btn"
android:layout_width="wrap_content"
android:layout_height="42dp"
android:background="@drawable/whirlpool_btn_blue"
android:layout_height="54dp"
android:text="NORMAL"
android:textColor="@color/white"
app:strokeWidth="1dp"
app:cornerRadius="4dp"
app:strokeColor="@color/txt_grey"
app:backgroundTint="@color/blue_ui_2"
app:layout_constraintBottom_toBottomOf="@+id/pool_fee_low_btn"
app:layout_constraintEnd_toStartOf="@+id/pool_fee_high_btn"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/pool_fee_low_btn"
app:layout_constraintTop_toTopOf="@+id/pool_fee_low_btn" />
<Button
<com.google.android.material.button.MaterialButton
android:id="@+id/pool_fee_high_btn"
android:layout_width="wrap_content"
android:layout_height="42dp"
android:background="@drawable/whirlpool_btn_inactive"
android:layout_height="54dp"
android:text="High"
app:strokeWidth="1dp"
app:cornerRadius="4dp"
app:strokeColor="@color/txt_grey"
android:textColor="@color/white"
app:backgroundTint="@color/windowDark"
app:layout_constraintBottom_toBottomOf="@+id/pool_fee_normal_btn"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
......@@ -71,6 +85,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:textColor="@color/white"
app:layout_constraintEnd_toEndOf="@+id/pool_fee_low_btn"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="@+id/pool_fee_low_btn"
......
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