Skip to content

Сделал домашку по view & Resources #32

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 38 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
6527119
Застопарился на dropdownmenu
nazarovNV Jun 2, 2024
b933e8f
Поулчился автокомплит а не дропдаунменю
nazarovNV Jun 3, 2024
22f324b
Поулчилось сделать дропдаунменю, надо настоить стили
nazarovNV Jun 3, 2024
1afd0ea
Сделал адрес
nazarovNV Jun 3, 2024
a1384ea
Делаю процентное расположение
nazarovNV Jun 9, 2024
c01f23e
Попрвил реакцию на нажатие и верстку второго ряда
nazarovNV Jun 9, 2024
8d26322
Сделал zip
nazarovNV Jun 9, 2024
9e88af4
1
nazarovNV Jun 9, 2024
c339de4
Поправил три элемента, перенес их в линеарлейаут
nazarovNV Jun 9, 2024
03aa074
Делаю кнопку
nazarovNV Jun 9, 2024
58b7ed2
Сделал экран контактов
nazarovNV Jun 9, 2024
e96c2f3
Поправил размер стрелки
nazarovNV Jun 9, 2024
e47a194
Сделал тулбар
nazarovNV Jun 9, 2024
dec474f
Пробую вставить компонент
nazarovNV Jun 10, 2024
d98d49d
Ломается вертка не пойму почему
nazarovNV Jun 10, 2024
0717fb5
Пробую поправить
nazarovNV Jun 12, 2024
6432087
Делаю как лайк дизлайк
nazarovNV Jun 15, 2024
91a0b43
Делаю как лайк дизлайк1
nazarovNV Jun 15, 2024
9b011a9
Сделал составной сниппет
nazarovNV Jun 15, 2024
5775a7d
Осталось сделать кнопку
nazarovNV Jun 15, 2024
6b2987e
Осталось сделать алерт
nazarovNV Jun 15, 2024
25bf057
Осталось сделать алерт1
nazarovNV Jun 15, 2024
4351132
Осталось сделать цвета для темной темы
nazarovNV Jun 15, 2024
273f4ea
Осталось сделать цвета для темной темы
nazarovNV Jun 15, 2024
1094a5d
Осталось сделать цвета для темной темы
nazarovNV Jun 15, 2024
26b14f9
Поправил алерт для темной темы
nazarovNV Jun 15, 2024
992b174
Поправил алерт для темной темы33
nazarovNV Jun 15, 2024
20f5bb4
Поправил контрактс для темной темы
nazarovNV Jun 15, 2024
9c07823
Поправил контрактс для темной темы3
nazarovNV Jun 15, 2024
2910e31
Готово,проверяю
nazarovNV Jun 15, 2024
a3f9d1b
Готово
nazarovNV Jun 15, 2024
d98c500
Поправил первые 3 пункта
nazarovNV Jun 16, 2024
3648e1f
4 пункт
nazarovNV Jun 16, 2024
221a1b7
Поправил 5 пункт
nazarovNV Jun 16, 2024
ca66eac
Пытаюсь решить проблему со скоролом в гор ориентации
nazarovNV Jun 16, 2024
00fab3d
Добавил скролл в контакты
nazarovNV Jun 16, 2024
6f46754
Поправил все замечания
nazarovNV Jun 16, 2024
125f6e8
Поправил все замечания
nazarovNV Jun 16, 2024
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
7 changes: 5 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@ plugins {
}

android {
compileSdk 32
compileSdk 33
buildFeatures {
viewBinding true
}

defaultConfig {
applicationId "otus.gpb.homework.viewandresources"
minSdk 23
targetSdk 32
targetSdk 33
versionCode 1
versionName "1.0"

Expand Down
15 changes: 10 additions & 5 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,24 @@
<activity
android:name=".CartActivity"
android:label="Cart"
android:exported="false" />
<activity
android:name=".ContactsActivity"
android:label="Contacts"
android:exported="false" />
android:exported="true">

</activity>
<activity
android:name=".MainActivity"
android:label="Contacts"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

</activity>
<activity
android:name=".ContactsActivity"
android:exported="true">

</activity>
</application>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,30 @@ package otus.gpb.homework.viewandresources

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.Menu
import android.view.MenuItem
import android.view.View
import android.widget.ImageView
import android.widget.TextView
import androidx.appcompat.widget.Toolbar

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

val toolbar = findViewById<Toolbar>(R.id.toolbar)
setSupportActionBar(toolbar)

}

override fun onCreateOptionsMenu(menu: Menu?): Boolean {
getMenuInflater().inflate(R.menu.card_menu, menu)
return true
}

override fun onOptionsItemSelected(item: MenuItem): Boolean {
val id = item.itemId
return true
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,66 @@
package otus.gpb.homework.viewandresources

import androidx.appcompat.app.AppCompatActivity

import android.os.Bundle
import android.view.Menu
import android.view.MenuItem
import android.widget.ArrayAdapter
import android.widget.AutoCompleteTextView
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.Toolbar
import androidx.core.content.ContentProviderCompat.requireContext


class ContactsActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_contacts)
val toolbar = findViewById<Toolbar>(R.id.toolbar)
setSupportActionBar(toolbar)

val items = resources.getStringArray(R.array.array_for_dropdown1)
val adapter = ArrayAdapter(
this,
R.layout.list_popup_window_item, items
)
val autoComplete2 = findViewById<AutoCompleteTextView>(R.id.autoComplete2)
autoComplete2.setAdapter(adapter)

val items2 = resources.getStringArray(R.array.array_for_dropdown2)
val adapter2 = ArrayAdapter(
this,
R.layout.list_popup_window_item, items2
)
val autoComplete3 = findViewById<AutoCompleteTextView>(R.id.autoComplete3)
autoComplete3.setAdapter(adapter2)




// val COUNTRIES = arrayOf(
// "Belgium", "France", "Italy", "Germany", "Spain"
// )
// val adapter = ArrayAdapter(
// this,
// android.R.layout.simple_dropdown_item_1line, COUNTRIES
// )
// val textView = findViewById<AutoCompleteTextView>(R.id.autocomplete1)
// textView.setAdapter(adapter)


}

override fun onCreateOptionsMenu(menu: Menu?): Boolean {
getMenuInflater().inflate(R.menu.toolbar_menu, menu)
return true

}

override fun onOptionsItemSelected(item: MenuItem): Boolean {
val id = item.itemId
return true


}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package otus.gpb.homework.viewandresources.components

import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.widget.LinearLayout
import androidx.core.content.withStyledAttributes
import otus.gpb.homework.viewandresources.R
import otus.gpb.homework.viewandresources.databinding.CartSnippetBinding

class CartSnippet @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0,
defStyleRes: Int = 0,
) : LinearLayout (context, attrs, defStyleAttr, defStyleRes) {
private val binding : CartSnippetBinding
private var name = ""
init {
binding = CartSnippetBinding.inflate(LayoutInflater.from(context), this)
// initPanel(attrs, defStyleAttr)
initParams(attrs, defStyleAttr)
}

private fun initParams(attrs: AttributeSet?, defStyleAttr: Int) = with(binding) {
context.withStyledAttributes(attrs, R.styleable.CartSnippet, defStyleAttr) {
name = getString(R.styleable.CartSnippet_staffName)?: "Имя"
textViewName.text = name

val imageResId = getResourceId(R.styleable.CartSnippet_ImageRes, 0)
if (imageResId != 0) {
itemImage.setImageResource(imageResId)
}

val description = getString(R.styleable.CartSnippet_Description)?: "Описание"
textViewDescription.text = description

val price = getString(R.styleable.CartSnippet_Price)?: "Цена"
textViewPrice.text = price


}
}


}
7 changes: 7 additions & 0 deletions app/src/main/res/color-night/stroke_color_selector.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:tools="http://schemas.android.com/tools" xmlns:android="http://schemas.android.com/apk/res/android" tools:ignore="MissingDefaultResource">
<item android:state_pressed="true" android:color="@color/alert_stroke_color" />
<item android:state_focused="true" android:color="@color/alert_stroke_color" />
<item android:state_enabled="false" android:color="@color/alert_stroke_color" />
<item android:color="@color/alert_stroke_color" />
</selector>
7 changes: 7 additions & 0 deletions app/src/main/res/color-notnight/stroke_color_selector.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:tools="http://schemas.android.com/tools" xmlns:android="http://schemas.android.com/apk/res/android" tools:ignore="MissingDefaultResource">
<item android:state_pressed="true" android:color="@color/alert_stroke_color" />
<item android:state_focused="true" android:color="@color/alert_stroke_color" />
<item android:state_enabled="false" android:color="@color/alert_stroke_color" />
<item android:color="@color/alert_stroke_color" />
</selector>
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/account.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:fillColor="@color/icon_color"
android:pathData="M12,4A4,4 0,0 1,16 8A4,4 0,0 1,12 12A4,4 0,0 1,8 8A4,4 0,0 1,12 4M12,14C16.42,14 20,15.79 20,18V20H4V18C4,15.79 7.58,14 12,14Z"/>
</vector>
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/arrow_left.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:fillColor="@color/Contracts_actionbar_icon_color"
android:pathData="M20,11V13H8L13.5,18.5L12.08,19.92L4.16,12L12.08,4.08L13.5,5.5L8,11H20Z"/>
</vector>
Binary file added app/src/main/res/drawable/cactus.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/calendar.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:fillColor="@color/icon_color"
android:pathData="M19,19H5V8H19M16,1V3H8V1H6V3H5C3.89,3 3,3.89 3,5V19A2,2 0,0 0,5 21H19A2,2 0,0 0,21 19V5C21,3.89 20.1,3 19,3H18V1M17,12H12V17H17V12Z"/>
</vector>
Binary file added app/src/main/res/drawable/clock.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 app/src/main/res/drawable/close.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="16dp" android:viewportHeight="24" android:viewportWidth="24" android:width="16dp">

<path android:fillColor="@color/cart_close_icon" android:pathData="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z"/>

</vector>
Binary file added app/src/main/res/drawable/disk.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 app/src/main/res/drawable/dots_vertical.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="40dp" android:viewportHeight="24" android:viewportWidth="24" android:width="40dp">

<path android:fillColor="@color/Contracts_actionbar_icon_color" android:pathData="M12,16A2,2 0,0 1,14 18A2,2 0,0 1,12 20A2,2 0,0 1,10 18A2,2 0,0 1,12 16M12,10A2,2 0,0 1,14 12A2,2 0,0 1,12 14A2,2 0,0 1,10 12A2,2 0,0 1,12 10M12,4A2,2 0,0 1,14 6A2,2 0,0 1,12 8A2,2 0,0 1,10 6A2,2 0,0 1,12 4Z"/>

</vector>
5 changes: 5 additions & 0 deletions app/src/main/res/drawable/magnify.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="40dp" android:viewportHeight="24" android:viewportWidth="24" android:width="40dp">

<path android:fillColor="@color/Contracts_actionbar_icon_color" android:pathData="M9.5,3A6.5,6.5 0,0 1,16 9.5C16,11.11 15.41,12.59 14.44,13.73L14.71,14H15.5L20.5,19L19,20.5L14,15.5V14.71L13.73,14.44C12.59,15.41 11.11,16 9.5,16A6.5,6.5 0,0 1,3 9.5A6.5,6.5 0,0 1,9.5 3M9.5,5C7,5 5,7 5,9.5C5,12 7,14 9.5,14C12,14 14,12 14,9.5C14,7 12,5 9.5,5Z"/>

</vector>
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/map_marker.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:fillColor="@color/icon_color"
android:pathData="M12,11.5A2.5,2.5 0,0 1,9.5 9A2.5,2.5 0,0 1,12 6.5A2.5,2.5 0,0 1,14.5 9A2.5,2.5 0,0 1,12 11.5M12,2A7,7 0,0 0,5 9C5,14.25 12,22 12,22C12,22 19,14.25 19,9A7,7 0,0 0,12 2Z"/>
</vector>
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/pencil.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:fillColor="@color/icon_color"
android:pathData="M20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18,2.9 17.35,2.9 16.96,3.29L15.12,5.12L18.87,8.87M3,17.25V21H6.75L17.81,9.93L14.06,6.18L3,17.25Z"/>
</vector>
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/phone.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:fillColor="@color/icon_color"
android:pathData="M6.62,10.79C8.06,13.62 10.38,15.94 13.21,17.38L15.41,15.18C15.69,14.9 16.08,14.82 16.43,14.93C17.55,15.3 18.75,15.5 20,15.5A1,1 0,0 1,21 16.5V20A1,1 0,0 1,20 21A17,17 0,0 1,3 4A1,1 0,0 1,4 3H7.5A1,1 0,0 1,8.5 4C8.5,5.25 8.7,6.45 9.07,7.57C9.18,7.92 9.1,8.31 8.82,8.59L6.62,10.79Z"/>
</vector>
Binary file added app/src/main/res/drawable/pie.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/placeholder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions app/src/main/res/drawable/rounded_button.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">
<solid android:color="#FF0000" /> <!-- Красный цвет -->
<corners android:radius="2000dp" />
</shape>
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/tag_heart.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:fillColor="@color/Contracts_actionbar_icon_color"
android:pathData="M21.41,11.58L12.41,2.58C12.05,2.22 11.55,2 11,2H4A2,2 0,0 0,2 4V11C2,11.55 2.22,12.05 2.59,12.42L11.59,21.42C11.95,21.78 12.45,22 13,22C13.55,22 14.05,21.78 14.41,21.41L21.41,14.41C21.78,14.05 22,13.55 22,13C22,12.45 21.77,11.94 21.41,11.58M5.5,7A1.5,1.5 0,0 1,4 5.5A1.5,1.5 0,0 1,5.5 4A1.5,1.5 0,0 1,7 5.5A1.5,1.5 0,0 1,5.5 7M17.27,15.27L13,19.54L8.73,15.27C8.28,14.81 8,14.19 8,13.5A2.5,2.5 0,0 1,10.5 11C11.19,11 11.82,11.28 12.27,11.74L13,12.46L13.73,11.73C14.18,11.28 14.81,11 15.5,11A2.5,2.5 0,0 1,18 13.5C18,14.19 17.72,14.82 17.27,15.27Z"/>
</vector>
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/wallet.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:fillColor="@color/icon_color"
android:pathData="M21,18V19A2,2 0,0 1,19 21H5C3.89,21 3,20.1 3,19V5A2,2 0,0 1,5 3H19A2,2 0,0 1,21 5V6H12C10.89,6 10,6.9 10,8V16A2,2 0,0 0,12 18M12,16H22V8H12M16,13.5A1.5,1.5 0,0 1,14.5 12A1.5,1.5 0,0 1,16 10.5A1.5,1.5 0,0 1,17.5 12A1.5,1.5 0,0 1,16 13.5Z"/>
</vector>
Binary file added app/src/main/res/font/aguafina_script.ttf
Binary file not shown.
Binary file added app/src/main/res/font/roboto.ttf
Binary file not shown.
Loading