diff --git a/app/build.gradle b/app/build.gradle index c5cf1b8..7976d9d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -3,12 +3,8 @@ plugins { id 'org.jetbrains.kotlin.android' } -kotlin { - jvmToolchain(17) -} - android { - compileSdk 34 + compileSdk 35 namespace "otus.gpb.homework.fragments" defaultConfig { @@ -42,6 +38,8 @@ dependencies { implementation 'androidx.appcompat:appcompat:1.5.1' implementation 'com.google.android.material:material:1.6.1' implementation 'androidx.constraintlayout:constraintlayout:2.1.4' + implementation 'androidx.activity:activity:1.10.1' + implementation 'androidx.fragment:fragment-ktx:1.8.6' testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 9604b34..5b4cb53 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -12,6 +12,12 @@ android:supportsRtl="true" android:theme="@style/Theme.Fragments" tools:targetApi="31"> + + diff --git a/app/src/main/java/otus/gpb/homework/fragments/ColorGenerator.kt b/app/src/main/java/otus/gpb/homework/fragments/ColorGenerator.kt index 3a4a5ac..b5c1517 100644 --- a/app/src/main/java/otus/gpb/homework/fragments/ColorGenerator.kt +++ b/app/src/main/java/otus/gpb/homework/fragments/ColorGenerator.kt @@ -1,13 +1,13 @@ package otus.gpb.homework.fragments -import android.graphics.Color import java.util.Random +import androidx.core.graphics.toColorInt object ColorGenerator { fun generateColor(): Int { val nextInt = Random().nextInt(0xffffff + 1) val colorCode = String.format("#%06x", nextInt) - return Color.parseColor(colorCode) + return colorCode.toColorInt() } } \ No newline at end of file diff --git a/app/src/main/java/otus/gpb/homework/fragments/MainActivity.kt b/app/src/main/java/otus/gpb/homework/fragments/MainActivity.kt index 5e89c44..d726baf 100644 --- a/app/src/main/java/otus/gpb/homework/fragments/MainActivity.kt +++ b/app/src/main/java/otus/gpb/homework/fragments/MainActivity.kt @@ -1,12 +1,25 @@ package otus.gpb.homework.fragments import android.os.Bundle +import android.widget.Button import androidx.appcompat.app.AppCompatActivity +import otus.gpb.homework.fragments.ui.ActivityA +import otus.gpb.homework.fragments.ui.ActivityB +import android.content.Intent class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) + + findViewById