Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
Your Cashier
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
Ahmad Abi Mulya
Your Cashier
Commits
75eb9e48
Commit
75eb9e48
authored
Sep 04, 2020
by
Ahmad Abi Mulya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix view model in product layout
parent
e1e63f58
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
28 additions
and
15 deletions
+28
-15
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+5
-1
MainActivity.java
.../com/example/yourcashiertest/activities/MainActivity.java
+4
-0
BackgroundService.java
...m/example/yourcashiertest/services/BackgroundService.java
+4
-3
activity_product.xml
app/src/main/res/layout/activity_product.xml
+5
-5
alert_dialog.xml
app/src/main/res/layout/alert_dialog.xml
+1
-1
item_list.xml
app/src/main/res/layout/item_list.xml
+5
-5
settings_menu.xml
app/src/main/res/menu/settings_menu.xml
+4
-0
No files found.
app/src/main/AndroidManifest.xml
View file @
75eb9e48
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
package=
"com.example.yourcashiertest"
>
package=
"com.example.yourcashiertest"
>
<uses-permission
android:name=
"android.permission.INTERNET"
/>
<uses-permission
android:name=
"android.permission.INTERNET"
/>
<uses-permission
android:name=
"android.permission.WAKE_LOCK"
/>
<uses-permission
android:name=
"android.permission.ACCESS_NETWORK_STATE"
/>
<uses-permission
android:name=
"android.permission.ACCESS_NETWORK_STATE"
/>
<uses-permission
android:name=
"android.permission.ACCESS_WIFI_STATE"
/>
<uses-permission
android:name=
"android.permission.ACCESS_WIFI_STATE"
/>
<uses-permission
android:name=
"android.permission.READ_EXTERNAL_STORAGE"
/>
<uses-permission
android:name=
"android.permission.READ_EXTERNAL_STORAGE"
/>
...
@@ -21,7 +22,10 @@
...
@@ -21,7 +22,10 @@
android:supportsRtl=
"true"
android:supportsRtl=
"true"
android:theme=
"@style/AppTheme2"
>
android:theme=
"@style/AppTheme2"
>
<activity
android:name=
".activities.OrderDetailActivity"
></activity>
<activity
android:name=
".activities.OrderDetailActivity"
></activity>
<service
android:name=
".services.BackgroundService"
android:enabled=
"true"
android:exported=
"true"
/>
<receiver
android:name=
".activities.InetChecker"
>
<receiver
android:name=
".activities.InetChecker"
>
<intent-filter>
<intent-filter>
<action
android:name=
"android.net.conn.CONNECTIVITY_CHANGE"
/>
<action
android:name=
"android.net.conn.CONNECTIVITY_CHANGE"
/>
...
...
app/src/main/java/com/example/yourcashiertest/activities/MainActivity.java
View file @
75eb9e48
...
@@ -31,6 +31,7 @@ import com.example.yourcashiertest.databinding.ActivityMainBinding;
...
@@ -31,6 +31,7 @@ import com.example.yourcashiertest.databinding.ActivityMainBinding;
import
com.example.yourcashiertest.entities.Cart
;
import
com.example.yourcashiertest.entities.Cart
;
import
com.example.yourcashiertest.entities.Product
;
import
com.example.yourcashiertest.entities.Product
;
import
com.example.yourcashiertest.entities.Transaksi
;
import
com.example.yourcashiertest.entities.Transaksi
;
import
com.example.yourcashiertest.services.BackgroundService
;
import
com.example.yourcashiertest.viewmodels.CartViewModel
;
import
com.example.yourcashiertest.viewmodels.CartViewModel
;
import
com.example.yourcashiertest.viewmodels.ProductViewModel
;
import
com.example.yourcashiertest.viewmodels.ProductViewModel
;
...
@@ -107,6 +108,9 @@ public class MainActivity extends AppCompatActivity {
...
@@ -107,6 +108,9 @@ public class MainActivity extends AppCompatActivity {
startActivity
(
new
Intent
(
MainActivity
.
this
,
OrderActivity
.
class
));
startActivity
(
new
Intent
(
MainActivity
.
this
,
OrderActivity
.
class
));
break
;
break
;
case
R
.
id
.
item_four
:
case
R
.
id
.
item_four
:
BackgroundService
.
startActionPushProduct
(
MainActivity
.
this
);
break
;
case
R
.
id
.
item_five
:
prefManager
.
removeLoginSession
();
prefManager
.
removeLoginSession
();
startActivity
(
new
Intent
(
MainActivity
.
this
,
LoginActivity
.
class
));
startActivity
(
new
Intent
(
MainActivity
.
this
,
LoginActivity
.
class
));
finish
();
finish
();
...
...
app/src/main/java/com/example/yourcashiertest/services/BackgroundService.java
View file @
75eb9e48
...
@@ -11,6 +11,7 @@ import com.example.yourcashiertest.daos.ProductDao;
...
@@ -11,6 +11,7 @@ import com.example.yourcashiertest.daos.ProductDao;
import
com.example.yourcashiertest.databases.LocalDatabase
;
import
com.example.yourcashiertest.databases.LocalDatabase
;
import
com.example.yourcashiertest.entities.Product
;
import
com.example.yourcashiertest.entities.Product
;
import
com.example.yourcashiertest.models.PushProduct
;
import
com.example.yourcashiertest.models.PushProduct
;
import
com.example.yourcashiertest.models.PushProductResponse
;
import
com.example.yourcashiertest.models.User
;
import
com.example.yourcashiertest.models.User
;
import
java.util.List
;
import
java.util.List
;
...
@@ -46,13 +47,13 @@ public class BackgroundService extends JobIntentService {
...
@@ -46,13 +47,13 @@ public class BackgroundService extends JobIntentService {
PushProduct
pushProduct
=
PushProduct
.
from
(
product
);
PushProduct
pushProduct
=
PushProduct
.
from
(
product
);
ApiClient
.
client
(
ProductService
.
class
,
BASE_URL
).
createProduct
(
pushProduct
)
ApiClient
.
client
(
ProductService
.
class
,
BASE_URL
).
createProduct
(
pushProduct
)
.
enqueue
(
new
Callback
<
User
>()
{
.
enqueue
(
new
Callback
<
PushProductResponse
>()
{
@Override
@Override
public
void
onResponse
(
Call
<
User
>
call
,
Response
<
User
>
response
)
{
public
void
onResponse
(
Call
<
PushProductResponse
>
call
,
Response
<
PushProductResponse
>
response
)
{
}
}
@Override
@Override
public
void
onFailure
(
Call
<
User
>
call
,
Throwable
t
)
{
public
void
onFailure
(
Call
<
PushProductResponse
>
call
,
Throwable
t
)
{
}
}
});
});
...
...
app/src/main/res/layout/activity_product.xml
View file @
75eb9e48
...
@@ -65,7 +65,7 @@
...
@@ -65,7 +65,7 @@
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:hint=
"Product Name"
android:hint=
"Product Name"
android:text=
"@{viewModel.
push
Product.name}"
android:text=
"@{viewModel.Product.name}"
android:inputType=
"textCapWords"
android:inputType=
"textCapWords"
android:textSize=
"@dimen/text_default"
/>
android:textSize=
"@dimen/text_default"
/>
...
@@ -86,7 +86,7 @@
...
@@ -86,7 +86,7 @@
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:hint=
"Price"
android:hint=
"Price"
android:text=
"@{viewModel.
pushProduct.price == 0 ? `` : viewModel.push
Product.price + ``}"
android:text=
"@{viewModel.
Product.price == 0 ? `` : viewModel.
Product.price + ``}"
android:inputType=
"number"
android:inputType=
"number"
android:textSize=
"@dimen/text_default"
/>
android:textSize=
"@dimen/text_default"
/>
...
@@ -108,7 +108,7 @@
...
@@ -108,7 +108,7 @@
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:hint=
"Qty"
android:hint=
"Qty"
android:text=
"@{viewModel.
pushProduct.quantity == 0 ? `` : viewModel.push
Product.quantity + ``}"
android:text=
"@{viewModel.
Product.quantity == 0 ? `` : viewModel.
Product.quantity + ``}"
android:inputType=
"number"
android:inputType=
"number"
android:textSize=
"@dimen/text_default"
/>
android:textSize=
"@dimen/text_default"
/>
</com.google.android.material.textfield.TextInputLayout>
</com.google.android.material.textfield.TextInputLayout>
...
@@ -125,7 +125,7 @@
...
@@ -125,7 +125,7 @@
<com.google.android.material.textfield.TextInputEditText
<com.google.android.material.textfield.TextInputEditText
android:id=
"@+id/etCategory"
android:id=
"@+id/etCategory"
android:hint=
"Category"
android:hint=
"Category"
android:text=
"@{viewModel.
push
Product.category}"
android:text=
"@{viewModel.Product.category}"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
/>
android:layout_height=
"wrap_content"
/>
</com.google.android.material.textfield.TextInputLayout>
</com.google.android.material.textfield.TextInputLayout>
...
@@ -148,7 +148,7 @@
...
@@ -148,7 +148,7 @@
android:inputType=
"textMultiLine"
android:inputType=
"textMultiLine"
android:lines=
"3"
android:lines=
"3"
android:maxLines=
"3"
android:maxLines=
"3"
android:text=
"@{viewModel.
push
Product.description}"
android:text=
"@{viewModel.Product.description}"
android:textSize=
"@dimen/text_default"
/>
android:textSize=
"@dimen/text_default"
/>
</com.google.android.material.textfield.TextInputLayout>
</com.google.android.material.textfield.TextInputLayout>
...
...
app/src/main/res/layout/alert_dialog.xml
View file @
75eb9e48
...
@@ -73,7 +73,7 @@
...
@@ -73,7 +73,7 @@
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Coba Lagi"
android:text=
"Coba Lagi"
android:textSize=
"18sp"
android:textSize=
"18sp"
android:textColor=
"
#3949AB
"
android:textColor=
"
@color/blue
"
android:textFontWeight=
"600"
android:textFontWeight=
"600"
android:paddingVertical=
"15dp"
android:paddingVertical=
"15dp"
android:gravity=
"center"
/>
android:gravity=
"center"
/>
...
...
app/src/main/res/layout/item_list.xml
View file @
75eb9e48
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
<data>
<data>
<import
type=
"android.view.View"
/>
<import
type=
"android.view.View"
/>
<variable
<variable
name=
"
push
Product"
name=
"Product"
type=
"com.example.yourcashiertest.entities.Product"
/>
type=
"com.example.yourcashiertest.entities.Product"
/>
<variable
<variable
...
@@ -42,7 +42,7 @@
...
@@ -42,7 +42,7 @@
android:layout_height=
"130dp"
android:layout_height=
"130dp"
android:adjustViewBounds=
"true"
android:adjustViewBounds=
"true"
android:scaleType=
"fitXY"
android:scaleType=
"fitXY"
app:file=
"@{
push
Product.photo}"
app:file=
"@{Product.photo}"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintHorizontal_bias=
"0.8"
app:layout_constraintHorizontal_bias=
"0.8"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
...
@@ -78,7 +78,7 @@
...
@@ -78,7 +78,7 @@
android:id=
"@+id/tv_name"
android:id=
"@+id/tv_name"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"@{
push
Product.name}"
android:text=
"@{Product.name}"
android:textStyle=
"bold"
android:textStyle=
"bold"
android:layout_marginTop=
"8dp"
android:layout_marginTop=
"8dp"
android:maxLength=
"20"
android:maxLength=
"20"
...
@@ -94,7 +94,7 @@
...
@@ -94,7 +94,7 @@
android:id=
"@+id/tv_desc"
android:id=
"@+id/tv_desc"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"@{
push
Product.description}"
android:text=
"@{Product.description}"
android:layout_marginTop=
"8dp"
android:layout_marginTop=
"8dp"
android:layout_marginBottom=
"@dimen/space_default"
android:layout_marginBottom=
"@dimen/space_default"
android:maxLength=
"40"
android:maxLength=
"40"
...
@@ -148,7 +148,7 @@
...
@@ -148,7 +148,7 @@
android:layout_height=
"20sp"
android:layout_height=
"20sp"
android:textColor=
"@color/white"
android:textColor=
"@color/white"
android:textAlignment=
"center"
android:textAlignment=
"center"
android:text=
"@{
push
Product.quantity + ``}"
android:text=
"@{Product.quantity + ``}"
android:background=
"@drawable/ic_stok"
android:background=
"@drawable/ic_stok"
app:layout_constraintBottom_toBottomOf=
"@+id/tvStock"
app:layout_constraintBottom_toBottomOf=
"@+id/tvStock"
app:layout_constraintTop_toTopOf=
"@+id/tvStock"
app:layout_constraintTop_toTopOf=
"@+id/tvStock"
...
...
app/src/main/res/menu/settings_menu.xml
View file @
75eb9e48
...
@@ -11,5 +11,9 @@
...
@@ -11,5 +11,9 @@
android:title=
"Transaction List"
/>
android:title=
"Transaction List"
/>
<item
<item
android:id=
"@+id/item_four"
android:id=
"@+id/item_four"
android:title=
"Sync Data"
/>
<item
android:id=
"@+id/item_five"
android:title=
"Log Out"
/>
android:title=
"Log Out"
/>
</menu>
</menu>
\ 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