1
0

2 Ревизии fbfc280620 ... ca1d4580d4

Автор SHA1 Съобщение Дата
  ПроваленкоЛН ca1d4580d4 Вывела табличку преди 1 месец
  ПроваленкоЛН 0ca8d3cb45 Вывела табличку преди 1 месец

+ 1 - 0
.idea/gradle.xml

@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <project version="4">
+  <component name="GradleMigrationSettings" migrationVersion="1" />
   <component name="GradleSettings">
     <option name="linkedExternalProjectsSettings">
       <GradleProjectSettings>

+ 42 - 0
.idea/inspectionProfiles/Project_Default.xml

@@ -0,0 +1,42 @@
+<component name="InspectionProjectProfileManager">
+  <profile version="1.0">
+    <option name="myName" value="Project Default" />
+    <inspection_tool class="PreviewAnnotationInFunctionWithParameters" enabled="true" level="ERROR" enabled_by_default="true">
+      <option name="composableFile" value="true" />
+      <option name="previewFile" value="true" />
+    </inspection_tool>
+    <inspection_tool class="PreviewApiLevelMustBeValid" enabled="true" level="ERROR" enabled_by_default="true">
+      <option name="composableFile" value="true" />
+      <option name="previewFile" value="true" />
+    </inspection_tool>
+    <inspection_tool class="PreviewDimensionRespectsLimit" enabled="true" level="WARNING" enabled_by_default="true">
+      <option name="composableFile" value="true" />
+      <option name="previewFile" value="true" />
+    </inspection_tool>
+    <inspection_tool class="PreviewFontScaleMustBeGreaterThanZero" enabled="true" level="ERROR" enabled_by_default="true">
+      <option name="composableFile" value="true" />
+      <option name="previewFile" value="true" />
+    </inspection_tool>
+    <inspection_tool class="PreviewMultipleParameterProviders" enabled="true" level="ERROR" enabled_by_default="true">
+      <option name="composableFile" value="true" />
+      <option name="previewFile" value="true" />
+    </inspection_tool>
+    <inspection_tool class="PreviewMustBeTopLevelFunction" enabled="true" level="ERROR" enabled_by_default="true">
+      <option name="composableFile" value="true" />
+      <option name="previewFile" value="true" />
+    </inspection_tool>
+    <inspection_tool class="PreviewNeedsComposableAnnotation" enabled="true" level="ERROR" enabled_by_default="true">
+      <option name="composableFile" value="true" />
+      <option name="previewFile" value="true" />
+    </inspection_tool>
+    <inspection_tool class="PreviewNotSupportedInUnitTestFiles" enabled="true" level="ERROR" enabled_by_default="true">
+      <option name="composableFile" value="true" />
+      <option name="previewFile" value="true" />
+    </inspection_tool>
+    <inspection_tool class="PreviewPickerAnnotation" enabled="true" level="ERROR" enabled_by_default="true">
+      <option name="composableFile" value="true" />
+      <option name="previewFile" value="true" />
+    </inspection_tool>
+    <inspection_tool class="UnstableApiUsage" enabled="false" level="WARNING" enabled_by_default="false" />
+  </profile>
+</component>

+ 6 - 0
.idea/vcs.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="VcsDirectoryMappings">
+    <mapping directory="" vcs="Git" />
+  </component>
+</project>

+ 8 - 6
app/build.gradle.kts

@@ -1,8 +1,11 @@
 plugins {
     alias(libs.plugins.android.application)
-    alias(libs.plugins.jetbrains.kotlin.android)
+    alias(libs.plugins.kotlin.android)
+    kotlin("plugin.serialization") version "1.9.22"
 }
 
+
+
 android {
     namespace = "com.example.test"
     compileSdk = 34
@@ -69,11 +72,10 @@ dependencies {
 
 
     implementation(platform(libs.bom))
-    implementation(libs.postgrest.kt)
-    implementation(libs.gotrue.kt)
-    implementation(libs.realtime.kt)
+    implementation(libs.supabase.postgrest.kt)
+    implementation(libs.supabase.realtime.kt)
+    implementation(libs.ktor.client.android)
 
     implementation(libs.coil.compose)
-
-
+    implementation(libs.storage.kt)
 }

+ 1 - 1
app/src/main/AndroidManifest.xml

@@ -15,7 +15,7 @@
         android:theme="@style/Theme.Test"
         tools:targetApi="31">
         <activity
-            android:name=".view.ui.theme.MainActivity"
+            android:name="com.example.test.view.ui.view.MainActivity"
             android:exported="true"
             android:label="@string/app_name"
             android:theme="@style/Theme.Test">

+ 0 - 9
app/src/main/java/com/example/test/Model/Film.kt

@@ -1,9 +0,0 @@
-package com.example.test.Model
-
-import kotlinx.serialization.Serializable
-
-@Serializable
-data class Film(
-    val id: Int,
-    val name: String
-)

+ 0 - 17
app/src/main/java/com/example/test/domain/Constant.kt

@@ -1,17 +0,0 @@
-package com.example.test.domain
-
-import io.github.jan.supabase.createSupabaseClient
-import io.github.jan.supabase.gotrue.Auth
-import io.github.jan.supabase.gotrue.FlowType
-import io.github.jan.supabase.postgrest.Postgrest
-import io.ktor.http.auth.parseAuthorizationHeader
-
-object Constant {
-    val supabase = createSupabaseClient(
-        supabaseUrl = "https://bdxftijaebxgfssqqfhr.supabase.co",
-        supabaseKey = "public-anon-key"
-    ){
-        install(Postgrest)
-        install(Auth)
-    }
-}

+ 17 - 0
app/src/main/java/com/example/test/domain/utlls/Constant.kt

@@ -0,0 +1,17 @@
+package com.example.test.domain.utlls
+
+import io.github.jan.supabase.createSupabaseClient
+import io.github.jan.supabase.gotrue.Auth
+import io.github.jan.supabase.postgrest.Postgrest
+import io.github.jan.supabase.storage.Storage
+
+object Constant {
+    val supabase = createSupabaseClient(
+        supabaseUrl = "https://bdxftijaebxgfssqqfhr.supabase.co",
+        supabaseKey = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImJkeGZ0aWphZWJ4Z2Zzc3FxZmhyIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MjU1MjY2MjEsImV4cCI6MjA0MTEwMjYyMX0.pkNIcD2Zgstp4WtocEBPrd9vX-kabRZfBIfnQ6IguHo"
+    ){
+        install(Auth)
+        install(Postgrest)
+        install(Storage)
+    }
+}

+ 10 - 0
app/src/main/java/com/example/test/model/films.kt

@@ -0,0 +1,10 @@
+package com.example.test.model
+
+import kotlinx.serialization.Serializable
+
+@Serializable
+data class films(
+    val id: Int,
+    val films_name: String,
+    val foto: String?
+)

+ 5 - 3
app/src/main/java/com/example/test/view/ui/theme/MainActivity.kt → app/src/main/java/com/example/test/view/ui/view/MainActivity.kt

@@ -1,4 +1,4 @@
-package com.example.test.view.ui.theme
+package com.example.test.view.ui.view
 
 import android.os.Bundle
 import androidx.activity.ComponentActivity
@@ -14,7 +14,9 @@ import androidx.compose.runtime.Composable
 import androidx.compose.ui.Alignment
 import androidx.compose.ui.Modifier
 import androidx.compose.ui.tooling.preview.Preview
-import com.example.test.ui.theme.TestTheme
+import com.example.test.view.ui.view.theme.TestTheme
+import com.example.test.view.ui.view.components.FilmsList
+import com.example.test.view.ui.view.theme.TestTheme
 
 class MainActivity : ComponentActivity() {
     override fun onCreate(savedInstanceState: Bundle?) {
@@ -26,7 +28,7 @@ class MainActivity : ComponentActivity() {
                     verticalArrangement = Arrangement.Center,
                     horizontalAlignment = Alignment.CenterHorizontally
                 ) {
-
+                   FilmsList()
                 }
                 }
             }

+ 87 - 0
app/src/main/java/com/example/test/view/ui/view/components/FilmList.kt

@@ -0,0 +1,87 @@
+package com.example.test.view.ui.view.components
+
+import com.example.test.model.films
+import com.example.test.domain.utlls.Constant
+
+import android.util.Log
+import androidx.compose.foundation.Image
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.foundation.layout.height
+import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.lazy.LazyColumn
+import androidx.compose.foundation.lazy.items
+import androidx.compose.material3.CircularProgressIndicator
+import androidx.compose.material3.Text
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.LaunchedEffect
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
+import androidx.compose.runtime.setValue
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.layout.ContentScale
+import androidx.compose.ui.platform.LocalContext
+import androidx.compose.ui.unit.dp
+import coil.compose.AsyncImagePainter
+import coil.compose.rememberAsyncImagePainter
+import coil.request.ImageRequest
+import coil.size.Size
+import io.github.jan.supabase.postgrest.from
+import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.withContext
+
+@Composable
+fun FilmsList() {
+    var Films1 by remember { mutableStateOf<List<films>>(listOf()) }
+
+    LaunchedEffect(Unit) {
+        withContext(Dispatchers.IO) {
+            Films1 = Constant.supabase.from("films")
+                .select().decodeList<films>()
+            Films1.forEach{it->
+                Log.d("C",it.films_name)
+            }
+        }
+    }
+
+    LazyColumn {
+
+        items(
+            Films1,
+            key = { films -> films.id },
+        ) { films ->
+            val imageState = rememberAsyncImagePainter(
+                model = ImageRequest.Builder(LocalContext.current).data(films.foto)
+                    .size(Size.ORIGINAL).build()
+            ).state
+            if (imageState is AsyncImagePainter.State.Error) {
+                Box(
+                    modifier = Modifier
+                        .fillMaxWidth()
+                        .height(200.dp),
+                    contentAlignment = Alignment.Center
+                ) {
+                    CircularProgressIndicator()
+                }
+            }
+
+            if (imageState is AsyncImagePainter.State.Success) {
+                Image(
+                    modifier = Modifier
+                        .fillMaxWidth()
+                        .height(200.dp),
+                    painter = imageState.painter,
+                    contentDescription = "",
+                    contentScale = ContentScale.Crop
+                )
+            }
+            Text(
+                films.films_name,
+                modifier = Modifier.padding(8.dp),
+            )
+
+        }
+    }
+}

+ 4 - 4
app/src/main/java/com/example/test/view/ui/theme/components/itemfilm.kt → app/src/main/java/com/example/test/view/ui/view/components/itemfilm.kt

@@ -1,16 +1,16 @@
-package com.example.test.view.ui.theme.components
+package com.example.test.view.ui.view.components
 
 import androidx.compose.foundation.layout.padding
 import androidx.compose.material3.Text
 import androidx.compose.runtime.Composable
 import androidx.compose.ui.Modifier
 import androidx.compose.ui.unit.dp
-import com.example.test.Model.Film
+import com.example.test.model.films
 
 @Composable
-fun itemfilm(film: Film){
+fun itemfilm(film: films){
     Text(
-        film.name,
+        film.films_name,
         modifier = Modifier.padding(8.dp),
     )
 }

+ 1 - 1
app/src/main/java/com/example/test/view/ui/theme/theme/Color.kt → app/src/main/java/com/example/test/view/ui/view/theme/Color.kt

@@ -1,4 +1,4 @@
-package com.example.test.ui.theme
+package com.example.test.view.ui.view.theme
 
 import androidx.compose.ui.graphics.Color
 

+ 1 - 2
app/src/main/java/com/example/test/view/ui/theme/theme/Theme.kt → app/src/main/java/com/example/test/view/ui/view/theme/Theme.kt

@@ -1,4 +1,4 @@
-package com.example.test.ui.theme
+package com.example.test.view.ui.view.theme
 
 import android.os.Build
 import androidx.compose.foundation.isSystemInDarkTheme
@@ -51,7 +51,6 @@ fun TestTheme(
 
     MaterialTheme(
         colorScheme = colorScheme,
-        typography = Typography,
         content = content
     )
 }

+ 1 - 1
app/src/main/java/com/example/test/view/ui/theme/theme/Type.kt → app/src/main/java/com/example/test/view/ui/view/theme/Type.kt

@@ -1,4 +1,4 @@
-package com.example.test.ui.theme
+package com.example.test.view.ui.view.theme
 
 import androidx.compose.material3.Typography
 import androidx.compose.ui.text.TextStyle

+ 1 - 1
build.gradle.kts

@@ -1,5 +1,5 @@
 // Top-level build file where you can add configuration options common to all sub-projects/modules.
 plugins {
     alias(libs.plugins.android.application) apply false
-    alias(libs.plugins.jetbrains.kotlin.android) apply false
+    alias(libs.plugins.kotlin.android) apply false
 }

+ 24 - 11
gradle/libs.versions.toml

@@ -1,20 +1,27 @@
 [versions]
 agp = "8.5.1"
-bom = "2.6.1"
-kotlin = "1.9.0"
+bom = "2.6.0"
 coilCompose = "2.4.0"
-coreKtx = "1.13.1"
+kotlin = "1.9.0"
+coreKtx = "1.10.1"
 junit = "4.13.2"
-junitVersion = "1.2.1"
-espressoCore = "3.6.1"
-lifecycleRuntimeKtx = "2.8.5"
-activityCompose = "1.9.2"
+junitVersion = "1.1.5"
+espressoCore = "3.5.1"
+ktor_version="2.3.12"
+ktorClientAndroid = "2.3.12"
+lifecycleRuntimeKtx = "2.6.1"
+activityCompose = "1.8.0"
 composeBom = "2024.04.01"
+storageKt = "2.0.4"
+xmodule_z = "2.6.0"
+volley = "1.2.1"
 
 [libraries]
 androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
-coil-compose = { module = "io.coil-kt:coil-compose", version.ref = "coilCompose" }
 bom = { module = "io.github.jan-tennert.supabase:bom", version.ref = "bom" }
+coil-compose = { module = "io.coil-kt:coil-compose", version.ref = "coilCompose" }
+github-postgrest-kt = { module = "io.github.jan-tennert.supabase:postgrest-kt" }
+github-realtime-kt = { module = "io.github.jan-tennert.supabase:realtime-kt" }
 gotrue-kt = { module = "io.github.jan-tennert.supabase:gotrue-kt" }
 junit = { group = "junit", name = "junit", version.ref = "junit" }
 androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
@@ -29,10 +36,16 @@ androidx-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-toolin
 androidx-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" }
 androidx-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" }
 androidx-material3 = { group = "androidx.compose.material3", name = "material3" }
-postgrest-kt = { module = "io.github.jan-tennert.supabase:postgrest-kt" }
+ktor-client-android = { module = "io.ktor:ktor-client-android", version.ref = "ktor_version" }
+ktor-ktor-client-android = { module = "io.ktor:ktor-client-Android", version.ref = "ktorClientAndroid" }
 realtime-kt = { module = "io.github.jan-tennert.supabase:realtime-kt" }
+postgrest-kt = { module = "io.github.jan-tennert.supabase:postgrest-kt" }
+storage-kt = { module = "io.github.jan-tennert.supabase:storage-kt", version.ref = "storageKt" }
+supabase-realtime-kt = { module = "io.github.jan-tennert.supabase:realtime-kt" }
+supabase-postgrest-kt = { module = "io.github.jan-tennert.supabase:postgrest-kt" }
+xmodule_z = { module = "io.github.jan-tennert.supabase:[module]", version.ref = "xmodule_z" }
+volley = { group = "com.android.volley", name = "volley", version.ref = "volley" }
 
 [plugins]
 android-application = { id = "com.android.application", version.ref = "agp" }
-jetbrains-kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
-
+kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }

+ 6 - 1
settings.gradle.kts

@@ -1,3 +1,5 @@
+import org.gradle.api.initialization.resolve.RepositoriesMode.FAIL_ON_PROJECT_REPOS
+
 pluginManagement {
     repositories {
         google {
@@ -11,8 +13,11 @@ pluginManagement {
         gradlePluginPortal()
     }
 }
+
+
+
 dependencyResolutionManagement {
-    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
+    repositoriesMode.set(FAIL_ON_PROJECT_REPOS)
     repositories {
         google()
         mavenCentral()