-
Notifications
You must be signed in to change notification settings - Fork 56
hw10 решение #44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
sergei-rodionov
wants to merge
2
commits into
Otus-Android:master
Choose a base branch
from
sergei-rodionov:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
hw10 решение #44
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
26 changes: 26 additions & 0 deletions
26
app/src/main/java/otus/gpb/homework/activities/ActivityA.kt
This file contains hidden or 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,26 @@ | ||
| package otus.gpb.homework.activities | ||
|
|
||
| import android.content.Intent | ||
| import android.os.Bundle | ||
| import android.util.Log | ||
| import android.widget.Button | ||
| import androidx.appcompat.app.AppCompatActivity | ||
|
|
||
| class ActivityA : AppCompatActivity() { | ||
|
|
||
| override fun onCreate(savedInstanceState: Bundle?) { | ||
| super.onCreate(savedInstanceState) | ||
| setContentView(R.layout.activity_a) | ||
| findViewById<Button?>(R.id.buttonA_openB).setOnClickListener{ | ||
|
|
||
| val intent = Intent(this, ActivityB::class.java) | ||
| intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_MULTIPLE_TASK | ||
| startActivity(intent) | ||
| } | ||
| } | ||
|
|
||
| override fun onNewIntent(intent: Intent?) { | ||
| Log.d("ActivityA", "onNewIntent") | ||
| super.onNewIntent(intent) | ||
| } | ||
| } |
19 changes: 19 additions & 0 deletions
19
app/src/main/java/otus/gpb/homework/activities/ActivityB.kt
This file contains hidden or 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,19 @@ | ||
| package otus.gpb.homework.activities | ||
|
|
||
| import android.content.Intent | ||
| import androidx.appcompat.app.AppCompatActivity | ||
| import android.os.Bundle | ||
| import android.widget.Button | ||
|
|
||
| class ActivityB : AppCompatActivity() { | ||
| override fun onCreate(savedInstanceState: Bundle?) { | ||
| super.onCreate(savedInstanceState) | ||
| setContentView(R.layout.activity_b) | ||
| findViewById<Button?>(R.id.buttonB_openC).setOnClickListener{ | ||
| val intent = Intent(this, ActivityC::class.java) | ||
|
|
||
| this.startActivity(intent) | ||
| } | ||
|
|
||
| } | ||
| } |
40 changes: 40 additions & 0 deletions
40
app/src/main/java/otus/gpb/homework/activities/ActivityC.kt
This file contains hidden or 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,40 @@ | ||
| package otus.gpb.homework.activities | ||
|
|
||
| import android.content.Intent | ||
| import androidx.appcompat.app.AppCompatActivity | ||
| import android.os.Bundle | ||
| import android.widget.Button | ||
|
|
||
|
|
||
| class ActivityC : AppCompatActivity() { | ||
| override fun onCreate(savedInstanceState: Bundle?) { | ||
| super.onCreate(savedInstanceState) | ||
| setContentView(R.layout.activity_c) | ||
| findViewById<Button?>(R.id.buttonC_openA).setOnClickListener{ | ||
| val intent = Intent(this, ActivityA::class.java) | ||
| // intent.flags = Intent.FLAG_ACTIVITY_CLEAR_TASK or | ||
| // Intent.FLAG_ACTIVITY_CLEAR_TOP | ||
| startActivity(intent) | ||
| } | ||
| findViewById<Button?>(R.id.buttonC_openD).setOnClickListener{ | ||
| val intent = Intent(this, ActivityD::class.java) | ||
| intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or | ||
| Intent.FLAG_ACTIVITY_CLEAR_TASK or | ||
| Intent.FLAG_ACTIVITY_CLEAR_TOP | ||
| startActivity(intent) | ||
| } | ||
| findViewById<Button?>(R.id.buttonC_close).setOnClickListener{ | ||
| finish() | ||
| } | ||
| findViewById<Button?>(R.id.buttonC_closeAll).setOnClickListener{ | ||
| // val intent = Intent(this, ActivityA::class.java) | ||
| // intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or | ||
| // Intent.FLAG_ACTIVITY_CLEAR_TASK or | ||
| // Intent.FLAG_ACTIVITY_CLEAR_TOP | ||
| // startActivity(intent) | ||
| // finish() | ||
| finishAffinity() | ||
| } | ||
|
|
||
| } | ||
| } |
11 changes: 11 additions & 0 deletions
11
app/src/main/java/otus/gpb/homework/activities/ActivityD.kt
This file contains hidden or 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 @@ | ||
| package otus.gpb.homework.activities | ||
|
|
||
| import androidx.appcompat.app.AppCompatActivity | ||
| import android.os.Bundle | ||
|
|
||
| class ActivityD : AppCompatActivity() { | ||
| override fun onCreate(savedInstanceState: Bundle?) { | ||
| super.onCreate(savedInstanceState) | ||
| setContentView(R.layout.activity_d) | ||
| } | ||
| } |
This file contains hidden or 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,33 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
| xmlns:app="http://schemas.android.com/apk/res-auto" | ||
| xmlns:tools="http://schemas.android.com/tools" | ||
| android:layout_width="match_parent" | ||
| android:layout_height="match_parent" | ||
| android:background="#F44336" | ||
| tools:context=".ActivityA"> | ||
|
|
||
| <Button | ||
| android:id="@+id/buttonA_openB" | ||
| android:layout_width="wrap_content" | ||
| android:layout_height="wrap_content" | ||
| android:text="Open ActivityB" | ||
| android:textAppearance="@style/TextAppearance.AppCompat.Large" | ||
| app:layout_constraintBottom_toBottomOf="parent" | ||
| app:layout_constraintEnd_toEndOf="parent" | ||
| app:layout_constraintHorizontal_bias="0.5" | ||
| app:layout_constraintStart_toStartOf="parent" | ||
| app:layout_constraintTop_toBottomOf="@+id/textView" | ||
| app:layout_constraintVertical_bias="0.5" /> | ||
|
|
||
| <TextView | ||
| android:id="@+id/textView" | ||
| android:layout_width="wrap_content" | ||
| android:layout_height="wrap_content" | ||
| android:text="Activity A" | ||
| android:textAppearance="@style/TextAppearance.AppCompat.Large" | ||
| app:layout_constraintEnd_toEndOf="parent" | ||
| app:layout_constraintHorizontal_bias="0.5" | ||
| app:layout_constraintStart_toStartOf="parent" | ||
| tools:layout_editor_absoluteY="16dp" /> | ||
| </androidx.constraintlayout.widget.ConstraintLayout> |
This file contains hidden or 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,33 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
| xmlns:app="http://schemas.android.com/apk/res-auto" | ||
| xmlns:tools="http://schemas.android.com/tools" | ||
| android:layout_width="match_parent" | ||
| android:layout_height="match_parent" | ||
| android:background="#4CAF50" | ||
| tools:context=".ActivityB"> | ||
|
|
||
| <Button | ||
| android:id="@+id/buttonB_openC" | ||
| android:layout_width="wrap_content" | ||
| android:layout_height="wrap_content" | ||
| android:text="Open ActivityC" | ||
| android:textAppearance="@style/TextAppearance.AppCompat.Large" | ||
| app:layout_constraintBottom_toBottomOf="parent" | ||
| app:layout_constraintEnd_toEndOf="parent" | ||
| app:layout_constraintHorizontal_bias="0.5" | ||
| app:layout_constraintStart_toStartOf="parent" | ||
| app:layout_constraintTop_toBottomOf="@+id/textView2" | ||
| app:layout_constraintVertical_bias="0.5" /> | ||
|
|
||
| <TextView | ||
| android:id="@+id/textView2" | ||
| android:layout_width="wrap_content" | ||
| android:layout_height="wrap_content" | ||
| android:text="Activity B" | ||
| android:textAppearance="@style/TextAppearance.AppCompat.Large" | ||
| app:layout_constraintEnd_toEndOf="parent" | ||
| app:layout_constraintHorizontal_bias="0.5" | ||
| app:layout_constraintStart_toStartOf="parent" | ||
| tools:layout_editor_absoluteY="16dp" /> | ||
| </androidx.constraintlayout.widget.ConstraintLayout> |
This file contains hidden or 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,75 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
| xmlns:app="http://schemas.android.com/apk/res-auto" | ||
| xmlns:tools="http://schemas.android.com/tools" | ||
| android:layout_width="match_parent" | ||
| android:layout_height="match_parent" | ||
| android:background="#2196F3" | ||
| tools:context=".ActivityC"> | ||
|
|
||
| <Button | ||
| android:id="@+id/buttonC_openA" | ||
| android:layout_width="wrap_content" | ||
| android:layout_height="wrap_content" | ||
| android:layout_marginBottom="90dp" | ||
| android:text="Open ActivityA" | ||
| android:textAppearance="@style/TextAppearance.AppCompat.Large" | ||
| app:layout_constraintBottom_toTopOf="@+id/buttonC_openD" | ||
| app:layout_constraintEnd_toEndOf="parent" | ||
| app:layout_constraintHorizontal_bias="0.5" | ||
| app:layout_constraintStart_toStartOf="parent" | ||
| app:layout_constraintTop_toBottomOf="@+id/textView3" | ||
| app:layout_constraintVertical_bias="0.5" /> | ||
|
|
||
| <Button | ||
| android:id="@+id/buttonC_openD" | ||
| android:layout_width="wrap_content" | ||
| android:layout_height="wrap_content" | ||
| android:layout_marginBottom="90dp" | ||
| android:text="Open ActivityD" | ||
| android:textAppearance="@style/TextAppearance.AppCompat.Large" | ||
| app:layout_constraintBottom_toTopOf="@+id/buttonC_close" | ||
| app:layout_constraintEnd_toEndOf="parent" | ||
| app:layout_constraintHorizontal_bias="0.5" | ||
| app:layout_constraintStart_toStartOf="parent" | ||
| app:layout_constraintTop_toBottomOf="@+id/buttonC_openA" | ||
| app:layout_constraintVertical_bias="0.5" /> | ||
|
|
||
| <Button | ||
| android:id="@+id/buttonC_close" | ||
| android:layout_width="wrap_content" | ||
| android:layout_height="wrap_content" | ||
| android:layout_marginBottom="91dp" | ||
| android:text="Close ActivityC" | ||
| android:textAppearance="@style/TextAppearance.AppCompat.Large" | ||
| app:layout_constraintBottom_toTopOf="@+id/buttonC_closeAll" | ||
| app:layout_constraintEnd_toEndOf="parent" | ||
| app:layout_constraintHorizontal_bias="0.5" | ||
| app:layout_constraintStart_toStartOf="parent" | ||
| app:layout_constraintTop_toBottomOf="@+id/buttonC_openD" | ||
| app:layout_constraintVertical_bias="0.5" /> | ||
|
|
||
| <Button | ||
| android:id="@+id/buttonC_closeAll" | ||
| android:layout_width="wrap_content" | ||
| android:layout_height="wrap_content" | ||
| android:text="Close Stack" | ||
| android:textAppearance="@style/TextAppearance.AppCompat.Large" | ||
| app:layout_constraintBottom_toBottomOf="parent" | ||
| app:layout_constraintEnd_toEndOf="parent" | ||
| app:layout_constraintHorizontal_bias="0.5" | ||
| app:layout_constraintStart_toStartOf="parent" | ||
| app:layout_constraintTop_toBottomOf="@+id/buttonC_close" | ||
| app:layout_constraintVertical_bias="0.5" /> | ||
|
|
||
| <TextView | ||
| android:id="@+id/textView3" | ||
| android:layout_width="wrap_content" | ||
| android:layout_height="wrap_content" | ||
| android:text="Activity C" | ||
| android:textAppearance="@style/TextAppearance.AppCompat.Large" | ||
| app:layout_constraintEnd_toEndOf="parent" | ||
| app:layout_constraintHorizontal_bias="0.5" | ||
| app:layout_constraintStart_toStartOf="parent" | ||
| tools:layout_editor_absoluteY="16dp" /> | ||
| </androidx.constraintlayout.widget.ConstraintLayout> |
This file contains hidden or 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,20 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
| xmlns:app="http://schemas.android.com/apk/res-auto" | ||
| xmlns:tools="http://schemas.android.com/tools" | ||
| android:layout_width="match_parent" | ||
| android:layout_height="match_parent" | ||
| android:background="#FFEB3B" | ||
| tools:context=".ActivityD"> | ||
|
|
||
| <TextView | ||
| android:id="@+id/textView4" | ||
| android:layout_width="wrap_content" | ||
| android:layout_height="wrap_content" | ||
| android:text="Activity D" | ||
| android:textAppearance="@style/TextAppearance.AppCompat.Large" | ||
| app:layout_constraintEnd_toEndOf="parent" | ||
| app:layout_constraintHorizontal_bias="0.5" | ||
| app:layout_constraintStart_toStartOf="parent" | ||
| tools:layout_editor_absoluteY="16dp" /> | ||
| </androidx.constraintlayout.widget.ConstraintLayout> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
В принципе, можно использовать и стандартный режим. Вы правильно расставили флажки при запуске.