Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
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
3 changes: 2 additions & 1 deletion 3 app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ android {
dependencies {
implementation 'androidx.core:core-ktx:1.15.0'
implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'com.google.android.material:material:1.12.0'
implementation 'com.google.android.material:material:1.11.0'
implementation 'androidx.constraintlayout:constraintlayout:2.2.0'
implementation 'androidx.recyclerview:recyclerview:1.4.0'
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,50 @@ package otus.gpb.homework.viewandresources

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.Menu
import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.appbar.MaterialToolbar

class CartActivity : AppCompatActivity() {

private lateinit var toolbar: MaterialToolbar

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

toolbar = findViewById<MaterialToolbar>(R.id.topAppBar)
setSupportActionBar(toolbar)
toolbar.title = "Cart"
val recyclerView: RecyclerView = findViewById(R.id.recyclerViewItems)
recyclerView.layoutManager = LinearLayoutManager(this)


recyclerView.addItemDecoration(
DividerItemDecoration(this, DividerItemDecoration.VERTICAL))
val listItems = getItemList()
recyclerView.adapter = CustomRecyclerAdapter(listItems)

}

private fun getItemList(): List<Item>{
val res = mutableListOf<Item>()
repeat(200) {
val item = Item(). apply {
title = "Title $it"
category = "Category $it"
price = (10..100).random()
}
res.add(item)
}
return res
}

override fun onCreateOptionsMenu(menu: Menu?): Boolean {
val inflater = menuInflater
inflater.inflate(R.menu.top_app_bar_cart, menu)
return super.onCreateOptionsMenu(menu)
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,37 @@
package otus.gpb.homework.viewandresources

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.Menu
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import com.google.android.material.appbar.MaterialToolbar


class ContactsActivity : AppCompatActivity() {
private lateinit var toolbar: MaterialToolbar

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
enableEdgeToEdge()
setContentView(R.layout.activity_contacts)
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.contacts)) { v, insets ->
val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
insets
}

toolbar = findViewById<MaterialToolbar>(R.id.topAppBar)
setSupportActionBar(toolbar)
toolbar.title = "Contacts"

}


override fun onCreateOptionsMenu(menu: Menu?): Boolean {
val inflater = menuInflater
inflater.inflate(R.menu.top_app_bar, menu)
return super.onCreateOptionsMenu(menu)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package otus.gpb.homework.viewandresources

import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.textview.MaterialTextView

class CustomRecyclerAdapter(private val items: List<Item>):
RecyclerView.Adapter<CustomRecyclerAdapter.MyViewHolder>() {

class MyViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
val title = itemView.findViewById<MaterialTextView>(R.id.textViewTitle)
val category = itemView.findViewById<MaterialTextView>(R.id.textViewCategory)
val priceItem = itemView.findViewById<MaterialTextView>(R.id.textViewPriceItem)
val imageItem = itemView.findViewById<ImageView>(R.id.imageView)
val description = itemView.findViewById<MaterialTextView>(R.id.textViewDescription)
}

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

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

override fun onBindViewHolder(holder: MyViewHolder, position: Int) {
val item = items[position]
holder.title.text = item.title
holder.category.text = item.category
holder.priceItem.text = item.price.toString()
holder.description.text = item.description
holder.imageItem.setImageResource(R.drawable.cat)
}
fun <T> myList(vararg i: T) = arrayListOf(*i)
val list = myList(1, 5, 3, 2, 4)
}

interface My1
9 changes: 9 additions & 0 deletions 9 app/src/main/java/otus/gpb/homework/viewandresources/Item.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package otus.gpb.homework.viewandresources

class Item {
var title: String = "title"
var category: String = "category"
var price: Int = 0
var image: Int = R.drawable.cat
var description: String = "description"
}
5 changes: 5 additions & 0 deletions 5 app/src/main/res/drawable/baseline_cancel_24.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#000000" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp">

<path android:fillColor="@android:color/white" android:pathData="M12,2C6.47,2 2,6.47 2,12s4.47,10 10,10 10,-4.47 10,-10S17.53,2 12,2zM17,15.59L15.59,17 12,13.41 8.41,17 7,15.59 10.59,12 7,8.41 8.41,7 12,10.59 15.59,7 17,8.41 13.41,12 17,15.59z"/>

</vector>
9 changes: 9 additions & 0 deletions 9 app/src/main/res/drawable/bookmark_24dp.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="960"
android:viewportHeight="960">
<path
android:pathData="M200,840v-640q0,-33 23.5,-56.5T280,120h400q33,0 56.5,23.5T760,200v640L480,720 200,840ZM280,718 L480,632 680,718v-518L280,200v518ZM280,200h400,-400Z"
android:fillColor="#1f1f1f"/>
</vector>
9 changes: 9 additions & 0 deletions 9 app/src/main/res/drawable/calendar_24dp.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="960"
android:viewportHeight="960">
<path
android:pathData="M360,660q-42,0 -71,-29t-29,-71q0,-42 29,-71t71,-29q42,0 71,29t29,71q0,42 -29,71t-71,29ZM200,880q-33,0 -56.5,-23.5T120,800v-560q0,-33 23.5,-56.5T200,160h40v-80h80v80h320v-80h80v80h40q33,0 56.5,23.5T840,240v560q0,33 -23.5,56.5T760,880L200,880ZM200,800h560v-400L200,400v400ZM200,320h560v-80L200,240v80ZM200,320v-80,80Z"
android:fillColor="#1f1f1f"/>
</vector>
Binary file added BIN +792 KB app/src/main/res/drawable/cat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions 5 app/src/main/res/drawable/check_circle_outline_24.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#000000" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp">

<path android:fillColor="@android:color/white" android:pathData="M16.59,7.58L10,14.17l-3.59,-3.58L5,12l5,5 8,-8zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.42,0 -8,-3.58 -8,-8s3.58,-8 8,-8 8,3.58 8,8 -3.58,8 -8,8z"/>

</vector>
9 changes: 9 additions & 0 deletions 9 app/src/main/res/drawable/dollar_ico.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="960"
android:viewportHeight="960">
<path
android:pathData="M441,840v-86q-53,-12 -91.5,-46T293,612l74,-30q15,48 44.5,73t77.5,25q41,0 69.5,-18.5T587,604q0,-35 -22,-55.5T463,502q-86,-27 -118,-64.5T313,346q0,-65 42,-101t86,-41v-84h80v84q50,8 82.5,36.5T651,310l-74,32q-12,-32 -34,-48t-60,-16q-44,0 -67,19.5T393,346q0,33 30,52t104,40q69,20 104.5,63.5T667,602q0,71 -42,108t-104,46v84h-80Z"
android:fillColor="#1f1f1f"/>
</vector>
9 changes: 9 additions & 0 deletions 9 app/src/main/res/drawable/ic_attach.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="960"
android:viewportHeight="960">
<path
android:pathData="M720,630q0,104 -73,177T470,880q-104,0 -177,-73t-73,-177v-370q0,-75 52.5,-127.5T400,80q75,0 127.5,52.5T580,260v350q0,46 -32,78t-78,32q-46,0 -78,-32t-32,-78v-370h80v370q0,13 8.5,21.5T470,640q13,0 21.5,-8.5T500,610v-350q-1,-42 -29.5,-71T400,160q-42,0 -71,29t-29,71v370q-1,71 49,120.5T470,800q70,0 119,-49.5T640,630v-390h80v390Z"
android:fillColor="#1f1f1f"/>
</vector>
9 changes: 9 additions & 0 deletions 9 app/src/main/res/drawable/mic_24dp.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="960"
android:viewportHeight="960">
<path
android:pathData="M480,560q-50,0 -85,-35t-35,-85v-240q0,-50 35,-85t85,-35q50,0 85,35t35,85v240q0,50 -35,85t-85,35ZM480,320ZM440,840v-123q-104,-14 -172,-93t-68,-184h80q0,83 58.5,141.5T480,640q83,0 141.5,-58.5T680,440h80q0,105 -68,184t-172,93v123h-80ZM480,480q17,0 28.5,-11.5T520,440v-240q0,-17 -11.5,-28.5T480,160q-17,0 -28.5,11.5T440,200v240q0,17 11.5,28.5T480,480Z"
android:fillColor="#1f1f1f"/>
</vector>
9 changes: 9 additions & 0 deletions 9 app/src/main/res/drawable/person_24dp.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="960"
android:viewportHeight="960">
<path
android:pathData="M480,480q-66,0 -113,-47t-47,-113q0,-66 47,-113t113,-47q66,0 113,47t47,113q0,66 -47,113t-113,47ZM160,800v-112q0,-34 17.5,-62.5T224,582q62,-31 126,-46.5T480,520q66,0 130,15.5T736,582q29,15 46.5,43.5T800,688v112L160,800ZM240,720h480v-32q0,-11 -5.5,-20T700,654q-54,-27 -109,-40.5T480,600q-56,0 -111,13.5T260,654q-9,5 -14.5,14t-5.5,20v32ZM480,400q33,0 56.5,-23.5T560,320q0,-33 -23.5,-56.5T480,240q-33,0 -56.5,23.5T400,320q0,33 23.5,56.5T480,400ZM480,320ZM480,720Z"
android:fillColor="#1f1f1f"/>
</vector>
6 changes: 6 additions & 0 deletions 6 app/src/main/res/drawable/round_outline.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="16dp"/>
<solid android:color="@android:color/transparent"/>
</shape>
5 changes: 5 additions & 0 deletions 5 app/src/main/res/drawable/smartphone.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="23.955555dp" android:viewportHeight="22" android:viewportWidth="18" android:width="19.6dp">

<path android:fillColor="#C4C6CF" android:pathData="M12.5,17V16.5H13.5V20C13.5,20.416 13.358,20.76 13.059,21.059C12.76,21.358 12.416,21.5 12,21.5H2C1.584,21.5 1.24,21.358 0.941,21.059C0.642,20.76 0.5,20.416 0.5,20V2C0.5,1.584 0.642,1.24 0.941,0.941C1.24,0.642 1.584,0.5 2,0.5H12C12.416,0.5 12.76,0.642 13.059,0.941C13.358,1.24 13.5,1.584 13.5,2V5.5H12.5V5V4.5H12H2H1.5V5V17V17.5H2H12H12.5V17ZM2,18.5H1.5V19V20V20.5H2H12H12.5V20V19V18.5H12H2ZM11.304,12.554L16.6,7.257L17.293,7.95L10.95,14.293L7.407,10.75L8.1,10.057L10.596,12.554L10.95,12.907L11.304,12.554ZM1.5,3V3.5H2H12H12.5V3V2V1.5H12H2H1.5V2V3Z" android:strokeColor="#000000" android:strokeWidth="1"/>

</vector>
9 changes: 9 additions & 0 deletions 9 app/src/main/res/drawable/sunny_24dp.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="960"
android:viewportHeight="960">
<path
android:pathData="M440,200v-160h80v160h-80ZM706,310 L651,255 763,140 819,197 706,310ZM760,520v-80h160v80L760,520ZM440,920v-160h80v160h-80ZM254,308 L140,197l57,-56 113,113 -56,54ZM762,820L651,705l54,-54 114,110 -57,59ZM40,520v-80h160v80L40,520ZM197,820 L141,763 253,651 282,678 311,706 197,820ZM480,720q-100,0 -170,-70t-70,-170q0,-100 70,-170t170,-70q100,0 170,70t70,170q0,100 -70,170t-170,70ZM480,640q66,0 113,-47t47,-113q0,-66 -47,-113t-113,-47q-66,0 -113,47t-47,113q0,66 47,113t113,47ZM480,480Z"
android:fillColor="#1f1f1f"/>
</vector>
9 changes: 9 additions & 0 deletions 9 app/src/main/res/drawable/west_24px.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="960"
android:viewportHeight="960">
<path
android:pathData="m313,520 l224,224 -57,56 -320,-320 320,-320 57,56 -224,224h487v80L313,520Z"
android:fillColor="#1f1f1f"/>
</vector>
5 changes: 5 additions & 0 deletions 5 app/src/main/res/font-v26/roboto.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<font-family xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Regular Roboto -->
<font android:font="@font/roboto_regular" android:fontStyle="normal"/>
</font-family>
Binary file added BIN +149 KB app/src/main/res/font/roboto_italic.ttf
Binary file not shown.
Binary file added BIN +143 KB app/src/main/res/font/roboto_light.ttf
Binary file not shown.
Binary file added BIN +143 KB app/src/main/res/font/roboto_medium.ttf
Binary file not shown.
Binary file added BIN +143 KB app/src/main/res/font/roboto_regular.ttf
Binary file not shown.
Binary file added BIN +143 KB app/src/main/res/font/roboto_semibold.ttf
Binary file not shown.
Binary file added BIN +149 KB app/src/main/res/font/roboto_semibolditalic.ttf
Binary file not shown.
Binary file added BIN +143 KB app/src/main/res/font/roboto_thin.ttf
Binary file not shown.
Binary file added BIN +148 KB app/src/main/res/font/roboto_thinitalic.ttf
Binary file not shown.
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.