Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Rayserzor
samourai-wallet-android
Commits
b0fb5fed
Verified
Commit
b0fb5fed
authored
Nov 22, 2020
by
Sarath
⚔
Browse files
Updated Material themes for whirlpool activities
parent
b13363e0
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
74 additions
and
40 deletions
+74
-40
app/src/main/AndroidManifest.xml
app/src/main/AndroidManifest.xml
+3
-2
app/src/main/java/com/samourai/wallet/whirlpool/WhirlpoolMain.java
...ain/java/com/samourai/wallet/whirlpool/WhirlpoolMain.java
+5
-3
app/src/main/java/com/samourai/wallet/whirlpool/newPool/NewPoolActivity.java
...om/samourai/wallet/whirlpool/newPool/NewPoolActivity.java
+22
-12
app/src/main/java/com/samourai/wallet/whirlpool/newPool/fragments/SelectPoolFragment.java
...allet/whirlpool/newPool/fragments/SelectPoolFragment.java
+14
-10
app/src/main/res/layout/activity_new_whirlpool_cycle.xml
app/src/main/res/layout/activity_new_whirlpool_cycle.xml
+5
-3
app/src/main/res/layout/fragment_choose_pools.xml
app/src/main/res/layout/fragment_choose_pools.xml
+25
-10
No files found.
app/src/main/AndroidManifest.xml
View file @
b0fb5fed
...
...
@@ -238,11 +238,12 @@
<activity
android:name=
".whirlpool.WhirlpoolMain"
android:label=
""
android:theme=
"@style/Samourai
App
Whirlpool
Theme
"
/>
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=
""
...
...
app/src/main/java/com/samourai/wallet/whirlpool/WhirlpoolMain.java
View file @
b0fb5fed
...
...
@@ -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
);
Material
AlertDialogBuilder
builder
=
new
Material
AlertDialogBuilder
(
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
);
Material
AlertDialogBuilder
builder
=
new
Material
AlertDialogBuilder
(
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
Material
AlertDialogBuilder
(
WhirlpoolMain
.
this
)
.
setTitle
(
R
.
string
.
app_name
)
.
setMessage
(
R
.
string
.
enter_scode
)
.
setView
(
scode
)
...
...
app/src/main/java/com/samourai/wallet/whirlpool/newPool/NewPoolActivity.java
View file @
b0fb5fed
...
...
@@ -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
Material
Button
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
.
setBackground
Resource
(
R
.
drawable
.
whirlpool_btn_blue
);
confirmButton
.
setBackground
TintList
(
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
));
}
}
...
...
app/src/main/java/com/samourai/wallet/whirlpool/newPool/fragments/SelectPoolFragment.java
View file @
b0fb5fed
...
...
@@ -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
Material
Button
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
;
...
...
app/src/main/res/layout/activity_new_whirlpool_cycle.xml
View file @
b0fb5fed
...
...
@@ -72,12 +72,14 @@
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"@+id/utxo_selection_confirm_btn"
/>
<Button
<
com.google.android.material.button.Material
Button
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.9
2
"
/>
app:layout_constraintGuide_percent=
"0.9"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
app/src/main/res/layout/fragment_choose_pools.xml
View file @
b0fb5fed
...
...
@@ -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=
"4
2
dp"
android:layout_height=
"
5
4dp"
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.Material
Button
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.Material
Button
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"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment