Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
ab9d8b9
feat: unified share
alperozturk96 Apr 20, 2026
bfa5cbb
add api models
alperozturk96 Apr 21, 2026
8fb13d6
adopt mock models to api models
alperozturk96 Apr 21, 2026
e81fbd0
add translations, bind ui actions
alperozturk96 Apr 21, 2026
1b3daa0
add translations, bind ui actions
alperozturk96 Apr 21, 2026
736a8f8
wip
alperozturk96 Apr 21, 2026
1a78b61
wip
alperozturk96 May 5, 2026
1a9d796
add test ocs call
alperozturk96 Apr 24, 2026
5221d7c
fix test call
alperozturk96 May 5, 2026
c9cb52a
use client
alperozturk96 May 5, 2026
cebaf33
wip
alperozturk96 May 5, 2026
266fcaa
wip
alperozturk96 May 5, 2026
e84f152
wip
alperozturk96 May 5, 2026
cf6a8b4
wip
alperozturk96 May 6, 2026
842b6a0
wip
alperozturk96 May 6, 2026
dfb9411
wip
alperozturk96 May 27, 2026
7156afc
wip
alperozturk96 May 27, 2026
b69d239
wip
alperozturk96 May 27, 2026
9d74f5b
add empty view state
alperozturk96 May 27, 2026
4649ac2
wip
alperozturk96 May 27, 2026
3408e39
wip
alperozturk96 May 28, 2026
dadb0f0
wip
alperozturk96 May 28, 2026
fa9906a
wip
alperozturk96 May 28, 2026
ac501d7
wip
alperozturk96 May 29, 2026
5090cad
wip
alperozturk96 May 29, 2026
4d30792
wip
alperozturk96 May 29, 2026
307c218
wip
alperozturk96 May 29, 2026
98a0065
wip
alperozturk96 May 29, 2026
2d3ba0e
wip
alperozturk96 May 29, 2026
b6b37cd
wip
alperozturk96 May 29, 2026
90c6d82
wip
alperozturk96 Jun 1, 2026
c0e601e
wip
alperozturk96 Jun 1, 2026
d6b595f
wip
alperozturk96 Jun 1, 2026
e31d35a
wip
alperozturk96 Jun 1, 2026
e10776e
wip
alperozturk96 Jun 1, 2026
a189419
wip
alperozturk96 Jun 1, 2026
d51cd8c
wip
alperozturk96 Jun 1, 2026
06dd8e1
wip
alperozturk96 Jun 1, 2026
62212b3
wip
alperozturk96 Jun 1, 2026
6f3f919
wip
alperozturk96 Jun 1, 2026
9de1a18
wip
alperozturk96 Jun 9, 2026
129ecee
wip
alperozturk96 Jun 9, 2026
a219203
wip
alperozturk96 Jun 9, 2026
87da22b
wip
alperozturk96 Jun 9, 2026
5d91b88
wip
alperozturk96 Jun 9, 2026
caf0207
disable multi recipients
alperozturk96 Jun 10, 2026
e4c0837
disable multi recipients
alperozturk96 Jun 10, 2026
7a44806
add secret and buttons
alperozturk96 Jun 10, 2026
a207da6
add secret and buttons
alperozturk96 Jun 10, 2026
61c68bb
fix enabled
alperozturk96 Jun 10, 2026
ab9cdb8
use ISO8601
alperozturk96 Jun 10, 2026
dacb751
adopt latest open api
alperozturk96 Jun 10, 2026
094dbec
property updates
alperozturk96 Jun 10, 2026
522cc85
add anyone recipient
alperozturk96 Jun 10, 2026
02f54bc
better error handling
alperozturk96 Jun 10, 2026
f47222d
better error handling
alperozturk96 Jun 10, 2026
1129c28
fix issues
alperozturk96 Jun 10, 2026
0413f26
fix issues
alperozturk96 Jun 10, 2026
12bf935
wip
alperozturk96 Jun 22, 2026
d728b1a
wip
alperozturk96 Jul 2, 2026
2d8d41f
wip
alperozturk96 Jul 2, 2026
a71cf5c
wip
alperozturk96 Jul 2, 2026
018d3d7
add PermissionPresetDropdown
alperozturk96 Jul 2, 2026
f23f0a4
remove unused strings
alperozturk96 Jul 2, 2026
d617f72
wip
alperozturk96 Jul 2, 2026
5ba7840
wip
alperozturk96 Jul 2, 2026
fa6d5e6
wip
alperozturk96 Jul 2, 2026
a2fd171
wip
alperozturk96 Jul 2, 2026
13b5d9b
wip
alperozturk96 Jul 3, 2026
3f7e6bf
wip
alperozturk96 Jul 3, 2026
c45257d
wip
alperozturk96 Jul 3, 2026
9bcbdd2
wip
alperozturk96 Jul 3, 2026
03b92a3
wip
alperozturk96 Jul 3, 2026
bdd9682
wip
alperozturk96 Jul 3, 2026
bf2b241
wip
alperozturk96 Jul 3, 2026
771c5df
wip
alperozturk96 Jul 3, 2026
44cbe44
wip
alperozturk96 Jul 3, 2026
74a074a
wip
alperozturk96 Jul 3, 2026
71f1326
wip
alperozturk96 Jul 3, 2026
3e326fd
wip
alperozturk96 Jul 3, 2026
9ab0cb3
wip
alperozturk96 Jul 3, 2026
39591fe
wip
alperozturk96 Jul 3, 2026
274ef85
wip
alperozturk96 Jul 3, 2026
50b0d4c
wip
alperozturk96 Jul 6, 2026
ec5d1b6
wip
alperozturk96 Jul 6, 2026
01d9ba9
wip
alperozturk96 Jul 6, 2026
3761357
wip
alperozturk96 Jul 6, 2026
95467c3
wip
alperozturk96 Jul 6, 2026
0bcb4cd
wip
alperozturk96 Jul 6, 2026
34ebf2c
wip
alperozturk96 Jul 6, 2026
65ba518
wip
alperozturk96 Jul 6, 2026
b474016
wip
alperozturk96 Jul 8, 2026
2f407f7
wip
alperozturk96 Jul 8, 2026
d7083e5
wip
alperozturk96 Jul 8, 2026
7cd5bbb
wip
alperozturk96 Jul 8, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions gradle/verification-metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
<trusting group="androidx.customview" name="customview" version="1.2.0"/>
<trusting group="androidx.databinding"/>
<trusting group="androidx.dynamicanimation" name="dynamicanimation" version="1.1.0"/>
<trusting group="androidx.exifinterface" name="exifinterface" version="1.4.2"/>
<trusting group="androidx.lifecycle"/>
<trusting group="androidx.savedstate"/>
<trusting group="androidx.swiperefreshlayout" name="swiperefreshlayout" version="1.2.0"/>
Expand All @@ -97,13 +98,19 @@
<trusted-key id="19BEAB2D799C020F17C69126B16698A4ADF4D638" group="org.checkerframework"/>
<trusted-key id="1A55F091AD28C07F831FA44D7905DE25C78AD456" group="com.google.protobuf"/>
<trusted-key id="1D0A8B5E77C678A7C724445ABF984B4145EA13F7" group="com.squareup" name="javapoet" version="1.13.0"/>
<trusted-key id="1D217F8475EEE9F19AB8DD6B793FD5751A0F0780" group="^com[.]squareup($|([.].*))" regex="true"/>
<trusted-key id="1D2C7EF8ADA0F794B58C7C63436902AF59EDF60E">
<trusting group="dev.equo.ide" name="solstice" version="1.7.5"/>
<trusting group="dev.equo.ide" name="solstice" version="1.8.0"/>
<trusting group="dev.equo.ide" name="solstice" version="1.8.1"/>
<trusting group="dev.equo.ide" name="solstice" version="1.8.2"/>
</trusted-key>
<trusted-key id="1D85469D8559C2E1DF5F925131D2D79DF7E85DD3" group="org.jcommander" name="jcommander" version="1.85"/>
<trusted-key id="20723A6399BC060154283B37CFAE163B64AC9189">
<trusting group="org.jetbrains.androidx.lifecycle"/>
<trusting group="org.jetbrains.androidx.savedstate"/>
<trusting group="^org[.]jetbrains[.]compose($|([.].*))" regex="true"/>
</trusted-key>
<trusted-key id="24D04176586361FDA94EE0315F7786DF73E61F56">
<trusting group="com.google.devtools.ksp" name="symbol-processing-api" version="1.9.20-1.0.14"/>
<trusting group="com.google.devtools.ksp" name="symbol-processing-api" version="1.9.24-1.0.20"/>
Expand Down Expand Up @@ -173,6 +180,7 @@
<trusting group="org.slf4j"/>
</trusted-key>
<trusted-key id="635EE627345F3C1DD422B2E207D3516820BCF6B1" group="com.github.ben-manes.caffeine" name="caffeine" version="2.9.3"/>
<trusted-key id="64B9B09F164AA0BF88742EB61188B69F6D6259CA" group="com.google.accompanist" name="accompanist-drawablepainter" version="0.37.3"/>
<trusted-key id="694621A7227D8D5289699830ABE9F3126BB741C1" group="^com[.]google($|([.].*))" regex="true"/>
<trusted-key id="696B6199A2A9D8C29CE78CC0D041CAD2E452550F" group="com.google.protobuf"/>
<trusted-key id="6DD3B8C64EF75253BEB2C53AD908A43FB7EC07AC">
Expand Down Expand Up @@ -244,6 +252,7 @@
<trusting group="androidx.graphics" name="graphics-path" version="1.0.1"/>
<trusting group="androidx.lifecycle"/>
<trusting group="androidx.profileinstaller"/>
<trusting group="androidx.startup" name="startup-runtime" version="1.2.0"/>
<trusting group="androidx.transition" name="transition" version="1.5.0"/>
<trusting group="androidx.webkit"/>
<trusting group="^androidx[.]compose($|([.].*))" regex="true"/>
Expand Down Expand Up @@ -280,6 +289,7 @@
<trusted-key id="D6F1BC78607808EC8E9F69437A8860944FAD5F62" group="org.apache.commons" name="commons-parent"/>
<trusted-key id="DB0597E3144342256BC81E3EC727D053C4481CF5" group="org.tensorflow" name="tensorflow-lite-metadata" version="0.1.0-rc2"/>
<trusted-key id="DBD744ACE7ADE6AA50DD591F66B50994442D2D40" group="^com[.]squareup($|([.].*))" regex="true"/>
<trusted-key id="DF25D3C4868FEC177182FAD64D176DC503FB4267" group="io.coil-kt.coil3"/>
<trusted-key id="E52F07877A5805F9AF4AB0ACD46C5610D06E7001" group="com.ibm.icu" name="icu4j" version="77.1"/>
<trusted-key id="E77417AC194160A3FABD04969A259C7EE636C5ED" group="^com[.]google($|([.].*))" regex="true"/>
<trusted-key id="E7DC75FC24FB3C8DFE8086AD3D5839A2262CBBFB" group="org.jetbrains.kotlinx"/>
Expand All @@ -295,6 +305,7 @@
<trusting group="org.apache" name="apache" version="13"/>
<trusting group="org.codehaus.mojo"/>
</trusted-key>
<trusted-key id="F3BD845679DD6A30F3F50F91597852B0B140F0BC" group="com.caverock" name="androidsvg-aar" version="1.4"/>
<trusted-key id="F4DD59C90148BDC52BEB90A4530AA5F25C25011F" group="commons-codec"/>
<trusted-key id="FA77DCFEF2EE6EB2DEBEDD2C012579464D01C06A" group="org.apache" name="apache"/>
<trusted-key id="FA7929F83AD44C4590F6CC6815C71C0A4E0B8EDD" group="net.java.dev.jna"/>
Expand Down Expand Up @@ -334,6 +345,11 @@
<sha256 value="c8923871e556cd5467addabac6773e778f3a4d3da19bfc8153bbaee0d145298f" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="androidx.activity" name="activity-compose" version="1.7.0">
<artifact name="activity-compose-1.7.0.module">
<sha256 value="f7a29bcba338575dcf89a553cff9cfad3f140340eaf2b56fd0193244da602c0a" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
</component>
<component group="androidx.activity" name="activity-compose" version="1.8.2">
<artifact name="activity-compose-1.8.2.aar">
<sha256 value="5a67e984f14ed2afc585aa3a23edff1c1791c80caa2bf68a0f799c1b11a39038" origin="Generated by Gradle"/>
Expand Down Expand Up @@ -19360,6 +19376,11 @@
<sha256 value="2a4f7b44a3d0ac7aec7dbf5b1aa88db938bf542f7351561fb1d3b5cf81b60d05" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.jetbrains.kotlin" name="kotlin-gradle-plugins-bom" version="2.4.0">
<artifact name="kotlin-gradle-plugins-bom-2.4.0.pom">
<sha256 value="8067da597f6e705c0edc50dc4f00293f326ba1b085d7b6a18871c569b1e8ec3e" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.jetbrains.kotlin" name="kotlin-klib-abi-reader" version="2.3.0">
<artifact name="kotlin-klib-abi-reader-2.3.0.jar">
<sha256 value="41e31422eb5eb224b9a475fe80eb8d06eb21ad34fb7d0a408d2c972a7abb8cbb" origin="Generated by Gradle"/>
Expand Down Expand Up @@ -20855,6 +20876,11 @@
<sha256 value="1446749f7236252d12ab350a19488aad1368fbf4f2d390386956c62ffbb76ddd" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
</component>
<component group="org.jetbrains.kotlin.plugin.serialization" name="org.jetbrains.kotlin.plugin.serialization.gradle.plugin" version="2.4.0">
<artifact name="org.jetbrains.kotlin.plugin.serialization.gradle.plugin-2.4.0.pom">
<sha256 value="847f5a5c9691e67117fa8cd211e4da9ec088647f4c9b7ca2bb4b83362d63cbfb" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
</component>
<component group="org.jetbrains.kotlinx" name="atomicfu" version="0.17.3">
<artifact name="atomicfu-0.17.3.module">
<sha256 value="854a75a9ebf30cb588e8ceda7da1b7089d4272a12324d3cffcaf5b62902738bd" origin="Generated by Gradle"/>
Expand Down
1 change: 1 addition & 0 deletions material-color-utilities/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

/*
* Nextcloud Android Common Library
*
Expand Down
1 change: 1 addition & 0 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ dependencies {
implementation 'androidx.constraintlayout:constraintlayout:2.2.1'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.11.0'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.11.0'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.9.0'
implementation project(path: ':ui')
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.3.0'
Expand Down
1 change: 1 addition & 0 deletions sample/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:usesCleartextTraffic="true"
android:theme="@style/Theme.Androidcommon">
<activity
android:name=".MainActivity"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,17 @@ class MainActivity : AppCompatActivity() {
material.colorMaterialButtonPrimaryBorderless(negativeButton)
}

binding.testApiBtn.setOnClickListener {
val baseUrl = binding.baseUrl.text?.toString().orEmpty()
val username = binding.username.text?.toString().orEmpty()
val token = binding.token.text?.toString().orEmpty()
mainViewModel.testPredefinedStatuses(baseUrl, username, token)
}

mainViewModel.apiTestResult.observe(this) { result ->
Toast.makeText(this, result, Toast.LENGTH_LONG).show()
}

setSupportActionBar(binding.toolbar)
supportActionBar?.setDisplayHomeAsUpEnabled(true)
mainViewModel.color.observe(this) { applyTheme(it) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,41 @@ package com.nextcloud.android.common.sample

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.nextcloud.android.common.ui.network.auth.ServerCredentials
import com.nextcloud.android.common.ui.network.model.NetworkResult
import com.nextcloud.android.common.ui.network.http.NextcloudHttpClient
import com.nextcloud.android.common.ui.network.UserStatusRepository
import kotlinx.coroutines.launch

class MainViewModel : ViewModel() {
val color = MutableLiveData<Int>()
val apiTestResult = MutableLiveData<String>()

fun testPredefinedStatuses(
baseUrl: String,
username: String,
token: String
) {
viewModelScope.launch {
val credentials = ServerCredentials(baseUrl, username, token)
val client = NextcloudHttpClient.create(credentials)
val service = UserStatusRepository(client)

when (val result = service.fetchPredefinedStatuses()) {
is NetworkResult.Success ->
apiTestResult.value =
"✅ Success (${result.data.size} statuses):\n" +
result.data.joinToString("\n") { "${it.icon} ${it.message}" }

is NetworkResult.ServerError ->
apiTestResult.value =
"❌ Error ${result.response.ocs.meta.statusCode}: ${result.response.ocs.meta.message}"

is NetworkResult.NetworkException ->
apiTestResult.value =
"❌ Exception: ${result.throwable.message}"
}
}
}
}
61 changes: 61 additions & 0 deletions sample/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,67 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/circular_progress_bar" />

<com.google.android.material.textfield.TextInputLayout
android:id="@+id/baseUrlTil"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:hint="@string/hint_base_url"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/dialogBtn">

<com.google.android.material.textfield.TextInputEditText
android:id="@+id/baseUrl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textUri"
android:text="https://cloud.example.com" />

</com.google.android.material.textfield.TextInputLayout>

<com.google.android.material.textfield.TextInputLayout
android:id="@+id/usernameTil"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:hint="@string/hint_username"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/baseUrlTil">

<com.google.android.material.textfield.TextInputEditText
android:id="@+id/username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text" />

</com.google.android.material.textfield.TextInputLayout>

<com.google.android.material.textfield.TextInputLayout
android:id="@+id/tokenTil"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:hint="@string/hint_token"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/usernameTil">

<com.google.android.material.textfield.TextInputEditText
android:id="@+id/token"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword" />

</com.google.android.material.textfield.TextInputLayout>

<com.google.android.material.button.MaterialButton
android:id="@+id/testApiBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="@string/test_user_status_api"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tokenTil" />

</androidx.constraintlayout.widget.ConstraintLayout>
</FrameLayout>

Expand Down
4 changes: 4 additions & 0 deletions sample/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
<string name="suggestion_chip">Suggestion Chip</string>
<string name="filter_chip">Filter Chip</string>
<string name="hint_color">Color</string>
<string name="hint_base_url">Base URL</string>
<string name="hint_username">Username</string>
<string name="hint_token">App token</string>
<string name="test_user_status_api">Test User Status API</string>
<string name="headline_theming">Theming</string>
<string name="headline_ui_module">UI Module</string>
</resources>
21 changes: 20 additions & 1 deletion ui/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

plugins {
id 'org.jetbrains.kotlin.plugin.compose'
id 'org.jetbrains.kotlin.plugin.serialization' version "$kotlinVersion"
id 'com.android.library'
id 'com.android.built-in-kotlin'
id 'com.android.legacy-kapt'
Expand All @@ -15,14 +16,15 @@ plugins {

android {
defaultConfig {
minSdk = 21
minSdk = 26
compileSdk = 37

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildFeatures {
compose = true
buildConfig = true
}

compileOptions {
Expand All @@ -45,12 +47,21 @@ android {
}

dependencies {
// region Jetpack Compose
implementation 'androidx.compose.ui:ui-tooling-preview:1.11.4'
debugImplementation 'androidx.compose.ui:ui-tooling:1.11.4'
kapt "org.jetbrains.kotlin:kotlin-metadata-jvm:${kotlinVersion}"

implementation(platform("androidx.compose:compose-bom:2026.06.01"))
implementation("androidx.compose.ui:ui")
implementation("androidx.compose.ui:ui-graphics")
implementation("androidx.compose.material3:material3")
implementation("androidx.compose.material:material-icons-core")
// endregion

implementation("io.coil-kt.coil3:coil-compose:3.5.0")
implementation("io.coil-kt.coil3:coil-network-okhttp:3.5.0")
implementation("io.coil-kt.coil3:coil-svg:3.5.0")

implementation("com.vanniktech:ui:0.10.0")

Expand All @@ -60,6 +71,14 @@ dependencies {
androidTestImplementation 'androidx.test.ext:junit:1.3.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.7.0'

// region okhttp
implementation(platform("com.squareup.okhttp3:okhttp-bom:5.4.0"))
implementation("com.squareup.okhttp3:okhttp")
implementation("com.squareup.okhttp3:logging-interceptor")
// endregion

implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.11.0")

implementation project(':core')
api project(':material-color-utilities')

Expand Down
2 changes: 1 addition & 1 deletion ui/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
~ SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
~ SPDX-License-Identifier: MIT
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<manifest>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
* Nextcloud Android Common Library
*
* SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: MIT
*/

package com.nextcloud.android.common.ui.component

import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp

@Composable
fun ContentUnavailableView(title: String, description: String? = null, iconId: Int? = null) {
Column(
modifier = Modifier
.fillMaxSize()
.padding(16.dp),
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally
) {
iconId?.let {
Image(
painter = painterResource(iconId),
modifier = Modifier.size(48.dp),
contentDescription = "",
)
}

Spacer(modifier = Modifier.height(16.dp))

Text(
text = title,
style = MaterialTheme.typography.headlineMedium,
textAlign = TextAlign.Center
)

description?.let {
Spacer(modifier = Modifier.height(8.dp))

Text(
text = description,
style = MaterialTheme.typography.headlineSmall,
textAlign = TextAlign.Center
)
}

Spacer(modifier = Modifier.height(32.dp))
}
}
Loading
Loading