Skip to content

layouts activity_cart, activity_contacts, cart_list_item and dialog_signin have been added #43

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ android {
namespace = "otus.gpb.homework.viewandresources"
defaultConfig {
applicationId "otus.gpb.homework.viewandresources"
minSdk 23
minSdk 26
targetSdk 35
versionCode 1
versionName "1.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,24 @@ package otus.gpb.homework.viewandresources

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.RecyclerView

class CartActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_cart)

val recyclerView: RecyclerView = findViewById(R.id.cart_rv)
recyclerView.addItemDecoration(DividerItemDecoration(this, DividerItemDecoration.VERTICAL))

val cartItemsList = listOf(
CartItem("List item 1","Category", getString(R.string.card_description), "$35"),
CartItem("List item 2","Category", getString(R.string.card_description), "$35"),
CartItem("List item 3","Category", getString(R.string.card_description), "$35"),
CartItem("List item 4","Category", getString(R.string.card_description), "$35"),
)

recyclerView.adapter = CartItemViewAdapter(cartItemsList)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package otus.gpb.homework.viewandresources

data class CartItem(
val name: String?,
val category: String?,
val description: String?,
val price: String?
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package otus.gpb.homework.viewandresources

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

class CartItemViewAdapter(private var cartItem: List<CartItem>) :
RecyclerView.Adapter<CartItemViewAdapter.CartItemViewHolder>() {

class CartItemViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
val name: TextView = itemView.findViewById(R.id.cart_item_title_tv)
val category: TextView = itemView.findViewById(R.id.cart_item_category_tv)
val description: TextView = itemView.findViewById(R.id.cart_item_description_tv)
val price: TextView = itemView.findViewById(R.id.cart_item_price_tv)
val itemImage: ImageView = itemView.findViewById(R.id.cart_item_iv)
}

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

override fun getItemCount(): Int {
return cartItem.size
}

override fun onBindViewHolder(holder: CartItemViewHolder, position: Int) {
val item = cartItem[position]
holder.itemImage.setImageResource(R.drawable.ic_cart_item)
holder.name.text = item.name
holder.category.text = item.category
holder.description.text = item.description
holder.price.text = item.price
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ class ContactsActivity : AppCompatActivity() {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_contacts)
}
}
}
13 changes: 13 additions & 0 deletions app/src/main/res/drawable/ic_address.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="48"
android:viewportHeight="48">
<group>
<clip-path
android:pathData="M24,4L24,4A20,20 0,0 1,44 24L44,24A20,20 0,0 1,24 44L24,44A20,20 0,0 1,4 24L4,24A20,20 0,0 1,24 4z"/>
<path
android:pathData="M17,33V17C17,16.45 17.196,15.979 17.587,15.587C17.979,15.196 18.45,15 19,15H29C29.55,15 30.021,15.196 30.413,15.587C30.804,15.979 31,16.45 31,17V33L24,30L17,33ZM19,29.95L24,27.8L29,29.95V17H19V29.95Z"
android:fillColor="?attr/colorOnSurface"/>
</group>
</vector>
13 changes: 13 additions & 0 deletions app/src/main/res/drawable/ic_back_arrow.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="48"
android:viewportHeight="48">
<group>
<clip-path
android:pathData="M24,4L24,4A20,20 0,0 1,44 24L44,24A20,20 0,0 1,24 44L24,44A20,20 0,0 1,4 24L4,24A20,20 0,0 1,24 4z"/>
<path
android:pathData="M19.825,25L25.425,30.6L24,32L16,24L24,16L25.425,17.4L19.825,23H32V25H19.825Z"
android:fillColor="?attr/colorOnSurface"/>
</group>
</vector>
Binary file added app/src/main/res/drawable/ic_cart_item.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/ic_clip.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M11.5,22C9.967,22 8.667,21.467 7.6,20.4C6.533,19.333 6,18.033 6,16.5V6C6,4.9 6.392,3.958 7.175,3.175C7.958,2.392 8.9,2 10,2C11.1,2 12.042,2.392 12.825,3.175C13.608,3.958 14,4.9 14,6V15.5C14,16.2 13.758,16.792 13.275,17.275C12.792,17.758 12.2,18 11.5,18C10.8,18 10.208,17.758 9.725,17.275C9.242,16.792 9,16.2 9,15.5V6H10.5V15.5C10.5,15.783 10.596,16.021 10.788,16.212C10.979,16.404 11.217,16.5 11.5,16.5C11.783,16.5 12.021,16.404 12.212,16.212C12.404,16.021 12.5,15.783 12.5,15.5V6C12.5,5.3 12.258,4.708 11.775,4.225C11.292,3.742 10.7,3.5 10,3.5C9.3,3.5 8.708,3.742 8.225,4.225C7.742,4.708 7.5,5.3 7.5,6V16.5C7.5,17.6 7.892,18.542 8.675,19.325C9.458,20.108 10.4,20.5 11.5,20.5C12.6,20.5 13.542,20.108 14.325,19.325C15.108,18.542 15.5,17.6 15.5,16.5V6H17V16.5C17,18.033 16.467,19.333 15.4,20.4C14.333,21.467 13.033,22 11.5,22Z"
android:fillColor="?attr/colorOnSurfaceVariant"/>
</vector>
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/ic_close.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M8.4,17L12,13.4L15.6,17L17,15.6L13.4,12L17,8.4L15.6,7L12,10.6L8.4,7L7,8.4L10.6,12L7,15.6L8.4,17ZM12,22C10.617,22 9.317,21.737 8.1,21.212C6.883,20.688 5.825,19.975 4.925,19.075C4.025,18.175 3.313,17.117 2.787,15.9C2.263,14.683 2,13.383 2,12C2,10.617 2.263,9.317 2.787,8.1C3.313,6.883 4.025,5.825 4.925,4.925C5.825,4.025 6.883,3.313 8.1,2.787C9.317,2.263 10.617,2 12,2C13.383,2 14.683,2.263 15.9,2.787C17.117,3.313 18.175,4.025 19.075,4.925C19.975,5.825 20.688,6.883 21.212,8.1C21.737,9.317 22,10.617 22,12C22,13.383 21.737,14.683 21.212,15.9C20.688,17.117 19.975,18.175 19.075,19.075C18.175,19.975 17.117,20.688 15.9,21.212C14.683,21.737 13.383,22 12,22ZM12,20C14.233,20 16.125,19.225 17.675,17.675C19.225,16.125 20,14.233 20,12C20,9.767 19.225,7.875 17.675,6.325C16.125,4.775 14.233,4 12,4C9.767,4 7.875,4.775 6.325,6.325C4.775,7.875 4,9.767 4,12C4,14.233 4.775,16.125 6.325,17.675C7.875,19.225 9.767,20 12,20Z"
android:fillColor="?attr/colorOnSurfaceVariant"/>
</vector>
13 changes: 13 additions & 0 deletions app/src/main/res/drawable/ic_date.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="48"
android:viewportHeight="48">
<group>
<clip-path
android:pathData="M24,4L24,4A20,20 0,0 1,44 24L44,24A20,20 0,0 1,24 44L24,44A20,20 0,0 1,4 24L4,24A20,20 0,0 1,24 4z"/>
<path
android:pathData="M21,28.5C20.3,28.5 19.708,28.258 19.225,27.775C18.742,27.292 18.5,26.7 18.5,26C18.5,25.3 18.742,24.708 19.225,24.225C19.708,23.742 20.3,23.5 21,23.5C21.7,23.5 22.292,23.742 22.775,24.225C23.258,24.708 23.5,25.3 23.5,26C23.5,26.7 23.258,27.292 22.775,27.775C22.292,28.258 21.7,28.5 21,28.5ZM17,34C16.45,34 15.979,33.804 15.587,33.412C15.196,33.021 15,32.55 15,32V18C15,17.45 15.196,16.979 15.587,16.587C15.979,16.196 16.45,16 17,16H18V14H20V16H28V14H30V16H31C31.55,16 32.021,16.196 32.412,16.587C32.804,16.979 33,17.45 33,18V32C33,32.55 32.804,33.021 32.412,33.412C32.021,33.804 31.55,34 31,34H17ZM17,32H31V22H17V32Z"
android:fillColor="?attr/colorOnSurface"/>
</group>
</vector>
13 changes: 13 additions & 0 deletions app/src/main/res/drawable/ic_menu.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="48"
android:viewportHeight="48">
<group>
<clip-path
android:pathData="M24,4L24,4A20,20 0,0 1,44 24L44,24A20,20 0,0 1,24 44L24,44A20,20 0,0 1,4 24L4,24A20,20 0,0 1,24 4z"/>
<path
android:pathData="M15,30V28H33V30H15ZM15,25V23H33V25H15ZM15,20V18H33V20H15Z"
android:fillColor="?attr/colorOnSurface"/>
</group>
</vector>
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/ic_mood.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="19dp"
android:height="18dp"
android:viewportWidth="19"
android:viewportHeight="18">
<path
android:pathData="M12.125,8.25C12.438,8.25 12.703,8.141 12.922,7.922C13.141,7.703 13.25,7.438 13.25,7.125C13.25,6.813 13.141,6.547 12.922,6.328C12.703,6.109 12.438,6 12.125,6C11.813,6 11.547,6.109 11.328,6.328C11.109,6.547 11,6.813 11,7.125C11,7.438 11.109,7.703 11.328,7.922C11.547,8.141 11.813,8.25 12.125,8.25ZM6.875,8.25C7.188,8.25 7.453,8.141 7.672,7.922C7.891,7.703 8,7.438 8,7.125C8,6.813 7.891,6.547 7.672,6.328C7.453,6.109 7.188,6 6.875,6C6.563,6 6.297,6.109 6.078,6.328C5.859,6.547 5.75,6.813 5.75,7.125C5.75,7.438 5.859,7.703 6.078,7.922C6.297,8.141 6.563,8.25 6.875,8.25ZM9.5,13.125C10.35,13.125 11.122,12.884 11.816,12.403C12.509,11.922 13.012,11.288 13.325,10.5H5.675C5.988,11.288 6.491,11.922 7.184,12.403C7.878,12.884 8.65,13.125 9.5,13.125ZM9.5,16.5C8.462,16.5 7.488,16.303 6.575,15.909C5.662,15.516 4.869,14.981 4.194,14.306C3.519,13.631 2.984,12.837 2.591,11.925C2.197,11.012 2,10.038 2,9C2,7.963 2.197,6.988 2.591,6.075C2.984,5.162 3.519,4.369 4.194,3.694C4.869,3.019 5.662,2.484 6.575,2.091C7.488,1.697 8.462,1.5 9.5,1.5C10.538,1.5 11.512,1.697 12.425,2.091C13.337,2.484 14.131,3.019 14.806,3.694C15.481,4.369 16.016,5.162 16.409,6.075C16.803,6.988 17,7.963 17,9C17,10.038 16.803,11.012 16.409,11.925C16.016,12.837 15.481,13.631 14.806,14.306C14.131,14.981 13.337,15.516 12.425,15.909C11.512,16.303 10.538,16.5 9.5,16.5ZM9.5,15C11.175,15 12.594,14.419 13.756,13.256C14.919,12.094 15.5,10.675 15.5,9C15.5,7.325 14.919,5.906 13.756,4.744C12.594,3.581 11.175,3 9.5,3C7.825,3 6.406,3.581 5.244,4.744C4.081,5.906 3.5,7.325 3.5,9C3.5,10.675 4.081,12.094 5.244,13.256C6.406,14.419 7.825,15 9.5,15Z"
android:fillColor="?attr/colorOnPrimary"/>
</vector>
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/ic_more.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M12,20C11.45,20 10.979,19.804 10.587,19.413C10.196,19.021 10,18.55 10,18C10,17.45 10.196,16.979 10.587,16.587C10.979,16.196 11.45,16 12,16C12.55,16 13.021,16.196 13.413,16.587C13.804,16.979 14,17.45 14,18C14,18.55 13.804,19.021 13.413,19.413C13.021,19.804 12.55,20 12,20ZM12,14C11.45,14 10.979,13.804 10.587,13.413C10.196,13.021 10,12.55 10,12C10,11.45 10.196,10.979 10.587,10.587C10.979,10.196 11.45,10 12,10C12.55,10 13.021,10.196 13.413,10.587C13.804,10.979 14,11.45 14,12C14,12.55 13.804,13.021 13.413,13.413C13.021,13.804 12.55,14 12,14ZM12,8C11.45,8 10.979,7.804 10.587,7.412C10.196,7.021 10,6.55 10,6C10,5.45 10.196,4.979 10.587,4.588C10.979,4.196 11.45,4 12,4C12.55,4 13.021,4.196 13.413,4.588C13.804,4.979 14,5.45 14,6C14,6.55 13.804,7.021 13.413,7.412C13.021,7.804 12.55,8 12,8Z"
android:fillColor="?attr/colorOnSurfaceVariant"/>
</vector>
13 changes: 13 additions & 0 deletions app/src/main/res/drawable/ic_notes.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="48"
android:viewportHeight="48">
<group>
<clip-path
android:pathData="M24,4L24,4A20,20 0,0 1,44 24L44,24A20,20 0,0 1,24 44L24,44A20,20 0,0 1,4 24L4,24A20,20 0,0 1,24 4z"/>
<path
android:pathData="M24,26C23.167,26 22.458,25.708 21.875,25.125C21.292,24.542 21,23.833 21,23V17C21,16.167 21.292,15.458 21.875,14.875C22.458,14.292 23.167,14 24,14C24.833,14 25.542,14.292 26.125,14.875C26.708,15.458 27,16.167 27,17V23C27,23.833 26.708,24.542 26.125,25.125C25.542,25.708 24.833,26 24,26ZM23,33V29.925C21.267,29.692 19.833,28.917 18.7,27.6C17.567,26.283 17,24.75 17,23H19C19,24.383 19.487,25.563 20.462,26.538C21.438,27.513 22.617,28 24,28C25.383,28 26.563,27.513 27.538,26.538C28.513,25.563 29,24.383 29,23H31C31,24.75 30.433,26.283 29.3,27.6C28.167,28.917 26.733,29.692 25,29.925V33H23Z"
android:fillColor="?attr/colorOnSurface"/>
</group>
</vector>
13 changes: 13 additions & 0 deletions app/src/main/res/drawable/ic_phone.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="48"
android:viewportHeight="48">
<group>
<clip-path
android:pathData="M24,4L24,4A20,20 0,0 1,44 24L44,24A20,20 0,0 1,24 44L24,44A20,20 0,0 1,4 24L4,24A20,20 0,0 1,24 4z"/>
<path
android:pathData="M18,35C17.45,35 16.979,34.804 16.587,34.412C16.196,34.021 16,33.55 16,33V15C16,14.45 16.196,13.979 16.587,13.587C16.979,13.196 17.45,13 18,13H28C28.55,13 29.021,13.196 29.413,13.587C29.804,13.979 30,14.45 30,15V19H28V18H18V30H28V29H30V33C30,33.55 29.804,34.021 29.413,34.412C29.021,34.804 28.55,35 28,35H18ZM18,32V33H28V32H18ZM26.95,28L22.7,23.75L24.1,22.35L26.95,25.2L32.6,19.55L34,20.95L26.95,28ZM18,16H28V15H18V16Z"
android:fillColor="?attr/colorOnSurfaceVariant"/>
</group>
</vector>
13 changes: 13 additions & 0 deletions app/src/main/res/drawable/ic_profile.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="48"
android:viewportHeight="48">
<group>
<clip-path
android:pathData="M24,4L24,4A20,20 0,0 1,44 24L44,24A20,20 0,0 1,24 44L24,44A20,20 0,0 1,4 24L4,24A20,20 0,0 1,24 4z"/>
<path
android:pathData="M17.85,29.1C18.7,28.45 19.65,27.938 20.7,27.563C21.75,27.188 22.85,27 24,27C25.15,27 26.25,27.188 27.3,27.563C28.35,27.938 29.3,28.45 30.15,29.1C30.733,28.417 31.188,27.642 31.513,26.775C31.837,25.908 32,24.983 32,24C32,21.783 31.221,19.896 29.663,18.337C28.104,16.779 26.217,16 24,16C21.783,16 19.896,16.779 18.337,18.337C16.779,19.896 16,21.783 16,24C16,24.983 16.163,25.908 16.487,26.775C16.813,27.642 17.267,28.417 17.85,29.1ZM24,25C23.017,25 22.188,24.663 21.513,23.987C20.837,23.313 20.5,22.483 20.5,21.5C20.5,20.517 20.837,19.688 21.513,19.013C22.188,18.337 23.017,18 24,18C24.983,18 25.813,18.337 26.487,19.013C27.163,19.688 27.5,20.517 27.5,21.5C27.5,22.483 27.163,23.313 26.487,23.987C25.813,24.663 24.983,25 24,25ZM24,34C22.617,34 21.317,33.737 20.1,33.213C18.883,32.688 17.825,31.975 16.925,31.075C16.025,30.175 15.313,29.117 14.788,27.9C14.262,26.683 14,25.383 14,24C14,22.617 14.262,21.317 14.788,20.1C15.313,18.883 16.025,17.825 16.925,16.925C17.825,16.025 18.883,15.313 20.1,14.788C21.317,14.262 22.617,14 24,14C25.383,14 26.683,14.262 27.9,14.788C29.117,15.313 30.175,16.025 31.075,16.925C31.975,17.825 32.688,18.883 33.213,20.1C33.737,21.317 34,22.617 34,24C34,25.383 33.737,26.683 33.213,27.9C32.688,29.117 31.975,30.175 31.075,31.075C30.175,31.975 29.117,32.688 27.9,33.213C26.683,33.737 25.383,34 24,34Z"
android:fillColor="?attr/colorOnSurfaceVariant"/>
</group>
</vector>
13 changes: 13 additions & 0 deletions app/src/main/res/drawable/iv_show_password.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="48"
android:viewportHeight="48">
<group>
<clip-path
android:pathData="M24,4L24,4A20,20 0,0 1,44 24L44,24A20,20 0,0 1,24 44L24,44A20,20 0,0 1,4 24L4,24A20,20 0,0 1,24 4z"/>
<path
android:pathData="M24,27C24.833,27 25.542,26.708 26.125,26.125C26.708,25.542 27,24.833 27,24C27,23.167 26.708,22.458 26.125,21.875C25.542,21.292 24.833,21 24,21C23.167,21 22.458,21.292 21.875,21.875C21.292,22.458 21,23.167 21,24C21,24.833 21.292,25.542 21.875,26.125C22.458,26.708 23.167,27 24,27ZM24,29C22.617,29 21.438,28.513 20.462,27.538C19.487,26.563 19,25.383 19,24C19,22.617 19.487,21.438 20.462,20.462C21.438,19.487 22.617,19 24,19C25.383,19 26.563,19.487 27.538,20.462C28.513,21.438 29,22.617 29,24C29,25.383 28.513,26.563 27.538,27.538C26.563,28.513 25.383,29 24,29ZM17,25H13V23H17V25ZM35,25H31V23H35V25ZM23,17V13H25V17H23ZM23,35V31H25V35H23ZM18.4,19.75L15.875,17.325L17.3,15.85L19.7,18.35L18.4,19.75ZM30.7,32.15L28.275,29.625L29.6,28.25L32.125,30.675L30.7,32.15ZM28.25,18.4L30.675,15.875L32.15,17.3L29.65,19.7L28.25,18.4ZM15.85,30.7L18.375,28.275L19.75,29.6L17.325,32.125L15.85,30.7Z"
android:fillColor="?attr/colorOnSurfaceVariant"/>
</group>
</vector>
Loading