diff --git a/README.md b/README.md
index 73775997..ade15050 100644
--- a/README.md
+++ b/README.md
@@ -29,3 +29,4 @@
> 💡 Чтобы достать ресурс, используйте метод [Context.getDrawable()](https://developer.android.com/reference/android/content/Context#getDrawable(int)), а чтобы поменять картинку в ImageView используйте метод [setImageDrawable()](https://developer.android.com/reference/android/widget/ImageView#setImageDrawable(android.graphics.drawable.Drawable))
+[payload.txt](sender/payload.txt)
\ No newline at end of file
diff --git a/receiver/src/main/AndroidManifest.xml b/receiver/src/main/AndroidManifest.xml
index e2f6ea6c..286d7817 100644
--- a/receiver/src/main/AndroidManifest.xml
+++ b/receiver/src/main/AndroidManifest.xml
@@ -8,6 +8,22 @@
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..8f81f1d8 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,39 @@ package otus.gpb.homework.activities.receiver
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
+import android.widget.ImageView
+import android.widget.TextView
+import androidx.activity.enableEdgeToEdge
+import androidx.appcompat.content.res.AppCompatResources
+import androidx.core.view.ViewCompat
+import androidx.core.view.WindowInsetsCompat
+import otus.gpb.homework.activities.receiver.databinding.ActivityReceiverBinding
class ReceiverActivity : AppCompatActivity() {
+ private lateinit var binding: ActivityReceiverBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_receiver)
+ binding = ActivityReceiverBinding.inflate(layoutInflater)
+ setContentView(binding.root)
+ ViewCompat.setOnApplyWindowInsetsListener(binding.root) { v, insets ->
+ val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
+ v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
+ insets
+ }
+
+ binding.titleTextView.text = intent.getStringExtra("title").orEmpty()
+ binding.yearTextView.text = intent.getStringExtra("year").orEmpty()
+ binding.descriptionTextView.text = intent.getStringExtra("description").orEmpty()
+
+ val posterResId = when (binding.titleTextView.text.toString().lowercase()) {
+ "интерстеллар" -> R.drawable.interstellar
+ "славные парни" -> R.drawable.niceguys
+ else -> R.drawable.niceguys
+ }
+
+ AppCompatResources.getDrawable(this, posterResId)?.let {
+ binding.posterImageView.setImageDrawable(it)
+ }
}
}
diff --git a/sender/build.gradle b/sender/build.gradle
index 9854ad15..8403f373 100644
--- a/sender/build.gradle
+++ b/sender/build.gradle
@@ -29,13 +29,14 @@ android {
kotlinOptions {
jvmTarget = '1.8'
}
- namespace 'otus.gpb.homework.activities.receiver'
+ namespace 'otus.gpb.homework.activities.sender'
buildFeatures {
viewBinding true
}
}
dependencies {
+ implementation 'androidx.activity:activity-ktx:1.9.0'
implementation 'androidx.core:core-ktx:1.13.1'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.12.0'
diff --git a/sender/src/main/AndroidManifest.xml b/sender/src/main/AndroidManifest.xml
index 1bddc002..3da0b140 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..fd77145d
--- /dev/null
+++ b/sender/src/main/java/otus/gpb/homework/activities/sender/SenderActivity.kt
@@ -0,0 +1,63 @@
+package otus.gpb.homework.activities.sender
+
+import android.os.Bundle
+import androidx.activity.enableEdgeToEdge
+import androidx.appcompat.app.AppCompatActivity
+import androidx.core.view.ViewCompat
+import androidx.core.view.WindowInsetsCompat
+import android.widget.Button
+import android.content.Intent
+import android.net.Uri
+import androidx.core.net.toUri
+
+import otus.gpb.homework.activities.sender.R
+
+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
+ }
+
+ val btnMaps = findViewById