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