-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
111 additions
and
38 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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 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 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
41 changes: 41 additions & 0 deletions
41
app/src/main/java/net/orgiu/tests/task/affinity/TaskAffinityActivity.kt
This file contains 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,41 @@ | ||
package net.orgiu.tests.task.affinity | ||
|
||
import android.content.Intent | ||
import androidx.appcompat.app.AppCompatActivity | ||
import android.os.Bundle | ||
import net.orgiu.tests.R | ||
import net.orgiu.tests.databinding.ActivityTaskAffinityBinding | ||
import kotlin.properties.Delegates | ||
import kotlin.random.Random.Default.nextInt | ||
|
||
class TaskAffinityActivity : AppCompatActivity() { | ||
|
||
private var binding : ActivityTaskAffinityBinding by Delegates.notNull() | ||
private val charPool : List<Char> = ('a'..'z') + ('A'..'Z') + ('0'..'9') | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
|
||
binding = ActivityTaskAffinityBinding.inflate(layoutInflater) | ||
|
||
setContentView(binding.root) | ||
|
||
binding.btnNewActivity.setOnClickListener { | ||
startActivity(Intent(this, TaskAffinityActivity::class.java)) | ||
} | ||
|
||
binding.btnCloseAffinity.setOnClickListener { | ||
finishAffinity() | ||
} | ||
|
||
binding.textView.text = generateRandomText() | ||
} | ||
|
||
private fun generateRandomText(): CharSequence { | ||
val length = nextInt(0, 1000) | ||
return (1..length) | ||
.map { nextInt(0, charPool.size) } | ||
.map(charPool::get) | ||
.joinToString("") | ||
} | ||
} |
This file contains 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,44 @@ | ||
<?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" | ||
tools:context=".task.affinity.TaskAffinityActivity"> | ||
|
||
<TextView | ||
android:id="@+id/textView" | ||
android:layout_width="0dp" | ||
android:layout_height="0dp" | ||
android:layout_marginStart="16dp" | ||
android:layout_marginTop="16dp" | ||
android:layout_marginEnd="16dp" | ||
android:layout_marginBottom="16dp" | ||
android:text="TextView" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" /> | ||
|
||
<Button | ||
android:id="@+id/btnNewActivity" | ||
android:layout_width="0dp" | ||
android:layout_height="wrap_content" | ||
android:layout_marginStart="32dp" | ||
android:layout_marginEnd="32dp" | ||
android:layout_marginBottom="32dp" | ||
android:text="New Activity Of Same Task" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" /> | ||
|
||
<Button | ||
android:id="@+id/btnCloseAffinity" | ||
android:layout_width="0dp" | ||
android:layout_height="wrap_content" | ||
android:layout_marginBottom="16dp" | ||
android:text="Close Affinity" | ||
app:layout_constraintBottom_toTopOf="@+id/btnNewActivity" | ||
app:layout_constraintEnd_toEndOf="@+id/btnNewActivity" | ||
app:layout_constraintStart_toStartOf="@+id/btnNewActivity" /> | ||
</androidx.constraintlayout.widget.ConstraintLayout> |
This file contains 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 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 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 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 |
---|---|---|
@@ -1 +1 @@ | ||
include ':app', ':openoffline', ':weightwatcher', ':branchview' | ||
include ':app' |