mirror of
https://github.com/JetBrains/intellij-platform-plugin-template.git
synced 2026-02-12 02:49:23 +00:00
Drop 'internal' modifier for readability and shortness of examples
This commit is contained in:
parent
edb8fb0b28
commit
8fe4926fb7
@ -36,7 +36,7 @@ import org.jetbrains.plugins.template.weatherApp.services.SearchAutoCompletionIt
|
|||||||
|
|
||||||
@OptIn(ExperimentalJewelApi::class)
|
@OptIn(ExperimentalJewelApi::class)
|
||||||
@Composable
|
@Composable
|
||||||
internal fun <T> SearchBarWithAutoCompletion(
|
fun <T> SearchBarWithAutoCompletion(
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
searchAutoCompletionItemProvider: SearchAutoCompletionItemProvider<T>,
|
searchAutoCompletionItemProvider: SearchAutoCompletionItemProvider<T>,
|
||||||
textFieldState: TextFieldState,
|
textFieldState: TextFieldState,
|
||||||
@ -120,7 +120,7 @@ internal fun <T> SearchBarWithAutoCompletion(
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
internal fun CloseIconButton(onClick: () -> Unit) {
|
fun CloseIconButton(onClick: () -> Unit) {
|
||||||
val interactionSource = remember { MutableInteractionSource() }
|
val interactionSource = remember { MutableInteractionSource() }
|
||||||
var hovered by remember { mutableStateOf(false) }
|
var hovered by remember { mutableStateOf(false) }
|
||||||
|
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import androidx.compose.runtime.Immutable
|
|||||||
* @property id A derived unique identifier for the location in the format `name, country`.
|
* @property id A derived unique identifier for the location in the format `name, country`.
|
||||||
*/
|
*/
|
||||||
@Immutable
|
@Immutable
|
||||||
internal data class Location(val name: String, val country: String) : PreviewableItem, Searchable {
|
data class Location(val name: String, val country: String) : PreviewableItem, Searchable {
|
||||||
val id: String = "$name, $country"
|
val id: String = "$name, $country"
|
||||||
|
|
||||||
override fun isSearchApplicable(query: String): Boolean {
|
override fun isSearchApplicable(query: String): Boolean {
|
||||||
@ -31,4 +31,4 @@ internal data class Location(val name: String, val country: String) : Previewabl
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Immutable
|
@Immutable
|
||||||
internal data class SelectableLocation(val location: Location, val isSelected: Boolean)
|
data class SelectableLocation(val location: Location, val isSelected: Boolean)
|
||||||
@ -3,6 +3,6 @@ package org.jetbrains.plugins.template.weatherApp.model
|
|||||||
/**
|
/**
|
||||||
* Represents an entity that can be filtered by a search query.
|
* Represents an entity that can be filtered by a search query.
|
||||||
*/
|
*/
|
||||||
internal interface Searchable {
|
interface Searchable {
|
||||||
fun isSearchApplicable(query: String): Boolean
|
fun isSearchApplicable(query: String): Boolean
|
||||||
}
|
}
|
||||||
@ -7,7 +7,7 @@ import java.time.LocalDateTime
|
|||||||
/**
|
/**
|
||||||
* Data class representing a daily weather forecast.
|
* Data class representing a daily weather forecast.
|
||||||
*/
|
*/
|
||||||
internal data class DailyForecast(
|
data class DailyForecast(
|
||||||
val date: LocalDateTime,
|
val date: LocalDateTime,
|
||||||
val temperature: Float,
|
val temperature: Float,
|
||||||
val weatherType: WeatherType,
|
val weatherType: WeatherType,
|
||||||
@ -19,7 +19,7 @@ internal data class DailyForecast(
|
|||||||
/**
|
/**
|
||||||
* Data class representing weather information to be displayed in the Weather Card.
|
* Data class representing weather information to be displayed in the Weather Card.
|
||||||
*/
|
*/
|
||||||
internal data class WeatherForecastData(
|
data class WeatherForecastData(
|
||||||
val location: Location,
|
val location: Location,
|
||||||
val currentWeatherForecast: DailyForecast,
|
val currentWeatherForecast: DailyForecast,
|
||||||
val dailyForecasts: List<DailyForecast> = emptyList()
|
val dailyForecasts: List<DailyForecast> = emptyList()
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import kotlinx.coroutines.flow.asStateFlow
|
|||||||
import org.jetbrains.plugins.template.weatherApp.model.Location
|
import org.jetbrains.plugins.template.weatherApp.model.Location
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
internal class LocationsProvider : SearchAutoCompletionItemProvider<Location> {
|
class LocationsProvider : SearchAutoCompletionItemProvider<Location> {
|
||||||
private val locationStateFlow = MutableStateFlow(
|
private val locationStateFlow = MutableStateFlow(
|
||||||
listOf(
|
listOf(
|
||||||
Location("Munich", "Germany"),
|
Location("Munich", "Germany"),
|
||||||
|
|||||||
@ -16,7 +16,7 @@ import org.jetbrains.plugins.template.weatherApp.model.WeatherForecastData
|
|||||||
* a flow to observe the list of selectable locations. Implementations are expected to handle
|
* a flow to observe the list of selectable locations. Implementations are expected to handle
|
||||||
* location-related logic and state management.
|
* location-related logic and state management.
|
||||||
*/
|
*/
|
||||||
internal interface MyLocationsViewModelApi {
|
interface MyLocationsViewModelApi {
|
||||||
fun onAddLocation(locationToAdd: Location)
|
fun onAddLocation(locationToAdd: Location)
|
||||||
|
|
||||||
fun onDeleteLocation(locationToDelete: Location)
|
fun onDeleteLocation(locationToDelete: Location)
|
||||||
@ -30,7 +30,7 @@ internal interface MyLocationsViewModelApi {
|
|||||||
* Interface representing a ViewModel for managing weather-related data
|
* Interface representing a ViewModel for managing weather-related data
|
||||||
* and user interactions.
|
* and user interactions.
|
||||||
*/
|
*/
|
||||||
internal interface WeatherViewModelApi {
|
interface WeatherViewModelApi {
|
||||||
val weatherForecast: Flow<WeatherForecastData>
|
val weatherForecast: Flow<WeatherForecastData>
|
||||||
|
|
||||||
fun onLoadWeatherForecast(location: Location)
|
fun onLoadWeatherForecast(location: Location)
|
||||||
@ -39,7 +39,7 @@ internal interface WeatherViewModelApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
internal class MyLocationsViewModel(cs: CoroutineScope) : MyLocationsViewModelApi, WeatherViewModelApi {
|
class MyLocationsViewModel(cs: CoroutineScope) : MyLocationsViewModelApi, WeatherViewModelApi {
|
||||||
|
|
||||||
private val weatherService = service<WeatherForecastService>()
|
private val weatherService = service<WeatherForecastService>()
|
||||||
|
|
||||||
|
|||||||
@ -11,6 +11,6 @@ import org.jetbrains.plugins.template.weatherApp.model.Searchable
|
|||||||
*
|
*
|
||||||
* @param T The type of items provided by this interface, which must extend [Searchable].
|
* @param T The type of items provided by this interface, which must extend [Searchable].
|
||||||
*/
|
*/
|
||||||
internal interface SearchAutoCompletionItemProvider<T : Searchable> {
|
interface SearchAutoCompletionItemProvider<T : Searchable> {
|
||||||
fun provideSearchableItems(searchTerm: String): List<T>
|
fun provideSearchableItems(searchTerm: String): List<T>
|
||||||
}
|
}
|
||||||
@ -15,7 +15,7 @@ import java.time.LocalTime
|
|||||||
import kotlin.random.Random
|
import kotlin.random.Random
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
internal class WeatherForecastService(private val cs: CoroutineScope) {
|
class WeatherForecastService(private val cs: CoroutineScope) {
|
||||||
private val _weatherForecast: MutableStateFlow<WeatherForecastData> = MutableStateFlow(WeatherForecastData.EMPTY)
|
private val _weatherForecast: MutableStateFlow<WeatherForecastData> = MutableStateFlow(WeatherForecastData.EMPTY)
|
||||||
|
|
||||||
val weatherForecast: StateFlow<WeatherForecastData> = _weatherForecast.asStateFlow()
|
val weatherForecast: StateFlow<WeatherForecastData> = _weatherForecast.asStateFlow()
|
||||||
|
|||||||
@ -32,7 +32,7 @@ import org.jetbrains.plugins.template.weatherApp.ui.components.SearchToolbarMenu
|
|||||||
import org.jetbrains.plugins.template.weatherApp.ui.components.WeatherDetailsCard
|
import org.jetbrains.plugins.template.weatherApp.ui.components.WeatherDetailsCard
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
internal fun WeatherAppSample(
|
fun WeatherAppSample(
|
||||||
myLocationViewModel: MyLocationsViewModelApi,
|
myLocationViewModel: MyLocationsViewModelApi,
|
||||||
weatherViewModelApi: WeatherViewModelApi,
|
weatherViewModelApi: WeatherViewModelApi,
|
||||||
searchAutoCompletionItemProvider: SearchAutoCompletionItemProvider<Location>
|
searchAutoCompletionItemProvider: SearchAutoCompletionItemProvider<Location>
|
||||||
@ -85,7 +85,7 @@ private fun LeftColumn(
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
internal fun MyLocationsListWithEmptyListPlaceholder(
|
fun MyLocationsListWithEmptyListPlaceholder(
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
myLocationsViewModelApi: MyLocationsViewModelApi
|
myLocationsViewModelApi: MyLocationsViewModelApi
|
||||||
) {
|
) {
|
||||||
|
|||||||
@ -17,7 +17,7 @@ import javax.xml.transform.stream.StreamResult
|
|||||||
import javax.xml.xpath.XPathConstants
|
import javax.xml.xpath.XPathConstants
|
||||||
import javax.xml.xpath.XPathFactory
|
import javax.xml.xpath.XPathFactory
|
||||||
|
|
||||||
internal object EmbeddedToInlineCssSvgTransformerHint : PainterSvgPatchHint {
|
object EmbeddedToInlineCssSvgTransformerHint : PainterSvgPatchHint {
|
||||||
private val CSS_STYLEABLE_TAGS = listOf(
|
private val CSS_STYLEABLE_TAGS = listOf(
|
||||||
"linearGradient", "radialGradient", "pattern",
|
"linearGradient", "radialGradient", "pattern",
|
||||||
"filter", "clipPath", "mask", "symbol",
|
"filter", "clipPath", "mask", "symbol",
|
||||||
|
|||||||
@ -20,7 +20,7 @@ import org.jetbrains.plugins.template.weatherApp.model.Searchable
|
|||||||
import org.jetbrains.plugins.template.weatherApp.services.SearchAutoCompletionItemProvider
|
import org.jetbrains.plugins.template.weatherApp.services.SearchAutoCompletionItemProvider
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
internal fun <T> SearchToolbarMenu(
|
fun <T> SearchToolbarMenu(
|
||||||
searchAutoCompletionItemProvider: SearchAutoCompletionItemProvider<T>,
|
searchAutoCompletionItemProvider: SearchAutoCompletionItemProvider<T>,
|
||||||
confirmButtonText: String = "Confirm",
|
confirmButtonText: String = "Confirm",
|
||||||
onSearchPerformed: (T) -> Unit = {},
|
onSearchPerformed: (T) -> Unit = {},
|
||||||
|
|||||||
@ -44,7 +44,7 @@ import java.util.*
|
|||||||
*/
|
*/
|
||||||
@OptIn(ExperimentalFoundationApi::class)
|
@OptIn(ExperimentalFoundationApi::class)
|
||||||
@Composable
|
@Composable
|
||||||
internal fun WeatherDetailsCard(
|
fun WeatherDetailsCard(
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
weatherForecastData: WeatherForecastData,
|
weatherForecastData: WeatherForecastData,
|
||||||
onReloadWeatherData: (Location) -> Unit
|
onReloadWeatherData: (Location) -> Unit
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user