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
2f44845a
Commit
2f44845a
authored
Aug 26, 2020
by
iman Fauzi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make payment list selected
parent
5110f6c3
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
12 deletions
+19
-12
PaymentActivity.java
app/src/main/java/com/yono/messeripos/PaymentActivity.java
+1
-1
PaymentAdapter.java
...main/java/com/yono/messeripos/adapter/PaymentAdapter.java
+8
-10
activity_payment.xml
app/src/main/res/layout/activity_payment.xml
+2
-1
payment_list.xml
app/src/main/res/layout/payment_list.xml
+8
-0
No files found.
app/src/main/java/com/yono/messeripos/PaymentActivity.java
View file @
2f44845a
...
...
@@ -40,7 +40,7 @@ public class PaymentActivity extends AppCompatActivity {
RecyclerView
rvPayment
=
findViewById
(
R
.
id
.
rvPayment
);
LinearLayoutManager
llm
=
new
LinearLayoutManager
(
this
);
LinearLayoutManager
llm
=
new
LinearLayoutManager
(
this
,
RecyclerView
.
VERTICAL
,
false
);
rvPayment
.
setLayoutManager
(
llm
);
paymentResponses
.
add
(
new
PaymentResponse
(
"https://i.ibb.co/RjJQT9K/BNI-logo.png"
,
"cash"
));
...
...
app/src/main/java/com/yono/messeripos/adapter/PaymentAdapter.java
View file @
2f44845a
...
...
@@ -6,6 +6,7 @@ import android.util.Log;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.RadioButton
;
import
android.widget.Toast
;
import
androidx.annotation.NonNull
;
...
...
@@ -58,7 +59,8 @@ public class PaymentAdapter extends RecyclerView.Adapter<PaymentAdapter.ViewHold
@Override
public
void
onBindViewHolder
(
@NonNull
ViewHolder
holder
,
int
position
)
{
holder
.
binData
(
paymentResponses
.
get
(
position
));
// holder.radioButton.setChecked(position == getPosition);
holder
.
radioButton
.
setChecked
(
position
==
getPosition
);
// final PaymentModel paymentModel = paymentModels.get(position);
//
// ImageView imageView = holder.logoComp;
...
...
@@ -76,15 +78,12 @@ public class PaymentAdapter extends RecyclerView.Adapter<PaymentAdapter.ViewHold
}
public
class
ViewHolder
extends
RecyclerView
.
ViewHolder
{
MaterialCardView
cardView
;
PaymentListBinding
binding
;
public
int
positi
on
;
RadioButton
radioButt
on
;
public
ViewHolder
(
@NonNull
PaymentListBinding
view
)
{
super
(
view
.
getRoot
());
this
.
binding
=
view
;
getPosition
=
getAdapterPosition
();
Log
.
d
(
"ViewHolder: "
,
String
.
valueOf
(
cardView
));
radioButton
=
view
.
rbPayment
;
}
@SuppressLint
(
"ResourceAsColor"
)
...
...
@@ -92,13 +91,12 @@ public class PaymentAdapter extends RecyclerView.Adapter<PaymentAdapter.ViewHold
binding
.
setPayment
(
paymentResponse
);
binding
.
setLogo
(
paymentResponse
.
getUrl
());
Log
.
d
(
"Position "
,
""
+
getAdapterPosition
());
binding
.
cvPayment
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
Log
.
d
(
"Click VC"
,
paymentResponse
.
getBank
());
binding
.
cvPayment
.
toggle
();
getPosition
=
getAdapterPosition
();
notifyDataSetChanged
();
}
});
}
...
...
app/src/main/res/layout/activity_payment.xml
View file @
2f44845a
...
...
@@ -19,7 +19,8 @@
android:id=
"@+id/rvPayment"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
app:layout_constraintTop_toBottomOf=
"@id/appbar"
/>
app:layout_constraintTop_toBottomOf=
"@id/appbar"
/>
<com.google.android.material.button.MaterialButton
android:id=
"@+id/btnPay"
...
...
app/src/main/res/layout/payment_list.xml
View file @
2f44845a
...
...
@@ -67,6 +67,14 @@
app:layout_constraintTop_toTopOf=
"parent"
/>
<RadioButton
android:id=
"@+id/rbPayment"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>
...
...
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