-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,3 @@ | |
.externalNativeBuild | ||
.cxx | ||
local.properties | ||
.idea/ | ||
buildSrc/build | ||
buildSrc/.gradle |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.vanpra.composematerialdialogdemos | ||
|
||
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.vanpra.composematerialdialogdemos", appContext.packageName) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,28 @@ | ||
package com.vanpra.composematerialdialogdemos.demos | ||
|
||
import androidx.compose.runtime.Composable | ||
import com.vanpra.composematerialdialogdemos.DialogAndShowButton | ||
import com.vanpra.composematerialdialogs.datetime.datepicker | ||
import com.vanpra.composematerialdialogs.datetime.datetimepicker | ||
import com.vanpra.composematerialdialogs.datetime.timepicker | ||
//import com.vanpra.composematerialdialogdemos.DialogAndShowButton | ||
//import com.vanpra.composematerialdialogs.datetime.datepicker | ||
//import com.vanpra.composematerialdialogs.datetime.datetimepicker | ||
//import com.vanpra.composematerialdialogs.datetime.timepicker | ||
|
||
/** | ||
* @brief Date and Time Picker Demos | ||
*/ | ||
@Composable | ||
fun DateTimeDialogDemo() { | ||
DialogAndShowButton(buttonText = "Time Picker Dialog") { | ||
title("Select a time", center = true) | ||
timepicker() | ||
} | ||
|
||
DialogAndShowButton(buttonText = "Date Picker Dialog") { | ||
title("Select a date", center = true) | ||
datepicker() | ||
} | ||
|
||
DialogAndShowButton(buttonText = "Date and Time Picker Dialog") { | ||
// Date time picker has a custom title as it needs to show a back icon | ||
datetimepicker("Select a date and time") | ||
} | ||
// DialogAndShowButton(buttonText = "Time Picker Dialog") { | ||
// title("Select a time", center = true) | ||
// timepicker() | ||
// } | ||
// | ||
// DialogAndShowButton(buttonText = "Date Picker Dialog") { | ||
// title("Select a date", center = true) | ||
// datepicker() | ||
// } | ||
// | ||
// DialogAndShowButton(buttonText = "Date and Time Picker Dialog") { | ||
// // Date time picker has a custom title as it needs to show a back icon | ||
// datetimepicker("Select a date and time") | ||
// } | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
package com.vanpra.composematerialdialogdemos.demos | ||
|
||
import android.util.Log | ||
import androidx.annotation.DrawableRes | ||
import androidx.compose.foundation.Image | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.layout.size | ||
import androidx.compose.material.MaterialTheme | ||
import androidx.compose.material.Text | ||
import androidx.compose.material.icons.Icons | ||
import androidx.compose.material.icons.filled.AccountCircle | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.getValue | ||
import androidx.compose.runtime.mutableStateOf | ||
|
@@ -23,7 +24,6 @@ import com.vanpra.composematerialdialogs.MaterialDialog | |
import com.vanpra.composematerialdialogs.listItems | ||
import com.vanpra.composematerialdialogs.listItemsMultiChoice | ||
import com.vanpra.composematerialdialogs.listItemsSingleChoice | ||
import dev.chrisbanes.accompanist.coil.CoilImage | ||
|
||
private val ringtones = | ||
listOf( | ||
|
@@ -45,18 +45,12 @@ private val ringtones = | |
"Zen Too" | ||
) | ||
private val labels = listOf("None", "Forums", "Social", "Updates", "Promotions", "Spam", "Bin") | ||
|
||
private data class EmailIcon( | ||
val email: String, | ||
@DrawableRes val icon: Int | ||
) | ||
|
||
private val emailItems = listOf( | ||
EmailIcon("[email protected]", R.drawable.tick), | ||
EmailIcon("[email protected]", R.drawable.tick), | ||
EmailIcon("[email protected]", R.drawable.tick), | ||
EmailIcon("[email protected]", R.drawable.tick), | ||
EmailIcon("[email protected]", R.drawable.tick) | ||
private val emails = listOf( | ||
"[email protected]", | ||
"[email protected]", | ||
"[email protected]", | ||
"[email protected]", | ||
"[email protected]" | ||
) | ||
|
||
@Composable | ||
|
@@ -73,32 +67,32 @@ private fun MaterialDialog.defaultListButtons() { | |
@Composable | ||
fun BasicListDialogDemo() { | ||
DialogAndShowButton(buttonText = "Simple List Dialog") { | ||
val emails = emailItems.map { it.email } | ||
title(res = R.string.backup_dialog_title) | ||
listItems(emails) | ||
} | ||
|
||
DialogAndShowButton(buttonText = "Custom List Dialog") { | ||
title(res = R.string.backup_dialog_title) | ||
listItems(emailItems) { _, emailIcon -> | ||
listItems(emails, item = { _, email -> | ||
Row(Modifier.fillMaxWidth()) { | ||
CoilImage( | ||
emailIcon.icon, | ||
Image( | ||
Icons.Default.AccountCircle, | ||
contentDescription = "Account icon", | ||
modifier = Modifier | ||
.padding(vertical = 8.dp) | ||
.size(30.dp), | ||
contentScale = ContentScale.FillHeight | ||
) | ||
Text( | ||
emailIcon.email, | ||
email, | ||
modifier = Modifier | ||
.padding(start = 16.dp) | ||
.align(Alignment.CenterVertically), | ||
color = MaterialTheme.colors.onBackground, | ||
style = MaterialTheme.typography.body1 | ||
) | ||
} | ||
} | ||
}) | ||
} | ||
} | ||
|
||
|