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
8cecb337
Commit
8cecb337
authored
Aug 24, 2020
by
iman Fauzi
Browse files
Options
Browse Files
Download
Plain Diff
fix
parents
5d2672c6
3af68606
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
74 additions
and
22 deletions
+74
-22
misc.xml
.idea/misc.xml
+1
-1
PaymentActivity.java
app/src/main/java/com/yono/messeripos/PaymentActivity.java
+8
-5
PaymentAdapter.java
...main/java/com/yono/messeripos/adapter/PaymentAdapter.java
+17
-15
PaymentResponse.java
...in/java/com/yono/messeripos/response/PaymentResponse.java
+41
-0
payment_list.xml
app/src/main/res/layout/payment_list.xml
+7
-1
No files found.
.idea/misc.xml
View file @
8cecb337
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<project
version=
"4"
>
<component
name=
"ProjectRootManager"
version=
"2"
languageLevel=
"JDK_1_
7
"
project-jdk-name=
"1.8"
project-jdk-type=
"JavaSDK"
>
<component
name=
"ProjectRootManager"
version=
"2"
languageLevel=
"JDK_1_
8
"
project-jdk-name=
"1.8"
project-jdk-type=
"JavaSDK"
>
<output
url=
"file://$PROJECT_DIR$/build/classes"
/>
<output
url=
"file://$PROJECT_DIR$/build/classes"
/>
</component>
</component>
<component
name=
"ProjectType"
>
<component
name=
"ProjectType"
>
...
...
app/src/main/java/com/yono/messeripos/PaymentActivity.java
View file @
8cecb337
...
@@ -6,11 +6,14 @@ import androidx.recyclerview.widget.RecyclerView;
...
@@ -6,11 +6,14 @@ import androidx.recyclerview.widget.RecyclerView;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
com.yono.messeripos.adapter.PaymentAdapter
;
import
com.yono.messeripos.response.PaymentResponse
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
public
class
PaymentActivity
extends
AppCompatActivity
{
public
class
PaymentActivity
extends
AppCompatActivity
{
private
ArrayList
<
Payment
Model
>
paymentModel
s
=
new
ArrayList
<>();
private
ArrayList
<
Payment
Response
>
paymentResponse
s
=
new
ArrayList
<>();
@Override
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
...
@@ -22,11 +25,11 @@ public class PaymentActivity extends AppCompatActivity {
...
@@ -22,11 +25,11 @@ public class PaymentActivity extends AppCompatActivity {
LinearLayoutManager
llm
=
new
LinearLayoutManager
(
this
);
LinearLayoutManager
llm
=
new
LinearLayoutManager
(
this
);
rvPayment
.
setLayoutManager
(
llm
);
rvPayment
.
setLayoutManager
(
llm
);
payment
Models
.
add
(
new
PaymentModel
(
"https://i.ibb.co/XCsdmmT/Bank-Mandiri-logo.png"
,
"mandiri"
));
payment
Responses
.
add
(
new
PaymentResponse
(
"https://i.ibb.co/XCsdmmT/Bank-Mandiri-logo.png"
,
"mandiri"
));
payment
Models
.
add
(
new
PaymentModel
(
"https://i.ibb.co/2n65nCT/bca-bank-central-asia.png"
,
"bca"
));
payment
Responses
.
add
(
new
PaymentResponse
(
"https://i.ibb.co/2n65nCT/bca-bank-central-asia.png"
,
"bca"
));
payment
Models
.
add
(
new
PaymentModel
(
"https://i.ibb.co/RjJQT9K/BNI-logo.png"
,
"bni"
));
payment
Responses
.
add
(
new
PaymentResponse
(
"https://i.ibb.co/RjJQT9K/BNI-logo.png"
,
"bni"
));
PaymentAdapter
adapter
=
new
PaymentAdapter
(
payment
Model
s
,
this
);
PaymentAdapter
adapter
=
new
PaymentAdapter
(
payment
Response
s
,
this
);
rvPayment
.
setAdapter
(
adapter
);
rvPayment
.
setAdapter
(
adapter
);
}
}
...
...
app/src/main/java/com/yono/messeripos/PaymentAdapter.java
→
app/src/main/java/com/yono/messeripos/
adapter/
PaymentAdapter.java
View file @
8cecb337
package
com
.
yono
.
messeripos
;
package
com
.
yono
.
messeripos
.
adapter
;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.util.Log
;
import
android.view.LayoutInflater
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.view.ViewGroup
;
import
android.widget.Button
;
import
android.widget.ImageView
;
import
android.widget.RadioButton
;
import
android.widget.TextView
;
import
androidx.annotation.NonNull
;
import
androidx.annotation.NonNull
;
import
androidx.recyclerview.widget.RecyclerView
;
import
androidx.recyclerview.widget.RecyclerView
;
import
com.google.android.material.button.MaterialButton
;
import
com.google.android.material.button.MaterialButton
;
import
androidx.databinding.DataBindingUtil
;
import
androidx.recyclerview.widget.RecyclerView
;
import
com.yono.messeripos.PaymentActivity
;
import
com.yono.messeripos.response.PaymentResponse
;
import
com.yono.messeripos.R
;
import
com.yono.messeripos.databinding.PaymentListBinding
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
public
class
PaymentAdapter
extends
RecyclerView
.
Adapter
<
PaymentAdapter
.
ViewHolder
>
{
public
class
PaymentAdapter
extends
RecyclerView
.
Adapter
<
PaymentAdapter
.
ViewHolder
>
{
private
ArrayList
<
Payment
Model
>
paymentModel
s
;
private
ArrayList
<
Payment
Response
>
paymentResponse
s
;
Context
context
;
Context
context
;
int
getPosition
=
-
1
;
int
getPosition
=
-
1
;
public
PaymentAdapter
(
ArrayList
<
Payment
Model
>
paymentModel
s
,
PaymentActivity
mainActivity
)
{
public
PaymentAdapter
(
ArrayList
<
Payment
Response
>
paymentResponse
s
,
PaymentActivity
mainActivity
)
{
this
.
payment
Models
=
paymentModel
s
;
this
.
payment
Responses
=
paymentResponse
s
;
this
.
context
=
mainActivity
;
this
.
context
=
mainActivity
;
}
}
...
@@ -50,7 +51,7 @@ public class PaymentAdapter extends RecyclerView.Adapter<PaymentAdapter.ViewHold
...
@@ -50,7 +51,7 @@ public class PaymentAdapter extends RecyclerView.Adapter<PaymentAdapter.ViewHold
@Override
@Override
public
void
onBindViewHolder
(
@NonNull
ViewHolder
holder
,
int
position
)
{
public
void
onBindViewHolder
(
@NonNull
ViewHolder
holder
,
int
position
)
{
holder
.
binData
(
payment
Model
s
.
get
(
position
));
holder
.
binData
(
payment
Response
s
.
get
(
position
));
// holder.cardView.setTag(position);
// holder.cardView.setTag(position);
// holder.radioButton.setChecked(position == getPosition);
// holder.radioButton.setChecked(position == getPosition);
// final PaymentModel paymentModel = paymentModels.get(position);
// final PaymentModel paymentModel = paymentModels.get(position);
...
@@ -65,7 +66,7 @@ public class PaymentAdapter extends RecyclerView.Adapter<PaymentAdapter.ViewHold
...
@@ -65,7 +66,7 @@ public class PaymentAdapter extends RecyclerView.Adapter<PaymentAdapter.ViewHold
@Override
@Override
public
int
getItemCount
()
{
public
int
getItemCount
()
{
return
payment
Model
s
.
size
();
return
payment
Response
s
.
size
();
}
}
public
class
ViewHolder
extends
RecyclerView
.
ViewHolder
{
public
class
ViewHolder
extends
RecyclerView
.
ViewHolder
{
...
@@ -75,8 +76,9 @@ public class PaymentAdapter extends RecyclerView.Adapter<PaymentAdapter.ViewHold
...
@@ -75,8 +76,9 @@ public class PaymentAdapter extends RecyclerView.Adapter<PaymentAdapter.ViewHold
this
.
binding
=
view
;
this
.
binding
=
view
;
}
}
public
void
binData
(
PaymentModel
paymentModel
){
public
void
binData
(
PaymentResponse
paymentResponse
){
binding
.
setPayment
(
paymentModel
);
binding
.
setPayment
(
paymentResponse
);
binding
.
setLogo
(
paymentResponse
.
getUrl
());
}
}
}
}
}
}
app/src/main/java/com/yono/messeripos/
PaymentModel
.java
→
app/src/main/java/com/yono/messeripos/
response/PaymentResponse
.java
View file @
8cecb337
package
com
.
yono
.
messeripos
;
package
com
.
yono
.
messeripos
.
response
;
public
class
PaymentModel
{
import
android.widget.ImageView
;
import
androidx.databinding.BindingAdapter
;
import
com.bumptech.glide.Glide
;
public
class
PaymentResponse
{
private
String
url
;
private
String
url
;
private
String
bank
;
private
String
bank
;
public
Payment
Model
(
String
url
,
String
bank
)
{
public
Payment
Response
(
String
url
,
String
bank
)
{
this
.
url
=
url
;
this
.
url
=
url
;
this
.
bank
=
bank
;
this
.
bank
=
bank
;
}
}
...
@@ -25,4 +31,11 @@ public class PaymentModel {
...
@@ -25,4 +31,11 @@ public class PaymentModel {
public
void
setBank
(
String
bank
)
{
public
void
setBank
(
String
bank
)
{
this
.
bank
=
bank
;
this
.
bank
=
bank
;
}
}
@BindingAdapter
(
"logo_bank"
)
public
static
void
loadImage
(
ImageView
view
,
String
url
)
{
Glide
.
with
(
view
.
getContext
())
.
load
(
url
)
.
into
(
view
);
}
}
}
\ No newline at end of file
app/src/main/res/layout/payment_list.xml
View file @
8cecb337
...
@@ -7,8 +7,13 @@
...
@@ -7,8 +7,13 @@
<data>
<data>
<variable
<variable
name=
"payment"
name=
"payment"
type=
"com.yono.messeripos.PaymentModel"
/>
type=
"com.yono.messeripos.response.PaymentResponse"
/>
<variable
name=
"logo"
type=
"String"
/>
</data>
</data>
<androidx.constraintlayout.widget.ConstraintLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
...
@@ -44,6 +49,7 @@
...
@@ -44,6 +49,7 @@
android:layout_width=
"131dp"
android:layout_width=
"131dp"
android:layout_height=
"39dp"
android:layout_height=
"39dp"
android:src=
"@drawable/ic_bni_logo"
android:src=
"@drawable/ic_bni_logo"
app:logo_bank=
"@{logo}"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
app:layout_constraintTop_toTopOf=
"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