Commit 7686d289 authored by Alfansyah Fadlian's avatar Alfansyah Fadlian

dashboard design

parent 354072de
......@@ -7,24 +7,17 @@ import android.view.MenuItem;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
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;
import java.util.ArrayList;
public class MainActivity extends AppCompatActivity {
private ArrayList<ProductModels> productModels = new ArrayList<>();
MaterialToolbar toolbar;
......@@ -34,8 +27,6 @@ public class MainActivity extends AppCompatActivity {
setContentView(R.layout.activity_main);
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);
......
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) {
}
}
}
......@@ -6,51 +6,19 @@
android:layout_height="match_parent"
tools:context=".MainActivity">
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/AppBar"
<include
android:id="@+id/topAppBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="15dp">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/topAppBar"
style="@style/Widget.MaterialComponents.Toolbar.Primary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:elevation="0dp"
app:menu="@menu/home"
app:navigationIcon="@drawable/ic_meser">
<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: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>
layout="@layout/appbar_dashboard">
</include>
<include
android:id="@+id/category"
app:layout_constraintTop_toBottomOf="@id/tilSearch"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@+id/topAppBar"
layout="@layout/item_category"/>
......@@ -58,18 +26,15 @@
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvProduct"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/tvNew"
android:layout_below="@id/topAppBar"
android:layout_height="wrap_content"
android:overScrollMode="never"
android:padding="12sp"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
app:spanCount="2"
app:layout_constraintTop_toBottomOf="@id/category"
tools:listitem="@layout/item_list" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.appbar.MaterialToolbar android:id="@+id/topAppBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="0dp"
style="@style/Widget.MaterialComponents.Toolbar.Primary"
xmlns:android="http://schemas.android.com/apk/res/android"
app:menu="@menu/home"
app:navigationIcon="@drawable/ic_meser"
xmlns:app="http://schemas.android.com/apk/res-auto">
<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:imeOptions="actionSearch"
android:textColor="#fff"
android:textColorHighlight="#fff"
android:textColorHint="#fff" />
</com.google.android.material.textfield.TextInputLayout>
</com.google.android.material.appbar.MaterialToolbar>
......@@ -43,7 +43,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/roboto"
android:text="Phones"
android:text="Food"
android:textStyle="bold"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment