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
e5e292b8
Commit
e5e292b8
authored
Aug 27, 2020
by
iman Fauzi
Browse files
Options
Browse Files
Download
Plain Diff
fix conflict
parents
1e05ef17
4443b63a
Hide whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
979 additions
and
226 deletions
+979
-226
misc.xml
.idea/misc.xml
+1
-1
build.gradle
app/build.gradle
+1
-1
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+4
-1
CartActivity.java
app/src/main/java/com/yono/messeripos/CartActivity.java
+39
-40
FormProductActivity.java
...rc/main/java/com/yono/messeripos/FormProductActivity.java
+5
-0
HistoryActivity.java
app/src/main/java/com/yono/messeripos/HistoryActivity.java
+79
-0
MainActivity.java
app/src/main/java/com/yono/messeripos/MainActivity.java
+107
-32
PaymentActivity.java
app/src/main/java/com/yono/messeripos/PaymentActivity.java
+40
-3
SplashScreen.java
app/src/main/java/com/yono/messeripos/SplashScreen.java
+0
-3
CartAdapter.java
...rc/main/java/com/yono/messeripos/adapter/CartAdapter.java
+12
-5
CheckoutAdapter.java
...ain/java/com/yono/messeripos/adapter/CheckoutAdapter.java
+71
-0
ProductAdapter.java
...main/java/com/yono/messeripos/adapter/ProductAdapter.java
+40
-19
TransactionAdapter.java
.../java/com/yono/messeripos/adapter/TransactionAdapter.java
+81
-0
PaymentService.java
.../java/com/yono/messeripos/api/service/PaymentService.java
+11
-0
TransactionService.java
...a/com/yono/messeripos/api/service/TransactionService.java
+16
-0
MainViewModels.java
.../main/java/com/yono/messeripos/models/MainViewModels.java
+38
-0
PaymentsModels.java
.../main/java/com/yono/messeripos/models/PaymentsModels.java
+92
-0
Utils.java
app/src/main/java/com/yono/messeripos/utils/Utils.java
+37
-0
activity_cart.xml
app/src/main/res/layout/activity_cart.xml
+1
-23
activity_history.xml
app/src/main/res/layout/activity_history.xml
+38
-0
activity_invoice.xml
app/src/main/res/layout/activity_invoice.xml
+1
-1
activity_main.xml
app/src/main/res/layout/activity_main.xml
+1
-0
activity_payment.xml
app/src/main/res/layout/activity_payment.xml
+111
-95
item_checkout.xml
app/src/main/res/layout/item_checkout.xml
+64
-0
item_history.xml
app/src/main/res/layout/item_history.xml
+79
-0
home.xml
app/src/main/res/menu/home.xml
+6
-0
strings.xml
app/src/main/res/values/strings.xml
+3
-0
styles.xml
app/src/main/res/values/styles.xml
+1
-2
No files found.
.idea/misc.xml
View file @
e5e292b8
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"ProjectRootManager"
version=
"2"
languageLevel=
"JDK_1_8"
project-jdk-name=
"
1.8
"
project-jdk-type=
"JavaSDK"
>
<component
name=
"ProjectRootManager"
version=
"2"
languageLevel=
"JDK_1_8"
project-jdk-name=
"
JDK
"
project-jdk-type=
"JavaSDK"
>
<output
url=
"file://$PROJECT_DIR$/build/classes"
/>
</component>
<component
name=
"ProjectType"
>
...
...
app/build.gradle
View file @
e5e292b8
...
...
@@ -6,7 +6,7 @@ android {
defaultConfig
{
applicationId
"com.yono.messeripos"
minSdkVersion
2
2
minSdkVersion
2
3
targetSdkVersion
30
versionCode
1
versionName
"1.0"
...
...
app/src/main/AndroidManifest.xml
View file @
e5e292b8
...
...
@@ -17,7 +17,10 @@
android:roundIcon=
"@mipmap/ic_launcher_new_icon"
android:supportsRtl=
"true"
android:theme=
"@style/AppTheme.appbar"
>
<activity
android:name=
".InvoiceActivity"
></activity>
<activity
android:name=
".HistoryActivity"
android:theme=
"@style/AppTheme.appbar"
/>
<activity
android:name=
".InvoiceActivity"
/>
<activity
android:name=
".LoginActivity"
android:theme=
"@style/AppTheme.appbar"
/>
...
...
app/src/main/java/com/yono/messeripos/CartActivity.java
View file @
e5e292b8
...
...
@@ -26,8 +26,6 @@ import com.yono.messeripos.models.MainViewModelsCart;
import
com.yono.messeripos.models.ProductCartModels
;
import
com.yono.messeripos.response.OrdersResponse
;
import
com.google.android.material.snackbar.Snackbar
;
import
java.util.List
;
import
java.util.Objects
;
...
...
@@ -59,9 +57,9 @@ public class CartActivity extends AppCompatActivity {
toolbars
.
setNavigationOnClickListener
(
view
->
onBackPressed
());
recyclerView
=
findViewById
(
R
.
id
.
rvCart
);
cartAdapter
=
new
CartAdapter
();
btnCheckout
=
findViewById
(
R
.
id
.
btCheckout
);
btnCheckout
=
findViewById
(
R
.
id
.
btCheckout
);
cartAdapter
=
new
CartAdapter
();
LinearLayoutManager
llm
=
new
LinearLayoutManager
(
this
);
recyclerView
.
setLayoutManager
(
llm
);
...
...
@@ -70,42 +68,42 @@ public class CartActivity extends AppCompatActivity {
modelsCart
=
new
ViewModelProvider
(
this
).
get
(
MainViewModelsCart
.
class
);
modelsCart
.
getCartProduct
().
observe
(
this
,
new
Observer
<
List
<
ProductCartModels
>>()
{
@Override
public
void
onChanged
(
List
<
ProductCartModels
>
productCartModels
)
{
if
(
productCartModels
!=
null
)
{
dataCart
=
productCartModels
;
cartAdapter
.
setCartAdapter
(
CartActivity
.
this
,
productCartModels
);
recyclerView
.
setAdapter
(
cartAdapter
);
}
}
});
cartAdapter
.
setListener
(
new
CartAdapter
.
CartListener
()
{
@Override
public
void
onDelete
(
ProductCartModels
productCartModels
)
{
modelsCart
.
deleteCart
(
productCartModels
);
}
@Override
public
void
onUpdateQuantityPlus
(
ProductCartModels
productCartModels
)
{
productCartModels
.
setQuantity_orders
(
productCartModels
.
getQuantity_orders
()
+
1
);
modelsCart
.
getCartProduct
().
observe
(
this
,
new
Observer
<
List
<
ProductCartModels
>>()
{
@Override
public
void
onChanged
(
List
<
ProductCartModels
>
productCartModels
)
{
if
(
productCartModels
!=
null
)
{
dataCart
=
productCartModels
;
cartAdapter
.
setCartAdapter
(
CartActivity
.
this
,
productCartModels
);
recyclerView
.
setAdapter
(
cartAdapter
);
}
}
});
cartAdapter
.
setListener
(
new
CartAdapter
.
CartListener
()
{
@Override
public
void
onDelete
(
ProductCartModels
productCartModels
)
{
modelsCart
.
deleteCart
(
productCartModels
);
}
@Override
public
void
onUpdateQuantityPlus
(
ProductCartModels
productCartModels
)
{
productCartModels
.
setQuantity_orders
(
productCartModels
.
getQuantity_orders
()
+
1
);
modelsCart
.
updateCart
(
productCartModels
);
}
}
@Override
public
void
onUpdateQuantityMinus
(
ProductCartModels
productCartModels
)
{
if
(
productCartModels
.
getQuantity_orders
()
>
1
)
{
productCartModels
.
setQuantity_orders
(
productCartModels
.
getQuantity_orders
()-
1
);
modelsCart
.
updateCart
(
productCartModels
);
}
}
@Override
public
void
onUpdateQuantityMinus
(
ProductCartModels
productCartModels
)
{
if
(
productCartModels
.
getQuantity_orders
()
>
1
)
{
productCartModels
.
setQuantity_orders
(
productCartModels
.
getQuantity_orders
()
-
1
);
modelsCart
.
updateCart
(
productCartModels
);
}
}
@Override
public
void
onCheckout
(
ProductCartModels
productCartModels
)
{
}
});
@Override
public
void
onCheckout
(
ProductCartModels
productCartModels
)
{
}
});
btnCheckout
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
...
...
@@ -116,16 +114,17 @@ public class CartActivity extends AppCompatActivity {
OrdersResponse
ordersResponse
=
new
OrdersResponse
();
List
<
ProductCartModels
>
productCartModels
;
Log
.
d
(
"Data cart checkout"
,
"onClick: "
+
dataCart
);
for
(
ProductCartModels
pd
:
dataCart
){
Log
.
d
(
"Data cart checkout"
,
"onClick: "
+
dataCart
);
for
(
ProductCartModels
pd
:
dataCart
)
{
ordersResponse
.
setOrders_id
(
pd
.
getId_orders
());
}
ordersResponse
.
setProduct_cart
(
dataCart
);
modelsCart
.
insertOrders
(
ordersResponse
);
progressDialog
.
dismiss
();
SharedPreferences
.
Editor
editor
=
sharedPreferences
.
edit
();
editor
.
putBoolean
(
SplashScreen
.
CHECKOUT
,
true
);
editor
.
putBoolean
(
MainActivity
.
CHECKOUT
,
true
);
if
(
editor
.
commit
()){
startActivity
(
new
Intent
(
CartActivity
.
this
,
PaymentActivity
.
class
));
finish
();
...
...
app/src/main/java/com/yono/messeripos/FormProductActivity.java
View file @
e5e292b8
package
com
.
yono
.
messeripos
;
import
android.Manifest
;
import
android.content.CursorLoader
;
import
android.content.Intent
;
import
android.database.Cursor
;
...
...
@@ -61,6 +62,9 @@ public class FormProductActivity extends AppCompatActivity {
"Oreo"
};
private
String
[]
permissions
=
new
String
[]{
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
,
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
};
@Override
public
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
...
...
@@ -68,6 +72,7 @@ public class FormProductActivity extends AppCompatActivity {
binding
.
btnAdd
.
setText
(
"Add New Prooduct"
);
productModels
=
new
ProductModels
();
requestPermissions
(
permissions
,
REQUEST_PERMISSIONS
);
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
)
{
Window
w
=
getWindow
();
...
...
app/src/main/java/com/yono/messeripos/HistoryActivity.java
0 → 100644
View file @
e5e292b8
package
com
.
yono
.
messeripos
;
import
androidx.appcompat.app.AppCompatActivity
;
import
androidx.lifecycle.Observer
;
import
androidx.lifecycle.ViewModelProvider
;
import
androidx.recyclerview.widget.LinearLayoutManager
;
import
androidx.recyclerview.widget.RecyclerView
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.util.Log
;
import
android.view.Window
;
import
android.view.WindowManager
;
import
com.google.android.material.appbar.MaterialToolbar
;
import
com.yono.messeripos.adapter.TransactionAdapter
;
import
com.yono.messeripos.models.MainViewModels
;
import
com.yono.messeripos.models.PaymentsModels
;
import
com.yono.messeripos.response.DataResponse
;
import
com.yono.messeripos.utils.Utils
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Objects
;
public
class
HistoryActivity
extends
AppCompatActivity
{
TransactionAdapter
transactionAdapter
;
PaymentsModels
paymentsModels
;
MainViewModels
mainViewModels
;
RecyclerView
recyclerView
;
Utils
utils
=
new
Utils
();
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_history
);
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
)
{
Window
w
=
getWindow
();
w
.
setFlags
(
WindowManager
.
LayoutParams
.
FLAG_LAYOUT_NO_LIMITS
,
WindowManager
.
LayoutParams
.
FLAG_LAYOUT_NO_LIMITS
);
}
MaterialToolbar
toolbars
=
findViewById
(
R
.
id
.
cAppBar
);
recyclerView
=
findViewById
(
R
.
id
.
rvHistory
);
recyclerView
.
addItemDecoration
(
utils
.
dividerItemDecoration
(
HistoryActivity
.
this
));
transactionAdapter
=
new
TransactionAdapter
();
mainViewModels
=
new
ViewModelProvider
(
this
).
get
(
MainViewModels
.
class
);
setSupportActionBar
(
toolbars
);
Objects
.
requireNonNull
(
getSupportActionBar
()).
setDisplayHomeAsUpEnabled
(
true
);
getSupportActionBar
().
setDisplayShowHomeEnabled
(
true
);
getSupportActionBar
().
setTitle
(
"All Transaction"
);
toolbars
.
setNavigationOnClickListener
(
view
->
onBackPressed
());
mainViewModels
.
getAllTransactions
().
observe
(
HistoryActivity
.
this
,
new
Observer
<
DataResponse
<
List
<
PaymentsModels
>>>()
{
@Override
public
void
onChanged
(
DataResponse
<
List
<
PaymentsModels
>>
listDataResponse
)
{
ArrayList
<
PaymentsModels
>
newData
=
new
ArrayList
<>();
newData
.
addAll
(
listDataResponse
.
getData
());
transactionAdapter
.
setTransactionAdapter
(
HistoryActivity
.
this
,
newData
);
/*
* SET RECYCLE VIEW MANAGER DISINI
* GUNAKAN LINEARLAYOUT MANAGER VERTICAL UNTUK SETTING LAYOUT MANAGER
*
* SET RECYCLEVIEW ADAPTER DENGAN TRANSACTION ADAPTER
*
* UNTUK BISA CLICK CARD VIEW NYA
* PANGGIL ADAPTERNYA KEMUDIAN .setList.....
* SILAHKAN PINDAH KE ACTIVITY SELANJUTNYA PADA ON.....
* */
}
});
}
}
\ No newline at end of file
app/src/main/java/com/yono/messeripos/MainActivity.java
View file @
e5e292b8
...
...
@@ -7,12 +7,15 @@ import android.content.Intent;
import
android.content.SharedPreferences
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.text.Editable
;
import
android.text.TextWatcher
;
import
android.util.Log
;
import
android.view.Menu
;
import
android.view.MenuItem
;
import
android.view.View
;
import
android.view.Window
;
import
android.view.WindowManager
;
import
android.widget.EditText
;
import
android.widget.TextView
;
import
android.widget.Toast
;
...
...
@@ -36,6 +39,7 @@ import com.yono.messeripos.databinding.ActivityMainBinding;
import
com.yono.messeripos.models.CategoryModels
;
import
com.yono.messeripos.models.MainViewModels
;
import
com.yono.messeripos.models.MainViewModelsCart
;
import
com.yono.messeripos.models.PaymentsModels
;
import
com.yono.messeripos.models.ProductCartModels
;
import
com.yono.messeripos.models.ProductModels
;
import
com.yono.messeripos.response.DataResponse
;
...
...
@@ -52,29 +56,35 @@ public class MainActivity extends AppCompatActivity {
ProductAdapter
productAdapter
;
CartAdapter
cartAdapter
;
TextView
txtBadge
;
EditText
etSearch
;
Utils
utils
=
new
Utils
();
public
static
Boolean
status_update
=
false
;
MainViewModelsCart
mainViewModelsCart
;
public
static
Boolean
cartIsEmpty
;
SharedPreferences
sharedPreferences
;
public
static
final
String
CHECKOUT
=
"checkout"
;
public
static
Boolean
checkout
;
public
static
Boolean
selectCategory
=
false
;
@SuppressLint
(
"LongLogTag"
)
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_main
);
ProductAdapter
adapter
=
new
ProductAdapter
();
binding
=
DataBindingUtil
.
setContentView
(
this
,
R
.
layout
.
activity_main
);
ProductAdapter
adapter
=
new
ProductAdapter
();
binding
.
rvProduct
.
setAdapter
(
adapter
);
// binding.appBarUpdate.setVisibility(View.GONE);
Log
.
i
(
"Status Checkout main activity"
,
"onCreate: "
+
SplashScreen
.
checkout
);
showLoading
(
true
);
categoryAdapter
=
new
CategoryAdapter
();
productAdapter
=
new
ProductAdapter
();
mainViewModelsCart
=
new
ViewModelProvider
(
MainActivity
.
this
).
get
(
MainViewModelsCart
.
class
);
sharedPreferences
=
getSharedPreferences
(
SplashScreen
.
MY_SHARED_PREFERENCES
,
Context
.
MODE_PRIVATE
);
checkout
=
sharedPreferences
.
getBoolean
(
CHECKOUT
,
false
);
toolbar
=
findViewById
(
R
.
id
.
topAppBar
);
mainViewModels
=
ViewModelProviders
.
of
(
this
).
get
(
MainViewModels
.
class
);
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
)
{
...
...
@@ -82,13 +92,29 @@ public class MainActivity extends AppCompatActivity {
w
.
setFlags
(
WindowManager
.
LayoutParams
.
FLAG_LAYOUT_NO_LIMITS
,
WindowManager
.
LayoutParams
.
FLAG_LAYOUT_NO_LIMITS
);
}
toolbar
=
findViewById
(
R
.
id
.
topAppBar
);
binding
.
etSearchProduct
.
addTextChangedListener
(
new
TextWatcher
()
{
@Override
public
void
beforeTextChanged
(
CharSequence
charSequence
,
int
i
,
int
i1
,
int
i2
)
{
}
@Override
public
void
onTextChanged
(
CharSequence
charSequence
,
int
i
,
int
i1
,
int
i2
)
{
productAdapter
.
getFilter
().
filter
(
charSequence
);
}
@Override
public
void
afterTextChanged
(
Editable
editable
)
{
}
});
toolbar
.
setOnMenuItemClickListener
(
new
Toolbar
.
OnMenuItemClickListener
()
{
@Override
public
boolean
onMenuItemClick
(
MenuItem
item
)
{
int
id
=
item
.
getItemId
();
if
(
id
==
R
.
id
.
menu_cart
)
{
if
(
SplashScreen
.
checkout
){
if
(
checkout
){
startActivity
(
new
Intent
(
getApplicationContext
(),
PaymentActivity
.
class
));
}
else
{
startActivity
(
new
Intent
(
getApplicationContext
(),
CartActivity
.
class
));
...
...
@@ -108,20 +134,25 @@ public class MainActivity extends AppCompatActivity {
productAdapter
.
notifyDataSetChanged
();
}
else
if
(
id
==
R
.
id
.
create
)
{
startActivity
(
new
Intent
(
getApplicationContext
(),
FormProductActivity
.
class
));
}
else
if
(
id
==
R
.
id
.
allTransaction
){
startActivity
(
new
Intent
(
getApplicationContext
(),
HistoryActivity
.
class
));
}
return
true
;
}
});
mainViewModels
=
ViewModelProviders
.
of
(
this
).
get
(
MainViewModels
.
class
);
mainViewModels
.
getCategory
().
observe
(
this
,
new
Observer
<
DataResponse
<
List
<
CategoryModels
>>>()
{
@Override
public
void
onChanged
(
DataResponse
<
List
<
CategoryModels
>>
listDataResponse
)
{
if
(
listDataResponse
!=
null
)
{
CategoryModels
caModels
=
new
CategoryModels
();
caModels
.
setNameCategory
(
"All"
);
caModels
.
setIdCategory
(
0
);
List
<
CategoryModels
>
categoryModels
=
listDataResponse
.
getData
();
ArrayList
<
CategoryModels
>
categoryModelsArrayList
=
new
ArrayList
<>();
categoryModels
.
add
(
0
,
caModels
);
categoryModelsArrayList
.
addAll
(
categoryModels
);
categoryAdapter
.
setCategoriAdapter
(
MainActivity
.
this
,
categoryModelsArrayList
);
binding
.
rvCategory
.
setLayoutManager
(
new
LinearLayoutManager
(
MainActivity
.
this
,
LinearLayoutManager
.
HORIZONTAL
,
false
));
...
...
@@ -134,8 +165,6 @@ public class MainActivity extends AppCompatActivity {
}
});
mainViewModels
=
ViewModelProviders
.
of
(
this
).
get
(
MainViewModels
.
class
);
binding
.
imgEmpty
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
...
...
@@ -245,33 +274,79 @@ public class MainActivity extends AppCompatActivity {
showLoading
(
true
);
ProgressDialog
progressDialog
=
new
ProgressDialog
(
MainActivity
.
this
);
progressDialog
.
setMessage
(
"Loading..."
);
progressDialog
.
show
();
Log
.
i
(
"diluar if"
,
"onGetProduct: "
+
selectCategory
);
if
(!
selectCategory
){
progressDialog
.
show
();
}
selectCategory
=
true
;
Log
.
i
(
"setelah if"
,
"onGetProduct: "
+
selectCategory
);
binding
.
rvProduct
.
setVisibility
(
View
.
GONE
);
mainViewModels
.
getProductByCategory
(
categoryModels
.
getIdCategory
()).
observe
(
MainActivity
.
this
,
new
Observer
<
DataResponse
<
List
<
ProductModels
>>>()
{
@Override
public
void
onChanged
(
DataResponse
<
List
<
ProductModels
>>
listDataResponse
)
{
if
(
listDataResponse
!=
null
)
{
ArrayList
<
ProductModels
>
productModelsArrayList
=
new
ArrayList
<>();
productModelsArrayList
.
addAll
(
listDataResponse
.
getData
());
progressDialog
.
dismiss
();
showLoading
(
false
);
if
(
productModelsArrayList
.
isEmpty
())
{
binding
.
rvProduct
.
setVisibility
(
View
.
GONE
);
binding
.
imgEmpty
.
setVisibility
(
View
.
VISIBLE
);
binding
.
imgEmpty
.
bringToFront
();
}
else
{
binding
.
rvProduct
.
setVisibility
(
View
.
VISIBLE
);
binding
.
imgEmpty
.
setVisibility
(
View
.
GONE
);
productAdapter
.
setProduct
(
MainActivity
.
this
,
productModelsArrayList
);
binding
.
rvProduct
.
setLayoutManager
(
new
GridLayoutManager
(
MainActivity
.
this
,
2
));
binding
.
rvProduct
.
setAdapter
(
productAdapter
);
productAdapter
.
notifyDataSetChanged
();
if
(
categoryModels
.
getIdCategory
()
==
0
){
if
(
mainViewModels
.
getProduct
().
getValue
().
getData
().
size
()
!=
0
){
progressDialog
.
dismiss
();
selectCategory
=
false
;
}
else
{
binding
.
rvProduct
.
setVisibility
(
View
.
GONE
);
binding
.
imgEmpty
.
setVisibility
(
View
.
VISIBLE
);
binding
.
imgEmpty
.
bringToFront
();
selectCategory
=
false
;
}
// mainViewModels.getProduct().observe(MainActivity.this, new Observer<DataResponse<List<ProductModels<CategoryModels>>>>() {
// @Override
// public void onChanged(DataResponse<List<ProductModels<CategoryModels>>> listDataResponse) {
// if (listDataResponse != null) {
// ArrayList<ProductModels> productModelsArrayList = new ArrayList<>();
//
// productModelsArrayList.addAll(listDataResponse.getData());
// progressDialog.dismiss();
// showLoading(false);
// if (productModelsArrayList.isEmpty()) {
// binding.rvProduct.setVisibility(View.GONE);
// binding.imgEmpty.setVisibility(View.VISIBLE);
// binding.imgEmpty.bringToFront();
// selectCategory = false;
// Log.i("daidalam get if", "onGetProduct: "+selectCategory);
// } else {
// binding.rvProduct.setVisibility(View.VISIBLE);
// binding.imgEmpty.setVisibility(View.GONE);
// productAdapter.setProduct(MainActivity.this, productModelsArrayList);
// binding.rvProduct.setLayoutManager(new GridLayoutManager(MainActivity.this, 2));
// binding.rvProduct.setAdapter(productAdapter);
// selectCategory = false;
// Log.i("daidalam get else", "onGetProduct: "+selectCategory);
//// productAdapter.notifyDataSetChanged();
// }
// }
// }
// });
selectCategory
=
false
;
}
else
{
mainViewModels
.
getProductByCategory
(
categoryModels
.
getIdCategory
()).
observe
(
MainActivity
.
this
,
new
Observer
<
DataResponse
<
List
<
ProductModels
>>>()
{
@Override
public
void
onChanged
(
DataResponse
<
List
<
ProductModels
>>
listDataResponse
)
{
if
(
listDataResponse
!=
null
)
{
ArrayList
<
ProductModels
>
productModelsArrayList
=
new
ArrayList
<>();
productModelsArrayList
.
addAll
(
listDataResponse
.
getData
());
progressDialog
.
dismiss
();
showLoading
(
false
);
if
(
productModelsArrayList
.
isEmpty
())
{
binding
.
rvProduct
.
setVisibility
(
View
.
GONE
);
binding
.
imgEmpty
.
setVisibility
(
View
.
VISIBLE
);
binding
.
imgEmpty
.
bringToFront
();
}
else
{
binding
.
rvProduct
.
setVisibility
(
View
.
VISIBLE
);
binding
.
imgEmpty
.
setVisibility
(
View
.
GONE
);
productAdapter
.
setProduct
(
MainActivity
.
this
,
productModelsArrayList
);
binding
.
rvProduct
.
setLayoutManager
(
new
GridLayoutManager
(
MainActivity
.
this
,
2
));
binding
.
rvProduct
.
setAdapter
(
productAdapter
);
// productAdapter.notifyDataSetChanged();
}
}
}
}
}
);
}
);
}
}
});
}
...
...
app/src/main/java/com/yono/messeripos/PaymentActivity.java
View file @
e5e292b8
...
...
@@ -4,6 +4,7 @@ import androidx.appcompat.app.AppCompatActivity;
import
androidx.lifecycle.Observer
;
import
androidx.lifecycle.ViewModelProvider
;
import
androidx.lifecycle.ViewModelProviders
;
import
androidx.recyclerview.widget.DividerItemDecoration
;
import
androidx.recyclerview.widget.LinearLayoutManager
;
import
androidx.recyclerview.widget.RecyclerView
;
...
...
@@ -15,41 +16,59 @@ import android.view.View;
import
android.view.Window
;
import
android.view.WindowManager
;
import
android.widget.Button
;
import
android.widget.ListView
;
import
android.widget.TextView
;
import
android.widget.Toast
;
import
android.widget.Toolbar
;
import
com.google.android.material.appbar.MaterialToolbar
;
import
com.google.android.material.snackbar.Snackbar
;
import
com.google.gson.Gson
;
import
com.yono.messeripos.adapter.CartAdapter
;
import
com.yono.messeripos.adapter.CheckoutAdapter
;
import
com.yono.messeripos.adapter.PaymentAdapter
;
import
com.yono.messeripos.models.MainViewModels
;
import
com.yono.messeripos.models.MainViewModelsCart
;
import
com.yono.messeripos.models.PaymentsModels
;
import
com.yono.messeripos.models.ProductCartModels
;
import
com.yono.messeripos.response.PaymentResponse
;
import
com.yono.messeripos.utils.Utils
;
import
java.util.ArrayList
;
import
java.util.List
;
import
static
com
.
yono
.
messeripos
.
MainActivity
.
checkout
;
public
class
PaymentActivity
extends
AppCompatActivity
{
private
ArrayList
<
PaymentResponse
>
paymentResponses
=
new
ArrayList
<>();
public
static
String
methodPay
=
""
;
private
Button
btnPay
;
private
MainViewModelsCart
mainViewModels
;
private
PaymentsModels
paymentsModels
;
private
long
total
=
0
;
private
Utils
utils
=
new
Utils
();
private
RecyclerView
recyclerView
;
private
CheckoutAdapter
checkoutAdapter
;
private
TextView
grandTotal
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_payment
);
Log
.
i
(
"Status Checkout payment"
,
"onCreate: "
+
SplashScreen
.
checkout
);
Log
.
i
(
"Status Checkout payment"
,
"onCreate: "
+
checkout
);
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
)
{
Window
w
=
getWindow
();
w
.
setFlags
(
WindowManager
.
LayoutParams
.
FLAG_LAYOUT_NO_LIMITS
,
WindowManager
.
LayoutParams
.
FLAG_LAYOUT_NO_LIMITS
);
}
paymentsModels
=
new
PaymentsModels
();
checkoutAdapter
=
new
CheckoutAdapter
();
recyclerView
=
findViewById
(
R
.
id
.
rvItem
);
grandTotal
=
findViewById
(
R
.
id
.
grand_total
);
MaterialToolbar
toolbars
=
findViewById
(
R
.
id
.
appbar
);
setSupportActionBar
(
toolbars
);
DividerItemDecoration
dividerItemDecoration
=
new
DividerItemDecoration
(
this
,
DividerItemDecoration
.
VERTICAL
);
mainViewModels
=
new
ViewModelProvider
(
PaymentActivity
.
this
).
get
(
MainViewModelsCart
.
class
);
mainViewModels
.
getCartProduct
().
observe
(
this
,
new
Observer
<
List
<
ProductCartModels
>>()
{
@Override
...
...
@@ -57,7 +76,18 @@ public class PaymentActivity extends AppCompatActivity {
String
js
=
new
Gson
().
toJson
(
productCartModels
);
Log
.
i
(
"On payment"
,
"onChanged: "
+
js
);
for
(
ProductCartModels
pd
:
productCartModels
){
total
=
total
+
pd
.
getPrice_orders
()*
pd
.
getQuantity_orders
();
}
getSupportActionBar
().
setTitle
(
productCartModels
.
get
(
0
).
getId_orders
());
paymentsModels
.
setOrderId
(
productCartModels
.
get
(
0
).
getId_orders
());
paymentsModels
.
setGrossAmount
(
total
);
checkoutAdapter
.
setCheckoutAdapter
(
PaymentActivity
.
this
,
productCartModels
);
recyclerView
.
setLayoutManager
(
new
LinearLayoutManager
(
PaymentActivity
.
this
,
RecyclerView
.
VERTICAL
,
false
));
recyclerView
.
setAdapter
(
checkoutAdapter
);
recyclerView
.
addItemDecoration
(
dividerItemDecoration
);
grandTotal
.
setText
(
utils
.
convertPrice
(
"Rp. "
,
total
));
}
});
...
...
@@ -85,7 +115,14 @@ public class PaymentActivity extends AppCompatActivity {
btnPay
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
Toast
.
makeText
(
getApplicationContext
(),
methodPay
,
Toast
.
LENGTH_LONG
).
show
();
if
(
methodPay
.
equals
(
"cash"
)){
paymentsModels
.
setPaymentType
(
"cash"
);
Log
.
i
(
"CASH"
,
"onClick: "
+
utils
.
convertGson
(
paymentsModels
));
}
else
{
paymentsModels
.
setPaymentType
(
"bank_transfer"
);
paymentsModels
.
setBank
(
methodPay
);
Log
.
i
(
"BANK"
,
"onClick: "
+
utils
.
convertGson
(
paymentsModels
));
}
}
});
}
...
...
app/src/main/java/com/yono/messeripos/SplashScreen.java
View file @
e5e292b8
...
...
@@ -24,9 +24,7 @@ public class SplashScreen extends AppCompatActivity {
SharedPreferences
sharedPreferences
;
public
static
final
String
MY_SHARED_PREFERENCES
=
"my_shared_preferences"
;
public
static
final
String
SESSION
=
"session"
;
public
static
final
String
CHECKOUT
=
"checkout"
;
public
static
Boolean
session
;
public
static
Boolean
checkout
;
@Override
public
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
...
...
@@ -50,7 +48,6 @@ public class SplashScreen extends AppCompatActivity {
},
700
);
sharedPreferences
=
getSharedPreferences
(
MY_SHARED_PREFERENCES
,
Context
.
MODE_PRIVATE
);
session
=
sharedPreferences
.
getBoolean
(
SESSION
,
false
);
checkout
=
sharedPreferences
.
getBoolean
(
CHECKOUT
,
false
);
...
...
app/src/main/java/com/yono/messeripos/adapter/CartAdapter.java
View file @
e5e292b8
...
...
@@ -15,6 +15,7 @@ import com.google.gson.Gson;
import
com.yono.messeripos.CartActivity
;
import
com.yono.messeripos.R
;
import
com.yono.messeripos.databinding.ItemCartBinding
;
import
com.yono.messeripos.databinding.ItemCheckoutBinding
;
import
com.yono.messeripos.models.CartModels
;
import
com.yono.messeripos.models.CategoryModels
;
import
com.yono.messeripos.models.ProductCartModels
;
...
...
@@ -66,6 +67,7 @@ public class CartAdapter extends RecyclerView.Adapter<CartAdapter.MyViewHolder>
parent
,
false
);
return
new
MyViewHolder
(
itemCartBinding
);
}
...
...
@@ -90,17 +92,17 @@ public class CartAdapter extends RecyclerView.Adapter<CartAdapter.MyViewHolder>
@SuppressLint
(
"SetTextI18n"
)
public
void
bindData
(
ProductCartModels
cartModels
)
{
binding
.
setCarts
(
cartModels
);
binding
.
setPrice
(
utils
.
convertPrice
(
"Rp. "
,
cartModels
.
getPrice_orders
()));
/*
* Data binding for itemCart in cart activity
* */
subtotal
=
cartModels
.
getPrice_orders
()
*
cartModels
.
getQuantity_orders
();
binding
.
setCarts
(
cartModels
);
binding
.
setPrice
(
utils
.
convertPrice
(
"Rp. "
,
cartModels
.
getPrice_orders
()));
binding
.
setSubTotal
(
utils
.
convertPrice
(
"Rp. "
,
subtotal
));
binding
.
etQty
.
setText
(
Long
.
toString
(
cartModels
.
getQuantity_orders
()));
binding
.
btDelete
.
setOnClickListener
(
view
->
{
listener
.
onDelete
(
cartModels
);
});
// set edit text qty
binding
.
etQty
.
setText
(
Long
.
toString
(
cartModels
.
getQuantity_orders
()));
...
...
@@ -113,6 +115,11 @@ public class CartAdapter extends RecyclerView.Adapter<CartAdapter.MyViewHolder>
listener
.
onUpdateQuantityMinus
(
cartModels
);
});
binding
.
btDelete
.
setOnClickListener
(
view
->
{
listener
.
onDelete
(
cartModels
);
});
}
}
...
...
app/src/main/java/com/yono/messeripos/adapter/CheckoutAdapter.java
0 → 100644
View file @
e5e292b8
package
com
.
yono
.
messeripos
.
adapter
;
import
android.content.Context
;
import
android.util.Log
;
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.ItemCartBinding
;
import
com.yono.messeripos.databinding.ItemCheckoutBinding
;
import
com.yono.messeripos.models.ProductCartModels
;
import
com.yono.messeripos.utils.Utils
;
import
java.util.List
;
public
class
CheckoutAdapter
extends
RecyclerView
.
Adapter
<
CheckoutAdapter
.
MyViewHolder
>
{
private
List
<
ProductCartModels
>
cartModels
;
private
int
price
;
Context
context
;
Utils
utils
=
new
Utils
();
public
void
setCheckoutAdapter
(
Context
context
,
List
<
ProductCartModels
>
cartModels
)
{
this
.
cartModels
=
cartModels
;
this
.
context
=
context
;
Log
.
d
(
"Checkout Adapter: "
,
String
.
valueOf
(
this
.
cartModels
));
notifyDataSetChanged
();
}
@NonNull
@Override
public
CheckoutAdapter
.
MyViewHolder
onCreateViewHolder
(
@NonNull
ViewGroup
parent
,
int
viewType
)
{
ItemCheckoutBinding
itemCheckoutBinding
=
DataBindingUtil
.
inflate
(
LayoutInflater
.
from
(
parent
.
getContext
()),
R
.
layout
.
item_checkout
,
parent
,
false
);
return
new
MyViewHolder
(
itemCheckoutBinding
);
}
@Override
public
void
onBindViewHolder
(
@NonNull
CheckoutAdapter
.
MyViewHolder
holder
,
int
position
)
{
holder
.
binData
(
cartModels
.
get
(
position
));
}
@Override
public
int
getItemCount
()
{
return
cartModels
.
size
();
}
public
class
MyViewHolder
extends
RecyclerView
.
ViewHolder
{
private
long
subtotal
=
0
;
private
ItemCheckoutBinding
itemCheckoutBinding
;
public
MyViewHolder
(
@NonNull
ItemCheckoutBinding
itemView
)
{
super
(
itemView
.
getRoot
());
this
.
itemCheckoutBinding
=
itemView
;
}
public
void
binData
(
ProductCartModels
cartModels
){
subtotal
=
cartModels
.
getPrice_orders
()
*
cartModels
.
getQuantity_orders
();
itemCheckoutBinding
.
setCheckout
(
cartModels
);
itemCheckoutBinding
.
setSubtotal
(
utils
.
convertPrice
(
"Rp. "
,
subtotal
));
}
}
}
app/src/main/java/com/yono/messeripos/adapter/ProductAdapter.java
View file @
e5e292b8
...
...
@@ -2,42 +2,31 @@ package com.yono.messeripos.adapter;
import
android.annotation.SuppressLint
;
import
android.content.Context
;
import
android.util.Log
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.Toast
;
import
android.widget.Filter
;
import
android.widget.Filterable
;
import
androidx.annotation.NonNull
;
import
androidx.databinding.DataBindingUtil
;
import
androidx.lifecycle.ViewModelProvider
;
import
androidx.recyclerview.widget.RecyclerView
;
import
com.yono.messeripos.MainActivity
;
import
com.yono.messeripos.R
;
import
com.yono.messeripos.databinding.ItemListBinding
;
import
androidx.fragment.app.FragmentActivity
;
import
androidx.lifecycle.ViewModelProvider
;
import
androidx.lifecycle.ViewModelProviders
;
import
androidx.recyclerview.widget.RecyclerView
;
import
com.
google.gson.Gson
;
import
com.
yono.messeripos.MainActivity
;
import
com.yono.messeripos.R
;
import
com.yono.messeripos.databinding.ItemListBinding
;
import
com.yono.messeripos.models.CartModels
;
import
com.yono.messeripos.models.MainViewModelsCart
;
import
com.yono.messeripos.models.ProductCartModels
;
import
com.yono.messeripos.models.ProductModels
;
import
com.yono.messeripos.utils.Utils
;
import
java.text.DecimalFormat
;
import
java.text.DecimalFormatSymbols
;
import
java.util.ArrayList
;
public
class
ProductAdapter
extends
RecyclerView
.
Adapter
<
ProductAdapter
.
MyViewHolder
>
{
public
class
ProductAdapter
extends
RecyclerView
.
Adapter
<
ProductAdapter
.
MyViewHolder
>
implements
Filterable
{
private
ArrayList
<
ProductModels
>
productModels
=
new
ArrayList
<>();
private
ArrayList
<
ProductModels
>
productModelsFiltered
=
new
ArrayList
<>();
Context
context
;
MainViewModelsCart
mainViewModelsCart
;
Utils
utils
=
new
Utils
();
public
interface
ProductListener
{
...
...
@@ -58,10 +47,42 @@ public class ProductAdapter extends RecyclerView.Adapter<ProductAdapter.MyViewHo
public
void
setProduct
(
Context
context
,
ArrayList
<
ProductModels
>
productModels
)
{
this
.
productModels
=
productModels
;
this
.
context
=
context
;
mainViewModelsCart
=
ViewModelProviders
.
of
((
FragmentActivity
)
context
).
get
(
MainViewModelsCart
.
class
)
;
this
.
productModelsFiltered
=
productModels
;
notifyDataSetChanged
();
}
@Override
public
Filter
getFilter
()
{
return
new
Filter
()
{
@Override
protected
FilterResults
performFiltering
(
CharSequence
charSequence
)
{
String
charString
=
charSequence
.
toString
();
if
(
charString
.
isEmpty
())
{
productModelsFiltered
=
productModels
;
}
else
{
ArrayList
<
ProductModels
>
filteredList
=
new
ArrayList
<>();
for
(
ProductModels
prdk
:
productModels
)
{
if
(
prdk
.
getProductName
().
toLowerCase
().
contains
(
charString
.
toLowerCase
()))
{
filteredList
.
add
(
prdk
);
}
}
productModelsFiltered
=
filteredList
;
}
FilterResults
filterResults
=
new
FilterResults
();
filterResults
.
values
=
productModelsFiltered
;
return
filterResults
;
}
@Override
protected
void
publishResults
(
CharSequence
charSequence
,
FilterResults
filterResults
)
{
productModelsFiltered
=
(
ArrayList
<
ProductModels
>)
filterResults
.
values
;
notifyDataSetChanged
();
}
};
}
@NonNull
@Override
public
ProductAdapter
.
MyViewHolder
onCreateViewHolder
(
@NonNull
ViewGroup
parent
,
int
viewType
)
{
...
...
@@ -77,12 +98,12 @@ public class ProductAdapter extends RecyclerView.Adapter<ProductAdapter.MyViewHo
@Override
public
void
onBindViewHolder
(
@NonNull
ProductAdapter
.
MyViewHolder
holder
,
int
position
)
{
holder
.
bindData
(
productModels
.
get
(
position
));
holder
.
bindData
(
productModels
Filtered
.
get
(
position
));
}
@Override
public
int
getItemCount
()
{
return
productModels
.
size
();
return
productModels
Filtered
.
size
();
}
public
class
MyViewHolder
extends
RecyclerView
.
ViewHolder
{
...
...
app/src/main/java/com/yono/messeripos/adapter/TransactionAdapter.java
0 → 100644
View file @
e5e292b8
package
com
.
yono
.
messeripos
.
adapter
;
import
android.content.Context
;
import
android.os.Build
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
androidx.annotation.NonNull
;
import
androidx.annotation.RequiresApi
;
import
androidx.databinding.DataBindingUtil
;
import
androidx.recyclerview.widget.RecyclerView
;
import
com.yono.messeripos.R
;
import
com.yono.messeripos.databinding.ItemHistoryBinding
;
import
com.yono.messeripos.models.PaymentsModels
;
import
com.yono.messeripos.models.ProductCartModels
;
import
com.yono.messeripos.utils.Utils
;
import
java.util.ArrayList
;
public
class
TransactionAdapter
extends
RecyclerView
.
Adapter
<
TransactionAdapter
.
MyViewHolder
>
{
private
ArrayList
<
PaymentsModels
>
paymentsModels
=
new
ArrayList
<>();
Context
context
;
Utils
utils
=
new
Utils
();
public
interface
TransactionListener
{
void
onShowDetail
(
PaymentsModels
paymentsModels
);
}
private
TransactionListener
listener
;
public
void
setListener
(
TransactionListener
listener
)
{
this
.
listener
=
listener
;
}
public
void
setTransactionAdapter
(
Context
context
,
ArrayList
<
PaymentsModels
>
paymentsModels
){
this
.
paymentsModels
=
paymentsModels
;
this
.
context
=
context
;
notifyDataSetChanged
();
}
@NonNull
@Override
public
TransactionAdapter
.
MyViewHolder
onCreateViewHolder
(
@NonNull
ViewGroup
parent
,
int
viewType
)
{
ItemHistoryBinding
itemHistoryBinding
=
DataBindingUtil
.
inflate
(
LayoutInflater
.
from
(
parent
.
getContext
()),
R
.
layout
.
item_history
,
parent
,
false
);
return
new
MyViewHolder
(
itemHistoryBinding
);
}
@RequiresApi
(
api
=
Build
.
VERSION_CODES
.
O
)
@Override
public
void
onBindViewHolder
(
@NonNull
TransactionAdapter
.
MyViewHolder
holder
,
int
position
)
{
holder
.
binData
(
paymentsModels
.
get
(
position
));
}
@Override
public
int
getItemCount
()
{
return
paymentsModels
.
size
();
}
public
class
MyViewHolder
extends
RecyclerView
.
ViewHolder
{
ItemHistoryBinding
itemHistoryBinding
;
public
MyViewHolder
(
@NonNull
ItemHistoryBinding
itemView
)
{
super
(
itemView
.
getRoot
());
this
.
itemHistoryBinding
=
itemView
;
}
@RequiresApi
(
api
=
Build
.
VERSION_CODES
.
O
)
public
void
binData
(
PaymentsModels
paymentsModels
){
itemHistoryBinding
.
setTransaction
(
paymentsModels
);
itemHistoryBinding
.
setDate
(
utils
.
convertDate
(
paymentsModels
.
getUpdatedAt
()));
itemHistoryBinding
.
cvHistory
.
setOnClickListener
(
view
->
listener
.
onShowDetail
(
paymentsModels
));
}
}
}
app/src/main/java/com/yono/messeripos/api/service/PaymentService.java
0 → 100644
View file @
e5e292b8
package
com
.
yono
.
messeripos
.
api
.
service
;
import
com.yono.messeripos.api.ApiHelper
;
import
retrofit2.Call
;
import
retrofit2.http.POST
;
public
interface
PaymentService
{
// @POST(ApiHelper.VERSI_API_1+"payment")
// Call
}
app/src/main/java/com/yono/messeripos/api/service/TransactionService.java
0 → 100644
View file @
e5e292b8
package
com
.
yono
.
messeripos
.
api
.
service
;
import
com.yono.messeripos.api.ApiHelper
;
import
com.yono.messeripos.models.PaymentsModels
;
import
com.yono.messeripos.response.DataResponse
;
import
java.util.List
;
import
retrofit2.Call
;
import
retrofit2.http.GET
;
public
interface
TransactionService
{
@GET
(
ApiHelper
.
VERSI_API_1
+
"payments"
)
Call
<
DataResponse
<
List
<
PaymentsModels
>>>
getAllTransaction
();
}
app/src/main/java/com/yono/messeripos/models/MainViewModels.java
View file @
e5e292b8
...
...
@@ -4,14 +4,18 @@ import android.util.Log;
import
androidx.lifecycle.LiveData
;
import
androidx.lifecycle.MutableLiveData
;
import
androidx.lifecycle.Transformations
;
import
androidx.lifecycle.ViewModel
;
import
androidx.lifecycle.ViewModelProvider
;
import
com.google.gson.Gson
;
import
com.yono.messeripos.api.client.Client
;
import
com.yono.messeripos.api.service.CategoryServise
;
import
com.yono.messeripos.api.service.ProductService
;
import
com.yono.messeripos.api.service.TransactionService
;
import
com.yono.messeripos.api.service.UsersService
;
import
com.yono.messeripos.response.DataResponse
;
import
com.yono.messeripos.utils.Utils
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -25,13 +29,19 @@ public class MainViewModels extends ViewModel {
MutableLiveData
<
DataResponse
<
List
<
ProductModels
>>>
productByCategory
;
MutableLiveData
<
DataResponse
<
List
<
CategoryModels
>>>
categoryList
;
MutableLiveData
<
DataResponse
<
UsersModels
>>
usersLogin
;
MutableLiveData
<
DataResponse
<
List
<
PaymentsModels
>>>
transactions
;
private
MainViewModels
mainViewModels
;
Client
client
=
new
Client
();
Utils
utils
=
new
Utils
();
public
MainViewModels
(){
productList
=
new
MutableLiveData
<>();
categoryList
=
new
MutableLiveData
<>();
productByCategory
=
new
MutableLiveData
<>();
transactions
=
new
MutableLiveData
<>();
}
public
LiveData
<
DataResponse
<
List
<
ProductModels
<
CategoryModels
>>>>
getProduct
(){
...
...
@@ -49,6 +59,34 @@ public class MainViewModels extends ViewModel {
return
productByCategory
;
}
public
LiveData
<
DataResponse
<
List
<
PaymentsModels
>>>
getAllTransactions
(){
getDataTransaction
();
return
transactions
;
}
private
void
getDataTransaction
()
{
TransactionService
transactionService
=
client
.
Client
(
TransactionService
.
class
);
transactionService
.
getAllTransaction
().
enqueue
(
new
Callback
<
DataResponse
<
List
<
PaymentsModels
>>>()
{
@Override
public
void
onResponse
(
Call
<
DataResponse
<
List
<
PaymentsModels
>>>
call
,
Response
<
DataResponse
<
List
<
PaymentsModels
>>>
response
)
{
Log
.
i
(
"Get all transaction"
,
"onResponse: "
+
utils
.
convertGson
(
response
.
body
()));
if
(
response
.
body
()
!=
null
){
transactions
.
setValue
(
response
.
body
());
}
else
{
transactions
=
null
;
}
}
@Override
public
void
onFailure
(
Call
<
DataResponse
<
List
<
PaymentsModels
>>>
call
,
Throwable
t
)
{
Log
.
e
(
"Error get transaction"
,
"onFailure: "
,
t
);
transactions
=
null
;
}
});
}
private
void
getDataProductByCategory
(
int
id
)
{
CategoryServise
categoryServise
=
client
.
Client
(
CategoryServise
.
class
);
...
...
app/src/main/java/com/yono/messeripos/models/PaymentsModels.java
0 → 100644
View file @
e5e292b8
package
com
.
yono
.
messeripos
.
models
;
import
com.google.gson.annotations.SerializedName
;
public
class
PaymentsModels
{
@SerializedName
(
"order_code"
)
private
String
orderId
;
@SerializedName
(
"payment_type"
)
private
String
paymentType
;
@SerializedName
(
"bank"
)
private
String
bank
;
@SerializedName
(
"gross_amount"
)
private
long
grossAmount
;
@SerializedName
(
"transaction_status"
)
private
String
transactionStatus
;
@SerializedName
(
"created_at"
)
private
String
createdAt
;
@SerializedName
(
"updated_at"
)
private
String
updatedAt
;
public
PaymentsModels
()
{
}
public
PaymentsModels
(
String
orderId
,
String
paymentType
,
String
bank
,
long
grossAmount
)
{
this
.
orderId
=
orderId
;
this
.
paymentType
=
paymentType
;
this
.
bank
=
bank
;
this
.
grossAmount
=
grossAmount
;
}
public
String
getOrderId
()
{
return
orderId
;
}
public
void
setOrderId
(
String
orderId
)
{
this
.
orderId
=
orderId
;
}
public
String
getPaymentType
()
{
return
paymentType
;
}
public
void
setPaymentType
(
String
paymentType
)
{
this
.
paymentType
=
paymentType
;
}
public
String
getBank
()
{
return
bank
;
}
public
void
setBank
(
String
bank
)
{
this
.
bank
=
bank
;
}
public
long
getGrossAmount
()
{
return
grossAmount
;
}
public
void
setGrossAmount
(
long
grossAmount
)
{
this
.
grossAmount
=
grossAmount
;
}
public
String
getTransactionStatus
()
{
return
transactionStatus
;
}
public
void
setTransactionStatus
(
String
transactionStatus
)
{
this
.
transactionStatus
=
transactionStatus
;
}
public
String
getCreatedAt
()
{
return
createdAt
;
}
public
void
setCreatedAt
(
String
createdAt
)
{
this
.
createdAt
=
createdAt
;
}
public
String
getUpdatedAt
()
{
return
updatedAt
;
}
public
void
setUpdatedAt
(
String
updatedAt
)
{
this
.
updatedAt
=
updatedAt
;
}
}
app/src/main/java/com/yono/messeripos/utils/Utils.java
View file @
e5e292b8
package
com
.
yono
.
messeripos
.
utils
;
import
android.content.Context
;
import
android.os.Build
;
import
androidx.annotation.RequiresApi
;
import
androidx.recyclerview.widget.DividerItemDecoration
;
import
com.google.gson.Gson
;
import
java.text.DecimalFormat
;
import
java.text.DecimalFormatSymbols
;
import
java.text.SimpleDateFormat
;
import
java.time.LocalDateTime
;
import
java.time.ZoneId
;
import
java.time.format.DateTimeFormatter
;
import
java.util.Date
;
import
java.util.Locale
;
public
class
Utils
{
public
String
convertPrice
(
String
mataUang
,
int
nilai
){
...
...
@@ -36,4 +48,29 @@ public class Utils {
String
timeStamp
=
new
SimpleDateFormat
(
"yyyyMMdd_HHmmss"
).
format
(
new
Date
());
return
timeStamp
;
}
public
String
convertGson
(
Object
object
){
String
js
=
new
Gson
().
toJson
(
object
);
return
js
;
}
public
DividerItemDecoration
dividerItemDecoration
(
Context
context
){
DividerItemDecoration
dividerItemDecoration
=
new
DividerItemDecoration
(
context
,
DividerItemDecoration
.
VERTICAL
);
return
dividerItemDecoration
;
}
@RequiresApi
(
api
=
Build
.
VERSION_CODES
.
O
)
public
String
convertDate
(
String
date
){
DateTimeFormatter
dateTimeFormatter
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"
)
.
withZone
(
ZoneId
.
of
(
"UTC"
));
LocalDateTime
localDateTime
=
LocalDateTime
.
parse
(
date
,
dateTimeFormatter
);
DateTimeFormatter
localFormatter
=
DateTimeFormatter
.
ofPattern
(
"EEEE, dd MM yyyy"
,
new
Locale
(
"id"
,
"ID"
));
String
localDate
=
localDateTime
.
format
(
localFormatter
);
return
localDate
;
}
}
app/src/main/res/layout/activity_cart.xml
View file @
e5e292b8
...
...
@@ -21,28 +21,6 @@
app:layoutManager=
"androidx.recyclerview.widget.GridLayoutManager"
tools:listitem=
"@layout/item_cart"
/>
<!-- <androidx.recyclerview.widget.RecyclerView-->
<!-- android:id="@+id/rvCart"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"-->
<!-- tools:listitem="@layout/item_cart"-->
<!-- android:layout_above="@+id/btCheckout"-->
<!-- />-->
<!-- <com.google.android.material.button.MaterialButton-->
<!-- android:id="@+id/btCheckout"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:text="@string/title_checkout"-->
<!-- android:padding="15dp"-->
<!-- android:textSize="16sp"-->
<!-- android:layout_margin="10dp"-->
<!-- android:layout_below="@id/rvCart"-->
<!-- android:layout_alignParentBottom="true"-->
<!-- android:layout_alignWithParentIfMissing="true"/>-->
<com.google.android.material.button.MaterialButton
android:id=
"@+id/btCheckout"
android:layout_width=
"match_parent"
...
...
@@ -56,4 +34,4 @@
android:textColor=
"@android:color/white"
android:textStyle=
"bold"
/>
</RelativeLayout>
\ No newline at end of file
</RelativeLayout>
app/src/main/res/layout/activity_history.xml
0 → 100644
View file @
e5e292b8
<?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"
/>
<ScrollView
android:layout_width=
"match_parent"
android:layout_height=
"600dp"
android:layout_below=
"@+id/cAppBar"
>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rvHistory"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_below=
"@id/cAppBar"
tools:listitem=
"@layout/item_history"
/>
</ScrollView>
<com.google.android.material.button.MaterialButton
android:id=
"@+id/btShow"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"@string/title_next"
android:padding=
"15dp"
android:textSize=
"16sp"
android:layout_alignParentBottom=
"true"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
/>
</RelativeLayout>
\ No newline at end of file
app/src/main/res/layout/activity_invoice.xml
View file @
e5e292b8
...
...
@@ -48,7 +48,7 @@
android:id=
"@+id/btCheckout"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"@string/title_
checkout
"
android:text=
"@string/title_
success
"
android:padding=
"15dp"
android:textSize=
"16sp"
android:layout_margin=
"10dp"
...
...
app/src/main/res/layout/activity_main.xml
View file @
e5e292b8
...
...
@@ -37,6 +37,7 @@
>
<EditText
android:id=
"@+id/etSearchProduct"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:textColor=
"#fff"
...
...
app/src/main/res/layout/activity_payment.xml
View file @
e5e292b8
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout
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=
".PaymentActivity"
>
<include
android:id=
"@+id/appbar"
layout=
"@layout/app_bar"
...
...
@@ -14,109 +17,121 @@
app:layout_constraintEnd_toEndOf=
"parent"
/>
<com.google.android.material.card.MaterialCardView
android:id=
"@+id/cvInvoice"
<ScrollView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:padding=
"12dp"
android:layout_margin=
"16dp"
app:cardCornerRadius=
"20dp"
android:scrollbars=
"vertical"
app:layout_constraintTop_toBottomOf=
"@+id/appbar"
tools:ignore=
"MissingConstraints"
>
android:layout_height=
"600dp"
android:layout_marginBottom=
"5dp"
app:layout_constraintBottom_toTopOf=
"@id/btnPay"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintHorizontal_bias=
"0.0"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/appbar"
app:layout_constraintVertical_bias=
"0.181"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:layout_height=
"300dp"
>
android:layout_height=
"match_parent"
>
<com.google.android.material.card.MaterialCardView
android:id=
"@+id/cvInvoice"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_marginTop=
"10dp"
android:layout_marginBottom=
"10dp"
android:padding=
"18dp"
android:scrollbars=
"vertical"
app:cardCornerRadius=
"3dp"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintBottom_toTopOf=
"@id/btnPay"
tools:ignore=
"MissingConstraints,NotSibling"
>
<com.google.android.material.textview.MaterialTextView
android:id=
"@+id/tvBilling"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"16dp"
android:fontFamily=
"@font/roboto"
android:textAlignment=
"center"
android:textSize=
"24sp"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
tools:text=
"@string/hint_billing"
/>
<ImageView
android:id=
"@+id/image_splash"
android:layout_width=
"50dp"
android:layout_height=
"50dp"
android:src=
"@drawable/bill"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/tvBilling"
/>
<com.google.android.material.textview.MaterialTextView
android:id=
"@+id/tvBillingProduct"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"16dp"
android:fontFamily=
"@font/roboto"
android:textAlignment=
"center"
android:textSize=
"14sp"
app:layout_constraintTop_toBottomOf=
"@+id/image_splash"
tools:text=
"@string/hint_product_name"
/>
<com.google.android.material.textview.MaterialTextView
android:id=
"@+id/tvBillingPrice"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"16dp"
android:fontFamily=
"@font/roboto"
android:textAlignment=
"center"
android:textSize=
"14sp"
app:layout_constraintTop_toBottomOf=
"@+id/tvBillingProduct"
tools:text=
"@string/hint_price"
/>
<com.google.android.material.textview.MaterialTextView
android:id=
"@+id/tvBillingQuantity"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"16dp"
android:fontFamily=
"@font/roboto"
android:textAlignment=
"center"
android:textSize=
"14sp"
app:layout_constraintTop_toBottomOf=
"@+id/tvBillingPrice"
tools:text=
"@string/hint_quantity"
/>
<com.google.android.material.textview.MaterialTextView
android:id=
"@+id/tvBillingCategory"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"16dp"
android:fontFamily=
"@font/roboto"
android:textAlignment=
"center"
android:textSize=
"14sp"
app:layout_constraintTop_toBottomOf=
"@+id/tvBillingQuantity"
tools:text=
"@string/hint_category"
/>
<com.google.android.material.textview.MaterialTextView
android:id=
"@+id/tvBillingDesc"
android:layout_width=
"wrap_content"
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:padding=
"10dp"
>
<com.google.android.material.textview.MaterialTextView
android:id=
"@+id/tvBilling"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:fontFamily=
"@font/roboto"
android:text=
"Billing "
android:textAlignment=
"center"
android:textSize=
"24sp"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintHorizontal_bias=
"0.099"
app:layout_constraintStart_toStartOf=
"parent"
tools:layout_editor_absoluteY=
"-4dp"
/>
<ImageView
android:id=
"@+id/image_splash"
android:layout_width=
"50dp"
android:layout_height=
"50dp"
android:layout_marginTop=
"8dp"
android:src=
"@drawable/bill"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintHorizontal_bias=
"0.13"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/tvBilling"
/>
<TextView
android:id=
"@+id/grand_total"
android:layout_width=
"300dp"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"24dp"
android:text=
""
android:textColor=
"@android:color/black"
android:textSize=
"30sp"
android:textAlignment=
"textEnd"
app:layout_constraintBottom_toBottomOf=
"@id/image_splash"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintHorizontal_bias=
"0.99"
app:layout_constraintStart_toEndOf=
"@id/image_splash"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintVertical_bias=
"0.568"
tools:text=
"@tools:sample/full_names"
/>
<TextView
android:id=
"@+id/title_item"
android:layout_width=
"200dp"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"10dp"
android:textColor=
"@android:color/black"
android:text=
"ITEM CHECKOUT"
android:textSize=
"20sp"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/image_splash"
tools:text=
"@tools:sample/full_names"
/>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rvItem"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_margin=
"0dp"
android:layout_marginTop=
"20dp"
app:layout_constraintTop_toBottomOf=
"@id/title_item"
tools:layout_editor_absoluteX=
"10dp"
tools:listitem=
"@layout/item_checkout"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rvPayment"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"16dp"
android:fontFamily=
"@font/roboto"
android:textAlignment=
"center"
android:textSize=
"14sp"
app:layout_constraintTop_toBottomOf=
"@+id/tvBillingCategory"
tools:text=
"@string/hint_description"
/>
android:layout_margin=
"10dp"
android:layout_marginTop=
"10dp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/cvInvoice"
tools:layout_editor_absoluteX=
"10dp"
tools:listitem=
"@layout/payment_list"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rvPayment"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:overScrollMode=
"never"
app:layout_constraintTop_toBottomOf=
"@id/cvInvoice"
/>
</ScrollView>
<com.google.android.material.button.MaterialButton
android:id=
"@+id/btnPay"
...
...
@@ -127,8 +142,9 @@
android:textSize=
"16sp"
android:enabled=
"false"
android:layout_margin=
"10dp"
android:layout_alignParentBottom=
"true"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
</androidx.constraintlayout.widget.ConstraintLayout>
app/src/main/res/layout/item_checkout.xml
0 → 100644
View file @
e5e292b8
<?xml version="1.0" encoding="utf-8"?>
<layout
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"
>
<data>
<variable
name=
"checkout"
type=
"com.yono.messeripos.models.ProductCartModels"
/>
<variable
name=
"subtotal"
type=
"String"
/>
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
<com.google.android.material.card.MaterialCardView
android:layout_width=
"match_parent"
android:layout_height=
"60dp"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_margin=
"10dp"
>
<TextView
android:id=
"@+id/itemCheckout"
android:layout_width=
"200dp"
android:layout_height=
"wrap_content"
tools:text=
"@tools:sample/full_names"
android:textSize=
"20sp"
android:lines=
"3"
android:text=
"@{checkout.product_name_orders+` x `+checkout.quantity_orders}"
android:layout_margin=
"10dp"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
<TextView
android:id=
"@+id/itemSubTotal"
android:layout_width=
"200dp"
android:layout_height=
"wrap_content"
tools:text=
"@tools:sample/full_names"
android:textSize=
"20sp"
android:text=
"@{subtotal}"
android:textColor=
"@android:color/black"
android:layout_margin=
"10dp"
app:layout_constraintStart_toEndOf=
"@id/itemCheckout"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
android:textAlignment=
"textEnd"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
\ No newline at end of file
app/src/main/res/layout/item_history.xml
0 → 100644
View file @
e5e292b8
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
>
<data>
<variable
name=
"transaction"
type=
"com.yono.messeripos.models.PaymentsModels"
/>
<variable
name=
"date"
type=
"String"
/>
</data>
<com.google.android.material.card.MaterialCardView
android:id=
"@+id/cvHistory"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
tools:ignore=
"MissingConstraints"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_margin=
"12dp"
>
<com.google.android.material.textview.MaterialTextView
android:id=
"@+id/tvPay"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:fontFamily=
"@font/roboto"
android:textSize=
"24sp"
app:layout_constraintStart_toStartOf=
"parent"
android:textColor=
"@android:color/black"
android:textStyle=
"bold"
android:textAllCaps=
"true"
tools:text=
"@string/hint_pay"
android:text=
"@{transaction.paymentType}"
app:layout_constraintTop_toTopOf=
"parent"
/>
<com.google.android.material.textview.MaterialTextView
android:id=
"@+id/tvDate"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:fontFamily=
"@font/roboto"
android:textSize=
"16sp"
tools:text=
"@tools:sample/date/ddmmyy"
android:text=
"@{date}"
app:layout_constraintStart_toStartOf=
"@id/tvPay"
app:layout_constraintTop_toBottomOf=
"@+id/tvPay"
/>
<com.google.android.material.textview.MaterialTextView
android:id=
"@+id/tvOrder"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:fontFamily=
"@font/roboto"
android:textSize=
"16sp"
android:text=
"@{transaction.orderId}"
tools:text=
"#6821739123"
app:layout_constraintStart_toStartOf=
"@id/tvDate"
app:layout_constraintTop_toBottomOf=
"@+id/tvDate"
/>
<com.google.android.material.textview.MaterialTextView
android:id=
"@+id/tvHistory"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"84dp"
android:backgroundTint=
"#8555DA"
android:text=
"@{transaction.transactionStatus}"
tools:text=
"@tools:sample/first_names"
android:textColor=
"#fff"
android:background=
"#C60000"
app:layout_constraintEnd_toEndOf=
"parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>
</layout>
\ No newline at end of file
app/src/main/res/menu/home.xml
View file @
e5e292b8
...
...
@@ -20,4 +20,10 @@
android:title=
"Create Product"
app:showAsAction=
"never"
/>
<item
android:id=
"@+id/allTransaction"
android:orderInCategory=
"100"
android:title=
"All Transaction"
app:showAsAction=
"never"
/>
</menu>
\ No newline at end of file
app/src/main/res/values/strings.xml
View file @
e5e292b8
...
...
@@ -23,6 +23,9 @@
<string
name=
"stock"
>
Stock
</string>
<string
name=
"add"
>
Add
</string>
<string
name=
"hint_billing"
>
Billing
</string>
<string
name=
"title_success"
>
Success
</string>
<string
name=
"hint_pay"
>
cash
</string>
<string
name=
"title_next"
>
next
</string>
<string-array
name=
"planets_array"
>
<item>
Mercury
</item>
...
...
app/src/main/res/values/styles.xml
View file @
e5e292b8
...
...
@@ -6,7 +6,6 @@
<item
name=
"colorPrimaryDark"
>
@color/colorPrimaryDark
</item>
<item
name=
"colorAccent"
>
@color/colorAccent
</item>
<item
name=
"android:fontFamily"
>
@font/roboto
</item>
<item
name=
"android:windowLightStatusBar"
>
false
</item>
<item
name=
"android:actionBarStyle"
>
@style/ThemeActionBar
</item>
<item
name=
"android:windowActionBarOverlay"
>
false
</item>
<item
name=
"android:windowTranslucentStatus"
>
true
</item>
...
...
@@ -18,12 +17,12 @@
<item
name=
"colorPrimary"
>
@color/colorPrimary
</item>
<item
name=
"colorPrimaryDark"
>
@color/colorPrimaryDark
</item>
<item
name=
"colorAccent"
>
@color/colorAccent
</item>
<item
name=
"android:windowLightStatusBar"
>
false
</item>
<item
name=
"android:actionBarStyle"
>
@style/ThemeActionBar
</item>
<item
name=
"android:windowActionBarOverlay"
>
false
</item>
<item
name=
"android:windowTranslucentStatus"
>
true
</item>
<item
name=
"android:windowTranslucentNavigation"
>
true
</item>
<item
name=
"windowActionBarOverlay"
>
true
</item>
<item
name=
"android:fontFamily"
>
@font/poppins_medium
</item>
<item
name=
"actionBarStyle"
>
@style/ThemeActionBar
</item>
</style>
...
...
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