Verified Commit b0fb5fed authored by Sarath's avatar Sarath
Browse files

Updated Material themes for whirlpool activities

parent b13363e0
......@@ -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=""
......
......@@ -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));
}
}
......
......@@ -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;
......
......@@ -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