diff --git a/build.gradle b/build.gradle
index 8ec48d7a..4064abae 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,8 +1,8 @@
// 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 '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.0' apply false
id "io.gitlab.arturbosch.detekt" version "1.21.0"
}
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/payload/build.gradle b/payload/build.gradle
new file mode 100644
index 00000000..8ca75021
--- /dev/null
+++ b/payload/build.gradle
@@ -0,0 +1,42 @@
+plugins {
+ id 'com.android.library'
+ id 'org.jetbrains.kotlin.android'
+ id 'kotlin-parcelize'
+}
+
+android {
+ namespace 'com.example.payload'
+ compileSdk 36
+
+ defaultConfig {
+ minSdk 24
+
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+ consumerProguardFiles "consumer-rules.pro"
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_11
+ targetCompatibility JavaVersion.VERSION_11
+ }
+ kotlinOptions {
+ jvmTarget = '11'
+ }
+}
+
+dependencies {
+
+ 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 'org.jetbrains.kotlin:kotlin-parcelize-runtime:2.2.0'
+ testImplementation 'junit:junit:4.13.2'
+ androidTestImplementation 'androidx.test.ext:junit:1.3.0'
+ androidTestImplementation 'androidx.test.espresso:espresso-core:3.7.0'
+}
\ No newline at end of file
diff --git a/payload/src/main/AndroidManifest.xml b/payload/src/main/AndroidManifest.xml
new file mode 100644
index 00000000..a5918e68
--- /dev/null
+++ b/payload/src/main/AndroidManifest.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/payload/src/main/java/com/example/payload/Payload.kt b/payload/src/main/java/com/example/payload/Payload.kt
new file mode 100644
index 00000000..90a5626c
--- /dev/null
+++ b/payload/src/main/java/com/example/payload/Payload.kt
@@ -0,0 +1,12 @@
+package com.example.payload
+
+import android.os.Parcelable
+import kotlinx.parcelize.Parcelize
+
+@Parcelize
+data class Payload(
+ val title: String,
+ val year: String,
+ val description: String
+) : Parcelable
+
diff --git a/receiver/build.gradle b/receiver/build.gradle
index 243c0925..7dc39a10 100644
--- a/receiver/build.gradle
+++ b/receiver/build.gradle
@@ -2,15 +2,16 @@ plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id("io.gitlab.arturbosch.detekt")
+ id("kotlin-parcelize")
}
android {
- compileSdk 34
+ compileSdk 36
defaultConfig {
applicationId "otus.gpb.homework.activities.receiver"
- minSdk 23
- targetSdk 34
+ minSdk 36
+ targetSdk 36
versionCode 1
versionName "1.0"
@@ -30,10 +31,13 @@ android {
kotlinOptions {
jvmTarget = '1.8'
}
- namespace 'otus.gpb.homework.activities.receiver'
+
+ namespace "otus.gpb.homework.activities.receiver"
+
buildFeatures {
viewBinding true
}
+ buildToolsVersion '36.0.0'
}
detekt {
@@ -57,4 +61,6 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.12.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
+ implementation 'org.jetbrains.kotlin:kotlin-parcelize-runtime:2.2.20'
+ implementation project(':payload')
}
\ No newline at end of file
diff --git a/receiver/src/main/AndroidManifest.xml b/receiver/src/main/AndroidManifest.xml
index e2f6ea6c..10e6acbc 100644
--- a/receiver/src/main/AndroidManifest.xml
+++ b/receiver/src/main/AndroidManifest.xml
@@ -8,6 +8,17 @@
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..941d11df 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
@@ -2,11 +2,33 @@ package otus.gpb.homework.activities.receiver
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
+import androidx.appcompat.content.res.AppCompatResources
+import androidx.core.content.IntentCompat
+import android.widget.ImageView
+import android.widget.TextView
+import com.example.payload.Payload
class ReceiverActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_receiver)
+
+ val payload: Payload? = IntentCompat.getParcelableExtra(intent, "intentPayload", Payload::class.java)
+
+ val imageViewer = findViewById(R.id.posterImageView)
+ val imageId = when (payload?.title) {
+ "Славные парни" -> R.drawable.niceguys
+ "Интерстеллар" -> R.drawable.interstellar
+ else -> 0
+ }
+
+ if( imageId > 0 ) {
+ imageViewer.setImageDrawable(AppCompatResources.getDrawable(this, imageId))
+ }
+
+ findViewById(R.id.titleTextView).apply { text = payload?.title }
+ findViewById(R.id.descriptionTextView).apply { text = payload?.description }
+ findViewById(R.id.yearTextView).apply { text = payload?.year }
}
}
diff --git a/receiver/src/main/res/layout/activity_receiver.xml b/receiver/src/main/res/layout/activity_receiver.xml
index 6e89c012..effdeaef 100644
--- a/receiver/src/main/res/layout/activity_receiver.xml
+++ b/receiver/src/main/res/layout/activity_receiver.xml
@@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
- tools:context=".ReceiverActivity">
+ tools:context="otus.gpb.homework.activities.receiver.ReceiverActivity">
+ android:theme="@style/Theme.Activities">
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/sender/src/main/java/otus/gpb/homework/activities/sender/Payload.kt b/sender/src/main/java/otus/gpb/homework/activities/sender/Payload.kt
deleted file mode 100644
index 5a0b139e..00000000
--- a/sender/src/main/java/otus/gpb/homework/activities/sender/Payload.kt
+++ /dev/null
@@ -1,7 +0,0 @@
-package otus.gpb.homework.activities.sender
-
-data class Payload(
- val title: String,
- val year: String,
- val description: String
-)
\ 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..5b868bb6
--- /dev/null
+++ b/sender/src/main/java/otus/gpb/homework/activities/sender/SenderActivity.kt
@@ -0,0 +1,61 @@
+package otus.gpb.homework.activities.sender
+
+import android.content.Intent
+import android.net.Uri
+import android.os.Bundle
+import android.widget.Button
+import androidx.activity.enableEdgeToEdge
+import androidx.appcompat.app.AppCompatActivity
+import androidx.core.view.ViewCompat
+import androidx.core.view.WindowInsetsCompat
+import com.example.payload.Payload
+
+class SenderActivity : AppCompatActivity() {
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ enableEdgeToEdge()
+ setContentView(R.layout.activity_sender)
+ 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