-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from DavayPosmotrim/13-view-dv-session
13 view dv session
- Loading branch information
Showing
17 changed files
with
242 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package com.davai.uikit | ||
|
||
import android.content.Context | ||
import android.util.AttributeSet | ||
import android.view.LayoutInflater | ||
import android.widget.ImageView | ||
import android.widget.LinearLayout | ||
import android.widget.TextView | ||
import coil.load | ||
import coil.transform.RoundedCornersTransformation | ||
|
||
class SessionView @JvmOverloads constructor( | ||
context: Context, | ||
attrs: AttributeSet? = null, | ||
defStyleAttr: Int = 0, | ||
defStyleRes: Int = 0 | ||
) : LinearLayout(context, attrs, defStyleAttr, defStyleRes) { | ||
private var tvDate: TextView? = null | ||
private var tvCoincidences: TextView? = null | ||
private var tvNamesList: TextView? = null | ||
private var ivCover: ImageView? = null | ||
|
||
init { | ||
initViews() | ||
} | ||
|
||
private fun initViews() { | ||
LayoutInflater.from(context).inflate(R.layout.session_view, this, true) | ||
tvDate = findViewById(R.id.tv_session_date) | ||
tvCoincidences = findViewById(R.id.tv_session_coincidences) | ||
tvNamesList = findViewById(R.id.tv_session_names_list) | ||
ivCover = findViewById(R.id.iv_session_cover) | ||
} | ||
|
||
fun setDate(date: String) { | ||
tvDate?.text = date | ||
} | ||
|
||
fun setCoincidences(amount: Int) { | ||
tvCoincidences?.text = String.format(resources.getString(R.string.session_coincidences), amount.toString()) | ||
} | ||
|
||
fun setNamesList(names: String) { | ||
tvNamesList?.text = names | ||
} | ||
|
||
fun setCover(url: String) { | ||
ivCover?.load(url) { | ||
error(R.drawable.error_img) | ||
placeholder(R.drawable.placeholder_img) | ||
transformations( | ||
RoundedCornersTransformation( | ||
radius = resources.getDimensionPixelSize(R.dimen.card_radius_18).toFloat() | ||
) | ||
) | ||
} | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="120dp" android:viewportHeight="512" android:viewportWidth="512" android:width="120dp"> | ||
|
||
<path android:fillColor="#8B7E7F" android:pathData="M182.23,399.45l0,103.47l101.3,0l0,-103.5z"/> | ||
|
||
<path android:fillColor="#00000000" android:pathData="M424.88,370.06L41.29,370.06" android:strokeColor="#000000" android:strokeLineCap="round" android:strokeLineJoin="round" android:strokeWidth="15"/> | ||
|
||
<path android:fillColor="#463836" android:pathData="M457.5,126.38c0,-12.11 -9.91,-22.02 -22.02,-22.02H30.28c-12.11,0 -22.02,9.91 -22.02,22.02v244.44l224.62,22.02l224.62,-22.02V126.38z"/> | ||
|
||
<path android:fillColor="#C2B8B9" android:pathData="M8.26,370.82v28.63c0,12.11 9.91,22.02 22.02,22.02h405.2c12.11,0 22.02,-9.91 22.02,-22.02v-28.63H8.26z"/> | ||
|
||
<path android:fillColor="#FFD24D" android:pathData="M503.74,108.92c0,-56.05 -57.21,-101.48 -127.78,-101.48c-70.57,0 -127.78,45.44 -127.78,101.48c0,50.07 45.66,91.67 105.72,99.97h-0.18c3.15,19.36 -2.66,39.92 -17.45,54.85c31.74,0 57.93,-23.9 61.91,-54.84h-0.18C458.06,200.6 503.74,158.99 503.74,108.92z"/> | ||
|
||
<path android:fillColor="#FF000000" android:pathData="M355.83,495.48h-63.39v-40.47c0,-4.56 -3.7,-8.26 -8.26,-8.26s-8.26,3.7 -8.26,8.26v40.47h-85.68v-40.47c0,-4.56 -3.7,-8.26 -8.26,-8.26s-8.26,3.7 -8.26,8.26v40.47h-63.39c-4.56,0 -8.26,3.7 -8.26,8.26c0,4.56 3.7,8.26 8.26,8.26h245.49c4.56,0 8.26,-3.7 8.26,-8.26C364.09,499.18 360.39,495.48 355.83,495.48z"/> | ||
|
||
<path android:fillColor="#FF000000" android:pathData="M457.91,212.37c-4.56,0 -8.26,3.7 -8.26,8.26v178.83c0,7.86 -6.4,14.26 -14.26,14.26H30.78c-7.86,0 -14.26,-6.4 -14.26,-14.26v-271.76c0,-7.86 6.4,-14.26 14.26,-14.26h184.37c4.56,0 8.26,-3.7 8.26,-8.26s-3.7,-8.26 -8.26,-8.26H30.78C13.81,96.93 0,110.73 0,127.71v271.76c0,16.97 13.81,30.78 30.78,30.78h404.61c16.97,0 30.78,-13.81 30.78,-30.78V220.63C466.17,216.07 462.48,212.37 457.91,212.37z"/> | ||
|
||
<path android:fillColor="#FF000000" android:pathData="M375.96,0c-75.01,0 -136.04,49.23 -136.04,109.74c0,51.82 44.31,96.03 106.28,107.11c0.86,15.5 -4.84,30.83 -15.8,41.9c-2.35,2.37 -3.04,5.91 -1.75,8.99c1.28,3.08 4.29,5.08 7.62,5.08c33.33,0 61.98,-23.62 69.04,-55.89C467.5,205.97 512,161.68 512,109.74C512,49.23 450.97,0 375.96,0zM396.86,201.54c-4.3,0.59 -7.4,4.41 -7.11,8.73c-3.16,19.95 -16.95,36.08 -35,42.73c6.72,-13.01 9.41,-27.97 7.39,-42.79c0.26,-4.3 -2.83,-8.09 -7.11,-8.68c-57.13,-7.9 -98.6,-46.5 -98.6,-91.79c0,-51.41 53.62,-93.23 119.53,-93.23s119.52,41.82 119.52,93.22C495.48,155.04 454.01,193.65 396.86,201.54z"/> | ||
|
||
<path android:fillColor="#FF000000" android:pathData="M330.92,100.92c-4.86,0 -8.82,3.96 -8.82,8.82s3.96,8.82 8.82,8.82c4.86,0 8.82,-3.96 8.82,-8.82S335.78,100.92 330.92,100.92z"/> | ||
|
||
<path android:fillColor="#FF000000" android:pathData="M421,100.92c-4.86,0 -8.82,3.96 -8.82,8.82s3.96,8.82 8.82,8.82s8.82,-3.96 8.82,-8.82S425.87,100.92 421,100.92z"/> | ||
|
||
<path android:fillColor="#FF000000" android:pathData="M375.96,100.92c-4.86,0 -8.82,3.96 -8.82,8.82s3.96,8.82 8.82,8.82c4.86,0 8.82,-3.96 8.82,-8.82S380.82,100.92 375.96,100.92z"/> | ||
|
||
<path android:fillColor="#FF000000" android:pathData="M33.03,370.89c0,4.56 3.7,8.26 8.26,8.26h383.59c4.56,0 8.26,-3.7 8.26,-8.26c0,-4.56 -3.7,-8.26 -8.26,-8.26H41.29C36.73,362.63 33.03,366.33 33.03,370.89z"/> | ||
|
||
</vector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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:height="120dp" android:viewportHeight="1024" android:viewportWidth="1024" android:width="120dp"> | ||
|
||
<path android:fillColor="#FFB89A" android:pathData="M861.9,383.8H218.1c-36.4,0 -66.1,-29.8 -66.1,-66.1V288c0,-36.4 29.8,-66.1 66.1,-66.1h643.8c36.4,0 66.1,29.8 66.1,66.1v29.7c0,36.3 -29.8,66.1 -66.1,66.1z"/> | ||
|
||
<path android:fillColor="#45484C" android:pathData="M822.9,129.2L199.8,129.2c-77.2,0 -140.4,63.2 -140.4,140.4v487.2c0,77.2 63.2,140.4 140.4,140.4h623.1c77.2,0 140.4,-63.2 140.4,-140.4L963.3,269.6c0,-77.2 -63.2,-140.4 -140.4,-140.4zM903.3,306.2L760.4,306.2L864.6,201c5.4,3.3 10.4,7.3 15,11.8 15.3,15.3 23.7,35.4 23.7,56.8v36.6zM230,306.2l104,-117h61.3l-109.1,117L230,306.2zM477.4,189.2h169.2L532,306.2L368.3,306.2l109.1,-117zM726.2,189.2h65.6L676,306.2h-60l112.5,-114.8 -2.3,-2.2zM143,212.9c15.3,-15.3 35.4,-23.7 56.8,-23.7h53.9l-104,117h-30.4v-36.5c0.1,-21.4 8.5,-41.5 23.7,-56.8zM879.6,813.6c-15.3,15.3 -35.4,23.7 -56.8,23.7h-623c-21.3,0 -41.5,-8.4 -56.8,-23.7 -15.3,-15.3 -23.7,-35.4 -23.7,-56.8L119.3,366.2h783.9v390.6c0.1,21.3 -8.3,41.5 -23.6,56.8z"/> | ||
|
||
<path android:fillColor="#33CC99" android:pathData="M400.5,770.6V430.9L534.1,508c14.3,8.3 19.3,26.6 11,41 -8.3,14.3 -26.6,19.3 -41,11l-43.6,-25.2v131.8l114.1,-65.9 -7.5,-4.3c-14.3,-8.3 -19.3,-26.6 -11,-41 8.3,-14.3 26.6,-19.3 41,-11l97.5,56.3 -294.1,169.9z"/> | ||
|
||
</vector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<shape | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:shape="rectangle"> | ||
<solid android:color="@color/background_white"/> | ||
<corners android:radius="@dimen/card_radius_24"/> | ||
</shape> |
11 changes: 11 additions & 0 deletions
11
uikit/src/main/res/drawable/session_highlighted_text_background.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<shape xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:shape="rectangle"> | ||
<solid android:color="@color/primary_base"/> | ||
<corners android:radius="@dimen/card_radius_12"/> | ||
<padding | ||
android:bottom="2dp" | ||
android:left="12dp" | ||
android:right="12dp" | ||
android:top="2dp"/> | ||
</shape> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:id="@+id/ll_session_body" | ||
android:layout_width="match_parent" | ||
android:layout_height="@dimen/session_card_height" | ||
android:background="@drawable/session_card_background" | ||
android:orientation="vertical" | ||
android:paddingTop="@dimen/padding_12" | ||
android:paddingBottom="@dimen/padding_8"> | ||
|
||
<LinearLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:gravity="center" | ||
android:orientation="horizontal" | ||
android:paddingStart="@dimen/padding_16" | ||
android:paddingEnd="@dimen/padding_12"> | ||
|
||
<TextView | ||
android:id="@+id/tv_session_date" | ||
style="@style/Text.Headline.SubTitle" | ||
android:layout_width="0dp" | ||
android:layout_height="wrap_content" | ||
android:layout_weight="1" | ||
tools:text="[23 сентября]" /> | ||
|
||
<TextView | ||
android:id="@+id/tv_session_coincidences" | ||
style="@style/Text.Base.Medium.Regular" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:background="@drawable/session_highlighted_text_background" | ||
android:textColor="@color/background_white" | ||
tools:text="[Совпадений: 3]" /> | ||
</LinearLayout> | ||
|
||
<TextView | ||
android:id="@+id/tv_session_names_list" | ||
style="@style/Text.Base.Medium.Regular" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_marginVertical="@dimen/padding_12" | ||
android:ellipsize="end" | ||
android:paddingStart="@dimen/padding_16" | ||
android:paddingEnd="@dimen/padding_12" | ||
android:singleLine="true" | ||
tools:text="[Артём (вы), Анна, Константин, Руслан, Никита, Игорь]" /> | ||
|
||
<ImageView | ||
android:id="@+id/iv_session_cover" | ||
android:layout_width="match_parent" | ||
android:layout_height="0dp" | ||
android:layout_weight="1" | ||
android:paddingHorizontal="@dimen/padding_8" | ||
android:src="@drawable/placeholder_img" /> | ||
</LinearLayout> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
|
||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<dimen name="card_radius_12">12dp</dimen> | ||
<dimen name="card_radius_18">18dp</dimen> | ||
<dimen name="card_radius_24">24dp</dimen> | ||
|
||
<dimen name="session_card_height">240dp</dimen> | ||
|
||
<dimen name="padding_16">16dp</dimen> | ||
<dimen name="padding_12">12dp</dimen> | ||
<dimen name="padding_8">8dp</dimen> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<string name="session_coincidences">Совпадений: %s</string> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
uikit_sample/src/main/java/com/davai/uikit_sample/SessionExample.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.davai.uikit_sample | ||
|
||
import android.os.Bundle | ||
import androidx.appcompat.app.AppCompatActivity | ||
import com.davai.uikit.SessionView | ||
|
||
@Suppress("Detekt:MagicNumber") | ||
class SessionExample : AppCompatActivity() { | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
|
||
val date = "1 января" | ||
val coincidences = 6 | ||
val namesList = "Дима (вы), Петя, Вася, Катя, Маша, Тимофеевна" | ||
val coverUrl = "https://s5.afisha.ru/mediastorage/ba/60/3a2f91298ada4e1cafb1bf3460ba.jpg" | ||
|
||
setContentView(R.layout.activity_session_example) | ||
|
||
findViewById<SessionView>(R.id.sv_example).apply { | ||
setDate(date) | ||
setCoincidences(coincidences) | ||
setNamesList(namesList) | ||
setCover(coverUrl) | ||
} | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
uikit_sample/src/main/res/layout/activity_session_example.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:background="@color/text_caption_light"> | ||
|
||
<com.davai.uikit.SessionView | ||
android:id="@+id/sv_example" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_margin="20dp"/> | ||
</LinearLayout> |