diff --git a/build.gradle b/build.gradle
index 8ec48d7a..04b6b10e 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,7 +1,7 @@
// 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 'com.android.application' version '8.12.2' apply false
+ id 'com.android.library' version '8.12.2' apply false
id 'org.jetbrains.kotlin.android' version '1.9.23' 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/receiver/build.gradle b/receiver/build.gradle
index 243c0925..bcfd759c 100644
--- a/receiver/build.gradle
+++ b/receiver/build.gradle
@@ -5,12 +5,12 @@ plugins {
}
android {
- compileSdk 34
+ compileSdk 36
defaultConfig {
applicationId "otus.gpb.homework.activities.receiver"
minSdk 23
- targetSdk 34
+ targetSdk 36
versionCode 1
versionName "1.0"
diff --git a/receiver/src/main/AndroidManifest.xml b/receiver/src/main/AndroidManifest.xml
index e2f6ea6c..83274bda 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..df15dd5d 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,40 @@
package otus.gpb.homework.activities.receiver
import android.os.Bundle
+import android.widget.ImageView
+import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
+import androidx.core.content.ContextCompat
class ReceiverActivity : AppCompatActivity() {
+ private var titleView: TextView? = null
+ private var yearView: TextView? = null
+ private var descrView: TextView? = null
+ private lateinit var posterView: ImageView
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_receiver)
+
+ titleView = findViewById(R.id.titleTextView)
+ yearView = findViewById(R.id.yearTextView)
+ descrView = findViewById(R.id.descriptionTextView)
+ posterView = findViewById(R.id.posterImageView)
+
+ val title = intent.extras?.getString("title")
+ titleView?.text = title
+ yearView?.text = intent.extras?.getString("year")
+ descrView?.text = intent.extras?.getString("description")
+
+ when(title){
+ "Interstellar" -> {
+ val drawable = ContextCompat.getDrawable(this, R.drawable.interstellar)
+ posterView.setImageDrawable(drawable)
+ }
+ "Nice guys" -> {
+ val drawable = ContextCompat.getDrawable(this, R.drawable.niceguys)
+ posterView.setImageDrawable(drawable)
+ }
+ }
}
}
diff --git a/receiver/src/main/res/layout/activity_receiver.xml b/receiver/src/main/res/layout/activity_receiver.xml
index 6e89c012..de69fd9a 100644
--- a/receiver/src/main/res/layout/activity_receiver.xml
+++ b/receiver/src/main/res/layout/activity_receiver.xml
@@ -21,6 +21,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
+ android:layout_marginTop="32dp"
android:textColor="#212121"
android:textSize="24dp"
app:layout_constraintStart_toEndOf="@+id/posterImageView"
diff --git a/sender/build.gradle b/sender/build.gradle
index 9854ad15..f87c8f51 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"
@@ -40,4 +40,5 @@ 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 'androidx.activity:activity:1.10.1'
}
\ No newline at end of file
diff --git a/sender/src/main/AndroidManifest.xml b/sender/src/main/AndroidManifest.xml
index 1bddc002..970f234e 100644
--- a/sender/src/main/AndroidManifest.xml
+++ b/sender/src/main/AndroidManifest.xml
@@ -7,6 +7,15 @@
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..b18d0736
--- /dev/null
+++ b/sender/src/main/java/otus/gpb/homework/activities/sender/SenderActivity.kt
@@ -0,0 +1,70 @@
+package otus.gpb.homework.activities.sender
+
+import android.content.Intent
+import android.net.Uri
+import android.os.Bundle
+import android.widget.Button
+import android.widget.Toast
+import androidx.appcompat.app.AppCompatActivity
+import otus.gpb.homework.activities.receiver.R
+import kotlin.Exception
+
+
+class SenderActivity : AppCompatActivity() {
+ private var buttonMap: Button? = null
+ private var buttonMail: Button? = null
+ private var buttonReceiver: Button? = null
+
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ setContentView(R.layout.activity_sender)
+ buttonMap = findViewById(R.id.button)
+ buttonMail = findViewById(R.id.button2)
+ buttonReceiver = findViewById(R.id.button3)
+
+ buttonMap?.setOnClickListener {
+ val intent = Intent(Intent.ACTION_VIEW, Uri.parse("geo:0,0?q=restaurants")).setPackage("com.google.android.apps.maps")
+ try {
+ startActivity(intent)
+ } catch (e: Exception) {
+ Toast.makeText(
+ this,
+ "Не удалось открыть карту",
+ Toast.LENGTH_SHORT
+ ).show()
+ }
+ }
+ buttonMail?.setOnClickListener {
+ val intent = Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:android@otus.ru?subject=\"Отзыв о курсе обучения\"&body=\"Курс очень понравился. Получил много полезной информации и навыков.\""))
+ try {
+ startActivity(intent)
+ } catch (e: Exception) {
+ Toast.makeText(
+ this,
+ "Не удалось открыть почтовый клиент",
+ Toast.LENGTH_SHORT
+ ).show()
+ }
+ }
+ buttonReceiver?.setOnClickListener {
+ val intent = Intent(Intent.ACTION_SEND)
+ intent.setType("text/plain")
+ intent.addCategory(Intent.CATEGORY_DEFAULT)
+ intent.putExtra("title", "Interstellar")
+ intent.putExtra("year", "2014")
+ intent.putExtra("description",
+ "Когда засуха, пыльные бури и вымирание растений приводят человечество к продовольственному кризису, коллектив исследователей и учёных отправляется сквозь червоточину (которая предположительно соединяет области пространства-времени через большое расстояние) в путешествие, чтобы превзойти прежние ограничения для космических путешествий человека и найти планету с подходящими для человечества условиями."
+ )
+ try {
+ startActivity(intent)
+ } catch (e: Exception) {
+ Toast.makeText(
+ this,
+ "Не удалось открыть Receiver",
+ Toast.LENGTH_SHORT
+ ).show()
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/sender/src/main/res/layout/activity_sender.xml b/sender/src/main/res/layout/activity_sender.xml
new file mode 100644
index 00000000..ba8c3aea
--- /dev/null
+++ b/sender/src/main/res/layout/activity_sender.xml
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file