path
stringlengths 4
280
| owner
stringlengths 2
39
| repo_id
int64 21.1k
879M
| is_fork
bool 2
classes | languages_distribution
stringlengths 13
1.95k
⌀ | content
stringlengths 7
482k
| issues
int64 0
13.9k
| main_language
stringclasses 121
values | forks
stringlengths 1
5
| stars
int64 0
111k
| commit_sha
stringlengths 40
40
| size
int64 7
482k
| name
stringlengths 1
100
| license
stringclasses 93
values |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
data/src/main/java/com/semicolon/data/local/datasource/LocalNoticeDataSource.kt | Walkhub | 443,006,389 | false | null | package com.semicolon.data.local.datasource
import com.semicolon.domain.entity.notice.NoticeEntity
import com.semicolon.domain.enum.NoticeType
interface LocalNoticeDataSource {
suspend fun fetchNoticeList(): NoticeEntity
suspend fun saveNoticeList(list: NoticeEntity)
} | 30 | Kotlin | 1 | 15 | c2d85ebb9ae8b200be22e9029dcfdcbfed19e473 | 281 | walkhub_android | MIT License |
src/commonMain/kotlin/commandHandler/ListDestinationsCommand.kt | Alpha-Kand | 583,475,560 | false | {"Kotlin": 133003, "Shell": 378, "Python": 236} | package commandHandler
import requireNull
class ListDestinationsCommand : Command {
private var name: String? = null
fun getName() = name
override fun verify() {}
override fun addArg(argumentName: String, value: String) = tryCatch(argumentName = argumentName, value = value) {
if (nameArguments.contains(argumentName)) {
requireNull(name)
name = value
return@tryCatch true
}
return@tryCatch false
}
}
| 0 | Kotlin | 0 | 0 | 671bca77a3e74b5fce4826625ccc577284aae803 | 486 | Fittonia | MIT License |
query/src/test/java/net/epictimes/uvindex/query/QueryPresenterTest.kt | mustafaberkaymutlu | 103,974,735 | false | null | package net.epictimes.uvindex.query
import com.nhaarman.mockito_kotlin.*
import net.epictimes.uvindex.data.interactor.WeatherInteractor
import net.epictimes.uvindex.data.model.Weather
import org.junit.Assert.assertEquals
import org.junit.Before
import org.junit.Test
import org.mockito.ArgumentMatchers.eq
import org.mockito.Mock
import org.mockito.Mockito.times
import org.mockito.Mockito.verify
import org.mockito.MockitoAnnotations
import java.util.*
class QueryPresenterTest {
private lateinit var queryPresenter: QueryPresenter
@Mock
private lateinit var weatherInteractor: WeatherInteractor
@Mock
private lateinit var queryView: QueryView
@Before
fun setupMocksAndView() {
MockitoAnnotations.initMocks(this)
}
@Test
fun givenEmptyWeatherList_shouldDisplayError() {
queryPresenter = QueryPresenter(weatherInteractor, Date())
queryPresenter.attachView(queryView)
queryPresenter.getForecastUvIndex(1.0, 2.0, null, null)
argumentCaptor<WeatherInteractor.GetForecastCallback>().apply {
verify(weatherInteractor).getForecast(eq(1.0), eq(2.0), eq(null), eq(null), eq(24),
capture())
firstValue.onSuccessGetForecast(emptyList(), "Europe/Istanbul")
}
verify(queryView, times(1)).displayGetUvIndexError()
}
@Test
fun givenError_shouldDisplayError() {
queryPresenter = QueryPresenter(weatherInteractor, Date())
queryPresenter.attachView(queryView)
queryPresenter.getForecastUvIndex(1.0, 2.0, null, null)
argumentCaptor<WeatherInteractor.GetForecastCallback>().apply {
verify(weatherInteractor).getForecast(eq(1.0), eq(2.0), eq(null), eq(null), eq(24),
capture())
firstValue.onFailGetForecast()
}
verify(queryView, times(1)).displayGetUvIndexError()
}
@Test
fun givenWeatherForecast_shouldDisplayUvIndex() {
val weather = mock<Weather>()
val weatherForecast = Array(24) { weather }.asList()
whenever(weather.datetime).thenReturn(Date())
queryPresenter = QueryPresenter(weatherInteractor, Date())
queryPresenter.attachView(queryView)
queryPresenter.getForecastUvIndex(1.0, 2.0, null, null)
argumentCaptor<WeatherInteractor.GetForecastCallback>().apply {
verify(weatherInteractor).getForecast(eq(1.0), eq(2.0), eq(null), eq(null), eq(24),
capture())
firstValue.onSuccessGetForecast(weatherForecast, "Europe/Istanbul")
}
val currentUvIndex = weatherForecast.first()
verify(queryView, times(1)).setToViewState(currentUvIndex, weatherForecast, "Europe/Istanbul")
verify(queryView, times(1)).displayUvIndex(currentUvIndex)
verify(queryView, times(1)).displayUvIndexForecast(weatherForecast)
}
@Test
fun givenWeatherForecast_shouldGetClosestDateCorrectly() {
val currentMillis = 2049L
val closestMillis = 2000L
val weatherForecast = (0..24).map({
val mock = mock<Weather>()
whenever(mock.datetime).thenReturn(Date(it * 100L))
mock
}).toList()
queryPresenter = QueryPresenter(weatherInteractor, Date(currentMillis))
queryPresenter.attachView(queryView)
queryPresenter.getForecastUvIndex(0.0, 0.0, null, null)
argumentCaptor<WeatherInteractor.GetForecastCallback>().apply {
verify(weatherInteractor, times(1)).getForecast(any(), any(),
anyOrNull(), anyOrNull(), anyOrNull(), capture())
firstValue.onSuccessGetForecast(weatherForecast, "Europe/Istanbul")
}
verify(queryView, times(1)).displayUvIndex(check {
assertEquals(closestMillis, it.datetime.time)
})
}
} | 2 | Kotlin | 9 | 66 | 5b7bbf83c472b462101cca466d0145eb8b131a8d | 3,868 | uv-index | Apache License 2.0 |
gmaven/src/main/kotlin/ru/rzn/gmyasoedov/gmaven/project/action/UpdateSnapshotAction.kt | grisha9 | 586,299,688 | false | {"Java": 254471, "Kotlin": 250979, "HTML": 339} | package ru.rzn.gmyasoedov.gmaven.project.action
import com.intellij.icons.AllIcons
import com.intellij.openapi.actionSystem.ActionUpdateThread
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.ToggleAction
import ru.rzn.gmyasoedov.gmaven.bundle.GBundle
import ru.rzn.gmyasoedov.gmaven.settings.MavenSettings
import ru.rzn.gmyasoedov.gmaven.settings.ProjectSettingsControlBuilder.SnapshotUpdateType
class UpdateSnapshotAction : ToggleAction() {
override fun isSelected(e: AnActionEvent): Boolean {
val project = e.project ?: return false
val settings = MavenSettings.getInstance(project).linkedProjectsSettings.firstOrNull() ?: return false
updateState(settings.snapshotUpdateType)
return settings.snapshotUpdateType != SnapshotUpdateType.DEFAULT
}
override fun setSelected(e: AnActionEvent, state: Boolean) {
val project = e.project ?: return
val settings = MavenSettings.getInstance(project).linkedProjectsSettings.firstOrNull() ?: return
val currentType = settings.snapshotUpdateType
val ordinal = currentType.ordinal
val next = SnapshotUpdateType.values()[(ordinal + 1) % SnapshotUpdateType.values().size]
MavenSettings.getInstance(project).linkedProjectsSettings.forEach { it.snapshotUpdateType = next }
updateState(next)
}
override fun getActionUpdateThread(): ActionUpdateThread {
return ActionUpdateThread.EDT
}
init {
templatePresentation.text = GBundle.message("gmaven.action.snapshot")
}
private fun updateState(type: SnapshotUpdateType) {
when (type) {
SnapshotUpdateType.DEFAULT -> templatePresentation.icon = AllIcons.Actions.FindEntireFile
SnapshotUpdateType.NEVER -> templatePresentation.icon = AllIcons.General.InspectionsTrafficOff
else -> templatePresentation.icon = AllIcons.Actions.ForceRefresh
}
}
} | 0 | Java | 0 | 11 | dae0249e46a83b4338071e6ee30367b2d78b7b53 | 1,969 | gmaven-plugin | Apache License 2.0 |
library/src/main/java/com/rafakob/nsdhelper/TransportLayer.kt | DatL4g | 251,677,632 | true | {"Kotlin": 17826, "Java": 1328} | package com.rafakob.nsdhelper
enum class TransportLayer(protocol: String) {
ALCAP("_alcap"),
CSP("_csp"),
DCCP("_dccp"),
ECN("_ecn"),
FASP("_fasp"),
IL("_il"),
LTP("_ltp"),
MTP("_mtp"),
PPTP("_pptp"),
QUIC("_quic"),
RDP("_rdp"),
RDS("_rds"),
RUDP("_rudp"),
RSVP("_rsvp"),
STCP("_stcp"),
SCTP("_sctp"),
SPX("_spx"),
SCCP("_sccp"),
SH1("_sh1"),
SST("_sst"),
TCPW("_tcpw"),
TIPC("_tipc"),
TCP("_tcp"),
UDPL("_udpl"),
UDP("_udp"),
VTP("_vtp"),
WDP("_wdp"),
WTP("_wtp"),
WTLS("_wtls"),
WTCP("_wtcp"),
XTP("_xtp"),
} | 0 | Kotlin | 0 | 1 | 71cc481f054a6cc7bad9f85f2d74f05322de3d47 | 635 | NsdHelper | Apache License 2.0 |
src/main/kotlin/de/debuglevel/simplebenchmark/benchmarks/Benchmark.kt | debuglevel | 294,937,712 | false | null | package de.debuglevel.simplebenchmark.benchmarks
import mu.KotlinLogging
import org.nield.kotlinstatistics.median
import kotlin.system.measureNanoTime
abstract class Benchmark {
private val logger = KotlinLogging.logger {}
abstract val enabled: Boolean
abstract val benchmarkIterations: Int
abstract val baselineValue: Double
abstract val name: String
abstract val benchmarkType: BenchmarkType
abstract fun getIterationDuration(): Long
fun getScore(): BenchmarkScore {
logger.debug { "Getting median score for $name over $benchmarkIterations iterations..." }
var medianDuration: Double
val nanoseconds = measureNanoTime {
val medianDurationX = (1..benchmarkIterations).map {
logger.trace { "Getting score for $name in iteration $it of $benchmarkIterations..." }
val score = getIterationDuration()
logger.trace { "Got score for $name in iteration $it of $benchmarkIterations: $score" }
score
}.median()
medianDuration = medianDurationX
}
val duration = nanoseconds / 1000.0 / 1000.0 / 1000.0
val score = medianDuration / baselineValue
logger.debug { "Got median score for $name over $benchmarkIterations iterations: $score" }
return BenchmarkScore(name, medianDuration, score, duration)
}
} | 0 | Kotlin | 0 | 0 | d2bcb6faf7b12be8b668f000660828fd570521a6 | 1,397 | simple-benchmark | The Unlicense |
src/main/kotlin/com/jerryjeon/logjerry/log/ParseCompleted.kt | jkj8790 | 521,791,909 | false | null | package com.jerryjeon.logjerry.log
import com.jerryjeon.logjerry.detection.DetectionFinished
import com.jerryjeon.logjerry.detector.Detection
import com.jerryjeon.logjerry.detector.DetectorKey
import com.jerryjeon.logjerry.detector.DetectorManager
import com.jerryjeon.logjerry.filter.FilterManager
import com.jerryjeon.logjerry.logview.LogAnnotation
import com.jerryjeon.logjerry.logview.RefineResult
import com.jerryjeon.logjerry.logview.RefinedLog
import com.jerryjeon.logjerry.preferences.Preferences
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.stateIn
/**
* The class that is created after parsing is completed.
*/
class ParseCompleted(
val originalLogsFlow: StateFlow<List<Log>>,
preferences: Preferences
) {
private val refineScope = CoroutineScope(Dispatchers.Default)
val filterManager = FilterManager()
val detectorManager = DetectorManager(preferences)
private val filteredLogsFlow = combine(originalLogsFlow, filterManager.filtersFlow) { originalLogs, filters ->
if (filters.isEmpty()) {
originalLogs
} else {
originalLogs
.filter { log -> filters.all { it.filter(log) } }
}
}
val detectionFinishedFlow = combine(filteredLogsFlow, detectorManager.detectorsFlow) { filteredLogs, detectors ->
val allDetectionResults = mutableMapOf<DetectorKey, List<Detection>>()
val detectionFinishedLogs = filteredLogs.associateWith { log ->
val detections = detectors.associate { it.key to it.detect(log.log, log.index) }
detections.forEach { (key, value) ->
allDetectionResults[key] = (allDetectionResults[key] ?: emptyList()) + value
}
detections
}
DetectionFinished(detectors, detectionFinishedLogs, allDetectionResults)
}.stateIn(
refineScope,
SharingStarted.Lazily,
DetectionFinished(emptyList(), emptyMap(), emptyMap())
)
val refineResultFlow = combine(
filteredLogsFlow,
detectionFinishedFlow
) { filteredLogs, detectionFinished ->
val allDetections = mutableMapOf<DetectorKey, List<Detection>>()
var lastRefinedLog: RefinedLog? = null
val refinedLogs = filteredLogs.map { log ->
val detections = detectionFinished.detectionsByLog[log] ?: emptyMap()
detections.forEach { (key, newValue) ->
val list = allDetections.getOrPut(key) { emptyList() }
allDetections[key] = list + newValue
}
// Why should it be separated : make possible to change data of detectionResult
// TODO don't want to repeat all annotate if just one log has changed. How can I achieve it
val logContents =
LogAnnotation.separateAnnotationStrings(log, detections.values.flatten())
val timeGap = lastRefinedLog?.log?.durationBetween(log)?.takeIf { it.toSeconds() >= 3 }
RefinedLog(log, detections, LogAnnotation.annotate(log, logContents, detectionFinished.detectors), timeGap).also {
lastRefinedLog = it
}
}
RefineResult(refinedLogs, allDetections)
}
.stateIn(refineScope, SharingStarted.Lazily, RefineResult(emptyList(), emptyMap()))
}
| 5 | Kotlin | 3 | 39 | 930eafcf6a321d329820cf1bb750d5a596bf8d9f | 3,481 | LogJerry | Apache License 2.0 |
app/src/main/java/com/kieronquinn/app/taptap/ui/screens/update/download/UpdateDownloadBottomSheetFragment.kt | KieronQuinn | 283,883,226 | false | null | package com.kieronquinn.app.taptap.ui.screens.update.download
import android.os.Bundle
import android.widget.Toast
import androidx.lifecycle.lifecycleScope
import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.customview.customView
import com.kieronquinn.app.taptap.R
import com.kieronquinn.app.taptap.databinding.FragmentUpdateDownloadBottomSheetBinding
import com.kieronquinn.app.taptap.components.base.BaseBottomSheetDialogFragment
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.launch
import org.koin.android.viewmodel.ext.android.sharedViewModel
class UpdateDownloadBottomSheetFragment: BaseBottomSheetDialogFragment() {
private val updateViewModel by sharedViewModel<UpdateDownloadBottomSheetViewModel>()
private lateinit var binding: FragmentUpdateDownloadBottomSheetBinding
override fun onMaterialDialogCreated(materialDialog: MaterialDialog, savedInstanceState: Bundle?) = materialDialog.apply {
title(R.string.bs_update_download_title)
binding = FragmentUpdateDownloadBottomSheetBinding.inflate(layoutInflater)
customView(view = binding.root)
negativeButton(R.string.restore_prompt_cancel){
updateViewModel.cancelDownload(this@UpdateDownloadBottomSheetFragment)
}
noAutoDismiss()
cancelOnTouchOutside(false)
}
override fun onResume() {
super.onResume()
lifecycleScope.launch {
updateViewModel.downloadState.collect {
when(it){
is UpdateDownloadBottomSheetViewModel.State.Downloading -> {
if(it.progress > 0) {
binding.fragmentUpdateDownloadProgress.isIndeterminate = false
binding.fragmentUpdateDownloadProgress.progress = it.progress
}
}
is UpdateDownloadBottomSheetViewModel.State.Done -> {
updateViewModel.openPackageInstaller(requireContext(), it.fileUri)
dismiss()
}
is UpdateDownloadBottomSheetViewModel.State.Failed -> {
Toast.makeText(requireContext(), R.string.bs_update_download_failed, Toast.LENGTH_LONG).show()
dismiss()
}
}
}
}
}
} | 52 | Kotlin | 2 | 2,251 | abec5a3e139786beeea75e2fb5677013d0719bf1 | 2,407 | TapTap | Apache License 2.0 |
configure-basemap-style-parameters/src/main/java/com/esri/arcgismaps/sample/configurebasemapstyleparameters/screens/MainScreen.kt | Esri | 530,805,756 | false | {"Kotlin": 900529, "Python": 31233, "Java": 9909, "Dockerfile": 620, "Ruby": 597} | /* Copyright 2024 Esri
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.esri.arcgismaps.sample.configurebasemapstyleparameters.screens
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.widthIn
import androidx.compose.foundation.layout.wrapContentHeight
import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.foundation.layout.wrapContentWidth
import androidx.compose.foundation.selection.selectable
import androidx.compose.material3.BottomSheetScaffold
import androidx.compose.material3.Button
import androidx.compose.material3.DropdownMenu
import androidx.compose.material3.DropdownMenuItem
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.RadioButton
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.material3.rememberBottomSheetScaffoldState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import androidx.lifecycle.viewmodel.compose.viewModel
import com.arcgismaps.toolkit.geoviewcompose.MapView
import com.esri.arcgismaps.sample.configurebasemapstyleparameters.components.MapViewModel
import com.esri.arcgismaps.sample.sampleslib.components.SampleTopAppBar
import kotlinx.coroutines.launch
/**
* Main screen layout for the sample app
*/
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun MainScreen(sampleName: String) {
// create a ViewModel to handle MapView interactions
val mapViewModel: MapViewModel = viewModel()
// handle the BottomSheetScaffold state
val bottomSheetScope = rememberCoroutineScope()
val bottomSheetState = rememberBottomSheetScaffoldState().apply {
bottomSheetScope.launch {
// show the bottom sheet on launch
bottomSheetState.expand()
}
}
Scaffold(
topBar = { SampleTopAppBar(title = sampleName) },
content = {
Box(
modifier = Modifier
.fillMaxSize()
.padding(it),
contentAlignment = Alignment.Center
) {
MapView(
modifier = Modifier
.fillMaxSize(),
arcGISMap = mapViewModel.map
)
// show the "Show controls" button only when the bottom sheet is not visible
if (!bottomSheetState.bottomSheetState.isVisible) {
Button(
modifier = Modifier
.align(Alignment.BottomCenter)
.padding(bottom = 24.dp),
onClick = {
bottomSheetScope.launch {
bottomSheetState.bottomSheetState.expand()
}
},
) {
Text(
text = "Show controls"
)
}
}
// constrain the bottom sheet to a maximum width of 380dp
Box(
modifier = Modifier
.widthIn(0.dp, 380.dp)
) {
BottomSheetScaffold(
scaffoldState = bottomSheetState,
sheetContent = {
Box(
// constrain the height of the bottom sheet to 160dp
Modifier
.heightIn(max = 160.dp)
.padding(8.dp)
) {
Row(horizontalArrangement = Arrangement.SpaceBetween) {
Column(Modifier.weight(0.5f)) {
// UI for setting the language strategy
LanguageStrategyControls(
languageStrategyOptions = mapViewModel.languageStrategyOptions,
onLanguageStrategyChange = { languageStrategy ->
mapViewModel.updateLanguageStrategy(languageStrategy)
},
languageStrategy = mapViewModel.languageStrategy,
enabled = (mapViewModel.specificLanguage == "None")
)
}
Column(Modifier.weight(0.5f)) {
// UI for setting the specific language
SpecificLanguageControls(
specificLanguageOptions = mapViewModel.specificLanguageOptions,
onSpecificLanguageChange = { specificLanguage ->
mapViewModel.updateSpecificStrategy(specificLanguage)
},
specificLanguage = mapViewModel.specificLanguage
)
}
}
}
}
) {
}
}
}
}
)
}
/**
* Define the UI radio buttons for selecting language strategy: "Global" or "Local".
*/
@Composable
private fun LanguageStrategyControls(
languageStrategyOptions: List<String>,
onLanguageStrategyChange: (String) -> Unit,
languageStrategy: String,
enabled: Boolean
) {
Text(
text = "Set language strategy:"
)
languageStrategyOptions.forEach { text ->
Row(
Modifier
.wrapContentWidth()
.wrapContentHeight()
.selectable(
selected = (text == languageStrategy),
onClick = {
if (enabled) {
onLanguageStrategyChange(text)
}
}
)
) {
RadioButton(
selected = (text == languageStrategy),
onClick = {
if (enabled) {
onLanguageStrategyChange(text)
}
},
enabled = enabled
)
Text(
text = text,
modifier = Modifier
.align(Alignment.CenterVertically)
.wrapContentHeight()
.wrapContentWidth()
)
}
}
}
/**
* Define the UI dropdown menu for selecting specific language: "None", "Bulgarian", "Greek" or
* "Turkish".
*/
@Composable
private fun SpecificLanguageControls(
specificLanguageOptions: List<String>,
onSpecificLanguageChange: (String) -> Unit,
specificLanguage: String
) {
Text(
text = "Set specific language:"
)
var expanded by remember { mutableStateOf(false) }
Box(
modifier = Modifier
.wrapContentHeight()
.wrapContentWidth()
.wrapContentSize(Alignment.TopStart)
.padding(top = 16.dp)
) {
Text(
specificLanguage,
modifier = Modifier
.fillMaxWidth()
.clickable(onClick = { expanded = true })
.border(
2.dp,
Color.LightGray
)
.padding(horizontal = 16.dp, vertical = 12.dp)
)
DropdownMenu(
expanded = expanded,
onDismissRequest = { expanded = false }
) {
specificLanguageOptions.forEachIndexed { index, specificLanguage ->
DropdownMenuItem(
text = { Text(specificLanguage) },
onClick = {
onSpecificLanguageChange(specificLanguage)
expanded = false
})
// show a divider between dropdown menu options
if (index < specificLanguageOptions.lastIndex) {
HorizontalDivider()
}
}
}
}
}
| 11 | Kotlin | 31 | 43 | 3ad9236362a048d5772e1bed49fbfe2f10038e9e | 9,833 | arcgis-maps-sdk-kotlin-samples | Apache License 2.0 |
domain/impl/src/main/kotlin/dev/yacsa/domain/impl/mapper/featureflag/FeatureFlagDomainRepoMapper.kt | andrew-malitchuk | 589,720,124 | false | null | package dev.yacsa.domain.impl.mapper.featureflag
import dev.yacsa.domain.model.featureflag.FeatureFlagDomainModel
import dev.yacsa.repository.model.FeatureFlagRepoModel
import org.mapstruct.Mapper
@Mapper
interface FeatureFlagDomainRepoMapper {
fun toRepo(
featureFlagDomainModel: FeatureFlagDomainModel,
): FeatureFlagRepoModel
fun toDomain(
featureFlagRepoModel: FeatureFlagRepoModel,
): FeatureFlagDomainModel
}
| 0 | Kotlin | 0 | 0 | e35620cf1c66b4f76f0ed30d9c6d499acd134403 | 451 | yet-another-compose-showcase-app | MIT License |
app/src/main/java/com/github/jacklt/arexperiments/Scene1Activity.kt | omarmiatello | 166,853,355 | false | null | package com.github.jacklt.arexperiments
import com.github.jacklt.arexperiments.ar.addOnUpdateInMills
import com.github.jacklt.arexperiments.ar.distanceToColor
import com.github.jacklt.arexperiments.ar.floatAnimator
import com.github.jacklt.arexperiments.ar.minus
import com.github.jacklt.arexperiments.generic.SceneformActivity
import com.google.ar.sceneform.NodeParent
import com.google.ar.sceneform.math.Vector3
import com.google.ar.sceneform.rendering.Color
import com.google.ar.sceneform.rendering.Material
import com.google.ar.sceneform.rendering.MaterialFactory
import com.google.ar.sceneform.rendering.ShapeFactory
class Scene1Activity : SceneformActivity() {
override fun onInitSceneform() {
arFragment.setOnTapArPlaneListener { hitResult, _, _ ->
hitResult.anchorNode {
transformableNode {
box(0.1f, 0.03f, 0.2f, 0.01f, material(Color(1f, 0f, 0f, .2f)))
ball(material(Color(1f, 0f, 0f)))
}
}
}
}
private suspend inline fun NodeParent.box(
width: Float,
height: Float,
depth: Float,
thick: Float,
material: Material
) = node("box") {
node("left").renderable = ShapeFactory
.makeCube(Vector3(thick, height, depth), Vector3((thick - width) / 2, 0f, 0f), material)
node("right").renderable = ShapeFactory
.makeCube(Vector3(thick, height, depth), Vector3((width - thick) / 2, 0f, 0f), material)
node("forward").renderable = ShapeFactory
.makeCube(Vector3(width, height, thick), Vector3(0f, 0f, (thick - depth) / 2), material)
node("back").renderable = ShapeFactory
.makeCube(Vector3(width, height, thick), Vector3(0f, 0f, (depth - thick) / 2), material)
localPosition = Vector3(0f, height / 2, 0f)
}
private suspend fun NodeParent.ball(red: Material) = node("ball") {
renderable = ShapeFactory.makeSphere(0.01f, Vector3(0.0f, 0.01f, 0.0f), red)
val xMax = (0.1f - (0.01f * 2) - (0.01f * 2)) / 2
val yMax = (0.03f - (0.01f * 2) - (0.01f * 2)) / 2
val zMax = (0.2f - (0.01f * 2) - (0.01f * 2)) / 2
val xAnim = floatAnimator(0f, xMax, 0f, -xMax, 0f) { duration = 6000 }
val yAnim = floatAnimator(0f, yMax, 0f) { duration = 2500 }
val zAnim = floatAnimator(0f, zMax, 0f, -zMax, 0f) { duration = 4000 }
val camera = arSceneView.scene.camera
addOnUpdateInMills {
val distance = (camera.worldPosition - worldPosition).length()
renderable!!.material.setFloat3(MaterialFactory.MATERIAL_COLOR, distance.distanceToColor())
localPosition = Vector3(xAnim.value(it), yAnim.value(it), zAnim.value(it))
}
}
}
| 0 | Kotlin | 1 | 10 | 7f0defb8b934b1dd48644d271b4c61ea9a31e68e | 2,792 | android-ktx-arcore-sceneform | MIT License |
features/home/src/main/java/com/example/movieapp/home/redux/HomeStateMachine.kt | Ahnset | 539,038,324 | false | {"Kotlin": 138435} | package com.example.movieapp.home.redux
import com.example.movieapp.core.redux.Reducer
import com.example.movieapp.core.redux.StateMachine
import com.example.movieapp.home.redux.HomeAction.GetHomeCatalogs
import com.example.movieapp.home.redux.HomeAction.GetHomeCatalogsError
import com.example.movieapp.home.redux.HomeAction.GetHomeCatalogsLoaded
import com.example.movieapp.home.redux.HomeAction.Idle
import javax.inject.Inject
class HomeStateMachine @Inject constructor(
homeMiddleware: HomeMiddleware
) : StateMachine<HomeState, HomeAction>(homeMiddleware) {
override val initialState = HomeState.Idle
override val reducer: Reducer<HomeState, HomeAction> = { currentState, action ->
when (action) {
is Idle -> currentState
is GetHomeCatalogs -> HomeState.GetHomeCatalogsStarted
is GetHomeCatalogsError -> HomeState.HomeCatalogsError(action.message)
is GetHomeCatalogsLoaded -> {
HomeState.HomeCatalogsLoaded(
popularMovies = action.popularMovies,
trendingMovies = action.trendingMovies,
topRatedMovies = action.topRatedMovies,
upcomingMovies = action.upcomingMovies,
)
}
}
}
}
| 0 | Kotlin | 2 | 3 | a5ddc921f8f4df80cc13f17284015086fe6112b0 | 1,289 | movieapp | Apache License 2.0 |
presentation/src/main/java/com/wa2c/android/cifsdocumentsprovider/presentation/ui/folder/FolderScreen.kt | wa2c | 309,159,444 | false | {"Kotlin": 328098} | package com.wa2c.android.cifsdocumentsprovider.presentation.ui.folder
import android.content.res.Configuration
import android.net.Uri
import androidx.activity.compose.BackHandler
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.foundation.ScrollState
import androidx.compose.foundation.clickable
import androidx.compose.foundation.horizontalScroll
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Button
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.Scaffold
import androidx.compose.material3.SnackbarHostState
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalLifecycleOwner
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.wa2c.android.cifsdocumentsprovider.common.utils.isRoot
import com.wa2c.android.cifsdocumentsprovider.domain.model.CifsFile
import com.wa2c.android.cifsdocumentsprovider.presentation.R
import com.wa2c.android.cifsdocumentsprovider.presentation.ext.collectIn
import com.wa2c.android.cifsdocumentsprovider.presentation.ui.common.AppSnackbarHost
import com.wa2c.android.cifsdocumentsprovider.presentation.ui.common.getAppTopAppBarColors
import com.wa2c.android.cifsdocumentsprovider.presentation.ui.common.DividerNormal
import com.wa2c.android.cifsdocumentsprovider.presentation.ui.common.DividerThin
import com.wa2c.android.cifsdocumentsprovider.presentation.ui.common.LoadingIconButton
import com.wa2c.android.cifsdocumentsprovider.presentation.ui.common.PopupMessage
import com.wa2c.android.cifsdocumentsprovider.presentation.ui.common.PopupMessageType
import com.wa2c.android.cifsdocumentsprovider.presentation.ui.common.Theme
import com.wa2c.android.cifsdocumentsprovider.presentation.ui.common.showPopup
/**
* Folder Screen
*/
@Composable
fun FolderScreen(
viewModel: FolderViewModel = hiltViewModel(),
lifecycleOwner: LifecycleOwner = LocalLifecycleOwner.current,
onNavigateBack: () -> Unit,
onNavigateSet: (Uri) -> Unit,
) {
val snackbarHostState = remember { SnackbarHostState() }
val scope = rememberCoroutineScope()
val fileList = viewModel.fileList.collectAsStateWithLifecycle()
val currentUri = viewModel.currentUri.collectAsStateWithLifecycle()
val isLoading = viewModel.isLoading.collectAsStateWithLifecycle()
FolderScreenContainer(
snackbarHostState = snackbarHostState,
fileList = fileList.value,
currentUri = currentUri.value,
isLoading = isLoading.value,
onClickBack = { onNavigateBack() },
onClickReload = { viewModel.onClickReload() },
onClickItem = { viewModel.onSelectFolder(it) },
onClickUp = { viewModel.onUpFolder() },
onClickSet = { viewModel.currentUri.value.let { onNavigateSet(it) } },
)
LaunchedEffect(Unit) {
viewModel.result.collectIn(lifecycleOwner) {
scope.showPopup(
snackbarHostState = snackbarHostState,
popupMessage = PopupMessage.Resource(
res = R.string.host_error_network,
type = PopupMessageType.Error,
error = it.exceptionOrNull()
)
)
}
}
// Back button
BackHandler { if (!viewModel.onUpFolder()) { onNavigateBack() } }
}
/**
* Folder Screen container
*/
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun FolderScreenContainer(
snackbarHostState: SnackbarHostState,
fileList: List<CifsFile>,
currentUri: Uri,
isLoading: Boolean,
onClickBack: () -> Unit,
onClickReload: () -> Unit,
onClickItem: (CifsFile) -> Unit,
onClickUp: () -> Unit,
onClickSet: () -> Unit,
) {
Scaffold(
topBar = {
TopAppBar(
title = { Text(stringResource(id = R.string.folder_title)) },
colors = getAppTopAppBarColors(),
actions = {
LoadingIconButton(
contentDescription = stringResource(id = R.string.folder_reload_button),
isLoading = isLoading,
onClick = onClickReload,
)
},
navigationIcon = {
IconButton(onClick = onClickBack) {
Icon(painter = painterResource(id = R.drawable.ic_back), contentDescription = "")
}
},
)
},
snackbarHost = { AppSnackbarHost(snackbarHostState) }
) { paddingValues ->
Column(
modifier = Modifier
.fillMaxHeight()
.padding(paddingValues)
) {
Box(
modifier = Modifier.weight(weight = 1f, fill = true)
) {
androidx.compose.animation.AnimatedVisibility(
visible = !isLoading,
enter = fadeIn(),
exit = fadeOut(),
) {
LazyColumn {
if (!currentUri.isRoot) {
item {
UpFolderItem(
onClick = onClickUp
)
DividerThin()
}
}
items(items = fileList) { file ->
FolderItem(
cifsFile = file,
onClick = { onClickItem(file) },
)
DividerThin()
}
}
}
}
DividerNormal()
Column(
modifier = Modifier
.padding(Theme.SizeS),
) {
Text(
text = currentUri.toString(),
maxLines = 1,
modifier = Modifier
.horizontalScroll(ScrollState(Int.MAX_VALUE))
)
Button(
onClick = onClickSet,
shape = RoundedCornerShape(Theme.SizeSS),
modifier = Modifier
.fillMaxWidth()
.padding(top = Theme.SizeS)
) {
Text(text = stringResource(id = R.string.folder_set))
}
}
}
}
}
@Composable
private fun UpFolderItem(
onClick: () -> Unit,
) {
Row(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = Theme.SizeS, vertical = Theme.SizeSS)
.clickable(enabled = true, onClick = onClick)
) {
Icon(
painter = painterResource(id = R.drawable.ic_folder_up),
"Folder",
modifier = Modifier.size(40.dp),
)
Text(
text = "..",
fontSize = 15.sp,
modifier = Modifier
.padding(start = Theme.SizeS)
)
}
}
@Composable
private fun FolderItem(
cifsFile: CifsFile,
onClick: () -> Unit,
) {
Row(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = Theme.SizeS, vertical = Theme.SizeSS)
.clickable(enabled = true, onClick = onClick)
) {
Icon(
painter = painterResource(id = R.drawable.ic_folder),
"Folder",
modifier = Modifier.size(40.dp),
)
Text(
text = cifsFile.name,
fontSize = 15.sp,
modifier = Modifier
.padding(start = Theme.SizeS)
)
}
}
/**
* Preview
*/
@Preview(
name = "Preview",
group = "Group",
uiMode = Configuration.UI_MODE_NIGHT_YES,
showBackground = true,
)
@Composable
private fun FolderScreenContainerPreview() {
Theme.AppTheme {
FolderScreenContainer(
snackbarHostState = SnackbarHostState(),
fileList = listOf(
CifsFile(
name = "example1.txt",
uri = Uri.parse("smb://example/"),
size = 128,
lastModified = 0,
isDirectory = true,
),
CifsFile(
name = "example2example2example2example2example2example2.txt",
uri = Uri.parse("smb://example/"),
size = 128,
lastModified = 0,
isDirectory = true,
),
CifsFile(
name = "example3example3example3example3example3example3example3example3example3example3.txt",
uri = Uri.parse("smb://example/"),
size = 128,
lastModified = 0,
isDirectory = true,
)
),
currentUri = Uri.EMPTY,
isLoading = false,
onClickBack = {},
onClickReload = {},
onClickItem = {},
onClickUp = {},
onClickSet = {},
)
}
}
| 28 | Kotlin | 17 | 149 | 49d75182e040ecb11fc76d297e6e45155f1e5716 | 10,325 | cifs-documents-provider | MIT License |
datasource/src/main/kotlin/gq/kirmanak/mealient/datasource/ServerUrlProvider.kt | kirmanak | 431,195,533 | false | {"Kotlin": 476781} | package gq.kirmanak.mealient.datasource
interface ServerUrlProvider {
suspend fun getUrl(): String?
} | 16 | Kotlin | 2 | 99 | 6f8a9520f3736ae641e4541d24afb0dcf9623ea0 | 107 | Mealient | MIT License |
src/main/java/com/silverhetch/clotho/file/SizeText.kt | fossabot | 268,971,219 | false | null | package com.silverhetch.clotho.file
import com.silverhetch.clotho.Source
import java.text.NumberFormat
import kotlin.Long.Companion.MAX_VALUE
/**
* Source to build size indicator string.
*/
class SizeText(private val sizeSrc: Source<Long>) : Source<String?> {
companion object {
private const val BYTES_TB = 1099511627776
private const val BYTES_GB = 1073741824
private const val BYTES_MB = 1048576
private const val BYTES_KB = 1024
}
override fun value(): String {
val format = NumberFormat.getInstance()
format.maximumFractionDigits = 1
return when (val count = sizeSrc.value()) {
in BYTES_KB until BYTES_MB -> {
format.format(count / BYTES_KB.toDouble()) + " KB"
}
in BYTES_MB until BYTES_GB -> {
format.format(count / BYTES_MB.toDouble()) + " MB"
}
in BYTES_GB until BYTES_TB -> {
format.format(count / BYTES_GB.toDouble()) + " GB"
}
in BYTES_TB until MAX_VALUE -> {
format.format(count / BYTES_TB.toDouble()) + " TB"
}
else -> {
"$count"
}
}
}
} | 1 | null | 1 | 1 | aeffa8e69ed87376e7ce1b792d5fe18b188a7e25 | 1,235 | Clotho | MIT License |
src/kz/seasky/tms/model/file/File.kt | task-management-system | 316,950,217 | false | null | package kz.seasky.tms.model.file
data class File(
val id: String,
val name: String,
val size: Int,
val path: String
) | 2 | Kotlin | 0 | 0 | 2b04062328d79ac2f77bece9ae7d660c06911ecd | 134 | backend | MIT License |
LoginService/src/main/kotlin/it/polito/loginservice/utils/JWTUtils.kt | tndevelop | 586,797,974 | false | null | package it.polito.loginservice.utils
import it.polito.loginservice.entities.User
import org.springframework.beans.factory.annotation.Value
import org.springframework.stereotype.Component
import java.util.*
import io.jsonwebtoken.Jwts
import io.jsonwebtoken.security.Keys
@Component
class JWTUtils {
@Value("\${key}")
lateinit var key: String
// @Value("\${exp}")\
private val jwtExpirationMs = 60 * 60 * 1000
fun generateJwtToken(user: User): String
{
val claims = Jwts.claims().setSubject(user.username)
claims["roles"] = arrayListOf(user.role.toString())
claims["authorities"] = arrayListOf(user.authority.toString())
return Jwts.builder()
.setClaims(claims)
.setIssuedAt(Date(System.currentTimeMillis()))
.setExpiration(Date(System.currentTimeMillis() + jwtExpirationMs)) //expTime in millisecs
.signWith(Keys.hmacShaKeyFor(key.toByteArray()))
.compact()
}
} | 0 | Kotlin | 1 | 0 | ebf7f88811287d89c98ff2f9e076c7fcf2a294b3 | 1,006 | Spring-PublicTransportSystem | MIT License |
src/me/anno/io/binary/BinaryTypes.kt | AntonioNoack | 456,513,348 | false | {"Kotlin": 10736182, "C": 236426, "Java": 6754, "Lua": 4404, "C++": 3070, "GLSL": 2698} | package me.anno.io.binary
object BinaryTypes {
// objects
const val OBJECT_NULL = 0
const val OBJECT_IMPL = 1
const val OBJECT_ARRAY = 2
const val OBJECT_ARRAY_2D = 3
const val OBJECTS_HOMOGENOUS_ARRAY = 4
const val OBJECT_LIST_UNKNOWN_LENGTH = 5
const val OBJECT_PTR = 6
// all other types have been moved to SimpleType.scalarId + 0/1/2 for their scalars/arrays/2d-arrays
} | 0 | Kotlin | 3 | 24 | 63377c2e684adf187a31af0f4e5dd0bfde1d050e | 411 | RemsEngine | Apache License 2.0 |
shared/src/commonMain/kotlin/io/ktlab/bshelper/ui/screens/home/bsmap/MapCardList.kt | ktKongTong | 694,984,299 | false | {"Kotlin": 836649, "Shell": 71} | package io.ktlab.bshelper.ui.screens.home.bsmap
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.material3.Surface
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import io.ktlab.bshelper.model.IMap
import io.ktlab.bshelper.model.enums.getSortKeyComparator
import io.ktlab.bshelper.ui.LocalUIEventHandler
import io.ktlab.bshelper.ui.components.EmptyContent
import io.ktlab.bshelper.ui.viewmodel.MapListState
@OptIn(ExperimentalFoundationApi::class)
@Composable
fun MapCardList(
modifier: Modifier = Modifier,
contentPadding: PaddingValues = PaddingValues(0.dp),
mapListState: MapListState,
mapList: List<IMap>,
stickyHeader: @Composable () -> Unit = {},
) {
val onUIEvent = LocalUIEventHandler.current
val state = rememberLazyListState()
val mapMultiSelected = mapListState.multiSelectedMapHashMap
val mapMultiSelectedMode = mapListState.isMapMultiSelectMode
val sortRule = mapListState.sortRule
// val context = LocalContext.current
LazyColumn(
modifier = modifier.fillMaxHeight(),
contentPadding = contentPadding,
state = state,
) {
stickyHeader {
Surface(Modifier.fillParentMaxWidth()) {
stickyHeader()
}
}
// mapListFilter
val mapListFiltered = mapList.filter { true }
val mapListSorted = mapListFiltered.sortedWith(sortRule.getSortKeyComparator())
if (mapListSorted.isNotEmpty()) {
items(mapListSorted.size) {
val map = mapListSorted[it]
MapCard(
map = map,
checked = mapMultiSelected.containsKey(map.getID()),
multiSelectedMode = mapMultiSelectedMode,
onUIEvent = onUIEvent,
modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp),
)
}
} else {
item {
EmptyContent(Modifier.padding(top = 32.dp))
}
}
}
}
| 5 | Kotlin | 0 | 0 | ab6de84e97bcf933d034ca18788170d4ae486341 | 2,392 | cm-bs-helper | MIT License |
data/src/main/java/com/almarai/data/easy_pick_models/adapters/JsonParsingGroupAdapter.kt | mohammed-uzair | 265,682,614 | false | null | package com.almarai.data.easy_pick_models.adapters
import com.almarai.data.easy_pick_models.Group
import com.squareup.moshi.FromJson
import com.squareup.moshi.ToJson
class JsonParsingGroupAdapter {
@ToJson
fun toJson(group: Group) = group.toString()
@FromJson
fun fromJson(group: String?): Group? {
if (group == null) return null
return when (group) {
"Bakery" -> Group.Bakery
"Poultry" -> Group.Poultry
"Dairy" -> Group.Dairy
"IPNC" -> Group.IPNC
"NonIPNC" -> Group.NonIPNC
"Customer" -> Group.Customer
else -> null
}
}
} | 0 | Kotlin | 0 | 0 | 347b7efc7e454e12fd629944a07db128de730cb3 | 654 | almarai-easy-pick | Apache License 2.0 |
data/src/main/java/com/almarai/data/easy_pick_models/adapters/JsonParsingGroupAdapter.kt | mohammed-uzair | 265,682,614 | false | null | package com.almarai.data.easy_pick_models.adapters
import com.almarai.data.easy_pick_models.Group
import com.squareup.moshi.FromJson
import com.squareup.moshi.ToJson
class JsonParsingGroupAdapter {
@ToJson
fun toJson(group: Group) = group.toString()
@FromJson
fun fromJson(group: String?): Group? {
if (group == null) return null
return when (group) {
"Bakery" -> Group.Bakery
"Poultry" -> Group.Poultry
"Dairy" -> Group.Dairy
"IPNC" -> Group.IPNC
"NonIPNC" -> Group.NonIPNC
"Customer" -> Group.Customer
else -> null
}
}
} | 0 | Kotlin | 0 | 0 | 347b7efc7e454e12fd629944a07db128de730cb3 | 654 | almarai-easy-pick | Apache License 2.0 |
core/js/src/JSJodaExceptions.kt | Kotlin | 215,849,579 | false | {"Kotlin": 499488, "C++": 66432, "C": 1638, "Java": 199} | /*
* Copyright 2019-2020 JetBrains s.r.o.
* Use of this source code is governed by the Apache 2.0 License that can be found in the LICENSE.txt file.
*/
package kotlinx.datetime
internal fun Throwable.isJodaArithmeticException(): Boolean = this.asDynamic().name == "ArithmeticException"
internal fun Throwable.isJodaDateTimeException(): Boolean = this.asDynamic().name == "DateTimeException"
internal fun Throwable.isJodaDateTimeParseException(): Boolean = this.asDynamic().name == "DateTimeParseException"
| 66 | Kotlin | 87 | 1,985 | 53ffd13bf80dfa35db3ca34ac5ae4234304169bb | 511 | kotlinx-datetime | Apache License 2.0 |
simple-app/app/src/main/java/com/sst/testapplication/Task.kt | joeltio | 409,246,319 | false | null | package com.sst.testapplication
data class Task(val name: String, val description: String)
| 0 | Kotlin | 0 | 0 | ebe3cd1dbcc93fb76e817da1f57c217596ba1db6 | 92 | simple-app | MIT License |
app/src/main/java/com/whl/mvvm/github/MainActivity.kt | honglei92 | 398,157,044 | false | null | package com.whl.mvvm.github
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
import com.whl.mvvm.R
import com.whl.mvvm.databinding.ActivityMain2Binding
import com.whl.mvvm.github.model.User
import com.whl.mvvm.github.viewmodel.UserViewModel
class MainActivity : AppCompatActivity() {
private var mUserViewModel: UserViewModel? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setSupportActionBar(findViewById(R.id.toolbar))
initView()
}
private fun initView() {
val activityMainBinding: ActivityMain2Binding =
DataBindingUtil.setContentView(this, R.layout.activity_main2)
mUserViewModel = ViewModelProvider(this).get(UserViewModel::class.java)
mUserViewModel!!.getUser().observe(this, object : Observer<User> {
override fun onChanged(user: User?) {
if (user != null) {
activityMainBinding.userViewModel = mUserViewModel
}
}
})
// mUserViewModel!!.refresh()
}
} | 0 | Kotlin | 0 | 1 | b8fdef077e64ced109c672f03d5c0fb2e22c10d2 | 1,229 | MVVM | Apache License 2.0 |
app/src/main/java/com/fivek/userapp/database/VehicleRepository.kt | gssureshkumar | 538,489,936 | false | {"Kotlin": 248895, "Java": 28477} | package com.fivek.userapp.database
import androidx.lifecycle.LiveData
class VehicleRepository(private val vehicleDao: VehicleDao) {
val allVehicles: LiveData<List<VehicleModel>> = vehicleDao.getAllVehicles()
val primaryVehicle: LiveData<VehicleModel> = vehicleDao.getPrimaryVehicle()
fun insert(vehicle: VehicleModel) {
if(allVehicles.value != null) {
for (model in allVehicles.value!!) {
model.isPrimary = false
vehicleDao.insert(model)
}
}
vehicle.isPrimary = true
vehicleDao.insert(vehicle)
}
fun insert(vehicle: List<VehicleModel>) {
vehicleDao.insert(vehicle)
}
fun delete(vehicleId: String){
vehicleDao.delete(vehicleId)
}
} | 0 | Kotlin | 0 | 0 | f88e15019631224e89b6d3c15c85debed95f64e0 | 784 | 5kcarcare | Apache License 2.0 |
src/models/student/StudentMeeting.kt | TPN-Labs | 587,419,240 | false | null | package com.progressp.models.student
import com.progressp.models.user.UsersTable
import org.jetbrains.exposed.dao.UUIDEntity
import org.jetbrains.exposed.dao.UUIDEntityClass
import org.jetbrains.exposed.dao.id.EntityID
import org.jetbrains.exposed.dao.id.UUIDTable
import org.jetbrains.exposed.sql.Column
import org.jetbrains.exposed.sql.ReferenceOption
import org.jetbrains.exposed.sql.javatime.datetime
import java.time.LocalDateTime
import java.util.UUID
object StudentsMeetingsTable : UUIDTable("students_meetings") {
val instructorId: Column<EntityID<UUID>> = reference(
"instructor_id", UsersTable, onDelete = ReferenceOption.CASCADE
)
val studentId: Column<EntityID<UUID>> = reference(
"student_id", StudentsTable, onDelete = ReferenceOption.CASCADE
)
val firstInMonth: Column<Boolean> = bool("first_in_month").default(false)
val startAt: Column<LocalDateTime> = datetime("start_at").default(LocalDateTime.now())
val endAt: Column<LocalDateTime> = datetime("end_at").default(LocalDateTime.now())
val updatedAt: Column<LocalDateTime> = datetime("updated_at").default(LocalDateTime.now())
val createdAt: Column<LocalDateTime> = datetime("created_at").default(LocalDateTime.now())
}
class StudentMeeting(id: EntityID<UUID>) : UUIDEntity(id) {
companion object : UUIDEntityClass<StudentMeeting>(StudentsMeetingsTable)
var instructorId by StudentsMeetingsTable.instructorId
var studentId by StudentsMeetingsTable.studentId
var startAt by StudentsMeetingsTable.startAt
var endAt by StudentsMeetingsTable.endAt
var firstInMonth by StudentsMeetingsTable.firstInMonth
var updatedAt by StudentsMeetingsTable.updatedAt
var createdAt by StudentsMeetingsTable.createdAt
data class New(
val id: String?,
val studentId: String,
val firstInMonth: Boolean,
val startAt: String,
val endAt: String,
)
data class Delete(
val id: String,
val studentId: String,
)
data class Response(
val id: String,
val studentId: String,
) {
companion object {
fun fromRow(row: StudentMeeting): Response = Response(
id = row.id.toString(),
studentId = row.studentId.toString(),
)
}
}
data class Page(
val id: String,
val student: Student.Response,
val startAt: LocalDateTime,
val endAt: LocalDateTime,
val firstInMonth: Boolean,
) {
companion object {
fun fromDbRow(row: StudentMeeting): Page {
val student = Student.findById(row.studentId)!!
return Page(
id = row.id.toString(),
student = Student.Response(
id = row.studentId.toString(),
fullName = student.fullName,
totalMeetings = student.totalMeetings,
gender = student.gender,
),
startAt = row.startAt,
endAt = row.endAt,
firstInMonth = row.firstInMonth
)
}
}
}
}
| 0 | Kotlin | 0 | 1 | 8e5be203444f08aa3c7ce066ffebd93d4dc71ec5 | 3,210 | ProgressPro-API | Apache License 2.0 |
app/src/main/java/com/marin/fireexpense/LoginActivity.kt | emarifer | 307,340,374 | false | null | package com.marin.fireexpense
import android.content.Intent
import android.os.Bundle
import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
import com.marin.fireexpense.data.LoginDataSource
import com.marin.fireexpense.data.model.LoginCredentials
import com.marin.fireexpense.databinding.ActivityLoginBinding
import com.marin.fireexpense.domain.LoginRepoImpl
import com.marin.fireexpense.presentation.LoginViewModel
import com.marin.fireexpense.presentation.LoginViewModelFactory
import com.marin.fireexpense.utils.savePassword
import com.marin.fireexpense.utils.showToast
import com.marin.fireexpense.utils.updateLoginScreen
class LoginActivity : AppCompatActivity() {
private val viewModel by viewModels<LoginViewModel> {
LoginViewModelFactory(LoginRepoImpl(LoginDataSource()))
}
private val binding: ActivityLoginBinding by lazy { ActivityLoginBinding.inflate(layoutInflater) }
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(binding.root)
updateLoginScreen(viewModel.getLoginResult, binding.progressBar)
binding.apply {
btnLogin.setOnClickListener { userLogin() }
txtRegister.setOnClickListener {
val intent = Intent(this@LoginActivity, RegisterActivity::class.java)
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_NEW_TASK)
startActivity(intent)
}
}
}
private fun userLogin() {
binding.apply {
val email = editTextTextEmailAddress.text.toString()
val password = editTextTextPassword.text.toString()
if (email.isNotBlank() && password.length == 16) {
savePassword(password)
viewModel.setLoginCredentials(LoginCredentials(email, password))
} else {
showToast("No has ingresado email o la contraseña tiene menos de 16 caracteres")
}
editTextTextEmailAddress.text.clear()
editTextTextPassword.text.clear()
editTextTextEmailAddress.requestFocus()
}
}
}
| 0 | Kotlin | 0 | 0 | e553ee54d9d2a98b8b2d9a65363b6025522d8dc4 | 2,189 | FireExpense | MIT License |
app/src/main/java/divyansh/tech/animeclassroom/common/data/PlayerModel.kt | justdvnsh | 361,118,759 | false | {"Kotlin": 197005} | package divyansh.tech.animeclassroom.common.data
data class PlayerScreenModel(
val animeName: String,
val streamingUrl: String,
val mirrorLinks: ArrayList<String>? = null,
val nextEpisodeUrl: String? = null,
val previousEpisodeUrl: String? = null
) | 47 | Kotlin | 32 | 95 | 53aa9258daa16022cad3b3dd961ceb60be01e67e | 269 | AnimeClassroom | MIT License |
androidApp/src/main/java/com/tomczyn/linkding/android/ui/common/LinkdingNavHost.kt | tomczyn | 599,241,128 | false | null | package com.tomczyn.linkding.android.ui.common
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.navigation.NavHostController
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.rememberNavController
import com.tomczyn.linkding.android.ui.login.loginGraph
import com.tomczyn.linkding.android.ui.login.loginRoute
@Composable
fun LinkdingNavHost(
modifier: Modifier = Modifier,
navController: NavHostController = rememberNavController()
) {
NavHost(
modifier = modifier,
navController = navController,
startDestination = loginRoute,
) {
loginGraph()
}
}
| 0 | Kotlin | 0 | 0 | 3b7ae5ade9e96c8bb357a5b4ea5af251c302daf3 | 678 | linkding-mobile | MIT License |
app/src/main/java/com/lodz/android/agiledevkt/modules/mvvm/abs/MvvmTestAbsActivity.kt | LZ9 | 137,967,291 | false | {"Kotlin": 2174504} | package com.lodz.android.agiledevkt.modules.mvvm.abs
import android.content.Context
import android.content.Intent
import android.view.View
import com.lodz.android.agiledevkt.databinding.ActivityMvvmTestBinding
import com.lodz.android.pandora.mvvm.base.activity.AbsVmActivity
import com.lodz.android.pandora.mvvm.vm.AbsViewModel
import com.lodz.android.pandora.utils.viewbinding.bindingLayout
import com.lodz.android.pandora.utils.viewmodel.bindViewModel
/**
* MVVM基础Activity
* @author zhouL
* @date 2019/12/3
*/
class MvvmTestAbsActivity : AbsVmActivity() {
companion object {
fun start(context: Context) {
val intent = Intent(context, MvvmTestAbsActivity::class.java)
context.startActivity(intent)
}
}
private val mViewModel by bindViewModel { MvvmTestAbsViewModel() }
override fun getViewModel(): AbsViewModel = mViewModel
private val mBinding: ActivityMvvmTestBinding by bindingLayout(ActivityMvvmTestBinding::inflate)
override fun getAbsViewBindingLayout(): View = mBinding.root
override fun setListeners() {
super.setListeners()
// 获取成功数据按钮
mBinding.getSuccessReusltBtn.setOnClickListener {
mViewModel.getResult(getContext(), true)
}
// 获取失败数据按钮
mBinding.getFailReusltBtn.setOnClickListener {
mViewModel.getResult(getContext(), false)
}
}
override fun setViewModelObserves() {
super.setViewModelObserves()
mViewModel.mResultText.observe(this) {
mBinding.resultTv.text = it
}
}
} | 0 | Kotlin | 3 | 11 | adc8471785a694ac7b49565465419f8f3b0664f3 | 1,594 | AgileDevKt | Apache License 2.0 |
app/src/main/java/org/fossasia/susi/ai/settings/ChatSettingsFragment.kt | mayank408 | 70,403,772 | true | {"Kotlin": 162802, "Java": 139210, "Shell": 685} | package org.fossasia.susi.ai.settings
import android.content.ComponentName
import android.content.Intent
import android.net.Uri
import android.os.Bundle
import android.support.v7.preference.ListPreference
import android.support.v7.preference.Preference
import android.support.v7.preference.PreferenceFragmentCompat
import org.fossasia.susi.ai.R
import org.fossasia.susi.ai.data.UtilModel
import org.fossasia.susi.ai.helper.Constant
import org.fossasia.susi.ai.settings.contract.ISettingsPresenter
/**
* The Fragment for Settings Activity
*
* Created by mayanktripathi on 10/07/17.
*/
class ChatSettingsFragment : PreferenceFragmentCompat() {
var settingsPresenter: ISettingsPresenter? = null
var textToSpeech: Preference? = null
var rate: Preference? = null
var server: Preference? = null
var micSettings: Preference? = null
var theme: ListPreference? = null
var hotwordSettings: Preference? = null
var settingActivity: SettingsActivity? = null
var utilModel: UtilModel?= null
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
addPreferencesFromResource(R.xml.pref_settings)
settingsPresenter = SettingsPresenter(activity)
utilModel = UtilModel(activity)
(settingsPresenter as SettingsPresenter).onAttach(this)
textToSpeech = preferenceManager.findPreference(Constant.LANG_SELECT)
rate = preferenceManager.findPreference(Constant.RATE)
server = preferenceManager.findPreference(Constant.SELECT_SERVER)
theme = preferenceManager.findPreference(Constant.THEME_KEY) as ListPreference
micSettings = preferenceManager.findPreference(Constant.MIC_INPUT)
hotwordSettings = preferenceManager.findPreference(Constant.HOTWORD_DETECTION)
settingActivity = SettingsActivity()
if (theme?.value == null)
theme?.setValueIndex(1)
if (theme?.entry != null)
theme?.summary = theme?.entry.toString()
textToSpeech?.setOnPreferenceClickListener {
val intent = Intent()
intent.component = ComponentName("com.android.settings", "com.android.settings.Settings\$TextToSpeechSettingsActivity")
startActivity(intent)
true
}
rate?.setOnPreferenceClickListener {
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/details?id=" + context.packageName)))
true
}
if(utilModel?.getAnonymity()!!){
server?.isEnabled = true
server?.setOnPreferenceClickListener {
settingActivity?.showAlert(activity)
true
}
}
else {
server?.isEnabled = false
}
theme?.setOnPreferenceChangeListener({ preference, newValue ->
preference.summary = newValue.toString()
settingsPresenter?.setTheme(newValue.toString())
activity.recreate()
true
})
micSettings?.isEnabled = settingsPresenter?.enableMic() as Boolean
hotwordSettings?.isEnabled = settingsPresenter?.enableHotword() as Boolean
}
override fun onDestroyView() {
super.onDestroyView()
settingsPresenter?.onDetach()
}
}
| 0 | Kotlin | 0 | 0 | 6012f43f76b915cd9ee6545c4a2869cf22c9b9c2 | 3,301 | susi_android | Apache License 2.0 |
app/src/main/java/com/github/llmaximll/todoapp/presentation/details/viewmodel/UpdateState.kt | llMaximll | 444,321,837 | false | {"Kotlin": 82412} | package com.github.llmaximll.todoapp.presentation.details.viewmodel
sealed class UpdateState {
object Initial : UpdateState()
object Loading : UpdateState()
sealed class InputError : UpdateState() {
sealed class Title : InputError() {
object Empty : Title()
object NotUnique : Title()
}
object Description : InputError()
}
object Error : UpdateState()
object Success : UpdateState()
}
| 1 | Kotlin | 1 | 8 | 63c3554a370f370d3494a4df7d514a5a8b9f9f58 | 466 | ToDoApp | MIT License |
rumascot-mappers-v2/src/commonMain/kotlin/MappersV2ToTransport.kt | mathemator | 586,045,497 | false | null | package ru.otus.otuskotlin.marketplace.mappers.v2
import ru.otus.otuskotlin.marketplace.api.v2.models.*
import ru.otus.otuskotlin.marketplace.common.ContextRum
import ru.otus.otuskotlin.marketplace.common.models.*
import ru.otus.otuskotlin.marketplace.mappers.v2.exceptions.UnknownCommandRum
fun ContextRum.toTransport(): IResponse = when (val cmd = command) {
CommandRum.CREATE -> toTransportCreate()
CommandRum.READ -> toTransportRead()
CommandRum.UPDATE -> toTransportUpdate()
CommandRum.DELETE -> toTransportDelete()
CommandRum.SEARCH -> toTransportSearch()
CommandRum.NONE -> throw UnknownCommandRum(cmd)
}
fun ContextRum.toTransportCreate() = AdCreateResponse(
requestId = this.requestId.asString().takeIf { it.isNotBlank() },
result = if (state == StateRum.RUNNING) ResponseResult.SUCCESS else ResponseResult.ERROR,
errors = errors.toTransportErrors(),
ad = adResponse.toTransport()
)
fun ContextRum.toTransportRead() = AdReadResponse(
requestId = this.requestId.asString().takeIf { it.isNotBlank() },
result = if (state == StateRum.RUNNING) ResponseResult.SUCCESS else ResponseResult.ERROR,
errors = errors.toTransportErrors(),
ad = adResponse.toTransport()
)
fun ContextRum.toTransportUpdate() = AdUpdateResponse(
requestId = this.requestId.asString().takeIf { it.isNotBlank() },
result = if (state == StateRum.RUNNING) ResponseResult.SUCCESS else ResponseResult.ERROR,
errors = errors.toTransportErrors(),
ad = adResponse.toTransport()
)
fun ContextRum.toTransportDelete() = AdDeleteResponse(
requestId = this.requestId.asString().takeIf { it.isNotBlank() },
result = if (state == StateRum.RUNNING) ResponseResult.SUCCESS else ResponseResult.ERROR,
errors = errors.toTransportErrors(),
ad = adResponse.toTransport()
)
fun ContextRum.toTransportSearch() = AdSearchResponse(
requestId = this.requestId.asString().takeIf { it.isNotBlank() },
result = if (state == StateRum.RUNNING) ResponseResult.SUCCESS else ResponseResult.ERROR,
errors = errors.toTransportErrors(),
ads = adsResponse.toTransportAds()
)
fun List<AdRum>.toTransportAds(): List<AdResponseObject>? = this
.map { it.toTransport() }
.toList()
.takeIf { it.isNotEmpty() }
private fun AdRum.toTransport(): AdResponseObject = AdResponseObject(
id = id.takeIf { it != AdIdRum.NONE }?.asString(),
title = title.takeIf { it.isNotBlank() },
description = description.takeIf { it.isNotBlank() },
ownerId = ownerId?.asLong(),
dealSide = dealSide.toTransport(),
visibility = visibility.toTransport(),
permissions = permissionsClient.toTransport(),
tags = tags?.toTransport()
)
private fun Set<AdPermissionClientRum>.toTransport(): Set<AdPermissions>? = this
.map { it.toTransport() }
.toSet()
.takeIf { it.isNotEmpty() }
private fun AdPermissionClientRum.toTransport() = when (this) {
AdPermissionClientRum.READ -> AdPermissions.READ
AdPermissionClientRum.UPDATE -> AdPermissions.UPDATE
AdPermissionClientRum.DELETE -> AdPermissions.DELETE
}
private fun VisibilityRum.toTransport(): AdVisibility? = when (this) {
VisibilityRum.VISIBLE_PUBLIC -> AdVisibility.PUBLIC
VisibilityRum.VISIBLE_TO_GROUP -> AdVisibility.REGISTERED_ONLY
VisibilityRum.NONE -> null
}
private fun DealSideRum.toTransport(): DealSide? = when (this) {
DealSideRum.DEMAND -> DealSide.DEMAND
DealSideRum.PROPOSAL -> DealSide.PROPOSAL
DealSideRum.NONE -> null
}
private fun List<ErrorRum>.toTransportErrors(): List<Error>? = this
.map { it.toTransport() }
.toList()
.takeIf { it.isNotEmpty() }
private fun ErrorRum.toTransport() = Error(
code = code.takeIf { it.isNotBlank() },
field = field.takeIf { it.isNotBlank() },
message = message.takeIf { it.isNotBlank() },
)
private fun List<TagRum>.toTransport(): List<Tag>? = this
.map { it.toTransport() }
.toList()
.takeIf { it.isNotEmpty() }
private fun TagRum.toTransport() = Tag(
id = id,
name = name,
)
| 2 | Kotlin | 0 | 0 | 633640f3c74b3d5a352052bbce9fd6358881953a | 4,039 | goppeav-kotlin-2022-12 | Apache License 2.0 |
src/main/kotlin/de/bund/digitalservice/useid/tenant/RequestMetricsTenantTagProvider.kt | digitalservicebund | 475,364,510 | false | null | package de.bund.digitalservice.useid.tenant
import de.bund.digitalservice.useid.metrics.METRICS_TAG_NAME_TENANT_ID
import io.micrometer.common.KeyValue
import io.micrometer.common.KeyValues
import org.springframework.http.server.observation.DefaultServerRequestObservationConvention
import org.springframework.http.server.observation.ServerRequestObservationContext
import org.springframework.stereotype.Component
@Component
class RequestMetricsTenantTagProvider : DefaultServerRequestObservationConvention() {
override fun getLowCardinalityKeyValues(context: ServerRequestObservationContext): KeyValues {
return super.getLowCardinalityKeyValues(context).and(tenantIdTag(context))
}
private fun tenantIdTag(context: ServerRequestObservationContext): KeyValues {
val tenant: Tenant? = context.carrier.getAttribute(REQUEST_ATTR_TENANT) as Tenant?
tenant?.let {
return KeyValues.of(KeyValue.of(METRICS_TAG_NAME_TENANT_ID, tenant.id))
}
return KeyValues.empty()
}
}
| 0 | Kotlin | 1 | 6 | 2524d1377e3be2953942f40b36ce231963ddbda2 | 1,035 | useid-backend-service | MIT License |
src/main/kotlin/com/gildedrose/UpdatableItem.kt | darioscattolini | 537,179,340 | false | null | package com.gildedrose
abstract class UpdatableItem protected constructor(private val item: Item) {
val name: String
get() = item.name
val sellIn: Int
get() = item.sellIn
val quality: Int
get() = item.quality
protected val baseQualityVariation: Int
get() = if (item.sellIn < 0) -2 else -1
private val maxQuality = 50
private val minQuality = 0
private val positiveInfinity = Double.POSITIVE_INFINITY.toInt()
abstract fun updateQuality()
protected fun updateSellIn() {
item.sellIn--
}
protected fun modifyQualityBy(amount: Int) {
item.quality = when (quality + amount) {
in maxQuality..positiveInfinity -> maxQuality
in minQuality until maxQuality -> quality + amount
else -> minQuality
}
}
companion object {
fun fromItem(item: Item): UpdatableItem {
return when {
item.name.startsWith("Sulfuras", ignoreCase = true) -> Sulfuras(item)
item.name.startsWith("Conjured", ignoreCase = true) -> ConjuredItem(item)
item.name.startsWith("Backstage Passes", ignoreCase = true) -> BackstagePasses(item)
item.name.startsWith("Aged Brie", ignoreCase = true) -> AgedBrie(item)
else -> RegularItem(item)
}
}
}
} | 0 | Kotlin | 0 | 0 | 7f872b33b2004943c6421477650da5d62f67bbb7 | 1,375 | refactoring-kata_gilded-rose | MIT License |
src/main/kotlin/xyz/r2turntrue/ieact/internal/Events.kt | R2turnTrue | 507,906,832 | false | null | package minepy
import org.bukkit.Bukkit
import org.bukkit.event.*
import org.bukkit.plugin.EventExecutor
import org.bukkit.plugin.IllegalPluginAccessException
import org.bukkit.plugin.RegisteredListener
import org.bukkit.plugin.TimedRegisteredListener
import org.python.core.PyFunction
import xyz.minejs.minepy.plugin
import java.lang.reflect.InvocationTargetException
private val Class<out Event>.handlerList : HandlerList
get() {
val throwException = fun (): Nothing = throw IllegalPluginAccessException(
"Unable to find handler list for event ${name}. Static getHandlerList method required!"
)
val exceptionableHandlerList = fun Class<out Event>.() : HandlerList {
val method = getDeclaredMethod("getHandlerList").apply { isAccessible = true }
return method.invoke(null) as HandlerList
}
var nowClass : Class<out Event> = this
kotlin.runCatching { return nowClass.exceptionableHandlerList() }
while (true) {
kotlin.runCatching { return nowClass.exceptionableHandlerList() }
nowClass.superclass ?: throwException()
if (nowClass.superclass == Event::class.java) throwException()
nowClass = nowClass.superclass as Class<out Event>
}
}
class Events {
companion object {
@JvmStatic
fun <T : Event> unregisterListener(clazz: Class<T>, listener: Listener) {
clazz.handlerList.unregister(listener)
}
@JvmStatic
fun <T : Event> registerListener(clazz: Class<T>, priority: EventPriority, ignoreCancelled: Boolean, listener: PyFunction): Listener {
val listenerData = object : Listener {
@EventHandler
fun on(event : T) {
listener._jcall(arrayOf<Any>(event))
}
}
val executor = EventExecutor { l, event ->
runCatching {
if (!clazz.isAssignableFrom(event.javaClass)) {
return@EventExecutor
}
listenerData.javaClass.declaredMethods[0].invoke(l, event)
}.exceptionOrNull()?.let {
if (it is InvocationTargetException) throw EventException(it.cause)
throw EventException(it)
}
}
if (Bukkit.getServer().pluginManager.useTimings()) {
clazz.handlerList.register(
TimedRegisteredListener(
listenerData,
executor,
priority,
plugin,
ignoreCancelled
)
)
} else {
clazz.handlerList.register(
RegisteredListener(listenerData, executor, priority, plugin, ignoreCancelled)
)
}
return listenerData
}
}
} | 1 | null | 1 | 6 | a44ef3836898114dd62d6dff964e82fe351f62b5 | 2,989 | ieact | MIT License |
app/src/main/kotlin/com/kevlina/budgetplus/app/book/BookActivity.kt | kevinguitar | 517,537,183 | false | {"Kotlin": 686513} | package com.kevlina.budgetplus.app.book
import android.content.Intent
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.activity.viewModels
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import androidx.core.net.toUri
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.kevlina.budgetplus.app.book.ui.BookBinding
import com.kevlina.budgetplus.core.common.R
import com.kevlina.budgetplus.core.common.nav.APP_DEEPLINK
import com.kevlina.budgetplus.core.common.nav.NAV_SETTINGS_PATH
import com.kevlina.budgetplus.core.common.nav.consumeNavigation
import com.kevlina.budgetplus.core.data.AuthManager
import com.kevlina.budgetplus.core.data.BookRepo
import com.kevlina.budgetplus.core.theme.ThemeManager
import com.kevlina.budgetplus.core.ui.AppTheme
import com.kevlina.budgetplus.core.ui.SnackbarDuration
import com.kevlina.budgetplus.core.ui.SnackbarSender
import com.kevlina.budgetplus.core.utils.setStatusBarColor
import com.kevlina.budgetplus.feature.auth.AuthActivity
import com.kevlina.budgetplus.feature.welcome.WelcomeActivity
import com.kevlina.budgetplus.inapp.update.InAppUpdateManager
import com.kevlina.budgetplus.inapp.update.InAppUpdateState
import dagger.hilt.android.AndroidEntryPoint
import javax.inject.Inject
@AndroidEntryPoint
class BookActivity : ComponentActivity() {
@Inject lateinit var authManager: AuthManager
@Inject lateinit var bookRepo: BookRepo
@Inject lateinit var themeManager: ThemeManager
@Inject lateinit var inAppUpdateManager: InAppUpdateManager
@Inject lateinit var snackbarSender: SnackbarSender
private val viewModel by viewModels<BookViewModel>()
private var newIntent: Intent? by mutableStateOf(null)
override fun onCreate(savedInstanceState: Bundle?) {
// When the user open the settings from app preference.
if (intent.action == Intent.ACTION_APPLICATION_PREFERENCES) {
intent.data = "$APP_DEEPLINK/$NAV_SETTINGS_PATH".toUri()
}
enableEdgeToEdge()
setStatusBarColor(isLight = false)
super.onCreate(savedInstanceState)
viewModel.handleJoinIntent(intent)
val destination = when {
authManager.userState.value == null -> AuthActivity::class.java
bookRepo.currentBookId == null -> WelcomeActivity::class.java
else -> null
}
if (destination != null) {
startActivity(Intent(this, destination))
finish()
}
setContent {
val themeColors by themeManager.themeColors.collectAsStateWithLifecycle()
AppTheme(themeColors) {
BookBinding(
vm = viewModel,
newIntent = newIntent,
)
}
val appUpdateState by inAppUpdateManager.updateState.collectAsStateWithLifecycle()
LaunchedEffect(key1 = appUpdateState) {
if (appUpdateState is InAppUpdateState.Downloaded) {
snackbarSender.send(
message = R.string.app_update_downloaded,
actionLabel = R.string.cta_complete,
duration = SnackbarDuration.Long,
action = (appUpdateState as InAppUpdateState.Downloaded).complete
)
}
}
}
consumeNavigation(viewModel.navigation)
}
override fun onNewIntent(intent: Intent) {
super.onNewIntent(intent)
if (!viewModel.handleJoinIntent(intent)) {
newIntent = intent
}
}
override fun onResume() {
super.onResume()
viewModel.handleJoinRequest()
}
} | 1 | Kotlin | 0 | 9 | ba738370c0a04e5105c4907ac4aabeeb64cada1c | 3,929 | budgetplus-android | MIT License |
android/features/community/recipes/src/main/kotlin/io/chefbook/features/community/recipes/ui/screens/content/components/blocks/Toolbar.kt | mephistolie | 379,951,682 | false | {"Kotlin": 1334117, "Ruby": 16819, "Swift": 352} | package io.chefbook.features.community.recipes.ui.screens.content.components.blocks
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.animation.slideInVertically
import androidx.compose.animation.slideOutVertically
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.statusBarsPadding
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.Icon
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.res.vectorResource
import androidx.compose.ui.unit.dp
import coil.compose.AsyncImage
import coil.request.ImageRequest
import com.mephistolie.compost.modifiers.clippedBackground
import com.mephistolie.compost.modifiers.simpleClickable
import io.chefbook.core.android.R as coreR
import io.chefbook.core.android.compose.providers.theme.LocalTheme
import io.chefbook.design.components.buttons.DynamicButton
import io.chefbook.design.theme.dimens.ComponentSmallHeight
import io.chefbook.design.theme.dimens.DefaultIconSize
import io.chefbook.design.theme.dimens.ToolbarHeight
import io.chefbook.features.community.recipes.ui.mvi.CommunityRecipesScreenState
import io.chefbook.features.community.recipes.ui.mvi.DashboardState
import io.chefbook.libs.models.language.Language
import io.chefbook.ui.common.extensions.localizedName
import io.chefbook.design.R as designR
@Composable
internal fun Toolbar(
languages: List<Language>,
avatar: String?,
mode: CommunityRecipesScreenState.Mode,
tab: DashboardState.Tab,
isRecipesBlockExpanded: Boolean,
onBackClick: () -> Unit,
onLanguageClick: () -> Unit,
onProfileClick: () -> Unit,
modifier: Modifier = Modifier,
) {
val context = LocalContext.current
val resources = context.resources
val colors = LocalTheme.colors
val typography = LocalTheme.typography
Box(
modifier = modifier
.fillMaxWidth()
.clippedBackground(
colors.backgroundPrimary,
RoundedCornerShape(bottomStart = 20.dp, bottomEnd = 20.dp)
)
.statusBarsPadding()
.height(ToolbarHeight)
.padding(vertical = 8.dp, horizontal = 12.dp),
contentAlignment = Alignment.Center,
) {
Icon(
imageVector = ImageVector.vectorResource(designR.drawable.ic_arrow_left),
tint = colors.foregroundPrimary,
contentDescription = null,
modifier = Modifier
.align(Alignment.CenterStart)
.size(DefaultIconSize)
.simpleClickable(onClick = onBackClick),
)
AnimatedVisibility(
visible = !isRecipesBlockExpanded,
enter = fadeIn() + slideInVertically(),
exit = fadeOut() + slideOutVertically(),
) {
DynamicButton(
text = when {
languages.isEmpty() -> stringResource(coreR.string.common_general_all_languages)
languages.size == 1 -> "${languages[0].flag} ${languages[0].localizedName(resources)}"
else -> {
var flags = languages.take(5).fold("") { str, language -> str + language.flag }
if (languages.size > 5) flags += "..."
flags
}
},
cornerRadius = 12.dp,
textStyle = typography.headline1,
iconsSize = 16.dp,
rightIcon = ImageVector.vectorResource(designR.drawable.ic_arrow_down),
selectedForeground = colors.foregroundPrimary,
selectedBackground = Color.Transparent,
isSelected = true,
disableScaling = true,
modifier = Modifier.height(ComponentSmallHeight),
onClick = onLanguageClick,
debounceInterval = 1000L,
)
}
AnimatedVisibility(
visible = isRecipesBlockExpanded,
enter = fadeIn() + slideInVertically(initialOffsetY = { it / 2 }),
exit = fadeOut() + slideOutVertically(targetOffsetY = { it / 2 }),
) {
DynamicButton(
text =
when (mode) {
CommunityRecipesScreenState.Mode.FILTER -> stringResource(coreR.string.common_general_search)
CommunityRecipesScreenState.Mode.DASHBOARD -> when (tab) {
DashboardState.Tab.NEW -> stringResource(coreR.string.common_general_new)
DashboardState.Tab.VOTES -> stringResource(coreR.string.common_general_popular)
DashboardState.Tab.TOP -> stringResource(coreR.string.common_general_top)
DashboardState.Tab.FAST -> stringResource(coreR.string.common_general_fast)
}
},
cornerRadius = 12.dp,
textStyle = typography.headline1,
iconsSize = 16.dp,
selectedForeground = colors.foregroundPrimary,
selectedBackground = Color.Transparent,
isSelected = true,
disableScaling = true,
modifier = Modifier.height(ComponentSmallHeight),
onClick = {},
)
}
AsyncImage(
model = ImageRequest.Builder(context)
.data(avatar)
.crossfade(true)
.build(),
placeholder = painterResource(designR.drawable.ic_user_circle),
error = painterResource(designR.drawable.ic_user_circle),
contentDescription = null,
contentScale = ContentScale.Crop,
colorFilter = if (avatar.isNullOrBlank()) ColorFilter.tint(LocalTheme.colors.foregroundPrimary) else null,
modifier = Modifier
.align(Alignment.CenterEnd)
.size(28.dp)
.clip(CircleShape)
.simpleClickable(1000L, onProfileClick)
)
}
}
| 0 | Kotlin | 0 | 12 | ddaf82ee3142f30aee8920d226a8f07873cdcffe | 6,153 | chefbook-mobile | Apache License 2.0 |
compose-mds/src/main/java/ch/sbb/compose_mds/sbbicons/small/ArrowCircleSmall.kt | SchweizerischeBundesbahnen | 853,290,161 | false | {"Kotlin": 6728512} | package ch.sbb.compose_mds.sbbicons.small
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.PathFillType.Companion.EvenOdd
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.graphics.StrokeCap.Companion.Butt
import androidx.compose.ui.graphics.StrokeJoin.Companion.Miter
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp
import ch.sbb.compose_mds.sbbicons.SmallGroup
public val SmallGroup.ArrowCircleSmall: ImageVector
get() {
if (_arrowCircleSmall != null) {
return _arrowCircleSmall!!
}
_arrowCircleSmall = Builder(name = "ArrowCircleSmall", defaultWidth = 24.0.dp, defaultHeight
= 24.0.dp, viewportWidth = 24.0f, viewportHeight = 24.0f).apply {
path(fill = SolidColor(Color(0xFF000000)), stroke = null, strokeLineWidth = 0.0f,
strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = 4.0f,
pathFillType = EvenOdd) {
moveTo(5.0f, 12.0f)
curveToRelative(0.0f, -4.073f, 2.927f, -7.0f, 7.0f, -7.0f)
curveToRelative(2.906f, 0.0f, 5.585f, 1.68f, 6.744f, 4.0f)
horizontalLineTo(15.0f)
verticalLineToRelative(1.0f)
horizontalLineToRelative(5.0f)
verticalLineTo(5.0f)
horizontalLineToRelative(-1.0f)
verticalLineToRelative(2.504f)
curveTo(17.466f, 5.394f, 14.812f, 4.0f, 12.0f, 4.0f)
curveToRelative(-4.625f, 0.0f, -8.0f, 3.375f, -8.0f, 8.0f)
curveToRelative(0.0f, 4.626f, 3.375f, 8.0f, 8.0f, 8.0f)
curveToRelative(3.871f, 0.0f, 6.883f, -2.367f, 7.75f, -5.882f)
lineToRelative(-0.971f, -0.239f)
curveTo(18.027f, 16.93f, 15.429f, 19.0f, 12.0f, 19.0f)
curveToRelative(-4.073f, 0.0f, -7.0f, -2.925f, -7.0f, -7.0f)
}
}
.build()
return _arrowCircleSmall!!
}
private var _arrowCircleSmall: ImageVector? = null
| 0 | Kotlin | 0 | 1 | 090a66a40e1e5a44d4da6209659287a68cae835d | 2,214 | mds-android-compose | MIT License |
app/src/androidTest/java/app/ibiocd/appointment/profile/ProfileInstrumentedTest.kt | Adrian-REH | 729,094,240 | false | {"Kotlin": 802379} | package app.ibiocd.appointment.profile
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.test.*
import androidx.compose.ui.test.junit4.createAndroidComposeRule
import androidx.navigation.compose.ComposeNavigator
import androidx.navigation.testing.TestNavHostController
import androidx.test.ext.junit.runners.AndroidJUnit4
import app.ibiocd.appointment.auth.view.SessionActivity
import app.ibiocd.appointment.auth.view.SessionNavHost
import dagger.hilt.android.testing.HiltAndroidRule
import dagger.hilt.android.testing.HiltAndroidTest
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
@HiltAndroidTest
@RunWith(AndroidJUnit4::class)
class ProfileInstrumentedTest {
@get:Rule(order =1)
var hiltTestRule= HiltAndroidRule(this)
@get:Rule(order =2)
var composeTestRule= createAndroidComposeRule<SessionActivity>()
lateinit var navController: TestNavHostController
@Test
fun patient_LogIn_Error_User(){
val user="adrianherrera.r.egmail.com"
val pass="dexter"
composeTestRule.setContent {
navController = TestNavHostController(LocalContext.current)
navController.navigatorProvider.addNavigator(ComposeNavigator())
SessionNavHost(navController,"Beginning/?newText=","")
}
composeTestRule.onNodeWithText("Iniciar sesion").performClick()
composeTestRule.onNodeWithText("PACIENTE").performClick()
form(user,pass)
composeTestRule.onNodeWithTag("user_error_session").assertTextContains("Error: Ingrese un correo valido")
}
@Test
fun patient_LogIn(){
val user="[email protected]"
val pass="dexter"
composeTestRule.setContent {
navController = TestNavHostController(LocalContext.current)
navController.navigatorProvider.addNavigator(ComposeNavigator())
SessionNavHost(navController,"Beginning/?newText=","")
}
composeTestRule.onNodeWithText("Iniciar sesion").performClick()
composeTestRule.onNodeWithText("PACIENTE").performClick()
form(user,pass)
}
fun form(user:String, pass:String){
composeTestRule.onNodeWithTag("user_session").performTextInput(user)
composeTestRule.onNodeWithTag("user_session").assertTextContains(user)
composeTestRule.onNodeWithTag("pass_session").performTextInput(pass)
composeTestRule.onNodeWithContentDescription("Ocultar contraseña").performClick()
composeTestRule.onNodeWithTag("pass_session").assertTextContains(pass)
composeTestRule.onNodeWithText("Continuar").performClick()
}
} | 0 | Kotlin | 0 | 0 | b661e81d83a8b670cd4d7295bf6ffb6a26d2938c | 2,687 | appointment_android | Apache License 2.0 |
shared/src/commonMain/kotlin/com/rld/justlisten/datalayer/datacalls/settings/SettingsCalls.kt | RLD-JL | 495,044,961 | false | {"Kotlin": 301525, "Swift": 344} | package com.rld.justlisten.datalayer.datacalls.settings
import com.rld.justlisten.datalayer.Repository
import com.rld.justlisten.datalayer.localdb.settingsscreen.SettingsInfo
import com.rld.justlisten.datalayer.localdb.settingsscreen.getSettingsInfo
import com.rld.justlisten.datalayer.localdb.settingsscreen.saveSettingsInfo
fun Repository.saveSettingsInfo(hasNavigationDonationOn: Boolean, isDarkThemeOn: Boolean, palletColor: String) {
localDb.saveSettingsInfo(hasNavigationDonationOn, isDarkThemeOn, palletColor)
}
fun Repository.getSettingsInfo() : SettingsInfo {
return localDb.getSettingsInfo()
} | 3 | Kotlin | 3 | 82 | f1d4281c534563d4660c40cb0b9e83435146a4d4 | 614 | Just-Listen | Apache License 2.0 |
app/src/main/java/com/github/skytoph/simpleweather/data/weather/cloud/model/HourlyForecastCloud.kt | skytoph | 482,520,275 | false | {"Kotlin": 386525} | package com.github.skytoph.simpleweather.data.weather.cloud.model
import com.github.skytoph.simpleweather.core.Mappable
import com.github.skytoph.simpleweather.core.MappableTo
import com.github.skytoph.simpleweather.data.weather.mapper.content.forecast.HourlyForecastDataMapper
import com.github.skytoph.simpleweather.data.weather.model.content.forecast.HourlyForecastData
import com.squareup.moshi.Json
/*
"dt": 1664089200,
"temp": 286.3,
"feels_like": 285.58,
"pressure": 1010,
"humidity": 73,
"dew_point": 281.57,
"uvi": 0.78,
"clouds": 100,
"visibility": 10000,
"wind_speed": 7.23,
"wind_deg": 231,
"wind_gust": 9.22,
"weather": [
{
"id": 804,
"main": "Clouds",
"description": "overcast clouds",
"icon": "04d"
}
],
"pop": 0.64
*/
data class HourlyForecastCloud(
@Json(name = "dt")
private val dt: Long,
@Json(name = "temp")
private val temp: Double,
@Json(name = "weather")
private val weather: List<WeatherTypeCloud>?,
@Json(name = "pop")
private val pop: Double,
@Json(name = "uvi")
private val uvi: Double,
) : Mappable<HourlyForecastData, HourlyForecastDataMapper>, MappableTo<Double> {
override fun map(mapper: HourlyForecastDataMapper): HourlyForecastData =
mapper.map(dt, temp, weather?.firstOrNull()?.map() ?: 0, pop, uvi)
override fun map(): Double = pop
} | 0 | Kotlin | 0 | 0 | 5629e9b11861dc3866510a366a1ba3cc95075fc9 | 1,355 | SimpleWeather | MIT License |
shark/shark/src/main/java/shark/OnAnalysisProgressListener.kt | square | 34,824,499 | false | null | package shark
import java.util.Locale
/**
* Reports progress from the [HeapAnalyzer] as they occur, as [Step] values.
*/
fun interface OnAnalysisProgressListener {
// These steps are defined in the order in which they occur.
enum class Step {
PARSING_HEAP_DUMP,
EXTRACTING_METADATA,
FINDING_RETAINED_OBJECTS,
FINDING_PATHS_TO_RETAINED_OBJECTS,
FINDING_DOMINATORS,
INSPECTING_OBJECTS,
COMPUTING_NATIVE_RETAINED_SIZE,
COMPUTING_RETAINED_SIZE,
BUILDING_LEAK_TRACES,
REPORTING_HEAP_ANALYSIS;
val humanReadableName: String
init {
val lowercaseName = name.replace("_", " ")
.lowercase(Locale.US)
humanReadableName =
lowercaseName.substring(0, 1).uppercase(Locale.US) + lowercaseName.substring(1)
}
}
fun onAnalysisProgress(step: Step)
companion object {
/**
* A no-op [OnAnalysisProgressListener]
*/
val NO_OP = OnAnalysisProgressListener {}
}
}
| 81 | null | 3958 | 29,180 | 5738869542af44bdfd8224603eac7af82327b054 | 960 | leakcanary | Apache License 2.0 |
src/plugin/cli/src/jsMain/kotlin/community/flock/wirespec/plugin/utils/Environment.kt | flock-community | 506,356,849 | false | {"Kotlin": 498649, "Shell": 10737, "TypeScript": 5761, "Java": 2713, "Witcher Script": 2474, "Dockerfile": 597, "Makefile": 571, "JavaScript": 140} | package community.flock.wirespec.plugin.utils
import community.flock.wirespec.plugin.cli.js.process
actual fun getEnvVar(s: String) = process.env[s].unsafeCast<String?>()
| 19 | Kotlin | 1 | 14 | b1467a46052ee1d13b64bbe066c8de27decc2467 | 173 | wirespec | Apache License 2.0 |
common/src/commonMain/kotlin/com/artemchep/keyguard/feature/home/settings/component/SettingCheckPwnedPasswords.kt | AChep | 669,697,660 | false | {"Kotlin": 5155654, "HTML": 45314} | package com.artemchep.keyguard.feature.home.settings.component
import androidx.compose.material3.LocalMinimumInteractiveComponentEnforcement
import androidx.compose.material3.Switch
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import arrow.core.partially1
import com.artemchep.keyguard.common.io.launchIn
import com.artemchep.keyguard.common.usecase.GetCheckPwnedPasswords
import com.artemchep.keyguard.common.usecase.PutCheckPwnedPasswords
import com.artemchep.keyguard.common.usecase.WindowCoroutineScope
import com.artemchep.keyguard.ui.FlatItem
import kotlinx.coroutines.flow.map
import org.kodein.di.DirectDI
import org.kodein.di.instance
fun settingCheckPwnedPasswordsProvider(
directDI: DirectDI,
) = settingCheckPwnedPasswordsProvider(
getCheckPwnedPasswords = directDI.instance(),
putCheckPwnedPasswords = directDI.instance(),
windowCoroutineScope = directDI.instance(),
)
fun settingCheckPwnedPasswordsProvider(
getCheckPwnedPasswords: GetCheckPwnedPasswords,
putCheckPwnedPasswords: PutCheckPwnedPasswords,
windowCoroutineScope: WindowCoroutineScope,
): SettingComponent = getCheckPwnedPasswords().map { checkPwnedPasswords ->
val onCheckedChange = { shouldCheckPwnedPasswords: Boolean ->
putCheckPwnedPasswords(shouldCheckPwnedPasswords)
.launchIn(windowCoroutineScope)
Unit
}
SettingIi {
SettingCheckPwnedPasswords(
checked = checkPwnedPasswords,
onCheckedChange = onCheckedChange,
)
}
}
@Composable
private fun SettingCheckPwnedPasswords(
checked: Boolean,
onCheckedChange: ((Boolean) -> Unit)?,
) {
FlatItem(
trailing = {
CompositionLocalProvider(
LocalMinimumInteractiveComponentEnforcement provides false,
) {
Switch(
checked = checked,
enabled = onCheckedChange != null,
onCheckedChange = onCheckedChange,
)
}
},
title = {
Text("Check for vulnerable passwords")
},
text = {
val text = "Check saved passwords for recent security breaches."
Text(text)
},
onClick = onCheckedChange?.partially1(!checked),
)
}
| 43 | Kotlin | 23 | 564 | 15cbd50734fb9aedd228926b3c8cd66dae8ae0d7 | 2,387 | keyguard-app | Linux Kernel Variant of OpenIB.org license |
app/src/main/java/com/iyxan23/eplk/runner/adapters/TokensRecyclerViewAdapter.kt | Iyxan23 | 376,169,195 | false | null | package com.iyxan23.eplk.runner.adapters
import android.graphics.Color
import android.text.Spannable
import android.text.SpannableStringBuilder
import android.text.style.ForegroundColorSpan
import android.text.style.RelativeSizeSpan
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.RecyclerView
import com.iyxan23.eplk.runner.R
import com.iyxan23.eplk.Tokens
import com.iyxan23.eplk.lexer.models.Token
class TokensRecyclerViewAdapter(
private var tokens: ArrayList<Token>,
var code: String
) : RecyclerView.Adapter<TokensRecyclerViewAdapter.ViewHolder>() {
fun update(tokens: ArrayList<Token>) {
this.tokens = tokens
notifyDataSetChanged()
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) =
ViewHolder(
LayoutInflater
.from(parent.context)
.inflate(R.layout.token_item_rv, parent, false)
)
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val token = tokens[position]
holder.tokenName.text = token.token.name
if (token.token == Tokens.EOF) {
holder.codeHighlight.text = "EOF"
} else {
holder.codeHighlight.text =
cutText(
code,
token.startPosition.index,
token.endPosition.index,
ContextCompat.getColor(holder.itemView.context, R.color.material_on_background_emphasis_medium)
)
}
}
override fun getItemCount() = tokens.size
class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
val codeHighlight: TextView = itemView.findViewById(R.id.highlight_code)
val tokenName: TextView = itemView.findViewById(R.id.token_name)
}
private fun cutText(
text: String,
front: Int,
back: Int,
defaultColor: Int,
offsetFront: Int = 2,
offsetBack: Int = 2,
color: ForegroundColorSpan = ForegroundColorSpan(Color.parseColor("#ED7417")) // orange
): SpannableStringBuilder {
val defaultForeground = ForegroundColorSpan(defaultColor)
val result = SpannableStringBuilder()
val length = text.length
val offsetFrontPosition = if (front - offsetFront > 0) front - offsetFront else 0
val offsetBackPosition = if (back + offsetBack < length - 1) back + offsetBack else length - 1
result.append(text.substring(offsetFrontPosition, front), defaultForeground, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
result.setSpan(RelativeSizeSpan(.75f), 0, front - offsetFrontPosition, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
result.append(text.substring(front, back), color, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
result.append(text.substring(back, offsetBackPosition + 1), defaultForeground, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
if (offsetBackPosition != length - 1) result.setSpan(RelativeSizeSpan(.75f), offsetBackPosition - back + 1, result.length - 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
return result
}
} | 0 | Kotlin | 0 | 6 | 6c5bb8523e6dce5e56c1683e9381e7f3baf1447b | 3,244 | eplk | MIT License |
library/src/main/java/com/trendyol/showcase/showcase/ShowcaseLifecycleOwner.kt | bilgehankalkan | 191,935,274 | false | null | package com.trendyol.showcase.showcase
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleEventObserver
import androidx.lifecycle.LifecycleOwner
class ShowcaseLifecycleOwner(
private val lifecycle: Lifecycle,
private val controller: ShowcaseStateController,
) : LifecycleEventObserver {
init {
lifecycle.addObserver(this)
}
override fun onStateChanged(source: LifecycleOwner, event: Lifecycle.Event) {
if (source.lifecycle.currentState == Lifecycle.State.DESTROYED) {
onDestroy()
return
}
if (event == Lifecycle.Event.ON_STOP) {
onDestroy()
return
}
}
private fun onDestroy() {
lifecycle.removeObserver(this)
controller.onStateChanged(ShowcaseState.DESTROY)
}
} | 0 | Kotlin | 10 | 8 | fa998c9760e229d5b9378e7b511ae0a3e7528edb | 823 | showcase | Apache License 2.0 |
modsman-core/src/main/kotlin/modsman/util.kt | sargunv | 255,055,478 | false | null | package modsman
import kotlinx.coroutines.*
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.flow.flowViaChannel
import java.util.concurrent.ExecutorService
@FlowPreview
internal inline fun <A, B> Collection<A>.toFlow(crossinline transform: suspend (A) -> B) = flow {
forEach { a -> emit(transform(a)) }
}
@FlowPreview
internal inline fun <A, B> Collection<A>.parallelMapToResultFlow(
executor: ExecutorService,
crossinline transform: suspend (A) -> B
): Flow<Result<B>> {
return flowViaChannel { channel ->
val jobs = map { a ->
launch(executor.asCoroutineDispatcher()) {
try {
channel.send(Result.success(transform(a)))
} catch (e: Throwable) {
channel.send(Result.failure(e))
}
}
}
runBlocking { jobs.joinAll() }
channel.close()
}
}
internal suspend inline fun <T> io(noinline block: suspend CoroutineScope.() -> T): T {
return withContext(Dispatchers.IO, block)
}
| 10 | Kotlin | 7 | 30 | 2908ed8792e4f9ccabafff8903dd46b59a1d43a3 | 1,089 | modsman | Apache License 2.0 |
app/src/main/java/fr/smarquis/fcm/utils/Notifications.kt | SimonMarquis | 86,733,874 | false | {"Kotlin": 53048, "JavaScript": 23390, "HTML": 16729, "CSS": 1388} | package fr.smarquis.fcm.utils
import android.app.NotificationChannel
import android.app.NotificationManager
import android.app.PendingIntent.FLAG_IMMUTABLE
import android.app.PendingIntent.getActivity
import android.content.Context
import android.content.Intent
import android.os.Build.VERSION.SDK_INT
import android.os.Build.VERSION_CODES.M
import android.os.Build.VERSION_CODES.O
import android.provider.Settings
import androidx.annotation.RequiresApi
import androidx.core.app.NotificationCompat.Builder
import androidx.core.app.NotificationCompat.CATEGORY_MESSAGE
import androidx.core.app.NotificationCompat.DEFAULT_ALL
import androidx.core.app.NotificationCompat.PRIORITY_MAX
import androidx.core.content.ContextCompat
import androidx.core.content.getSystemService
import fr.smarquis.fcm.R
import fr.smarquis.fcm.data.model.Message
import fr.smarquis.fcm.view.ui.MainActivity
object Notifications {
@RequiresApi(api = O)
private fun createNotificationChannel(context: Context) {
val id = context.getString(R.string.notification_channel_id)
val name: CharSequence = context.getString(R.string.notification_channel_name)
val importance = NotificationManager.IMPORTANCE_HIGH
val channel = NotificationChannel(id, name, importance)
channel.enableLights(true)
channel.enableVibration(true)
channel.setShowBadge(true)
context.getSystemService<NotificationManager>()?.createNotificationChannel(channel)
}
private fun getNotificationBuilder(context: Context): Builder {
if (SDK_INT >= O) {
createNotificationChannel(context)
}
return Builder(context, context.getString(R.string.notification_channel_id))
.setColor(ContextCompat.getColor(context, R.color.colorPrimary))
.setContentIntent(getActivity(context, 0, Intent(context, MainActivity::class.java), if (SDK_INT >= M) FLAG_IMMUTABLE else 0))
.setLocalOnly(true)
.setAutoCancel(true)
.setDefaults(DEFAULT_ALL)
.setPriority(PRIORITY_MAX)
.setCategory(CATEGORY_MESSAGE)
}
fun show(context: Context, message: Message) {
val payload = message.payload ?: return
val notification = payload.configure(getNotificationBuilder(context).setSmallIcon(payload.icon())).build()
context.getSystemService<NotificationManager>()?.notify(message.messageId, payload.notificationId(), notification)
}
fun removeAll(context: Context) {
context.getSystemService<NotificationManager>()?.cancelAll()
}
@RequiresApi(O)
fun settingsIntent(context: Context) = Intent(Settings.ACTION_APP_NOTIFICATION_SETTINGS)
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK).putExtra(Settings.EXTRA_APP_PACKAGE, context.packageName)
.putExtra(Settings.EXTRA_CHANNEL_ID, context.getString(R.string.notification_channel_id))
}
| 2 | Kotlin | 72 | 405 | c26a33a5bb3fe7df41688f64e672fc5dc72941ed | 2,907 | FCM-toolbox | Apache License 2.0 |
feature-wallet-api/src/main/java/jp/co/soramitsu/wallet/api/presentation/model/AmountModel.kt | soramitsu | 278,060,397 | false | null | package jp.co.soramitsu.wallet.api.presentation.model
import androidx.annotation.StringRes
import java.math.BigDecimal
import java.math.BigInteger
import jp.co.soramitsu.common.utils.formatCrypto
import jp.co.soramitsu.common.utils.formatCryptoDetail
import jp.co.soramitsu.common.utils.formatFiat
import jp.co.soramitsu.common.utils.orZero
import jp.co.soramitsu.wallet.impl.domain.model.Asset
import jp.co.soramitsu.wallet.impl.domain.model.amountFromPlanks
data class AmountModel(
val amount: BigDecimal,
val token: String,
val fiat: String?,
@StringRes val titleResId: Int? = null
)
fun mapAmountToAmountModel(
amountInPlanks: BigInteger,
asset: Asset,
@StringRes titleResId: Int? = null
): AmountModel = mapAmountToAmountModel(
amount = asset.token.amountFromPlanks(amountInPlanks).orZero(),
asset = asset,
titleResId = titleResId
)
fun mapAmountToAmountModel(
amount: BigDecimal,
asset: Asset,
@StringRes titleResId: Int? = null,
useDetailCryptoFormat: Boolean = false
): AmountModel {
val token = asset.token
val fiatAmount = token.fiatAmount(amount)
val tokenAmount = if (useDetailCryptoFormat) {
amount.formatCryptoDetail(token.configuration.symbol)
} else {
amount.formatCrypto(token.configuration.symbol)
}
return AmountModel(
amount = amount,
token = tokenAmount,
fiat = fiatAmount?.formatFiat(token.fiatSymbol),
titleResId = titleResId
)
}
| 16 | null | 30 | 89 | 1de6dfa7c77d4960eca2d215df2bdcf71a2ef5f2 | 1,492 | fearless-Android | Apache License 2.0 |
data/src/main/java/ronybrosh/rocketlauncher/data/db/RocketLauncherDatabase.kt | ron-brosh | 412,615,944 | true | {"Kotlin": 88759} | package ronybrosh.rocketlauncher.data.db
import android.content.Context
import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase
import androidx.room.TypeConverters
import ronybrosh.rocketlauncher.data.db.dao.LaunchDao
import ronybrosh.rocketlauncher.data.db.dao.RocketDao
import ronybrosh.rocketlauncher.data.db.model.LaunchRow
import ronybrosh.rocketlauncher.data.db.model.RocketRow
import ronybrosh.rocketlauncher.data.db.utils.RocketConverters
@Database(entities = [RocketRow::class, LaunchRow::class], version = 3, exportSchema = false)
@TypeConverters(RocketConverters::class)
abstract class RocketLauncherDatabase : RoomDatabase() {
abstract fun getRocketDao(): RocketDao
abstract fun getLaunchDao(): LaunchDao
companion object {
private var instance: RocketLauncherDatabase? = null
@Synchronized
fun getInstance(context: Context): RocketLauncherDatabase {
if (instance == null) {
instance = Room.databaseBuilder(
context.applicationContext,
RocketLauncherDatabase::class.java, "rocketLauncher.db"
)
.fallbackToDestructiveMigration()
.build()
}
return instance as RocketLauncherDatabase
}
}
} | 0 | null | 0 | 0 | 43640b1aeea9812a1e75a9ade3b322705567682d | 1,332 | RocketLauncher | Apache License 2.0 |
app/src/main/java/io/locally/engagesdk/widgets/Widget.kt | locally-io | 166,338,169 | false | null | package io.locally.engagesdk.widgets
import android.content.Context
import android.content.Intent
import android.support.v7.app.AppCompatActivity
import io.locally.engagesdk.datamodels.campaign.CampaignContent
const val CAMPAIGN_CONTENT = "campaignContent"
typealias Widget = AppCompatActivity
interface WidgetFactory {
fun widget(context: Context, content: CampaignContent): Intent?
} | 0 | Kotlin | 0 | 0 | b30d1ef589a44a6da2ba0cdf7fcecac90d2ab7fa | 393 | android-engage-sdk | MIT License |
i18n4k-generator/src/test/files/generated_code/JVM/x/y/Coolo.kt | comahe-de | 340,499,429 | false | null | package x.y
import de.comahe.i18n4k.Locale
import de.comahe.i18n4k.messages.MessageBundle
import de.comahe.i18n4k.messages.providers.MessagesProvider
import de.comahe.i18n4k.strings.LocalizedString
import kotlin.Array
import kotlin.Int
import kotlin.String
import kotlin.jvm.JvmStatic
/**
* Massage constants for bundle 'Coolo'. Generated by i18n4k.
*/
public object Coolo : MessageBundle() {
/**
* do that!
*/
@JvmStatic
public val to_do_that: LocalizedString = getLocalizedString0(0)
/**
* do this!
*/
@JvmStatic
public val to_do_this: LocalizedString = getLocalizedString0(1)
init {
registerTranslation(Coolo_en)
registerTranslation(Coolo_de)
}
}
/**
* Translation of message bundle 'Coolo' for locale 'en'. Generated by i18n4k.
*/
private object Coolo_en : MessagesProvider {
@JvmStatic
private val _data: Array<String?> = arrayOf(
"do that!",
"do this!")
public override val locale: Locale = Locale("en")
public override val size: Int
get() = _data.size
public override fun `get`(index: Int): String? = _data[index]
}
/**
* Translation of message bundle 'Coolo' for locale 'de'. Generated by i18n4k.
*/
private object Coolo_de : MessagesProvider {
@JvmStatic
private val _data: Array<String?> = arrayOf(
"mach jenes!",
"mach das!!")
public override val locale: Locale = Locale("de")
public override val size: Int
get() = _data.size
public override fun `get`(index: Int): String? = _data[index]
}
| 2 | null | 6 | 48 | e9488cc7170db79f220d4c1bf343901229ff7b65 | 1,507 | i18n4k | Apache License 2.0 |
app/src/main/java/com/example/android_study/ui/viewSystem/view_post/view/KaTonShadowTextView.kt | RhythmCoderZZF | 281,057,053 | false | null | package com.example.android_study.ui.viewSystem.view_post.view
import android.content.Context
import android.graphics.Canvas
import android.graphics.Paint
import android.graphics.Typeface
import android.text.TextPaint
import android.util.AttributeSet
import android.view.ViewGroup
import android.widget.TextView
import com.example.android_study.R
/**
* Author:create by RhythmCoder
* Date:2021/6/9
* Description:
*/
class KaTonShadowTextView @JvmOverloads constructor(
context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
) : TextView(context, attrs, defStyleAttr) {
private var borderText: KaTonTextView? = null ///用于描边的TextView
init {
borderText = KaTonTextView(context, attrs)
init()
}
fun init() {
val tp1: TextPaint = borderText!!.paint
tp1.strokeWidth = 2f //设置描边宽度
tp1.isAntiAlias=true
tp1.style = Paint.Style.STROKE //对文字只描边
borderText!!.setTextColor(resources.getColor(R.color.white)) //设置描边颜色
borderText!!.gravity = gravity
}
override fun setLayoutParams(params: ViewGroup.LayoutParams?) {
super.setLayoutParams(params)
borderText!!.layoutParams = params
}
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
val tt: CharSequence = borderText!!.text
//两个TextView上的文字必须一致
if (tt != this.text) {
borderText!!.text = text
this.postInvalidate()
}
super.onMeasure(widthMeasureSpec, heightMeasureSpec)
borderText!!.measure(widthMeasureSpec, heightMeasureSpec)
}
override fun onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int) {
super.onLayout(changed, left, top, right, bottom)
borderText!!.layout(left, top, right, bottom)
}
override fun onDraw(canvas: Canvas?) {
borderText!!.draw(canvas)
super.onDraw(canvas)
}
//重写设置字体方法
override fun setTypeface(tf: Typeface?) {
val tf = Typeface.createFromAsset(context.assets, "katon.TTF")
super.setTypeface(tf)
}
} | 0 | Kotlin | 0 | 0 | b569adcacfdba5ea6b4c323454c3c5130a1b4763 | 2,103 | AndroidStudy | Apache License 2.0 |
lib/src/main/java/com/freshdigitable/yttt/feature/oauth/TwitchOauthViewModel.kt | akihito104 | 613,290,086 | false | {"Kotlin": 267594} | package com.freshdigitable.yttt
import androidx.lifecycle.LiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.liveData
import androidx.lifecycle.viewModelScope
import com.freshdigitable.yttt.data.AccountRepository
import com.freshdigitable.yttt.data.TwitchLiveRepository
import com.freshdigitable.yttt.data.TwitchOauthToken
import com.freshdigitable.yttt.data.model.TwitchUser
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.stateIn
import kotlinx.coroutines.launch
import javax.inject.Inject
@HiltViewModel
class TwitchOauthViewModel @Inject constructor(
private val twitchRepository: TwitchLiveRepository,
private val accountRepository: AccountRepository,
) : ViewModel() {
val hasTokenState: StateFlow<Boolean> = accountRepository.twitchToken
.map { it != null }
.distinctUntilChanged()
.stateIn(viewModelScope, SharingStarted.Lazily, false)
fun hasToken(): Boolean = accountRepository.getTwitchToken() != null
suspend fun getAuthorizeUrl(): String = twitchRepository.getAuthorizeUrl()
fun putToken(token: TwitchOauthToken) {
viewModelScope.launch {
accountRepository.putTwitchToken(token.accessToken)
}
}
fun getMe(): LiveData<TwitchUser> = liveData {
val user = twitchRepository.fetchMe() ?: throw IllegalStateException()
emit(user)
}
companion object {
@Suppress("unused")
private val TAG = TwitchOauthViewModel::class.simpleName
}
}
| 9 | Kotlin | 0 | 0 | b178376294885eee68acf29f678c9408d0bfb0ba | 1,701 | yttt | Apache License 2.0 |
app/src/main/java/com/thread0/weather/net/service/CarRestrictedService.kt | wuzelong | 384,625,570 | false | null | /*
* @Copyright: 2020-2021 www.thread0.com Inc. All rights reserved.
*/
package com.thread0.weather.net.service
import com.thread0.weather.data.model.*
import com.thread0.weather.net.WEATHER_PRIVATE_KEY
import retrofit2.http.GET
import retrofit2.http.Query
interface CarRestrictedService {
/**
* 机动车尾号限行
*/
@GET("/v3/life/driving_restriction.json")
suspend fun getCarRestricted(
@Query("key") key: String = WEATHER_PRIVATE_KEY,
@Query("location") location: String = "WKEZD7MXE04F"
): CarRestrictedServer?
} | 0 | Kotlin | 0 | 1 | 00f93f0c656d3734c4d3bb10c66ec94f6e030d7e | 552 | weather | Apache License 2.0 |
app/src/main/java/edu/rosehulman/crawfoaj/clubcalender/EventDetail.kt | crawfoaj2020 | 163,697,387 | false | null | package edu.rosehulman.crawfoaj.clubcalender
import android.app.Activity
import android.content.Intent
import android.os.Bundle
import android.support.v7.app.AppCompatActivity;
import android.util.Log
import android.view.Menu
import android.view.MenuItem
import android.widget.Toast
import com.google.firebase.auth.FirebaseAuth
import com.google.firebase.firestore.FirebaseFirestore
import edu.rosehulman.rosefire.Rosefire
import kotlinx.android.synthetic.main.activity_event_detail.*
import kotlinx.android.synthetic.main.content_event_detail.*
import java.util.*
class EventDetail : AppCompatActivity() {
var event = EventModelObject()
var day:Int? =null
var month:Int?=null
var year:Int?=null
var managedClubs: ArrayList<String>? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_event_detail)
setSupportActionBar(toolbar)
event = intent.getParcelableExtra(EventModelObject.KEY)
day = intent.getIntExtra(EventModelObject.DAY, 0)
month = intent.getIntExtra(EventModelObject.MONTH, 0)
year = intent.getIntExtra(EventModelObject.YEAR, 0)
if(intent.getStringArrayListExtra(User.KEY) != null){
managedClubs = intent.getStringArrayListExtra(User.KEY)
println("AAAAAAA got list $managedClubs")
}
setValues()
}
private fun setValues(){
ValueName.text = event.name
ValueDescription.text = event.description
ValueLocation.text = event.location
ValueTime.text = event.getTimeFormatted(false) //TODO figure out AM vs PM
ValueTimeEnd.text = event.getTimeFormatted(true)
if(day!=null && month != null && year != null){
val oneIndexedMonth = month!! +1
ValueDate.text = getString(R.string.Dateformat, oneIndexedMonth, day, year)
}else{
val oneIndexedMonth = event.month +1
ValueDate.text = getString(R.string.Dateformat, oneIndexedMonth, event.day, event.year)
}
ValueClub.text = event.club
}
override fun onCreateOptionsMenu(menu: Menu): Boolean {
// Inflate the menu; this adds items to the action bar if it is present.
menuInflater.inflate(R.menu.menu_edit_event, menu)
if(event.club !in managedClubs!!){
menu.findItem(R.id.action_edit_event).isVisible = false
}
return true
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
return when (item.itemId) {
R.id.action_edit_event -> {
//TODO add edit permission limitation
val intent = Intent(this,CreateEvent::class.java)
intent.putExtra(EventModelObject.KEY, event)
startActivityForResult(intent,EDIT_EVENT_REQUEST_CODE)
true
}
else -> super.onOptionsItemSelected(item)
}
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
val allEventsRef = FirebaseFirestore
.getInstance().collection(Constants.EVENTS_COLLECTION)
if (requestCode == EDIT_EVENT_REQUEST_CODE && resultCode == Activity.RESULT_OK) {
val newEvent = data!!.getParcelableExtra<EventModelObject>(CreateEvent.KEY_NEW_EVENT)
allEventsRef.document(event.id).set(newEvent)
val intent = Intent(this@EventDetail, EventSummary::class.java)
startActivity(intent)
}
}
companion object {
val EDIT_EVENT_REQUEST_CODE = 2
}
}
| 0 | Kotlin | 0 | 0 | 52f2c674f2c6a2c68fce489e40a3dc5f3e1577f5 | 3,827 | AndroidClubCalender | Apache License 2.0 |
app/src/main/java/io/github/fuadreza/pikul_dagger/repository/user/UserManager.kt | fuadreza | 275,099,096 | false | null | package io.github.fuadreza.pikul_dagger.repository.user
import com.google.firebase.auth.FirebaseAuth
import com.google.firebase.auth.FirebaseUser
import javax.inject.Inject
import javax.inject.Singleton
/**
* Dibuat dengan kerjakerasbagaiquda oleh Shifu pada tanggal 24/06/2020.
*
*/
@Singleton
class UserManager @Inject constructor(
private val userComponentFactory: UserComponent.Factory
) {
var userComponent: UserComponent? = null
private set
private val firebaseAuth = FirebaseAuth.getInstance()
var user: FirebaseUser? = firebaseAuth.currentUser
fun isUserLoggedIn(): Boolean {
return user != null
}
fun userJustLoggedIn() {
userComponent = userComponentFactory.create()
}
fun logoutUser(){
firebaseAuth.signOut()
user = null
userComponent = null
}
}
| 7 | Kotlin | 0 | 0 | fb87a113678454c4a390b93fc546873dfa2aaa9e | 859 | Pikul-dagger | MIT License |
src/main/kotlin/team/nk/kimiljeongserver/domain/post/domain/repository/CustomPostRepository.kt | team-nk | 513,313,744 | false | null | package team.nk.kimiljeongserver.domain.post.domain.repository
import team.nk.kimiljeongserver.domain.post.domain.repository.vo.PostVO
interface CustomPostRepository {
fun queryPost(): List<PostVO>
} | 2 | Kotlin | 1 | 16 | b7814ffdd99ddc844861746cdccde4553580b6db | 205 | kim-il-jeong-server | MIT License |
app/src/main/java/com/albertjsoft/portainerapp/data/api/ApiService.kt | AlbertJQarK | 147,027,536 | false | null | package com.albertjsoft.portainerapp.data.api
import com.albertjsoft.portainerapp.data.api.service.AuthService
import com.google.gson.FieldNamingPolicy
import com.google.gson.Gson
import com.google.gson.GsonBuilder
import okhttp3.OkHttpClient
import retrofit2.Retrofit
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory
import retrofit2.converter.gson.GsonConverterFactory
import java.util.concurrent.TimeUnit
private const val DEFAULT_TIMEOUT = 30
private var apiBaseUrl = "http://localhost:9000"
private var builder = Retrofit.Builder().baseUrl(apiBaseUrl)
internal fun provideAuthenticationService() = createService(AuthService::class.java)
fun <T> createService(service: Class<T>): T = provideRetrofit().create(service)
private fun provideRetrofit(): Retrofit = builder.build()
private fun provideOkHttpClient(): OkHttpClient =
OkHttpClient.Builder().apply {
connectTimeout(DEFAULT_TIMEOUT.toLong(), TimeUnit.SECONDS)
readTimeout(DEFAULT_TIMEOUT.toLong(), TimeUnit.SECONDS)
writeTimeout(DEFAULT_TIMEOUT.toLong(), TimeUnit.SECONDS)
}.build()
private fun provideGson(): Gson =
GsonBuilder().setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES).create()
fun changeApiBaseUrl(newApiBaseUrl: String) {
apiBaseUrl = newApiBaseUrl
builder = Retrofit.Builder()
.addConverterFactory(GsonConverterFactory.create())
.baseUrl("http:// $apiBaseUrl")
.addConverterFactory(GsonConverterFactory.create(provideGson()))
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.client(provideOkHttpClient())
} | 0 | Kotlin | 0 | 0 | acee979a2776eb34f447e9c697a35016da3957e0 | 1,643 | PortainerApp | Apache License 2.0 |
app/src/main/java/io/sensify/sensor/ui/resource/values/JlResShapes.kt | JunkieLabs | 488,675,241 | false | null | package io.sensify.sensor.ui.resource.values
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.Shapes
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
/**
* Created by Niraj on 05-08-2022.
*/
object JlResShapes {
object Common{
val shapes = Shapes(
small = RoundedCornerShape(8.dp),
medium = RoundedCornerShape(12.dp),
large = RoundedCornerShape(24.dp)
)
}
object Space{
val H4 = Modifier.height(JlResDimens.dp4)
val H18 = Modifier.height(JlResDimens.dp18)
val H20 = Modifier.height(JlResDimens.dp20)
val H24 = Modifier.height(JlResDimens.dp24)
val H28 = Modifier.height(JlResDimens.dp28)
val H32 = Modifier.height(JlResDimens.dp32)
val H48 = Modifier.height(JlResDimens.dp48)
val H56 = Modifier.height(JlResDimens.dp56)
val H64 = Modifier.height(JlResDimens.dp64)
val W18 = Modifier.width(JlResDimens.dp18)
val W20 = Modifier.width(JlResDimens.dp20)
val W24 = Modifier.width(JlResDimens.dp24)
val W28 = Modifier.width(JlResDimens.dp28)
val W32 = Modifier.width(JlResDimens.dp32)
}
} | 2 | null | 19 | 164 | d8b875f92100b63022ff7fa4360de5ba3d75dfdf | 1,386 | sensify-android | MIT License |
src/commonMain/kotlin/data/items/MoltenEarthKilt.kt | marisa-ashkandi | 332,658,265 | false | null | package `data`.items
import `data`.Constants
import `data`.buffs.Buffs
import `data`.model.Item
import `data`.model.ItemSet
import `data`.model.Socket
import `data`.model.SocketBonus
import character.Buff
import character.Stats
import kotlin.Array
import kotlin.Boolean
import kotlin.Double
import kotlin.Int
import kotlin.String
import kotlin.collections.List
import kotlin.js.JsExport
@JsExport
public class MoltenEarthKilt : Item() {
public override var isAutoGenerated: Boolean = true
public override var id: Int = 28266
public override var name: String = "Molten Earth Kilt"
public override var itemLevel: Int = 115
public override var quality: Int = 3
public override var icon: String = "inv_pants_plate_02.jpg"
public override var inventorySlot: Int = 7
public override var itemSet: ItemSet? = null
public override var itemClass: Constants.ItemClass? = Constants.ItemClass.ARMOR
public override var itemSubclass: Constants.ItemSubclass? = Constants.ItemSubclass.MAIL
public override var allowableClasses: Array<Constants.AllowableClass>? = null
public override var minDmg: Double = 0.0
public override var maxDmg: Double = 0.0
public override var speed: Double = 0.0
public override var stats: Stats = Stats(
stamina = 24,
intellect = 32,
armor = 570
)
public override var sockets: Array<Socket> = arrayOf()
public override var socketBonus: SocketBonus? = null
public override var phase: Int = 1
public override val buffs: List<Buff> by lazy {
listOfNotNull(
Buffs.byIdOrName(18056, "Increase Spell Dam 40", this),
Buffs.byIdOrName(21633, "Increased Mana Regen", this)
)}
}
| 21 | Kotlin | 11 | 25 | 9cb6a0e51a650b5d04c63883cb9bf3f64057ce73 | 1,696 | tbcsim | MIT License |
src/commonMain/kotlin/data/items/MoltenEarthKilt.kt | marisa-ashkandi | 332,658,265 | false | null | package `data`.items
import `data`.Constants
import `data`.buffs.Buffs
import `data`.model.Item
import `data`.model.ItemSet
import `data`.model.Socket
import `data`.model.SocketBonus
import character.Buff
import character.Stats
import kotlin.Array
import kotlin.Boolean
import kotlin.Double
import kotlin.Int
import kotlin.String
import kotlin.collections.List
import kotlin.js.JsExport
@JsExport
public class MoltenEarthKilt : Item() {
public override var isAutoGenerated: Boolean = true
public override var id: Int = 28266
public override var name: String = "Molten Earth Kilt"
public override var itemLevel: Int = 115
public override var quality: Int = 3
public override var icon: String = "inv_pants_plate_02.jpg"
public override var inventorySlot: Int = 7
public override var itemSet: ItemSet? = null
public override var itemClass: Constants.ItemClass? = Constants.ItemClass.ARMOR
public override var itemSubclass: Constants.ItemSubclass? = Constants.ItemSubclass.MAIL
public override var allowableClasses: Array<Constants.AllowableClass>? = null
public override var minDmg: Double = 0.0
public override var maxDmg: Double = 0.0
public override var speed: Double = 0.0
public override var stats: Stats = Stats(
stamina = 24,
intellect = 32,
armor = 570
)
public override var sockets: Array<Socket> = arrayOf()
public override var socketBonus: SocketBonus? = null
public override var phase: Int = 1
public override val buffs: List<Buff> by lazy {
listOfNotNull(
Buffs.byIdOrName(18056, "Increase Spell Dam 40", this),
Buffs.byIdOrName(21633, "Increased Mana Regen", this)
)}
}
| 21 | Kotlin | 11 | 25 | 9cb6a0e51a650b5d04c63883cb9bf3f64057ce73 | 1,696 | tbcsim | MIT License |
src/command/ArticlesCommand.kt | digithree | 332,478,224 | false | null | package co.simonkenny.web.command
import airtable.AirtableRequester
import airtable.LIMIT_MAX
import airtable.airtableDate
import co.simonkenny.web.DIV_CLASS
import co.simonkenny.web.airtable.*
import kotlinx.html.*
import java.lang.IllegalStateException
import java.net.URLEncoder
import java.text.SimpleDateFormat
import java.util.*
import kotlin.jvm.Throws
const val CMD_ARTICLES = "articles"
private val FLAG_LIMIT = FlagInfo("l", "limit")
private val FLAG_ORDER = FlagInfo("o", "order")
private val FLAG_DETAILS = FlagInfo("d", "details")
private val FLAG_COMMENTS = FlagInfo("c", "comments")
private val FLAG_GROUP = FlagInfo("g", "group")
private val FLAG_ROW = FlagInfo("r", "row")
private const val COMMENTS_ON = "on"
private const val COMMENTS_OFF = "off"
private const val ROW_ON = "on"
private const val ROW_OFF = "off"
private const val GROUP_NONE = "none"
private const val GROUP_YEAR_ADDED = "yearadd"
private const val GROUP_MONTH_ADDED = "monthadd"
private const val GROUP_YEAR_PUBLISHED = "yearpub"
private const val GROUP_MONTH_PUBLISHED = "monthpub"
private val GROUP_DATE_NONE = Calendar.getInstance().apply { set(1970, 1, 1) }.time
private val DATE_FORMAT_GROUP_YEAR = SimpleDateFormat("yyyy")
private val DATE_FORMAT_GROUP_MONTH = SimpleDateFormat("MMMMMMM yyyy")
class ArticlesCommand(
flags: List<FlagData>
): Command(flags) {
private enum class RenderSize {
LARGE, SMALL
}
override val name = CMD_ARTICLES
override val canBeOptionless = true
override val _registeredFlags = registeredFlags
companion object {
private val registeredFlags = listOf(
FLAG_HELP,
FLAG_LIMIT,
FLAG_ORDER,
FLAG_DETAILS,
FLAG_COMMENTS,
FLAG_GROUP,
FLAG_ROW
)
@Throws(IllegalStateException::class)
fun parse(params: List<String>): ArticlesCommand =
ArticlesCommand(params.extractFlagsRaw().createFlagDataList(registeredFlags))
}
override fun distinctKey(): String = name
override fun helpRender(block: HtmlBlockTag, config: ConfigCommand?) {
block.div(DIV_CLASS) {
pre(classes = "scroll") {
+"""usage: articles [options]
Options:
-h,--help shows this help, ignores other commands and flags
-l=<?>,--limit=<?> positive integer between 1 to $LIMIT_MAX, show number of
items up to limit
-o=<?>,--order=<?> order to show items in, default is newest-add,
one of: newestadd, newestpub
-c=<?>,--comments=<?> show comments for each media item, off by default
unless grouping, one of: on, off
-d,--details show more details for each media item
-g=<?>,--g=<?> grouping to apply, default is none,
one of: none, yearadd, yearpub,
monthadd, monthpub
-r=<?>,--row=<?> include ROW link, on by default,
one of: on, off
""".trimIndent()
}
}
}
override suspend fun render(block: HtmlBlockTag, config: ConfigCommand?) {
block.div(DIV_CLASS) { p { em {
+"Note: articles here are not endorsed, they are simply of some interest."
} } }
if (checkHelp(block, config)) return
val articlesRecord = AirtableRequester.getInstance().articles.fetch(
limit = getFlagOption(FLAG_LIMIT)?.toIntOrNull()?.takeIf { it > 0 } ?: LIMIT_MAX,
order = try {
getFlagOption(FLAG_ORDER)?.let { orderKey ->
ArticlesRecord.ORDERS.find { it.key == orderKey }
} ?: ArticlesRecord.Order.NEWEST_ADDED
} catch (e: Exception) {
e.printStackTrace()
ArticlesRecord.Order.NEWEST_ADDED
},
fieldMatchers = listOfNotNull(
if (config?.friendUnlocked != true) FieldMatcher("public", "1") else null
)
)
block.div(DIV_CLASS) {
articlesRecord.map { it.fields }.takeIf { it.isNotEmpty() }?.run {
when (val group = getFlagOption(FLAG_GROUP) ?: GROUP_NONE) {
GROUP_NONE -> forEach {
section(classes = "group") {
hr { }
renderItem(this, it, RenderSize.LARGE, config?.dark == true)
}
}
else -> groupBy {
(if (group == GROUP_MONTH_ADDED || group == GROUP_YEAR_ADDED) it.added else it.published)
?.takeIf { date -> date.isNotBlank() }?.airtableDate()?.let {
Calendar.getInstance().apply {
time = it
set(Calendar.DAY_OF_MONTH, 1)
if (group == GROUP_YEAR_ADDED || group == GROUP_YEAR_PUBLISHED) set(Calendar.MONTH, 1)
}.time
} ?: GROUP_DATE_NONE
}
.toSortedMap { o1, o2 -> o2.compareTo(o1) }
.forEach { (date, list) ->
div(classes = "terminal-card") {
header {
date.takeIf { it != GROUP_DATE_NONE }?.run {
when(group) {
GROUP_YEAR_ADDED, GROUP_YEAR_PUBLISHED -> DATE_FORMAT_GROUP_YEAR
else -> DATE_FORMAT_GROUP_MONTH
}.format(date).let { +it }
} ?: +"None"
}
div {
list.forEach {
section(classes = "group") {
renderItem(this, it, RenderSize.SMALL, config?.dark == true)
}
}
}
}
br { }
br { }
}
}
}
if (config?.friendUnlocked != true) {
p {
hr { }
em { +"Private access not enabled, use friend code for full content" }
}
}
}
}
private fun renderItem(block: HtmlBlockTag, articlesFields: ArticlesFields, renderSize: RenderSize, dark: Boolean) {
with(block) {
articlesFields.let {
p {
if (getFlagOption(FLAG_ROW) == null || getFlagOption(FLAG_ROW) == ROW_ON) {
a(
href = "https://row.onl/url?${if (dark) "theme=2&" else ""}q=${URLEncoder.encode(it.url, "UTF-8")}",
target = "_blank"
) { +"[ROW]" }
+" | "
}
a(href = it.url, target = "_blank") { +it.title }
br { }
it.published?.run { +airtableDate().readable() }
}
var longText = false
if (findFlag(FLAG_DETAILS) != null || renderSize == RenderSize.LARGE) {
it.description?.run {
p { +"${this@run}..." }
}
p { +"Added: ${it.added.airtableDate().readable()}" }
longText = true
}
if (getFlagOption(FLAG_COMMENTS) == COMMENTS_ON) {
it.comment?.takeIf { str -> str.isNotBlank() }?.run {
h2 { +"Comments" }
p { +this@run }
longText = true
}
}
if (longText && renderSize == RenderSize.SMALL) hr { }
}
}
}
} | 0 | Kotlin | 0 | 0 | d8800ad6227e746409a5edca9c37a8d67c05e592 | 8,183 | simonkennyweb | MIT License |
mui-kotlin/src/jsMain/kotlin/muix/tree/view/TreeItem.types.kt | karakum-team | 387,062,541 | false | {"Kotlin": 3079611, "TypeScript": 2249, "HTML": 724, "CSS": 86} | // Automatically generated - do not modify!
package muix.tree.view
import mui.material.styles.Theme
import mui.system.SxProps
import web.cssom.ClassName
external interface TreeItemProps :
react.dom.html.HTMLAttributes<web.html.HTMLLIElement>,
react.PropsWithChildren,
react.PropsWithClassName,
mui.system.PropsWithSx {
/**
* The content of the component.
*/
override var children: react.ReactNode?
/**
* className applied to the root element.
*/
override var className: ClassName?
/**
* Override or extend the styles applied to the component.
*/
var classes: TreeItemClasses?
/**
* The icon used to collapse the node.
*/
var collapseIcon: react.ReactNode?
/**
* The component used for the content node.
* @default TreeItemContent
*/
var ContentComponent: react.ComponentType<TreeItemContentProps>?
/**
* Props applied to ContentComponent.
*/
var ContentProps: react.dom.html.HTMLAttributes<web.html.HTMLElement>?
/**
* If `true`, the node is disabled.
* @default false
*/
var disabled: Boolean?
/**
* The icon displayed next to an end node.
*/
var endIcon: react.ReactNode?
/**
* The icon used to expand the node.
*/
var expandIcon: react.ReactNode?
/**
* The icon to display next to the tree node's label.
*/
var icon: react.ReactNode?
/**
* This prop isn't supported.
* Use the `onNodeFocus` callback on the tree if you need to monitor a node's focus.
*/
@Deprecated("See documentation")
override var onFocus: react.dom.events.FocusEventHandler<web.html.HTMLLIElement>?
/**
* The tree node label.
*/
var label: react.ReactNode?
/**
* The id of the node.
*/
var nodeId: String
/**
* The component used for the transition.
* [Follow this guide](/material-ui/transitions/#transitioncomponent-prop) to learn more about the requirements for this component.
* @default Collapse
*/
var TransitionComponent: react.ComponentType<mui.material.transitions.TransitionProps>?
/**
* Props applied to the transition element.
* By default, the element is based on this [`Transition`](http://reactcommunity.org/react-transition-group/transition/) component.
*/
var TransitionProps: mui.material.transitions.TransitionProps?
/**
* The system prop that allows defining system overrides as well as additional CSS styles.
*/
override var sx: SxProps<Theme>?
}
external interface TreeItemOwnerState {
var expanded: Boolean
var focused: Boolean
var selected: Boolean
var disabled: Boolean
}
| 0 | Kotlin | 5 | 35 | 60404a8933357df15ecfd8caf6e83258962ca909 | 2,746 | mui-kotlin | Apache License 2.0 |
mui-kotlin/src/jsMain/kotlin/muix/tree/view/TreeItem.types.kt | karakum-team | 387,062,541 | false | {"Kotlin": 3079611, "TypeScript": 2249, "HTML": 724, "CSS": 86} | // Automatically generated - do not modify!
package muix.tree.view
import mui.material.styles.Theme
import mui.system.SxProps
import web.cssom.ClassName
external interface TreeItemProps :
react.dom.html.HTMLAttributes<web.html.HTMLLIElement>,
react.PropsWithChildren,
react.PropsWithClassName,
mui.system.PropsWithSx {
/**
* The content of the component.
*/
override var children: react.ReactNode?
/**
* className applied to the root element.
*/
override var className: ClassName?
/**
* Override or extend the styles applied to the component.
*/
var classes: TreeItemClasses?
/**
* The icon used to collapse the node.
*/
var collapseIcon: react.ReactNode?
/**
* The component used for the content node.
* @default TreeItemContent
*/
var ContentComponent: react.ComponentType<TreeItemContentProps>?
/**
* Props applied to ContentComponent.
*/
var ContentProps: react.dom.html.HTMLAttributes<web.html.HTMLElement>?
/**
* If `true`, the node is disabled.
* @default false
*/
var disabled: Boolean?
/**
* The icon displayed next to an end node.
*/
var endIcon: react.ReactNode?
/**
* The icon used to expand the node.
*/
var expandIcon: react.ReactNode?
/**
* The icon to display next to the tree node's label.
*/
var icon: react.ReactNode?
/**
* This prop isn't supported.
* Use the `onNodeFocus` callback on the tree if you need to monitor a node's focus.
*/
@Deprecated("See documentation")
override var onFocus: react.dom.events.FocusEventHandler<web.html.HTMLLIElement>?
/**
* The tree node label.
*/
var label: react.ReactNode?
/**
* The id of the node.
*/
var nodeId: String
/**
* The component used for the transition.
* [Follow this guide](/material-ui/transitions/#transitioncomponent-prop) to learn more about the requirements for this component.
* @default Collapse
*/
var TransitionComponent: react.ComponentType<mui.material.transitions.TransitionProps>?
/**
* Props applied to the transition element.
* By default, the element is based on this [`Transition`](http://reactcommunity.org/react-transition-group/transition/) component.
*/
var TransitionProps: mui.material.transitions.TransitionProps?
/**
* The system prop that allows defining system overrides as well as additional CSS styles.
*/
override var sx: SxProps<Theme>?
}
external interface TreeItemOwnerState {
var expanded: Boolean
var focused: Boolean
var selected: Boolean
var disabled: Boolean
}
| 0 | Kotlin | 5 | 35 | 60404a8933357df15ecfd8caf6e83258962ca909 | 2,746 | mui-kotlin | Apache License 2.0 |
tracy/src/test/kotlin/io/polyakov/tracy/action/AffectedDescriptorsRepositoryTest.kt | p01yak0v | 596,203,365 | false | {"Kotlin": 85412, "Shell": 657} | package io.polyakov.tracy.action
import io.kotest.core.spec.style.BehaviorSpec
import io.kotest.data.forAll
import io.kotest.data.row
import io.kotest.matchers.collections.shouldContainExactly
import io.polyakov.tracy.descriptor.TraceDescriptor
import io.polyakov.tracy.descriptor.TraceDescriptorProvider
import io.polyakov.tracy.model.stub.StubCheckpoint
class AffectedDescriptorsRepositoryTest : BehaviorSpec({
Given("instance of affected descriptors repository") {
val firstTraceDescriptor = DynamicTraceDescriptor("first")
val secondTraceDescriptor = DynamicTraceDescriptor("second")
val descriptorsProvider = object : TraceDescriptorProvider {
override fun provide() = setOf<TraceDescriptor>(
firstTraceDescriptor,
secondTraceDescriptor
)
}
val affectedDescriptorsRepository: AffectedDescriptorsRepository =
DefaultAffectedDescriptorsRepository(descriptorsProvider)
forAll(
row("start", firstTraceDescriptor.startCheckpointName, firstTraceDescriptor, TraceAction.START),
row("cancel", firstTraceDescriptor.cancelCheckpointName, firstTraceDescriptor, TraceAction.CANCEL),
row("stop", firstTraceDescriptor.stopCheckpointName, firstTraceDescriptor, TraceAction.STOP),
row("start", secondTraceDescriptor.startCheckpointName, secondTraceDescriptor, TraceAction.START),
row("cancel", secondTraceDescriptor.cancelCheckpointName, secondTraceDescriptor, TraceAction.CANCEL),
row("stop", secondTraceDescriptor.stopCheckpointName, secondTraceDescriptor, TraceAction.STOP),
) { label, checkpointName, targetDescriptor, targetAction ->
When("$label checkpoint for ${targetDescriptor.name} is arrived") {
val affectedTraces = affectedDescriptorsRepository.getAffectedTraces(
StubCheckpoint(checkpointName)
)
Then("single trace affected only") {
affectedTraces.shouldContainExactly(
listOf(targetDescriptor to targetAction)
)
}
}
}
forAll(
row(
"stop",
DynamicTraceDescriptor::stopMatcher,
firstTraceDescriptor.stopCheckpointName,
TraceAction.STOP
),
row(
"start",
DynamicTraceDescriptor::startMatcher,
firstTraceDescriptor.startCheckpointName,
TraceAction.START
),
row(
"cancel",
DynamicTraceDescriptor::cancelMatcher,
firstTraceDescriptor.cancelCheckpointName,
TraceAction.CANCEL
),
) { label: String, matcher: DynamicTraceDescriptor.() -> DynamicNameCheckpointMatcher,
firstCheckpointName: String, action: TraceAction ->
And("second trace has the same $label checkpoint as the first one") {
secondTraceDescriptor.matcher().checkpointName = firstCheckpointName
When("$label checkpoint associated with two descriptors is arrived") {
val affectedTraces = affectedDescriptorsRepository.getAffectedTraces(
StubCheckpoint(firstCheckpointName)
)
Then("both descriptors are affected") {
affectedTraces.shouldContainExactly(
listOf(
firstTraceDescriptor to action,
secondTraceDescriptor to action
)
)
}
}
}
}
}
})
| 0 | Kotlin | 0 | 0 | ede1a8b81ccf52b181d1d39eedb7672412d1ef09 | 3,838 | tracy | Apache License 2.0 |
project/app/src/main/java/com/nexte/nexte/Entities/User/UserAdapter.kt | fga-gpp-mds | 124,143,396 | false | null | package com.nexte.nexte.Entities.User
interface UserAdapter {
fun getAll(): List<User>
fun get(identifier: String): User?
fun updateOrInsert(user: User): User?
fun delete(identifier: String): User?
} | 10 | null | 4 | 9 | b603be5a55de445349805b319275c965fe4a3a92 | 216 | 2018.1_Nexte | MIT License |
app/src/main/java/com/oskhoj/swingplanner/model/FavoritesResponse.kt | oskarh | 113,068,591 | false | null | package com.oskhoj.swingplanner.model
data class FavoritesResponse(val events: List<EventSummary>) | 0 | Kotlin | 0 | 2 | 4bab0b7c7e2b98903d126cf77137371d95db6929 | 99 | SwingPlanner-android | MIT License |
cascade/src/main/java/me/saket/cascade/ktx.kt | kizitonwose | 373,462,030 | false | null | @file:Suppress("unused")
package me.saket.cascade
import android.view.Menu
import android.view.MenuItem
import android.view.SubMenu
import androidx.annotation.StringRes
import androidx.core.view.iterator
// ==================================================================
// This file contains extensions that make it easy to manage toolbar
// menus from Kotlin, something that cascade wants to encourage.
// ==================================================================
/**
* Like [Menu.children], but recursively includes items from sub-menus as well.
*/
@OptIn(ExperimentalStdlibApi::class)
val Menu.allChildren: List<MenuItem>
get() {
val menu = this
return buildList {
for (item in menu) {
add(item)
if (item.hasSubMenu()) {
addAll(item.subMenu.allChildren)
}
}
}
}
fun Menu.add(
title: CharSequence,
itemId: Int = Menu.NONE,
groupId: Int = Menu.NONE,
order: Int = Menu.NONE
): MenuItem {
return add(groupId, itemId, order, title)
}
fun Menu.add(
@StringRes titleRes: Int,
itemId: Int = Menu.NONE,
groupId: Int = Menu.NONE,
order: Int = Menu.NONE
): MenuItem {
return add(groupId, itemId, order, titleRes)
}
fun Menu.addSubMenu(
title: CharSequence,
groupId: Int = Menu.NONE,
itemId: Int = Menu.NONE,
order: Int = Menu.NONE
): SubMenu {
return addSubMenu(groupId, itemId, order, title)
}
fun Menu.addSubMenu(
@StringRes titleRes: Int,
groupId: Int = Menu.NONE,
itemId: Int = Menu.NONE,
order: Int = Menu.NONE
): SubMenu {
return addSubMenu(groupId, itemId, order, titleRes)
}
| 8 | null | 64 | 2 | 13ba790ad0f9e4da6fe033404a7a8da572f9b79f | 1,600 | cascade | Apache License 2.0 |
android/app/src/main/kotlin/com/example/metaWeather/MainActivity.kt | WahdanZ | 385,484,346 | false | {"Dart": 74046, "HTML": 3793, "Ruby": 2684, "Swift": 1405, "Kotlin": 257, "Objective-C": 38} | package com.example.metaWeather
import io.flutter.embedding.android.FlutterActivity
class MainActivity: FlutterActivity() {
}
| 0 | Dart | 0 | 2 | 76e7b1945bf984d6c7324631e7f44c13e82696ba | 128 | meta_weather | MIT License |
app/src/main/java/com/ubuntuyouiwe/nexus/domain/use_case/auth/token/GetTokenUseCase.kt | ubuntuyiw | 670,182,275 | false | {"Kotlin": 645882} | package com.ubuntuyouiwe.nexus.domain.use_case.auth.token
import com.ubuntuyouiwe.nexus.domain.repository.AuthRepository
import com.ubuntuyouiwe.nexus.util.Resource
import com.ubuntuyouiwe.nexus.util.erros.ErrorCodes
import kotlinx.coroutines.flow.flow
import javax.inject.Inject
class GetTokenUseCase @Inject constructor(
private val authRepository: AuthRepository
) {
operator fun invoke() = flow<Resource<String>> {
emit(Resource.Loading)
try {
val token = authRepository.getDeviceToken()
emit(Resource.Success(token))
} catch (e: Exception) {
emit(Resource.Error(message = e.message?: ErrorCodes.UNKNOWN_ERROR.name))
}
}
} | 0 | Kotlin | 0 | 9 | 4edd0040e8983f79eca4cce71ca3e60cc4ee31b7 | 704 | Nexus | Apache License 2.0 |
src/main/kotlin/com/krillsson/sysapi/docker/DockerClient.kt | Krillsson | 40,235,586 | false | {"Kotlin": 450651, "Shell": 10836, "Batchfile": 734, "Dockerfile": 274} | package com.krillsson.sysapi.docker
import com.fasterxml.jackson.databind.ObjectMapper
import com.github.dockerjava.api.async.ResultCallback
import com.github.dockerjava.api.model.Frame
import com.github.dockerjava.api.model.Statistics
import com.github.dockerjava.core.DefaultDockerClientConfig
import com.github.dockerjava.core.DockerClientConfig
import com.github.dockerjava.core.DockerClientConfigDelegate
import com.github.dockerjava.core.DockerClientImpl
import com.github.dockerjava.core.InvocationBuilder.AsyncResultCallback
import com.github.dockerjava.httpclient5.ApacheDockerHttpClient
import com.github.dockerjava.transport.DockerHttpClient
import com.krillsson.sysapi.config.DockerConfiguration
import com.krillsson.sysapi.config.YAMLConfigFile
import com.krillsson.sysapi.core.domain.docker.Command
import com.krillsson.sysapi.core.domain.docker.CommandType
import com.krillsson.sysapi.core.domain.docker.Container
import com.krillsson.sysapi.core.domain.docker.ContainerMetrics
import com.krillsson.sysapi.core.domain.system.Platform
import com.krillsson.sysapi.util.logger
import com.krillsson.sysapi.util.measureTimeMillis
import org.springframework.stereotype.Component
import java.time.Duration
import java.time.Instant
import java.util.concurrent.TimeUnit
@Component
class DockerClient(
private val dockerConfiguration: YAMLConfigFile,
private val applicationObjectMapper: ObjectMapper,
private val platform: Platform
) {
companion object {
val LOGGER by logger()
const val READ_LOGS_COMMAND_TIMEOUT_SEC = 10L
}
private val defaultConfig = DefaultDockerClientConfig.createDefaultConfigBuilder()
.apply {
dockerConfiguration.docker.host?.let { host ->
withDockerHost(host)
}
}
.withDockerTlsVerify(false)
.build()
private val config: DockerClientConfig = object : DockerClientConfigDelegate(
defaultConfig
) {
override fun getObjectMapper(): ObjectMapper {
return applicationObjectMapper
}
}
private val httpClient: DockerHttpClient = ApacheDockerHttpClient.Builder()
.dockerHost(config.dockerHost)
.sslConfig(config.sslConfig)
.connectionTimeout(Duration.ofSeconds(15))
.responseTimeout(Duration.ofSeconds(30))
.maxConnections(100)
.build()
private val client = DockerClientImpl.getInstance(config, httpClient)
fun performCommandWithContainer(command: Command): CommandResult {
return try {
val timedResult: Pair<Long, Void> = measureTimeMillis {
when (command.commandType) {
CommandType.START -> client.startContainerCmd(command.id).exec()
CommandType.STOP -> client.stopContainerCmd(command.id).exec()
CommandType.PAUSE -> client.pauseContainerCmd(command.id).exec()
CommandType.UNPAUSE -> client.unpauseContainerCmd(command.id).exec()
CommandType.RESTART -> client.restartContainerCmd(command.id).exec()
}
}
LOGGER.debug(
"Took {} to perform {} with container {}",
"${timedResult.first.toInt()}ms",
command.commandType,
command.id
)
CommandResult.Success
} catch (e: RuntimeException) {
CommandResult.Failed(e)
}
}
fun listContainers(containersFilter: List<String> = emptyList()): List<Container> {
val timedResult = measureTimeMillis {
val command = if (containersFilter.isNotEmpty()) {
client.listContainersCmd()
.withShowAll(true)
.withIdFilter(containersFilter)
} else {
client.listContainersCmd()
.withShowAll(true)
}
command.exec().map { container ->
val inspection = client.inspectContainerCmd(container.id).exec()
val volumes = if (inspection.volumes == null) emptyList() else inspection.volumes.asVolumeBindings()
val config = inspection.config.asConfig(volumes)
val health = inspection.state.health?.asHealth()
container.asContainer(config, health)
}
}
LOGGER.debug(
"Took {} to fetch {} containers",
"${timedResult.first.toInt()}ms",
timedResult.second.size
)
return timedResult.second
}
fun containerStatistics(containerId: String): ContainerMetrics? {
val timedResult = measureTimeMillis {
var statistics: Statistics?
val callback = AsyncResultCallback<Statistics>()
client.statsCmd(containerId)
.withNoStream(true)
.exec(callback)
try {
// this call takes about ~1-2 sec since it's sleeping on the other end to measure CPU usage
statistics = callback.awaitResult()
callback.close()
statistics.asStatistics(containerId, platform)
} catch (exception: Exception) {
LOGGER.error("Error while getting stats for $containerId", exception)
null
}
}
LOGGER.debug(
"Took {} to fetch stats for container: {}",
"${timedResult.first.toInt()}ms",
containerId
)
return timedResult.second
}
fun readLogsForContainer(
containerId: String,
from: Instant?,
to: Instant?
): MutableList<String> {
val timedResult = measureTimeMillis {
val result = mutableListOf<String>()
client.logContainerCmd(containerId)
.withFollowStream(false)
.withStdErr(true)
.withStdOut(true)
.withTimestamps(true)
.apply { from?.let { withSince(from.toEpochMilli().div(1000).toInt()) } }
.apply { to?.let { withUntil(to.toEpochMilli().div(1000).toInt()) } }
.exec(object : ResultCallback.Adapter<Frame>() {
override fun onNext(frame: Frame?) {
result.add(frame.toString())
}
}).awaitCompletion(READ_LOGS_COMMAND_TIMEOUT_SEC, TimeUnit.SECONDS)
result
}
LOGGER.debug(
"Took {} to fetch {} log lines",
"${timedResult.first.toInt()}ms",
timedResult.second.size
)
return timedResult.second
}
sealed interface PingResult {
object Success : PingResult
data class Fail(val throwable: Throwable) : PingResult
}
fun checkAvailability(): PingResult {
return try {
client.pingCmd().exec()
PingResult.Success
} catch (err: Throwable) {
PingResult.Fail(err)
}
}
}
| 9 | Kotlin | 3 | 97 | bfac764b9fbf3633755e8a045e9d18c5b0b488f8 | 7,013 | sys-API | Apache License 2.0 |
domain-picker/src/test/kotlin/wf/garnier/domainpicker/DomainServiceClientTest.kt | Kehrlann | 123,979,690 | false | null | package wf.garnier.domainpicker
import org.assertj.core.api.Assertions.assertThat
import org.junit.Test
import org.springframework.web.client.RestTemplate
import wf.garnier.domain.Domain
import wf.garnier.domainpicker.mockserver.MockServer
class DomainServiceClientTest {
private val server = MockServer()
private val underTest = DomainServiceClient(RestTemplate(), server.url())
@Test
fun `it should call the domain service over http`() {
server.addJsonResponse("")
underTest.listDomains("anything")
assertThat(server.requestUrl()).matches(".*domains\\?search=anything\$")
}
@Test
fun `it should extract domains from the response`() {
server.addJsonResponse("""{"domains": [{ "name": "example", "extension" : "com", "available": true }]}""")
val domains = underTest.listDomains("anything")
assertThat(domains).containsExactlyInAnyOrder(Domain("example", "com", true))
}
}
| 0 | Kotlin | 2 | 3 | 03efeaaec60259be36fc91ee52f0a9d55e391b09 | 960 | spring-cloud-demo | MIT License |
features/login/src/main/java/com/lgdevs/mynextbook/login/analytics/LoginAnalytics.kt | luangs7 | 493,071,853 | false | null | package com.lgdevs.mynextbook.login.analytics
import android.os.Bundle
import com.lgdevs.mynextbook.common.analytics.BaseAnalytics
import com.lgdevs.mynextbook.domain.model.User
interface LoginAnalytics : BaseAnalytics {
companion object {
const val LOGIN_SCREEN_VIEW = "ScrViewLoginAnalytics"
const val BUTTON_LOGIN_ENTER = "BtnEnterLogin"
const val BUTTON_LOGIN_ENTER_GOOGLE = "BtnEnterLoginGoogle"
const val LOGIN_USERNAME = "LoginUsernameField"
const val LOGIN_EMAIL = "LoginEmailField"
const val LOGIN_WITH_GOOGLE_ERROR = "LoginGoogleError"
const val LOGIN_WITH_ERROR = "LoginError"
const val LOGIN_USER = "LoginUser"
}
fun createParams(param: User): Bundle
}
| 0 | Kotlin | 0 | 3 | ecfd52f889c9c97eb875f076480fadfc1a4adaf7 | 744 | MyNextBook | MIT License |
data/src/main/java/com/sonphil/canadarecallsandsafetyalerts/data/db/RecallDetailsImageDao.kt | Sonphil | 237,512,399 | false | null | package com.sonphil.canadarecallsandsafetyalerts.data.db
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import androidx.room.Transaction
import com.sonphil.canadarecallsandsafetyalerts.data.db.entity.Recall
import com.sonphil.canadarecallsandsafetyalerts.data.db.entity.RecallImage
/**
* Created by Sonphil on 22-02-20.
*/
@Dao
interface RecallDetailsImageDao {
@Insert(onConflict = OnConflictStrategy.REPLACE)
suspend fun insertAll(images: List<RecallImage>)
@Query("DELETE FROM recallimage WHERE recallId = :recallId")
suspend fun deleteAllOfRecall(recallId: String)
@Transaction
suspend fun refreshRecallDetailsImagesForRecall(
images: List<RecallImage>,
recall: Recall
) {
deleteAllOfRecall(recall.id)
insertAll(images)
}
}
| 0 | Kotlin | 0 | 1 | 7c7e02702861ce87c5a058a05acfcc61cb8f78f6 | 872 | CanadaRecallsAndSafetyAlerts | Apache License 2.0 |
api-scanner/src/test/resources/kotlin-internal-annotation/kotlin/net/corda/example/kotlin/InvisibleAnnotation.kt | corda | 120,318,601 | false | null | package net.corda.example.kotlin
import kotlin.annotation.AnnotationRetention.*
import kotlin.annotation.AnnotationTarget.*
@Target(FILE, CLASS, FUNCTION)
@Retention(BINARY)
@CordaInternal
annotation class InvisibleAnnotation | 17 | null | 35 | 24 | aeb324e3b9cb523f55bc32541688b2e90d920791 | 227 | corda-gradle-plugins | Apache License 2.0 |
src/main/kotlin/com/github/blarc/gitlab/template/lint/plugin/gitlab/GitlabLintResponse.kt | Blarc | 492,919,606 | false | null | package com.github.blarc.gitlab.template.lint.plugin.gitlab
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Suppress("PROVIDED_RUNTIME_TOO_LOW")
@Serializable
data class GitlabLintResponse(
val valid: Boolean,
val errors: List<String>,
val warnings: List<String>,
@SerialName("merged_yaml")
val mergedYaml: String?
)
| 7 | Kotlin | 2 | 10 | 0474123e553ffc8941bb70567af1e429f2061685 | 374 | gitlab-template-lint-plugin | Apache License 2.0 |
app/src/main/java/com/github/vitorfg8/popcorn/home/populartvshows/domain/repository/PopularTvShowsRepository.kt | vitorfg8 | 677,008,016 | false | {"Kotlin": 84741} | package com.github.vitorfg8.popcorn.home.populartvshows.domain.repository
import com.github.vitorfg8.popcorn.home.populartvshows.domain.model.PopularTvShow
import kotlinx.coroutines.flow.Flow
interface PopularTvShowsRepository {
suspend fun getPopularTvShows(): Flow<List<PopularTvShow>>
} | 0 | Kotlin | 0 | 0 | 9f945b8621304778b8c55dc01df48a5f8c462bfe | 296 | Popcorn | MIT License |
app/src/main/java/com/github/vitorfg8/popcorn/home/populartvshows/domain/repository/PopularTvShowsRepository.kt | vitorfg8 | 677,008,016 | false | {"Kotlin": 84741} | package com.github.vitorfg8.popcorn.home.populartvshows.domain.repository
import com.github.vitorfg8.popcorn.home.populartvshows.domain.model.PopularTvShow
import kotlinx.coroutines.flow.Flow
interface PopularTvShowsRepository {
suspend fun getPopularTvShows(): Flow<List<PopularTvShow>>
} | 0 | Kotlin | 0 | 0 | 9f945b8621304778b8c55dc01df48a5f8c462bfe | 296 | Popcorn | MIT License |
database/src/main/java/fr/jhelp/database/query/condition/NotCondition.kt | jhelpgg | 264,682,891 | false | null | /*
* <h1>License :</h1> <br/>
* The following code is deliver as is. <br/>
* You can use, modify, the code as your need for any usage.<br/>
* But you can't do any action that avoid me or other person use, modify this code.<br/>
* The code is free for usage and modification, you can't change that fact.
*/
package fr.jhelp.database.query.condition
internal class NotCondition(private val databaseCondition: DatabaseCondition)
: DatabaseCondition
{
override fun where(stringBuilder: StringBuilder)
{
stringBuilder.append("NOT(")
this.databaseCondition.where(stringBuilder)
stringBuilder.append(")")
}
}
| 4 | Kotlin | 0 | 0 | d912fedb330027216113f8af9f8974e8d2b1b7b6 | 654 | AndroidEngine3D | Apache License 2.0 |
app/src/main/java/com/masrofy/emoji/Emoji.kt | salmanA169 | 589,714,976 | false | null | package com.wisnu.kurniawan.wallee.foundation.emoji
object EmojiData {
val DATA: Map<String, String> = mapOf(
"grinning" to "😀",
"smiley" to "😃",
"smile" to "😄",
"grin" to "😁",
"laughing" to "😆",
"sweat_smile" to "😅",
"rofl" to "🤣",
"joy" to "😂",
"slightly_smiling_face" to "🙂",
"upside_down_face" to "🙃",
"wink" to "😉",
"blush" to "😊",
"innocent" to "😇",
"smiling_face_with_three_hearts" to "🥰",
"heart_eyes" to "😍",
"star_struck" to "🤩",
"kissing_heart" to "😘",
"kissing" to "😗",
"relaxed" to "☺️",
"kissing_closed_eyes" to "😚",
"kissing_smiling_eyes" to "😙",
"smiling_face_with_tear" to "🥲",
"yum" to "😋",
"stuck_out_tongue" to "😛",
"stuck_out_tongue_winking_eye" to "😜",
"zany_face" to "🤪",
"stuck_out_tongue_closed_eyes" to "😝",
"money_mouth_face" to "🤑",
"hugs" to "🤗",
"hand_over_mouth" to "🤭",
"shushing_face" to "🤫",
"thinking" to "🤔",
"zipper_mouth_face" to "🤐",
"raised_eyebrow" to "🤨",
"neutral_face" to "😐",
"expressionless" to "😑",
"no_mouth" to "😶",
"smirk" to "😏",
"unamused" to "😒",
"roll_eyes" to "🙄",
"grimacing" to "😬",
"lying_face" to "🤥",
"relieved" to "😌",
"pensive" to "😔",
"sleepy" to "😪",
"drooling_face" to "🤤",
"sleeping" to "😴",
"mask" to "😷",
"face_with_thermometer" to "🤒",
"face_with_head_bandage" to "🤕",
"nauseated_face" to "🤢",
"vomiting_face" to "🤮",
"sneezing_face" to "🤧",
"hot_face" to "🥵",
"cold_face" to "🥶",
"woozy_face" to "🥴",
"dizzy_face" to "😵",
"exploding_head" to "🤯",
"cowboy_hat_face" to "🤠",
"partying_face" to "🥳",
"disguised_face" to "🥸",
"sunglasses" to "😎",
"nerd_face" to "🤓",
"monocle_face" to "🧐",
"confused" to "😕",
"worried" to "😟",
"slightly_frowning_face" to "🙁",
"frowning_face" to "☹️",
"open_mouth" to "😮",
"hushed" to "😯",
"astonished" to "😲",
"flushed" to "😳",
"pleading_face" to "🥺",
"frowning" to "😦",
"anguished" to "😧",
"fearful" to "😨",
"cold_sweat" to "😰",
"disappointed_relieved" to "😥",
"cry" to "😢",
"sob" to "😭",
"scream" to "😱",
"confounded" to "😖",
"persevere" to "😣",
"disappointed" to "😞",
"sweat" to "😓",
"weary" to "😩",
"tired_face" to "😫",
"yawning_face" to "🥱",
"triumph" to "😤",
"rage" to "😡",
"angry" to "😠",
"cursing_face" to "🤬",
"smiling_imp" to "😈",
"imp" to "👿",
"skull" to "💀",
"skull_and_crossbones" to "☠️",
"hankey" to "💩",
"clown_face" to "🤡",
"japanese_ogre" to "👹",
"japanese_goblin" to "👺",
"ghost" to "👻",
"alien" to "👽",
"space_invader" to "👾",
"robot" to "🤖",
"smiley_cat" to "😺",
"smile_cat" to "😸",
"joy_cat" to "😹",
"heart_eyes_cat" to "😻",
"smirk_cat" to "😼",
"kissing_cat" to "😽",
"scream_cat" to "🙀",
"crying_cat_face" to "😿",
"pouting_cat" to "😾",
"see_no_evil" to "🙈",
"hear_no_evil" to "🙉",
"speak_no_evil" to "🙊",
"kiss" to "💋",
"love_letter" to "💌",
"cupid" to "💘",
"gift_heart" to "💝",
"sparkling_heart" to "💖",
"heartpulse" to "💗",
"heartbeat" to "💓",
"revolving_hearts" to "💞",
"two_hearts" to "💕",
"heart_decoration" to "💟",
"heavy_heart_exclamation" to "❣️",
"broken_heart" to "💔",
"heart" to "❤️",
"orange_heart" to "🧡",
"yellow_heart" to "💛",
"green_heart" to "💚",
"blue_heart" to "💙",
"purple_heart" to "💜",
"brown_heart" to "🤎",
"black_heart" to "🖤",
"white_heart" to "🤍",
"100" to "💯",
"anger" to "💢",
"boom" to "💥",
"dizzy" to "💫",
"sweat_drops" to "💦",
"dash" to "💨",
"hole" to "🕳️",
"bomb" to "💣",
"speech_balloon" to "💬",
"eye_speech_bubble" to "👁️🗨️",
"left_speech_bubble" to "🗨️",
"right_anger_bubble" to "🗯️",
"thought_balloon" to "💭",
"zzz" to "💤",
"wave" to "👋",
"raised_back_of_hand" to "🤚",
"raised_hand_with_fingers_splayed" to "🖐️",
"hand" to "✋",
"vulcan_salute" to "🖖",
"ok_hand" to "👌",
"pinched_fingers" to "🤌",
"pinching_hand" to "🤏",
"v" to "✌️",
"crossed_fingers" to "🤞",
"love_you_gesture" to "🤟",
"metal" to "🤘",
"call_me_hand" to "🤙",
"point_left" to "👈",
"point_right" to "👉",
"point_up_2" to "👆",
"middle_finger" to "🖕",
"point_down" to "👇",
"point_up" to "☝️",
"+1" to "👍",
"-1" to "👎",
"fist_raised" to "✊",
"fist_oncoming" to "👊",
"fist_left" to "🤛",
"fist_right" to "🤜",
"clap" to "👏",
"raised_hands" to "🙌",
"open_hands" to "👐",
"palms_up_together" to "🤲",
"handshake" to "🤝",
"pray" to "🙏",
"writing_hand" to "✍️",
"nail_care" to "💅",
"selfie" to "🤳",
"muscle" to "💪",
"mechanical_arm" to "🦾",
"mechanical_leg" to "🦿",
"leg" to "🦵",
"foot" to "🦶",
"ear" to "👂",
"ear_with_hearing_aid" to "🦻",
"nose" to "👃",
"brain" to "🧠",
"anatomical_heart" to "🫀",
"lungs" to "🫁",
"tooth" to "🦷",
"bone" to "🦴",
"eyes" to "👀",
"eye" to "👁️",
"tongue" to "👅",
"lips" to "👄",
"baby" to "👶",
"child" to "🧒",
"boy" to "👦",
"girl" to "👧",
"adult" to "🧑",
"blond_haired_person" to "👱",
"man" to "👨",
"bearded_person" to "🧔",
"red_haired_man" to "👨🦰",
"curly_haired_man" to "👨🦱",
"white_haired_man" to "👨🦳",
"bald_man" to "👨🦲",
"woman" to "👩",
"red_haired_woman" to "👩🦰",
"person_red_hair" to "🧑🦰",
"curly_haired_woman" to "👩🦱",
"person_curly_hair" to "🧑🦱",
"white_haired_woman" to "👩🦳",
"person_white_hair" to "🧑🦳",
"bald_woman" to "👩🦲",
"person_bald" to "🧑🦲",
"blond_haired_woman" to "👱♀️",
"blond_haired_man" to "👱♂️",
"older_adult" to "🧓",
"older_man" to "👴",
"older_woman" to "👵",
"frowning_person" to "🙍",
"frowning_man" to "🙍♂️",
"frowning_woman" to "🙍♀️",
"pouting_face" to "🙎",
"pouting_man" to "🙎♂️",
"pouting_woman" to "🙎♀️",
"no_good" to "🙅",
"no_good_man" to "🙅♂️",
"no_good_woman" to "🙅♀️",
"ok_person" to "🙆",
"ok_man" to "🙆♂️",
"ok_woman" to "🙆♀️",
"tipping_hand_person" to "💁",
"tipping_hand_man" to "💁♂️",
"tipping_hand_woman" to "💁♀️",
"raising_hand" to "🙋",
"raising_hand_man" to "🙋♂️",
"raising_hand_woman" to "🙋♀️",
"deaf_person" to "🧏",
"deaf_man" to "🧏♂️",
"deaf_woman" to "🧏♀️",
"bow" to "🙇",
"bowing_man" to "🙇♂️",
"bowing_woman" to "🙇♀️",
"facepalm" to "🤦",
"man_facepalming" to "🤦♂️",
"woman_facepalming" to "🤦♀️",
"shrug" to "🤷",
"man_shrugging" to "🤷♂️",
"woman_shrugging" to "🤷♀️",
"health_worker" to "🧑⚕️",
"man_health_worker" to "👨⚕️",
"woman_health_worker" to "👩⚕️",
"student" to "🧑🎓",
"man_student" to "👨🎓",
"woman_student" to "👩🎓",
"teacher" to "🧑🏫",
"man_teacher" to "👨🏫",
"woman_teacher" to "👩🏫",
"judge" to "🧑⚖️",
"man_judge" to "👨⚖️",
"woman_judge" to "👩⚖️",
"farmer" to "🧑🌾",
"man_farmer" to "👨🌾",
"woman_farmer" to "👩🌾",
"cook" to "🧑🍳",
"man_cook" to "👨🍳",
"woman_cook" to "👩🍳",
"mechanic" to "🧑🔧",
"man_mechanic" to "👨🔧",
"woman_mechanic" to "👩🔧",
"factory_worker" to "🧑🏭",
"man_factory_worker" to "👨🏭",
"woman_factory_worker" to "👩🏭",
"office_worker" to "🧑💼",
"man_office_worker" to "👨💼",
"woman_office_worker" to "👩💼",
"scientist" to "🧑🔬",
"man_scientist" to "👨🔬",
"woman_scientist" to "👩🔬",
"technologist" to "🧑💻",
"man_technologist" to "👨💻",
"woman_technologist" to "👩💻",
"singer" to "🧑🎤",
"man_singer" to "👨🎤",
"woman_singer" to "👩🎤",
"artist" to "🧑🎨",
"man_artist" to "👨🎨",
"woman_artist" to "👩🎨",
"pilot" to "🧑✈️",
"man_pilot" to "👨✈️",
"woman_pilot" to "👩✈️",
"astronaut" to "🧑🚀",
"man_astronaut" to "👨🚀",
"woman_astronaut" to "👩🚀",
"firefighter" to "🧑🚒",
"man_firefighter" to "👨🚒",
"woman_firefighter" to "👩🚒",
"police_officer" to "👮",
"policeman" to "👮♂️",
"policewoman" to "👮♀️",
"detective" to "🕵️",
"male_detective" to "🕵️♂️",
"female_detective" to "🕵️♀️",
"guard" to "💂",
"guardsman" to "💂♂️",
"guardswoman" to "💂♀️",
"ninja" to "🥷",
"construction_worker" to "👷",
"construction_worker_man" to "👷♂️",
"construction_worker_woman" to "👷♀️",
"prince" to "🤴",
"princess" to "👸",
"person_with_turban" to "👳",
"man_with_turban" to "👳♂️",
"woman_with_turban" to "👳♀️",
"man_with_gua_pi_mao" to "👲",
"woman_with_headscarf" to "🧕",
"person_in_tuxedo" to "🤵",
"man_in_tuxedo" to "🤵♂️",
"woman_in_tuxedo" to "🤵♀️",
"person_with_veil" to "👰",
"man_with_veil" to "👰♂️",
"woman_with_veil" to "👰♀️",
"pregnant_woman" to "🤰",
"breast_feeding" to "🤱",
"woman_feeding_baby" to "👩🍼",
"man_feeding_baby" to "👨🍼",
"person_feeding_baby" to "🧑🍼",
"angel" to "👼",
"santa" to "🎅",
"mrs_claus" to "🤶",
"mx_claus" to "🧑🎄",
"superhero" to "🦸",
"superhero_man" to "🦸♂️",
"superhero_woman" to "🦸♀️",
"supervillain" to "🦹",
"supervillain_man" to "🦹♂️",
"supervillain_woman" to "🦹♀️",
"mage" to "🧙",
"mage_man" to "🧙♂️",
"mage_woman" to "🧙♀️",
"fairy" to "🧚",
"fairy_man" to "🧚♂️",
"fairy_woman" to "🧚♀️",
"vampire" to "🧛",
"vampire_man" to "🧛♂️",
"vampire_woman" to "🧛♀️",
"merperson" to "🧜",
"merman" to "🧜♂️",
"mermaid" to "🧜♀️",
"elf" to "🧝",
"elf_man" to "🧝♂️",
"elf_woman" to "🧝♀️",
"genie" to "🧞",
"genie_man" to "🧞♂️",
"genie_woman" to "🧞♀️",
"zombie" to "🧟",
"zombie_man" to "🧟♂️",
"zombie_woman" to "🧟♀️",
"massage" to "💆",
"massage_man" to "💆♂️",
"massage_woman" to "💆♀️",
"haircut" to "💇",
"haircut_man" to "💇♂️",
"haircut_woman" to "💇♀️",
"walking" to "🚶",
"walking_man" to "🚶♂️",
"walking_woman" to "🚶♀️",
"standing_person" to "🧍",
"standing_man" to "🧍♂️",
"standing_woman" to "🧍♀️",
"kneeling_person" to "🧎",
"kneeling_man" to "🧎♂️",
"kneeling_woman" to "🧎♀️",
"person_with_probing_cane" to "🧑🦯",
"man_with_probing_cane" to "👨🦯",
"woman_with_probing_cane" to "👩🦯",
"person_in_motorized_wheelchair" to "🧑🦼",
"man_in_motorized_wheelchair" to "👨🦼",
"woman_in_motorized_wheelchair" to "👩🦼",
"person_in_manual_wheelchair" to "🧑🦽",
"man_in_manual_wheelchair" to "👨🦽",
"woman_in_manual_wheelchair" to "👩🦽",
"runner" to "🏃",
"running_man" to "🏃♂️",
"running_woman" to "🏃♀️",
"woman_dancing" to "💃",
"man_dancing" to "🕺",
"business_suit_levitating" to "🕴️",
"dancers" to "👯",
"dancing_men" to "👯♂️",
"dancing_women" to "👯♀️",
"sauna_person" to "🧖",
"sauna_man" to "🧖♂️",
"sauna_woman" to "🧖♀️",
"climbing" to "🧗",
"climbing_man" to "🧗♂️",
"climbing_woman" to "🧗♀️",
"person_fencing" to "🤺",
"horse_racing" to "🏇",
"skier" to "⛷️",
"snowboarder" to "🏂",
"golfing" to "🏌️",
"golfing_man" to "🏌️♂️",
"golfing_woman" to "🏌️♀️",
"surfer" to "🏄",
"surfing_man" to "🏄♂️",
"surfing_woman" to "🏄♀️",
"rowboat" to "🚣",
"rowing_man" to "🚣♂️",
"rowing_woman" to "🚣♀️",
"swimmer" to "🏊",
"swimming_man" to "🏊♂️",
"swimming_woman" to "🏊♀️",
"bouncing_ball_person" to "⛹️",
"bouncing_ball_man" to "⛹️♂️",
"bouncing_ball_woman" to "⛹️♀️",
"weight_lifting" to "🏋️",
"weight_lifting_man" to "🏋️♂️",
"weight_lifting_woman" to "🏋️♀️",
"bicyclist" to "🚴",
"biking_man" to "🚴♂️",
"biking_woman" to "🚴♀️",
"mountain_bicyclist" to "🚵",
"mountain_biking_man" to "🚵♂️",
"mountain_biking_woman" to "🚵♀️",
"cartwheeling" to "🤸",
"man_cartwheeling" to "🤸♂️",
"woman_cartwheeling" to "🤸♀️",
"wrestling" to "🤼",
"men_wrestling" to "🤼♂️",
"women_wrestling" to "🤼♀️",
"water_polo" to "🤽",
"man_playing_water_polo" to "🤽♂️",
"woman_playing_water_polo" to "🤽♀️",
"handball_person" to "🤾",
"man_playing_handball" to "🤾♂️",
"woman_playing_handball" to "🤾♀️",
"juggling_person" to "🤹",
"man_juggling" to "🤹♂️",
"woman_juggling" to "🤹♀️",
"lotus_position" to "🧘",
"lotus_position_man" to "🧘♂️",
"lotus_position_woman" to "🧘♀️",
"bath" to "🛀",
"sleeping_bed" to "🛌",
"people_holding_hands" to "🧑🤝🧑",
"two_women_holding_hands" to "👭",
"couple" to "👫",
"two_men_holding_hands" to "👬",
"couplekiss" to "💏",
"couplekiss_man_woman" to "👩❤️💋👨",
"couplekiss_man_man" to "👨❤️💋👨",
"couplekiss_woman_woman" to "👩❤️💋👩",
"couple_with_heart" to "💑",
"couple_with_heart_woman_man" to "👩❤️👨",
"couple_with_heart_man_man" to "👨❤️👨",
"couple_with_heart_woman_woman" to "👩❤️👩",
"family" to "👪",
"family_man_woman_boy" to "👨👩👦",
"family_man_woman_girl" to "👨👩👧",
"family_man_woman_girl_boy" to "👨👩👧👦",
"family_man_woman_boy_boy" to "👨👩👦👦",
"family_man_woman_girl_girl" to "👨👩👧👧",
"family_man_man_boy" to "👨👨👦",
"family_man_man_girl" to "👨👨👧",
"family_man_man_girl_boy" to "👨👨👧👦",
"family_man_man_boy_boy" to "👨👨👦👦",
"family_man_man_girl_girl" to "👨👨👧👧",
"family_woman_woman_boy" to "👩👩👦",
"family_woman_woman_girl" to "👩👩👧",
"family_woman_woman_girl_boy" to "👩👩👧👦",
"family_woman_woman_boy_boy" to "👩👩👦👦",
"family_woman_woman_girl_girl" to "👩👩👧👧",
"family_man_boy" to "👨👦",
"family_man_boy_boy" to "👨👦👦",
"family_man_girl" to "👨👧",
"family_man_girl_boy" to "👨👧👦",
"family_man_girl_girl" to "👨👧👧",
"family_woman_boy" to "👩👦",
"family_woman_boy_boy" to "👩👦👦",
"family_woman_girl" to "👩👧",
"family_woman_girl_boy" to "👩👧👦",
"family_woman_girl_girl" to "👩👧👧",
"speaking_head" to "🗣️",
"bust_in_silhouette" to "👤",
"busts_in_silhouette" to "👥",
"people_hugging" to "🫂",
"footprints" to "👣",
"monkey_face" to "🐵",
"monkey" to "🐒",
"gorilla" to "🦍",
"orangutan" to "🦧",
"dog" to "🐶",
"dog2" to "🐕",
"guide_dog" to "🦮",
"service_dog" to "🐕🦺",
"poodle" to "🐩",
"wolf" to "🐺",
"fox_face" to "🦊",
"raccoon" to "🦝",
"cat" to "🐱",
"cat2" to "🐈",
"black_cat" to "🐈⬛",
"lion" to "🦁",
"tiger" to "🐯",
"tiger2" to "🐅",
"leopard" to "🐆",
"horse" to "🐴",
"racehorse" to "🐎",
"unicorn" to "🦄",
"zebra" to "🦓",
"deer" to "🦌",
"bison" to "🦬",
"cow" to "🐮",
"ox" to "🐂",
"water_buffalo" to "🐃",
"cow2" to "🐄",
"pig" to "🐷",
"pig2" to "🐖",
"boar" to "🐗",
"pig_nose" to "🐽",
"ram" to "🐏",
"sheep" to "🐑",
"goat" to "🐐",
"dromedary_camel" to "🐪",
"camel" to "🐫",
"llama" to "🦙",
"giraffe" to "🦒",
"elephant" to "🐘",
"mammoth" to "🦣",
"rhinoceros" to "🦏",
"hippopotamus" to "🦛",
"mouse" to "🐭",
"mouse2" to "🐁",
"rat" to "🐀",
"hamster" to "🐹",
"rabbit" to "🐰",
"rabbit2" to "🐇",
"chipmunk" to "🐿️",
"beaver" to "🦫",
"hedgehog" to "🦔",
"bat" to "🦇",
"bear" to "🐻",
"polar_bear" to "🐻❄️",
"koala" to "🐨",
"panda_face" to "🐼",
"sloth" to "🦥",
"otter" to "🦦",
"skunk" to "🦨",
"kangaroo" to "🦘",
"badger" to "🦡",
"feet" to "🐾",
"turkey" to "🦃",
"chicken" to "🐔",
"rooster" to "🐓",
"hatching_chick" to "🐣",
"baby_chick" to "🐤",
"hatched_chick" to "🐥",
"bird" to "🐦",
"penguin" to "🐧",
"dove" to "🕊️",
"eagle" to "🦅",
"duck" to "🦆",
"swan" to "🦢",
"owl" to "🦉",
"dodo" to "🦤",
"feather" to "🪶",
"flamingo" to "🦩",
"peacock" to "🦚",
"parrot" to "🦜",
"frog" to "🐸",
"crocodile" to "🐊",
"turtle" to "🐢",
"lizard" to "🦎",
"snake" to "🐍",
"dragon_face" to "🐲",
"dragon" to "🐉",
"sauropod" to "🦕",
"t-rex" to "🦖",
"whale" to "🐳",
"whale2" to "🐋",
"dolphin" to "🐬",
"seal" to "🦭",
"fish" to "🐟",
"tropical_fish" to "🐠",
"blowfish" to "🐡",
"shark" to "🦈",
"octopus" to "🐙",
"shell" to "🐚",
"snail" to "🐌",
"butterfly" to "🦋",
"bug" to "🐛",
"ant" to "🐜",
"bee" to "🐝",
"beetle" to "🪲",
"lady_beetle" to "🐞",
"cricket" to "🦗",
"cockroach" to "🪳",
"spider" to "🕷️",
"spider_web" to "🕸️",
"scorpion" to "🦂",
"mosquito" to "🦟",
"fly" to "🪰",
"worm" to "🪱",
"microbe" to "🦠",
"bouquet" to "💐",
"cherry_blossom" to "🌸",
"white_flower" to "💮",
"rosette" to "🏵️",
"rose" to "🌹",
"wilted_flower" to "🥀",
"hibiscus" to "🌺",
"sunflower" to "🌻",
"blossom" to "🌼",
"tulip" to "🌷",
"seedling" to "🌱",
"potted_plant" to "🪴",
"evergreen_tree" to "🌲",
"deciduous_tree" to "🌳",
"palm_tree" to "🌴",
"cactus" to "🌵",
"ear_of_rice" to "🌾",
"herb" to "🌿",
"shamrock" to "☘️",
"four_leaf_clover" to "🍀",
"maple_leaf" to "🍁",
"fallen_leaf" to "🍂",
"leaves" to "🍃",
"grapes" to "🍇",
"melon" to "🍈",
"watermelon" to "🍉",
"tangerine" to "🍊",
"lemon" to "🍋",
"banana" to "🍌",
"pineapple" to "🍍",
"mango" to "🥭",
"apple" to "🍎",
"green_apple" to "🍏",
"pear" to "🍐",
"peach" to "🍑",
"cherries" to "🍒",
"strawberry" to "🍓",
"blueberries" to "🫐",
"kiwi_fruit" to "🥝",
"tomato" to "🍅",
"olive" to "🫒",
"coconut" to "🥥",
"avocado" to "🥑",
"eggplant" to "🍆",
"potato" to "🥔",
"carrot" to "🥕",
"corn" to "🌽",
"hot_pepper" to "🌶️",
"bell_pepper" to "🫑",
"cucumber" to "🥒",
"leafy_green" to "🥬",
"broccoli" to "🥦",
"garlic" to "🧄",
"onion" to "🧅",
"mushroom" to "🍄",
"peanuts" to "🥜",
"chestnut" to "🌰",
"bread" to "🍞",
"croissant" to "🥐",
"baguette_bread" to "🥖",
"flatbread" to "🫓",
"pretzel" to "🥨",
"bagel" to "🥯",
"pancakes" to "🥞",
"waffle" to "🧇",
"cheese" to "🧀",
"meat_on_bone" to "🍖",
"poultry_leg" to "🍗",
"cut_of_meat" to "🥩",
"bacon" to "🥓",
"hamburger" to "🍔",
"fries" to "🍟",
"pizza" to "🍕",
"hotdog" to "🌭",
"sandwich" to "🥪",
"taco" to "🌮",
"burrito" to "🌯",
"tamale" to "🫔",
"stuffed_flatbread" to "🥙",
"falafel" to "🧆",
"egg" to "🥚",
"fried_egg" to "🍳",
"shallow_pan_of_food" to "🥘",
"stew" to "🍲",
"fondue" to "🫕",
"bowl_with_spoon" to "🥣",
"green_salad" to "🥗",
"popcorn" to "🍿",
"butter" to "🧈",
"salt" to "🧂",
"canned_food" to "🥫",
"bento" to "🍱",
"rice_cracker" to "🍘",
"rice_ball" to "🍙",
"rice" to "🍚",
"curry" to "🍛",
"ramen" to "🍜",
"spaghetti" to "🍝",
"sweet_potato" to "🍠",
"oden" to "🍢",
"sushi" to "🍣",
"fried_shrimp" to "🍤",
"fish_cake" to "🍥",
"moon_cake" to "🥮",
"dango" to "🍡",
"dumpling" to "🥟",
"fortune_cookie" to "🥠",
"takeout_box" to "🥡",
"crab" to "🦀",
"lobster" to "🦞",
"shrimp" to "🦐",
"squid" to "🦑",
"oyster" to "🦪",
"icecream" to "🍦",
"shaved_ice" to "🍧",
"ice_cream" to "🍨",
"doughnut" to "🍩",
"cookie" to "🍪",
"birthday" to "🎂",
"cake" to "🍰",
"cupcake" to "🧁",
"pie" to "🥧",
"chocolate_bar" to "🍫",
"candy" to "🍬",
"lollipop" to "🍭",
"custard" to "🍮",
"honey_pot" to "🍯",
"baby_bottle" to "🍼",
"milk_glass" to "🥛",
"coffee" to "☕",
"teapot" to "🫖",
"tea" to "🍵",
"sake" to "🍶",
"champagne" to "🍾",
"wine_glass" to "🍷",
"cocktail" to "🍸",
"tropical_drink" to "🍹",
"beer" to "🍺",
"beers" to "🍻",
"clinking_glasses" to "🥂",
"tumbler_glass" to "🥃",
"cup_with_straw" to "🥤",
"bubble_tea" to "🧋",
"beverage_box" to "🧃",
"mate" to "🧉",
"ice_cube" to "🧊",
"chopsticks" to "🥢",
"plate_with_cutlery" to "🍽️",
"fork_and_knife" to "🍴",
"spoon" to "🥄",
"hocho" to "🔪",
"amphora" to "🏺",
"earth_africa" to "🌍",
"earth_americas" to "🌎",
"earth_asia" to "🌏",
"globe_with_meridians" to "🌐",
"world_map" to "🗺️",
"japan" to "🗾",
"compass" to "🧭",
"mountain_snow" to "🏔️",
"mountain" to "⛰️",
"volcano" to "🌋",
"mount_fuji" to "🗻",
"camping" to "🏕️",
"beach_umbrella" to "🏖️",
"desert" to "🏜️",
"desert_island" to "🏝️",
"national_park" to "🏞️",
"stadium" to "🏟️",
"classical_building" to "🏛️",
"building_construction" to "🏗️",
"bricks" to "🧱",
"rock" to "🪨",
"wood" to "🪵",
"hut" to "🛖",
"houses" to "🏘️",
"derelict_house" to "🏚️",
"house" to "🏠",
"house_with_garden" to "🏡",
"office" to "🏢",
"post_office" to "🏣",
"european_post_office" to "🏤",
"hospital" to "🏥",
"bank" to "🏦",
"hotel" to "🏨",
"love_hotel" to "🏩",
"convenience_store" to "🏪",
"school" to "🏫",
"department_store" to "🏬",
"factory" to "🏭",
"japanese_castle" to "🏯",
"european_castle" to "🏰",
"wedding" to "💒",
"tokyo_tower" to "🗼",
"statue_of_liberty" to "🗽",
"church" to "⛪",
"mosque" to "🕌",
"hindu_temple" to "🛕",
"synagogue" to "🕍",
"shinto_shrine" to "⛩️",
"kaaba" to "🕋",
"fountain" to "⛲",
"tent" to "⛺",
"foggy" to "🌁",
"night_with_stars" to "🌃",
"cityscape" to "🏙️",
"sunrise_over_mountains" to "🌄",
"sunrise" to "🌅",
"city_sunset" to "🌆",
"city_sunrise" to "🌇",
"bridge_at_night" to "🌉",
"hotsprings" to "♨️",
"carousel_horse" to "🎠",
"ferris_wheel" to "🎡",
"roller_coaster" to "🎢",
"barber" to "💈",
"circus_tent" to "🎪",
"steam_locomotive" to "🚂",
"railway_car" to "🚃",
"bullettrain_side" to "🚄",
"bullettrain_front" to "🚅",
"train2" to "🚆",
"metro" to "🚇",
"light_rail" to "🚈",
"station" to "🚉",
"tram" to "🚊",
"monorail" to "🚝",
"mountain_railway" to "🚞",
"train" to "🚋",
"bus" to "🚌",
"oncoming_bus" to "🚍",
"trolleybus" to "🚎",
"minibus" to "🚐",
"ambulance" to "🚑",
"fire_engine" to "🚒",
"police_car" to "🚓",
"oncoming_police_car" to "🚔",
"taxi" to "🚕",
"oncoming_taxi" to "🚖",
"car" to "🚗",
"oncoming_automobile" to "🚘",
"blue_car" to "🚙",
"pickup_truck" to "🛻",
"truck" to "🚚",
"articulated_lorry" to "🚛",
"tractor" to "🚜",
"racing_car" to "🏎️",
"motorcycle" to "🏍️",
"motor_scooter" to "🛵",
"manual_wheelchair" to "🦽",
"motorized_wheelchair" to "🦼",
"auto_rickshaw" to "🛺",
"bike" to "🚲",
"kick_scooter" to "🛴",
"skateboard" to "🛹",
"roller_skate" to "🛼",
"busstop" to "🚏",
"motorway" to "🛣️",
"railway_track" to "🛤️",
"oil_drum" to "🛢️",
"fuelpump" to "⛽",
"rotating_light" to "🚨",
"traffic_light" to "🚥",
"vertical_traffic_light" to "🚦",
"stop_sign" to "🛑",
"construction" to "🚧",
"anchor" to "⚓",
"boat" to "⛵",
"canoe" to "🛶",
"speedboat" to "🚤",
"passenger_ship" to "🛳️",
"ferry" to "⛴️",
"motor_boat" to "🛥️",
"ship" to "🚢",
"airplane" to "✈️",
"small_airplane" to "🛩️",
"flight_departure" to "🛫",
"flight_arrival" to "🛬",
"parachute" to "🪂",
"seat" to "💺",
"helicopter" to "🚁",
"suspension_railway" to "🚟",
"mountain_cableway" to "🚠",
"aerial_tramway" to "🚡",
"artificial_satellite" to "🛰️",
"rocket" to "🚀",
"flying_saucer" to "🛸",
"bellhop_bell" to "🛎️",
"luggage" to "🧳",
"hourglass" to "⌛",
"hourglass_flowing_sand" to "⏳",
"watch" to "⌚",
"alarm_clock" to "⏰",
"stopwatch" to "⏱️",
"timer_clock" to "⏲️",
"mantelpiece_clock" to "🕰️",
"clock12" to "🕛",
"clock1230" to "🕧",
"clock1" to "🕐",
"clock130" to "🕜",
"clock2" to "🕑",
"clock230" to "🕝",
"clock3" to "🕒",
"clock330" to "🕞",
"clock4" to "🕓",
"clock430" to "🕟",
"clock5" to "🕔",
"clock530" to "🕠",
"clock6" to "🕕",
"clock630" to "🕡",
"clock7" to "🕖",
"clock730" to "🕢",
"clock8" to "🕗",
"clock830" to "🕣",
"clock9" to "🕘",
"clock930" to "🕤",
"clock10" to "🕙",
"clock1030" to "🕥",
"clock11" to "🕚",
"clock1130" to "🕦",
"new_moon" to "🌑",
"waxing_crescent_moon" to "🌒",
"first_quarter_moon" to "🌓",
"moon" to "🌔",
"full_moon" to "🌕",
"waning_gibbous_moon" to "🌖",
"last_quarter_moon" to "🌗",
"waning_crescent_moon" to "🌘",
"crescent_moon" to "🌙",
"new_moon_with_face" to "🌚",
"first_quarter_moon_with_face" to "🌛",
"last_quarter_moon_with_face" to "🌜",
"thermometer" to "🌡️",
"sunny" to "☀️",
"full_moon_with_face" to "🌝",
"sun_with_face" to "🌞",
"ringed_planet" to "🪐",
"star" to "⭐",
"star2" to "🌟",
"stars" to "🌠",
"milky_way" to "🌌",
"cloud" to "☁️",
"partly_sunny" to "⛅",
"cloud_with_lightning_and_rain" to "⛈️",
"sun_behind_small_cloud" to "🌤️",
"sun_behind_large_cloud" to "🌥️",
"sun_behind_rain_cloud" to "🌦️",
"cloud_with_rain" to "🌧️",
"cloud_with_snow" to "🌨️",
"cloud_with_lightning" to "🌩️",
"tornado" to "🌪️",
"fog" to "🌫️",
"wind_face" to "🌬️",
"cyclone" to "🌀",
"rainbow" to "🌈",
"closed_umbrella" to "🌂",
"open_umbrella" to "☂️",
"umbrella" to "☔",
"parasol_on_ground" to "⛱️",
"zap" to "⚡",
"snowflake" to "❄️",
"snowman_with_snow" to "☃️",
"snowman" to "⛄",
"comet" to "☄️",
"fire" to "🔥",
"droplet" to "💧",
"ocean" to "🌊",
"jack_o_lantern" to "🎃",
"christmas_tree" to "🎄",
"fireworks" to "🎆",
"sparkler" to "🎇",
"firecracker" to "🧨",
"sparkles" to "✨",
"balloon" to "🎈",
"tada" to "🎉",
"confetti_ball" to "🎊",
"tanabata_tree" to "🎋",
"bamboo" to "🎍",
"dolls" to "🎎",
"flags" to "🎏",
"wind_chime" to "🎐",
"rice_scene" to "🎑",
"red_envelope" to "🧧",
"ribbon" to "🎀",
"gift" to "🎁",
"reminder_ribbon" to "🎗️",
"tickets" to "🎟️",
"ticket" to "🎫",
"medal_military" to "🎖️",
"trophy" to "🏆",
"medal_sports" to "🏅",
"1st_place_medal" to "🥇",
"2nd_place_medal" to "🥈",
"3rd_place_medal" to "🥉",
"soccer" to "⚽",
"baseball" to "⚾",
"softball" to "🥎",
"basketball" to "🏀",
"volleyball" to "🏐",
"football" to "🏈",
"rugby_football" to "🏉",
"tennis" to "🎾",
"flying_disc" to "🥏",
"bowling" to "🎳",
"cricket_game" to "🏏",
"field_hockey" to "🏑",
"ice_hockey" to "🏒",
"lacrosse" to "🥍",
"ping_pong" to "🏓",
"badminton" to "🏸",
"boxing_glove" to "🥊",
"martial_arts_uniform" to "🥋",
"goal_net" to "🥅",
"golf" to "⛳",
"ice_skate" to "⛸️",
"fishing_pole_and_fish" to "🎣",
"diving_mask" to "🤿",
"running_shirt_with_sash" to "🎽",
"ski" to "🎿",
"sled" to "🛷",
"curling_stone" to "🥌",
"dart" to "🎯",
"yo_yo" to "🪀",
"kite" to "🪁",
"8ball" to "🎱",
"crystal_ball" to "🔮",
"magic_wand" to "🪄",
"nazar_amulet" to "🧿",
"video_game" to "🎮",
"joystick" to "🕹️",
"slot_machine" to "🎰",
"game_die" to "🎲",
"jigsaw" to "🧩",
"teddy_bear" to "🧸",
"pi_ata" to "🪅",
"nesting_dolls" to "🪆",
"spades" to "♠️",
"hearts" to "♥️",
"diamonds" to "♦️",
"clubs" to "♣️",
"chess_pawn" to "♟️",
"black_joker" to "🃏",
"mahjong" to "🀄",
"flower_playing_cards" to "🎴",
"performing_arts" to "🎭",
"framed_picture" to "🖼️",
"art" to "🎨",
"thread" to "🧵",
"sewing_needle" to "🪡",
"yarn" to "🧶",
"knot" to "🪢",
"eyeglasses" to "👓",
"dark_sunglasses" to "🕶️",
"goggles" to "🥽",
"lab_coat" to "🥼",
"safety_vest" to "🦺",
"necktie" to "👔",
"shirt" to "👕",
"jeans" to "👖",
"scarf" to "🧣",
"gloves" to "🧤",
"coat" to "🧥",
"socks" to "🧦",
"dress" to "👗",
"kimono" to "👘",
"sari" to "🥻",
"one_piece_swimsuit" to "🩱",
"swim_brief" to "🩲",
"shorts" to "🩳",
"bikini" to "👙",
"womans_clothes" to "👚",
"purse" to "👛",
"handbag" to "👜",
"pouch" to "👝",
"shopping" to "🛍️",
"school_satchel" to "🎒",
"thong_sandal" to "🩴",
"mans_shoe" to "👞",
"athletic_shoe" to "👟",
"hiking_boot" to "🥾",
"flat_shoe" to "🥿",
"high_heel" to "👠",
"sandal" to "👡",
"ballet_shoes" to "🩰",
"boot" to "👢",
"crown" to "👑",
"womans_hat" to "👒",
"tophat" to "🎩",
"mortar_board" to "🎓",
"billed_cap" to "🧢",
"military_helmet" to "🪖",
"rescue_worker_helmet" to "⛑️",
"prayer_beads" to "📿",
"lipstick" to "💄",
"ring" to "💍",
"gem" to "💎",
"mute" to "🔇",
"speaker" to "🔈",
"sound" to "🔉",
"loud_sound" to "🔊",
"loudspeaker" to "📢",
"mega" to "📣",
"postal_horn" to "📯",
"bell" to "🔔",
"no_bell" to "🔕",
"musical_score" to "🎼",
"musical_note" to "🎵",
"notes" to "🎶",
"studio_microphone" to "🎙️",
"level_slider" to "🎚️",
"control_knobs" to "🎛️",
"microphone" to "🎤",
"headphones" to "🎧",
"radio" to "📻",
"saxophone" to "🎷",
"accordion" to "🪗",
"guitar" to "🎸",
"musical_keyboard" to "🎹",
"trumpet" to "🎺",
"violin" to "🎻",
"banjo" to "🪕",
"drum" to "🥁",
"long_drum" to "🪘",
"iphone" to "📱",
"calling" to "📲",
"phone" to "☎️",
"telephone_receiver" to "📞",
"pager" to "📟",
"fax" to "📠",
"battery" to "🔋",
"electric_plug" to "🔌",
"computer" to "💻",
"desktop_computer" to "🖥️",
"printer" to "🖨️",
"keyboard" to "⌨️",
"computer_mouse" to "🖱️",
"trackball" to "🖲️",
"minidisc" to "💽",
"floppy_disk" to "💾",
"cd" to "💿",
"dvd" to "📀",
"abacus" to "🧮",
"movie_camera" to "🎥",
"film_strip" to "🎞️",
"film_projector" to "📽️",
"clapper" to "🎬",
"tv" to "📺",
"camera" to "📷",
"camera_flash" to "📸",
"video_camera" to "📹",
"vhs" to "📼",
"mag" to "🔍",
"mag_right" to "🔎",
"candle" to "🕯️",
"bulb" to "💡",
"flashlight" to "🔦",
"izakaya_lantern" to "🏮",
"diya_lamp" to "🪔",
"notebook_with_decorative_cover" to "📔",
"closed_book" to "📕",
"book" to "📖",
"green_book" to "📗",
"blue_book" to "📘",
"orange_book" to "📙",
"books" to "📚",
"notebook" to "📓",
"ledger" to "📒",
"page_with_curl" to "📃",
"scroll" to "📜",
"page_facing_up" to "📄",
"newspaper" to "📰",
"newspaper_roll" to "🗞️",
"bookmark_tabs" to "📑",
"bookmark" to "🔖",
"label" to "🏷️",
"moneybag" to "💰",
"coin" to "🪙",
"yen" to "💴",
"dollar" to "💵",
"euro" to "💶",
"pound" to "💷",
"money_with_wings" to "💸",
"credit_card" to "💳",
"receipt" to "🧾",
"chart" to "💹",
"email" to "✉️",
"e-mail" to "📧",
"incoming_envelope" to "📨",
"envelope_with_arrow" to "📩",
"outbox_tray" to "📤",
"inbox_tray" to "📥",
"package" to "📦",
"mailbox" to "📫",
"mailbox_closed" to "📪",
"mailbox_with_mail" to "📬",
"mailbox_with_no_mail" to "📭",
"postbox" to "📮",
"ballot_box" to "🗳️",
"pencil2" to "✏️",
"black_nib" to "✒️",
"fountain_pen" to "🖋️",
"pen" to "🖊️",
"paintbrush" to "🖌️",
"crayon" to "🖍️",
"memo" to "📝",
"briefcase" to "💼",
"file_folder" to "📁",
"open_file_folder" to "📂",
"card_index_dividers" to "🗂️",
"date" to "📅",
"calendar" to "📆",
"spiral_notepad" to "🗒️",
"spiral_calendar" to "🗓️",
"card_index" to "📇",
"chart_with_upwards_trend" to "📈",
"chart_with_downwards_trend" to "📉",
"bar_chart" to "📊",
"clipboard" to "📋",
"pushpin" to "📌",
"round_pushpin" to "📍",
"paperclip" to "📎",
"paperclips" to "🖇️",
"straight_ruler" to "📏",
"triangular_ruler" to "📐",
"scissors" to "✂️",
"card_file_box" to "🗃️",
"file_cabinet" to "🗄️",
"wastebasket" to "🗑️",
"lock" to "🔒",
"unlock" to "🔓",
"lock_with_ink_pen" to "🔏",
"closed_lock_with_key" to "🔐",
"key" to "🔑",
"old_key" to "🗝️",
"hammer" to "🔨",
"axe" to "🪓",
"pick" to "⛏️",
"hammer_and_pick" to "⚒️",
"hammer_and_wrench" to "🛠️",
"dagger" to "🗡️",
"crossed_swords" to "⚔️",
"gun" to "🔫",
"boomerang" to "🪃",
"bow_and_arrow" to "🏹",
"shield" to "🛡️",
"carpentry_saw" to "🪚",
"wrench" to "🔧",
"screwdriver" to "🪛",
"nut_and_bolt" to "🔩",
"gear" to "⚙️",
"clamp" to "🗜️",
"balance_scale" to "⚖️",
"probing_cane" to "🦯",
"link" to "🔗",
"chains" to "⛓️",
"hook" to "🪝",
"toolbox" to "🧰",
"magnet" to "🧲",
"ladder" to "🪜",
"alembic" to "⚗️",
"test_tube" to "🧪",
"petri_dish" to "🧫",
"dna" to "🧬",
"microscope" to "🔬",
"telescope" to "🔭",
"satellite" to "📡",
"syringe" to "💉",
"drop_of_blood" to "🩸",
"pill" to "💊",
"adhesive_bandage" to "🩹",
"stethoscope" to "🩺",
"door" to "🚪",
"elevator" to "🛗",
"mirror" to "🪞",
"window" to "🪟",
"bed" to "🛏️",
"couch_and_lamp" to "🛋️",
"chair" to "🪑",
"toilet" to "🚽",
"plunger" to "🪠",
"shower" to "🚿",
"bathtub" to "🛁",
"mouse_trap" to "🪤",
"razor" to "🪒",
"lotion_bottle" to "🧴",
"safety_pin" to "🧷",
"broom" to "🧹",
"basket" to "🧺",
"roll_of_paper" to "🧻",
"bucket" to "🪣",
"soap" to "🧼",
"toothbrush" to "🪥",
"sponge" to "🧽",
"fire_extinguisher" to "🧯",
"shopping_cart" to "🛒",
"smoking" to "🚬",
"coffin" to "⚰️",
"headstone" to "🪦",
"funeral_urn" to "⚱️",
"moyai" to "🗿",
"placard" to "🪧",
"atm" to "🏧",
"put_litter_in_its_place" to "🚮",
"potable_water" to "🚰",
"wheelchair" to "♿",
"mens" to "🚹",
"womens" to "🚺",
"restroom" to "🚻",
"baby_symbol" to "🚼",
"wc" to "🚾",
"passport_control" to "🛂",
"customs" to "🛃",
"baggage_claim" to "🛄",
"left_luggage" to "🛅",
"warning" to "⚠️",
"children_crossing" to "🚸",
"no_entry" to "⛔",
"no_entry_sign" to "🚫",
"no_bicycles" to "🚳",
"no_smoking" to "🚭",
"do_not_litter" to "🚯",
"non-potable_water" to "🚱",
"no_pedestrians" to "🚷",
"no_mobile_phones" to "📵",
"underage" to "🔞",
"radioactive" to "☢️",
"biohazard" to "☣️",
"arrow_up" to "⬆️",
"arrow_upper_right" to "↗️",
"arrow_right" to "➡️",
"arrow_lower_right" to "↘️",
"arrow_down" to "⬇️",
"arrow_lower_left" to "↙️",
"arrow_left" to "⬅️",
"arrow_upper_left" to "↖️",
"arrow_up_down" to "↕️",
"left_right_arrow" to "↔️",
"leftwards_arrow_with_hook" to "↩️",
"arrow_right_hook" to "↪️",
"arrow_heading_up" to "⤴️",
"arrow_heading_down" to "⤵️",
"arrows_clockwise" to "🔃",
"arrows_counterclockwise" to "🔄",
"back" to "🔙",
"end" to "🔚",
"on" to "🔛",
"soon" to "🔜",
"top" to "🔝",
"place_of_worship" to "🛐",
"atom_symbol" to "⚛️",
"om" to "🕉️",
"star_of_david" to "✡️",
"wheel_of_dharma" to "☸️",
"yin_yang" to "☯️",
"latin_cross" to "✝️",
"orthodox_cross" to "☦️",
"star_and_crescent" to "☪️",
"peace_symbol" to "☮️",
"menorah" to "🕎",
"six_pointed_star" to "🔯",
"aries" to "♈",
"taurus" to "♉",
"gemini" to "♊",
"cancer" to "♋",
"leo" to "♌",
"virgo" to "♍",
"libra" to "♎",
"scorpius" to "♏",
"sagittarius" to "♐",
"capricorn" to "♑",
"aquarius" to "♒",
"pisces" to "♓",
"ophiuchus" to "⛎",
"twisted_rightwards_arrows" to "🔀",
"repeat" to "🔁",
"repeat_one" to "🔂",
"arrow_forward" to "▶️",
"fast_forward" to "⏩",
"next_track_button" to "⏭️",
"play_or_pause_button" to "⏯️",
"arrow_backward" to "◀️",
"rewind" to "⏪",
"previous_track_button" to "⏮️",
"arrow_up_small" to "🔼",
"arrow_double_up" to "⏫",
"arrow_down_small" to "🔽",
"arrow_double_down" to "⏬",
"pause_button" to "⏸️",
"stop_button" to "⏹️",
"record_button" to "⏺️",
"eject_button" to "⏏️",
"cinema" to "🎦",
"low_brightness" to "🔅",
"high_brightness" to "🔆",
"signal_strength" to "📶",
"vibration_mode" to "📳",
"mobile_phone_off" to "📴",
"female_sign" to "♀️",
"male_sign" to "♂️",
"transgender_symbol" to "⚧️",
"heavy_multiplication_x" to "✖️",
"heavy_plus_sign" to "➕",
"heavy_minus_sign" to "➖",
"heavy_division_sign" to "➗",
"infinity" to "♾️",
"bangbang" to "‼️",
"interrobang" to "⁉️",
"question" to "❓",
"grey_question" to "❔",
"grey_exclamation" to "❕",
"exclamation" to "❗",
"wavy_dash" to "〰️",
"currency_exchange" to "💱",
"heavy_dollar_sign" to "💲",
"medical_symbol" to "⚕️",
"recycle" to "♻️",
"fleur_de_lis" to "⚜️",
"trident" to "🔱",
"name_badge" to "📛",
"beginner" to "🔰",
"o" to "⭕",
"white_check_mark" to "✅",
"ballot_box_with_check" to "☑️",
"heavy_check_mark" to "✔️",
"x" to "❌",
"negative_squared_cross_mark" to "❎",
"curly_loop" to "➰",
"loop" to "➿",
"part_alternation_mark" to "〽️",
"eight_spoked_asterisk" to "✳️",
"eight_pointed_black_star" to "✴️",
"sparkle" to "❇️",
"copyright" to "©️",
"registered" to "®️",
"tm" to "™️",
"hash" to "#️⃣",
"asterisk" to "*️⃣",
"zero" to "0️⃣",
"one" to "1️⃣",
"two" to "2️⃣",
"three" to "3️⃣",
"four" to "4️⃣",
"five" to "5️⃣",
"six" to "6️⃣",
"seven" to "7️⃣",
"eight" to "8️⃣",
"nine" to "9️⃣",
"keycap_ten" to "🔟",
"capital_abcd" to "🔠",
"abcd" to "🔡",
"1234" to "🔢",
"symbols" to "🔣",
"abc" to "🔤",
"a" to "🅰️",
"ab" to "🆎",
"b" to "🅱️",
"cl" to "🆑",
"cool" to "🆒",
"free" to "🆓",
"information_source" to "ℹ️",
"id" to "🆔",
"m" to "Ⓜ️",
"new" to "🆕",
"ng" to "🆖",
"o2" to "🅾️",
"ok" to "🆗",
"parking" to "🅿️",
"sos" to "🆘",
"up" to "🆙",
"vs" to "🆚",
"koko" to "🈁",
"sa" to "🈂️",
"u6708" to "🈷️",
"u6709" to "🈶",
"u6307" to "🈯",
"ideograph_advantage" to "🉐",
"u5272" to "🈹",
"u7121" to "🈚",
"u7981" to "🈲",
"accept" to "🉑",
"u7533" to "🈸",
"u5408" to "🈴",
"u7a7a" to "🈳",
"congratulations" to "㊗️",
"secret" to "㊙️",
"u55b6" to "🈺",
"u6e80" to "🈵",
"red_circle" to "🔴",
"orange_circle" to "🟠",
"yellow_circle" to "🟡",
"green_circle" to "🟢",
"large_blue_circle" to "🔵",
"purple_circle" to "🟣",
"brown_circle" to "🟤",
"black_circle" to "⚫",
"white_circle" to "⚪",
"red_square" to "🟥",
"orange_square" to "🟧",
"yellow_square" to "🟨",
"green_square" to "🟩",
"blue_square" to "🟦",
"purple_square" to "🟪",
"brown_square" to "🟫",
"black_large_square" to "⬛",
"white_large_square" to "⬜",
"black_medium_square" to "◼️",
"white_medium_square" to "◻️",
"black_medium_small_square" to "◾",
"white_medium_small_square" to "◽",
"black_small_square" to "▪️",
"white_small_square" to "▫️",
"large_orange_diamond" to "🔶",
"large_blue_diamond" to "🔷",
"small_orange_diamond" to "🔸",
"small_blue_diamond" to "🔹",
"small_red_triangle" to "🔺",
"small_red_triangle_down" to "🔻",
"diamond_shape_with_a_dot_inside" to "💠",
"radio_button" to "🔘",
"white_square_button" to "🔳",
"black_square_button" to "🔲",
"checkered_flag" to "🏁",
"triangular_flag_on_post" to "🚩",
"crossed_flags" to "🎌",
"black_flag" to "🏴",
"white_flag" to "🏳️",
"rainbow_flag" to "🏳️🌈",
"transgender_flag" to "🏳️⚧️",
"pirate_flag" to "🏴☠️",
"ascension_island" to "🇦🇨",
"andorra" to "🇦🇩",
"united_arab_emirates" to "🇦🇪",
"afghanistan" to "🇦🇫",
"antigua_and_barbuda" to "🇦🇬",
"anguilla" to "🇦🇮",
"albania" to "🇦🇱",
"armenia" to "🇦🇲",
"angola" to "🇦🇴",
"antarctica" to "🇦🇶",
"argentina" to "🇦🇷",
"american_samoa" to "🇦🇸",
"austria" to "🇦🇹",
"australia" to "🇦🇺",
"aruba" to "🇦🇼",
"åland_islands" to "🇦🇽",
"azerbaijan" to "🇦🇿",
"bosnia_and_herzegovina" to "🇧🇦",
"barbados" to "🇧🇧",
"bangladesh" to "🇧🇩",
"belgium" to "🇧🇪",
"burkina_faso" to "🇧🇫",
"bulgaria" to "🇧🇬",
"bahrain" to "🇧🇭",
"burundi" to "🇧🇮",
"benin" to "🇧🇯",
"saint_barthélemy" to "🇧🇱",
"bermuda" to "🇧🇲",
"brunei" to "🇧🇳",
"bolivia" to "🇧🇴",
"caribbean_netherlands" to "🇧🇶",
"brazil" to "🇧🇷",
"bahamas" to "🇧🇸",
"bhutan" to "🇧🇹",
"bouvet_island" to "🇧🇻",
"botswana" to "🇧🇼",
"belarus" to "🇧🇾",
"belize" to "🇧🇿",
"canada" to "🇨🇦",
"cocos_keeling_islands" to "🇨🇨",
"democratic_republic_of_the_congo" to "🇨🇩",
"central_african_republic" to "🇨🇫",
"republic_of_the_congo" to "🇨🇬",
"switzerland" to "🇨🇭",
"côte_d'ivoire" to "🇨🇮",
"cook_islands" to "🇨🇰",
"chile" to "🇨🇱",
"cameroon" to "🇨🇲",
"china" to "🇨🇳",
"colombia" to "🇨🇴",
"clipperton_island" to "🇨🇵",
"costa_rica" to "🇨🇷",
"cuba" to "🇨🇺",
"cabo_verde" to "🇨🇻",
"curaçao" to "🇨🇼",
"christmas_island" to "🇨🇽",
"cyprus" to "🇨🇾",
"czechia" to "🇨🇿",
"germany" to "🇩🇪",
"diego_garcia" to "🇩🇬",
"djibouti" to "🇩🇯",
"denmark" to "🇩🇰",
"dominica" to "🇩🇲",
"dominican_republic" to "🇩🇴",
"algeria" to "🇩🇿",
"ceuta_melilla" to "🇪🇦",
"ecuador" to "🇪🇨",
"estonia" to "🇪🇪",
"egypt" to "🇪🇬",
"western_sahara" to "🇪🇭",
"eritrea" to "🇪🇷",
"spain" to "🇪🇸",
"ethiopia" to "🇪🇹",
"eu" to "🇪🇺",
"finland" to "🇫🇮",
"fiji" to "🇫🇯",
"falkland_islands" to "🇫🇰",
"federated_states_of_micronesia" to "🇫🇲",
"faroe_islands" to "🇫🇴",
"france" to "🇫🇷",
"gabon" to "🇬🇦",
"united_kingdom" to "🇬🇧",
"grenada" to "🇬🇩",
"georgia" to "🇬🇪",
"french_guiana" to "🇬🇫",
"guernsey" to "🇬🇬",
"ghana" to "🇬🇭",
"gibraltar" to "🇬🇮",
"greenland" to "🇬🇱",
"gambia" to "🇬🇲",
"guinea" to "🇬🇳",
"guadeloupe" to "🇬🇵",
"equatorial_guinea" to "🇬🇶",
"greece" to "🇬🇷",
"south_georgia_south_sandwich_islands" to "🇬🇸",
"guatemala" to "🇬🇹",
"guam" to "🇬🇺",
"guinea_bissau" to "🇬🇼",
"guyana" to "🇬🇾",
"hong_kong" to "🇭🇰",
"heard_island_and_mcdonald_islands" to "🇭🇲",
"honduras" to "🇭🇳",
"croatia" to "🇭🇷",
"haiti" to "🇭🇹",
"hungary" to "🇭🇺",
"canary_islands" to "🇮🇨",
"indonesia" to "🇮🇩",
"ireland" to "🇮🇪",
"israel" to "🇮🇱",
"isle_of_man" to "🇮🇲",
"india" to "🇮🇳",
"british_indian_ocean_territory" to "🇮🇴",
"iraq" to "🇮🇶",
"iran" to "🇮🇷",
"iceland" to "🇮🇸",
"italy" to "🇮🇹",
"jersey" to "🇯🇪",
"jamaica" to "🇯🇲",
"jordan" to "🇯🇴",
"jp" to "🇯🇵",
"kenya" to "🇰🇪",
"kyrgyzstan" to "🇰🇬",
"cambodia" to "🇰🇭",
"kiribati" to "🇰🇮",
"comoros" to "🇰🇲",
"saint_kitts_and_nevis" to "🇰🇳",
"north_korea" to "🇰🇵",
"south_korea" to "🇰🇷",
"kuwait" to "🇰🇼",
"cayman_islands" to "🇰🇾",
"kazakhstan" to "🇰🇿",
"laos" to "🇱🇦",
"lebanon" to "🇱🇧",
"saint_lucia" to "🇱🇨",
"liechtenstein" to "🇱🇮",
"sri_lanka" to "🇱🇰",
"liberia" to "🇱🇷",
"lesotho" to "🇱🇸",
"lithuania" to "🇱🇹",
"luxembourg" to "🇱🇺",
"latvia" to "🇱🇻",
"libya" to "🇱🇾",
"morocco" to "🇲🇦",
"monaco" to "🇲🇨",
"moldova" to "🇲🇩",
"montenegro" to "🇲🇪",
"saint_martin" to "🇲🇫",
"madagascar" to "🇲🇬",
"marshall_islands" to "🇲🇭",
"north_macedonia" to "🇲🇰",
"mali" to "🇲🇱",
"myanmar" to "🇲🇲",
"mongolia" to "🇲🇳",
"macau" to "🇲🇴",
"northern_mariana_islands" to "🇲🇵",
"martinique" to "🇲🇶",
"mauritania" to "🇲🇷",
"montserrat" to "🇲🇸",
"malta" to "🇲🇹",
"mauritius" to "🇲🇺",
"maldives" to "🇲🇻",
"malawi" to "🇲🇼",
"mexico" to "🇲🇽",
"malaysia" to "🇲🇾",
"mozambique" to "🇲🇿",
"namibia" to "🇳🇦",
"new_caledonia" to "🇳🇨",
"niger" to "🇳🇪",
"norfolk_island" to "🇳🇫",
"nigeria" to "🇳🇬",
"nicaragua" to "🇳🇮",
"netherlands" to "🇳🇱",
"norway" to "🇳🇴",
"nepal" to "🇳🇵",
"nauru" to "🇳🇷",
"niue" to "🇳🇺",
"new_zealand" to "🇳🇿",
"oman" to "🇴🇲",
"panama" to "🇵🇦",
"peru" to "🇵🇪",
"french_polynesia" to "🇵🇫",
"papua_new_guinea" to "🇵🇬",
"philippines" to "🇵🇭",
"pakistan" to "🇵🇰",
"poland" to "🇵🇱",
"saint_pierre_and_miquelon" to "🇵🇲",
"pitcairn_islands" to "🇵🇳",
"puerto_rico" to "🇵🇷",
"palestinian_territories" to "🇵🇸",
"portugal" to "🇵🇹",
"palau" to "🇵🇼",
"paraguay" to "🇵🇾",
"qatar" to "🇶🇦",
"réunion" to "🇷🇪",
"romania" to "🇷🇴",
"serbia" to "🇷🇸",
"russia" to "🇷🇺",
"rwanda" to "🇷🇼",
"saudi_arabia" to "🇸🇦",
"solomon_islands" to "🇸🇧",
"seychelles" to "🇸🇨",
"sudan" to "🇸🇩",
"sweden" to "🇸🇪",
"singapore" to "🇸🇬",
"saint_helena" to "🇸🇭",
"slovenia" to "🇸🇮",
"svalbard_and_jan_mayen" to "🇸🇯",
"slovakia" to "🇸🇰",
"sierra_leone" to "🇸🇱",
"san_marino" to "🇸🇲",
"senegal" to "🇸🇳",
"somalia" to "🇸🇴",
"suriname" to "🇸🇷",
"south_sudan" to "🇸🇸",
"são_tomé_and_príncipe" to "🇸🇹",
"el_salvador" to "🇸🇻",
"sint_maarten" to "🇸🇽",
"syria" to "🇸🇾",
"eswatini" to "🇸🇿",
"tristan_da_cunha" to "🇹🇦",
"turks_and_caicos_islands" to "🇹🇨",
"chad" to "🇹🇩",
"french_southern_and_antarctic_lands" to "🇹🇫",
"togo" to "🇹🇬",
"thailand" to "🇹🇭",
"tajikistan" to "🇹🇯",
"tokelau" to "🇹🇰",
"timor_leste" to "🇹🇱",
"turkmenistan" to "🇹🇲",
"tunisia" to "🇹🇳",
"tonga" to "🇹🇴",
"tr" to "🇹🇷",
"trinidad_and_tobago" to "🇹🇹",
"tuvalu" to "🇹🇻",
"taiwan" to "🇹🇼",
"tanzania" to "🇹🇿",
"ukraine" to "🇺🇦",
"uganda" to "🇺🇬",
"united_states_minor_outlying_islands" to "🇺🇲",
"united_nations" to "🇺🇳",
"united_states" to "🇺🇸",
"uruguay" to "🇺🇾",
"uzbekistan" to "🇺🇿",
"vatican_city" to "🇻🇦",
"saint_vincent_and_the_grenadines" to "🇻🇨",
"venezuela" to "🇻🇪",
"british_virgin_islands" to "🇻🇬",
"u.s._virgin_islands" to "🇻🇮",
"vietnam" to "🇻🇳",
"vanuatu" to "🇻🇺",
"wallis_and_futuna" to "🇼🇫",
"samoa" to "🇼🇸",
"kosovo" to "🇽🇰",
"yemen" to "🇾🇪",
"mayotte" to "🇾🇹",
"south_africa" to "🇿🇦",
"zambia" to "🇿🇲",
"zimbabwe" to "🇿🇼",
"england" to "🏴",
"scotland" to "🏴",
"wales" to "🏴",
)
}
| 2 | null | 17 | 9 | fb671fc1e2c628fb467bca9d3109799b3e1d43f2 | 54,107 | masrofy | Apache License 2.0 |
app/src/main/java/com/hashcode/unfinger/Activities/ReviewActivity.kt | vaginessa | 128,424,096 | true | {"Java Properties": 3, "Shell": 1, "Batchfile": 1, "Proguard": 1, "Java": 5, "Kotlin": 2} | package com.hashcode.unfinger.Activities
import android.app.Activity
import android.app.ProgressDialog
import android.content.Context
import android.net.ConnectivityManager
import android.net.NetworkInfo
import android.os.Bundle
import android.support.design.widget.FloatingActionButton
import android.support.design.widget.Snackbar
import android.support.v7.app.AppCompatActivity
import android.support.v7.widget.Toolbar
import android.view.MenuItem
import android.widget.EditText
import com.google.firebase.database.DatabaseError
import com.google.firebase.database.DatabaseReference
import com.google.firebase.database.FirebaseDatabase
import com.hashcode.unfinger.R
import com.hashcode.unfinger.models.Review
class ReviewActivity : AppCompatActivity() {
lateinit var reviewEditText : EditText
lateinit var nameEditText : EditText
lateinit var mFirebaseDatabase : DatabaseReference
var REVIEWS_KEY = "reviews"
val REVIEW_STORE = "review store"
val NAME_STORE = "username"
lateinit var progressBar : ProgressDialog
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_review)
val toolbar : Toolbar = findViewById(R.id.toolbar)
setSupportActionBar(toolbar)
supportActionBar!!.setDisplayHomeAsUpEnabled(true)
supportActionBar!!.setHomeButtonEnabled(true)
supportActionBar!!.title = "Submit A Review"
mFirebaseDatabase = FirebaseDatabase.getInstance().reference
val fab : FloatingActionButton = findViewById(R.id.send_review_button)
reviewEditText = findViewById(R.id.review_edit_text)
nameEditText = findViewById(R.id.reviewer_name_edit_text)
if (savedInstanceState != null){
nameEditText.setText(savedInstanceState.getString(NAME_STORE))
reviewEditText.setText(savedInstanceState.getString(REVIEW_STORE))
}
var review : Review
fab.setOnClickListener { view ->
if(isOnline(this)){
if(reviewValid() && nameValid()){
progressBar.show()
review = Review(nameEditText.text.toString(),reviewEditText.text.toString())
mFirebaseDatabase.child(REVIEWS_KEY).push().setValue(review, {
databaseError: DatabaseError?, databaseReference: DatabaseReference? ->
if (databaseError == null){
progressBar.cancel()
Snackbar.make(view, "Thank you for your review", Snackbar.LENGTH_LONG)
.setAction("Action", null).show()
}
})
}
}
else{
Snackbar.make(view, "No Internet Connection", Snackbar.LENGTH_LONG)
.setAction("Action", null).show()
}
}
supportActionBar!!.setDisplayHomeAsUpEnabled(true)
progressBar = ProgressDialog(this)
progressBar.setMessage("Submitting Review")
progressBar.setProgressStyle(ProgressDialog.STYLE_SPINNER)
progressBar.isIndeterminate = true
progressBar.progress = 0
}
fun reviewValid() : Boolean{
var reviewText = reviewEditText.text.toString()
if(reviewText.length < 3) {
reviewEditText.error = "too short"
return false
}
else{ return true}
}
fun nameValid() : Boolean {
var name = nameEditText.text.toString()
if(name.length == 0){
nameEditText.error = "Enter your name"
return false
}
else{
return true
}
}
override fun onSaveInstanceState(outState: Bundle?) {
super.onSaveInstanceState(outState)
outState?.putString(NAME_STORE, nameEditText.text.toString())
outState?.putString(REVIEW_STORE, reviewEditText.text.toString())
}
fun isOnline(context: Context): Boolean {
val connectivityManager = context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
return connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE).state == NetworkInfo.State.CONNECTED || connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI).state == NetworkInfo.State.CONNECTED
}
override fun onOptionsItemSelected(item: MenuItem?): Boolean {
return super.onOptionsItemSelected(item)
var id = item!!.itemId
if(id == R.id.home){
onBackPressed()
}
}
}
| 1 | Java | 0 | 0 | 11f763c0a108327b31771872b8ff46564e51999a | 4,603 | Unfinger | Apache License 2.0 |
app/src/main/java/com/melody/text/effect/components/GesturesExtensions.kt | TheMelody | 533,360,294 | false | null | package com.github.rwsbillyang.composedemo.demo2
import androidx.compose.foundation.gestures.awaitFirstDown
import androidx.compose.foundation.gestures.forEachGesture
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.input.pointer.PointerEvent
import androidx.compose.ui.input.pointer.PointerInputScope
import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
/**
* GesturesExtensions
* @author TheMelody
* email <EMAIL>
* created 2022/9/6 21:44
*/
internal suspend fun PointerInputScope.detectTouchGestures(
onDown: ((Offset) -> Unit),
onMove: ((Offset) -> Unit),
onUp: (Offset) -> Unit
): Unit = coroutineScope {
launch {
forEachGesture {
awaitPointerEventScope {
val down = awaitFirstDown().also { it.consume() }
// ACTION_DOWN
onDown.invoke(down.position)
var pointer = down
var pointerId = down.id
// 第一次触摸后添加延迟
var waitedAfterDown = false
launch {
delay(16)
waitedAfterDown = true
}
while (true) {
val event: PointerEvent = awaitPointerEvent()
if (event.changes.any { it.pressed }) {
val pointerInputChange =
event.changes.firstOrNull { it.id == pointerId }
?: event.changes.first()
pointerId = pointerInputChange.id
pointer = pointerInputChange
if (waitedAfterDown) {
// ACTION_MOVE
onMove(pointer.position)
}
} else {
// ACTION_UP
onUp.invoke(pointer.position)
break
}
}
}
}
}
} | 1 | null | 4 | 9 | 6703ebc4ec1cd1a24331ec9cdacde2744173376f | 2,030 | ComposeTextEffect | Apache License 2.0 |
fluent-icons-extended/src/commonMain/kotlin/com/konyaco/fluent/icons/filled/CallForward.kt | Konyaco | 574,321,009 | false | null |
package com.konyaco.fluent.icons.filled
import androidx.compose.ui.graphics.vector.ImageVector
import com.konyaco.fluent.icons.Icons
import com.konyaco.fluent.icons.fluentIcon
import com.konyaco.fluent.icons.fluentPath
public val Icons.Filled.CallForward: ImageVector
get() {
if (_callForward != null) {
return _callForward!!
}
_callForward = fluentIcon(name = "Filled.CallForward") {
fluentPath {
moveToRelative(9.93f, 2.05f)
lineToRelative(1.03f, 0.2f)
curveToRelative(0.97f, 0.18f, 1.63f, 1.1f, 1.53f, 2.12f)
lineToRelative(-0.2f, 2.05f)
curveToRelative(-0.09f, 0.89f, -0.72f, 1.65f, -1.57f, 1.88f)
lineToRelative(-2.35f, 0.63f)
arcToRelative(8.1f, 8.1f, 0.0f, false, false, 0.18f, 6.23f)
lineToRelative(2.2f, 0.4f)
arcToRelative(1.9f, 1.9f, 0.0f, false, true, 1.55f, 1.7f)
lineToRelative(0.2f, 2.04f)
arcToRelative(2.17f, 2.17f, 0.0f, false, true, -1.5f, 2.28f)
lineToRelative(-1.04f, 0.3f)
curveToRelative(-1.04f, 0.32f, -2.12f, 0.04f, -2.85f, -0.71f)
curveToRelative(-1.74f, -1.78f, -2.6f, -4.75f, -2.61f, -8.91f)
curveToRelative(0.0f, -4.17f, 0.86f, -7.23f, 2.59f, -9.2f)
arcToRelative(3.05f, 3.05f, 0.0f, false, true, 2.84f, -1.01f)
close()
moveTo(16.7f, 7.15f)
lineTo(16.78f, 7.22f)
lineTo(20.78f, 11.22f)
curveToRelative(0.26f, 0.26f, 0.29f, 0.68f, 0.07f, 0.97f)
lineToRelative(-0.07f, 0.09f)
lineToRelative(-4.0f, 4.0f)
arcToRelative(0.75f, 0.75f, 0.0f, false, true, -1.13f, -0.97f)
lineToRelative(0.07f, -0.09f)
lineToRelative(2.71f, -2.72f)
lineTo(12.0f, 12.5f)
arcToRelative(0.75f, 0.75f, 0.0f, false, true, -0.74f, -0.64f)
verticalLineToRelative(-0.1f)
curveToRelative(0.0f, -0.39f, 0.27f, -0.7f, 0.64f, -0.75f)
horizontalLineToRelative(6.54f)
lineToRelative(-2.72f, -2.73f)
arcToRelative(0.75f, 0.75f, 0.0f, false, true, -0.07f, -0.98f)
lineToRelative(0.07f, -0.08f)
curveToRelative(0.24f, -0.24f, 0.6f, -0.28f, 0.87f, -0.14f)
lineToRelative(0.1f, 0.07f)
close()
}
}
return _callForward!!
}
private var _callForward: ImageVector? = null
| 1 | Kotlin | 3 | 83 | 9e86d93bf1f9ca63a93a913c990e95f13d8ede5a | 2,634 | compose-fluent-ui | Apache License 2.0 |
presentation/src/main/java/com/study/bamboo/view/admin/dialog/RejectCancelDialog.kt | joog-lim | 382,022,630 | false | null | package com.study.bamboo.view.admin.dialog
import android.view.View
import android.widget.Toast
import androidx.fragment.app.viewModels
import androidx.lifecycle.lifecycleScope
import androidx.navigation.fragment.findNavController
import androidx.navigation.fragment.navArgs
import com.study.bamboo.R
import com.study.bamboo.adapter.STATUS
import com.study.bamboo.databinding.RejectCancelDialogBinding
import com.study.bamboo.utils.setNavResult
import com.study.bamboo.view.admin.AdminViewModel
import com.study.bamboo.view.admin.AuthViewModel
import com.study.base.base.base.BaseDialogFragment
import com.study.domain.model.admin.request.SetStatusEntity
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.launch
@AndroidEntryPoint
class RejectCancelDialog :
BaseDialogFragment<RejectCancelDialogBinding>(R.layout.reject_cancel_dialog) {
private val args by navArgs<RejectCancelDialogArgs>()
private val viewModel: AdminViewModel by viewModels()
private val authViewModel: AuthViewModel by viewModels()
override fun RejectCancelDialogBinding.onCreateView() {
binding.dialog = this@RejectCancelDialog
}
override fun RejectCancelDialogBinding.onViewCreated() {
with(viewModel) {
isSuccess.observe(viewLifecycleOwner) {
setNavResult(data = STATUS.ACCEPTED)
findNavController().popBackStack()
}
isLoading.observe(viewLifecycleOwner) {
if (it) {
binding.progressBar.visibility = View.VISIBLE
} else {
binding.progressBar.visibility = View.GONE
}
}
isFailure.observe(viewLifecycleOwner) {
Toast.makeText(requireContext(), it, Toast.LENGTH_SHORT).show()
}
}
}
fun rejectDialog() {
lifecycleScope.launch {
viewModel.patchPost(
authViewModel.getToken(),
args.result.idx,
SetStatusEntity(STATUS.ACCEPTED.toString(), binding.reasonText.text.toString()),
)
}
}
} | 2 | Kotlin | 0 | 8 | 13d892f3f867c1c3b064cac61d7a4f1fe9290280 | 2,147 | bamboo-android | Apache License 2.0 |
app/src/main/java/dev/jatzuk/mvvmrunning/other/MapLifecycleObserver.kt | jatzuk | 282,022,393 | false | null | package dev.jatzuk.mvvmrunning.other
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleObserver
import androidx.lifecycle.OnLifecycleEvent
import com.google.android.gms.maps.MapView
class MapLifecycleObserver(
private val mapView: MapView?,
lifecycle: Lifecycle
) : LifecycleObserver {
init {
lifecycle.addObserver(this)
}
@OnLifecycleEvent(Lifecycle.Event.ON_START)
fun onStart() {
mapView?.onStart()
}
@OnLifecycleEvent(Lifecycle.Event.ON_RESUME)
fun onResume() {
mapView?.onResume()
}
@OnLifecycleEvent(Lifecycle.Event.ON_PAUSE)
fun onPause() {
mapView?.onPause()
}
@OnLifecycleEvent(Lifecycle.Event.ON_STOP)
fun onStop() {
mapView?.onStop()
}
}
| 0 | Kotlin | 1 | 7 | a1388974902dad0f9e407e6f640887b319b7bc37 | 782 | MVVM-Running | Apache License 2.0 |
rounded/src/commonMain/kotlin/me/localx/icons/rounded/filled/FilePsd.kt | localhostov | 808,861,591 | false | {"Kotlin": 79430321, "HTML": 331, "CSS": 102} | package me.localx.icons.rounded.filled
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.PathFillType
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.graphics.StrokeCap
import androidx.compose.ui.graphics.StrokeCap.Companion.Butt
import androidx.compose.ui.graphics.StrokeJoin
import androidx.compose.ui.graphics.StrokeJoin.Companion.Miter
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp
import me.localx.icons.rounded.Icons
public val Icons.Filled.FilePsd: ImageVector
get() {
if (_filePsd != null) {
return _filePsd!!
}
_filePsd = Builder(name = "FilePsd", defaultWidth = 512.0.dp, defaultHeight = 512.0.dp,
viewportWidth = 512.001f, viewportHeight = 512.001f).apply {
path(fill = SolidColor(Color(0xFF000000)), stroke = null, strokeLineWidth = 0.0f,
strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = 4.0f,
pathFillType = NonZero) {
moveTo(132.373f, 123.605f)
horizontalLineToRelative(-17.877f)
lineToRelative(0.128f, 36.779f)
horizontalLineToRelative(17.749f)
curveToRelative(10.133f, 0.005f, 18.351f, -8.205f, 18.356f, -18.338f)
reflectiveCurveToRelative(-8.205f, -18.351f, -18.338f, -18.356f)
curveToRelative(-0.006f, 0.0f, -0.012f, 0.0f, -0.018f, 0.0f)
verticalLineTo(123.605f)
close()
}
path(fill = SolidColor(Color(0xFF000000)), stroke = null, strokeLineWidth = 0.0f,
strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = 4.0f,
pathFillType = NonZero) {
moveTo(363.051f, 125.269f)
horizontalLineTo(345.6f)
verticalLineToRelative(82.197f)
curveToRelative(6.528f, 0.0f, 13.845f, 0.0f, 18.005f, -0.192f)
curveToRelative(20.715f, -0.341f, 29.973f, -20.779f, 29.973f, -40.875f)
reflectiveCurveTo(385.643f, 125.269f, 363.051f, 125.269f)
close()
}
path(fill = SolidColor(Color(0xFF000000)), stroke = null, strokeLineWidth = 0.0f,
strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = 4.0f,
pathFillType = NonZero) {
moveTo(384.0f, 405.333f)
verticalLineToRelative(96.853f)
curveToRelative(19.734f, -7.452f, 37.66f, -19.015f, 52.587f, -33.92f)
lineToRelative(31.659f, -31.68f)
curveToRelative(14.923f, -14.917f, 26.494f, -32.844f, 33.941f, -52.587f)
horizontalLineToRelative(-96.853f)
curveTo(393.551f, 384.0f, 384.0f, 393.551f, 384.0f, 405.333f)
close()
}
path(fill = SolidColor(Color(0xFF000000)), stroke = null, strokeLineWidth = 0.0f,
strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = 4.0f,
pathFillType = NonZero) {
moveTo(405.333f, 0.0f)
horizontalLineTo(106.667f)
curveTo(47.786f, 0.071f, 0.071f, 47.786f, 0.0f, 106.667f)
verticalLineToRelative(298.667f)
curveTo(0.071f, 464.214f, 47.786f, 511.93f, 106.667f, 512.0f)
horizontalLineToRelative(224.32f)
curveToRelative(3.477f, 0.0f, 6.912f, -0.277f, 10.347f, -0.512f)
verticalLineTo(405.333f)
curveToRelative(0.0f, -35.346f, 28.654f, -64.0f, 64.0f, -64.0f)
horizontalLineToRelative(106.155f)
curveToRelative(0.235f, -3.435f, 0.512f, -6.869f, 0.512f, -10.347f)
verticalLineToRelative(-224.32f)
curveTo(511.93f, 47.786f, 464.214f, 0.071f, 405.333f, 0.0f)
close()
moveTo(100.992f, 96.939f)
horizontalLineToRelative(31.381f)
curveToRelative(24.86f, 0.0f, 45.013f, 20.153f, 45.013f, 45.013f)
reflectiveCurveToRelative(-20.153f, 45.013f, -45.013f, 45.013f)
horizontalLineToRelative(-17.92f)
verticalLineToRelative(35.477f)
curveToRelative(0.0f, 7.364f, -5.97f, 13.333f, -13.333f, 13.333f)
reflectiveCurveToRelative(-13.333f, -5.97f, -13.333f, -13.333f)
verticalLineToRelative(-112.17f)
curveToRelative(-0.039f, -0.769f, -0.207f, -5.839f, 3.818f, -9.756f)
curveTo(95.433f, 96.791f, 100.184f, 96.906f, 100.992f, 96.939f)
close()
moveTo(290.795f, 200.533f)
curveToRelative(-4.945f, 21.475f, -24.536f, 36.343f, -46.549f, 35.328f)
curveToRelative(-18.564f, 0.114f, -36.339f, -7.499f, -49.067f, -21.013f)
curveToRelative(-4.902f, -5.495f, -4.421f, -13.924f, 1.075f, -18.826f)
curveToRelative(0.004f, -0.004f, 0.009f, -0.008f, 0.013f, -0.012f)
curveToRelative(4.452f, -4.187f, 11.242f, -4.642f, 16.213f, -1.088f)
curveToRelative(0.341f, 0.235f, 2.133f, 1.643f, 2.709f, 2.133f)
curveToRelative(5.316f, 4.647f, 11.451f, 8.264f, 18.091f, 10.667f)
curveToRelative(6.823f, 2.02f, 14.118f, 1.757f, 20.779f, -0.747f)
curveToRelative(4.379f, -1.313f, 7.95f, -4.501f, 9.749f, -8.704f)
curveToRelative(1.379f, -4.387f, 0.146f, -9.176f, -3.179f, -12.352f)
curveToRelative(-2.97f, -2.672f, -6.475f, -4.679f, -10.283f, -5.888f)
curveToRelative(-8.853f, -3.243f, -17.579f, -6.72f, -26.304f, -10.304f)
curveToRelative(-8.337f, -2.896f, -15.524f, -8.392f, -20.501f, -15.68f)
curveToRelative(-4.411f, -6.976f, -6.182f, -15.299f, -4.992f, -23.467f)
curveToRelative(0.652f, -4.541f, 2.15f, -8.919f, 4.416f, -12.907f)
curveToRelative(4.832f, -8.407f, 12.643f, -14.696f, 21.888f, -17.621f)
curveToRelative(17.502f, -4.653f, 36.139f, -2.11f, 51.755f, 7.061f)
curveToRelative(3.488f, 1.75f, 6.475f, 4.356f, 8.683f, 7.573f)
curveToRelative(3.341f, 4.796f, 3.061f, 11.234f, -0.683f, 15.723f)
curveToRelative(-5.056f, 5.973f, -12.459f, 4.267f, -18.731f, 1.579f)
curveToRelative(-5.699f, -2.533f, -11.54f, -4.734f, -17.493f, -6.592f)
curveToRelative(-4.138f, -1.526f, -8.548f, -2.173f, -12.949f, -1.899f)
curveToRelative(-4.469f, 0.341f, -8.434f, 2.996f, -10.453f, 6.997f)
curveToRelative(-1.607f, 4.646f, -0.347f, 9.803f, 3.221f, 13.184f)
curveToRelative(3.565f, 3.244f, 7.946f, 5.456f, 12.672f, 6.4f)
curveToRelative(5.952f, 1.557f, 11.989f, 2.645f, 17.813f, 4.629f)
curveToRelative(7.113f, 2.392f, 13.682f, 6.17f, 19.328f, 11.115f)
curveTo(288.049f, 174.365f, 292.894f, 187.525f, 290.795f, 200.533f)
lineTo(290.795f, 200.533f)
close()
moveTo(364.16f, 233.941f)
curveToRelative(-8.832f, 0.171f, -31.701f, 0.256f, -31.701f, 0.256f)
lineToRelative(0.0f, 0.0f)
curveToRelative(-7.347f, 0.0f, -13.31f, -5.944f, -13.333f, -13.291f)
lineToRelative(-0.235f, -108.927f)
curveToRelative(0.0f, -7.371f, 5.963f, -13.352f, 13.333f, -13.376f)
horizontalLineToRelative(30.869f)
curveToRelative(34.219f, 0.0f, 57.173f, 27.264f, 57.173f, 67.797f)
curveTo(420.267f, 204.971f, 396.8f, 233.387f, 364.16f, 233.941f)
close()
}
}
.build()
return _filePsd!!
}
private var _filePsd: ImageVector? = null
| 1 | Kotlin | 0 | 5 | cbd8b510fca0e5e40e95498834f23ec73cc8f245 | 8,117 | icons | MIT License |
app/src/test/java/org/simple/clinic/security/pin/PinEntryUpdateTest.kt | exp-devops | 285,629,460 | true | {"Kotlin": 3801097, "Shell": 3616, "Python": 3162} | package org.simple.clinic.security.pin
import com.spotify.mobius.test.NextMatchers.hasEffects
import com.spotify.mobius.test.NextMatchers.hasNoModel
import com.spotify.mobius.test.UpdateSpec
import com.spotify.mobius.test.UpdateSpec.assertThatNext
import org.junit.Test
import org.simple.clinic.security.pin.verification.PinVerificationMethod.VerificationResult.NetworkError
import org.simple.clinic.security.pin.verification.PinVerificationMethod.VerificationResult.OtherError
import org.simple.clinic.security.pin.verification.PinVerificationMethod.VerificationResult.ServerError
class PinEntryUpdateTest {
private val spec = UpdateSpec(PinEntryUpdate(submitPinAtLength = 4))
private val defaultModel = PinEntryModel.default()
@Test
fun `when the PIN verification fails with a network error, show the network error message`() {
val model = defaultModel.enteredPinChanged("1234")
spec
.given(model)
.whenEvent(PinVerified(NetworkError))
.then(
assertThatNext(
hasNoModel(),
hasEffects(ShowNetworkError, AllowPinEntry)
)
)
}
@Test
fun `when the PIN verification fails with a server error, show the server error message`() {
val model = defaultModel.enteredPinChanged("1234")
spec
.given(model)
.whenEvent(PinVerified(ServerError))
.then(
assertThatNext(
hasNoModel(),
hasEffects(ShowServerError, AllowPinEntry)
)
)
}
@Test
fun `when the PIN verification fails with any other error, show the generic error message`() {
val model = defaultModel.enteredPinChanged("1234")
spec
.given(model)
.whenEvent(PinVerified(OtherError(RuntimeException())))
.then(
assertThatNext(
hasNoModel(),
hasEffects(ShowUnexpectedError, AllowPinEntry)
)
)
}
}
| 0 | null | 0 | 0 | 3dbd6b23ae510164c0eed4a12769d48f4244e62b | 1,956 | simple-android | MIT License |
src/com/company/Main.kt | olegstabr | 105,130,126 | false | null | package com.company
fun main(args: Array<String>) {
val vk = VK()
val tokenFrame = TokenFrame()
} | 0 | Kotlin | 0 | 0 | 63988db4902f5eb7e57820482a802c1ab5716c63 | 106 | VKGroupInvite | Apache License 2.0 |
src/main/kotlin/com/emberjs/glint/GlintHBSupressErrorFix.kt | patricklx | 412,986,421 | false | {"Kotlin": 637340, "JavaScript": 31431, "HTML": 8237, "Handlebars": 2507, "Java": 207, "Scala": 172, "CSS": 144, "SCSS": 96} | package com.emberjs.glint
import com.dmarcotte.handlebars.psi.HbPsiFile
import com.emberjs.utils.ifTrue
import com.intellij.application.options.CodeStyle
import com.intellij.codeInsight.intention.LowPriorityAction
import com.intellij.codeInsight.intention.impl.BaseIntentionAction
import com.intellij.lang.typescript.compiler.languageService.codeFixes.TypeScriptServiceRelatedAction
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.project.Project
import com.intellij.openapi.util.TextRange
import com.intellij.openapi.util.text.StringUtil
import com.intellij.psi.PsiFile
import com.intellij.psi.util.PsiUtilCore
class GlintHBSupressErrorFix(val type: String) : BaseIntentionAction(), LowPriorityAction, TypeScriptServiceRelatedAction {
override fun getFamilyName(): String {
return "supress with @glint-$type"
}
override fun getText(): String {
return familyName
}
override fun isAvailable(project: Project, editor: Editor, file: PsiFile): Boolean {
return file is HbPsiFile
}
override fun invoke(project: Project, editor: Editor, file: PsiFile) {
val offset = editor.caretModel.offset
val element = PsiUtilCore.getElementAtOffset(file, offset)
if (element !is PsiFile) {
val ignore = (type == "ignore").ifTrue { "@glint-ignore" } ?: (type == "expect").ifTrue { "@glint-expect-error" } ?: (type == "no-check").ifTrue { "@glint-nocheck" }
val comment = "{{! $ignore }}"
val document = editor.document
val sep = file.virtualFile?.detectedLineSeparator ?: StringUtil.detectSeparators(document.text) ?: CodeStyle.getProjectOrDefaultSettings(project).lineSeparator
if (type == "no-check") {
document.setText(document.text.replaceRange(0, 0, "$comment$sep"))
return
}
val line = document.getLineNumber(offset)
val startOffset = document.getLineStartOffset(line)
val textRange = TextRange(startOffset, document.getLineEndOffset(line))
val lineText = document.getText(textRange)
val whitespace = " ".repeat(lineText.indexOfFirst { it != ' ' })
document.setText(document.text.replaceRange(startOffset, startOffset, "$whitespace$comment$sep"))
}
}
override fun getIndex(): Int {
return Int.MAX_VALUE
}
}
| 4 | Kotlin | 4 | 9 | 9400ac33a967419b0c28d938a881b7e1aaea13be | 2,403 | intellij-emberjs-experimental | Apache License 2.0 |
src/test/kotlin/com/hogwai/bananesexportkata/controller/OrderControllerTest.kt | Hogwai | 651,528,744 | false | null | package com.hogwai.bananesexportkata.controller
import com.fasterxml.jackson.databind.json.JsonMapper
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule
import com.hogwai.bananesexportkata.model.Order
import com.hogwai.bananesexportkata.model.Recipient
import com.hogwai.bananesexportkata.request.OrderRequest
import com.hogwai.bananesexportkata.service.OrderService
import com.hogwai.bananesexportkata.service.RecipientService
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.mockito.InjectMocks
import org.mockito.Mock
import org.mockito.Mockito.*
import org.mockito.MockitoAnnotations
import org.springframework.http.MediaType
import org.springframework.test.web.servlet.MockMvc
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*
import org.springframework.test.web.servlet.result.MockMvcResultMatchers.content
import org.springframework.test.web.servlet.result.MockMvcResultMatchers.status
import org.springframework.test.web.servlet.setup.MockMvcBuilders
import java.time.LocalDate
class OrderControllerTest {
@Mock
private lateinit var orderService: OrderService
@Mock
private lateinit var recipientService: RecipientService
@InjectMocks
private lateinit var orderController: OrderController
private lateinit var mockMvc: MockMvc
private val objectMapper = JsonMapper.builder().addModule(JavaTimeModule()).build()
@BeforeEach
fun setup() {
MockitoAnnotations.openMocks(this)
mockMvc = MockMvcBuilders.standaloneSetup(orderController).build()
}
private fun createRecipientWithId(
id: Long
): Recipient {
return Recipient(id, "Jean", "<NAME>", "80190", "Y", "France")
}
private fun <T> any() : T {
return org.mockito.ArgumentMatchers.any()
}
@Test
fun testGetAllOrders() {
val order1 = Order(1L, createRecipientWithId(1), LocalDate.now(), 10, 25.0)
val order2 = Order(2L, createRecipientWithId(1), LocalDate.now(), 5, 12.5)
val orders = listOf(order1, order2)
`when`(orderService.getAllOrders()).thenReturn(orders)
mockMvc.perform(get("/order"))
.andExpect(status().isOk)
.andExpect(content().json(objectMapper.writeValueAsString(orders)))
}
@Test
fun testGetOrdersByRecipient() {
val recipientId = 1L
val order1 = Order(1L, createRecipientWithId(1), LocalDate.now(), 10, 25.0)
val order2 = Order(2L, createRecipientWithId(1), LocalDate.now(), 5, 12.5)
val orders = listOf(order1, order2)
`when`(recipientService.getRecipientById(recipientId)).thenReturn(createRecipientWithId(1))
`when`(orderService.getOrdersByRecipient(recipientId)).thenReturn(orders)
mockMvc.perform(get("/order/recipient/{recipientId}", recipientId))
.andExpect(status().isOk)
.andExpect(content().json(objectMapper.writeValueAsString(orders)))
}
@Test
fun testCreateOrder() {
val orderRequest = OrderRequest(1L, LocalDate.now(), 10)
val newOrder = Order(null, createRecipientWithId(1), orderRequest.deliveryDate, orderRequest.bananaQuantity, null)
val createdOrder = Order(1L, createRecipientWithId(1), orderRequest.deliveryDate, orderRequest.bananaQuantity, null)
`when`(recipientService.getRecipientById(orderRequest.recipientId)).thenReturn(createRecipientWithId(1))
doNothing().`when`(orderService).validateOrder(newOrder)
`when`(orderService.createOrder(newOrder)).thenReturn(createdOrder)
mockMvc.perform(post("/order")
.contentType(MediaType.APPLICATION_JSON)
.content(objectMapper.writeValueAsString(orderRequest)))
.andExpect(status().isCreated)
.andExpect(content().string("The order has been created: $createdOrder"))
}
@Test
fun testUpdateOrder() {
val orderId = 1L
val orderRequest = OrderRequest(1L, LocalDate.now(), 25)
val updatedOrder = Order(orderId, createRecipientWithId(1), orderRequest.deliveryDate, 50, null)
`when`(recipientService.getRecipientById(orderRequest.recipientId)).thenReturn(createRecipientWithId(1))
`when`(orderService.existsById(orderId)).thenReturn(true)
doNothing().`when`(orderService).validateOrder(updatedOrder)
doReturn(updatedOrder).`when`(orderService).updateOrder(any())
mockMvc.perform(put("/order/{id}", orderId)
.contentType(MediaType.APPLICATION_JSON)
.content(objectMapper.writeValueAsString(orderRequest)))
.andExpect(status().isOk)
.andExpect(content().string("The order has been updated: $updatedOrder"))
}
@Test
fun testDeleteOrder() {
val orderId = 1L
`when`(orderService.existsById(orderId)).thenReturn(true)
mockMvc.perform(delete("/order/{id}", orderId))
.andExpect(status().isOk)
.andExpect(content().string("The order $orderId has been deleted."))
}
}
| 0 | Kotlin | 0 | 0 | faf6b7147030d4c1aade0a370bda367353696b29 | 5,061 | bananes-export-kata | MIT License |
lib_http-coroutine/src/main/java/com/allens/lib_http2/core/HttpResult.kt | JiangHaiYang01 | 266,275,124 | false | null | package com.allens.lib_http2.core
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
sealed class HttpResult<out T : Any> {
data class Success<out T : Any>(val data: T) : HttpResult<T>()
data class Error(val throwable: Throwable) : HttpResult<Nothing>()
override fun toString(): String {
return when (this) {
is Success<*> -> "Success[data=$data]"
is Error -> "Error[throwable=$throwable]"
}
}
fun doSuccess(action: (T) -> Unit): HttpResult<T> {
if (this is Success) {
action(data)
}
return this
}
fun doFailed(action: (Throwable) -> Unit): HttpResult<T> {
if (this is Error) {
action(throwable)
}
return this
}
suspend inline fun result(
crossinline success: (T) -> Unit,
crossinline failed: (Throwable) -> Unit
) {
when (this) {
is Success -> {
withContext(Dispatchers.Main) {
success(data)
}
}
is Error -> {
withContext(Dispatchers.Main) {
failed(throwable)
}
}
}
}
} | 1 | Kotlin | 6 | 16 | 41ac10b266b519d4c214b43573017ed35718bb2b | 1,244 | RxHttp | Apache License 2.0 |
sspulltorefresh/src/main/java/com/simform/refresh/DefaultAnimationView.kt | SimformSolutionsPvtLtd | 379,198,133 | false | null | package com.simform.refresh
import android.content.Context
class DefaultAnimationView(context: Context): SSLottieAnimationView(context) {
private var mIsPlaying = false
override fun reset() {
mIsPlaying = false
cancelAnimation()
}
override fun refreshing() {
}
override fun refreshComplete() {
mIsPlaying = false
cancelAnimation()
}
override fun pullToRefresh() {
}
override fun releaseToRefresh() {
}
override fun pullProgress(pullDistance: Float, pullProgress: Float) {
if (!mIsPlaying) {
mIsPlaying = true
playAnimation()
}
}
} | 0 | Kotlin | 18 | 98 | 24f82567de4989c83bd4078a763ccfaf53727267 | 664 | SSPullToRefresh | MIT License |
tv/src/main/java/dev/myipaddress/app/MainActivity.kt | catcto | 549,391,910 | false | {"Kotlin": 4938} | package dev.myipaddress.app
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.net.Uri;
import java.net.URL;
import android.view.View
import android.widget.*
import com.android.volley.Request
import com.android.volley.RequestQueue
import com.android.volley.toolbox.JsonObjectRequest
import com.android.volley.toolbox.Volley
class MainActivity : AppCompatActivity() {
lateinit var etIP: EditText
lateinit var btnLookup: Button
lateinit var pbLoading: ProgressBar
lateinit var tvResults: TextView
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
etIP = findViewById(R.id.etIP)
btnLookup = findViewById(R.id.btnLookup)
pbLoading = findViewById(R.id.pbLoading)
tvResults = findViewById(R.id.tvResults)
btnLookup.setOnClickListener {
tvResults.text = ""
pbLoading.visibility = View.VISIBLE
lookup()
}
lookup()
}
private fun lookup() {
val uriBuilder = Uri.parse("https://myipaddress.dev/").buildUpon().path("json")
val ip = etIP.text.toString().trim()
if (ip.isNotEmpty()) {
uriBuilder.appendQueryParameter("ip", ip)
}
val queue: RequestQueue = Volley.newRequestQueue(applicationContext)
val request = JsonObjectRequest(Request.Method.GET, uriBuilder.toString(), null, { response ->
pbLoading.visibility = View.GONE
try {
etIP.setText(response.getString("ip"))
tvResults.text = response.toString(4);
} catch (e: Exception) {
e.printStackTrace()
}
}, { error ->
pbLoading.visibility = View.GONE
Toast.makeText(this@MainActivity, "Fail to get response", Toast.LENGTH_SHORT).show()
})
queue.add(request)
}
} | 0 | Kotlin | 0 | 1 | 620f0eb52c82245031f6c701e7698c93b36c4a40 | 1,965 | myipaddress-app | MIT License |
app/src/main/kotlin/io/github/fobo66/wearmmr/model/ViewModelsModule.kt | fobo66 | 117,318,095 | false | null | /*
* Copyright 2022 Andrey Mukamolov
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.github.fobo66.wearmmr.model
import org.koin.androidx.viewmodel.dsl.viewModel
import org.koin.dsl.module
val viewModelsModule = module {
viewModel {
MainViewModel(get())
}
viewModel {
SettingsViewModel(
get(),
get()
)
}
}
| 6 | Kotlin | 0 | 5 | 33907edc10051ee2a71e62949a69c07e9e7ae5ad | 929 | WearMMR | Apache License 2.0 |
src/zh/manhuagui/src/eu/kanade/tachiyomi/extension/zh/manhuagui/Manhuagui.kt | ZongerZY | 287,689,898 | true | {"Kotlin": 3948599, "Shell": 1958, "Java": 608} | package eu.kanade.tachiyomi.extension.zh.manhuagui
import android.app.Application
import android.content.SharedPreferences
import android.support.v7.preference.CheckBoxPreference
import android.support.v7.preference.ListPreference
import android.support.v7.preference.PreferenceScreen
import com.google.gson.Gson
import com.squareup.duktape.Duktape
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.network.POST
import eu.kanade.tachiyomi.network.asObservableSuccess
import eu.kanade.tachiyomi.source.ConfigurableSource
import eu.kanade.tachiyomi.source.model.FilterList
import eu.kanade.tachiyomi.source.model.MangasPage
import eu.kanade.tachiyomi.source.model.Page
import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.source.model.SManga
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
import eu.kanade.tachiyomi.util.asJsoup
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import okhttp3.Call
import okhttp3.Callback
import okhttp3.Headers
import okhttp3.HttpUrl
import okhttp3.Interceptor
import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.Response
import org.jsoup.Jsoup
import org.jsoup.nodes.Document
import org.jsoup.nodes.Element
import rx.Observable
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
import java.io.IOException
import java.text.SimpleDateFormat
import java.util.Locale
class Manhuagui : ConfigurableSource, ParsedHttpSource() {
private val preferences: SharedPreferences by lazy {
Injekt.get<Application>().getSharedPreferences("source_$id", 0x0000)
}
override val name = "漫画柜"
override val baseUrl =
if (preferences.getBoolean(SHOW_ZH_HANT_WEBSITE_PREF, false))
"https://tw.manhuagui.com"
else
"https://www.manhuagui.com"
override val lang = "zh"
override val supportsLatest = true
private val imageServer = arrayOf("https://i.hamreus.com")
private val gson = Gson()
private val baseHttpUrl: HttpUrl = HttpUrl.parse(baseUrl)!!
// Add rate limit to fix manga thumbnail load failure
private val rateLimitInterceptor = ManhuaguiRateLimitInterceptor(
baseHttpUrl.host()!!,
preferences.getString(MAINSITE_RATELIMIT_PREF, "2")!!.toInt(),
preferences.getString(IMAGE_CDN_RATELIMIT_PREF, "4")!!.toInt()
)
override val client: OkHttpClient =
if (getShowR18())
network.client.newBuilder()
.addNetworkInterceptor(rateLimitInterceptor)
.addNetworkInterceptor(AddCookieHeaderInterceptor(baseHttpUrl.host()!!))
.build()
else
network.client.newBuilder()
.addNetworkInterceptor(rateLimitInterceptor)
.build()
// Add R18 verification cookie
class AddCookieHeaderInterceptor(private val baseHost: String) : Interceptor {
override fun intercept(chain: Interceptor.Chain): Response {
if (chain.request().url().host() == baseHost) {
val originalCookies = chain.request().header("Cookie") ?: ""
if (originalCookies != "" && !originalCookies.contains("isAdult=1")) {
return chain.proceed(
chain.request().newBuilder()
.header("Cookie", "$originalCookies; isAdult=1")
.build()
)
}
}
return chain.proceed(chain.request())
}
}
override fun popularMangaRequest(page: Int): Request = GET("$baseUrl/list/view_p$page.html", headers)
override fun latestUpdatesRequest(page: Int): Request = GET("$baseUrl/list/update_p$page.html", headers)
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request =
GET("$baseUrl/s/${query}_p$page.html", headers)
override fun mangaDetailsRequest(manga: SManga): Request {
var bid = Regex("""\d+/?$""").find(manga.url)?.value
if (bid != null) {
bid = bid.removeSuffix("/")
// Send a get request to https://www.manhuagui.com/tools/vote.ashx?act=get&bid=$bid
// and a post request to https://www.manhuagui.com/tools/submit_ajax.ashx?action=user_check_login
// to simulate what web page javascript do and get "country" cookie.
// Send requests using coroutine in another (IO) thread.
GlobalScope.launch {
withContext(Dispatchers.IO) {
// Delay 1 second to wait main manga details request complete
delay(1000L)
client.newCall(
POST(
"$baseUrl/tools/submit_ajax.ashx?action=user_check_login",
headersBuilder()
.set("Referer", manga.url)
.set("X-Requested-With", "XMLHttpRequest")
.build()
)
).enqueue(
object : Callback {
override fun onFailure(call: Call, e: IOException) = e.printStackTrace()
override fun onResponse(call: Call, response: Response) = response.close()
}
)
client.newCall(
GET(
"$baseUrl/tools/vote.ashx?act=get&bid=$bid",
headersBuilder()
.set("Referer", manga.url)
.set("X-Requested-With", "XMLHttpRequest").build()
)
).enqueue(
object : Callback {
override fun onFailure(call: Call, e: IOException) = e.printStackTrace()
override fun onResponse(call: Call, response: Response) = response.close()
}
)
}
}
}
return GET(baseUrl + manga.url, headers)
}
// For ManhuaguiUrlActivity
private fun searchMangaByIdRequest(id: String) = GET("$baseUrl/comic/$id", headers)
private fun searchMangaByIdParse(response: Response, id: String): MangasPage {
val sManga = mangaDetailsParse(response)
sManga.url = "/comic/$id/"
return MangasPage(listOf(sManga), false)
}
override fun fetchSearchManga(page: Int, query: String, filters: FilterList): Observable<MangasPage> {
return if (query.startsWith(PREFIX_ID_SEARCH)) {
val id = query.removePrefix(PREFIX_ID_SEARCH)
client.newCall(searchMangaByIdRequest(id))
.asObservableSuccess()
.map { response -> searchMangaByIdParse(response, id) }
} else {
super.fetchSearchManga(page, query, filters)
}
}
override fun popularMangaSelector() = "ul#contList > li"
override fun latestUpdatesSelector() = popularMangaSelector()
override fun searchMangaSelector() = "div.book-result > ul > li"
override fun chapterListSelector() = "ul > li > a.status0"
override fun searchMangaNextPageSelector() = "span.current + a" // "a.prev" contain 2~4 elements: first, previous, next and last page, "span.current + a" is a better choice.
override fun popularMangaNextPageSelector() = searchMangaNextPageSelector()
override fun latestUpdatesNextPageSelector() = searchMangaNextPageSelector()
override fun headersBuilder(): Headers.Builder = super.headersBuilder()
.set("Referer", baseUrl)
.set("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36")
override fun popularMangaFromElement(element: Element) = mangaFromElement(element)
override fun latestUpdatesFromElement(element: Element) = mangaFromElement(element)
private fun mangaFromElement(element: Element): SManga {
val manga = SManga.create()
element.select("a.bcover").first().let {
manga.url = it.attr("href")
manga.title = it.attr("title").trim()
// Fix thumbnail lazy load
val thumbnailElement = it.select("img").first()
manga.thumbnail_url = if (thumbnailElement.hasAttr("src"))
thumbnailElement.attr("abs:src")
else
thumbnailElement.attr("abs:data-src")
}
return manga
}
override fun searchMangaFromElement(element: Element): SManga {
val manga = SManga.create()
element.select("div.book-detail").first().let {
manga.url = it.select("dl > dt > a").first().attr("href")
manga.title = it.select("dl > dt > a").first().attr("title").trim()
manga.thumbnail_url = element.select("div.book-cover > a.bcover > img").first().attr("abs:src")
}
return manga
}
override fun chapterFromElement(element: Element) = throw Exception("Not used")
override fun chapterListParse(response: Response): List<SChapter> {
val document = response.asJsoup()
val chapters = mutableListOf<SChapter>()
// Try to get R18 manga hidden chapter list
val hiddenEncryptedChapterList = document.select("#__VIEWSTATE").first()
if (hiddenEncryptedChapterList != null) {
if (getShowR18()) {
// Hidden chapter list is LZString encoded
val decodedHiddenChapterList = Duktape.create().use {
it.evaluate(
jsDecodeFunc +
"""LZString.decompressFromBase64('${hiddenEncryptedChapterList.`val`()}');"""
) as String
}
val hiddenChapterList = Jsoup.parse(decodedHiddenChapterList, response.request().url().toString())
if (hiddenChapterList != null) {
// Replace R18 warning with actual chapter list
document.select("#erroraudit_show").first().replaceWith(hiddenChapterList)
// Remove hidden chapter list element
document.select("#__VIEWSTATE").first().remove()
}
} else {
// "You need to enable R18 switch and restart Tachiyomi to read this manga"
error("您需要打开R18作品显示开关并重启软件才能阅读此作品")
}
}
val chapterList = document.select("ul > li > a.status0")
val latestChapterHref = document.select("div.book-detail > ul.detail-list > li.status > span > a.blue").first()?.attr("href")
val chNumRegex = Regex("""\d+""")
chapterList.forEach {
val currentChapter = SChapter.create()
currentChapter.url = it.attr("href")
currentChapter.name = it?.attr("title")?.trim() ?: it.select("span").first().ownText()
currentChapter.chapter_number = chNumRegex.find(currentChapter.name)?.value?.toFloatOrNull() ?: 0F
// Manhuagui only provide upload date for latest chapter
if (currentChapter.url == latestChapterHref) {
currentChapter.date_upload = parseDate(document.select("div.book-detail > ul.detail-list > li.status > span > span.red").last())
}
chapters.add(currentChapter)
}
return chapters.sortedByDescending { it.chapter_number }
}
private fun parseDate(element: Element): Long = SimpleDateFormat("yyyy-MM-dd", Locale.CHINA).parse(element.text())?.time ?: 0
override fun mangaDetailsParse(document: Document): SManga {
val manga = SManga.create()
/**
* When searching manga from intent filter, sometimes will cause the error below and manga don't appear in search result:
* eu.kanade.tachiyomi.debug E/GlobalSearchPresenter$search: kotlin.UninitializedPropertyAccessException: lateinit property title has not been initialized
* at eu.kanade.tachiyomi.source.model.SMangaImpl.getTitle(SMangaImpl.kt:7)
* at eu.kanade.tachiyomi.ui.browse.source.globalsearch.GlobalSearchPresenter.networkToLocalManga(GlobalSearchPresenter.kt:259)
* at eu.kanade.tachiyomi.ui.browse.source.globalsearch.GlobalSearchPresenter$search$1$4.call(GlobalSearchPresenter.kt:172)
* at eu.kanade.tachiyomi.ui.browse.source.globalsearch.GlobalSearchPresenter$search$1$4.call(GlobalSearchPresenter.kt:34)
* Parse manga.title here can solve it.
*/
manga.title = document.select("div.book-title > h1:nth-child(1)").text().trim()
manga.description = document.select("div#intro-all").text().trim()
manga.thumbnail_url = document.select("p.hcover > img").attr("abs:src")
manga.author = document.select("span:contains(漫画作者) > a , span:contains(漫畫作者) > a").text().trim()
manga.genre = document.select("span:contains(漫画剧情) > a , span:contains(漫畫劇情) > a").text().trim().replace(" ", ", ")
manga.status = when (document.select("div.book-detail > ul.detail-list > li.status > span > span").first().text()) {
"连载中" -> SManga.ONGOING
"已完结" -> SManga.COMPLETED
"連載中" -> SManga.ONGOING
"已完結" -> SManga.COMPLETED
else -> SManga.UNKNOWN
}
return manga
}
private val jsDecodeFunc =
"""
var LZString=(function(){var f=String.fromCharCode;var keyStrBase64="<KEY>;var baseReverseDic={};function getBaseValue(alphabet,character){if(!baseReverseDic[alphabet]){baseReverseDic[alphabet]={};for(var i=0;i<alphabet.length;i++){baseReverseDic[alphabet][alphabet.charAt(i)]=i}}return baseReverseDic[alphabet][character]}var LZString={decompressFromBase64:function(input){if(input==null)return"";if(input=="")return null;return LZString._0(input.length,32,function(index){return getBaseValue(keyStrBase64,input.charAt(index))})},_0:function(length,resetValue,getNextValue){var dictionary=[],next,enlargeIn=4,dictSize=4,numBits=3,entry="",result=[],i,w,bits,resb,maxpower,power,c,data={val:getNextValue(0),position:resetValue,index:1};for(i=0;i<3;i+=1){dictionary[i]=i}bits=0;maxpower=Math.pow(2,2);power=1;while(power!=maxpower){resb=data.val&data.position;data.position>>=1;if(data.position==0){data.position=resetValue;data.val=getNextValue(data.index++)}bits|=(resb>0?1:0)*power;power<<=1}switch(next=bits){case 0:bits=0;maxpower=Math.pow(2,8);power=1;while(power!=maxpower){resb=data.val&data.position;data.position>>=1;if(data.position==0){data.position=resetValue;data.val=getNextValue(data.index++)}bits|=(resb>0?1:0)*power;power<<=1}c=f(bits);break;case 1:bits=0;maxpower=Math.pow(2,16);power=1;while(power!=maxpower){resb=data.val&data.position;data.position>>=1;if(data.position==0){data.position=resetValue;data.val=getNextValue(data.index++)}bits|=(resb>0?1:0)*power;power<<=1}c=f(bits);break;case 2:return""}dictionary[3]=c;w=c;result.push(c);while(true){if(data.index>length){return""}bits=0;maxpower=Math.pow(2,numBits);power=1;while(power!=maxpower){resb=data.val&data.position;data.position>>=1;if(data.position==0){data.position=resetValue;data.val=getNextValue(data.index++)}bits|=(resb>0?1:0)*power;power<<=1}switch(c=bits){case 0:bits=0;maxpower=Math.pow(2,8);power=1;while(power!=maxpower){resb=data.val&data.position;data.position>>=1;if(data.position==0){data.position=resetValue;data.val=getNextValue(data.index++)}bits|=(resb>0?1:0)*power;power<<=1}dictionary[dictSize++]=f(bits);c=dictSize-1;enlargeIn--;break;case 1:bits=0;maxpower=Math.pow(2,16);power=1;while(power!=maxpower){resb=data.val&data.position;data.position>>=1;if(data.position==0){data.position=resetValue;data.val=getNextValue(data.index++)}bits|=(resb>0?1:0)*power;power<<=1}dictionary[dictSize++]=f(bits);c=dictSize-1;enlargeIn--;break;case 2:return result.join('')}if(enlargeIn==0){enlargeIn=Math.pow(2,numBits);numBits++}if(dictionary[c]){entry=dictionary[c]}else{if(c===dictSize){entry=w+w.charAt(0)}else{return null}}result.push(entry);dictionary[dictSize++]=w+entry.charAt(0);enlargeIn--;w=entry;if(enlargeIn==0){enlargeIn=Math.pow(2,numBits);numBits++}}}};return LZString})();String.prototype.splic=function(f){return LZString.decompressFromBase64(this).split(f)};
"""
// Page list is javascript eval encoded and LZString encoded, these website:
// http://www.oicqzone.com/tool/eval/ , https://www.w3xue.com/tools/jseval/ ,
// https://www.w3cschool.cn/tools/index?name=evalencode can try to decode javascript eval encoded content,
// jsDecodeFunc's LZString.decompressFromBase64() can decode LZString.
override fun pageListParse(document: Document): List<Page> {
// R18 warning element (#erroraudit_show) is remove by web page javascript, so here the warning element
// will always exist if this manga is R18 limited whether R18 verification cookies has been sent or not.
// But it will not interfere parse mechanism below.
if (document.select("#erroraudit_show").first() != null && !getShowR18())
error("R18作品显示开关未开启或未生效") // "R18 setting didn't enabled or became effective"
val html = document.html()
// These "\" can't be remove: \} more info in pull request 3926.
val re = Regex("""window\[".*?"\](\(.*\)\s*\{[\s\S]+\}\s*\(.*\))""")
val imgCode = re.find(html)?.groups?.get(1)?.value
val imgDecode = Duktape.create().use {
it.evaluate(jsDecodeFunc + imgCode) as String
}
// \}
val re2 = Regex("""\{.*\}""")
val imgJsonStr = re2.find(imgDecode)?.groups?.get(0)?.value
val imageJson: Comic = gson.fromJson(imgJsonStr, Comic::class.java)
return imageJson.files!!.mapIndexed { i, imgStr ->
val imgurl = "${imageServer[0]}${imageJson.path}$imgStr?cid=${imageJson.cid}&md5=${imageJson.sl?.md5}"
Page(i, "", imgurl)
}
}
override fun imageUrlParse(document: Document) = ""
override fun setupPreferenceScreen(screen: androidx.preference.PreferenceScreen) {
val mainSiteRateLimitPreference = androidx.preference.ListPreference(screen.context).apply {
key = MAINSITE_RATELIMIT_PREF
title = "主站每秒连接数限制" // "Ratelimit permits per second for main website"
entries = arrayOf("1", "2", "3", "4", "5")
entryValues = arrayOf("1", "2", "3", "4", "5")
// "This value affects network request amount for updating library. Lower this value may reduce the chance to get IP Ban, but loading speed will be slower too. Tachiyomi restart required."
summary = "此值影响更新书架时发起连接请求的数量。调低此值可能减小IP被屏蔽的几率,但加载速度也会变慢。需要重启软件以生效。"
setDefaultValue("2")
setOnPreferenceChangeListener { _, newValue ->
try {
val setting = preferences.edit().putString(MAINSITE_RATELIMIT_PREF, newValue as String).commit()
setting
} catch (e: Exception) {
e.printStackTrace()
false
}
}
}
val imgCDNRateLimitPreference = androidx.preference.ListPreference(screen.context).apply {
key = IMAGE_CDN_RATELIMIT_PREF
title = "图片CDN每秒连接数限制" // "Ratelimit permits per second for image CDN"
entries = arrayOf("1", "2", "3", "4", "5")
entryValues = arrayOf("1", "2", "3", "4", "5")
// "This value affects network request amount for loading image. Lower this value may reduce the chance to get IP Ban, but loading speed will be slower too. Tachiyomi restart required."
summary = "此值影响加载图片时发起连接请求的数量。调低此值可能减小IP被屏蔽的几率,但加载速度也会变慢。需要重启软件以生效。"
setDefaultValue("4")
setOnPreferenceChangeListener { _, newValue ->
try {
val setting = preferences.edit().putString(IMAGE_CDN_RATELIMIT_PREF, newValue as String).commit()
setting
} catch (e: Exception) {
e.printStackTrace()
false
}
}
}
// Simplified/Traditional Chinese version website switch
val zhHantPreference = androidx.preference.CheckBoxPreference(screen.context).apply {
key = SHOW_ZH_HANT_WEBSITE_PREF
// "Use traditional chinese version website"
title = "使用繁体版网站"
// "You need to restart Tachiyomi"
summary = "需要重启软件以生效。"
setOnPreferenceChangeListener { _, newValue ->
try {
val setting = preferences.edit().putBoolean(SHOW_ZH_HANT_WEBSITE_PREF, newValue as Boolean).commit()
setting
} catch (e: Exception) {
e.printStackTrace()
false
}
}
}
// R18+ switch
val r18Preference = androidx.preference.CheckBoxPreference(screen.context).apply {
key = SHOW_R18_PREF_Title
// "R18 Setting"
title = "R18作品显示设置"
// "Please make sure your IP is not in Manhuagui's ban list, e.g., China mainland IP. Tachiyomi restart required. If you want to close this switch after enabled it, you need to clear cookies in Tachiyomi advanced setting too.
summary = "请确认您的IP不在漫画柜的屏蔽列表内,例如中国大陆IP。需要重启软件以生效。\n启动后如需关闭,需一并到Tachiyomi高级设置内清除Cookies后才能生效。"
setOnPreferenceChangeListener { _, newValue ->
try {
val newSetting = preferences.edit().putBoolean(SHOW_R18_PREF, newValue as Boolean).commit()
newSetting
} catch (e: Exception) {
e.printStackTrace()
false
}
}
}
screen.addPreference(mainSiteRateLimitPreference)
screen.addPreference(imgCDNRateLimitPreference)
screen.addPreference(zhHantPreference)
screen.addPreference(r18Preference)
}
override fun setupPreferenceScreen(screen: PreferenceScreen) {
val mainSiteRateLimitPreference = ListPreference(screen.context).apply {
key = MAINSITE_RATELIMIT_PREF
title = "主站每秒连接数限制"
entries = arrayOf("1", "2", "3", "4", "5")
entryValues = arrayOf("1", "2", "3", "4", "5")
summary = "此值影响更新章节时发起连接请求的数量。调低此值可能减小IP被屏蔽的几率,但加载速度也会变慢。需要重启软件以生效。"
setDefaultValue("2")
setOnPreferenceChangeListener { _, newValue ->
try {
val setting = preferences.edit().putString(MAINSITE_RATELIMIT_PREF, newValue as String).commit()
setting
} catch (e: Exception) {
e.printStackTrace()
false
}
}
}
val imgCDNRateLimitPreference = ListPreference(screen.context).apply {
key = IMAGE_CDN_RATELIMIT_PREF
title = "图片CDN每秒连接数限制"
entries = arrayOf("1", "2", "3", "4", "5")
entryValues = arrayOf("1", "2", "3", "4", "5")
summary = "此值影响加载图片时发起连接请求的数量。调低此值可能减小IP被屏蔽的几率,但加载速度也会变慢。需要重启软件以生效。"
setDefaultValue("4")
setOnPreferenceChangeListener { _, newValue ->
try {
val setting = preferences.edit().putString(IMAGE_CDN_RATELIMIT_PREF, newValue as String).commit()
setting
} catch (e: Exception) {
e.printStackTrace()
false
}
}
}
val zhHantPreference = CheckBoxPreference(screen.context).apply {
key = SHOW_ZH_HANT_WEBSITE_PREF
title = "使用繁体版网站"
summary = "需要重启软件以生效。"
setOnPreferenceChangeListener { _, newValue ->
try {
val setting = preferences.edit().putBoolean(SHOW_ZH_HANT_WEBSITE_PREF, newValue as Boolean).commit()
setting
} catch (e: Exception) {
e.printStackTrace()
false
}
}
}
val r18Preference = CheckBoxPreference(screen.context).apply {
key = SHOW_R18_PREF_Title
title = "R18作品显示设置"
summary = "请确认您的IP不在漫画柜的屏蔽列表内,例如中国大陆IP。需要重启软件以生效。\n启动后如需关闭,需一并到Tachiyomi高级设置内清除Cookies后才能生效。"
setOnPreferenceChangeListener { _, newValue ->
try {
val newSetting = preferences.edit().putBoolean(SHOW_R18_PREF, newValue as Boolean).commit()
newSetting
} catch (e: Exception) {
e.printStackTrace()
false
}
}
}
screen.addPreference(mainSiteRateLimitPreference)
screen.addPreference(imgCDNRateLimitPreference)
screen.addPreference(zhHantPreference)
screen.addPreference(r18Preference)
}
private fun getShowR18(): Boolean = preferences.getBoolean(SHOW_R18_PREF, false)
companion object {
private const val SHOW_R18_PREF_Title = "R18Setting"
private const val SHOW_R18_PREF = "showR18Default"
private const val SHOW_ZH_HANT_WEBSITE_PREF = "showZhHantWebsite"
private const val MAINSITE_RATELIMIT_PREF = "mainSiteRatelimitPreference"
private const val IMAGE_CDN_RATELIMIT_PREF = "imgCDNRatelimitPreference"
const val PREFIX_ID_SEARCH = "id:"
}
}
| 0 | Kotlin | 1 | 8 | 1f40e4d4c4aff4b71fa72ffae03dbcd871e91803 | 25,697 | tachiyomi-extensions | Apache License 2.0 |
rentalproperty-be-common/src/main/kotlin/ru/otus/otuskotlin/vd/rentalproperty/be/common/models/media/MediaFileModel.kt | otuskotlin | 327,227,710 | false | null | package ru.otus.otuskotlin.vd.rentalproperty.be.common.models.media
data class MediaFileModel(
val id: MediaFileIdModel = MediaFileIdModel.NONE,
val title: String = "",
val url: String = "",
val fileNameInStorage: String = "",
) {
companion object {
val NONE = MediaFileModel()
}
} | 1 | Kotlin | 1 | 0 | d921e9c8ce4b071efa9ae7bc251f663660b8f5f6 | 298 | otuskotlin-202012-rentalproperty-vd | MIT License |
app/src/main/kotlin/sample/kotlin/project/presentation/core/views/BaseActivity.kt | Anna-Sentyakova | 239,825,048 | false | null | package sample.kotlin.project.presentation.core.views
import android.content.Intent
import android.os.Bundle
import android.os.Parcelable
import androidx.annotation.LayoutRes
import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProvider
import dagger.android.AndroidInjection
import dagger.android.HasAndroidInjector
import io.logging.LogSystem.sens
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.rxkotlin.plusAssign
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import ru.terrakok.cicerone.Navigator
import ru.terrakok.cicerone.NavigatorHolder
import sample.kotlin.project.domain.core.mvi.MviView
import sample.kotlin.project.domain.core.mvi.pojo.Action
import sample.kotlin.project.domain.core.mvi.pojo.Event
import sample.kotlin.project.domain.core.mvi.pojo.NavigationCommand
import sample.kotlin.project.domain.core.mvi.pojo.State
import sample.kotlin.project.presentation.core.views.extensions.unexpectedError
import javax.inject.Inject
@Suppress("TooManyFunctions")
abstract class BaseActivity<S : State, A : Action, E : Event, NC : NavigationCommand,
Parcel : Parcelable, VM : BaseViewModel<S, A, E, NC>> :
AppCompatActivity(), HasAndroidInjector, MviView<S, E> {
final override fun toString() = super.toString()
val logger: Logger = LoggerFactory.getLogger(toString())
@Inject
internal lateinit var baseView: BaseView<S, A, E, NC, Parcel, VM>
protected val viewModel get() = baseView.viewModel
protected val disposables get() = baseView.disposables
@Inject
internal lateinit var navigatorHolder: NavigatorHolder
final override fun androidInjector() = baseView.androidInjector
internal abstract val navigator: Navigator
@get:LayoutRes
protected abstract val layoutId: Int
protected abstract fun provideViewModel(provider: ViewModelProvider): VM
override fun onCreate(savedInstanceState: Bundle?) {
AndroidInjection.inject(this)
super.onCreate(savedInstanceState)
setContentView(layoutId)
baseView.stateSaver.restoreState(savedInstanceState)
baseView.viewModel =
provideViewModel(ViewModelProvider(this, baseView.viewModelProviderFactory))
logger.debug("provided view model: ${baseView.viewModel}")
baseView.statesDisposables += baseView.viewModel.statesObservable
.observeOn(AndroidSchedulers.mainThread())
.subscribe(::handle, ::unexpectedError)
}
private fun handle(state: S) {
baseView.stateSaver.state = state
render(state)
}
override fun onNewIntent(intent: Intent?) {
super.onNewIntent(intent)
logger.debug("onNewIntent: ${sens(intent)}")
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
logger.debug(
"onActivityResult: requestCode={}; resultCode={}; data={}",
requestCode, resultCode, sens(data)
)
}
override fun onStart() {
super.onStart()
logger.debug("onStart")
}
override fun onRestoreInstanceState(savedInstanceState: Bundle) {
super.onRestoreInstanceState(savedInstanceState)
logger.debug("onRestoreInstanceState: ${sens(savedInstanceState)}")
}
override fun onResume() {
super.onResume()
logger.debug("onResume")
baseView.viewModel.eventsHolder.attachView(this)
}
override fun onAttachFragment(fragment: Fragment) {
super.onAttachFragment(fragment)
logger.debug("onAttachFragment: $fragment")
}
override fun onResumeFragments() {
super.onResumeFragments()
logger.debug("onResumeFragments")
logger.debug("attached navigation holder: $navigatorHolder")
navigatorHolder.setNavigator(navigator)
}
override fun onPause() {
super.onPause()
logger.debug("onPause")
logger.debug("detached navigation holder: $navigatorHolder")
navigatorHolder.removeNavigator()
baseView.viewModel.eventsHolder.detachView()
}
override fun onSaveInstanceState(outState: Bundle) {
super.onSaveInstanceState(outState)
baseView.stateSaver.saveInstanceState(outState)
logger.debug("onSaveInstanceState: ${sens(outState)}")
}
override fun onStop() {
super.onStop()
logger.debug("onStop")
}
override fun onDestroy() {
super.onDestroy()
logger.debug("onDestroy")
baseView.disposables.dispose()
baseView.statesDisposables.dispose()
}
override fun finish() {
super.finish()
overridePendingTransition(0, 0)
}
override fun startActivity(intent: Intent?) {
super.startActivity(intent)
overridePendingTransition(0, 0)
}
override fun startActivityForResult(intent: Intent?, requestCode: Int) {
super.startActivityForResult(intent, requestCode)
overridePendingTransition(0, 0)
}
override fun render(state: S) {
// override in nested classes if needed
}
override fun handle(event: E) {
// override in nested classes if needed
}
}
| 0 | Kotlin | 0 | 1 | 37b57a5dd22bf5e106ecd8a28cf24cbdd7cb5819 | 5,288 | projekt | Apache License 2.0 |
Kotlin/problems/0054_sum_of_even_numbers_after_queries.kt | oxone-999 | 243,366,951 | true | {"C++": 961697, "Kotlin": 99948, "Java": 17927, "Python": 9476, "Shell": 999, "Makefile": 187} | // Problem Statement
// We have an array A of integers, and an array queries of queries.
//
// For the i-th query val = queries[i][0], index = queries[i][1], we add val to A[index].
// Then, the answer to the i-th query is the sum of the even values of A.
//
// (Here, the given index = queries[i][1] is a 0-based index, and each query permanently
// modifies the array A.)
//
// Return the answer to all queries. Your answer array should have answer[i]
// as the answer to the i-th query.
class Solution constructor() {
fun sumEvenAfterQueries(A: IntArray, queries: Array<IntArray>): IntArray {
var result:MutableList<Int> = mutableListOf<Int>();
var evenSum: Int = 0;
for(value in A){
if(value%2==0){
evenSum += value;
}
}
for(query in queries){
if(A[query[1]]%2==0){
evenSum-=A[query[1]];
}
A[query[1]]+=query[0];
if(A[query[1]]%2==0){
evenSum+=A[query[1]];
}
result.add(evenSum);
}
return result.toIntArray();
}
}
fun main(args:Array<String>){
var sol:Solution = Solution();
var A: IntArray = intArrayOf(1,2,3,4);
var queries:Array<IntArray> = arrayOf(intArrayOf(1,0),intArrayOf(-3,1),intArrayOf(-4,0),intArrayOf(2,3));
println(sol.sumEvenAfterQueries(A,queries).joinToString(prefix = "[", postfix = "]"));
}
| 0 | null | 0 | 0 | 52dc527111e7422923a0e25684d8f4837e81a09b | 1,438 | algorithms | MIT License |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.