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
354072de
Commit
354072de
authored
Aug 24, 2020
by
Alfansyah Fadlian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
item category
parent
baa6fb25
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
294 additions
and
48 deletions
+294
-48
MainActivity.java
app/src/main/java/com/yono/messeripos/MainActivity.java
+15
-3
ProductAdapter.java
...main/java/com/yono/messeripos/adapter/ProductAdapter.java
+74
-0
activity_main.xml
app/src/main/res/layout/activity_main.xml
+49
-43
item_category.xml
app/src/main/res/layout/item_category.xml
+150
-0
item_list.xml
app/src/main/res/layout/item_list.xml
+6
-2
No files found.
app/src/main/java/com/yono/messeripos/MainActivity.java
View file @
354072de
...
...
@@ -12,19 +12,31 @@ import android.widget.Toast;
import
androidx.appcompat.app.AppCompatActivity
;
import
androidx.appcompat.widget.Toolbar
;
import
androidx.core.content.ContextCompat
;
import
androidx.recyclerview.widget.LinearLayoutManager
;
import
androidx.recyclerview.widget.RecyclerView
;
import
com.google.android.material.appbar.MaterialToolbar
;
import
com.yono.messeripos.adapter.PaymentAdapter
;
import
com.yono.messeripos.adapter.ProductAdapter
;
import
com.yono.messeripos.models.ProductModels
;
import
com.yono.messeripos.response.PaymentResponse
;
public
class
MainActivity
extends
AppCompatActivity
{
import
java.util.ArrayList
;
public
class
MainActivity
extends
AppCompatActivity
{
private
ArrayList
<
ProductModels
>
productModels
=
new
ArrayList
<>();
MaterialToolbar
toolbar
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_main
);
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
){
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
);
w
.
getDecorView
().
setSystemUiVisibility
(
View
.
SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
);
...
...
@@ -38,7 +50,7 @@ public class MainActivity extends AppCompatActivity {
public
boolean
onMenuItemClick
(
MenuItem
item
)
{
int
id
=
item
.
getItemId
();
if
(
id
==
R
.
id
.
menu_cart
){
if
(
id
==
R
.
id
.
menu_cart
)
{
startActivity
(
new
Intent
(
MainActivity
.
this
,
CartActivity
.
class
));
}
return
true
;
...
...
app/src/main/java/com/yono/messeripos/adapter/ProductAdapter.java
0 → 100644
View file @
354072de
package
com
.
yono
.
messeripos
.
adapter
;
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.ItemListBinding
;
import
com.yono.messeripos.models.ProductModels
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
ProductAdapter
extends
RecyclerView
.
Adapter
<
ProductAdapter
.
ViewHolder
>
{
private
List
<
ProductModels
>
products
=
new
ArrayList
<>();
public
interface
ProductListener
{
void
onUpdate
(
ProductModels
product
);
void
onDelete
(
ProductModels
product
);
}
private
ProductListener
listener
;
public
void
setListener
(
ProductListener
listener
)
{
this
.
listener
=
listener
;
}
public
void
setProducts
(
List
<
ProductModels
>
products
)
{
this
.
products
=
products
;
notifyDataSetChanged
();
}
@NonNull
@Override
public
ProductAdapter
.
ViewHolder
onCreateViewHolder
(
@NonNull
ViewGroup
parent
,
int
viewType
)
{
return
new
ViewHolder
(
DataBindingUtil
.
inflate
(
LayoutInflater
.
from
(
parent
.
getContext
()),
R
.
layout
.
item_list
,
parent
,
false
)
);
}
@Override
public
void
onBindViewHolder
(
@NonNull
ProductAdapter
.
ViewHolder
holder
,
int
position
)
{
holder
.
bindData
(
products
.
get
(
position
),
listener
);
}
@Override
public
int
getItemCount
()
{
return
0
;
}
public
static
class
ViewHolder
extends
RecyclerView
.
ViewHolder
{
private
ItemListBinding
binding
;
public
ViewHolder
(
@NonNull
ItemListBinding
binding
)
{
super
(
binding
.
getRoot
());
this
.
binding
=
binding
;
}
public
void
bindData
(
ProductModels
productModels
,
ProductListener
listener
)
{
}
}
}
app/src/main/res/layout/activity_main.xml
View file @
354072de
...
...
@@ -11,6 +11,7 @@
android:layout_height=
"match_parent"
>
<com.google.android.material.appbar.AppBarLayout
android:id=
"@+id/AppBar"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:paddingStart=
"15dp"
>
...
...
@@ -25,28 +26,33 @@
app:menu=
"@menu/home"
app:navigationIcon=
"@drawable/ic_meser"
>
<EditText
<com.google.android.material.textfield.TextInputLayout
android:id=
"@+id/tilSearch"
style=
"@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
<com.google.android.material.textfield.TextInputEditText
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:drawableStart=
"@drawable/ic_baseline_search_24"
android:hint=
"Search"
android:outlineSpotShadowColor=
"#fff"
android:paddingStart=
"10dp"
android:imeOptions=
"actionSearch"
android:textColor=
"#fff"
android:textColorHighlight=
"#fff"
android:textColorHint=
"#fff"
/>
</com.google.android.material.textfield.TextInputLayout>
</com.google.android.material.appbar.MaterialToolbar>
</com.google.android.material.appbar.AppBarLayout>
<!-- Note: A RecyclerView can also be used -->
<androidx.core.widget.NestedScrollView
android:layout_width=
"match_parent
"
android:layout_height=
"match_parent"
app:layout_behavior=
"@string/appbar_scrolling_view_behavior"
>
<include
android:id=
"@+id/category"
app:layout_constraintTop_toBottomOf=
"@id/tilSearch
"
layout=
"@layout/item_category"
/>
<!-- Scrollable content -->
<androidx.recyclerview.widget.RecyclerView
...
...
@@ -55,15 +61,15 @@
android:layout_height=
"match_parent"
android:layout_above=
"@+id/tvNew"
android:layout_below=
"@id/topAppBar"
android:overScrollMode=
"never"
android:padding=
"12sp"
app:layoutManager=
"androidx.recyclerview.widget.GridLayoutManager"
app:spanCount=
"2"
tools:listitem=
"@layout/item_list"
/>
</androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
app/src/main/res/layout/item_category.xml
0 → 100644
View file @
354072de
<?xml version="1.0" encoding="utf-8"?>
<HorizontalScrollView
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_height=
"60dp"
android:layout_width=
"match_parent"
android:scrollbars=
"none"
>
<LinearLayout
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:paddingStart=
"10dp"
android:paddingTop=
"5dp"
android:paddingEnd=
"10dp"
android:orientation=
"horizontal"
>
<com.google.android.material.card.MaterialCardView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:backgroundTint=
"@color/ic_launcher_background"
app:cardCornerRadius=
"15dp"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<ImageView
android:id=
"@+id/image_cat"
android:layout_width=
"30dp"
android:layout_height=
"50dp"
android:src=
"@drawable/ic_meser"
android:layout_marginStart=
"10dp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintHorizontal_bias=
"0.06"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintVertical_bias=
"0.0"
tools:ignore=
"MissingConstraints"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:fontFamily=
"@font/roboto"
android:text=
"Phones"
android:textStyle=
"bold"
android:textSize=
"20sp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toEndOf=
"@id/image_cat"
app:layout_constraintTop_toTopOf=
"parent"
android:layout_marginStart=
"10dp"
android:layout_marginEnd=
"40dp"
tools:ignore=
"MissingConstraints"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.card.MaterialCardView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:backgroundTint=
"@color/ic_launcher_background"
android:layout_marginStart=
"20dp"
app:cardCornerRadius=
"15dp"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<ImageView
android:id=
"@+id/image_cat1"
android:layout_width=
"30dp"
android:layout_height=
"50dp"
android:src=
"@drawable/ic_meser"
android:layout_marginStart=
"10dp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintHorizontal_bias=
"0.06"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintVertical_bias=
"0.0"
tools:ignore=
"MissingConstraints"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:fontFamily=
"@font/roboto"
android:text=
"Food"
android:textStyle=
"bold"
android:textSize=
"20sp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toEndOf=
"@id/image_cat1"
app:layout_constraintTop_toTopOf=
"parent"
android:layout_marginStart=
"10dp"
android:layout_marginEnd=
"40dp"
tools:ignore=
"MissingConstraints"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.card.MaterialCardView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:backgroundTint=
"@color/ic_launcher_background"
android:layout_marginStart=
"20dp"
app:cardCornerRadius=
"15dp"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<ImageView
android:id=
"@+id/image_cat2"
android:layout_width=
"30dp"
android:layout_height=
"50dp"
android:src=
"@drawable/ic_meser"
android:layout_marginStart=
"10dp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintHorizontal_bias=
"0.06"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintVertical_bias=
"0.0"
tools:ignore=
"MissingConstraints"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:fontFamily=
"@font/roboto"
android:text=
"Food"
android:textStyle=
"bold"
android:textSize=
"20sp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toEndOf=
"@id/image_cat2"
app:layout_constraintTop_toTopOf=
"parent"
android:layout_marginStart=
"10dp"
android:layout_marginEnd=
"40dp"
tools:ignore=
"MissingConstraints"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>
</LinearLayout>
</HorizontalScrollView>
\ No newline at end of file
app/src/main/res/layout/item_list.xml
View file @
354072de
...
...
@@ -3,6 +3,11 @@
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
>
<data>
<variable
name=
"product"
type=
"com.yono.messeripos.models.ProductModels"
/>
</data>
<com.google.android.material.card.MaterialCardView
android:layout_width=
"match_parent"
...
...
@@ -60,8 +65,7 @@
android:paddingStart=
"@dimen/material_emphasis_medium"
android:paddingEnd=
"@dimen/material_emphasis_disabled"
android:textColor=
"@drawable/ic_launcher_background"
android:textSize=
"12sp"
tools:text=
"Rp. 100.000.000"
/>
android:textSize=
"12sp"
/>
<com.google.android.material.textview.MaterialTextView
android:id=
"@+id/tvDescription"
...
...
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