Enable customizations for calendar events, contacts, files, websites and wikipedia articles
This commit is contained in:
parent
ac028946ee
commit
2efa703852
@ -13,10 +13,7 @@ import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.SnackbarResult
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.collectAsState
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.drawBehind
|
||||
@ -35,6 +32,7 @@ import de.mm20.launcher2.ui.component.DefaultToolbarAction
|
||||
import de.mm20.launcher2.ui.component.Toolbar
|
||||
import de.mm20.launcher2.ui.component.ToolbarAction
|
||||
import de.mm20.launcher2.ui.ktx.toDp
|
||||
import de.mm20.launcher2.ui.launcher.search.common.customattrs.CustomizeSearchableSheet
|
||||
import de.mm20.launcher2.ui.locals.LocalDarkTheme
|
||||
import de.mm20.launcher2.ui.locals.LocalFavoritesEnabled
|
||||
import de.mm20.launcher2.ui.locals.LocalSnackbarHostState
|
||||
@ -54,6 +52,8 @@ fun CalendarItem(
|
||||
val lifecycleOwner = LocalLifecycleOwner.current
|
||||
val snackbarHostState = LocalSnackbarHostState.current
|
||||
|
||||
var edit by remember { mutableStateOf(false) }
|
||||
|
||||
val darkMode = LocalDarkTheme.current
|
||||
|
||||
Row(
|
||||
@ -217,7 +217,6 @@ fun CalendarItem(
|
||||
}
|
||||
})
|
||||
}
|
||||
toolbarActions.add(hideAction)
|
||||
|
||||
toolbarActions.add(
|
||||
DefaultToolbarAction(
|
||||
@ -229,6 +228,15 @@ fun CalendarItem(
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
toolbarActions.add(DefaultToolbarAction(
|
||||
label = stringResource(R.string.menu_customize),
|
||||
icon = Icons.Rounded.Edit,
|
||||
action = { edit = true }
|
||||
))
|
||||
|
||||
toolbarActions.add(hideAction)
|
||||
|
||||
Toolbar(
|
||||
leftActions = listOf(
|
||||
DefaultToolbarAction(
|
||||
@ -244,6 +252,13 @@ fun CalendarItem(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (edit) {
|
||||
CustomizeSearchableSheet(
|
||||
searchable = calendar,
|
||||
onDismiss = { edit = false }
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalAnimationApi::class)
|
||||
|
||||
@ -14,10 +14,7 @@ import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.SnackbarResult
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.collectAsState
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.geometry.Rect
|
||||
@ -37,6 +34,7 @@ import de.mm20.launcher2.ui.icons.Telegram
|
||||
import de.mm20.launcher2.ui.icons.WhatsApp
|
||||
import de.mm20.launcher2.ui.ktx.toDp
|
||||
import de.mm20.launcher2.ui.ktx.toPixels
|
||||
import de.mm20.launcher2.ui.launcher.search.common.customattrs.CustomizeSearchableSheet
|
||||
import de.mm20.launcher2.ui.locals.LocalFavoritesEnabled
|
||||
import de.mm20.launcher2.ui.locals.LocalGridIconSize
|
||||
import de.mm20.launcher2.ui.locals.LocalSnackbarHostState
|
||||
@ -56,6 +54,8 @@ fun ContactItem(
|
||||
val lifecycleOwner = LocalLifecycleOwner.current
|
||||
val snackbarHostState = LocalSnackbarHostState.current
|
||||
|
||||
var edit by remember { mutableStateOf(false) }
|
||||
|
||||
val transition = updateTransition(showDetails, label = "ContactItem")
|
||||
|
||||
Column(
|
||||
@ -276,7 +276,6 @@ fun ContactItem(
|
||||
}
|
||||
})
|
||||
}
|
||||
toolbarActions.add(hideAction)
|
||||
|
||||
toolbarActions.add(
|
||||
DefaultToolbarAction(
|
||||
@ -287,6 +286,15 @@ fun ContactItem(
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
toolbarActions.add(DefaultToolbarAction(
|
||||
label = stringResource(R.string.menu_customize),
|
||||
icon = Icons.Rounded.Edit,
|
||||
action = { edit = true }
|
||||
))
|
||||
|
||||
toolbarActions.add(hideAction)
|
||||
|
||||
Toolbar(
|
||||
leftActions = listOf(
|
||||
DefaultToolbarAction(
|
||||
@ -301,6 +309,13 @@ fun ContactItem(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (edit) {
|
||||
CustomizeSearchableSheet(
|
||||
searchable = contact,
|
||||
onDismiss = { edit = false }
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalAnimationApi::class)
|
||||
|
||||
@ -30,6 +30,7 @@ import de.mm20.launcher2.ui.component.Toolbar
|
||||
import de.mm20.launcher2.ui.component.ToolbarAction
|
||||
import de.mm20.launcher2.ui.ktx.toDp
|
||||
import de.mm20.launcher2.ui.ktx.toPixels
|
||||
import de.mm20.launcher2.ui.launcher.search.common.customattrs.CustomizeSearchableSheet
|
||||
import de.mm20.launcher2.ui.locals.LocalFavoritesEnabled
|
||||
import de.mm20.launcher2.ui.locals.LocalGridIconSize
|
||||
import de.mm20.launcher2.ui.locals.LocalSnackbarHostState
|
||||
@ -48,6 +49,8 @@ fun FileItem(
|
||||
val context = LocalContext.current
|
||||
val viewModel = remember(file.key) { FileItemVM(file) }
|
||||
|
||||
var edit by remember { mutableStateOf(false) }
|
||||
|
||||
val lifecycleOwner = LocalLifecycleOwner.current
|
||||
val snackbarHostState = LocalSnackbarHostState.current
|
||||
|
||||
@ -221,6 +224,12 @@ fun FileItem(
|
||||
}
|
||||
}
|
||||
|
||||
toolbarActions.add(DefaultToolbarAction(
|
||||
label = stringResource(R.string.menu_customize),
|
||||
icon = Icons.Rounded.Edit,
|
||||
action = { edit = true }
|
||||
))
|
||||
|
||||
val isHidden by viewModel.isHidden.collectAsState(false)
|
||||
val hideAction = if (isHidden) {
|
||||
DefaultToolbarAction(
|
||||
@ -267,6 +276,13 @@ fun FileItem(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (edit) {
|
||||
CustomizeSearchableSheet(
|
||||
searchable = file,
|
||||
onDismiss = { edit = false }
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalAnimationApi::class)
|
||||
|
||||
@ -7,16 +7,10 @@ import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.rounded.ArrowBack
|
||||
import androidx.compose.material.icons.rounded.Share
|
||||
import androidx.compose.material.icons.rounded.Star
|
||||
import androidx.compose.material.icons.rounded.StarOutline
|
||||
import androidx.compose.material.icons.rounded.*
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.collectAsState
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.geometry.Rect
|
||||
import androidx.compose.ui.layout.ContentScale
|
||||
@ -30,6 +24,7 @@ import de.mm20.launcher2.ui.component.Toolbar
|
||||
import de.mm20.launcher2.ui.component.ToolbarAction
|
||||
import de.mm20.launcher2.ui.R
|
||||
import de.mm20.launcher2.ui.ktx.toDp
|
||||
import de.mm20.launcher2.ui.launcher.search.common.customattrs.CustomizeSearchableSheet
|
||||
import de.mm20.launcher2.ui.locals.LocalFavoritesEnabled
|
||||
|
||||
@Composable
|
||||
@ -41,6 +36,8 @@ fun WebsiteItem(
|
||||
val context = LocalContext.current
|
||||
val viewModel = remember(website) { WebsiteItemVM(website) }
|
||||
|
||||
var edit by remember { mutableStateOf(false) }
|
||||
|
||||
Column(
|
||||
modifier = modifier.clickable {
|
||||
viewModel.launch(context)
|
||||
@ -104,6 +101,12 @@ fun WebsiteItem(
|
||||
)
|
||||
)
|
||||
|
||||
toolbarActions.add(DefaultToolbarAction(
|
||||
label = stringResource(R.string.menu_customize),
|
||||
icon = Icons.Rounded.Edit,
|
||||
action = { edit = true }
|
||||
))
|
||||
|
||||
Toolbar(
|
||||
leftActions = if (onBack != null) listOf(
|
||||
DefaultToolbarAction(
|
||||
@ -115,6 +118,13 @@ fun WebsiteItem(
|
||||
rightActions = toolbarActions
|
||||
)
|
||||
}
|
||||
|
||||
if (edit) {
|
||||
CustomizeSearchableSheet(
|
||||
searchable = website,
|
||||
onDismiss = { edit = false }
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalAnimationApi::class)
|
||||
|
||||
@ -6,16 +6,10 @@ import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.rounded.ArrowBack
|
||||
import androidx.compose.material.icons.rounded.Share
|
||||
import androidx.compose.material.icons.rounded.Star
|
||||
import androidx.compose.material.icons.rounded.StarOutline
|
||||
import androidx.compose.material.icons.rounded.*
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.collectAsState
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.geometry.Rect
|
||||
import androidx.compose.ui.layout.ContentScale
|
||||
@ -29,6 +23,7 @@ import de.mm20.launcher2.ui.component.DefaultToolbarAction
|
||||
import de.mm20.launcher2.ui.component.Toolbar
|
||||
import de.mm20.launcher2.ui.component.ToolbarAction
|
||||
import de.mm20.launcher2.ui.ktx.toDp
|
||||
import de.mm20.launcher2.ui.launcher.search.common.customattrs.CustomizeSearchableSheet
|
||||
import de.mm20.launcher2.ui.locals.LocalFavoritesEnabled
|
||||
import de.mm20.launcher2.ui.utils.htmlToAnnotatedString
|
||||
|
||||
@ -41,6 +36,8 @@ fun WikipediaItem(
|
||||
val context = LocalContext.current
|
||||
val viewModel = remember(wikipedia) { WikipediaItemVM(wikipedia) }
|
||||
|
||||
var edit by remember { mutableStateOf(false) }
|
||||
|
||||
Column(
|
||||
modifier = modifier.clickable {
|
||||
viewModel.launch(context)
|
||||
@ -111,6 +108,12 @@ fun WikipediaItem(
|
||||
)
|
||||
)
|
||||
|
||||
toolbarActions.add(DefaultToolbarAction(
|
||||
label = stringResource(R.string.menu_customize),
|
||||
icon = Icons.Rounded.Edit,
|
||||
action = { edit = true }
|
||||
))
|
||||
|
||||
Toolbar(
|
||||
leftActions = if (onBack != null) listOf(
|
||||
DefaultToolbarAction(
|
||||
@ -122,6 +125,13 @@ fun WikipediaItem(
|
||||
rightActions = toolbarActions
|
||||
)
|
||||
}
|
||||
|
||||
if (edit) {
|
||||
CustomizeSearchableSheet(
|
||||
searchable = wikipedia,
|
||||
onDismiss = { edit = false }
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalAnimationApi::class)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user