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
53a6ba2d
Commit
53a6ba2d
authored
Aug 30, 2020
by
Muhammad Suryono
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update di pembayaran
parent
f2818dac
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
434 additions
and
238 deletions
+434
-238
build.gradle
app/build.gradle
+2
-0
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+4
-1
BottomSheets.java
app/src/main/java/com/yono/messeripos/BottomSheets.java
+35
-1
FormCategory.java
app/src/main/java/com/yono/messeripos/FormCategory.java
+26
-0
FormProductActivity.java
...rc/main/java/com/yono/messeripos/FormProductActivity.java
+8
-5
MainActivity.java
app/src/main/java/com/yono/messeripos/MainActivity.java
+17
-2
PaymentActivity.java
app/src/main/java/com/yono/messeripos/PaymentActivity.java
+74
-37
QRCode.java
app/src/main/java/com/yono/messeripos/QRCode.java
+4
-2
CategoryAdapter.java
...ain/java/com/yono/messeripos/adapter/CategoryAdapter.java
+2
-0
ProductAdapter.java
...main/java/com/yono/messeripos/adapter/ProductAdapter.java
+2
-0
bg_grid_item.xml
app/src/main/res/drawable/bg_grid_item.xml
+10
-0
round_corner_sheet.xml
app/src/main/res/drawable/round_corner_sheet.xml
+9
-0
activity_bottom_sheets.xml
app/src/main/res/layout/activity_bottom_sheets.xml
+11
-0
activity_invoice.xml
app/src/main/res/layout/activity_invoice.xml
+58
-46
activity_payment.xml
app/src/main/res/layout/activity_payment.xml
+72
-127
activity_q_r_code.xml
app/src/main/res/layout/activity_q_r_code.xml
+8
-2
form_category.xml
app/src/main/res/layout/form_category.xml
+39
-0
form_product.xml
app/src/main/res/layout/form_product.xml
+1
-1
item_checkout.xml
app/src/main/res/layout/item_checkout.xml
+1
-1
item_list.xml
app/src/main/res/layout/item_list.xml
+16
-13
skeleton_category.xml
app/src/main/res/layout/skeleton_category.xml
+29
-0
colors.xml
app/src/main/res/values/colors.xml
+2
-0
strings.xml
app/src/main/res/values/strings.xml
+1
-0
styles.xml
app/src/main/res/values/styles.xml
+3
-0
No files found.
app/build.gradle
View file @
53a6ba2d
...
...
@@ -46,6 +46,8 @@ dependencies {
implementation
'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation
'com.github.bumptech.glide:glide:4.3.1'
implementation
'com.squareup.okhttp3:logging-interceptor:4.2.1'
implementation
'com.ethanhua:skeleton:1.1.2'
implementation
'io.supercharge:shimmerlayout:2.1.0'
implementation
project
(
':library'
)
def
room_version
=
"2.2.5"
...
...
app/src/main/AndroidManifest.xml
View file @
53a6ba2d
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
package=
"com.yono.messeripos"
>
<uses-permission
android:name=
"android.permission.INTERNET"
/>
...
...
@@ -17,7 +18,9 @@
android:roundIcon=
"@mipmap/ic_launcher_new_icon"
android:supportsRtl=
"true"
android:theme=
"@style/AppTheme.appbar"
>
<activity
android:name=
".BottomSheets"
></activity>
<activity
android:name=
".BottomSheets"
tools:ignore=
"Instantiatable"
/>
<activity
android:name=
".QRCode"
/>
<activity
android:name=
".HistoryActivity"
...
...
app/src/main/java/com/yono/messeripos/BottomSheets.java
View file @
53a6ba2d
...
...
@@ -13,11 +13,14 @@ import android.view.View;
import
android.view.ViewGroup
;
import
android.widget.Button
;
import
android.widget.EditText
;
import
android.widget.RelativeLayout
;
import
android.widget.TextView
;
import
androidx.annotation.NonNull
;
import
androidx.annotation.Nullable
;
import
androidx.lifecycle.ViewModelProvider
;
import
com.google.android.material.bottomsheet.BottomSheetBehavior
;
import
com.google.android.material.bottomsheet.BottomSheetDialogFragment
;
import
com.yono.messeripos.adapter.ProductAdapter
;
import
com.yono.messeripos.api.client.Client
;
...
...
@@ -45,6 +48,8 @@ public class BottomSheets extends BottomSheetDialogFragment {
Client
client
=
new
Client
();
public
static
long
grossAmount
;
SharedPreferences
sharedPreferences
;
BottomSheetBehavior
bottomSheetBehavior
;
RelativeLayout
layoutFormCash
;
PaymentsModels
paymentsModels
;
public
BottomSheets
(
PaymentsModels
paymentsModels
)
{
...
...
@@ -68,19 +73,48 @@ public class BottomSheets extends BottomSheetDialogFragment {
View
v
=
inflater
.
inflate
(
R
.
layout
.
activity_bottom_sheets
,
container
,
false
);
layoutFormCash
=
v
.
findViewById
(
R
.
id
.
form_cash
);
inputAmount
=
v
.
findViewById
(
R
.
id
.
etBayar
);
hargaChange
=
v
.
findViewById
(
R
.
id
.
hargaChange
);
btnCash
=
v
.
findViewById
(
R
.
id
.
btnCash
);
totalHarga
=
v
.
findViewById
(
R
.
id
.
totalHarga
);
utils
=
new
Utils
();
bottomSheetBehavior
=
BottomSheetBehavior
.
from
(
layoutFormCash
);
// sharedPreferences = getActivity().getSharedPreferences(MainActivity.ORDER_ID, Context.MODE_PRIVATE);
bottomSheetBehavior
.
setState
(
BottomSheetBehavior
.
STATE_COLLAPSED
);
long
ga
=
paymentsModels
.
getGrossAmount
();
String
setCurrency
=
utils
.
convertPrice
(
"Rp."
,
ga
);
totalHarga
.
setText
(
setCurrency
);
hargaChange
.
setText
(
defaultText
);
bottomSheetBehavior
.
setBottomSheetCallback
(
new
BottomSheetBehavior
.
BottomSheetCallback
()
{
@Override
public
void
onStateChanged
(
@NonNull
View
bottomSheet
,
int
newState
)
{
switch
(
newState
)
{
case
BottomSheetBehavior
.
STATE_HIDDEN
:
break
;
case
BottomSheetBehavior
.
STATE_EXPANDED
:
break
;
case
BottomSheetBehavior
.
STATE_COLLAPSED
:
break
;
case
BottomSheetBehavior
.
STATE_DRAGGING
:
break
;
case
BottomSheetBehavior
.
STATE_SETTLING
:
break
;
}
}
@Override
public
void
onSlide
(
@NonNull
View
bottomSheet
,
float
slideOffset
)
{
if
(
bottomSheetBehavior
.
getState
()
!=
BottomSheetBehavior
.
STATE_EXPANDED
)
{
bottomSheetBehavior
.
setState
(
BottomSheetBehavior
.
STATE_EXPANDED
);
}
else
{
bottomSheetBehavior
.
setState
(
BottomSheetBehavior
.
STATE_COLLAPSED
);
}
}
});
inputAmount
.
addTextChangedListener
(
new
TextWatcher
()
{
@Override
public
void
beforeTextChanged
(
CharSequence
charSequence
,
int
i
,
int
i1
,
int
i2
)
{
...
...
app/src/main/java/com/yono/messeripos/FormCategory.java
0 → 100644
View file @
53a6ba2d
package
com
.
yono
.
messeripos
;
import
android.os.Bundle
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
androidx.annotation.NonNull
;
import
androidx.annotation.Nullable
;
import
com.google.android.material.bottomsheet.BottomSheetDialogFragment
;
public
class
FormCategory
extends
BottomSheetDialogFragment
{
public
FormCategory
()
{
}
@Nullable
@Override
public
View
onCreateView
(
@NonNull
LayoutInflater
inflater
,
@Nullable
ViewGroup
container
,
@Nullable
Bundle
savedInstanceState
)
{
View
v
=
inflater
.
inflate
(
R
.
layout
.
form_category
,
container
,
false
);
return
v
;
}
}
app/src/main/java/com/yono/messeripos/FormProductActivity.java
View file @
53a6ba2d
...
...
@@ -8,14 +8,11 @@ import android.content.CursorLoader;
import
android.content.DialogInterface
;
import
android.content.Intent
;
import
android.database.Cursor
;
import
android.graphics.Bitmap
;
import
android.graphics.BitmapFactory
;
import
android.net.Uri
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.os.Environment
;
import
android.provider.MediaStore
;
import
android.util.Base64
;
import
android.util.Log
;
import
android.view.Window
;
import
android.view.WindowManager
;
...
...
@@ -31,6 +28,7 @@ import androidx.lifecycle.Observer;
import
androidx.lifecycle.ViewModelProviders
;
import
com.google.android.material.appbar.MaterialToolbar
;
import
com.google.android.material.bottomsheet.BottomSheetDialogFragment
;
import
com.jaredrummler.materialspinner.MaterialSpinner
;
import
com.yono.messeripos.api.client.Client
;
import
com.yono.messeripos.api.service.ProductService
;
...
...
@@ -41,7 +39,6 @@ import com.yono.messeripos.models.ProductModels;
import
com.yono.messeripos.response.DataResponse
;
import
com.yono.messeripos.utils.Utils
;
import
java.io.ByteArrayOutputStream
;
import
java.io.File
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
...
...
@@ -80,7 +77,6 @@ public class FormProductActivity extends AppCompatActivity {
binding
.
btnAdd
.
setText
(
"Add New Product"
);
productModels
=
new
ProductModels
();
requestPermissions
(
permissions
,
REQUEST_PERMISSIONS
);
mainViewModels
=
ViewModelProviders
.
of
(
this
).
get
(
MainViewModels
.
class
);
progressDialog
=
new
ProgressDialog
(
FormProductActivity
.
this
);
progressDialog
.
setMessage
(
"Loading..."
);
...
...
@@ -128,7 +124,13 @@ public class FormProductActivity extends AppCompatActivity {
categoryModels
.
add
(
"SELECT CATEGORY"
);
setSpinner
();
setSelectedSpinner
();
addCategory
();
}
private
void
addCategory
()
{
FormCategory
formCategory
=
new
FormCategory
();
formCategory
.
show
(
getSupportFragmentManager
(),
"ModalFormCategory"
);
}
private
void
setSelectedSpinner
()
{
...
...
@@ -270,6 +272,7 @@ public class FormProductActivity extends AppCompatActivity {
}
private
void
openFile
(){
requestPermissions
(
permissions
,
REQUEST_PERMISSIONS
);
Intent
i
=
new
Intent
(
Intent
.
ACTION_PICK
,
MediaStore
.
Images
.
Media
.
EXTERNAL_CONTENT_URI
);
startActivityForResult
(
i
,
100
);
...
...
app/src/main/java/com/yono/messeripos/MainActivity.java
View file @
53a6ba2d
...
...
@@ -29,7 +29,11 @@ import androidx.lifecycle.ViewModelProvider;
import
androidx.lifecycle.ViewModelProviders
;
import
androidx.recyclerview.widget.GridLayoutManager
;
import
androidx.recyclerview.widget.LinearLayoutManager
;
import
androidx.recyclerview.widget.RecyclerView
;
import
com.ethanhua.skeleton.RecyclerViewSkeletonScreen
;
import
com.ethanhua.skeleton.Skeleton
;
import
com.ethanhua.skeleton.SkeletonScreen
;
import
com.google.android.material.appbar.MaterialToolbar
;
import
com.google.android.material.button.MaterialButton
;
import
com.google.android.material.snackbar.Snackbar
;
...
...
@@ -76,6 +80,9 @@ public class MainActivity extends AppCompatActivity {
public
static
final
String
MY_SHARED_PREFERENCES
=
"my_shared_preferences"
;
ProgressDialog
progressDialog
;
MaterialButton
btnAddCart
;
SkeletonScreen
skeletonCategory
;
@SuppressLint
(
"LongLogTag"
)
@Override
...
...
@@ -89,6 +96,8 @@ public class MainActivity extends AppCompatActivity {
showLoading
(
true
);
btnAddCart
=
findViewById
(
R
.
id
.
materialBtnAddCart
);
binding
.
tvCategory
.
setVisibility
(
View
.
GONE
);
binding
.
tvProduct
.
setVisibility
(
View
.
GONE
);
categoryAdapter
=
new
CategoryAdapter
();
productAdapter
=
new
ProductAdapter
();
...
...
@@ -102,7 +111,6 @@ public class MainActivity extends AppCompatActivity {
toolbar
=
findViewById
(
R
.
id
.
topAppBar
);
mainViewModels
=
ViewModelProviders
.
of
(
this
).
get
(
MainViewModels
.
class
);
if
(
orderId
.
isEmpty
())
{
SharedPreferences
.
Editor
editor
=
sharedPreferences
.
edit
();
...
...
@@ -141,6 +149,7 @@ public class MainActivity extends AppCompatActivity {
}
else
if
(
id
==
R
.
id
.
update
){
status_update
=
true
;
// binding.topAppBar.setVisibility(View.GONE);
binding
.
tvCategory
.
setVisibility
(
View
.
GONE
);
binding
.
rvCategory
.
setVisibility
(
View
.
GONE
);
// binding.appBarUpdate.setVisibility(View.VISIBLE);
...
...
@@ -177,8 +186,14 @@ public class MainActivity extends AppCompatActivity {
categoryModels
.
add
(
0
,
caModels
);
categoryModelsArrayList
.
addAll
(
categoryModels
);
binding
.
tvCategory
.
setVisibility
(
View
.
VISIBLE
);
binding
.
tvProduct
.
setVisibility
(
View
.
VISIBLE
);
categoryAdapter
.
setCategoriAdapter
(
MainActivity
.
this
,
categoryModelsArrayList
);
binding
.
rvCategory
.
setLayoutManager
(
new
LinearLayoutManager
(
MainActivity
.
this
,
LinearLayoutManager
.
HORIZONTAL
,
false
));
binding
.
rvCategory
.
setLayoutManager
(
new
LinearLayoutManager
(
MainActivity
.
this
,
RecyclerView
.
HORIZONTAL
,
false
));
binding
.
rvCategory
.
setAdapter
(
categoryAdapter
);
}
...
...
app/src/main/java/com/yono/messeripos/PaymentActivity.java
View file @
53a6ba2d
package
com
.
yono
.
messeripos
;
import
androidx.annotation.NonNull
;
import
androidx.appcompat.app.AppCompatActivity
;
import
androidx.lifecycle.Observer
;
import
androidx.lifecycle.ViewModelProvider
;
...
...
@@ -19,10 +20,12 @@ import android.view.View;
import
android.view.Window
;
import
android.view.WindowManager
;
import
android.widget.Button
;
import
android.widget.RelativeLayout
;
import
android.widget.TextView
;
import
android.widget.Toast
;
import
com.google.android.material.appbar.MaterialToolbar
;
import
com.google.android.material.bottomsheet.BottomSheetBehavior
;
import
com.google.gson.Gson
;
import
com.yono.messeripos.adapter.CheckoutAdapter
;
import
com.yono.messeripos.adapter.PaymentAdapter
;
...
...
@@ -64,6 +67,8 @@ public class PaymentActivity extends AppCompatActivity {
public
static
SharedPreferences
sharedPreferences
;
Button
cashBtn
;
ProgressDialog
progressDialog
;
BottomSheetBehavior
bottomSheetBank
;
RelativeLayout
qrcodeLayoutBank
;
...
...
@@ -83,6 +88,8 @@ public class PaymentActivity extends AppCompatActivity {
checkoutAdapter
=
new
CheckoutAdapter
();
recyclerView
=
findViewById
(
R
.
id
.
rvItem
);
grandTotal
=
findViewById
(
R
.
id
.
grand_total
);
qrcodeLayoutBank
=
findViewById
(
R
.
id
.
qrCodeForm
);
bottomSheetBank
=
BottomSheetBehavior
.
from
(
qrcodeLayoutBank
);
progressDialog
=
new
ProgressDialog
(
PaymentActivity
.
this
);
progressDialog
.
setMessage
(
"Loading..."
);
progressDialog
.
setCancelable
(
false
);
...
...
@@ -135,6 +142,35 @@ public class PaymentActivity extends AppCompatActivity {
btnPay
.
setEnabled
(
true
);
});
bottomSheetBank
.
setBottomSheetCallback
(
new
BottomSheetBehavior
.
BottomSheetCallback
()
{
@Override
public
void
onStateChanged
(
@NonNull
View
bottomSheet
,
int
newState
)
{
switch
(
newState
)
{
case
BottomSheetBehavior
.
STATE_HIDDEN
:
break
;
case
BottomSheetBehavior
.
STATE_EXPANDED
:
break
;
case
BottomSheetBehavior
.
STATE_COLLAPSED
:
break
;
case
BottomSheetBehavior
.
STATE_DRAGGING
:
break
;
case
BottomSheetBehavior
.
STATE_SETTLING
:
break
;
}
}
@Override
public
void
onSlide
(
@NonNull
View
bottomSheet
,
float
slideOffset
)
{
if
(
bottomSheetBank
.
getState
()
!=
BottomSheetBehavior
.
STATE_EXPANDED
)
{
bottomSheetBank
.
setState
(
BottomSheetBehavior
.
STATE_EXPANDED
);
}
else
{
bottomSheetBank
.
setState
(
BottomSheetBehavior
.
STATE_COLLAPSED
);
}
}
});
btnPay
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
...
...
@@ -146,43 +182,44 @@ public class PaymentActivity extends AppCompatActivity {
bottomSheet
.
show
(
getSupportFragmentManager
(),
"ModalBottomSheet"
);
}
else
{
progressDialog
.
show
();
Client
client
=
new
Client
();
paymentsModels
.
setPaymentType
(
"bank_transfer"
);
paymentsModels
.
setBank
(
methodPay
);
paymentsModels
.
setOrderId
(
orderId
);
Log
.
i
(
"BANK"
,
"onClick: "
+
utils
.
convertGson
(
paymentsModels
));
PaymentService
paymentService
=
client
.
Client
(
PaymentService
.
class
);
paymentService
.
postFromCart
(
paymentsModels
).
enqueue
(
new
Callback
<
DataResponse
<
PaymentsModels
>>()
{
@Override
public
void
onResponse
(
Call
<
DataResponse
<
PaymentsModels
>>
call
,
Response
<
DataResponse
<
PaymentsModels
>>
response
)
{
Log
.
i
(
"Paymen_bank"
,
"onResponse: "
+
utils
.
convertGson
(
response
.
body
()));
if
(
response
.
body
()
!=
null
){
SharedPreferences
.
Editor
editor
=
sharedPreferences
.
edit
();
editor
.
putString
(
ORDER_ID
,
""
);
editor
.
putBoolean
(
CHECKOUT
,
false
);
progressDialog
.
dismiss
();
if
(
editor
.
commit
()){
startActivity
(
new
Intent
(
PaymentActivity
.
this
,
MainActivity
.
class
));
finish
();
}
}
else
{
progressDialog
.
dismiss
();
new
AlertDialog
.
Builder
(
PaymentActivity
.
this
)
.
setTitle
(
"Payment Order"
)
.
setMessage
(
"Erorr save!"
).
show
();
}
}
@Override
public
void
onFailure
(
Call
<
DataResponse
<
PaymentsModels
>>
call
,
Throwable
t
)
{
progressDialog
.
dismiss
();
new
AlertDialog
.
Builder
(
PaymentActivity
.
this
)
.
setCancelable
(
false
)
.
setTitle
(
"Payment Order"
)
.
setMessage
(
"Add new payment failed, try again!"
).
show
();
}
});
bottomSheetBank
.
setState
(
BottomSheetBehavior
.
STATE_EXPANDED
);
// progressDialog.show();
// Client client = new Client();
// paymentsModels.setPaymentType("bank_transfer");
// paymentsModels.setBank(methodPay);
// paymentsModels.setOrderId(orderId);
// Log.i("BANK", "onClick: "+utils.convertGson(paymentsModels));
// PaymentService paymentService = client.Client(PaymentService.class);
// paymentService.postFromCart(paymentsModels).enqueue(new Callback<DataResponse<PaymentsModels>>() {
// @Override
// public void onResponse(Call<DataResponse<PaymentsModels>> call, Response<DataResponse<PaymentsModels>> response) {
// Log.i("Paymen_bank", "onResponse: "+utils.convertGson(response.body()));
// if (response.body() != null){
// SharedPreferences.Editor editor = sharedPreferences.edit();
// editor.putString(ORDER_ID, "");
// editor.putBoolean(CHECKOUT, false);
// progressDialog.dismiss();
// if (editor.commit()){
// startActivity(new Intent(PaymentActivity.this, MainActivity.class));
// finish();
// }
// }else{
// progressDialog.dismiss();
// new AlertDialog.Builder(PaymentActivity.this)
// .setTitle("Payment Order")
// .setMessage("Erorr save!").show();
// }
// }
//
// @Override
// public void onFailure(Call<DataResponse<PaymentsModels>> call, Throwable t) {
// progressDialog.dismiss();
// new AlertDialog.Builder(PaymentActivity.this)
// .setCancelable(false)
// .setTitle("Payment Order")
// .setMessage("Add new payment failed, try again!").show();
// }
// });
}
...
...
app/src/main/java/com/yono/messeripos/QRCode.java
View file @
53a6ba2d
...
...
@@ -32,7 +32,11 @@ public class QRCode extends AppCompatActivity {
qrCode
=
findViewById
(
R
.
id
.
qr_image
);
vaText
=
findViewById
(
R
.
id
.
etVA
);
generateQrCode
();
}
private
void
generateQrCode
()
{
WindowManager
manager
=
(
WindowManager
)
getSystemService
(
WINDOW_SERVICE
);
Display
display
=
manager
.
getDefaultDisplay
();
Point
point
=
new
Point
();
...
...
@@ -41,7 +45,6 @@ public class QRCode extends AppCompatActivity {
int
height
=
point
.
y
;
int
smallDimens
=
Math
.
min
(
width
,
height
);
smallDimens
=
smallDimens
*
3
/
4
;
qrgEncoder
=
new
QRGEncoder
(
"inputValue"
,
null
,
QRGContents
.
Type
.
TEXT
,
...
...
@@ -54,6 +57,5 @@ public class QRCode extends AppCompatActivity {
}
catch
(
Exception
e
)
{
Log
.
d
(
"onCreate: "
,
e
.
toString
());
}
}
}
\ No newline at end of file
app/src/main/java/com/yono/messeripos/adapter/CategoryAdapter.java
View file @
53a6ba2d
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
;
...
...
@@ -53,6 +54,7 @@ public class CategoryAdapter extends RecyclerView.Adapter<CategoryAdapter.MyView
@Override
public
void
onBindViewHolder
(
@NonNull
CategoryAdapter
.
MyViewHolder
holder
,
int
position
)
{
Log
.
i
(
"POSITION"
,
"onBindViewHolder: "
+
position
);
holder
.
binData
(
categoryModels
.
get
(
position
));
}
...
...
app/src/main/java/com/yono/messeripos/adapter/ProductAdapter.java
View file @
53a6ba2d
...
...
@@ -131,9 +131,11 @@ public class ProductAdapter extends RecyclerView.Adapter<ProductAdapter.MyViewHo
if
(!
MainActivity
.
status_update
)
{
binding
.
btnDelete
.
setVisibility
(
View
.
GONE
);
binding
.
btnEdit
.
setVisibility
(
View
.
GONE
);
binding
.
materialBtnAddCart
.
setVisibility
(
View
.
VISIBLE
);
}
else
{
binding
.
btnDelete
.
setVisibility
(
View
.
VISIBLE
);
binding
.
btnEdit
.
setVisibility
(
View
.
VISIBLE
);
binding
.
materialBtnAddCart
.
setVisibility
(
View
.
GONE
);
}
if
(
products
.
getStockProduct
()
==
0
)
{
...
...
app/src/main/res/drawable/bg_grid_item.xml
0 → 100644
View file @
53a6ba2d
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<solid
android:color=
"@android:color/transparent"
/>
<stroke
android:width=
"1px"
android:color=
"#d6d6d6"
/>
</shape>
\ No newline at end of file
app/src/main/res/drawable/round_corner_sheet.xml
0 → 100644
View file @
53a6ba2d
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item>
<shape>
<corners
android:topLeftRadius=
"30dp"
android:topRightRadius=
"30dp"
/>
</shape>
</item>
</selector>
\ No newline at end of file
app/src/main/res/layout/activity_bottom_sheets.xml
View file @
53a6ba2d
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
>
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:id=
"@+id/form_cash"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:gravity=
"center_horizontal"
android:orientation=
"vertical"
app:behavior_hideable=
"true"
app:behavior_peekHeight=
"56dp"
app:layout_behavior=
"com.google.android.material.bottomsheet.BottomSheetBehavior"
style=
"@style/AppModalStyle"
android:padding=
"16dp"
>
<TextView
...
...
@@ -71,6 +81,7 @@
android:layout_below=
"@id/etBayar"
/>
</RelativeLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
app/src/main/res/layout/activity_invoice.xml
View file @
53a6ba2d
<?xml version="1.0" encoding="utf-8"?>
<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"
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@color/ic_launcher_new_icon_background"
>
<com.google.android.material.textfield.TextInputLayout
android:id=
"@+id/tilInvoice"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
tools:ignore=
"MissingConstraints"
>
android:layout_height=
"wrap_content"
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"
>
<com.google.android.material.textview.MaterialTextView
android:id=
"@+id/tvProductName"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:fontFamily=
"@font/roboto"
android:textSize=
"24sp"
android:nestedScrollingEnabled=
"false"
android:text=
"Invoice"
app:layout_constraintStart_toStartOf=
"parent"
android:textColor=
"@color/colorWhite"
app:layout_constraintTop_toTopOf=
"parent"
/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.card.MaterialCardView
android:id=
"@+id/cvInvoice"
android:layout_width=
"match_parent"
android:layout_height=
"
wrap_cont
ent"
android:
padding=
"12s
p"
a
pp:cardCornerRadius=
"2
0dp"
android:
nestedScrollingEnabled=
"false
"
a
pp:layout_constraintTop_toBottomOf=
"@+id/tilInvoice
"
tools:ignore=
"MissingConstraints
"
>
android:layout_height=
"
match_par
ent"
android:
layout_marginTop=
"10d
p"
a
ndroid:layout_marginBottom=
"1
0dp"
android:
padding=
"18dp
"
a
ndroid:scrollbars=
"vertical
"
app:cardCornerRadius=
"3dp
"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:layout_height=
"
600dp
"
>
android:layout_height=
"
wrap_content
"
android:padding=
"10dp"
>
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>
<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_constraintStart_toStartOf=
"@id/image_splash"
app:layout_constraintTop_toTopOf=
"parent"
/>
<com.google.android.material.button.MaterialButton
android:id=
"@+id/btCheckout"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"@string/title_success"
android:padding=
"15dp"
android:textSize=
"16sp"
android:layout_margin=
"10dp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
/>
<ImageView
android:id=
"@+id/image_splash"
android:layout_width=
"50dp"
android:layout_height=
"50dp"
android:layout_marginTop=
"8dp"
android:src=
"@drawable/bill"
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"
tools:text=
"@tools:sample/full_names"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"@id/image_splash"
/>
<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.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
app/src/main/res/layout/activity_payment.xml
View file @
53a6ba2d
<?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"
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
tools:context=
".PaymentActivity"
>
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
>
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
tools:context=
".PaymentActivity"
>
<include
android:id=
"@+id/appbar"
layout=
"@layout/app_bar"
android:layout_above=
"@id/cvInvoice"
/>
<include
android:id=
"@+id/appbar"
layout=
"@layout/app_bar"
/>
<com.google.android.material.card.MaterialCardView
<include
android:layout_below=
"@id/appbar"
layout=
"@layout/activity_invoice"
android:id=
"@+id/cvInvoice"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"10dp"
android:layout_marginBottom=
"10dp"
android:padding=
"18dp"
android:scrollbars=
"vertical"
app:cardCornerRadius=
"3dp"
android:layout_below=
"@id/appbar"
>
android:layout_width=
"match_parent"
/>
<androidx.constraintlayout.widget.ConstraintLayout
<ScrollView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_below=
"@id/cvInvoice"
android:layout_above=
"@id/btnPay"
>
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:padding=
"10dp"
>
android:layout_height=
"wrap_content"
>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rvItem"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_margin=
"0dp"
android:nestedScrollingEnabled=
"false"
android:layout_marginTop=
"20dp"
tools:layout_editor_absoluteX=
"10dp"
tools:listitem=
"@layout/item_checkout"
/>
<com.google.android.material.textview.MaterialTextView
android:id=
"@+id/tv
Billing
"
android:layout_width=
"
wrap_cont
ent"
android:id=
"@+id/tv
Label
"
android:layout_width=
"
match_par
ent"
android:layout_height=
"wrap_content"
android:fontFamily=
"@font/roboto"
android:text=
"Billing "
android:textAlignment=
"center"
android:text=
"Payment"
android:textSize=
"24sp"
app:layout_constraintStart_toStartOf=
"@id/image_splash"
app:layout_constraintTop_toTopOf=
"parent"
/>
<ImageView
android:id=
"@+id/image_splash"
android:layout_width=
"50dp"
android:layout_height=
"50dp"
android:layout_marginTop=
"8dp"
android:src=
"@drawable/bill"
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"
tools:text=
"@tools:sample/full_names"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"@id/image_splash"
/>
<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.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>
<ScrollView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_below=
"@id/cvInvoice"
android:layout_above=
"@id/btnPay"
>
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rvItem"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_margin=
"0dp"
android:nestedScrollingEnabled=
"false"
android:layout_marginTop=
"20dp"
tools:layout_editor_absoluteX=
"10dp"
tools:listitem=
"@layout/item_checkout"
/>
<com.google.android.material.textview.MaterialTextView
android:id=
"@+id/tvLabel"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"Payment"
android:textSize=
"24sp"
android:textFontWeight=
"600"
android:textStyle=
"bold"
android:textColor=
"#202020"
android:layout_marginTop=
"20dp"
android:layout_marginBottom=
"0dp"
android:layout_marginStart=
"10dp"
android:layout_below=
"@id/rvItem"
/>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rvPayment"
android:layout_width=
"match_parent"
android:textFontWeight=
"600"
android:textStyle=
"bold"
android:textColor=
"#202020"
android:layout_marginTop=
"20dp"
android:layout_marginBottom=
"0dp"
android:layout_marginStart=
"10dp"
android:layout_below=
"@id/rvItem"
/>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rvPayment"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_margin=
"10dp"
android:nestedScrollingEnabled=
"false"
tools:layout_editor_absoluteX=
"10dp"
tools:listitem=
"@layout/payment_list"
android:layout_below=
"@id/tvLabel"
/>
</RelativeLayout>
</ScrollView>
<com.google.android.material.button.MaterialButton
android:id=
"@+id/btnPay"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:text=
"pay"
android:padding=
"15dp"
android:textSize=
"16sp"
android:enabled=
"false"
android:layout_margin=
"10dp"
android:nestedScrollingEnabled=
"false"
tools:layout_editor_absoluteX=
"10dp"
tools:listitem=
"@layout/payment_list"
android:layout_below=
"@id/tvLabel"
/>
</RelativeLayout>
</ScrollView>
android:layout_alignParentBottom=
"true"
android:layout_alignParentEnd=
"true"
android:layout_alignParentStart=
"true"
/>
<com.google.android.material.button.MaterialButton
android:id=
"@+id/btnPay"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:text=
"pay"
android:padding=
"15dp"
android:textSize=
"16sp"
android:enabled=
"false"
android:layout_margin=
"10dp"
android:layout_alignParentBottom=
"true"
android:layout_alignParentEnd=
"true"
android:layout_alignParentStart=
"true"
/>
</RelativeLayout>
</RelativeLayout>
<include
layout=
"@layout/activity_q_r_code"
/>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
app/src/main/res/layout/activity_q_r_code.xml
View file @
53a6ba2d
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
<RelativeLayout
android:id=
"@+id/qrCodeForm"
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"
android:layout_height=
"380dp"
app:behavior_hideable=
"true"
app:behavior_peekHeight=
"56dp"
android:background=
"#efefef"
app:layout_behavior=
"com.google.android.material.bottomsheet.BottomSheetBehavior"
tools:context=
".QRCode"
>
<ImageView
...
...
app/src/main/res/layout/form_category.xml
0 → 100644
View file @
53a6ba2d
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:gravity=
"center_horizontal"
android:orientation=
"vertical"
android:padding=
"16dp"
>
<TextView
android:id=
"@+id/tvAddCategory"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Category Name"
android:textSize=
"20sp"
android:textFontWeight=
"600"
android:layout_alignParentStart=
"true"
/>
<EditText
android:id=
"@+id/etBayar"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_below=
"@id/tvAddCategory"
android:hint=
"Category Name"
android:inputType=
"number"
android:imeOptions=
"actionDone"
/>
<Button
android:id=
"@+id/btnCash"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"@string/text_new_category"
android:hint=
"Insert Money"
android:layout_below=
"@id/etBayar"
/>
</RelativeLayout>
app/src/main/res/layout/form_product.xml
View file @
53a6ba2d
...
...
@@ -139,7 +139,7 @@
android:foregroundGravity=
"bottom"
android:text=
"@string/add"
android:padding=
"14dp"
android:backgroundTint=
"@color/colorAccent
Dark
"
android:backgroundTint=
"@color/colorAccent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"@id/listCategory"
app:layout_constraintBottom_toBottomOf=
"@id/listCategory"
...
...
app/src/main/res/layout/item_checkout.xml
View file @
53a6ba2d
...
...
@@ -37,7 +37,7 @@
tools:text=
"@tools:sample/full_names"
android:textSize=
"20sp"
android:lines=
"3"
android:text=
"@{checkout.product_name_orders+` x `+checkout.quantity_orders}"
android:text=
"@{checkout.product_name_orders
.toUpperCase()
+` x `+checkout.quantity_orders}"
android:layout_margin=
"10dp"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
...
...
app/src/main/res/layout/item_list.xml
View file @
53a6ba2d
...
...
@@ -28,6 +28,7 @@
android:layout_marginVertical=
"10dp"
>
<com.google.android.material.card.MaterialCardView
android:id=
"@+id/cvProduct"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
app:cardElevation=
"0dp"
...
...
@@ -48,23 +49,25 @@
app:url=
"@{image}"
android:scaleType=
"fitXY"
/>
<
ImageView
<
com.google.android.material.button.MaterialButton
android:id=
"@+id/btnDelete"
android:layout_width=
"
30dp
"
android:layout_height=
"
3
0dp"
android:layout_width=
"
wrap_content
"
android:layout_height=
"
4
0dp"
android:layout_margin=
"10dp"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
android:src=
"@drawable/ic_baseline_delete_24"
/>
android:backgroundTint=
"@color/colorRed"
android:text=
"Delete"
app:layout_constraintBottom_toBottomOf=
"@id/image_product"
app:layout_constraintEnd_toEndOf=
"parent"
/>
<
ImageView
<
com.google.android.material.button.MaterialButton
android:id=
"@+id/btnEdit"
android:layout_width=
"30dp"
android:layout_height=
"30dp"
android:layout_margin=
"10dp"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
android:src=
"@drawable/ic_baseline_edit_24"
/>
android:layout_width=
"wrap_content"
android:layout_height=
"40dp"
android:layout_marginEnd=
"10dp"
app:layout_constraintBottom_toTopOf=
"@id/btnDelete"
app:layout_constraintEnd_toEndOf=
"parent"
android:backgroundTint=
"#4CAF50"
android:text=
"UPDATE"
/>
<TextView
android:id=
"@+id/title_product"
...
...
app/src/main/res/layout/skeleton_category.xml
0 → 100644
View file @
53a6ba2d
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:layout_width=
"match_parent"
android:layout_height=
"50dp"
android:layout_marginBottom=
"8dp"
android:background=
"@android:color/transparent"
>
<View
android:layout_width=
"0dp"
android:layout_height=
"1px"
android:background=
"@color/colorLine"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintLeft_toRightOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
<View
android:id=
"@+id/img_news"
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
android:layout_margin=
"5dp"
android:background=
"@color/light_transparent"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
app/src/main/res/values/colors.xml
View file @
53a6ba2d
...
...
@@ -9,4 +9,6 @@
<color
name=
"color_stroke"
>
#22333333
</color>
<color
name=
"badge_not_available"
>
#F1ACAC
</color>
<color
name=
"badge_available"
>
#9DED87
</color>
<color
name=
"colorLine"
>
#dfdfdf
</color>
<color
name=
"colorRed"
>
#F81A1A
</color>
</resources>
\ No newline at end of file
app/src/main/res/values/strings.xml
View file @
53a6ba2d
...
...
@@ -27,6 +27,7 @@
<string
name=
"hint_pay"
>
cash
</string>
<string
name=
"title_next"
>
next
</string>
<string
name=
"open_cart"
>
Open Cart
</string>
<string
name=
"text_new_category"
>
Add New Category
</string>
<string-array
name=
"planets_array"
>
<item>
Mercury
</item>
...
...
app/src/main/res/values/styles.xml
View file @
53a6ba2d
...
...
@@ -73,4 +73,7 @@
<item
name=
"android:hint"
>
Select kategori
</item>
</style>
<style
name=
"AppModalStyle"
parent=
"Widget.Design.BottomSheet.Modal"
>
<item
name=
"android:background"
>
@drawable/round_corner_sheet
</item>
</style>
</resources>
\ No newline at end of file
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