Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions Demo/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ dependencies {
implementation(libs.androidx.lifecycle.runtime.ktx)
implementation(libs.androidx.activity.compose)
implementation(libs.androidx.fragment)
implementation(libs.google.material)
implementation(platform(libs.androidx.compose.bom))
implementation(libs.androidx.ui)
implementation(libs.androidx.ui.graphics)
Expand Down
4 changes: 2 additions & 2 deletions Demo/app/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>

<style name="Theme.SwiftAndroid" parent="android:Theme.Material.Light.NoActionBar" />
</resources>
<style name="Theme.SwiftAndroid" parent="Theme.Material3.DayNight.NoActionBar" />
</resources>
2 changes: 2 additions & 0 deletions Demo/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ lifecycleRuntimeKtx = "2.6.1"
activityCompose = "1.8.0"
composeBom = "2024.09.00"
fragment = "1.8.6"
material = "1.14.0"

[libraries]
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
Expand All @@ -18,6 +19,7 @@ androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-co
androidx-lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycleRuntimeKtx" }
androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "activityCompose" }
androidx-fragment = { group = "androidx.fragment", name = "fragment", version.ref = "fragment" }
google-material = { group = "com.google.android.material", name = "material", version.ref = "material" }
androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "composeBom" }
androidx-ui = { group = "androidx.compose.ui", name = "ui" }
androidx-ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics" }
Expand Down
3 changes: 2 additions & 1 deletion Sources/AndroidSwiftUI/AndroidButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ extension AndroidButton: AndroidViewRepresentable {
extension AndroidButton {

func createView(context: AndroidContent.Context) -> AndroidWidget.Button {
let view = AndroidWidget.Button(context)
// Material Design button; requires a `Theme.Material3` derived application theme
let view = MaterialButton(context)
updateView(view)
// set on click listener
let listener = ViewOnClickListener(action: action)
Expand Down
8 changes: 4 additions & 4 deletions Sources/AndroidSwiftUI/AndroidDivider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import AndroidKit
extension Divider: AnyAndroidView {

public func createAndroidView(_ context: AndroidContent.Context) -> AndroidView.View {
let view = AndroidView.View(context)
// hairline separator
// Material Design divider, colored with the theme's outline color
let view = MaterialDivider(context)
let matchParent = try! JavaClass<ViewGroup.LayoutParams>().MATCH_PARENT
view.setLayoutParams(ViewGroup.LayoutParams(matchParent, 2))
view.setBackgroundColor(0x33_00_00_00) // ARGB translucent black
let wrapContent = try! JavaClass<ViewGroup.LayoutParams>().WRAP_CONTENT
view.setLayoutParams(ViewGroup.LayoutParams(matchParent, wrapContent))
return view
}

Expand Down
Loading