commit 6bd068ac2b6ecfbc1819e1d98a771f64a4969823 Author: KP9lK Date: Fri Sep 27 20:59:13 2024 +0300 init diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..aa724b7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,15 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx +local.properties diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/app/build.gradle.kts b/app/build.gradle.kts new file mode 100644 index 0000000..4ac4cc7 --- /dev/null +++ b/app/build.gradle.kts @@ -0,0 +1,48 @@ +plugins { + alias(libs.plugins.android.application) + alias(libs.plugins.jetbrains.kotlin.android) +} + +android { + namespace = "com.example.recyclerviewsample" + compileSdk = 34 + + defaultConfig { + applicationId = "com.example.recyclerviewsample" + minSdk = 24 + targetSdk = 34 + versionCode = 1 + versionName = "1.0" + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + isMinifyEnabled = false + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules.pro" + ) + } + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + kotlinOptions { + jvmTarget = "1.8" + } +} + +dependencies { + + implementation(libs.androidx.core.ktx) + implementation(libs.androidx.appcompat) + implementation(libs.material) + implementation(libs.androidx.activity) + implementation(libs.androidx.constraintlayout) + testImplementation(libs.junit) + androidTestImplementation(libs.androidx.junit) + androidTestImplementation(libs.androidx.espresso.core) +} \ No newline at end of file diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/app/src/androidTest/java/com/example/recyclerviewsample/ExampleInstrumentedTest.kt b/app/src/androidTest/java/com/example/recyclerviewsample/ExampleInstrumentedTest.kt new file mode 100644 index 0000000..e43f226 --- /dev/null +++ b/app/src/androidTest/java/com/example/recyclerviewsample/ExampleInstrumentedTest.kt @@ -0,0 +1,24 @@ +package com.example.recyclerviewsample + +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.ext.junit.runners.AndroidJUnit4 + +import org.junit.Test +import org.junit.runner.RunWith + +import org.junit.Assert.* + +/** + * Instrumented test, which will execute on an Android device. + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { + @Test + fun useAppContext() { + // Context of the app under test. + val appContext = InstrumentationRegistry.getInstrumentation().targetContext + assertEquals("com.example.recyclerviewsample", appContext.packageName) + } +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..d95cdf0 --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/com/example/recyclerviewsample/MainActivity.kt b/app/src/main/java/com/example/recyclerviewsample/MainActivity.kt new file mode 100644 index 0000000..257b685 --- /dev/null +++ b/app/src/main/java/com/example/recyclerviewsample/MainActivity.kt @@ -0,0 +1,38 @@ +package com.example.recyclerviewsample + +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.RecyclerView + +class MainActivity : AppCompatActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + enableEdgeToEdge() + setContentView(R.layout.activity_main) + val dataSample = listOf( + SampleData(sampleName = "sample1", sampleDescription = "sample1".repeat(5)), + SampleData(sampleName = "sample2", sampleDescription = "sample2".repeat(5)), + SampleData(sampleName = "sample3", sampleDescription = "sample3".repeat(5)), + SampleData(sampleName = "sample4", sampleDescription = "sample4".repeat(5)), + SampleData(sampleName = "sample5", sampleDescription = "sample5".repeat(5)), + SampleData(sampleName = "sample5", sampleDescription = "sample5".repeat(5)), + SampleData(sampleName = "sample5", sampleDescription = "sample5".repeat(5)), + SampleData(sampleName = "sample5", sampleDescription = "sample5".repeat(5)), + SampleData(sampleName = "sample5", sampleDescription = "sample5".repeat(5)), + SampleData(sampleName = "sample5", sampleDescription = "sample5".repeat(5)), + SampleData(sampleName = "sample5", sampleDescription = "sample5".repeat(5)), + SampleData(sampleName = "sample5", sampleDescription = "sample5".repeat(5)), + SampleData(sampleName = "sample5", sampleDescription = "sample5".repeat(5)), + SampleData(sampleName = "sample5", sampleDescription = "sample5".repeat(5)), + SampleData(sampleName = "sample5", sampleDescription = "sample5".repeat(5)), + SampleData(sampleName = "sample5", sampleDescription = "sample5".repeat(5)), + SampleData(sampleName = "sample5", sampleDescription = "sample5".repeat(5)), + ) + val sampleRecyclerView = findViewById(R.id.SampleRecyclerViewList) + val adapter = SampleRecyclerViewAdapter(dataSample) + sampleRecyclerView.adapter = adapter + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/recyclerviewsample/SampleData.kt b/app/src/main/java/com/example/recyclerviewsample/SampleData.kt new file mode 100644 index 0000000..59f7b31 --- /dev/null +++ b/app/src/main/java/com/example/recyclerviewsample/SampleData.kt @@ -0,0 +1,3 @@ +package com.example.recyclerviewsample + +data class SampleData(val sampleName: String, val sampleDescription: String) diff --git a/app/src/main/java/com/example/recyclerviewsample/SampleRecyclerViewAdapter.kt b/app/src/main/java/com/example/recyclerviewsample/SampleRecyclerViewAdapter.kt new file mode 100644 index 0000000..bb460b5 --- /dev/null +++ b/app/src/main/java/com/example/recyclerviewsample/SampleRecyclerViewAdapter.kt @@ -0,0 +1,34 @@ +package com.example.recyclerviewsample + +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.TextView +import androidx.recyclerview.widget.RecyclerView.Adapter +import androidx.recyclerview.widget.RecyclerView.ViewHolder + +class SampleRecyclerViewAdapter(private val sampleList: List): Adapter() { + + class SampleRecyclerViewHolder(itemView: View) : ViewHolder(itemView){ + val sampleName = itemView.findViewById(R.id.SampleCardName) + val sampleDescription = itemView.findViewById(R.id.SampleCardDescription) + + fun bind(sampleData: SampleData) { + sampleName.text = sampleData.sampleName + sampleDescription.text = sampleData.sampleDescription + } + } + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): SampleRecyclerViewHolder { + val view = LayoutInflater.from(parent.context).inflate(R.layout.sample_recycler_view_item, parent, false) + return SampleRecyclerViewHolder(view) + } + + override fun getItemCount(): Int { + return sampleList.size + } + + override fun onBindViewHolder(holder: SampleRecyclerViewHolder, position: Int) { + holder.bind(sampleData = sampleList[position]) + } +} \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..07d5da9 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/ic_launcher_foreground.xml b/app/src/main/res/drawable/ic_launcher_foreground.xml new file mode 100644 index 0000000..2b068d1 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ 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..af32115 --- /dev/null +++ b/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,19 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/sample_recycler_view_item.xml b/app/src/main/res/layout/sample_recycler_view_item.xml new file mode 100644 index 0000000..ebc0378 --- /dev/null +++ b/app/src/main/res/layout/sample_recycler_view_item.xml @@ -0,0 +1,26 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000..6f3b755 --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 0000000..6f3b755 --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/app/src/main/res/mipmap-hdpi/ic_launcher.webp new file mode 100644 index 0000000..c209e78 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher.webp differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp new file mode 100644 index 0000000..b2dfe3d Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/app/src/main/res/mipmap-mdpi/ic_launcher.webp new file mode 100644 index 0000000..4f0f1d6 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher.webp differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp new file mode 100644 index 0000000..62b611d Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xhdpi/ic_launcher.webp new file mode 100644 index 0000000..948a307 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher.webp differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..1b9a695 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp new file mode 100644 index 0000000..28d4b77 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..9287f50 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp new file mode 100644 index 0000000..aa7d642 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..9126ae3 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp differ diff --git a/app/src/main/res/values-night/themes.xml b/app/src/main/res/values-night/themes.xml new file mode 100644 index 0000000..07a0850 --- /dev/null +++ b/app/src/main/res/values-night/themes.xml @@ -0,0 +1,7 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml new file mode 100644 index 0000000..c8524cd --- /dev/null +++ b/app/src/main/res/values/colors.xml @@ -0,0 +1,5 @@ + + + #FF000000 + #FFFFFFFF + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..be70bb4 --- /dev/null +++ b/app/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + RecyclerViewSample + \ No newline at end of file diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml new file mode 100644 index 0000000..4f723b4 --- /dev/null +++ b/app/src/main/res/values/themes.xml @@ -0,0 +1,9 @@ + + + + +