Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
meser
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Muhammad Suryono
meser
Commits
b2224723
Commit
b2224723
authored
Aug 26, 2020
by
iman Fauzi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix button payment when bank name is selected
parent
2f44845a
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
39 additions
and
7 deletions
+39
-7
PaymentActivity.java
app/src/main/java/com/yono/messeripos/PaymentActivity.java
+19
-0
CartAdapter.java
...rc/main/java/com/yono/messeripos/adapter/CartAdapter.java
+2
-0
PaymentAdapter.java
...main/java/com/yono/messeripos/adapter/PaymentAdapter.java
+15
-7
activity_payment.xml
app/src/main/res/layout/activity_payment.xml
+1
-0
payment_list.xml
app/src/main/res/layout/payment_list.xml
+2
-0
No files found.
app/src/main/java/com/yono/messeripos/PaymentActivity.java
View file @
b2224723
...
...
@@ -6,8 +6,11 @@ import androidx.recyclerview.widget.RecyclerView;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.view.View
;
import
android.view.Window
;
import
android.view.WindowManager
;
import
android.widget.Button
;
import
android.widget.Toast
;
import
android.widget.Toolbar
;
import
com.google.android.material.appbar.MaterialToolbar
;
...
...
@@ -19,6 +22,9 @@ import java.util.ArrayList;
public
class
PaymentActivity
extends
AppCompatActivity
{
private
ArrayList
<
PaymentResponse
>
paymentResponses
=
new
ArrayList
<>();
Button
btnPay
;
public
static
String
methodPay
=
""
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
...
...
@@ -51,5 +57,18 @@ public class PaymentActivity extends AppCompatActivity {
PaymentAdapter
adapter
=
new
PaymentAdapter
(
paymentResponses
,
this
);
rvPayment
.
setAdapter
(
adapter
);
btnPay
=
findViewById
(
R
.
id
.
btnPay
);
adapter
.
setListener
(
paymentResponse
->
{
methodPay
=
paymentResponse
.
getBank
();
btnPay
.
setEnabled
(
true
);
});
btnPay
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
Toast
.
makeText
(
getApplicationContext
(),
methodPay
,
Toast
.
LENGTH_LONG
).
show
();
}
});
}
}
\ No newline at end of file
app/src/main/java/com/yono/messeripos/adapter/CartAdapter.java
View file @
b2224723
package
com
.
yono
.
messeripos
.
adapter
;
import
android.annotation.SuppressLint
;
import
android.content.Context
;
import
android.util.Log
;
import
android.view.LayoutInflater
;
...
...
@@ -87,6 +88,7 @@ public class CartAdapter extends RecyclerView.Adapter<CartAdapter.MyViewHolder>
this
.
binding
=
binding
;
}
@SuppressLint
(
"SetTextI18n"
)
public
void
bindData
(
ProductCartModels
cartModels
)
{
binding
.
setCarts
(
cartModels
);
binding
.
setPrice
(
utils
.
convertPrice
(
"Rp. "
,
cartModels
.
getPrice_orders
()));
...
...
app/src/main/java/com/yono/messeripos/adapter/PaymentAdapter.java
View file @
b2224723
...
...
@@ -18,6 +18,7 @@ import androidx.recyclerview.widget.RecyclerView;
import
com.google.android.material.card.MaterialCardView
;
import
com.yono.messeripos.PaymentActivity
;
import
com.yono.messeripos.models.ProductCartModels
;
import
com.yono.messeripos.response.PaymentResponse
;
import
com.yono.messeripos.R
;
import
com.yono.messeripos.databinding.PaymentListBinding
;
...
...
@@ -30,6 +31,16 @@ public class PaymentAdapter extends RecyclerView.Adapter<PaymentAdapter.ViewHold
Context
context
;
int
getPosition
=
-
1
;
public
interface
PaymentListener
{
void
onSelectPayment
(
PaymentResponse
paymentResponse
);
}
private
PaymentListener
listener
;
public
void
setListener
(
PaymentListener
listener
)
{
this
.
listener
=
listener
;
}
public
PaymentAdapter
(
ArrayList
<
PaymentResponse
>
paymentResponses
,
PaymentActivity
mainActivity
)
{
this
.
paymentResponses
=
paymentResponses
;
this
.
context
=
mainActivity
;
...
...
@@ -80,10 +91,11 @@ public class PaymentAdapter extends RecyclerView.Adapter<PaymentAdapter.ViewHold
public
class
ViewHolder
extends
RecyclerView
.
ViewHolder
{
PaymentListBinding
binding
;
RadioButton
radioButton
;
public
ViewHolder
(
@NonNull
PaymentListBinding
view
)
{
super
(
view
.
getRoot
());
this
.
binding
=
view
;
radioButton
=
view
.
rbPayment
;
this
.
radioButton
=
view
.
rbPayment
;
}
@SuppressLint
(
"ResourceAsColor"
)
...
...
@@ -91,14 +103,10 @@ public class PaymentAdapter extends RecyclerView.Adapter<PaymentAdapter.ViewHold
binding
.
setPayment
(
paymentResponse
);
binding
.
setLogo
(
paymentResponse
.
getUrl
());
binding
.
cvPayment
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
binding
.
cvPayment
.
setOnClickListener
(
view
->{
getPosition
=
getAdapterPosition
();
notifyDataSetChanged
();
}
});
listener
.
onSelectPayment
(
paymentResponse
);});
}
}
}
app/src/main/res/layout/activity_payment.xml
View file @
b2224723
...
...
@@ -29,6 +29,7 @@
android:text=
"pay"
android:padding=
"15dp"
android:textSize=
"16sp"
android:enabled=
"false"
android:layout_margin=
"10dp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
...
...
app/src/main/res/layout/payment_list.xml
View file @
b2224723
...
...
@@ -71,6 +71,8 @@
android:id=
"@+id/rbPayment"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:buttonTint=
"@color/colorPrimary"
android:enabled=
"false"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
/>
...
...
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