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..815cf4b --- /dev/null +++ b/app/src/main/java/ru/myitschool/work/BookAdapter.kt @@ -0,0 +1,26 @@ +package ru.myitschool.work + +import android.view.Gravity +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.TextView +import androidx.recyclerview.widget.RecyclerView +import ru.myitschool.work.databinding.ItemBookBinding + +class BookAdapter(private val bookList: List) : RecyclerView.Adapter() { + + //TODO: Реализовать класс BookViewHolder, используя binding + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BookViewHolder { + val inflater = LayoutInflater.from(parent.context) + val binding = ItemBookBinding.inflate(inflater, parent, false) + return BookViewHolder(binding) + } + + 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..744796d --- /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: Создать и заполнить RecyclerView + } +} \ 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..faef0fd --- /dev/null +++ b/app/src/main/res/layout/item_book.xml @@ -0,0 +1,22 @@ + + + + + + + + \ No newline at end of file