diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 0ab9e22..1c6b94f 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -1,4 +1,5 @@ plugins { + id("org.jetbrains.kotlin.android") androidApplication } @@ -17,7 +18,7 @@ android { testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } - + buildFeatures.viewBinding = true compileOptions { @@ -27,5 +28,9 @@ android { } dependencies { + implementation("androidx.appcompat:appcompat:1.7.0") + implementation("com.google.android.material:material:1.12.0") + implementation("androidx.activity:activity:1.9.1") + implementation("androidx.constraintlayout:constraintlayout:2.1.4") defaultLibrary() } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 9ee5c40..4162890 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -10,7 +10,14 @@ android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" - android:theme="@style/Theme.Default" - tools:targetApi="31" /> + android:theme="@style/Theme.Design.Light.NoActionBar" + tools:targetApi="31"> + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/ru/myitschool/work/Book.kt b/app/src/main/java/ru/myitschool/work/Book.kt new file mode 100644 index 0000000..7ee9310 --- /dev/null +++ b/app/src/main/java/ru/myitschool/work/Book.kt @@ -0,0 +1,3 @@ +package ru.myitschool.work + +data class Book(val title: String, val author: String) diff --git a/app/src/main/java/ru/myitschool/work/BookAdapter.kt b/app/src/main/java/ru/myitschool/work/BookAdapter.kt new file mode 100644 index 0000000..37c52c4 --- /dev/null +++ b/app/src/main/java/ru/myitschool/work/BookAdapter.kt @@ -0,0 +1,26 @@ +package ru.myitschool.work + +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.TextView +import androidx.recyclerview.widget.RecyclerView + +class BookAdapter(private val bookList: List) : RecyclerView.Adapter() { + + class BookViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { + val titleTextView: TextView = itemView.findViewById(R.id.bookTitle) + val authorTextView: TextView = itemView.findViewById(R.id.bookAuthor) + } + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BookViewHolder { + val itemView = LayoutInflater.from(parent.context).inflate(R.layout.item_book, parent, false) + return BookViewHolder(itemView) + } + + override fun onBindViewHolder(holder: BookViewHolder, position: Int) { + //TODO: Заполнить + } + + override fun getItemCount() = bookList.size +} diff --git a/app/src/main/java/ru/myitschool/work/MainActivity.kt b/app/src/main/java/ru/myitschool/work/MainActivity.kt new file mode 100644 index 0000000..bdfd7e6 --- /dev/null +++ b/app/src/main/java/ru/myitschool/work/MainActivity.kt @@ -0,0 +1,19 @@ +package ru.myitschool.work + +import android.os.Bundle +import androidx.activity.enableEdgeToEdge +import androidx.appcompat.app.AppCompatActivity +import androidx.core.view.ViewCompat +import androidx.core.view.WindowInsetsCompat +import androidx.recyclerview.widget.LinearLayoutManager +import androidx.recyclerview.widget.RecyclerView + +class MainActivity : AppCompatActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + enableEdgeToEdge() + setContentView(R.layout.activity_main) + + //TODO: Заполнить + } +} \ No newline at end of file diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..61a3f47 --- /dev/null +++ b/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,14 @@ + + + + + + diff --git a/app/src/main/res/layout/item_book.xml b/app/src/main/res/layout/item_book.xml new file mode 100644 index 0000000..b95abcc --- /dev/null +++ b/app/src/main/res/layout/item_book.xml @@ -0,0 +1,21 @@ + + + + + + + + \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 860f2c8..3e2b590 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -2,4 +2,5 @@ plugins { androidApplication version Version.gradle apply false kotlinJvm version Version.Kotlin.language apply false + id("org.jetbrains.kotlin.android") version "2.0.0" apply false } \ No newline at end of file