Redesign of the categories page
This commit is contained in:
parent
0bc203c5db
commit
3ce22edb33
@ -16,10 +16,10 @@ class MainActivity : AppCompatActivity() {
|
||||
|
||||
startActivity(Intent(baseContext, HomeActivity::class.java))
|
||||
|
||||
val intent = Intent(baseContext, ProductActivity::class.java)
|
||||
intent.putExtra("productId", 63)
|
||||
|
||||
startActivity(intent)
|
||||
// val intent = Intent(baseContext, ProductActivity::class.java)
|
||||
// intent.putExtra("productId", 63)
|
||||
//
|
||||
// startActivity(intent)
|
||||
|
||||
finish()
|
||||
|
||||
|
||||
@ -15,10 +15,8 @@ class CategoryViewHolder(val context: Context, itemView: View) :
|
||||
|
||||
fun renderView(category: Category) {
|
||||
val tvTitle = itemView.findViewById<TextView>(R.id.tvTitle)
|
||||
val tvDescription = itemView.findViewById<TextView>(R.id.tvDescription)
|
||||
|
||||
tvTitle.text = category.name
|
||||
tvDescription.text = Html.fromHtml(category.description)
|
||||
|
||||
itemView.setOnClickListener{
|
||||
val intent = Intent(context, ShopActivity::class.java)
|
||||
|
||||
@ -70,8 +70,11 @@ class CategoryFragment : Fragment() {
|
||||
categories.clear()
|
||||
|
||||
val categoriesResponse = response.data()
|
||||
|
||||
for (category in categoriesResponse) {
|
||||
categories.add(category)
|
||||
if (category.name != "Uncategorized") {
|
||||
categories.add(category)
|
||||
}
|
||||
}
|
||||
|
||||
adapter.notifyDataSetChanged()
|
||||
|
||||
@ -3,13 +3,17 @@ package me.gilo.wc.ui.product
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.support.v4.view.GravityCompat
|
||||
import android.support.v7.widget.GridLayoutManager
|
||||
import android.support.v7.widget.LinearLayoutManager
|
||||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
import android.widget.Toast
|
||||
import io.github.inflationx.viewpump.ViewPumpContextWrapper
|
||||
import kotlinx.android.synthetic.main.activity_shop.*
|
||||
import kotlinx.android.synthetic.main.content_shop.*
|
||||
import kotlinx.android.synthetic.main.drawer_filter.*
|
||||
import me.gilo.wc.R
|
||||
import me.gilo.wc.adapter.HomeProductAdapter
|
||||
import me.gilo.wc.adapter.ProductAdapter
|
||||
import me.gilo.wc.common.BaseActivity
|
||||
import me.gilo.wc.common.Status
|
||||
@ -23,7 +27,7 @@ import java.util.*
|
||||
class ShopActivity : BaseActivity() {
|
||||
|
||||
lateinit var adapter: ProductAdapter
|
||||
private lateinit var products: ArrayList<Product>
|
||||
var products : ArrayList<Product> = ArrayList()
|
||||
|
||||
private lateinit var viewModel: ProductViewModel
|
||||
val TAG = this::getLocalClassName
|
||||
@ -42,6 +46,8 @@ class ShopActivity : BaseActivity() {
|
||||
title = "Shop"
|
||||
|
||||
|
||||
setUpPage()
|
||||
|
||||
|
||||
|
||||
cart()
|
||||
@ -59,6 +65,17 @@ class ShopActivity : BaseActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun setUpPage() {
|
||||
val layoutManager = GridLayoutManager(baseContext, 2)
|
||||
rvShop.layoutManager = layoutManager
|
||||
rvShop.isNestedScrollingEnabled = false
|
||||
|
||||
products = ArrayList()
|
||||
|
||||
adapter = ProductAdapter(products)
|
||||
rvShop.adapter = adapter
|
||||
}
|
||||
|
||||
private fun filter() {
|
||||
val filter = ProductFilter()
|
||||
|
||||
|
||||
@ -1,18 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.constraint.ConstraintLayout
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/bg"
|
||||
android:orientation="vertical"
|
||||
>
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="16dp"
|
||||
android:id="@+id/rvCategory"
|
||||
>
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="16dp"
|
||||
android:id="@+id/rvCategory"
|
||||
android:elevation="2dp"
|
||||
android:background="@drawable/rect_white"
|
||||
>
|
||||
|
||||
</android.support.v7.widget.RecyclerView>
|
||||
</android.support.v7.widget.RecyclerView>
|
||||
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
</LinearLayout>
|
||||
@ -1,43 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:background="@drawable/rect_white"
|
||||
android:elevation="2dp"
|
||||
android:orientation="vertical"
|
||||
tools:ignore="MissingPrefix">
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
tools:ignore="MissingPrefix">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTitle"
|
||||
fontPath="@string/font_medium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:gravity="left"
|
||||
android:textColor="@color/text"
|
||||
android:textSize="18sp" />
|
||||
<TextView
|
||||
android:id="@+id/tvTitle"
|
||||
fontPath="@string/font_regular"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="16dp"
|
||||
android:gravity="left"
|
||||
android:textColor="@color/text_black_4"
|
||||
android:textSize="16sp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvDescription"
|
||||
fontPath="@string/font_regular"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:gravity="left"
|
||||
android:maxLines="2"
|
||||
android:lineSpacingMultiplier="1.2"
|
||||
android:textColor="@color/text_black_5"
|
||||
android:textSize="14sp" />
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/bg"
|
||||
/>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user