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
4891bf7a
Commit
4891bf7a
authored
Aug 25, 2020
by
Muhammad Suryono
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pdate form
parent
2c5e12f3
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
353 additions
and
149 deletions
+353
-149
Project.xml
.idea/codeStyles/Project.xml
+0
-24
misc.xml
.idea/misc.xml
+1
-1
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+16
-0
FormProductActivity.java
...rc/main/java/com/yono/messeripos/FormProductActivity.java
+127
-1
MainActivity.java
app/src/main/java/com/yono/messeripos/MainActivity.java
+16
-8
ProductService.java
.../java/com/yono/messeripos/api/service/ProductService.java
+12
-0
ProductModels.java
...c/main/java/com/yono/messeripos/models/ProductModels.java
+14
-0
basge_background.xml
app/src/main/res/drawable/basge_background.xml
+7
-0
custome_action_badge.xml
app/src/main/res/layout/custome_action_badge.xml
+31
-0
form_product.xml
app/src/main/res/layout/form_product.xml
+121
-113
home.xml
app/src/main/res/menu/home.xml
+2
-2
path.xml
app/src/main/res/xml/path.xml
+6
-0
No files found.
.idea/codeStyles/Project.xml
View file @
4891bf7a
<component
name=
"ProjectCodeStyleConfiguration"
>
<component
name=
"ProjectCodeStyleConfiguration"
>
<code_scheme
name=
"Project"
version=
"173"
>
<code_scheme
name=
"Project"
version=
"173"
>
<DBN-PSQL>
<case-options
enabled=
"true"
>
<option
name=
"KEYWORD_CASE"
value=
"lower"
/>
<option
name=
"FUNCTION_CASE"
value=
"lower"
/>
<option
name=
"PARAMETER_CASE"
value=
"lower"
/>
<option
name=
"DATATYPE_CASE"
value=
"lower"
/>
<option
name=
"OBJECT_CASE"
value=
"preserve"
/>
</case-options>
<formatting-settings
enabled=
"false"
/>
</DBN-PSQL>
<DBN-SQL>
<case-options
enabled=
"true"
>
<option
name=
"KEYWORD_CASE"
value=
"lower"
/>
<option
name=
"FUNCTION_CASE"
value=
"lower"
/>
<option
name=
"PARAMETER_CASE"
value=
"lower"
/>
<option
name=
"DATATYPE_CASE"
value=
"lower"
/>
<option
name=
"OBJECT_CASE"
value=
"preserve"
/>
</case-options>
<formatting-settings
enabled=
"false"
>
<option
name=
"STATEMENT_SPACING"
value=
"one_line"
/>
<option
name=
"CLAUSE_CHOP_DOWN"
value=
"chop_down_if_statement_long"
/>
<option
name=
"ITERATION_ELEMENTS_WRAPPING"
value=
"chop_down_if_not_single"
/>
</formatting-settings>
</DBN-SQL>
<DBN-PSQL>
<DBN-PSQL>
<case-options
enabled=
"true"
>
<case-options
enabled=
"true"
>
<option
name=
"KEYWORD_CASE"
value=
"lower"
/>
<option
name=
"KEYWORD_CASE"
value=
"lower"
/>
...
...
.idea/misc.xml
View file @
4891bf7a
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<project
version=
"4"
>
<component
name=
"ProjectRootManager"
version=
"2"
languageLevel=
"JDK_1_8"
project-jdk-name=
"
JDK
"
project-jdk-type=
"JavaSDK"
>
<component
name=
"ProjectRootManager"
version=
"2"
languageLevel=
"JDK_1_8"
project-jdk-name=
"
1.8
"
project-jdk-type=
"JavaSDK"
>
<output
url=
"file://$PROJECT_DIR$/build/classes"
/>
<output
url=
"file://$PROJECT_DIR$/build/classes"
/>
</component>
</component>
<component
name=
"ProjectType"
>
<component
name=
"ProjectType"
>
...
...
app/src/main/AndroidManifest.xml
View file @
4891bf7a
...
@@ -3,6 +3,12 @@
...
@@ -3,6 +3,12 @@
package=
"com.yono.messeripos"
>
package=
"com.yono.messeripos"
>
<uses-permission
android:name=
"android.permission.INTERNET"
/>
<uses-permission
android:name=
"android.permission.INTERNET"
/>
<uses-permission
android:name=
"android.permission.READ_EXTERNAL_STORAGE"
/>
<uses-permission
android:name=
"android.permission.WRITE_EXTERNAL_STORAGE"
/>
<uses-feature
android:name=
"android.hardware.camera"
android:required=
"true"
/>
<application
<application
android:allowBackup=
"true"
android:allowBackup=
"true"
...
@@ -31,6 +37,16 @@
...
@@ -31,6 +37,16 @@
android:theme=
"@style/AppTheme.appbar"
/>
android:theme=
"@style/AppTheme.appbar"
/>
<activity
android:name=
".FormProductActivity"
/>
<activity
android:name=
".FormProductActivity"
/>
<provider
android:name=
"androidx.core.content.FileProvider"
android:authorities=
"com.example.android.messer"
android:exported=
"false"
android:grantUriPermissions=
"true"
>
<meta-data
android:name=
"android.support.FILE_PROVIDER_PATHS"
android:resource=
"@xml/path"
/>
</provider>
<meta-data
<meta-data
android:name=
"preloaded_fonts"
android:name=
"preloaded_fonts"
android:resource=
"@array/preloaded_fonts"
/>
android:resource=
"@array/preloaded_fonts"
/>
...
...
app/src/main/java/com/yono/messeripos/FormProductActivity.java
View file @
4891bf7a
package
com
.
yono
.
messeripos
;
package
com
.
yono
.
messeripos
;
import
android.content.CursorLoader
;
import
android.content.Intent
;
import
android.database.Cursor
;
import
android.net.Uri
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.os.Environment
;
import
android.os.PersistableBundle
;
import
android.os.PersistableBundle
;
import
android.provider.MediaStore
;
import
android.provider.Settings
;
import
android.util.Log
;
import
android.view.Window
;
import
android.view.WindowManager
;
import
android.widget.Toast
;
import
androidx.annotation.NonNull
;
import
androidx.annotation.Nullable
;
import
androidx.annotation.Nullable
;
import
androidx.appcompat.app.AppCompatActivity
;
import
androidx.appcompat.app.AppCompatActivity
;
import
androidx.core.content.ContextCompat
;
import
androidx.core.content.FileProvider
;
import
androidx.databinding.DataBindingUtil
;
import
com.google.android.material.appbar.MaterialToolbar
;
import
com.google.android.material.appbar.MaterialToolbar
;
import
com.yono.messeripos.databinding.FormProductBinding
;
import
com.yono.messeripos.models.ProductModels
;
import
java.io.File
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
public
class
FormProductActivity
extends
AppCompatActivity
{
public
class
FormProductActivity
extends
AppCompatActivity
{
FormProductBinding
binding
;
ProductModels
productModels
;
File
file
;
private
static
final
int
REQUEST_IMAGE_CAPTURE
=
1
;
private
static
final
int
REQUEST_PERMISSIONS
=
448
;
private
boolean
isUpdate
=
false
;
@Override
@Override
public
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
public
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
form_product
);
binding
=
DataBindingUtil
.
setContentView
(
this
,
R
.
layout
.
form_product
);
binding
.
btnAdd
.
setText
(
"Add New Prooduct"
);
productModels
=
new
ProductModels
();
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
.
topAppBarForm
);
MaterialToolbar
toolbars
=
findViewById
(
R
.
id
.
topAppBarForm
);
setSupportActionBar
(
toolbars
);
setSupportActionBar
(
toolbars
);
...
@@ -20,5 +58,93 @@ public class FormProductActivity extends AppCompatActivity {
...
@@ -20,5 +58,93 @@ public class FormProductActivity extends AppCompatActivity {
getSupportActionBar
().
setDisplayShowHomeEnabled
(
true
);
getSupportActionBar
().
setDisplayShowHomeEnabled
(
true
);
getSupportActionBar
().
setTitle
(
"Add Product"
);
getSupportActionBar
().
setTitle
(
"Add Product"
);
toolbars
.
setNavigationOnClickListener
(
view
->
onBackPressed
());
toolbars
.
setNavigationOnClickListener
(
view
->
onBackPressed
());
binding
.
cvProduct
.
setOnClickListener
(
view
->
takePhoto
());
binding
.
btnAdd
.
setOnClickListener
(
view
->
saveProduct
());
}
private
void
saveProduct
(){
productModels
.
setProductName
(
binding
.
etName
.
getText
().
toString
());
productModels
.
setPriceProduct
(
Integer
.
parseInt
(
binding
.
etPrice
.
getText
().
toString
()));
productModels
.
setStockProduct
(
Integer
.
parseInt
(
binding
.
etStock
.
getText
().
toString
()));
Toast
.
makeText
(
this
,
productModels
.
getImageProduct
()+
" "
+
productModels
.
getProductName
(),
Toast
.
LENGTH_LONG
).
show
();
}
private
void
openFile
(){
Intent
i
=
new
Intent
(
Intent
.
ACTION_PICK
,
MediaStore
.
Images
.
Media
.
EXTERNAL_CONTENT_URI
);
startActivityForResult
(
i
,
100
);
}
private
File
createImageFile
()
{
try
{
String
timeStamp
=
new
SimpleDateFormat
(
"yyyyMMdd_HHmmss"
).
format
(
new
Date
());
File
image
=
File
.
createTempFile
(
"MESSER_"
+
timeStamp
+
"_"
,
".jpg"
,
getExternalFilesDir
(
Environment
.
DIRECTORY_PICTURES
)
);
file
=
image
;
return
image
;
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
();
return
null
;
}
}
private
void
takePhoto
()
{
Intent
takePictureIntent
=
new
Intent
(
MediaStore
.
ACTION_IMAGE_CAPTURE
);
if
(
takePictureIntent
.
resolveActivity
(
getPackageManager
())
!=
null
)
{
File
photoFile
=
createImageFile
();
if
(
photoFile
!=
null
)
{
Uri
photoURI
=
FileProvider
.
getUriForFile
(
this
,
"com.example.android.messer"
,
photoFile
);
takePictureIntent
.
putExtra
(
MediaStore
.
EXTRA_OUTPUT
,
photoURI
);
startActivityForResult
(
takePictureIntent
,
REQUEST_IMAGE_CAPTURE
);
}
}
}
@Override
protected
void
onActivityResult
(
int
requestCode
,
int
resultCode
,
@Nullable
Intent
data
)
{
super
.
onActivityResult
(
requestCode
,
resultCode
,
data
);
// if (requestCode == 100 && resultCode == RESULT_OK && data != null) {
// Uri selectedImage = data.getData();
//
// Log.d("Get filepath photo", "" + getRealPathFromURI(selectedImage));
// binding.setPhoto(getRealPathFromURI(selectedImage));
// }
if
(
requestCode
==
REQUEST_IMAGE_CAPTURE
&&
resultCode
==
RESULT_OK
)
{
Log
.
d
(
"Get filepath photo"
,
""
+
file
.
getName
());
binding
.
setPhoto
(
file
.
getAbsolutePath
());
productModels
.
setImageProduct
(
file
.
getName
());
}
}
@Override
public
void
onRequestPermissionsResult
(
int
requestCode
,
@NonNull
String
[]
permissions
,
@NonNull
int
[]
grantResults
)
{
super
.
onRequestPermissionsResult
(
requestCode
,
permissions
,
grantResults
);
if
(
requestCode
==
REQUEST_PERMISSIONS
&&
grantResults
.
length
!=
permissions
.
length
)
{
requestPermissions
(
permissions
,
REQUEST_PERMISSIONS
);
}
}
private
String
getRealPathFromURI
(
Uri
contentUri
)
{
String
[]
proj
=
{
MediaStore
.
Images
.
Media
.
DATA
};
CursorLoader
loader
=
new
CursorLoader
(
this
,
contentUri
,
proj
,
null
,
null
,
null
);
Cursor
cursor
=
loader
.
loadInBackground
();
int
column_index
=
cursor
.
getColumnIndexOrThrow
(
MediaStore
.
Images
.
Media
.
DATA
);
cursor
.
moveToFirst
();
String
result
=
cursor
.
getString
(
column_index
);
cursor
.
close
();
return
result
;
}
}
}
}
app/src/main/java/com/yono/messeripos/MainActivity.java
View file @
4891bf7a
...
@@ -5,11 +5,13 @@ import android.os.Build;
...
@@ -5,11 +5,13 @@ import android.os.Build;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.util.Log
;
import
android.util.Log
;
import
android.view.LayoutInflater
;
import
android.view.LayoutInflater
;
import
android.view.Menu
;
import
android.view.MenuItem
;
import
android.view.MenuItem
;
import
android.view.View
;
import
android.view.View
;
import
android.view.Window
;
import
android.view.Window
;
import
android.view.WindowManager
;
import
android.view.WindowManager
;
import
android.widget.ImageView
;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
android.widget.Toast
;
import
android.widget.Toast
;
import
androidx.appcompat.app.AppCompatActivity
;
import
androidx.appcompat.app.AppCompatActivity
;
...
@@ -50,6 +52,7 @@ public class MainActivity extends AppCompatActivity {
...
@@ -50,6 +52,7 @@ public class MainActivity extends AppCompatActivity {
CategoryAdapter
categoryAdapter
;
CategoryAdapter
categoryAdapter
;
ProductAdapter
productAdapter
;
ProductAdapter
productAdapter
;
CartAdapter
cartAdapter
;
CartAdapter
cartAdapter
;
TextView
txtBadge
;
public
static
Boolean
status_update
=
false
;
public
static
Boolean
status_update
=
false
;
MainViewModelsCart
mainViewModelsCart
;
MainViewModelsCart
mainViewModelsCart
;
...
@@ -64,7 +67,7 @@ public class MainActivity extends AppCompatActivity {
...
@@ -64,7 +67,7 @@ public class MainActivity extends AppCompatActivity {
categoryAdapter
=
new
CategoryAdapter
();
categoryAdapter
=
new
CategoryAdapter
();
productAdapter
=
new
ProductAdapter
();
productAdapter
=
new
ProductAdapter
();
mainViewModelsCart
=
new
ViewModelProvider
(
MainActivity
.
this
).
get
(
MainViewModelsCart
.
class
);
mainViewModelsCart
=
new
ViewModelProvider
(
MainActivity
.
this
).
get
(
MainViewModelsCart
.
class
);
cartAdapter
=
new
CartAdapter
();
//
cartAdapter = new CartAdapter();
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
)
{
...
@@ -83,13 +86,6 @@ public class MainActivity extends AppCompatActivity {
...
@@ -83,13 +86,6 @@ public class MainActivity extends AppCompatActivity {
status_update
=
true
;
status_update
=
true
;
binding
.
rvCategory
.
setVisibility
(
View
.
GONE
);
binding
.
rvCategory
.
setVisibility
(
View
.
GONE
);
productAdapter
.
notifyDataSetChanged
();
productAdapter
.
notifyDataSetChanged
();
mainViewModelsCart
.
getCartProduct
().
observe
(
MainActivity
.
this
,
new
Observer
<
List
<
ProductCartModels
>>()
{
@Override
public
void
onChanged
(
List
<
ProductCartModels
>
productCartModels
)
{
String
js
=
new
Gson
().
toJson
(
productCartModels
);
Log
.
d
(
"from cart"
,
"Response "
+
js
);
}
});
}
else
if
(
id
==
R
.
id
.
create
)
{
}
else
if
(
id
==
R
.
id
.
create
)
{
startActivity
(
new
Intent
(
getApplicationContext
(),
FormProductActivity
.
class
));
startActivity
(
new
Intent
(
getApplicationContext
(),
FormProductActivity
.
class
));
}
}
...
@@ -139,4 +135,16 @@ public class MainActivity extends AppCompatActivity {
...
@@ -139,4 +135,16 @@ public class MainActivity extends AppCompatActivity {
}
}
});
});
}
}
@Override
public
boolean
onCreateOptionsMenu
(
Menu
menu
)
{
getMenuInflater
().
inflate
(
R
.
menu
.
home
,
menu
);
final
MenuItem
menuItem
=
menu
.
findItem
(
R
.
id
.
menu_cart
);
View
actionView
=
menuItem
.
getActionView
();
txtBadge
=
actionView
.
findViewById
(
R
.
id
.
cart_badge
);
return
true
;
}
}
}
\ No newline at end of file
app/src/main/java/com/yono/messeripos/api/service/ProductService.java
View file @
4891bf7a
...
@@ -7,11 +7,23 @@ import com.yono.messeripos.response.DataResponse;
...
@@ -7,11 +7,23 @@ import com.yono.messeripos.response.DataResponse;
import
java.util.List
;
import
java.util.List
;
import
okhttp3.RequestBody
;
import
retrofit2.Call
;
import
retrofit2.Call
;
import
retrofit2.http.GET
;
import
retrofit2.http.GET
;
import
retrofit2.http.Multipart
;
import
retrofit2.http.Part
;
public
interface
ProductService
{
public
interface
ProductService
{
@GET
(
ApiHelper
.
VERSI_API_1
+
"products-join"
)
@GET
(
ApiHelper
.
VERSI_API_1
+
"products-join"
)
Call
<
DataResponse
<
List
<
ProductModels
<
CategoryModels
>>>>
getProducts
();
Call
<
DataResponse
<
List
<
ProductModels
<
CategoryModels
>>>>
getProducts
();
@Multipart
@GET
(
ApiHelper
.
VERSI_API_1
+
"products"
)
Call
<
DataResponse
<
ProductModels
>>
postProduct
(
@Part
(
"image\"; filename=\"messer_file.jpg\""
)
RequestBody
image
,
@Part
RequestBody
name
,
@Part
RequestBody
price
,
@Part
RequestBody
stock
,
@Part
RequestBody
category_id
);
}
}
app/src/main/java/com/yono/messeripos/models/ProductModels.java
View file @
4891bf7a
package
com
.
yono
.
messeripos
.
models
;
package
com
.
yono
.
messeripos
.
models
;
import
android.text.TextUtils
;
import
android.widget.ImageView
;
import
android.widget.ImageView
;
import
androidx.databinding.BindingAdapter
;
import
androidx.databinding.BindingAdapter
;
...
@@ -10,6 +11,8 @@ import com.google.gson.annotations.SerializedName;
...
@@ -10,6 +11,8 @@ import com.google.gson.annotations.SerializedName;
import
com.yono.messeripos.R
;
import
com.yono.messeripos.R
;
import
com.yono.messeripos.api.ApiHelper
;
import
com.yono.messeripos.api.ApiHelper
;
import
java.io.File
;
public
class
ProductModels
<
T
>
{
public
class
ProductModels
<
T
>
{
@SerializedName
(
"id"
)
@SerializedName
(
"id"
)
private
int
idProduct
;
private
int
idProduct
;
...
@@ -88,4 +91,15 @@ public class ProductModels<T> {
...
@@ -88,4 +91,15 @@ public class ProductModels<T> {
.
into
(
view
);
.
into
(
view
);
}
}
}
}
@BindingAdapter
(
"path"
)
public
static
void
setPathImage
(
ImageView
view
,
String
path
)
{
if
(
TextUtils
.
isEmpty
(
path
))
view
.
setImageResource
(
R
.
mipmap
.
ic_launcher_round
);
else
{
File
file
=
new
File
(
path
);
if
(
file
.
exists
())
Glide
.
with
(
view
).
load
(
file
).
into
(
view
);
else
view
.
setImageResource
(
R
.
mipmap
.
ic_launcher_round
);
}
}
}
}
app/src/main/res/drawable/basge_background.xml
0 → 100644
View file @
4891bf7a
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"oval"
>
<solid
android:color=
"@android:color/holo_red_dark"
/>
<stroke
android:color=
"@android:color/white"
android:width=
"1dp"
/>
</shape>
\ No newline at end of file
app/src/main/res/layout/custome_action_badge.xml
0 → 100644
View file @
4891bf7a
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
style=
"?attr/actionButtonStyle"
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:clipToPadding=
"false"
android:focusable=
"true"
>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:src=
"@drawable/ic_baseline_shopping_cart_24"
/>
<TextView
android:id=
"@+id/cart_badge"
android:layout_width=
"20dp"
android:layout_height=
"20dp"
android:layout_gravity=
"right|end|top"
android:layout_marginEnd=
"-5dp"
android:layout_marginRight=
"-5dp"
android:layout_marginTop=
"3dp"
android:background=
"@drawable/basge_background"
android:gravity=
"center"
android:padding=
"3dp"
android:textColor=
"@android:color/white"
android:text=
"0"
android:textSize=
"10sp"
/>
</FrameLayout>
\ No newline at end of file
app/src/main/res/layout/form_product.xml
View file @
4891bf7a
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
<layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@drawable/bg_add"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:fitsSystemWindows=
"true"
xmlns:tools=
"http://schemas.android.com/tools"
>
xmlns:tools=
"http://schemas.android.com/tools"
>
<com.google.android.material.appbar.MaterialToolbar
<data>
android:id=
"@+id/topAppBarForm"
<variable
android:layout_width=
"match_parent"
name=
"productForm"
android:layout_height=
"wrap_content"
type=
"com.yono.messeripos.models.ProductModels"
/>
android:elevation=
"0dp"
android:paddingTop=
"20dp"
<variable
android:background=
"@drawable/gradient"
name=
"photo"
app:layout_constraintTop_toTopOf=
"parent"
type=
"String"
/>
app:layout_constraintStart_toStartOf=
"parent"
</data>
app:layout_constraintEnd_toEndOf=
"parent"
style=
"@style/Widget.MaterialComponents.Toolbar.Primary"
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
</com.google.android.material.appbar.MaterialToolbar>
<com.google.android.material.card.MaterialCardView
android:id=
"@+id/cvProduct"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerHorizontal=
"true"
android:layout_margin=
"10dp"
app:cardCornerRadius=
"80dp"
app:layout_constraintTop_toBottomOf=
"@id/topAppBarForm"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintBottom_toTopOf=
"@id/tfName"
>
<ImageView
android:id=
"@+id/ivProduct"
android:layout_width=
"160dp"
android:layout_height=
"160dp"
android:scaleType=
"centerCrop"
android:src=
"@mipmap/ic_launcher_round"
/>
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.textfield.TextInputLayout
android:id=
"@+id/tfName"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"match_parent"
android:layout_margin=
"10dp"
android:fitsSystemWindows=
"true"
>
android:hint=
"@string/name"
android:textColor=
"#fff"
<com.google.android.material.appbar.MaterialToolbar
android:id=
"@+id/topAppBarForm"
style=
"@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width=
"match_parent"
app:layout_constraintTop_toBottomOf=
"@+id/cvProduct"
android:layout_height=
"wrap_content"
tools:ignore=
"MissingConstraints"
>
android:elevation=
"0dp"
android:paddingTop=
"20dp"
<com.google.android.material.textfield.TextInputEditText
android:background=
"@drawable/gradient"
android:id=
"@+id/etName"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
style=
"@style/Widget.MaterialComponents.Toolbar.Primary"
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
</com.google.android.material.appbar.MaterialToolbar>
<com.google.android.material.card.MaterialCardView
android:id=
"@+id/cvProduct"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerHorizontal=
"true"
android:layout_margin=
"10dp"
app:cardCornerRadius=
"80dp"
app:layout_constraintTop_toBottomOf=
"@id/topAppBarForm"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintBottom_toTopOf=
"@id/tfName"
>
<ImageView
android:id=
"@+id/ivProduct"
android:layout_width=
"160dp"
android:layout_height=
"160dp"
android:scaleType=
"centerCrop"
app:path=
"@{photo}"
android:src=
"@mipmap/ic_launcher_round"
/>
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.textfield.TextInputLayout
android:id=
"@+id/tfName"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
/>
android:layout_margin=
"10dp"
android:hint=
"@string/name"
android:textColor=
"#fff"
style=
"@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
app:layout_constraintTop_toBottomOf=
"@+id/cvProduct"
tools:ignore=
"MissingConstraints"
>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputEditText
android:id=
"@+id/etName"
android:text=
"@{productForm.productName}"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
/>
<com.google.android.material.textfield.TextInputLayout
</com.google.android.material.textfield.TextInputLayout>
android:id=
"@+id/tfPrice"
android:layout_width=
"match_parent"
<com.google.android.material.textfield.TextInputLayout
android:layout_height=
"wrap_content"
android:id=
"@+id/tfPrice"
android:layout_margin=
"10dp"
android:hint=
"@string/price"
android:textColor=
"#fff"
style=
"@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
app:layout_constraintTop_toBottomOf=
"@id/tfName"
>
<com.google.android.material.textfield.TextInputEditText
android:id=
"@+id/etPrice"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
/>
android:layout_margin=
"10dp"
android:hint=
"@string/price"
android:textColor=
"#fff"
style=
"@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
app:layout_constraintTop_toBottomOf=
"@id/tfName"
>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputEditText
android:id=
"@+id/etPrice"
android:text=
"@{productForm.priceProduct+``}"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
/>
<com.google.android.material.textfield.TextInputLayout
</com.google.android.material.textfield.TextInputLayout>
android:id=
"@+id/tfStock"
android:layout_width=
"match_parent"
<com.google.android.material.textfield.TextInputLayout
android:layout_height=
"wrap_content"
android:id=
"@+id/tfStock"
android:layout_margin=
"10dp"
android:hint=
"@string/stock"
android:textColor=
"#fff"
style=
"@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
app:layout_constraintTop_toBottomOf=
"@id/tfPrice"
>
<com.google.android.material.textfield.TextInputEditText
android:id=
"@+id/etStock"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_margin=
"10dp"
android:hint=
"@string/stock"
android:textColor=
"#fff"
android:textColor=
"#fff"
/>
style=
"@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
app:layout_constraintTop_toBottomOf=
"@id/tfPrice"
>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputEditText
android:id=
"@+id/etStock"
android:text=
"@{productForm.stockProduct+``}"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:textColor=
"#fff"
/>
<Spinner
</com.google.android.material.textfield.TextInputLayout>
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
<Spinner
android:id=
"@+id/listCategory"
android:layout_width=
"match_parent"
android:padding=
"15dp"
android:layout_height=
"wrap_content"
android:layout_margin=
"10dp"
android:id=
"@+id/listCategory"
app:layout_constraintTop_toBottomOf=
"@id/tfStock"
>
android:padding=
"25dp"
</Spinner>
android:layout_margin=
"10dp"
android:textAlignment=
"textStart"
<com.google.android.material.button.MaterialButton
android:spinnerMode=
"dropdown"
android:id=
"@+id/btnAdd"
app:layout_constraintTop_toBottomOf=
"@id/tfStock"
/>
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
<com.google.android.material.button.MaterialButton
android:layout_margin=
"10dp"
android:id=
"@+id/btnAdd"
app:layout_constraintTop_toBottomOf=
"@+id/listCategory"
android:layout_width=
"match_parent"
android:text=
"@string/add"
android:layout_height=
"wrap_content"
tools:ignore=
"MissingConstraints"
/>
android:layout_margin=
"10dp"
android:foregroundGravity=
"bottom"
android:text=
"@string/add"
<ImageView
android:padding=
"16dp"
android:id=
"@+id/ivLogin"
app:layout_constraintBottom_toBottomOf=
"parent"
android:layout_width=
"191dp"
app:layout_constraintTop_toBottomOf=
"@+id/listCategory"
android:layout_height=
"166dp"
app:layout_constraintVertical_bias=
"1.0"
android:layout_marginTop=
"68dp"
tools:ignore=
"MissingConstraints"
android:src=
"@drawable/ic_launcher_new_icon_foreground"
tools:layout_editor_absoluteX=
"16dp"
/>
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/btnAdd"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
\ No newline at end of file
app/src/main/res/menu/home.xml
View file @
4891bf7a
...
@@ -3,9 +3,9 @@
...
@@ -3,9 +3,9 @@
xmlns:app=
"http://schemas.android.com/apk/res-auto"
>
xmlns:app=
"http://schemas.android.com/apk/res-auto"
>
<item
<item
android:id=
"@+id/menu_cart"
android:id=
"@+id/menu_cart"
android:orderInCategory=
"100"
app:showAsAction=
"always"
app:showAsAction=
"ifRoom"
android:icon=
"@drawable/ic_baseline_shopping_cart_24"
android:icon=
"@drawable/ic_baseline_shopping_cart_24"
android:actionLayout=
"@layout/custome_action_badge"
android:title=
"Cart"
/>
android:title=
"Cart"
/>
<item
<item
...
...
app/src/main/res/xml/path.xml
0 → 100644
View file @
4891bf7a
<?xml version="1.0" encoding="utf-8"?>
<paths>
<external-files-path
name=
"photos"
path=
"/"
/>
</paths>
\ 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