diff --git a/build.gradle b/build.gradle index 8ec48d7a..b3758d67 100644 --- a/build.gradle +++ b/build.gradle @@ -1,9 +1,9 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. plugins { - id 'com.android.application' version '8.4.0' apply false - id 'com.android.library' version '8.4.0' apply false - id 'org.jetbrains.kotlin.android' version '1.9.23' apply false - id "io.gitlab.arturbosch.detekt" version "1.21.0" + id 'com.android.application' version '8.12.3' apply false + id 'com.android.library' version '8.12.3' apply false + id 'org.jetbrains.kotlin.android' version '2.2.20' apply false + id "io.gitlab.arturbosch.detekt" version "1.23.8" } task clean(type: Delete) { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index fb9e5b80..7c7cf9f5 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Sat Aug 27 13:57:30 MSK 2022 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip distributionPath=wrapper/dists zipStorePath=wrapper/dists zipStoreBase=GRADLE_USER_HOME diff --git a/receiver/build.gradle b/receiver/build.gradle index 243c0925..aedf688a 100644 --- a/receiver/build.gradle +++ b/receiver/build.gradle @@ -5,7 +5,7 @@ plugins { } android { - compileSdk 34 + compileSdk 36 defaultConfig { applicationId "otus.gpb.homework.activities.receiver" @@ -53,8 +53,8 @@ tasks.named("detekt").configure { } dependencies { - implementation 'androidx.core:core-ktx:1.13.1' - implementation 'androidx.appcompat:appcompat:1.6.1' - implementation 'com.google.android.material:material:1.12.0' - implementation 'androidx.constraintlayout:constraintlayout:2.1.4' + implementation 'androidx.core:core-ktx:1.17.0' + implementation 'androidx.appcompat:appcompat:1.7.1' + implementation 'com.google.android.material:material:1.13.0' + implementation 'androidx.constraintlayout:constraintlayout:2.2.1' } \ No newline at end of file diff --git a/receiver/src/main/AndroidManifest.xml b/receiver/src/main/AndroidManifest.xml index e2f6ea6c..15247a9c 100644 --- a/receiver/src/main/AndroidManifest.xml +++ b/receiver/src/main/AndroidManifest.xml @@ -8,6 +8,16 @@ android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" - android:theme="@style/Theme.Activities" /> + android:theme="@style/Theme.Activities"> + + + + + + + + \ No newline at end of file diff --git a/receiver/src/main/java/otus/gpb/homework/activities/receiver/ReceiverActivity.kt b/receiver/src/main/java/otus/gpb/homework/activities/receiver/ReceiverActivity.kt index b3fe360c..e9457347 100644 --- a/receiver/src/main/java/otus/gpb/homework/activities/receiver/ReceiverActivity.kt +++ b/receiver/src/main/java/otus/gpb/homework/activities/receiver/ReceiverActivity.kt @@ -1,12 +1,39 @@ package otus.gpb.homework.activities.receiver +import android.content.Context +import android.graphics.drawable.Drawable import android.os.Bundle +import android.view.View +import android.widget.ImageView +import android.widget.TextView import androidx.appcompat.app.AppCompatActivity +import androidx.core.content.ContextCompat class ReceiverActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_receiver) + + intent?.extras?.let { defaultViewModelCreationExtras -> + defaultViewModelCreationExtras.getString("title")?.let { + findViewById(R.id.titleTextView).text = it + + when (it) { + "Интерстеллар" -> ContextCompat.getDrawable(this, R.drawable.interstellar) + "Славные парни" -> ContextCompat.getDrawable(this, R.drawable.niceguys) + else -> null + }?.let { drawable -> + findViewById(R.id.posterImageView).setImageDrawable(drawable) + } ?: findViewById(R.id.posterImageView).setVisibility(View.GONE) + } + defaultViewModelCreationExtras.getString("year")?.let { + findViewById(R.id.yearTextView).text = it + } + defaultViewModelCreationExtras.getString("description")?.let { + findViewById(R.id.descriptionTextView).text = it + } + + } } } diff --git a/sender/build.gradle b/sender/build.gradle index 9854ad15..283772a5 100644 --- a/sender/build.gradle +++ b/sender/build.gradle @@ -4,12 +4,12 @@ plugins { } android { - compileSdk 34 + compileSdk 36 defaultConfig { applicationId "otus.gpb.homework.activities.sender" minSdk 23 - targetSdk 34 + targetSdk 36 versionCode 1 versionName "1.0" @@ -36,8 +36,9 @@ android { } dependencies { - implementation 'androidx.core:core-ktx:1.13.1' - implementation 'androidx.appcompat:appcompat:1.6.1' - implementation 'com.google.android.material:material:1.12.0' - implementation 'androidx.constraintlayout:constraintlayout:2.1.4' + implementation 'androidx.core:core-ktx:1.17.0' + implementation 'androidx.appcompat:appcompat:1.7.1' + implementation 'com.google.android.material:material:1.13.0' + implementation 'androidx.constraintlayout:constraintlayout:2.2.1' + implementation 'androidx.activity:activity:1.11.0' } \ No newline at end of file diff --git a/sender/src/main/AndroidManifest.xml b/sender/src/main/AndroidManifest.xml index 1bddc002..74df87b6 100644 --- a/sender/src/main/AndroidManifest.xml +++ b/sender/src/main/AndroidManifest.xml @@ -7,6 +7,16 @@ android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" - android:theme="@style/Theme.Activities" /> + android:theme="@style/Theme.Activities"> + + + + + + + + \ No newline at end of file diff --git a/sender/src/main/java/otus/gpb/homework/activities/sender/SenderActivity.kt b/sender/src/main/java/otus/gpb/homework/activities/sender/SenderActivity.kt new file mode 100644 index 00000000..71019cd4 --- /dev/null +++ b/sender/src/main/java/otus/gpb/homework/activities/sender/SenderActivity.kt @@ -0,0 +1,47 @@ +package otus.gpb.homework.activities.sender + +import android.content.Intent +import android.os.Bundle +import android.widget.Button +import androidx.activity.enableEdgeToEdge +import androidx.appcompat.app.AppCompatActivity +import androidx.core.net.toUri +import androidx.core.view.ViewCompat +import androidx.core.view.WindowInsetsCompat +import otus.gpb.homework.activities.receiver.R + +class SenderActivity : AppCompatActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + enableEdgeToEdge() + setContentView(R.layout.sender_activity) + ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets -> + val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars()) + v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom) + insets + } + + findViewById