Drop 'internal' modifier for readability and shortness of examples

This commit is contained in:
Nebojsa Vuksic 2025-08-01 12:56:29 +02:00
parent edb8fb0b28
commit 8fe4926fb7
12 changed files with 18 additions and 18 deletions

View File

@ -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) }

View File

@ -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)

View File

@ -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
} }

View File

@ -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()

View File

@ -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"),

View File

@ -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>()

View File

@ -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>
} }

View File

@ -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()

View File

@ -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
) { ) {

View File

@ -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",

View File

@ -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 = {},

View File

@ -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