Skip to content

Commit

Permalink
Update ui library, add jetpack compose preview capability
Browse files Browse the repository at this point in the history
Signed-off-by: alperozturk <[email protected]>
  • Loading branch information
alperozturk96 committed Mar 4, 2024
1 parent dd108a6 commit 445113d
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 17 deletions.
5 changes: 4 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,8 @@ dependencies {
implementation("androidx.compose.ui:ui")
implementation("androidx.compose.ui:ui-graphics")
implementation("androidx.compose.material3:material3")
implementation("androidx.compose.ui:ui-tooling-preview:1.6.2")


compileOnly 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
// remove after entire switch to lib v2
Expand Down Expand Up @@ -304,6 +306,7 @@ dependencies {

implementation "com.github.nextcloud-deps.hwsecurity:hwsecurity-fido:$fidoVersion"
implementation "com.github.nextcloud-deps.hwsecurity:hwsecurity-fido2:$fidoVersion"
debugImplementation 'androidx.compose.ui:ui-tooling:1.6.2'

// document scanner not available on FDroid (generic) due to OpenCV binaries
gplayImplementation project(':appscan')
Expand Down Expand Up @@ -404,7 +407,7 @@ dependencies {
gplayImplementation "com.google.firebase:firebase-messaging:23.4.1"
gplayImplementation 'com.google.android.play:review-ktx:2.0.1'

implementation 'com.github.nextcloud.android-common:ui:0.16.0'
implementation 'com.github.nextcloud.android-common:ui:0.17.0'

implementation "androidx.room:room-runtime:$roomVersion"
ksp "androidx.room:room-compiler:$roomVersion"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.nextcloud.ui.composeComponents.bottomSheet.MoreActionsBottomSheet
Expand Down Expand Up @@ -78,9 +79,9 @@ fun TaskView(

task.input?.let {
Text(
text = stringResource(id = R.string.assistant_screen_task_view_input, it),
text = it,
color = Color.White,
fontSize = 18.sp,
fontSize = 18.sp
)
}

Expand All @@ -90,10 +91,7 @@ fun TaskView(
HorizontalDivider(modifier = Modifier.padding(horizontal = 4.dp, vertical = 8.dp))

Text(
text = stringResource(
id = R.string.assistant_screen_task_view_output,
if (expanded) it else it.take(100) + "..."
),
text = if (expanded) it else it.take(100) + "...",
fontSize = 12.sp,
color = Color.White,
modifier = Modifier
Expand Down Expand Up @@ -139,3 +137,38 @@ fun TaskView(
}
}
}

@Preview
@Composable
private fun TaskViewPreview() {
val output =
"Lorem Ipsum is simply dummy text of the printing and " +
"typesetting industry. Lorem Ipsum has been the " +
"industry's standard dummy text ever since the 1500s, " +
"when an unknown printer took a galley of type and " +
"scrambled it to make a type specimen book. " +
"It has survived not only five centuries, but also " +
"the leap into electronic typesetting, remaining" +
" essentially unchanged. It wLorem Ipsum is simply dummy" +
" text of the printing and typesetting industry. " +
"Lorem Ipsum has been the industry's standard dummy " +
"text ever since the 1500s, when an unknown printer took a" +
" galley of type and scrambled it to make a type specimen book. " +
"It has survived not only five centuries, but also the leap " +
"into electronic typesetting, remaining essentially unchanged."

TaskView(
task = Task(
1,
"Free Prompt",
0,
"1",
"1",
"Give me text",
output,
"",
""
)
) {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class ComposeActivity : DrawerActivity() {

binding.composeView.setContent {
MaterialTheme(
// colorScheme = viewThemeUtils.getColorScheme(this),
colorScheme = viewThemeUtils.getColorScheme(this),
content = {
Content(destination, storageManager.user, this)
}
Expand Down
2 changes: 0 additions & 2 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
<string name="assistant_screen_create_task_alert_dialog_input_field_placeholder">Type some text</string>

<string name="assistant_screen_all_task_type">All</string>
<string name="assistant_screen_task_view_input">Input %s</string>
<string name="assistant_screen_task_view_output">Output\n%s</string>
<string name="assistant_screen_task_view_show_more">Show more</string>
<string name="assistant_screen_task_view_show_less">Show less</string>

Expand Down
24 changes: 24 additions & 0 deletions gradle/verification-metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4050,6 +4050,14 @@
<sha256 value="2b9fe04f11de743212d44d35aeb084996637cf9dcc7a25bcf7b76b4af23e8479" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
</component>
<component group="com.github.nextcloud.android-common" name="core" version="0.17.0">
<artifact name="core-0.17.0.aar">
<sha256 value="65d89207886467066072a394c07cc8d58bb80f115704a427306c27c08c6e8344" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
<artifact name="core-0.17.0.module">
<sha256 value="c566a8a9d41b8e804c52539975cfc017d105e9fe2730e74f936ed948f55bc6dc" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
</component>
<component group="com.github.nextcloud.android-common" name="material-color-utilities" version="0.13.0">
<artifact name="material-color-utilities-0.13.0.jar">
<sha256 value="d0e932c5de6e2aefd4c0a66caa86df4bc6c582189e67de95ede894ed1adb9367" origin="Generated by Gradle" reason="Artifact is not signed"/>
Expand Down Expand Up @@ -4082,6 +4090,14 @@
<sha256 value="9f78238c228e06485c0f9409b0825064a2bbd8f381db964b129b76587b03277c" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
</component>
<component group="com.github.nextcloud.android-common" name="material-color-utilities" version="0.17.0">
<artifact name="material-color-utilities-0.17.0.jar">
<sha256 value="188a63e6c1d0d7f4c999e2f4a7476a16f6da0ee8969cc5b489449baf3477619d" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
<artifact name="material-color-utilities-0.17.0.module">
<sha256 value="c6239f76c0d68b7126c4233e84fd3de9063b86e76084c602f296010192536a74" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
</component>
<component group="com.github.nextcloud.android-common" name="ui" version="0.13.0">
<artifact name="ui-0.13.0.aar">
<sha256 value="4d73e91f3692d9f1d34d89d8a87d91e632f18e6366ec9f1fec6b0648bc4f25ea" origin="Generated by Gradle" reason="Artifact is not signed"/>
Expand Down Expand Up @@ -4114,6 +4130,14 @@
<sha256 value="c588c69cd8540cb9bd57899df0b833eb9bb3787e10ac9ea3476b2005c98d9543" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
</component>
<component group="com.github.nextcloud.android-common" name="ui" version="0.17.0">
<artifact name="ui-0.17.0.aar">
<sha256 value="179a48b24d5e0b9f4bfdd567d2ec8a66f6816689d745aab9b528b022932fb9fe" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
<artifact name="ui-0.17.0.module">
<sha256 value="2ac34079e37123543bfc0fa78271424978b81baa5866d21884ec4084d6157573" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
</component>
<component group="com.github.spotbugs" name="spotbugs" version="4.7.3">
<artifact name="spotbugs-4.7.3.jar">
<sha256 value="df37eab21a7d04aa807808a33e9f7c081451cb02c14b4a2c33119976be498520" origin="Generated by Gradle" reason="A key couldn't be downloaded"/>
Expand Down
7 changes: 0 additions & 7 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,3 @@ include ':appscan'
// substitute module('com.github.nextcloud:android-library') using project(':library')
// }
//}


includeBuild('/Users/alperozturk/Desktop/nextcloud/nextcloud_android_common') {
dependencySubstitution {
substitute module('com.github.nextcloud.android-common:ui') using project(':ui')
}
}

0 comments on commit 445113d

Please sign in to comment.