Skip to content

Commit

Permalink
Dashboard Page UI
Browse files Browse the repository at this point in the history
  • Loading branch information
Suswan114 committed Mar 6, 2022
1 parent 14368ef commit 2189252
Show file tree
Hide file tree
Showing 6 changed files with 372 additions and 0 deletions.
32 changes: 32 additions & 0 deletions app/src/main/java/com/hazard/samarpan/ClothAdapter.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.hazard.samarpan

import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import androidx.recyclerview.widget.RecyclerView

class ClothAdapter(var clothList: ArrayList<Int>) :
RecyclerView.Adapter<ClothAdapter.ViewHolder>() {

override fun getItemCount() =clothList.size

override fun onBindViewHolder(holder: ClothAdapter.ViewHolder, position: Int) {
holder.clothImage.setImageDrawable(holder.itemView.context.getDrawable(clothList[position]))

}

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ClothAdapter.ViewHolder {
val view: View=LayoutInflater.from(parent.context).inflate(R.layout.clothing_item_dashboard,parent,false)
return ViewHolder(view)
}



class ViewHolder(itemView: View):RecyclerView.ViewHolder(itemView){
var clothImage: ImageView=itemView.findViewById(R.id.cloth_image)


}
}

36 changes: 36 additions & 0 deletions app/src/main/java/com/hazard/samarpan/DashboardFragment.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package com.hazard.samarpan
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView

class DashboardFragment : Fragment() {

public lateinit var clothRecycler: RecyclerView

override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {

val v = layoutInflater.inflate(R.layout.dashboard_fragment, container, false)

var clothList: ArrayList<Int> = ArrayList()
for(i in 1..15){
clothList.add(R.drawable.ic_uploadimage)
}


clothRecycler = v.findViewById(R.id.clothing_recycler)
clothRecycler.layoutManager=LinearLayoutManager(activity,LinearLayoutManager.HORIZONTAL,false)
clothRecycler.adapter=ClothAdapter(clothList)


return v

}
}
5 changes: 5 additions & 0 deletions app/src/main/res/drawable/ic_baseline_add_24.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/>
</vector>
10 changes: 10 additions & 0 deletions app/src/main/res/drawable/ic_baseline_perm_identity_24.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M12,5.9c1.16,0 2.1,0.94 2.1,2.1s-0.94,2.1 -2.1,2.1S9.9,9.16 9.9,8s0.94,-2.1 2.1,-2.1m0,9c2.97,0 6.1,1.46 6.1,2.1v1.1L5.9,18.1L5.9,17c0,-0.64 3.13,-2.1 6.1,-2.1M12,4C9.79,4 8,5.79 8,8s1.79,4 4,4 4,-1.79 4,-4 -1.79,-4 -4,-4zM12,13c-2.67,0 -8,1.34 -8,4v3h16v-3c0,-2.66 -5.33,-4 -8,-4z"/>
</vector>
21 changes: 21 additions & 0 deletions app/src/main/res/layout/clothing_item_dashboard.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="17dp"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="horizontal">
<androidx.cardview.widget.CardView
android:layout_width="130dp"
android:layout_height="130dp"
android:id="@+id/clothing_card"
app:cardBackgroundColor="@color/purple_200"
app:cardCornerRadius="20dp">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/cloth_image"
android:src="@drawable/ic_uploadimage"/>
</androidx.cardview.widget.CardView>

</LinearLayout>
268 changes: 268 additions & 0 deletions app/src/main/res/layout/dashboard_fragment.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,268 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:paddingHorizontal="20dp"
android:paddingTop="10dp"
android:background="@color/white">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="2">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1.7"
android:text="@string/app_name"
android:textSize="20sp"
android:fontFamily="@font/righteous"
android:textColor="@color/theme_text_color_heading"/>
<ImageButton
android:layout_width="0dp"
android:layout_height="50dp"
android:layout_weight="0.3"
android:backgroundTint="@color/theme_transparent_button"
android:src="@drawable/ic_baseline_perm_identity_24"
android:id="@+id/profile_button"
app:tint="@color/profile_button_color" />
</LinearLayout>
<ImageView
android:layout_width="match_parent"
android:layout_height="150dp"
android:src="@color/theme_color_light"

android:id="@+id/banner"
android:layout_marginTop="25dp"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="25dp"
android:weightSum="2">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="22sp"
android:text="@string/categories"
android:textColor="@color/theme_text_color_heading"
android:layout_weight="1.5"
android:fontFamily="@font/righteous"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/view_more"
android:layout_weight=".5"
android:textSize="14sp"
android:textColor="@color/theme_text_color_heading"
android:gravity="center"
android:fontFamily="@font/righteous"
/>
</LinearLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp">
<androidx.cardview.widget.CardView
android:layout_width="60dp"
android:layout_height="60dp"
android:id="@+id/cat_1"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:backgroundTint="@color/theme_color_light"
app:cardCornerRadius="30dp"
app:layout_constraintEnd_toStartOf="@id/cat_2">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/ic_uploadimage"
android:padding="13dp"/>
</androidx.cardview.widget.CardView>

<androidx.cardview.widget.CardView
android:layout_width="60dp"
android:layout_height="60dp"
android:id="@+id/cat_2"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toEndOf="@id/cat_1"
android:backgroundTint="@color/theme_color_light"
app:cardCornerRadius="30dp"
app:layout_constraintEnd_toStartOf="@id/cat_3">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/ic_uploadimage"
android:padding="13dp"/>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="60dp"
android:layout_height="60dp"
android:id="@+id/cat_3"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toEndOf="@id/cat_2"
android:backgroundTint="@color/theme_color_light"
app:cardCornerRadius="30dp"
app:layout_constraintEnd_toStartOf="@id/cat_4">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/ic_uploadimage"
android:padding="13dp"/>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="60dp"
android:layout_height="60dp"
android:id="@+id/cat_4"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toEndOf="@id/cat_3"
android:backgroundTint="@color/theme_color_light"
app:cardCornerRadius="30dp"
app:layout_constraintEnd_toEndOf="parent">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/ic_uploadimage"
android:padding="13dp"/>
</androidx.cardview.widget.CardView>

</androidx.constraintlayout.widget.ConstraintLayout>


<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="25dp">
<androidx.cardview.widget.CardView
android:layout_width="60dp"
android:layout_height="60dp"
android:id="@+id/cat_5"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:backgroundTint="@color/theme_color_light"
app:cardCornerRadius="30dp"
app:layout_constraintEnd_toStartOf="@id/cat_6">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/ic_uploadimage"
android:padding="13dp"/>
</androidx.cardview.widget.CardView>

<androidx.cardview.widget.CardView
android:layout_width="60dp"
android:layout_height="60dp"
android:id="@+id/cat_6"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toEndOf="@id/cat_5"
android:backgroundTint="@color/theme_color_light"
app:cardCornerRadius="30dp"
app:layout_constraintEnd_toStartOf="@id/cat_7">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/ic_uploadimage"
android:padding="13dp"/>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="60dp"
android:layout_height="60dp"
android:id="@+id/cat_7"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toEndOf="@id/cat_6"
android:backgroundTint="@color/theme_color_light"
app:cardCornerRadius="30dp"
app:layout_constraintEnd_toStartOf="@id/cat_8">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/ic_uploadimage"
android:padding="13dp"/>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="60dp"
android:layout_height="60dp"
android:id="@+id/cat_8"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toEndOf="@id/cat_7"
android:backgroundTint="@color/theme_color_light"
app:cardCornerRadius="30dp"
app:layout_constraintEnd_toEndOf="parent">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/ic_uploadimage"
android:padding="13dp"/>
</androidx.cardview.widget.CardView>

</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_marginTop="30dp"

android:backgroundTint="@color/theme_color">
<TextView
android:layout_width="match_parent"
android:fontFamily="@font/roboto"
android:layout_height="match_parent"
android:text="@string/book_sharing_text"
android:textSize="24sp"
android:layout_marginHorizontal="10dp"
android:textColor="@color/white"
android:layout_marginTop="10dp"/>
</androidx.cardview.widget.CardView>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="30dp"
android:weightSum="2">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="22sp"
android:text="@string/clothing"
android:fontFamily="@font/righteous"
android:textColor="@color/theme_text_color_heading"
android:layout_weight="1.5"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/view_more"
android:layout_weight=".5"
android:gravity="center"
android:fontFamily="@font/righteous"
android:textColor="@color/theme_text_color_heading"
android:textSize="14sp" />
</LinearLayout>

<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="25dp"
android:orientation="horizontal"
android:id="@+id/clothing_recycler"/>

</LinearLayout>
</androidx.core.widget.NestedScrollView>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_margin="25dp"
android:backgroundTint="@color/theme_color"
android:src="@drawable/ic_baseline_add_24"
/>
</androidx.constraintlayout.widget.ConstraintLayout>

0 comments on commit 2189252

Please sign in to comment.