Better Material You integration
This commit is contained in:
parent
cee98fd0f4
commit
fc04223798
4 changed files with 158 additions and 42 deletions
|
@ -1,18 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="deploymentTargetDropDown">
|
<component name="deploymentTargetDropDown">
|
||||||
<runningDeviceTargetSelectedWithDropDown>
|
|
||||||
<Target>
|
|
||||||
<type value="RUNNING_DEVICE_TARGET" />
|
|
||||||
<deviceKey>
|
|
||||||
<Key>
|
|
||||||
<type value="SERIAL_NUMBER" />
|
|
||||||
<value value="adb-a3950b57-giqMub._adb-tls-connect._tcp" />
|
|
||||||
</Key>
|
|
||||||
</deviceKey>
|
|
||||||
</Target>
|
|
||||||
</runningDeviceTargetSelectedWithDropDown>
|
|
||||||
<timeTargetWasSelectedWithDropDown value="2022-09-06T09:57:52.303689Z" />
|
|
||||||
<targetsSelectedWithDialog>
|
<targetsSelectedWithDialog>
|
||||||
<Target>
|
<Target>
|
||||||
<type value="QUICK_BOOT_TARGET" />
|
<type value="QUICK_BOOT_TARGET" />
|
||||||
|
|
|
@ -32,13 +32,17 @@ import androidx.compose.ui.unit.dp
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import androidx.documentfile.provider.DocumentFile
|
import androidx.documentfile.provider.DocumentFile
|
||||||
import androidx.lifecycle.ViewModelProvider
|
import androidx.lifecycle.ViewModelProvider
|
||||||
|
import androidx.navigation.NavController
|
||||||
import androidx.navigation.NavHostController
|
import androidx.navigation.NavHostController
|
||||||
|
import androidx.navigation.NavType
|
||||||
import androidx.navigation.compose.NavHost
|
import androidx.navigation.compose.NavHost
|
||||||
import androidx.navigation.compose.composable
|
import androidx.navigation.compose.composable
|
||||||
import androidx.navigation.compose.currentBackStackEntryAsState
|
import androidx.navigation.compose.currentBackStackEntryAsState
|
||||||
import androidx.navigation.compose.rememberNavController
|
import androidx.navigation.compose.rememberNavController
|
||||||
|
import androidx.navigation.navArgument
|
||||||
import coil.compose.AsyncImage
|
import coil.compose.AsyncImage
|
||||||
import coil.compose.rememberImagePainter
|
import coil.compose.rememberImagePainter
|
||||||
|
import com.google.accompanist.systemuicontroller.rememberSystemUiController
|
||||||
import com.yausername.ffmpeg.FFmpeg
|
import com.yausername.ffmpeg.FFmpeg
|
||||||
import com.yausername.youtubedl_android.YoutubeDL
|
import com.yausername.youtubedl_android.YoutubeDL
|
||||||
import com.yausername.youtubedl_android.YoutubeDLException
|
import com.yausername.youtubedl_android.YoutubeDLException
|
||||||
|
@ -51,8 +55,11 @@ import su.litvak.chromecast.api.v2.ChromeCast
|
||||||
import su.litvak.chromecast.api.v2.Media
|
import su.litvak.chromecast.api.v2.Media
|
||||||
import su.litvak.chromecast.api.v2.MediaStatus
|
import su.litvak.chromecast.api.v2.MediaStatus
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
import java.util.*
|
||||||
import java.util.regex.Matcher
|
import java.util.regex.Matcher
|
||||||
import java.util.regex.Pattern
|
import java.util.regex.Pattern
|
||||||
|
import kotlin.collections.ArrayList
|
||||||
|
import kotlin.collections.LinkedHashMap
|
||||||
|
|
||||||
|
|
||||||
data class BottomNavItem(
|
data class BottomNavItem(
|
||||||
|
@ -142,7 +149,7 @@ class ChromecastManagerActivity : ComponentActivity() {
|
||||||
|
|
||||||
private lateinit var chromeCast: ChromeCast
|
private lateinit var chromeCast: ChromeCast
|
||||||
private lateinit var viewModel: ChromecastManageViewmodel
|
private lateinit var viewModel: ChromecastManageViewmodel
|
||||||
|
private lateinit var navController: NavHostController
|
||||||
|
|
||||||
@RequiresApi(Build.VERSION_CODES.O)
|
@RequiresApi(Build.VERSION_CODES.O)
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
@ -170,9 +177,15 @@ class ChromecastManagerActivity : ComponentActivity() {
|
||||||
setContent {
|
setContent {
|
||||||
CasterTheme {
|
CasterTheme {
|
||||||
colorScheme = getColorScheme()
|
colorScheme = getColorScheme()
|
||||||
|
|
||||||
|
val systemUiController = rememberSystemUiController()
|
||||||
|
systemUiController.setStatusBarColor(
|
||||||
|
color = colorScheme.primary,
|
||||||
|
darkIcons = true
|
||||||
|
)
|
||||||
// remember navController so it does not
|
// remember navController so it does not
|
||||||
// get recreated on recomposition
|
// get recreated on recomposition
|
||||||
val navController = rememberNavController()
|
navController = rememberNavController()
|
||||||
|
|
||||||
Surface(color = colorScheme.background, contentColor = colorScheme.onBackground) {
|
Surface(color = colorScheme.background, contentColor = colorScheme.onBackground) {
|
||||||
|
|
||||||
|
@ -231,7 +244,18 @@ class ChromecastManagerActivity : ComponentActivity() {
|
||||||
|
|
||||||
// route : profile
|
// route : profile
|
||||||
composable("settings") {
|
composable("settings") {
|
||||||
SettingsScreen()
|
Column {
|
||||||
|
MenuBar()
|
||||||
|
SettingsScreen()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
composable("folderView/{folder}", listOf(navArgument("folder") { type = NavType.StringType}))
|
||||||
|
{ backStackEntry ->
|
||||||
|
Column {
|
||||||
|
MenuBar()
|
||||||
|
imageGrid(context = application, folderArg = backStackEntry.arguments?.getString("folder")!! )
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -568,7 +592,11 @@ class ChromecastManagerActivity : ComponentActivity() {
|
||||||
.fillMaxSize(),
|
.fillMaxSize(),
|
||||||
// parameters set to place the items in center
|
// parameters set to place the items in center
|
||||||
) {
|
) {
|
||||||
Row() {
|
Row(
|
||||||
|
Modifier.padding(all = 10.dp),
|
||||||
|
horizontalArrangement = Arrangement.Start,
|
||||||
|
verticalAlignment = Alignment.CenterVertically
|
||||||
|
) {
|
||||||
Text("Enable SponsorBlock")
|
Text("Enable SponsorBlock")
|
||||||
var switched by remember {
|
var switched by remember {
|
||||||
mutableStateOf(
|
mutableStateOf(
|
||||||
|
@ -601,10 +629,12 @@ class ChromecastManagerActivity : ComponentActivity() {
|
||||||
Card(modifier = Modifier
|
Card(modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.clickable {
|
.clickable {
|
||||||
val intent = Intent(applicationContext, FolderViewActivity::class.java)
|
/* val intent = Intent(applicationContext, FolderViewActivity::class.java)
|
||||||
FolderViewActivity.chromecastRecv = chromeCast
|
FolderViewActivity.chromecastRecv = chromeCast
|
||||||
FolderViewActivity.folderRecv = folders[index]
|
FolderViewActivity.folderRecv = folders[index]
|
||||||
startActivity(intent)
|
startActivity(intent)*/
|
||||||
|
|
||||||
|
navController.navigate("folderView/${Base64.getEncoder().encodeToString(folders[index].uri.toString().toByteArray())}")
|
||||||
}) {
|
}) {
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
package eu.toldi.balazs.caster
|
package eu.toldi.balazs.caster
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
|
import android.content.Context
|
||||||
|
import android.net.Uri
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import androidx.activity.ComponentActivity
|
import androidx.activity.ComponentActivity
|
||||||
import androidx.activity.compose.setContent
|
import androidx.activity.compose.setContent
|
||||||
import androidx.compose.foundation.lazy.LazyColumn
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material.*
|
import androidx.compose.material.*
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.filled.ArrowBack
|
import androidx.compose.material.icons.filled.ArrowBack
|
||||||
|
@ -16,6 +19,7 @@ import androidx.compose.foundation.layout.*
|
||||||
import androidx.compose.ui.layout.ContentScale
|
import androidx.compose.ui.layout.ContentScale
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.semantics.Role.Companion.Image
|
import androidx.compose.ui.semantics.Role.Companion.Image
|
||||||
|
import androidx.compose.ui.text.input.KeyboardType.Companion.Uri
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.documentfile.provider.DocumentFile
|
import androidx.documentfile.provider.DocumentFile
|
||||||
|
@ -36,6 +40,7 @@ import kotlinx.coroutines.GlobalScope
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import su.litvak.chromecast.api.v2.ChromeCast
|
import su.litvak.chromecast.api.v2.ChromeCast
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
class FolderViewActivity : ComponentActivity() {
|
class FolderViewActivity : ComponentActivity() {
|
||||||
|
|
||||||
|
@ -55,7 +60,7 @@ class FolderViewActivity : ComponentActivity() {
|
||||||
setContent {
|
setContent {
|
||||||
CasterTheme {
|
CasterTheme {
|
||||||
// A surface container using the 'background' color from the theme
|
// A surface container using the 'background' color from the theme
|
||||||
Surface(color = MaterialTheme.colors.background) {
|
Surface(color = MaterialTheme.colorScheme.background) {
|
||||||
Column(modifier = Modifier.fillMaxSize()) {
|
Column(modifier = Modifier.fillMaxSize()) {
|
||||||
MenuBar(title = folder.name!!)
|
MenuBar(title = folder.name!!)
|
||||||
val images = folder.listFiles()
|
val images = folder.listFiles()
|
||||||
|
@ -173,6 +178,7 @@ class FolderViewActivity : ComponentActivity() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun MenuBar(title: String) {
|
fun MenuBar(title: String) {
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
|
@ -199,3 +205,52 @@ class FolderViewActivity : ComponentActivity() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun imageGrid(context : Context, folderArg: String) {
|
||||||
|
Log.e("Base64",folderArg)
|
||||||
|
val folder = DocumentFile.fromSingleUri(context, android.net.Uri.parse(Base64.getDecoder().decode(folderArg).toString()))!!
|
||||||
|
val images = folder.listFiles()
|
||||||
|
.filter { it.name?.endsWith(".png") ?: false || it.name?.endsWith(".jpg") ?: false }
|
||||||
|
|
||||||
|
val cacheHelper = FileCacheHelper(context)
|
||||||
|
val row_count = images.size / 3 + 1
|
||||||
|
LazyColumn(modifier = Modifier.fillMaxWidth()) {
|
||||||
|
items(row_count) { index ->
|
||||||
|
Row(modifier = Modifier.fillMaxWidth()) {
|
||||||
|
for (i in 0 until 3) {
|
||||||
|
if (index + i >= images.size) break
|
||||||
|
val imageFile = if (images[index + i].exists()) {
|
||||||
|
cacheHelper.cacheThis(listOf(images[index + i].uri))
|
||||||
|
File(context.cacheDir, cacheHelper.tryFileName(images[index + i].uri))
|
||||||
|
} else {
|
||||||
|
File(context.cacheDir, cacheHelper.tryFileName(images[index + i].uri))
|
||||||
|
}
|
||||||
|
Card(
|
||||||
|
modifier = Modifier
|
||||||
|
.padding(all = 5.dp)
|
||||||
|
.weight(1f)
|
||||||
|
) {
|
||||||
|
Column {
|
||||||
|
Column(
|
||||||
|
modifier = Modifier
|
||||||
|
.height(100.dp)
|
||||||
|
.width(100.dp)
|
||||||
|
.padding(10.dp)
|
||||||
|
) {
|
||||||
|
Image(
|
||||||
|
painter = rememberImagePainter(
|
||||||
|
data = imageFile
|
||||||
|
|
||||||
|
),
|
||||||
|
contentDescription = null,
|
||||||
|
modifier = Modifier.fillMaxWidth()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ package eu.toldi.balazs.caster
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
|
import android.graphics.Color
|
||||||
import android.graphics.ColorSpace.adapt
|
import android.graphics.ColorSpace.adapt
|
||||||
import android.net.wifi.WifiManager
|
import android.net.wifi.WifiManager
|
||||||
import android.net.wifi.WifiManager.MulticastLock
|
import android.net.wifi.WifiManager.MulticastLock
|
||||||
|
@ -26,6 +27,7 @@ import androidx.compose.material.Icon
|
||||||
import androidx.compose.material.MaterialTheme
|
import androidx.compose.material.MaterialTheme
|
||||||
import androidx.compose.material.OutlinedTextField
|
import androidx.compose.material.OutlinedTextField
|
||||||
import androidx.compose.material.Text
|
import androidx.compose.material.Text
|
||||||
|
import androidx.compose.material.TextFieldDefaults
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.filled.Add
|
import androidx.compose.material.icons.filled.Add
|
||||||
import androidx.compose.material.icons.filled.Refresh
|
import androidx.compose.material.icons.filled.Refresh
|
||||||
|
@ -34,6 +36,7 @@ import androidx.compose.runtime.*
|
||||||
import androidx.compose.runtime.livedata.observeAsState
|
import androidx.compose.runtime.livedata.observeAsState
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.graphics.Color.Companion.Transparent
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
import androidx.compose.ui.res.painterResource
|
import androidx.compose.ui.res.painterResource
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
|
@ -42,14 +45,13 @@ import androidx.compose.ui.unit.dp
|
||||||
import androidx.lifecycle.ViewModelProvider
|
import androidx.lifecycle.ViewModelProvider
|
||||||
import com.google.accompanist.swiperefresh.SwipeRefresh
|
import com.google.accompanist.swiperefresh.SwipeRefresh
|
||||||
import com.google.accompanist.swiperefresh.rememberSwipeRefreshState
|
import com.google.accompanist.swiperefresh.rememberSwipeRefreshState
|
||||||
|
import com.google.accompanist.systemuicontroller.rememberSystemUiController
|
||||||
import eu.toldi.balazs.caster.model.ChromeCastViewModel
|
import eu.toldi.balazs.caster.model.ChromeCastViewModel
|
||||||
import eu.toldi.balazs.caster.ui.theme.CasterTheme
|
import eu.toldi.balazs.caster.ui.theme.CasterTheme
|
||||||
import eu.toldi.balazs.caster.ui.theme.getColorScheme
|
import eu.toldi.balazs.caster.ui.theme.getColorScheme
|
||||||
import su.litvak.chromecast.api.v2.ChromeCast
|
import su.litvak.chromecast.api.v2.ChromeCast
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
open class MainActivity : ComponentActivity() {
|
open class MainActivity : ComponentActivity() {
|
||||||
|
|
||||||
protected lateinit var viewModel: ChromeCastViewModel
|
protected lateinit var viewModel: ChromeCastViewModel
|
||||||
|
@ -84,17 +86,27 @@ open class MainActivity : ComponentActivity() {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
setContent {
|
setContent {
|
||||||
|
|
||||||
CasterTheme {
|
CasterTheme {
|
||||||
colorScheme = getColorScheme()
|
colorScheme = getColorScheme()
|
||||||
viewModel = ViewModelProvider(this).get(ChromeCastViewModel::class.java)
|
viewModel = ViewModelProvider(this).get(ChromeCastViewModel::class.java)
|
||||||
|
|
||||||
|
val systemUiController = rememberSystemUiController()
|
||||||
|
systemUiController.setStatusBarColor(
|
||||||
|
color = colorScheme.primary,
|
||||||
|
darkIcons = true
|
||||||
|
)
|
||||||
|
|
||||||
val chromeCastState = viewModel.chromeCasts.observeAsState(initial = emptyList())
|
val chromeCastState = viewModel.chromeCasts.observeAsState(initial = emptyList())
|
||||||
val chromeCasts = chromeCastState.value
|
val chromeCasts = chromeCastState.value
|
||||||
Log.e(null, chromeCasts.toString())
|
Log.e(null, chromeCasts.toString())
|
||||||
// A surface container using the 'background' color from the theme
|
// A surface container using the 'background' color from the theme
|
||||||
Surface(color = colorScheme.background, contentColor = colorScheme.onBackground) {
|
Surface(color = colorScheme.background, contentColor = colorScheme.onBackground) {
|
||||||
Column(modifier = Modifier
|
Column(
|
||||||
.fillMaxWidth()
|
modifier = Modifier
|
||||||
.fillMaxHeight()) {
|
.fillMaxWidth()
|
||||||
|
.fillMaxHeight()
|
||||||
|
) {
|
||||||
var isAddChromecastDialogOpen by remember {
|
var isAddChromecastDialogOpen by remember {
|
||||||
mutableStateOf(false)
|
mutableStateOf(false)
|
||||||
}
|
}
|
||||||
|
@ -141,13 +153,19 @@ open class MainActivity : ComponentActivity() {
|
||||||
) {
|
) {
|
||||||
item {
|
item {
|
||||||
if (chromeCasts.isNotEmpty())
|
if (chromeCasts.isNotEmpty())
|
||||||
Text(text = stringResource(id = R.string.available_chromecasts),color =colorScheme.onBackground)
|
Text(
|
||||||
|
text = stringResource(id = R.string.available_chromecasts),
|
||||||
|
color = colorScheme.onBackground
|
||||||
|
)
|
||||||
else {
|
else {
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier.fillMaxSize(),
|
modifier = Modifier.fillMaxSize(),
|
||||||
horizontalAlignment = Alignment.CenterHorizontally
|
horizontalAlignment = Alignment.CenterHorizontally
|
||||||
) {
|
) {
|
||||||
Text(text = stringResource(id = R.string.looking_for_devices),color= colorScheme.onBackground)
|
Text(
|
||||||
|
text = stringResource(id = R.string.looking_for_devices),
|
||||||
|
color = colorScheme.onBackground
|
||||||
|
)
|
||||||
CircularProgressIndicator(color = colorScheme.secondary)
|
CircularProgressIndicator(color = colorScheme.secondary)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -170,7 +188,10 @@ open class MainActivity : ComponentActivity() {
|
||||||
}
|
}
|
||||||
AlertDialog(onDismissRequest = dismiss,
|
AlertDialog(onDismissRequest = dismiss,
|
||||||
title = {
|
title = {
|
||||||
Text(text = stringResource(id = R.string.add_chromecast),color= colorScheme.onBackground)
|
Text(
|
||||||
|
text = stringResource(id = R.string.add_chromecast),
|
||||||
|
color = colorScheme.onBackground
|
||||||
|
)
|
||||||
},
|
},
|
||||||
text = {
|
text = {
|
||||||
OutlinedTextField(
|
OutlinedTextField(
|
||||||
|
@ -178,8 +199,19 @@ open class MainActivity : ComponentActivity() {
|
||||||
onValueChange = {
|
onValueChange = {
|
||||||
ipaddress = it
|
ipaddress = it
|
||||||
},
|
},
|
||||||
label = { Text(stringResource(id = R.string.ip_address),color= colorScheme.onBackground) },
|
label = {
|
||||||
modifier = Modifier.padding(vertical = 4.dp)
|
Text(
|
||||||
|
stringResource(id = R.string.ip_address),
|
||||||
|
color = colorScheme.onBackground
|
||||||
|
)
|
||||||
|
},
|
||||||
|
modifier = Modifier.padding(vertical = 4.dp),
|
||||||
|
colors = TextFieldDefaults.outlinedTextFieldColors(
|
||||||
|
cursorColor = colorScheme.primary,
|
||||||
|
focusedBorderColor =
|
||||||
|
colorScheme.primary.copy(alpha = ContentAlpha.high),
|
||||||
|
focusedLabelColor = colorScheme.primary
|
||||||
|
)
|
||||||
)
|
)
|
||||||
}, buttons = {
|
}, buttons = {
|
||||||
Row(
|
Row(
|
||||||
|
@ -191,16 +223,23 @@ open class MainActivity : ComponentActivity() {
|
||||||
add(ipaddress)
|
add(ipaddress)
|
||||||
dismiss()
|
dismiss()
|
||||||
},
|
},
|
||||||
colors = ButtonDefaults.buttonColors(backgroundColor = colorScheme.primary, contentColor = colorScheme.onPrimary),
|
colors = ButtonDefaults.buttonColors(
|
||||||
|
backgroundColor = colorScheme.primary,
|
||||||
|
contentColor = colorScheme.onPrimary
|
||||||
|
),
|
||||||
modifier = Modifier.padding(all = 8.dp),
|
modifier = Modifier.padding(all = 8.dp),
|
||||||
|
|
||||||
) {
|
) {
|
||||||
Text(text = stringResource(id = R.string.add_chromecast))
|
Text(text = stringResource(id = R.string.add_chromecast))
|
||||||
}
|
}
|
||||||
Button(
|
Button(
|
||||||
onClick = dismiss,
|
onClick = dismiss,
|
||||||
colors = ButtonDefaults.buttonColors(backgroundColor = colorScheme.primary, contentColor = colorScheme.onPrimary),
|
colors = ButtonDefaults.buttonColors(
|
||||||
modifier = Modifier.padding(all = 8.dp)) {
|
backgroundColor = colorScheme.primary,
|
||||||
|
contentColor = colorScheme.onPrimary
|
||||||
|
),
|
||||||
|
modifier = Modifier.padding(all = 8.dp)
|
||||||
|
) {
|
||||||
Text(stringResource(id = R.string.cancel))
|
Text(stringResource(id = R.string.cancel))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -209,11 +248,13 @@ open class MainActivity : ComponentActivity() {
|
||||||
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun showChromeCastButton(chromeCast: ChromeCast,buttonCallBack: () -> Unit = {
|
fun showChromeCastButton(
|
||||||
ChromecastManagerActivity.chromeCast_ = chromeCast
|
chromeCast: ChromeCast, buttonCallBack: () -> Unit = {
|
||||||
val intent = Intent(applicationContext, ChromecastManagerActivity::class.java)
|
ChromecastManagerActivity.chromeCast_ = chromeCast
|
||||||
startActivity(intent)
|
val intent = Intent(applicationContext, ChromecastManagerActivity::class.java)
|
||||||
}) {
|
startActivity(intent)
|
||||||
|
}
|
||||||
|
) {
|
||||||
Column(
|
Column(
|
||||||
Modifier
|
Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
|
@ -244,10 +285,12 @@ open class MainActivity : ComponentActivity() {
|
||||||
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
Column(modifier = Modifier
|
Column(
|
||||||
.fillMaxWidth()
|
modifier = Modifier
|
||||||
.height(80.dp),
|
.fillMaxWidth()
|
||||||
verticalArrangement = Arrangement.Center) {
|
.height(80.dp),
|
||||||
|
verticalArrangement = Arrangement.Center
|
||||||
|
) {
|
||||||
Text(
|
Text(
|
||||||
text = "Name: " + when {
|
text = "Name: " + when {
|
||||||
chromeCast.title != null -> chromeCast.title
|
chromeCast.title != null -> chromeCast.title
|
||||||
|
|
Loading…
Reference in a new issue