Commit 3ee68156 authored by Ahmad Abi Mulya's avatar Ahmad Abi Mulya

Fix Recycle view product

parent 556a1c17
......@@ -38,7 +38,7 @@
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="com.example.android.fileprovider"
android:authorities="com.example.yourcashiertest.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
......
......@@ -4,6 +4,7 @@ import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;
import androidx.lifecycle.ViewModelProvider;
import androidx.recyclerview.widget.GridLayoutManager;
import android.Manifest;
......@@ -39,7 +40,8 @@ public class MainActivity extends AppCompatActivity {
ProductAdapter adapter = new ProductAdapter();
binding = DataBindingUtil.setContentView(this, R.layout.activity_main);
// GridLayoutManager grid = new GridLayoutManager(this, 2);
// binding.rvProducts.setLayoutManager(grid);
// settings menu
binding.ivCart.setOnClickListener(view -> startActivity(new Intent(MainActivity.this, CartActivity.class)));
binding.ivSettings.setOnClickListener(view -> {
......
......@@ -109,7 +109,7 @@ public class ProductActivity extends AppCompatActivity{
if (photoFile != null) {
Uri photoURI = FileProvider.getUriForFile(this,
"com.example.android.fileprovider",
"com.example.yourcashiertest.fileprovider",
photoFile);
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI);
startActivityForResult(takePictureIntent, REQUEST_IMAGE_CAPTURE);
......
......@@ -16,6 +16,6 @@ public class SplashActivity extends AppCompatActivity {
new Handler(Looper.getMainLooper()).postDelayed(() -> {
startActivity(new Intent(this, LoginActivity.class));
finish();
}, 3000);
}, 2000);
}
}
\ No newline at end of file
......@@ -18,7 +18,7 @@
<View
android:id="@+id/rectangle_4"
android:layout_width="match_parent"
android:layout_height="250dp"
android:layout_height="200dp"
android:background="@drawable/rectangle_4"
app:layout_constraintBottom_toTopOf="@id/rvProducts"
app:layout_constraintEnd_toEndOf="parent"
......@@ -117,15 +117,16 @@
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvProducts"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="0dp"
android:layout_marginVertical="15dp"
app:layout_constraintTop_toBottomOf="@id/rectangle_4"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:overScrollMode="never"
android:padding="@dimen/space_small"
app:layoutManager="androidx.recyclerview.widget.StaggeredGridLayoutManager"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
app:spanCount="2"
tools:listitem="@layout/item_list"
tools:ignore="MissingConstraints" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
......@@ -20,6 +20,10 @@
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
app:cardElevation="2dp"
android:layout_height="wrap_content">
......@@ -117,6 +121,7 @@
app:cornerRadius="5dp"
app:icon="@drawable/ic_baseline_add_shopping_cart_24"
app:iconGravity="textStart"
android:textSize="10dp"
android:text="Add to cart"
app:layout_constraintTop_toBottomOf="@+id/tv_price" />
......
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