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
89dcbb63
Commit
89dcbb63
authored
Sep 03, 2020
by
Muhammad Suryono
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update ya
parent
d280a465
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
205 additions
and
7 deletions
+205
-7
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+2
-1
CartActivity.java
app/src/main/java/com/yono/messeripos/CartActivity.java
+16
-2
TransactionActivity.java
...rc/main/java/com/yono/messeripos/TransactionActivity.java
+2
-1
PendingAdapter.java
...main/java/com/yono/messeripos/adapter/PendingAdapter.java
+65
-0
MainViewModelsCart.java
...n/java/com/yono/messeripos/models/MainViewModelsCart.java
+4
-0
PaymentPendingRepositories.java
...o/messeripos/repositories/PaymentPendingRepositories.java
+4
-0
TransactionPending.java
...om/yono/messeripos/transactiontab/TransactionPending.java
+76
-0
activity_pending.xml
app/src/main/res/layout/activity_pending.xml
+33
-0
item_pending.xml
app/src/main/res/layout/item_pending.xml
+3
-3
No files found.
app/src/main/AndroidManifest.xml
View file @
89dcbb63
...
@@ -49,7 +49,8 @@
...
@@ -49,7 +49,8 @@
<activity
<activity
android:name=
".MainActivity"
android:name=
".MainActivity"
android:theme=
"@style/AppTheme.appbar"
/>
android:theme=
"@style/AppTheme.appbar"
/>
<activity
android:name=
".FormProductActivity"
/>
<activity
android:name=
".FormProductActivity"
android:windowSoftInputMode=
"adjustResize"
/>
<provider
<provider
android:name=
"androidx.core.content.FileProvider"
android:name=
"androidx.core.content.FileProvider"
...
...
app/src/main/java/com/yono/messeripos/CartActivity.java
View file @
89dcbb63
...
@@ -7,6 +7,7 @@ import android.content.Intent;
...
@@ -7,6 +7,7 @@ import android.content.Intent;
import
android.content.SharedPreferences
;
import
android.content.SharedPreferences
;
import
android.os.Build
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.os.Handler
;
import
android.util.Log
;
import
android.util.Log
;
import
android.view.View
;
import
android.view.View
;
import
android.view.Window
;
import
android.view.Window
;
...
@@ -229,7 +230,9 @@ public class CartActivity extends AppCompatActivity {
...
@@ -229,7 +230,9 @@ public class CartActivity extends AppCompatActivity {
}
}
private
void
actionSaveCart
()
{
private
void
actionSaveCart
()
{
ProgressDialog
progressDialog
=
new
ProgressDialog
(
CartActivity
.
this
);
progressDialog
.
setMessage
(
"Creating your orders...."
);
progressDialog
.
show
();
Client
client
=
new
Client
();
Client
client
=
new
Client
();
modelsCart
.
getCartById
(
sharedPreferences
.
getString
(
ORDER_ID
,
""
)).
observe
(
this
,
new
Observer
<
List
<
ProductCartModels
>>()
{
modelsCart
.
getCartById
(
sharedPreferences
.
getString
(
ORDER_ID
,
""
)).
observe
(
this
,
new
Observer
<
List
<
ProductCartModels
>>()
{
@Override
@Override
...
@@ -249,7 +252,18 @@ public class CartActivity extends AppCompatActivity {
...
@@ -249,7 +252,18 @@ public class CartActivity extends AppCompatActivity {
paymentPending
.
setTransaction_time
(
utils
.
dateNow
());
paymentPending
.
setTransaction_time
(
utils
.
dateNow
());
Log
.
i
(
"Convert Input"
,
"onChanged: "
+
utils
.
convertGson
(
paymentPending
));
Log
.
i
(
"Convert Input"
,
"onChanged: "
+
utils
.
convertGson
(
paymentPending
));
modelsCart
.
savePaymentPending
(
paymentPending
);
modelsCart
.
savePaymentPending
(
paymentPending
);
SharedPreferences
.
Editor
editor
=
sharedPreferences
.
edit
();
editor
.
putString
(
ORDER_ID
,
""
);
if
(
editor
.
commit
()){
new
Handler
().
postDelayed
(
new
Runnable
()
{
@Override
public
void
run
()
{
progressDialog
.
dismiss
();
startActivity
(
new
Intent
(
CartActivity
.
this
,
MainActivity
.
class
));
finish
();
}
},
700
);
}
}
}
});
});
}
}
...
...
app/src/main/java/com/yono/messeripos/TransactionActivity.java
View file @
89dcbb63
...
@@ -10,6 +10,7 @@ import androidx.viewpager.widget.ViewPager;
...
@@ -10,6 +10,7 @@ import androidx.viewpager.widget.ViewPager;
import
com.google.android.material.appbar.MaterialToolbar
;
import
com.google.android.material.appbar.MaterialToolbar
;
import
com.google.android.material.tabs.TabLayout
;
import
com.google.android.material.tabs.TabLayout
;
import
com.yono.messeripos.adapter.TabAdapterTransaction
;
import
com.yono.messeripos.adapter.TabAdapterTransaction
;
import
com.yono.messeripos.transactiontab.TransactionPending
;
import
com.yono.messeripos.transactiontab.TransactionSuccess
;
import
com.yono.messeripos.transactiontab.TransactionSuccess
;
import
java.util.Objects
;
import
java.util.Objects
;
...
@@ -34,7 +35,7 @@ public class TransactionActivity extends AppCompatActivity {
...
@@ -34,7 +35,7 @@ public class TransactionActivity extends AppCompatActivity {
adapter
=
new
TabAdapterTransaction
(
getSupportFragmentManager
());
adapter
=
new
TabAdapterTransaction
(
getSupportFragmentManager
());
adapter
.
addFragment
(
new
TransactionSuccess
(),
"Transaction Success"
);
adapter
.
addFragment
(
new
TransactionSuccess
(),
"Transaction Success"
);
adapter
.
addFragment
(
new
Transaction
Success
(),
"Transaction Pending"
);
adapter
.
addFragment
(
new
Transaction
Pending
(),
"Transaction Pending"
);
viewPager
.
setAdapter
(
adapter
);
viewPager
.
setAdapter
(
adapter
);
tabLayout
.
setupWithViewPager
(
viewPager
);
tabLayout
.
setupWithViewPager
(
viewPager
);
...
...
app/src/main/java/com/yono/messeripos/adapter/PendingAdapter.java
0 → 100644
View file @
89dcbb63
package
com
.
yono
.
messeripos
.
adapter
;
import
android.content.Context
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
androidx.annotation.NonNull
;
import
androidx.databinding.DataBindingUtil
;
import
androidx.recyclerview.widget.RecyclerView
;
import
com.yono.messeripos.R
;
import
com.yono.messeripos.databinding.ItemPendingBinding
;
import
com.yono.messeripos.models.PaymentPending
;
import
com.yono.messeripos.models.PaymentsModels
;
import
com.yono.messeripos.utils.Utils
;
import
java.util.ArrayList
;
public
class
PendingAdapter
extends
RecyclerView
.
Adapter
<
PendingAdapter
.
MyViewHolder
>
{
private
ArrayList
<
PaymentPending
>
paymentPendings
=
new
ArrayList
<>();
Context
context
;
Utils
utils
=
new
Utils
();
public
void
setPendingAdapter
(
Context
context
,
ArrayList
<
PaymentPending
>
paymentPending
){
this
.
paymentPendings
=
paymentPending
;
this
.
context
=
context
;
}
@NonNull
@Override
public
PendingAdapter
.
MyViewHolder
onCreateViewHolder
(
@NonNull
ViewGroup
parent
,
int
viewType
)
{
ItemPendingBinding
itemPendingBinding
=
DataBindingUtil
.
inflate
(
LayoutInflater
.
from
(
parent
.
getContext
()),
R
.
layout
.
item_pending
,
parent
,
false
);
return
new
MyViewHolder
(
itemPendingBinding
);
}
@Override
public
void
onBindViewHolder
(
@NonNull
PendingAdapter
.
MyViewHolder
holder
,
int
position
)
{
holder
.
binData
(
paymentPendings
.
get
(
position
));
}
@Override
public
int
getItemCount
()
{
return
paymentPendings
.
size
();
}
public
class
MyViewHolder
extends
RecyclerView
.
ViewHolder
{
ItemPendingBinding
binding
;
public
MyViewHolder
(
@NonNull
ItemPendingBinding
itemView
)
{
super
(
itemView
.
getRoot
());
binding
=
itemView
;
}
public
void
binData
(
PaymentPending
paymentPending
)
{
binding
.
setTransaction
(
paymentPending
);
binding
.
setDate
(
paymentPending
.
getTransaction_time
());
binding
.
setGrossAmount
(
utils
.
convertPrice
(
"Rp. "
,
paymentPending
.
getGross_amount
()));
}
}
}
app/src/main/java/com/yono/messeripos/models/MainViewModelsCart.java
View file @
89dcbb63
...
@@ -68,6 +68,10 @@ public class MainViewModelsCart extends AndroidViewModel {
...
@@ -68,6 +68,10 @@ public class MainViewModelsCart extends AndroidViewModel {
paymentPendingRepositories
.
insert
(
paymentPending
);
paymentPendingRepositories
.
insert
(
paymentPending
);
}
}
public
LiveData
<
List
<
PaymentPending
>>
getAllPaymentPending
(){
return
paymentPendingRepositories
.
getPaymentPending
();
}
public
void
insertPayments
(){
public
void
insertPayments
(){
}
}
...
...
app/src/main/java/com/yono/messeripos/repositories/PaymentPendingRepositories.java
View file @
89dcbb63
...
@@ -21,6 +21,10 @@ public class PaymentPendingRepositories {
...
@@ -21,6 +21,10 @@ public class PaymentPendingRepositories {
paymentPending
=
daos
.
getAll
();
paymentPending
=
daos
.
getAll
();
}
}
public
LiveData
<
List
<
PaymentPending
>>
getPaymentPending
(){
return
paymentPending
;
}
public
void
insert
(
PaymentPending
paymentPending
){
public
void
insert
(
PaymentPending
paymentPending
){
LocalDatabase
.
databaseWriterExecutor
.
execute
(()
->
daos
.
insertPaymentPending
(
paymentPending
));
LocalDatabase
.
databaseWriterExecutor
.
execute
(()
->
daos
.
insertPaymentPending
(
paymentPending
));
}
}
...
...
app/src/main/java/com/yono/messeripos/transactiontab/TransactionPending.java
0 → 100644
View file @
89dcbb63
package
com
.
yono
.
messeripos
.
transactiontab
;
import
android.os.Bundle
;
import
android.util.Log
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.ProgressBar
;
import
androidx.annotation.NonNull
;
import
androidx.annotation.Nullable
;
import
androidx.fragment.app.Fragment
;
import
androidx.lifecycle.LifecycleOwner
;
import
androidx.lifecycle.Observer
;
import
androidx.lifecycle.ViewModelProvider
;
import
androidx.recyclerview.widget.LinearLayoutManager
;
import
androidx.recyclerview.widget.RecyclerView
;
import
com.yono.messeripos.R
;
import
com.yono.messeripos.adapter.PendingAdapter
;
import
com.yono.messeripos.adapter.TransactionAdapter
;
import
com.yono.messeripos.models.MainViewModels
;
import
com.yono.messeripos.models.MainViewModelsCart
;
import
com.yono.messeripos.models.PaymentPending
;
import
com.yono.messeripos.models.PaymentsModels
;
import
com.yono.messeripos.utils.Utils
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
TransactionPending
extends
Fragment
{
PendingAdapter
pendingAdapter
;
PaymentPending
paymentPending
;
MainViewModelsCart
mainViewModelsCart
;
RecyclerView
recyclerView
;
Utils
utils
=
new
Utils
();
ProgressBar
loading
;
@Nullable
@Override
public
View
onCreateView
(
@NonNull
LayoutInflater
inflater
,
@Nullable
ViewGroup
container
,
@Nullable
Bundle
savedInstanceState
)
{
View
v
=
inflater
.
inflate
(
R
.
layout
.
activity_pending
,
container
,
false
);
mainViewModelsCart
=
new
ViewModelProvider
(
this
).
get
(
MainViewModelsCart
.
class
);
recyclerView
=
v
.
findViewById
(
R
.
id
.
rvPending
);
loading
=
v
.
findViewById
(
R
.
id
.
loadingPending
);
pendingAdapter
=
new
PendingAdapter
();
LifecycleOwner
lifecycleOwner
=
this
;
loading
.
setVisibility
(
View
.
VISIBLE
);
mainViewModelsCart
.
getAllPaymentPending
().
observe
(
lifecycleOwner
,
new
Observer
<
List
<
PaymentPending
>>()
{
@Override
public
void
onChanged
(
List
<
PaymentPending
>
paymentPendings
)
{
Log
.
i
(
"Get data"
,
"onChanged: "
+
utils
.
convertGson
(
paymentPendings
));
loading
.
setVisibility
(
View
.
GONE
);
ArrayList
<
PaymentPending
>
pendingArrayList
=
new
ArrayList
<>();
pendingArrayList
.
addAll
(
paymentPendings
);
pendingAdapter
.
setPendingAdapter
(
v
.
getContext
(),
pendingArrayList
);
recyclerView
.
setLayoutManager
(
new
LinearLayoutManager
(
v
.
getContext
(),
RecyclerView
.
VERTICAL
,
false
));
recyclerView
.
setAdapter
(
pendingAdapter
);
}
});
return
v
;
}
}
app/src/main/res/layout/activity_pending.xml
0 → 100644
View file @
89dcbb63
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
tools:context=
".HistoryActivity"
>
<!-- <include-->
<!-- android:id="@+id/cAppBar"-->
<!-- layout="@layout/app_bar" />-->
<ProgressBar
android:id=
"@+id/loadingPending"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerInParent=
"true"
android:elevation=
"1dp"
/>
<ScrollView
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_alignParentBottom=
"true"
>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rvPending"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_below=
"@id/cAppBar"
tools:listitem=
"@layout/item_pending"
/>
</ScrollView>
</RelativeLayout>
\ No newline at end of file
app/src/main/res/layout/item_pending.xml
View file @
89dcbb63
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
<data>
<data>
<variable
<variable
name=
"transaction"
name=
"transaction"
type=
"com.yono.messeripos.models.Payment
sModels
"
/>
type=
"com.yono.messeripos.models.Payment
Pending
"
/>
<variable
<variable
name=
"date"
name=
"date"
...
@@ -46,7 +46,7 @@
...
@@ -46,7 +46,7 @@
android:textStyle=
"bold"
android:textStyle=
"bold"
android:textAllCaps=
"true"
android:textAllCaps=
"true"
tools:text=
"@string/hint_pay"
tools:text=
"@string/hint_pay"
android:text=
"
@{transaction.paymentType}
"
android:text=
"
Pending
"
app:layout_constraintTop_toTopOf=
"parent"
/>
app:layout_constraintTop_toTopOf=
"parent"
/>
<com.google.android.material.textview.MaterialTextView
<com.google.android.material.textview.MaterialTextView
...
@@ -66,7 +66,7 @@
...
@@ -66,7 +66,7 @@
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:fontFamily=
"@font/roboto"
android:fontFamily=
"@font/roboto"
android:textSize=
"16sp"
android:textSize=
"16sp"
android:text=
"@{transaction.
nomorPembayaranGet
}"
android:text=
"@{transaction.
id_orders
}"
tools:text=
"#6821739123"
tools:text=
"#6821739123"
app:layout_constraintStart_toStartOf=
"@id/tvDate"
app:layout_constraintStart_toStartOf=
"@id/tvDate"
app:layout_constraintTop_toBottomOf=
"@+id/tvDate"
/>
app:layout_constraintTop_toBottomOf=
"@+id/tvDate"
/>
...
...
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