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
src/main/kotlin/com/github/jomof/kane/impl/MatrixOps.kt
jomof
320,425,199
false
null
package com.github.jomof.kane.impl import com.github.jomof.kane.ScalarExpr fun matrixOf(columns: Int, rows: Int, vararg elements: Double) = DataMatrix( columns, rows, elements.map { constant(it) }.toList() ) fun matrixOf(columns: Int, rows: Int, vararg elements: ScalarExpr) = DataMatrix( columns, rows, elements.toList() ) fun matrixOf(columns: Int, rows: Int, init: (Coordinate) -> Any): DataMatrix { val elements = coordinatesOf(columns, rows).map { convertAnyToScalarExpr(init(it)) } return matrixOf(columns, rows, *elements.toTypedArray()) }
0
Kotlin
0
0
f841b79c6f826713a3e1110498cfe38dc4968e64
598
kane
Apache License 2.0
.teamcity/_Self/vcsRoots/Branch_Release.kt
JetBrains
1,459,486
false
null
@file:Suppress("ClassName") package _Self.vcsRoots import jetbrains.buildServer.configs.kotlin.v2019_2.vcs.GitVcsRoot object Branch_Release : GitVcsRoot({ name = "https://github.com/JetBrains/ideavim (branch release)" url = "https://github.com/JetBrains/ideavim.git" branch = "release" })
7
Kotlin
692
7,422
2a6b6f89f42f4d21a2f7c6e534191a3d8ac86428
298
ideavim
MIT License
shared/src/commonTest/kotlin/ru/olegivo/repeatodo/Randomization.kt
olegivo
503,480,894
false
null
/* * Copyright (C) 2022 <NAME> <<EMAIL>> * * This file is part of RepeaTodo. * * AFS is free software: you can redistribute it and/or modify * it under the terms of the MIT License. * * AFS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * RepeaTodo. */ package ru.olegivo.repeatodo import kotlin.random.Random fun randomString(size: Int = 10) = Random.azstring(size) fun Random.azchar(): Char = nextInt(from = 97, until = 123).toChar() fun Random.azstring(size: Int): String { val chars = List(size) { azchar() }.toCharArray() return chars.concatToString() } data class Position(private val range: IntRange, val position: Int) { val isLast = position == range.last } fun <T> randomList( count: Int = Random.nextInt(from = 5, until = 10), producer: Position.() -> T, ): List<T> = (0 until count).let { range -> range.map { position -> Position(range, position).producer() } }
2
Kotlin
0
0
1e6bda8a1f6acf394eb4547e39c1d15da02f4832
1,350
RepeaTodo
MIT License
app/src/main/kotlin/com/fibelatti/raffler/features/myraffles/presentation/voting/vote/CustomRaffleVotingVoteFragment.kt
jonikarppinen
196,982,278
true
{"Kotlin": 351499, "Java": 1626}
package com.fibelatti.raffler.features.myraffles.presentation.voting.vote import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import androidx.navigation.findNavController import com.fibelatti.raffler.R import com.fibelatti.raffler.core.extension.alertDialogBuilder import com.fibelatti.raffler.core.extension.observeEvent import com.fibelatti.raffler.core.extension.withDefaultDecoration import com.fibelatti.raffler.core.extension.withLinearLayoutManager import com.fibelatti.raffler.core.platform.base.BaseFragment import com.fibelatti.raffler.features.myraffles.presentation.voting.CustomRaffleVotingModel import com.fibelatti.raffler.features.myraffles.presentation.voting.CustomRaffleVotingViewModel import kotlinx.android.synthetic.main.fragment_custom_raffle_voting_vote.* import javax.inject.Inject class CustomRaffleVotingVoteFragment : BaseFragment() { private val customRaffleVotingViewModel by lazy { viewModelFactory.get<CustomRaffleVotingViewModel>(requireActivity()) } @Inject lateinit var adapter: CustomRaffleVotingVoteAdapter override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) injector.inject(this) customRaffleVotingViewModel.run { observeEvent(readyToVote) { handleReadyToVote() } } } override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? = inflater.inflate(R.layout.fragment_custom_raffle_voting_vote, container, false) override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) setupLayout() setupRecyclerView() withVoting { layoutTitle.setTitle(getString(R.string.custom_raffle_voting_title, it.description)) adapter.setItems(it.votes.map { item -> item.key }) } } private fun setupLayout() { layoutTitle.setNavigateUp { layoutRoot.findNavController().navigateUp() } } private fun setupRecyclerView() { recyclerViewItems.withDefaultDecoration() .withLinearLayoutManager() .adapter = adapter adapter.clickListener = { vote -> alertDialogBuilder { setMessage(getString(R.string.custom_raffle_voting_confirm_vote, vote)) setPositiveButton(R.string.hint_yes) { _, _ -> customRaffleVotingViewModel.vote(vote) } setNegativeButton(R.string.hint_no) { dialog, _ -> dialog.dismiss() } show() } } } private fun handleReadyToVote() { layoutRoot.findNavController().navigateUp() } private fun withVoting(body: (CustomRaffleVotingModel) -> Unit) { customRaffleVotingViewModel.voting.value?.let(body) } }
0
Kotlin
0
0
be9fa7c8e615fab9a4a12da4ee2f99758c4b552b
2,929
raffler-kotlin
Apache License 2.0
src/main/kotlin/io/github/kmakma/adventofcode/y2019/Y2019Day13.kt
kmakma
225,714,388
false
null
package io.github.kmakma.adventofcode.y2019 import io.github.kmakma.adventofcode.y2019.utils.BreakoutGame import io.github.kmakma.adventofcode.y2019.utils.IntcodeComputer import kotlinx.coroutines.ExperimentalCoroutinesApi @ExperimentalCoroutinesApi internal class Y2019Day13 : Y2019Day(13, "Care Package") { private lateinit var intcodeProgram: List<Long> override fun initializeDay() { intcodeProgram = inputAsIntcodeProgram() } override suspend fun solveTask1(): Int { return IntcodeComputer(intcodeProgram) .run() .output() .filterIndexed { index, _ -> index % 3 == 2 } .count { it == 2L } } override suspend fun solveTask2(): Int { return BreakoutGame(intcodeProgram).win().score // return BreakoutGame(intcodeProgram).play().score } }
0
Kotlin
0
0
7e6241173959b9d838fa00f81fdeb39fdb3ef6fe
851
adventofcode-kotlin
MIT License
arbeidsgiveropplysninger/src/test/kotlin/arbeidsgiveropplysninger/MockUtils.kt
navikt
575,838,396
false
null
package no.nav.helse.arbeidsgiveropplysninger import arbeidsgiveropplysninger.inntektsmeldingaktivitet.InntektsmeldingAktivitetDto import java.time.LocalDateTime import java.util.UUID internal fun mockInntektsmeldingAktivitet(hendelseId: UUID = UUID.randomUUID(), varselkode: String) = InntektsmeldingAktivitetDto( id = UUID.randomUUID(), hendelseId = hendelseId, varselkode = varselkode, nivå = "VARSEL", melding = "Dette er en melding", tidsstempel = LocalDateTime.now() ) internal fun mockInntektsmelingAktiviteter(hendelseId: UUID = UUID.randomUUID()) = listOf( mockInntektsmeldingAktivitet(hendelseId = hendelseId, varselkode = "RV_IM_1"), mockInntektsmeldingAktivitet(hendelseId = hendelseId, varselkode = "RV_IM_2"), )
3
Kotlin
0
1
e57f5a3450eed4bd5dced16786ff06a017f62156
793
helse-dataprodukter
MIT License
src/main/kotlin/ui/composable/screens/ApplicationDetailsScreen.kt
jskako
686,469,615
false
{"Kotlin": 183833, "VBScript": 410, "Batchfile": 108}
package ui.composable.screens import androidx.compose.foundation.VerticalScrollbar import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.width import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items import androidx.compose.foundation.lazy.rememberLazyListState import androidx.compose.foundation.rememberScrollbarAdapter import androidx.compose.foundation.text.selection.SelectionContainer import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Add import androidx.compose.material3.ExtendedFloatingActionButton import androidx.compose.material3.Icon import androidx.compose.material3.Scaffold import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember 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 kotlinx.coroutines.async import log.ApplicationManager import ui.composable.elements.CircularProgressBar import utils.Colors.darkBlue import utils.getStringResource @Composable fun ApplicationDetailsScreen( applicationManager: ApplicationManager, packageId: String ) { val listState = rememberLazyListState() var applicationDetails by remember { mutableStateOf<List<String>>(emptyList()) } LaunchedEffect(Unit) { val userAppsData = async { applicationManager.getAppDetails( packageName = packageId ) } applicationDetails = userAppsData.await() ?: emptyList() } Scaffold( modifier = Modifier.fillMaxSize(), floatingActionButton = { ExtendedFloatingActionButton( onClick = { }, containerColor = darkBlue, contentColor = Color.White, icon = { Icon(Icons.Filled.Add, getStringResource("info.install.app")) }, text = { Text(text = getStringResource("info.install.app")) }, ) } ) { paddingValues -> Column(modifier = Modifier.padding(paddingValues)) { CircularProgressBar( text = getStringResource("info.search.application.empty"), isVisible = applicationDetails.isEmpty() ) if (applicationDetails.isNotEmpty()) { Box( modifier = Modifier.fillMaxSize() ) { LazyColumn( state = listState, contentPadding = PaddingValues( start = 16.dp, end = 16.dp, top = 8.dp, bottom = 80.dp ) ) { items(applicationDetails) { line -> SelectionContainer { Text(text = line) } } } VerticalScrollbar( modifier = Modifier .align(Alignment.CenterEnd) .fillMaxHeight() .padding(end = 5.dp) .width(15.dp), adapter = rememberScrollbarAdapter( scrollState = listState ) ) } } } } }
6
Kotlin
1
16
4c7cb21a2096e742b3ff45c860048d4a6047aada
4,024
DroidSense
Apache License 2.0
frontend/src/main/kotlin/com/gdaley/Contact.kt
grahamdaley
158,703,682
false
null
package com.gdaley import kotlinx.serialization.Serializable @Serializable actual data class Contact( val id: String? = null, val name: String? = null, val email: String? = null )
0
Kotlin
0
1
5779fd160e47a202c7f6f3b36ef729289256b0bc
194
SimpleAddressBook
The Unlicense
libbase/src/main/java/com/earth/libbase/network/request/SendGiftRequest.kt
engineerrep
643,933,914
false
{"Java": 2291635, "Kotlin": 1651449}
package com.earth.libbase.network.request import com.google.gson.annotations.SerializedName data class SendGiftRequest( @SerializedName("exchangePersonId")//交换物品的用户id var exchangePersonId: Long? = null, @SerializedName("id")//旧物记录id var id: Long? = null )
1
null
1
1
415e0417870b6ff2c84a9798d1f3f3a4e6921354
272
EarthAngel
MIT License
libraries/stdlib/src/kotlin/concurrent/Locks.kt
virtuoushub
27,313,453
true
{"Markdown": 21, "XML": 504, "Ant Build System": 33, "Ignore List": 8, "Kotlin": 14560, "Java": 4036, "Protocol Buffer": 2, "Roff": 18, "Roff Manpage": 4, "Text": 3020, "JAR Manifest": 1, "INI": 6, "HTML": 102, "Groovy": 7, "Gradle": 62, "Maven POM": 39, "Java Properties": 10, "CSS": 10, "JavaScript": 53, "JFlex": 3, "Shell": 8, "Batchfile": 8}
package kotlin.concurrent import java.util.concurrent.locks.Lock import java.util.concurrent.locks.ReentrantReadWriteLock import java.util.concurrent.CountDownLatch /** * Executes given calculation under lock * Returns result of the calculation */ public inline fun <T> Lock.withLock(action: () -> T): T { lock() try { return action() } finally { unlock(); } } /** * Executes given calculation under read lock * Returns result of the calculation */ public inline fun <T> ReentrantReadWriteLock.read(action: () -> T): T { val rl = readLock() rl.lock() try { return action() } finally { rl.unlock() } } /** * Executes given calculation under write lock. * The method does upgrade from read to write lock if needed * If such write has been initiated by checking some condition, the condition must be rechecked inside the action to avoid possible races * Returns result of the calculation */ public inline fun <T> ReentrantReadWriteLock.write(action: () -> T): T { val rl = readLock() val readCount = if (getWriteHoldCount() == 0) getReadHoldCount() else 0 readCount times { rl.unlock() } val wl = writeLock() wl.lock() try { return action() } finally { readCount times { rl.lock() } wl.unlock() } } /** * Execute given calculation and await for CountDownLatch * Returns result of the calculation */ public fun <T> Int.latch(operation: CountDownLatch.() -> T): T { val latch = CountDownLatch(this) val result = latch.operation() latch.await() return result }
0
Java
0
0
99ec8952e192d3f95bb1974e71bbfca1d2e92c78
1,616
kotlin
Apache License 2.0
boot-app-server-spring-cloud/account-api/src/main/kotlin/com/ittianyu/accountapi/dto/LoginResultDTO.kt
ittianyu
194,419,824
false
null
package com.ittianyu.accountapi.dto /** * login result */ data class LoginResultDTO( var username: String? = null, var nickname: String? = null, var status: Byte? = null, var token: String? = null, var tokenExpireTime: Long? = null ) { }
1
Kotlin
0
11
136b573124a399606be2105da3f8d20212df3d23
281
boot-app
Apache License 2.0
references/src/main/kotlin/com/jakewharton/sdksearch/reference/SourceLocation.kt
nickbutcher
117,999,086
true
{"Kotlin": 79814, "Java": 4330, "IDL": 4241, "Prolog": 129, "HTML": 69}
package com.jakewharton.sdksearch.reference internal data class SourceLocation( val project: SourceProject, val branch: String = "master", val baseDir: String ) { init { require(baseDir.endsWith('/')) } fun branch(branch: String) = copy(branch = branch) }
1
Kotlin
1
6
09920af115157c542ea4787abb2d3851cdaeb4a5
274
SdkSearch
Apache License 2.0
src/test/kotlin/day18/Day18Test.kt
alxgarcia
435,549,527
false
null
package day18 import org.junit.jupiter.api.Test import kotlin.test.assertEquals internal class Day18Test { @Test fun `parse the tree structure of a SnailFish number`() { val testCases = listOf( "[1,2]", "[[1,2],3]", "[9,[8,7]]", "[[1,9],[8,5]]", "[[[[1,2],[3,4]],[[5,6],[7,8]]],9]", "[[[9,[3,8]],[[0,9],6]],[[[3,7],[4,9]],3]]", "[[3,[2,[8,0]]],[9,[5,[4,[3,2]]]]]", "[[[[1,3],[5,3]],[[1,3],[8,7]]],[[[4,9],[6,9]],[[8,2],[7,3]]]]", ) for (input in testCases) { assertEquals(input, parseSnailFishNumber(input).toString()) } } @Test fun `exploit a SnailFish number`() { val testCases = listOf( "[[[[[9,8],1],2],3],4]" to "[[[[0,9],2],3],4]", "[7,[6,[5,[4,[3,2]]]]]" to "[7,[6,[5,[7,0]]]]", "[[6,[5,[4,[3,2]]]],1]" to "[[6,[5,[7,0]]],3]", "[[3,[2,[1,[7,3]]]],[6,[5,[4,[3,2]]]]]" to "[[3,[2,[8,0]]],[9,[5,[4,[3,2]]]]]", "[[3,[2,[8,0]]],[9,[5,[4,[3,2]]]]]" to "[[3,[2,[8,0]]],[9,[5,[7,0]]]]", ) for ((input, expected) in testCases) { val n = parseSnailFishNumber(input) n.reduceOnce() assertEquals(expected, n.toString()) } } @Test fun `sum two SnailFish numbers`() { val n1 = parseSnailFishNumber("[[[[4,3],4],4],[7,[[8,4],9]]]") val n2 = parseSnailFishNumber("[1,1]") val expected = "[[[[0,7],4],[[7,8],[6,0]]],[8,1]]" assertEquals(expected, sum(n1, n2).toString()) } @Test fun `SnailFish number's magnitude`() { val input = "[[[[0,7],4],[[7,8],[6,0]]],[8,1]]" assertEquals(1384, parseSnailFishNumber(input).magnitude) } }
0
Kotlin
0
0
d6b10093dc6f4a5fc21254f42146af04709f6e30
1,609
advent-of-code-2021
MIT License
app/src/main/java/com/example/devintensive/models/UserView.kt
alekxeyuk
192,739,236
false
null
package com.example.devintensive.models class UserView( val id: String, ) { }
0
Kotlin
1
0
b78922b56dc1eef2eb51995970afbf0c216ebd72
88
dev-intensive-2019
MIT License
sketch-compose-core/src/commonMain/kotlin/com/github/panpf/sketch/painter/internal/DrawInvalidate.kt
panpf
14,798,941
false
{"Kotlin": 2979756, "Shell": 1469}
/* * Copyright (C) 2024 panpf <[email protected]> * * 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.github.panpf.sketch.painter.internal import androidx.compose.runtime.MutableIntState interface DrawInvalidate { var drawInvalidateTick: MutableIntState fun invalidateDraw() { if (drawInvalidateTick.value == Int.MAX_VALUE) { drawInvalidateTick.value = 0 } else { drawInvalidateTick.value++ } } }
8
Kotlin
309
2,057
89784530da0de6085a5b08f810415147cb3165cf
987
sketch
Apache License 2.0
src/main/kotlin/dev/aaronhowser/mods/geneticsresequenced/datagen/custom_recipe_types/DupeCellRecipeBuilder.kt
Berry-Club
780,170,281
false
{"Kotlin": 837166}
package dev.aaronhowser.mods.geneticsresequenced.datagen.custom_recipe_types import dev.aaronhowser.mods.geneticsresequenced.recipe.incubator.DupeCellRecipe import dev.aaronhowser.mods.geneticsresequenced.registry.ModItems import dev.aaronhowser.mods.geneticsresequenced.util.OtherUtil import net.minecraft.advancements.AdvancementRequirements import net.minecraft.advancements.AdvancementRewards import net.minecraft.advancements.Criterion import net.minecraft.advancements.critereon.RecipeUnlockedTrigger import net.minecraft.data.recipes.RecipeBuilder import net.minecraft.data.recipes.RecipeOutput import net.minecraft.resources.ResourceLocation import net.minecraft.world.item.Item class DupeCellRecipeBuilder( val isGmoCell: Boolean = false ) : RecipeBuilder { private val criteria: MutableMap<String, Criterion<*>> = mutableMapOf() override fun unlockedBy(name: String, criterion: Criterion<*>): RecipeBuilder { criteria[name] = criterion return this } override fun group(p0: String?): RecipeBuilder { error("Unsupported") } override fun getResult(): Item { return ModItems.CELL.get() } override fun save(output: RecipeOutput, defaultId: ResourceLocation) { val idString = if (isGmoCell) "incubator/dupe_substrate_cell_gmo" else "incubator/dupe_substrate_cell" val id = OtherUtil.modResource(idString) val advancement = output.advancement() .addCriterion("has_the_recipe", RecipeUnlockedTrigger.unlocked(id)) .rewards(AdvancementRewards.Builder.recipe(id)) .requirements(AdvancementRequirements.Strategy.OR) criteria.forEach { (name, criterion) -> advancement.addCriterion(name, criterion) } val recipe = DupeCellRecipe(isGmoCell) output.accept(id, recipe, advancement.build(id.withPrefix("recipes/"))) } }
10
Kotlin
0
1
478237c3fc57590f7e114fc2fc57197aae54a08b
1,881
Genetics-Resequenced
MIT License
fifi-framework/src/commonMain/kotlin/com/paoapps/fifi/api/ClientApiImpl.kt
Paoapps
684,655,570
false
{"Kotlin": 126960}
package com.paoapps.fifi.api import com.paoapps.fifi.auth.Claims import com.paoapps.fifi.auth.IdentifiableClaims import com.paoapps.fifi.auth.TokenStore import com.paoapps.fifi.model.ModelEnvironment import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.map import org.koin.core.component.KoinComponent import org.koin.core.component.inject open class ClientApiImpl<Environment: ModelEnvironment, AccessTokenClaims: IdentifiableClaims, RefreshTokenClaims: Claims, ServerError: Any>( final override val environment: Environment, appVersion: String, additionalHeaders: Map<String, String> = emptyMap(), ): KoinComponent, ClientApi<AccessTokenClaims> { val tokensStore: TokenStore by inject() val tokenDecoder: TokenDecoder<AccessTokenClaims, RefreshTokenClaims> by inject() val tokensFlow = MutableStateFlow(tokensStore.loadTokens(environment)) override val claimsFlow: Flow<AccessTokenClaims?> = tokensFlow.map { it?.accessToken?.let(tokenDecoder::accessTokenClaims) }.distinctUntilChanged() protected val apiHelper = ApiHelper<AccessTokenClaims, RefreshTokenClaims>(tokensFlow, environment, appVersion, additionalHeaders) }
0
Kotlin
0
3
f77319ec0109d37c312e5bf6fb38e3ba3a0721a4
1,274
fifi
MIT License
src/main/kotlin/no/nav/omsorgspengerutbetaling/soknad/BostedOgOpphold.kt
navikt
259,895,555
false
null
package no.nav.omsorgspengerutbetaling.soknad import com.fasterxml.jackson.annotation.JsonFormat import no.nav.helse.dusseldorf.ktor.core.ParameterType import no.nav.helse.dusseldorf.ktor.core.Violation import java.time.LocalDate data class Bosted( @JsonFormat(pattern = "yyyy-MM-dd") val fraOgMed: LocalDate, @JsonFormat(pattern = "yyyy-MM-dd") val tilOgMed: LocalDate, val landkode: String, val landnavn: String, val erEØSLand: JaNei ) typealias Opphold = Bosted internal fun List<Bosted>.valider(jsonPath: String) : Set<Violation> { val violations = mutableSetOf<Violation>() val perioder = map { Periode(fraOgMed = it.fraOgMed, tilOgMed = it.tilOgMed) } violations.addAll(perioder.valider(jsonPath)) forEachIndexed { index, it -> if (it.landkode.isBlank()) { violations.add( Violation( parameterName = "$jsonPath[$index].landkode", parameterType = ParameterType.ENTITY, reason = "Landkode må settes", invalidValue = it.landkode ) ) } if (it.landnavn.isBlank()) { violations.add( Violation( parameterName = "$jsonPath[$index].landnavn", parameterType = ParameterType.ENTITY, reason = "Landnavn må settes", invalidValue = it.landkode ) ) } } return violations }
4
Kotlin
0
0
68fc3f2a60de9f1061971d73e8ea551944b6a45d
1,517
omsorgspengerutbetalingsoknad-arbeidstaker-api
MIT License
src/main/java/me/bytebeats/mns/enumation/StockChartType.kt
bytebeats
282,830,790
false
{"Gradle Kotlin DSL": 2, "Java Properties": 2, "Shell": 1, "Text": 1, "Ignore List": 1, "Batchfile": 1, "Markdown": 1, "Java": 30, "Kotlin": 10, "XML": 9, "SVG": 1}
package me.bytebeats.mns.enumation /** * @Author bytebeats * @Email <<EMAIL>> * @Github https://github.com/bytebeats * @Created at 2021/9/19 16:47 * @Version 1.0 * @Description 股票 K 线图类型 */ enum class StockChartType(val type: String, val description: String) { Minute("min", "分时图"), Daily("daily", "日K图"), Weekly("weekly", "周K图"), Monthly("monthly", "月K图"); }
25
Java
52
219
105fe49791ed35d5b9877c9c7d8ec2497147e3e1
384
mns
MIT License
samples/app/src/main/kotlin/com/bumble/appyx/app/node/backstack/app/composable/PeekInsideBackStack.kt
bumble-tech
493,334,393
false
null
package com.bumble.appyx.app.node.backstack.app.composable import androidx.compose.foundation.background import androidx.compose.foundation.border import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.lazy.LazyRow import androidx.compose.foundation.lazy.rememberLazyListState import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.collectAsState 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.text.font.FontWeight import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import com.bumble.appyx.app.node.backstack.app.indexedbackstack.IndexedBackStack import com.bumble.appyx.app.node.backstack.app.indexedbackstack.IndexedBackStack.State.Active import com.bumble.appyx.app.node.backstack.app.indexedbackstack.IndexedBackStack.State.Created import com.bumble.appyx.app.node.backstack.app.indexedbackstack.IndexedBackStack.State.Destroyed import com.bumble.appyx.app.node.backstack.app.indexedbackstack.IndexedBackStack.State.Stashed import com.bumble.appyx.app.ui.appyx_yellow2 import com.bumble.appyx.app.ui.atomic_tangerine import com.bumble.appyx.app.ui.imperial_red import com.bumble.appyx.core.navigation.NavElement import java.util.Locale @Composable fun <T : Any> PeekInsideBackStack( backStack: IndexedBackStack<T>, modifier: Modifier = Modifier ) { val elements = backStack.elements.collectAsState() val listState = rememberLazyListState() LaunchedEffect(elements.value.lastIndex) { listState.animateScrollToItem(index = elements.value.lastIndex) } LazyRow( state = listState, modifier = modifier .fillMaxWidth() .background(if (isSystemInDarkTheme()) Color.DarkGray else Color.LightGray) .padding(12.dp), verticalAlignment = Alignment.CenterVertically, ) { elements.value.forEach { element -> item { BackStackElement(element) } } } } @Composable private fun <T> BackStackElement( element: NavElement<T, IndexedBackStack.State>, ) { Column( modifier = Modifier .size(60.dp) .padding(4.dp) .clip(RoundedCornerShape(15)) .background(if (isSystemInDarkTheme()) Color.Transparent else element.targetState.toColor()) .border(2.dp, element.targetState.toColor(), RoundedCornerShape(15)) .padding(6.dp), verticalArrangement = Arrangement.Center ) { Text( text = element.key.navTarget.toString(), color = MaterialTheme.colorScheme.onSurface, fontSize = 16.sp, fontWeight = FontWeight.Bold ) Text( text = element.targetState.javaClass.simpleName.toString() .replace("Destroyed", "Destr") .uppercase(Locale.getDefault()), color = MaterialTheme.colorScheme.onSurface, fontSize = 9.sp, ) } } private fun IndexedBackStack.State.toColor(): Color = when (this) { is Created -> appyx_yellow2 is Active -> appyx_yellow2 is Stashed -> atomic_tangerine is Destroyed -> imperial_red }
68
Kotlin
45
754
1c13ab49fb3e2eb0bcd192332d597f8c05d3f6a9
3,782
appyx
Apache License 2.0
processor/src/main/kotlin/com/intuit/hooks/plugin/ksp/Text.kt
intuit
342,405,057
false
null
package com.intuit.hooks.plugin.ksp import com.google.devtools.ksp.symbol.* internal val KSTypeArgument.text: String get() = when (variance) { Variance.STAR -> variance.label // type should always be defined if not star projected Variance.INVARIANT -> type!!.text else -> "${variance.label} ${type!!.text}" } internal val List<KSTypeArgument>.text: String get() = if (isEmpty()) "" else "<${joinToString(transform = KSTypeArgument::text)}>" internal val KSTypeReference.text: String get() = element?.let { when (it) { // Use lambda type shorthand is KSCallableReference -> "${if (this.modifiers.contains(Modifier.SUSPEND)) "suspend " else ""}(${ it.functionParameters.map(KSValueParameter::type).joinToString(transform = KSTypeReference::text) }) -> ${it.returnType.text}" else -> "$it${it.typeArguments.text}" } } ?: throw HooksProcessor.Exception("element was null, cannot translate KSTypeReference to code text: $this")
6
Kotlin
6
30
4e3e909bb2106d34bc82c51ddd76631a0aeffc6c
995
hooks
MIT License
app/src/main/java/com/santebreezefsm/features/reimbursement/api/editapi/ReimbursementEditRepo.kt
DebashisINT
671,482,089
false
{"Kotlin": 13517144, "Java": 994519}
package com.santebreezefsm.features.reimbursement.api.editapi import com.santebreezefsm.base.BaseResponse import com.santebreezefsm.features.reimbursement.model.ApplyReimbursementInputModel import io.reactivex.Observable /** * Created by Saikat on 08-02-2019. */ class ReimbursementEditRepo(val apiService: ReimbursementEditApi) { fun editReimbursement(input: ApplyReimbursementInputModel): Observable<BaseResponse> { return apiService.editReimbursement(input) } }
0
Kotlin
0
0
99ea7a961eb5deb3834491f27eb4e3e48c16d769
484
FSMSante
Apache License 2.0
app/src/main/java/ar/edu/unlam/mobile/scaffold/ui/screens/deck/DeckUI.kt
unlam-tec-movil
691,293,842
false
{"Kotlin": 341117}
package ar.edu.unlam.mobile.scaffold.ui.screens.deck enum class DeckUI { LISTA_DE_MAZOS, GENERAR_MAZOS }
3
Kotlin
0
0
02d90497e4ae17d0ddbaedbe5d5e3c068c099763
114
A3-2023-H2-Cartas-Super
MIT License
Mesh_network app/lib-meshnetworks/src/main/java/com/meshnetwork/meshnetworks/mmcp/MmcpAck.kt
arif6371
862,438,759
false
{"Kotlin": 492389, "TypeScript": 157688, "HTML": 33644, "Java": 18350, "JavaScript": 6573, "Objective-C": 2285, "Ruby": 2277, "Objective-C++": 745}
package com.meshnetwork.meshnetworks.mmcp import java.nio.ByteBuffer import java.nio.ByteOrder /** * An MMCP message may request an acknowledgement (ACK) reply - e.g. to be sure that the original * message was received. */ class MmcpAck( messageId: Int, val ackOfMessageId: Int, ) : MmcpMessage( what = WHAT_ACK, messageId = messageId, ){ override fun toBytes() = headerAndPayloadToBytes(header, ByteBuffer.wrap(ByteArray(MESSAGE_SIZE)) .order(ByteOrder.BIG_ENDIAN) .putInt(ackOfMessageId) .array()) override fun equals(other: Any?): Boolean { if (this === other) return true if (other !is MmcpAck) return false if (!super.equals(other)) return false if (ackOfMessageId != other.ackOfMessageId) return false return true } override fun hashCode(): Int { var result = super.hashCode() result = 31 * result + ackOfMessageId return result } companion object { //Size = size of ackOfMessageId = 4 bytes const val MESSAGE_SIZE = 4 fun fromBytes( byteArray: ByteArray, offset: Int = 0, len: Int = byteArray.size, ): MmcpAck { val (header, payload) = mmcpHeaderAndPayloadFromBytes(byteArray, offset, len) val ackOfMessageId = ByteBuffer.wrap(payload).int return MmcpAck(messageId = header.messageId, ackOfMessageId = ackOfMessageId) } } }
0
Kotlin
0
0
67810a07661786d72a5f74a2305a16cdd4c96c4a
1,510
Technova_Mayday-sos-app
MIT License
src/test/kotlin/test/io/kvision/form/FormSpec.kt
rjaros
120,835,750
false
null
/* * Copyright (c) 2017-present Robert Jaros * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package test.pl.treksoft.kvision.form import kotlinx.serialization.Serializable import pl.treksoft.kvision.form.Form import pl.treksoft.kvision.form.text.Text import pl.treksoft.kvision.form.time.DateTime import pl.treksoft.kvision.types.KDate import test.pl.treksoft.kvision.SimpleSpec import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertNotNull import kotlin.test.assertNull @Serializable data class DataForm( val a: String? = null, val b: Boolean? = null, val c: KDate? = null ) @Serializable data class DataForm2( val s: String? = null, val d: KDate? = null ) @Suppress("CanBeParameter") class FormSpec : SimpleSpec { @Test fun add() { run { val form = Form.create<DataForm>() val data = DataForm(a = "Test value") form.setData(data) val result = form.getData() assertNull(result.a, "Form should return null without adding any control") val textField = Text() form.add(DataForm::a, textField) form.setData(data) val result2 = form.getData() assertEquals("Test value", result2.a, "Form should return initial value") } } @Test fun remove() { run { val form = Form.create<DataForm>() val data = DataForm(a = "Test value") form.add(DataForm::a, Text()) form.setData(data) form.remove(DataForm::a) val result = form.getData() assertNull(result.a, "Form should return null after removing control") } } @Test fun removeAll() { run { val form = Form.create<DataForm>() val data = DataForm(a = "Test value") form.add(DataForm::a, Text()) form.setData(data) form.removeAll() val result = form.getData() assertNull(result.a, "Form should return null after removing all controls") } } @Test fun getControl() { run { val form = Form.create<DataForm>() form.add(DataForm::a, Text()) val control = form.getControl(DataForm::b) assertNull(control, "Should return null when there is no such control") val control2 = form.getControl(DataForm::a) assertNotNull(control2, "Should return correct control") } } @Test fun get() { run { val form = Form.create<DataForm>() val data = DataForm(a = "Test value") form.add(DataForm::a, Text()) val b = form[DataForm::b] assertNull(b, "Should return null value when there is no added control") val a = form[DataForm::a] assertNull(a, "Should return null value when control is empty") form.setData(data) val a2 = form[DataForm::a] assertEquals("Test value", a2, "Should return correct value") } } @Test fun getData() { run { val form = Form.create<DataForm>() val data = DataForm(a = "Test value") val textField = Text() form.add(DataForm::a, textField) form.setData(data) textField.value = "New value" val result = form.getData() assertEquals("New value", result.a, "Form should return changed value") } } @Test fun validate() { run { val form = Form.create<DataForm2>() form.add(DataForm2::s, Text()) { it.getValue()?.length ?: 0 > 4 } form.add(DataForm2::d, DateTime(), required = true) form.setData(DataForm2(s = "123")) val valid = form.validate() assertEquals(false, valid, "Should be invalid with initial data") form.setData(DataForm2(s = "12345")) val valid2 = form.validate() assertEquals(false, valid2, "Should be invalid with partially changed data") form.setData(DataForm2(s = "12345", d = KDate())) val valid3 = form.validate() assertEquals(true, valid3, "Should be valid") } } }
22
null
56
882
bde30bbfd3c1a837eeff58a0a81bf7a5d677c72f
5,347
kvision
MIT License
src/main/kotlin/com/basicfu/sip/api/common/Enum.kt
basicfu
172,451,351
false
null
package com.basicfu.sip.api.common enum class Enum(val value: Int, val msg: String) { NOT_FOUND_DATA(8, "要操作的数据不存在"), EXIST_PROJECT_NAME(4000, "项目名已存在"), EXIST_PROJECT_CATEGORY_NAME(4001, "项目分类名已存在"), EXIST_INTERFACE_NAME(4002, "接口名已存在"); enum class ProjectCategoryType { DIRECTORY, INTERFACE } enum class RequestMethod { GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS, } enum class ReqBodyType { FORM, JSON, FILE, RAW, } enum class InterfaceHistoryType { SAVE, REQUEST, } }
0
null
0
5
4ef2a5cb568d1d928be655003f0929e49bdf7209
646
sip-api
MIT License
src/main/kotlin/br/com/lighthost/kotlinDactylApi/impl/client/server/managers/databases/models/ClientDatabaseModel.kt
LightHostDatacenter
403,120,776
false
null
package br.com.lighthost.kotlinDactylApi.impl.client.server.managers.databases.models import br.com.lighthost.kotlinDactylApi.impl.client.server.managers.databases.actions.ClientDatabaseActions import br.com.lighthost.kotlinDactylApi.impl.client.server.managers.details.ClientServerDetails import br.com.lighthost.kotlinDactylApi.requests.BaseRequest data class ClientDatabaseModel( val id:String, val address:String, val port:Int, val name:String, val username:String, val allowedRemote:String, val password:String, private val server:ClientServerDetails, private val baseRequest: BaseRequest){ fun actions(): ClientDatabaseActions { return ClientDatabaseActions(server, baseRequest, id) } }
0
Kotlin
0
4
5f8903d9e810659afd895204a82a3eb2517b0fb6
749
KotlinDactyl-API
Apache License 2.0
core/src/main/kotlin/org/liberejo/game/data/DefaultDataManager.kt
liberejo
171,410,791
false
null
package org.liberejo.game.data import com.squareup.moshi.Moshi import net.harawata.appdirs.AppDirsFactory import org.kodein.di.Kodein import org.liberejo.api.data.DataManager import org.liberejo.api.data.LiberejoConfig import java.nio.file.Files import java.nio.file.Path import java.nio.file.Paths class DefaultDataManager : DataManager { private val moshi: Moshi = Moshi.Builder().build() private val configAdapter = moshi.adapter(LiberejoConfig::class.java) override val dataDir: Path override val configDir: Path override val packagesDir: Path override val configFile: Path init { // use AppDirs to locate per-platform directories val appDirs = AppDirsFactory.getInstance() dataDir = Paths.get(appDirs.getUserDataDir("liberejo", null, null)) configDir = Paths.get(appDirs.getUserConfigDir("liberejo", null, null)) packagesDir = dataDir.resolve("packages") Files.createDirectories(dataDir) Files.createDirectories(configDir) Files.createDirectories(packagesDir) configFile = configDir.resolve("config.json") } override fun loadConfig(): LiberejoConfig { val raw = Files.readAllBytes(configFile).toString() return configAdapter.fromJson(raw) ?: LiberejoConfig() } override fun saveConfig(config: LiberejoConfig) { val json = configAdapter.toJson(config) Files.write(configFile, json.toByteArray()) } }
0
Kotlin
0
2
ab3d86e2146a9a7e5f6990f5a974b46c22b47321
1,353
liberejo
Apache License 2.0
rounded/src/commonMain/kotlin/me/localx/icons/rounded/outline/Pallet.kt
localhostov
808,861,591
false
{"Kotlin": 79430321, "HTML": 331, "CSS": 102}
package me.localx.icons.rounded.outline import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.PathFillType.Companion.NonZero 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 me.localx.icons.rounded.Icons public val Icons.Outline.Pallet: ImageVector get() { if (_pallet != null) { return _pallet!! } _pallet = Builder(name = "Pallet", 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 = NonZero) { moveToRelative(24.0f, 20.0f) verticalLineToRelative(1.0f) curveToRelative(0.0f, 0.553f, -0.448f, 1.0f, -1.0f, 1.0f) reflectiveCurveToRelative(-1.0f, -0.447f, -1.0f, -1.0f) verticalLineToRelative(-1.0f) curveToRelative(0.0f, -0.552f, -0.449f, -1.0f, -1.0f, -1.0f) horizontalLineToRelative(-8.0f) verticalLineToRelative(2.0f) curveToRelative(0.0f, 0.553f, -0.448f, 1.0f, -1.0f, 1.0f) reflectiveCurveToRelative(-1.0f, -0.447f, -1.0f, -1.0f) verticalLineToRelative(-2.0f) horizontalLineTo(3.0f) curveToRelative(-0.551f, 0.0f, -1.0f, 0.448f, -1.0f, 1.0f) verticalLineToRelative(1.0f) curveToRelative(0.0f, 0.553f, -0.448f, 1.0f, -1.0f, 1.0f) reflectiveCurveToRelative(-1.0f, -0.447f, -1.0f, -1.0f) verticalLineToRelative(-1.0f) curveToRelative(0.0f, -1.654f, 1.346f, -3.0f, 3.0f, -3.0f) horizontalLineToRelative(18.0f) curveToRelative(1.654f, 0.0f, 3.0f, 1.346f, 3.0f, 3.0f) close() } } .build() return _pallet!! } private var _pallet: ImageVector? = null
1
Kotlin
0
5
cbd8b510fca0e5e40e95498834f23ec73cc8f245
2,408
icons
MIT License
app/src/main/java/com/bernardooechsler/bitcoinprice/data/local/graph/BitcoinDao.kt
nardober1st
674,827,015
false
null
package com.bernardooechsler.bitcoinprice.data.local.graph import androidx.room.Dao import androidx.room.Insert import androidx.room.OnConflictStrategy import androidx.room.Query import androidx.room.Upsert import com.bernardooechsler.bitcoinprice.data.model.graph.Bitcoin @Dao interface BitcoinDao { @Upsert suspend fun insertBitcoin(bitcoin: Bitcoin) @Query("SELECT * FROM bitcoin_table") suspend fun getLastBitcoin(): Bitcoin? }
0
Kotlin
1
0
0d9a5bbdbb784b0a517b3f99bec74e3c744e6f93
451
BitcoinPrice
MIT License
Topics/Getting substrings/Exchange/src/Main.kt
vitorfloriano
639,676,484
false
null
fun main() { // put your code here val str = readLine()!! val strFirstChar = str.first() val strLastChar = str.last() val strMiddle = str.substring(1, str.length - 1) println(strLastChar + strMiddle + strFirstChar) }
0
Kotlin
0
0
48f635adf3dd340043109268977e2e557c35494e
240
simple-tic-tac-toe-in-kotlin
MIT License
app/src/main/kotlin/com/k0d4black/theforce/commons/ViewExtensions.kt
Ericgacoki
269,908,844
true
{"Kotlin": 152025}
package com.k0d4black.theforce.commons import android.app.Activity import android.content.Context import android.content.Intent import android.view.View import android.widget.Toast import androidx.annotation.ColorRes import androidx.core.content.ContextCompat import androidx.recyclerview.widget.DividerItemDecoration import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import com.google.android.material.snackbar.Snackbar import com.k0d4black.theforce.R internal fun View.show() { this.visibility = View.VISIBLE } internal fun View.hide() { this.visibility = View.INVISIBLE } internal fun View.remove() { this.visibility = View.GONE } internal fun Activity.showSnackbar(view: View, message: String, isError: Boolean = false) { val sb = Snackbar.make(view, message, Snackbar.LENGTH_LONG) if (isError) sb.setBackgroundTint(loadColor(R.color.colorError)) .setTextColor(loadColor(R.color.colorOnError)) .show() else sb.setBackgroundTint(loadColor(R.color.colorSecondary)) .setTextColor(loadColor(R.color.colorOnSecondary)) .show() } internal fun RecyclerView.initRecyclerViewWithLineDecoration(context: Context) { val linearLayoutManager = LinearLayoutManager(context) val itemDecoration = DividerItemDecoration(context, linearLayoutManager.orientation).apply { setDrawable(context.getDrawable(R.drawable.view_divider)!!) } layoutManager = linearLayoutManager addItemDecoration(itemDecoration) } internal fun Context.loadColor(@ColorRes colorRes: Int): Int { return ContextCompat.getColor(this, colorRes) } internal fun Context.showToast(message: String) { Toast.makeText(this, message, Toast.LENGTH_SHORT).show() } internal inline fun <reified T : Activity> Context.startActivity(block: Intent.() -> Unit = {}) { val intent = Intent(this, T::class.java) block(intent) startActivity(intent) }
0
null
1
1
9366a48b95085417132ddfb0766e59e71575212e
1,989
Clean-MVVM-ArchComponents
Apache License 2.0
feature-soracard-api/src/main/kotlin/jp/co/soramitsu/soracard/api/presentation/SoraCardRouter.kt
soramitsu
278,060,397
false
null
package jp.co.soramitsu.soracard.api.presentation interface SoraCardRouter { fun back() fun openGetMoreXor() fun openSwapTokensScreen(assetId: String, chainId: String) fun showBuyCrypto() fun openWebViewer(title: String, url: String) }
10
Kotlin
20
65
040d69f2d9f83a3ad0388ef57d40353c74e7488c
261
fearless-Android
Apache License 2.0
app/src/main/java/com/kmvdata/kotlin/demoflickrmvvm/api/GalleryItem.kt
kmvdata
351,786,602
false
null
package com.kmvdata.kotlin.demoflickrmvvm.api import com.google.gson.annotations.SerializedName import java.io.Serializable data class GalleryItem( var title: String = "", var id: String = "", @SerializedName("url_s") var url: String = "" ) : Serializable
0
Kotlin
0
0
9022d0c95c71bc9b3ee4c2da89f5a1ade4ee88e2
274
DemoFlickrMvvm
MIT License
library/src/main/kotlin/com/jonapoul/about/domain/usecase/GetLatestReleaseUseCase.kt
jonapoul
378,197,473
false
null
package com.jonapoul.about.domain.usecase import com.jonapoul.about.data.GithubRepository import com.jonapoul.about.data.LatestReleaseState import com.jonapoul.about.domain.AboutTextCreator import com.jonapoul.common.ui.SnackbarFeed import com.jonapoul.common.ui.SnackbarMessage import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.onEach import javax.inject.Inject internal class GetLatestReleaseUseCase @Inject constructor( private val githubRepository: GithubRepository, private val snackbarFeed: SnackbarFeed, private val textCreator: AboutTextCreator, ) { fun getLatestRelease(): Flow<LatestReleaseState> = githubRepository.getLatestRelease() .onEach { showSnackbarOnFailure(it) } private suspend fun showSnackbarOnFailure(state: LatestReleaseState) { snackbarFeed.add( when (state) { is LatestReleaseState.Failure -> SnackbarMessage.Warning(state.message) LatestReleaseState.NoUpdate -> SnackbarMessage.Caution(textCreator.releaseNoUpdate) LatestReleaseState.NoReleases -> SnackbarMessage.Caution(textCreator.releaseNoneFound) else -> return } ) } }
0
Kotlin
0
0
f5a8148732efbb516f6440e29333f30df7b39d4a
1,301
about
Apache License 2.0
app/src/main/java/com/example/firebaseapp/models/History.kt
enesulkerr
651,993,592
false
null
package com.example.firebaseapp.models data class History( val title: String, val yer: String, val notes: String, val imageurl: String )
0
Kotlin
0
0
5078bad60789f21e788390dc8c1b83ec2f82f7d7
160
Firebase-Traveler-App
MIT License
app/src/main/java/com/example/firebaseapp/models/History.kt
enesulkerr
651,993,592
false
null
package com.example.firebaseapp.models data class History( val title: String, val yer: String, val notes: String, val imageurl: String )
0
Kotlin
0
0
5078bad60789f21e788390dc8c1b83ec2f82f7d7
160
Firebase-Traveler-App
MIT License
src/main/kotlin/ua/pp/lumivoid/registration/GamerulesRegistration.kt
Bumer-32
779,465,671
false
{"Kotlin": 152624, "Java": 10615, "Groovy": 3292, "Python": 462}
package ua.pp.lumivoid.registration import net.fabricmc.fabric.api.gamerule.v1.GameRuleFactory import net.fabricmc.fabric.api.gamerule.v1.GameRuleRegistry import net.minecraft.world.GameRules import net.minecraft.world.GameRules.BooleanRule object GamerulesRegistration { var DO_CONTAINER_DROPS: GameRules.Key<BooleanRule>? = null fun register() { DO_CONTAINER_DROPS = GameRuleRegistry.register( "doContainerDrops", GameRules.Category.DROPS, GameRuleFactory.createBooleanRule(true) ) } }
0
Kotlin
1
2
37933c09b03914d0b80eb4097fedf94c40dcca15
555
Redstone-Helper
Apache License 2.0
app/src/main/java/dev/amits/cleanarchitecturenewsapp/domain/usecases/GetSearchNewsUseCases.kt
amitsahoo1998
591,703,105
false
null
package dev.amits.cleanarchitecturenewsapp.domain.usecases import dev.amits.cleanarchitecturenewsapp.data.model.NewsResponse import dev.amits.cleanarchitecturenewsapp.domain.repository.NewsRepository class GetSearchNewsUseCases (private val newsRepository: NewsRepository){ suspend fun execute(country: String , searchQuery : String , page: Int) : dev.amits.cleanarchitecturenewsapp.data.Resource<NewsResponse> = newsRepository.getSearchNews(country, searchQuery, page) }
0
Kotlin
0
0
7100ec6b7ec15f287febffe76a28b1433eee8833
479
News-Apps-MVVM-Clean-Architecture
MIT License
straight/src/commonMain/kotlin/me/localx/icons/straight/filled/FacePleading.kt
localhostov
808,861,591
false
{"Kotlin": 79430321, "HTML": 331, "CSS": 102}
package me.localx.icons.straight.filled import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.PathFillType.Companion.NonZero 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 me.localx.icons.straight.Icons public val Icons.Filled.FacePleading: ImageVector get() { if (_facePleading != null) { return _facePleading!! } _facePleading = Builder(name = "FacePleading", defaultWidth = 512.0.dp, defaultHeight = 512.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 = NonZero) { moveTo(10.0f, 13.0f) curveToRelative(0.0f, 0.552f, -0.448f, 1.0f, -1.0f, 1.0f) reflectiveCurveToRelative(-1.0f, -0.448f, -1.0f, -1.0f) reflectiveCurveToRelative(0.448f, -1.0f, 1.0f, -1.0f) reflectiveCurveToRelative(1.0f, 0.448f, 1.0f, 1.0f) close() moveTo(17.0f, 12.0f) curveToRelative(-0.552f, 0.0f, -1.0f, 0.448f, -1.0f, 1.0f) reflectiveCurveToRelative(0.448f, 1.0f, 1.0f, 1.0f) reflectiveCurveToRelative(1.0f, -0.448f, 1.0f, -1.0f) reflectiveCurveToRelative(-0.448f, -1.0f, -1.0f, -1.0f) close() moveTo(24.0f, 12.0f) curveToRelative(0.0f, 6.617f, -5.383f, 12.0f, -12.0f, 12.0f) reflectiveCurveTo(0.0f, 18.617f, 0.0f, 12.0f) reflectiveCurveTo(5.383f, 0.0f, 12.0f, 0.0f) reflectiveCurveToRelative(12.0f, 5.383f, 12.0f, 12.0f) close() moveTo(4.629f, 7.477f) lineToRelative(0.74f, 1.857f) curveToRelative(1.583f, -0.631f, 2.953f, -1.766f, 3.963f, -3.279f) lineToRelative(-1.664f, -1.109f) curveToRelative(-0.772f, 1.158f, -1.852f, 2.058f, -3.039f, 2.531f) close() moveTo(8.0f, 15.0f) curveToRelative(1.654f, 0.0f, 3.0f, -1.346f, 3.0f, -3.0f) reflectiveCurveToRelative(-1.346f, -3.0f, -3.0f, -3.0f) curveToRelative(-0.304f, 0.0f, -0.592f, 0.059f, -0.869f, 0.144f) curveToRelative(0.512f, 0.239f, 0.869f, 0.755f, 0.869f, 1.356f) curveToRelative(0.0f, 0.828f, -0.672f, 1.5f, -1.5f, 1.5f) curveToRelative(-0.602f, 0.0f, -1.117f, -0.357f, -1.356f, -0.869f) curveToRelative(-0.085f, 0.277f, -0.144f, 0.565f, -0.144f, 0.869f) curveToRelative(0.0f, 1.654f, 1.346f, 3.0f, 3.0f, 3.0f) close() moveTo(15.598f, 18.198f) curveToRelative(-0.066f, -0.049f, -1.632f, -1.198f, -3.598f, -1.198f) reflectiveCurveToRelative(-3.531f, 1.149f, -3.598f, 1.198f) lineToRelative(1.191f, 1.606f) curveToRelative(0.011f, -0.008f, 1.117f, -0.805f, 2.406f, -0.805f) reflectiveCurveToRelative(2.396f, 0.797f, 2.402f, 0.802f) lineToRelative(1.195f, -1.604f) close() moveTo(19.0f, 12.0f) curveToRelative(0.0f, -1.654f, -1.346f, -3.0f, -3.0f, -3.0f) curveToRelative(-0.304f, 0.0f, -0.592f, 0.059f, -0.869f, 0.144f) curveToRelative(0.512f, 0.239f, 0.869f, 0.755f, 0.869f, 1.356f) curveToRelative(0.0f, 0.828f, -0.672f, 1.5f, -1.5f, 1.5f) curveToRelative(-0.602f, 0.0f, -1.117f, -0.357f, -1.356f, -0.869f) curveToRelative(-0.085f, 0.277f, -0.144f, 0.565f, -0.144f, 0.869f) curveToRelative(0.0f, 1.654f, 1.346f, 3.0f, 3.0f, 3.0f) reflectiveCurveToRelative(3.0f, -1.346f, 3.0f, -3.0f) close() moveTo(19.371f, 7.477f) curveToRelative(-1.188f, -0.474f, -2.267f, -1.373f, -3.039f, -2.531f) lineToRelative(-1.664f, 1.109f) curveToRelative(1.01f, 1.514f, 2.38f, 2.648f, 3.963f, 3.279f) lineToRelative(0.74f, -1.857f) close() } } .build() return _facePleading!! } private var _facePleading: ImageVector? = null
1
Kotlin
0
5
cbd8b510fca0e5e40e95498834f23ec73cc8f245
4,747
icons
MIT License
kotlin/src/main/kotlin/com/github/jntakpe/aoc2022/days/Day6.kt
jntakpe
572,853,785
false
null
package com.github.jntakpe.aoc2022.days import com.github.jntakpe.aoc2022.shared.Day import com.github.jntakpe.aoc2022.shared.readInput object Day6 : Day { override val input = readInput(6) override fun part1() = indexOfDifferentChars(input, 4) override fun part2() = indexOfDifferentChars(input, 14) fun indexOfDifferentChars(input: String, window: Int): Int { return input.windowed(window).indexOfFirst { it.toSet().size == it.length } + window } }
1
Kotlin
0
0
24545b44eb10d6229edf039f9aad93368f75eaf4
484
aoc2022
MIT License
src/main/kotlin/com/github/rochedo/planetsandstars/registry/PlanetsAndStarsFluids.kt
Rochedo098
372,644,126
false
null
package com.github.rochedo.planetsandstars.registry import com.github.rochedo.planetsandstars.registry.fluids.HydrogenFluid import com.github.rochedo.planetsandstars.registry.fluids.OxygenFluid import com.github.rochedo.planetsandstars.utils.MyIdentifier import net.fabricmc.fabric.api.`object`.builder.v1.block.FabricBlockSettings import net.fabricmc.fabric.api.item.v1.FabricItemSettings import net.minecraft.block.Block import net.minecraft.block.FluidBlock import net.minecraft.block.Material import net.minecraft.fluid.FlowableFluid import net.minecraft.item.BucketItem import net.minecraft.item.Item import net.minecraft.item.Items import net.minecraft.util.registry.Registry object PlanetsAndStarsFluids { var STILL_OXYGEN: FlowableFluid = OxygenFluid.Still() var FLOWING_OXYGEN: FlowableFluid = OxygenFluid.Flowing() var OXYGEN_BUCKET: Item = BucketItem(STILL_OXYGEN, FabricItemSettings().recipeRemainder(Items.BUCKET).maxCount(1)) var OXYGEN: Block = object : FluidBlock(STILL_OXYGEN, FabricBlockSettings.of(Material.WATER)){} var STILL_HYDROGEN: FlowableFluid = HydrogenFluid.Still() var FLOWING_HYDROGEN: FlowableFluid = HydrogenFluid.FLowing() var HYDROGEN_BUCKET: Item = BucketItem(STILL_HYDROGEN, FabricItemSettings().recipeRemainder(Items.BUCKET).maxCount(1)) var HYDROGEN: Block = object : FluidBlock(STILL_HYDROGEN, FabricBlockSettings.of(Material.WATER)){} fun register() { Registry.register(Registry.FLUID, MyIdentifier("oxygen"), STILL_OXYGEN) Registry.register(Registry.FLUID, MyIdentifier("flowing_oxygen"), FLOWING_OXYGEN) Registry.register(Registry.ITEM, MyIdentifier("oxygen_bucket"), OXYGEN_BUCKET) Registry.register(Registry.BLOCK, MyIdentifier("oxygen"), OXYGEN) Registry.register(Registry.FLUID, MyIdentifier("hydrogen"), STILL_HYDROGEN) Registry.register(Registry.FLUID, MyIdentifier("flowing_hydrogen"), FLOWING_HYDROGEN) Registry.register(Registry.ITEM, MyIdentifier("hydrogen_bucket"), HYDROGEN_BUCKET) Registry.register(Registry.BLOCK, MyIdentifier("hydrogen"), HYDROGEN) } }
0
Kotlin
0
0
480ad335852a10a4f87f2e0e59c3d7e02337a931
2,118
Planets-and-Stars
Apache License 2.0
backend/src/main/kotlin/net/iceyleagons/butler/services/MicrosoftService.kt
IceyLeagons
561,907,558
false
{"Kotlin": 47195, "Svelte": 24955, "TypeScript": 22439, "SCSS": 2753, "HTML": 1308, "CSS": 291, "JavaScript": 213}
package net.iceyleagons.butler.services import net.iceyleagons.butler.CalendarEvent interface MicrosoftService { fun getEventsInAllCalendars(user: GatekeeperService.GatekeeperIdentity): List<CalendarEvent> }
0
Kotlin
0
0
c5c110fb17dd40ec9429e76f48658c5af53cf67c
215
Butler
MIT License
subprojects/xcfa/c2xcfa/src/main/java/hu/bme/mit/theta/c2xcfa/CMetaData.kt
ftsrg
39,392,321
false
{"Java": 5102996, "Kotlin": 1308219, "C": 278090, "ANTLR": 121909, "C++": 110696, "SWIG": 65732, "SMT": 24985, "Shell": 5456, "Dockerfile": 2404, "PowerShell": 865}
/* * Copyright 2024 Budapest University of Technology and Economics * * 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 hu.bme.mit.theta.c2xcfa import hu.bme.mit.theta.xcfa.model.MetaData import hu.bme.mit.theta.xcfa.model.XcfaEdge import hu.bme.mit.theta.xcfa.model.XcfaLabel import hu.bme.mit.theta.xcfa.model.XcfaLocation data class CMetaData( val lineNumberStart: Int?, val colNumberStart: Int?, val lineNumberStop: Int?, val colNumberStop: Int?, val offsetStart: Int?, val offsetEnd: Int?, val sourceText: String? ) : MetaData() fun XcfaLabel.getCMetaData(): CMetaData? { return if (this.metadata is CMetaData) { this.metadata as CMetaData } else { null } } fun XcfaLocation.getCMetaData(): CMetaData? { return if (this.metadata is CMetaData) { this.metadata as CMetaData } else { null } } fun XcfaEdge.getCMetaData(): CMetaData? { return if (this.metadata is CMetaData) { this.metadata as CMetaData } else { null } }
50
Java
42
49
cb77d7e6bb0e51ea00d2a1dc483fdf510dd8e8b4
1,568
theta
Apache License 2.0
src/main/kotlin/io/github/dockyardmc/entities/Entity.kt
DockyardMC
650,731,309
false
{"Kotlin": 1019371}
package io.github.dockyardmc.entities import cz.lukynka.Bindable import cz.lukynka.BindableMap import io.github.dockyardmc.blocks.Block import io.github.dockyardmc.blocks.BlockIterator import io.github.dockyardmc.config.ConfigManager import io.github.dockyardmc.effects.PotionEffectImpl import io.github.dockyardmc.events.* import io.github.dockyardmc.extentions.sendPacket import io.github.dockyardmc.location.Location import io.github.dockyardmc.player.EntityPose import io.github.dockyardmc.player.PersistentPlayer import io.github.dockyardmc.player.Player import io.github.dockyardmc.player.toPersistent import io.github.dockyardmc.protocol.packets.ClientboundPacket import io.github.dockyardmc.protocol.packets.play.clientbound.* import io.github.dockyardmc.registry.* import io.github.dockyardmc.registry.registries.DamageType import io.github.dockyardmc.registry.registries.EntityType import io.github.dockyardmc.registry.registries.PotionEffect import io.github.dockyardmc.sounds.Sound import io.github.dockyardmc.sounds.playSound import io.github.dockyardmc.team.Team import io.github.dockyardmc.team.TeamManager import io.github.dockyardmc.utils.Disposable import io.github.dockyardmc.utils.mergeEntityMetadata import io.github.dockyardmc.utils.ticksToMs import io.github.dockyardmc.utils.vectors.Vector3 import io.github.dockyardmc.utils.vectors.Vector3f import io.github.dockyardmc.world.World import java.util.* import kotlin.math.cos import kotlin.math.sin abstract class Entity(open var location: Location, open var world: World) : Disposable { open var entityId: Int = EntityManager.entityIdCounter.incrementAndGet() open var uuid: UUID = UUID.randomUUID() abstract var type: EntityType open var velocity: Vector3 = Vector3() val viewers: MutableSet<Player> = mutableSetOf() open var hasGravity: Boolean = true open var isInvulnerable: Boolean = false open var displayName: String = this::class.simpleName.toString() open var isOnGround: Boolean = true val metadata: BindableMap<EntityMetadataType, EntityMetadata> = BindableMap() val pose: Bindable<EntityPose> = Bindable(EntityPose.STANDING) abstract var health: Bindable<Float> abstract var inventorySize: Int val potionEffects: BindableMap<PotionEffect, AppliedPotionEffect> = BindableMap() val walkSpeed: Bindable<Float> = Bindable(0.15f) open var tickable: Boolean = true val metadataLayers: BindableMap<PersistentPlayer, MutableMap<EntityMetadataType, EntityMetadata>> = BindableMap() val isGlowing: Bindable<Boolean> = Bindable(false) val isInvisible: Bindable<Boolean> = Bindable(false) val team: Bindable<Team?> = Bindable(null) val isOnFire: Bindable<Boolean> = Bindable(false) val freezeTicks: Bindable<Int> = Bindable(0) val equipment: Bindable<EntityEquipment> = Bindable(EntityEquipment()) val equipmentLayers: BindableMap<PersistentPlayer, EntityEquipmentLayer> = BindableMap() var renderDistanceBlocks: Int = ConfigManager.config.implementationConfig.defaultEntityRenderDistanceBlocks var autoViewable: Boolean = true constructor(location: Location) : this(location, location.world) init { equipment.valueChanged { viewers.forEach(::sendEquipmentPacket) } equipmentLayers.itemSet { val player = it.key.toPlayer() if (player != null) sendEquipmentPacket(player) } equipmentLayers.itemRemoved { val player = it.key.toPlayer() if (player != null) sendEquipmentPacket(player) } isOnFire.valueChanged { val meta = getEntityMetadataState(this) { isOnFire = it.newValue } metadata[EntityMetadataType.STATE] = meta } freezeTicks.valueChanged { val meta = EntityMetadata(EntityMetadataType.FROZEN_TICKS, EntityMetaValue.VAR_INT, it.newValue) metadata[EntityMetadataType.FROZEN_TICKS] = meta } metadata.mapUpdated { sendMetadataPacketToViewers() sendSelfMetadataIfPlayer() } metadata.itemSet { sendMetadataPacketToViewers() sendSelfMetadataIfPlayer() } isGlowing.valueChanged { metadata[EntityMetadataType.STATE] = getEntityMetadataState(this) } isInvisible.valueChanged { metadata[EntityMetadataType.STATE] = getEntityMetadataState(this) } metadataLayers.itemSet { val player = it.key.toPlayer() if (player != null) sendMetadataPacket(player) } metadataLayers.itemRemoved { val player = it.key.toPlayer() if (player != null) sendMetadataPacket(player) } pose.valueChanged { metadata[EntityMetadataType.POSE] = EntityMetadata(EntityMetadataType.POSE, EntityMetaValue.POSE, it.newValue) } //TODO add attribute modifiers walkSpeed.valueChanged {} potionEffects.itemSet { it.value.startTime = System.currentTimeMillis() val packet = ClientboundEntityEffectPacket( this, it.value.effect, it.value.level, it.value.duration, it.value.showParticles, it.value.showBlueBorder, it.value.showIconOnHud ) viewers.sendPacket(packet) sendSelfPacketIfPlayer(packet) PotionEffectImpl.onEffectApply(this, it.value.effect) } potionEffects.itemRemoved { val packet = ClientboundRemoveEntityEffectPacket(this, it.value) viewers.sendPacket(packet) PotionEffectImpl.onEffectRemoved(this, it.value.effect) sendSelfPacketIfPlayer(packet) } team.valueChanged { if (it.newValue != null && !TeamManager.teams.values.containsKey(it.newValue!!.name)) throw IllegalArgumentException( "Team ${it.newValue!!.name} is not registered!" ) this.team.value?.entities?.remove(this) it.newValue?.entities?.add(this) } } override fun dispose() { autoViewable = false team.value?.entities?.remove(this) team.value = null equipmentLayers.clear() viewers.iterator().forEach { removeViewer(it, false) } metadataLayers.clear() EntityManager.entities.remove(this) world.entities.remove(this) } fun updateEntity(player: Player, respawn: Boolean = false) { sendMetadataPacketToViewers() } open fun tick() { potionEffects.values.forEach { if (System.currentTimeMillis() >= it.value.startTime!! + ticksToMs(it.value.duration)) { potionEffects.remove(it.key) } } } open fun addViewer(player: Player) { val event = EntityViewerAddEvent(this, player) Events.dispatch(event) if (event.cancelled) return sendMetadataPacket(player) val entitySpawnPacket = ClientboundSpawnEntityPacket(entityId, uuid, type.getProtocolId(), location, location.yaw, 0, velocity) isOnGround = true player.visibleEntities.add(this) viewers.add(player) player.sendPacket(entitySpawnPacket) sendMetadataPacket(player) sendMetadataPacketToViewers() } open fun removeViewer(player: Player, isDisconnect: Boolean) { val event = EntityViewerRemoveEvent(this, player) Events.dispatch(event) if (event.cancelled) return viewers.remove(player) val entityDespawnPacket = ClientboundEntityRemovePacket(this) player.sendPacket(entityDespawnPacket) player.visibleEntities.remove(this) } //TODO move to bindable open fun setEntityVelocity(velocity: Vector3) { val packet = ClientboundSetVelocityPacket(this, velocity) viewers.sendPacket(packet) sendSelfPacketIfPlayer(packet) } open fun lookAt(target: Entity) { val newLoc = this.location.setDirection(target.location.toVector3d() - (this.location).toVector3d()) teleport(newLoc) } open fun lookAtClientside(target: Entity, player: Player) { lookAtClientside(target, listOf(player)) } open fun lookAtClientside(target: Entity, players: Collection<Player>) { val clonedLoc = location.clone() val newLoc = clonedLoc.setDirection(target.location.toVector3d() - (this.location).toVector3d()) teleportClientside(newLoc, players) } open fun sendMetadataPacketToViewers() { viewers.forEach(this::sendMetadataPacket) } open fun sendMetadataPacket(player: Player) { val metadata = mergeEntityMetadata(this, metadataLayers[player.toPersistent()]) val packet = ClientboundSetEntityMetadataPacket(this, metadata) player.sendPacket(packet) } open fun sendEquipmentPacket(player: Player) { val equipment = getMergedEquipmentData(equipment.value, equipmentLayers[player.toPersistent()]) val packet = ClientboundSetEquipmentPacket(this, equipment) player.sendPacket(packet) } open fun calculateBoundingBox(): BoundingBox { val width = type.dimensions.width val height = type.dimensions.height return BoundingBox( location.x - width / 2, location.x + width / 2, location.y - height / 2, location.y + height / 2, location.z - width / 2, location.z + width / 2 ) } open fun teleport(location: Location) { this.location = location viewers.sendPacket(ClientboundEntityTeleportPacket(this, location)) viewers.sendPacket(ClientboundSetHeadYawPacket(this)) } open fun teleportClientside(location: Location, player: Player) { teleportClientside(location, listOf(player)) } open fun teleportClientside(location: Location, players: Collection<Player>) { players.sendPacket(ClientboundEntityTeleportPacket(this, location)) players.sendPacket(ClientboundSetHeadYawPacket(this, location)) } open fun damage(damage: Float, damageType: DamageType, attacker: Entity? = null, projectile: Entity? = null) { val event = EntityDamageEvent(this, damage, damageType, attacker, projectile) Events.dispatch(event) if (event.cancelled) return var location: Location? = null if (attacker != null) location = attacker.location if (projectile != null) location = projectile.location if (event.damage > 0) { if (!isInvulnerable) { if (health.value - event.damage <= 0) kill() else health.value -= event.damage } } val packet = ClientboundDamageEventPacket(this, event.damageType, event.attacker, event.projectile, location) viewers.sendPacket(packet) } fun playSoundToViewers(sound: Sound, location: Location? = this.location) { viewers.playSound(sound, location) } open fun kill() { val event = EntityDeathEvent(this) Events.dispatch(event) if (event.cancelled) { health.value = 0.1f return } health.value = 0f; } data class BoundingBox( val minX: Double, val maxX: Double, val minY: Double, val maxY: Double, val minZ: Double, val maxZ: Double, ) private fun sendSelfPacketIfPlayer(packet: ClientboundPacket) { if (this is Player) this.sendPacket(packet) } private fun sendSelfMetadataIfPlayer() { if (this is Player) sendMetadataPacket(this) } fun addPotionEffect( effect: PotionEffect, duration: Int, level: Int = 1, showParticles: Boolean = false, showBlueBorder: Boolean = false, showIconOnHud: Boolean = false, ) { val potionEffect = AppliedPotionEffect(effect, duration, level, showParticles, showBlueBorder, showIconOnHud) this.potionEffects[effect] = potionEffect } fun removePotionEffect(effect: PotionEffect) { this.potionEffects.remove(effect) } fun removePotionEffect(effect: AppliedPotionEffect) { this.potionEffects.remove(effect.effect) } fun clearPotionEffects() { this.potionEffects.clear() } fun refreshPotionEffects() { viewers.forEach(::sendPotionEffectsPacket) if (this is Player) this.sendPotionEffectsPacket(this) } fun sendPotionEffectsPacket(player: Player) { potionEffects.values.values.forEach { val packet = ClientboundEntityEffectPacket( this, it.effect, it.level, it.duration, it.showParticles, it.showBlueBorder, it.showIconOnHud ) player.sendPacket(packet) } } fun placeBlock(location: Location, block: Block) { } fun interact() { } fun breakBlock() { } fun getTargetBlock(maxDistance: Int): Location? { val it: Iterator<Vector3> = BlockIterator(this, maxDistance) while (it.hasNext()) { val position: Location = it.next().toLocation(world) if (world.getBlock(position).isAir()) return position } return null } fun getFacingDirectionVector(): Vector3f { val yawRadians = Math.toRadians(location.yaw.toDouble()) val pitchRadians = Math.toRadians(location.pitch.toDouble()) val x = -sin(yawRadians) * cos(pitchRadians) val y = -sin(pitchRadians) val z = cos(yawRadians) * cos(pitchRadians) return Vector3f(x.toFloat(), y.toFloat(), z.toFloat()) } }
9
Kotlin
7
55
9a0eb8f3184123b79b835356ddde526d9eb6df65
13,930
Dockyard
MIT License
verik-compiler/src/main/kotlin/io/verik/compiler/target/declaration/TargetArrayList.kt
frwang96
269,980,078
false
null
/* * SPDX-License-Identifier: Apache-2.0 */ package io.verik.compiler.target.declaration import io.verik.compiler.target.common.CompositeTargetFunctionDeclaration import io.verik.compiler.target.common.Target import io.verik.compiler.target.common.TargetScope /** * Target declarations from ArrayList. */ object TargetArrayList : TargetScope(Target.C_ArrayList) { val F_new = CompositeTargetFunctionDeclaration( parent, "__new", """ static function automatic ArrayList#(E) __new(); ArrayList#(E) arrayList = new(); return arrayList; endfunction : __new """.trimIndent(), true ) val F_add = CompositeTargetFunctionDeclaration( parent, "add", """ function automatic void add(E e); queue.push_back(e); endfunction : add """.trimIndent(), false ) val F_get = CompositeTargetFunctionDeclaration( parent, "get", """ function automatic E get(int index); return queue[index]; endfunction : get """.trimIndent(), false ) val F_set = CompositeTargetFunctionDeclaration( parent, "set", """ function automatic set(int index, E e); queue[index] = e; endfunction : set """.trimIndent(), false ) val F_size = CompositeTargetFunctionDeclaration( parent, "size", """ function automatic int size(); return queue.size(); endfunction : size """.trimIndent(), false ) }
0
Kotlin
1
33
ee22969235460fd144294bcbcbab0338c638eb92
1,717
verik
Apache License 2.0
newm-server/src/main/kotlin/io/newm/server/auth/twofactor/repo/TwoFactorAuthRepositoryImpl.kt
projectNEWM
447,979,150
false
null
package io.newm.server.auth.twofactor.repo import io.ktor.server.application.ApplicationEnvironment import io.ktor.util.logging.Logger import io.newm.server.auth.twofactor.database.TwoFactorAuthEntity import io.newm.server.ext.getConfigBoolean import io.newm.server.ext.getConfigInt import io.newm.server.ext.getConfigLong import io.newm.server.ext.getConfigString import io.newm.server.ext.nextDigitCode import io.newm.server.ext.toHash import io.newm.server.ext.toUrl import io.newm.server.ext.verify import org.apache.commons.mail.DefaultAuthenticator import org.apache.commons.mail.HtmlEmail import org.jetbrains.exposed.sql.transactions.transaction import org.slf4j.MarkerFactory import java.security.SecureRandom import java.time.LocalDateTime internal class TwoFactorAuthRepositoryImpl( private val environment: ApplicationEnvironment, private val logger: Logger ) : TwoFactorAuthRepository { private val marker = MarkerFactory.getMarker(javaClass.simpleName) private val random = SecureRandom() override suspend fun sendCode(email: String) { logger.debug(marker, "sendCode: $email") val code = random.nextDigitCode(environment.getConfigInt("emailAuth.codeSize")) val message = environment.getConfigString("emailAuth.messageUrl") .toUrl() .readText() .replaceFirst("{{code}}", code) val smtpHost = environment.getConfigString("emailAuth.smtpHost") if (smtpHost.isNotBlank()) { HtmlEmail().apply { hostName = smtpHost setSmtpPort(environment.getConfigInt("emailAuth.smtpPort")) isSSLOnConnect = environment.getConfigBoolean("emailAuth.sslOnConnect") setAuthenticator( DefaultAuthenticator( environment.getConfigString("emailAuth.userName"), environment.getConfigString("emailAuth.password") ) ) setFrom(environment.getConfigString("emailAuth.from")) addTo(email) subject = environment.getConfigString("emailAuth.subject") setHtmlMsg(message) }.send() } else { // debugging locally, not sending email, so dump a trace message of the email logger.trace(marker, "email -> $message") } val codeHash = code.toHash() val expiresAt = LocalDateTime.now().plusSeconds(environment.getConfigLong("emailAuth.timeToLive")) transaction { TwoFactorAuthEntity.deleteByEmail(email) TwoFactorAuthEntity.new { this.email = email this.codeHash = codeHash this.expiresAt = expiresAt } } } override suspend fun verifyCode(email: String, code: String): Boolean = transaction { TwoFactorAuthEntity.deleteAllExpired() TwoFactorAuthEntity.getByEmail(email)?.takeIf { code.verify(it.codeHash) }?.let { entity -> entity.delete() true } ?: false } }
0
Kotlin
1
3
de5d69ce85fa7b93ccd10315c084f29cc31568ac
3,105
newm-server
Apache License 2.0
app/src/main/java/xyz/asnes/attention/PhysicalPromptsActivity.kt
nicasnes
321,897,380
false
null
package xyz.asnes.attention import android.content.Context import android.content.Intent import android.net.Uri import android.os.Bundle import android.view.View import android.widget.Toast import androidx.appcompat.app.AppCompatActivity class PhysicalPromptsActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { supportActionBar?.hide() super.onCreate(savedInstanceState) setContentView(R.layout.activity_physical_prompts) } /** * A series of functions called when the user presses the associated button. * Sends an SMS to the phone number specified in settings regarding a desire * for additional physical attention through the specified means. */ fun sendHugs(view: View) { sendSMS(getString(R.string.textheader) + getString(R.string.phug)) } fun sendKiss(view: View) { sendSMS(getString(R.string.textheader) + getString(R.string.pkiss)) } fun sendSex(view: View) { sendSMS(getString(R.string.textheader) + getString(R.string.psex)) } fun sendMassage(view: View) { sendSMS(getString(R.string.textheader) + getString(R.string.pmassage)) } fun sendCuddles(view: View) { sendSMS(getString(R.string.textheader) + getString(R.string.pcuddles)) } /** * Takes a message as a String which will be sent to the phone number stored in the * settings (through SharedPreferences) * If the phone number is invalid or the SMS fails, the user is notified. */ private fun sendSMS(message : String) { // Load the phone number val settings = this.getSharedPreferences("appInfo", Context.MODE_PRIVATE) val phoneNum = settings.getString("phoneNumber", "none") if (phoneNum == "none") { Toast.makeText(applicationContext, "Phone number is invalid or does not exist.", Toast.LENGTH_SHORT).show() return } try { startActivity( Intent(Intent.ACTION_VIEW, Uri.fromParts("sms", phoneNum, null)) .putExtra("sms_body", message) ) finish() } catch (ex : android.content.ActivityNotFoundException) { Toast.makeText(applicationContext, "SMS failed, please try again later", Toast.LENGTH_SHORT).show() } } }
2
Kotlin
0
0
279ce346a052792e4340753bd2b6abe3340f738f
2,361
Communicator
MIT License
src/main/kotlin/com/intworkers/application/service/schoolsystem/SchoolService.kt
74ultra
193,610,954
true
{"Kotlin": 84025}
package com.intworkers.application.service.schoolsystem import com.intworkers.application.model.schoolsystem.School import org.springframework.data.domain.Pageable interface SchoolService { fun findById(id: Long): School fun findAll(pageable: Pageable): MutableList<School> fun save(school: School): School fun update(school: School, id: Long): School fun delete(id: Long) }
0
Kotlin
0
0
22f8c5b0cf7ef68f0cacb2abda5a20211f8b7a18
400
international-school-socialworker-BE
MIT License
javaApp/src/main/java/net/solvetheriddle/processing/java/utils/ImageLoad.kt
anoniim
197,846,450
false
{"Gradle": 5, "Java Properties": 3, "Shell": 1, "Text": 1, "Ignore List": 4, "Batchfile": 1, "XML": 16, "Markdown": 1, "Kotlin": 19, "Java": 1, "Proguard": 1}
package net.solvetheriddle.processing.java.utils import processing.core.PImage import java.awt.image.BufferedImage import java.io.IOException import javax.imageio.ImageIO class ImageLoad { fun getImage(url: String): PImage { var image: BufferedImage? = null try { image = ImageIO.read(ImageLoad::class.java.classLoader.getResourceAsStream(url)) } catch (e: IOException) { println("UNABLE TO LOAD IMAGE!!") e.printStackTrace() } return PImage(image) } }
6
null
1
1
f8b8536cfbf1ca4120e8e58a290c4623d29f2354
540
visuals
MIT License
app/src/main/java/com/inno/innochat/ui/LoginFragment.kt
noundla
154,170,378
false
{"Gradle": 4, "Java Properties": 2, "Shell": 1, "Text": 1, "Ignore List": 3, "Batchfile": 1, "Markdown": 1, "Proguard": 2, "Kotlin": 33, "XML": 33, "Java": 2}
package com.inno.innochat.ui import com.inno.innochat.R import kotlinx.android.synthetic.main.fragment_login.* import android.content.* import android.net.Uri import android.os.Bundle import android.preference.PreferenceManager import android.support.customtabs.CustomTabsIntent import android.support.design.widget.CoordinatorLayout import android.support.design.widget.Snackbar import android.support.v4.app.Fragment import android.util.Log import com.inno.innochat.Constants import com.inno.innochat.xmpp.InnoChatConnectionService import android.text.TextUtils import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import com.inno.innochat.model.User import com.inno.innochat.model.UsersModel /** * This fragment is used to display login screen to process the authentication * * @author Sandeep Noundla * */ class LoginFragment : Fragment() { companion object { private val TAG = "LoginFragment" } private lateinit var mBroadcastReceiver: BroadcastReceiver private var mNavigationListener : NavigationListener? = null private var mLoaderListener : DisplayLoaderListener? = null private var mCoordinateLayout : CoordinatorLayout? = null override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { // Inflate the layout for this fragment return inflater.inflate(R.layout.fragment_login, container, false) } override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) mCoordinateLayout = activity!!.findViewById(R.id.coordinateLayout) loginButton.setOnClickListener{ processLogin() } registrationTV.setOnClickListener{ launchRegistrationPage() } } override fun onResume() { super.onResume() registerAuthenticationBroadcast() } override fun onPause() { super.onPause() context?.unregisterReceiver(mBroadcastReceiver) } override fun onAttach(context: Context?) { super.onAttach(context) if (context is NavigationListener) { mNavigationListener = context } if (context is DisplayLoaderListener) { mLoaderListener = context } } override fun onDetach() { super.onDetach() mNavigationListener = null } /** * Register user login status receiver to proceed to users list when authenticated. * */ private fun registerAuthenticationBroadcast(){ mBroadcastReceiver = object : BroadcastReceiver() { override fun onReceive(context: Context, intent: Intent) { val action = intent.action when (action) { InnoChatConnectionService.UI_AUTHENTICATED -> { Log.d(TAG, "Got a broadcast to show the main app window") val prefs = PreferenceManager.getDefaultSharedPreferences(activity) prefs.edit().putBoolean(Constants.SP_LOGIN_STATUS, true).commit() mLoaderListener?.hideLoader() mNavigationListener?.showUserListScreen() } InnoChatConnectionService.UI_AUTH_FAILED -> { mLoaderListener?.hideLoader() showLoginFailedMessage() } } } } val filter = IntentFilter(InnoChatConnectionService.UI_AUTHENTICATED) filter.addAction(InnoChatConnectionService.UI_AUTH_FAILED) context?.registerReceiver(mBroadcastReceiver, filter) } /** * Attempts to sign-in the account specified by the login form. * If there are form errors (invalid email, missing fields, etc.), the * errors are presented and no actual login attempt is made. */ private fun processLogin() { // Reset errors. userNameET.error = null passwordET.error = null val userName = userNameET.text.toString() val password = passwordET.text.toString() var cancel = false var focusView: View? = null // Check for a valid password, if the user entered one. if (TextUtils.isEmpty(password)) { passwordET.error = getString(R.string.error_field_required) focusView = passwordET cancel = true } // Check for a valid username if (TextUtils.isEmpty(userName)) { userNameET.error = getString(R.string.error_field_required) focusView = userNameET cancel = true } if (cancel) { // There was an error; don't attempt login focusView!!.requestFocus() } else { // Show a progress spinner, and kick off a background task to // perform the user login attempt. mLoaderListener?.showLoader() val password = passwordET.text.toString() var username = userNameET.text.toString() if (!username.contains("@")) { username = "$userName@${Constants.HOST}" } //Save the credentials and login saveCredentialsAndLogin(username, password) } } /** * Saves credentials in sharedpreferences for login purpose. * This has to be stored as encrypted string for better security. * * Start the service to initiate login with xmpp server * */ private fun saveCredentialsAndLogin(username:String, password:String) { val prefs = PreferenceManager.getDefaultSharedPreferences(activity) prefs.edit() .putString(Constants.SP_USER_NAME, username) .putString(Constants.SP_PASSWORD, password) .commit() //Start the service val i1 = Intent(activity, InnoChatConnectionService::class.java) context?.startService(i1) } /** * Launches browser tab with registration page. * */ private fun launchRegistrationPage() { val customTabsIntent = CustomTabsIntent.Builder() .addDefaultShareMenuItem() .setToolbarColor(this.resources .getColor(R.color.colorPrimary)) .setShowTitle(true) //.setCloseButtonIcon(getDrawable(R.drawable.ic_close)) .build() customTabsIntent.launchUrl(context!!, Uri.parse(getString(R.string.registration_url))) } private fun showLoginFailedMessage() { if (mCoordinateLayout != null) { val snackbar = Snackbar.make(mCoordinateLayout!!, getString(R.string.msg_login_failed), Snackbar.LENGTH_LONG) snackbar.setAction(getString(R.string.ok)) { snackbar.dismiss() } snackbar.show() } else { Log.w(TAG, "showLoginFailedMessage") } } }
1
null
1
1
20f79cfff856d2d4ace3eb81052556e0a573542e
7,081
InnoChat
The Unlicense
Frontend/TRANSFINITTE24IPdapp/app/src/main/java/com/example/transfinitte_24_ip_dapp/screens/PatentDetailPage.kt
FrenchMartini
874,816,359
false
{"Kotlin": 45473, "Solidity": 7236, "JavaScript": 5652}
package com.example.transfinitte_24_ip_dapp.screens import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.tooling.preview.Preview import androidx.navigation.NavController import androidx.navigation.compose.rememberNavController @Composable fun PatentDetailPage( patentId: String, title: String, abstract: String, description: String, navController: NavController ) { } @Preview @Composable private fun prev() { PatentDetailPage( patentId = "awd", title = "aedaefe", abstract ="e,ifawuiefwliuef", description = " oeifoaedjowi;f", navController = rememberNavController() ) }
1
Kotlin
1
0
cdac936aee1545ddd3db8ddab5dbca595b4ae478
696
TRANSFINITTE_24
MIT License
app/src/test/java/io/fluks/InitModuleMock.kt
yaneq6
169,347,692
false
{"Gradle": 10, "Java Properties": 2, "Shell": 1, "Text": 1, "Ignore List": 2, "Batchfile": 1, "Proguard": 1, "Kotlin": 82, "XML": 34, "SVG": 2, "Java": 1}
package io.fluks object InitModuleMock : Init.Component { override fun leakCanary() { // no-op } override fun vectorDrawables() { // no-op } override fun logging() { // no-op } }
0
Kotlin
0
2
96ab0f8c34f52cf6f6e287e2317cb144c0b954e9
229
fluKs
MIT License
src/main/kotlin/Vec2d.kt
monicaerica
467,867,872
false
{"Kotlin": 131705, "Jupyter Notebook": 44578, "Shell": 13158, "HTML": 8763, "Batchfile": 6773, "JavaScript": 5252, "CSS": 3780, "Python": 1720}
import kotlin.math.abs class Vec2d( var u: Float = 0.0f, var v: Float = 0.0f, ) { fun IsClose(other: Vec2d, epsilon: Float = 1e-5f): Boolean{ var isclose: Boolean = false if (abs(this.u - other.u) < epsilon && abs(this.v - other.v) < epsilon) { isclose = true } return isclose } /** * Returns the sum of two vectors * @param other: The other vector to be summed with the original * @return A Vec2d given by the sum of the original and the other vector */ operator fun plus(other: Vec2d): Vec2d { return Vec2d(u + other.u, u + other.u) } }
0
Kotlin
0
0
3f9e0913cac666e4324cb66a1a14bab2e2ff38fc
640
myraytracer
MIT License
src/test/kotlin/io/usoamic/testcli/AccountManagerTest.kt
usoamic
194,265,029
false
null
package io.usoamic.testcli import io.usoamic.cli.core.Core import io.usoamic.cli.exception.ValidateUtilException import io.usoamic.testcli.other.TestConfig import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows import org.web3j.crypto.MnemonicUtils import org.web3j.crypto.WalletUtils import javax.inject.Inject class AccountManagerTest { @Inject lateinit var core: Core init { BaseUnitTest.componentTest.inject(this) } @Test fun importMnemonicPhraseTest() { val mnemonicPhrase = "denial wrist culture into guess parade lesson black member shove wisdom strike" core.getResponse("import_mnemonic_phrase ${TestConfig.PASSWORD} '$mnemonicPhrase'") } @Test fun accountTestWhenMnemonicPhraseIsEmpty() { val mnemonicPhrase = "" assertThrows<ValidateUtilException> { core.getResponse("import_mnemonic_phrase ${TestConfig.PASSWORD} '$mnemonicPhrase'") } } @Test fun accountTestWhenMnemonicPhraseIsInvalid() { val mnemonicPhrase = "culture into" assertThrows<ValidateUtilException> { core.getResponse("import_mnemonic_phrase ${TestConfig.PASSWORD} '$mnemonicPhrase'") } } @Test fun importPrivateKeyTest() { val privateKey = "0x5baac668d2baaf61478294b44a83955779cace044fe8c777c6d6f122deebb8a0" assert(WalletUtils.isValidPrivateKey(privateKey)) core.getResponse("import_private_key ${TestConfig.PASSWORD} $privateKey") } @Test fun accountTestWhenPrivateKeyIsEmpty() { val privateKey = "" assertThrows<ValidateUtilException> { core.getResponse("import_private_key ${TestConfig.PASSWORD} '$privateKey'") } } @Test fun accountTestWhenPrivateKeyIsInvalid() { val privateKey = "0x0as" assertThrows<ValidateUtilException> { core.getResponse("import_private_key ${TestConfig.PASSWORD} '$privateKey'") } } @Test fun createPrivateKeyTest() { val privateKey = core.getResponse("create_private_key") assert(WalletUtils.isValidPrivateKey(privateKey)) } @Test fun createMnemonicPhraseTest() { val mnemonicPhrase = core.getResponse("create_mnemonic_phrase") assert(MnemonicUtils.validateMnemonic(mnemonicPhrase)) } }
0
Kotlin
0
0
4c6da89a2b43ce1d36a2da99a2b50142fae7eba9
2,359
UsoWallet-CLI
MIT License
AcornUtils/js/src/com/acornui/math/random.kt
konsoletyper
105,533,124
false
null
package com.acornui.math internal actual fun random(): Double = js("Math").random().unsafeCast<Double>()
0
Kotlin
3
0
a84b559fe1d1cad01eb9223ad9af73b4d5fb5bc8
105
Acorn
Apache License 2.0
core/taskpool/taskpool-api/src/main/kotlin/io/holunda/camunda/taskpool/api/task/WithPayload.kt
holunda-io
135,994,693
false
null
package io.holunda.camunda.taskpool.api.task import org.camunda.bpm.engine.variable.VariableMap /** * Represents task payload. */ interface WithPayload { /** * Payload. */ val payload: VariableMap /** * Business key. */ val businessKey: String? }
21
null
26
68
0a80b87e49127b355d62f8a32e91a6c355d11419
271
camunda-bpm-taskpool
Apache License 2.0
archer-core/src/commonMain/kotlin/com/m2f/archer/crud/cache/Invalidation.kt
m2f-kt
725,163,141
false
{"Kotlin": 43201, "JavaScript": 1057}
package com.m2f.archer.crud.cache import com.m2f.archer.configuration.Configuration import com.m2f.archer.configuration.DefaultConfiguration import com.m2f.archer.crud.ArcherRaise import com.m2f.archer.crud.cache.memcache.CacheMetaInformation import kotlinx.datetime.Instant suspend inline fun <reified A> ArcherRaise.invalidateCache( configuration: Configuration = DefaultConfiguration, key: Any, ) { @Suppress("NullableToStringCall") val info = CacheMetaInformation( key = key.toString(), classIdentifier = A::class.simpleName.toString(), ) configuration.cache.put(info, Instant.DISTANT_PAST) }
5
Kotlin
3
7
a9f57f7900c025f19439fc4dc43fc26b9788d3d3
640
Archer
Apache License 2.0
map/src/main/kotlin/de/darkatra/bfme2/map/blendtile/CliffTextureMapping.kt
DarkAtra
325,887,805
false
{"Kotlin": 263823}
package de.darkatra.bfme2.map.blendtile import de.darkatra.bfme2.Vector2 data class CliffTextureMapping( val textureTile: UInt, val bottomLeftCoords: Vector2, val bottomRightCoords: Vector2, val topRightCoords: Vector2, val topLeftCoords: Vector2, val unknown2: UShort )
2
Kotlin
0
3
e602ba2bfdff6d627860d20e2093d483de055772
297
bfme2-modding-utils
MIT License
dto/src/main/kotlin/cz/vutbr/fit/knot/enticing/dto/BugReport.kt
d-kozak
180,137,313
false
{"Kotlin": 1104829, "TypeScript": 477922, "Python": 23617, "Shell": 19609, "HTML": 8510, "ANTLR": 2005, "CSS": 1432}
package cz.vutbr.fit.knot.enticing.dto import cz.vutbr.fit.knot.enticing.dto.interval.Interval import javax.validation.Valid import javax.validation.constraints.NotBlank import javax.validation.constraints.Positive /** * Contains necessary information to replicate invalid match */ data class BugReport( @field:NotBlank val query: String, val filterOverlaps: Boolean, @field:NotBlank val host: String, @field:NotBlank val collection: String, @field:Positive val documentId: Int, @field:NotBlank val documentTitle: String, @field:Valid val matchInterval: Interval, val description: String )
0
Kotlin
0
0
1ea9f874c6d2e4ea158e20bbf672fc45bcb4a561
705
enticing
MIT License
blahblah-fake/src/commonMain/kotlin/io/spherelabs/blahblahfake/provider/PokemonProvider.kt
getspherelabs
675,959,138
false
null
package io.spherelabs.blahblahfake.provider import io.spherelabs.blahblahfake.exception.UnsupportedPathException import io.spherelabs.blahblahfake.internal.resolver import io.spherelabs.blahblahfake.path.Path import io.spherelabs.blahblahfake.path.PokemonPath import io.spherelabs.blahblahyaml.provider.YamlProvider internal class PokemonProvider( private val yamlProvider: YamlProvider ) : Provider { override fun get(path: Path): String { return when (path) { is PokemonPath -> resolver { yamlProvider.get(path.value) } else -> throw UnsupportedPathException(path) } } }
2
Kotlin
1
8
02c8e6d8d32aaa3c98396ac4e39358ac8ff1204c
628
blahblah
MIT License
app/src/main/java/com/gottlicher/elektro/MainActivity.kt
FabioCZ
163,694,188
false
null
package com.gottlicher.elektro import android.content.Context import android.os.Bundle import android.support.v7.app.AppCompatActivity import kotlinx.android.synthetic.main.activity_main.* import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.async import kotlinx.coroutines.launch import org.jetbrains.anko.sdk27.coroutines.onClick import java.util.* class MainActivity : AppCompatActivity() { private val bottomIcons = ArrayList<PlayerNavView>(0) private lateinit var bank:Bank var currPl:Int = 0 var numberQ:Deque<Int> = ArrayDeque<Int>(0) override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) startSession() bottomIcons.add(pl1_nav) bottomIcons.add(pl2_nav) bottomIcons.add(pl3_nav) bottomIcons.add(pl4_nav) bottomIcons.add(pl5_nav) bottomIcons.add(pl6_nav) for(i in 0 until MAX_PLAYERS){ bottomIcons[i].onClick { onPlayerClick(i) } } btnZero.onClick { onNumberClick(0) } btnOne.onClick { onNumberClick(1) } btnTwo.onClick { onNumberClick(2) } btnThree.onClick { onNumberClick(3) } btnFour.onClick { onNumberClick(4) } btnFive.onClick { onNumberClick(5) } btnSix.onClick { onNumberClick(6) } btnSeven.onClick { onNumberClick(7) } btnEight.onClick { onNumberClick(8) } btnNine.onClick { onNumberClick(9) } btnPlusTen.onClick { onNumberClick(10) } btnPlusFifteen.onClick { onNumberClick(15) } btnPlus.onClick { onPlusClick() } btnUndo.onClick { onUndoClick() } btnAdd.onClick { onSubAddClick(true) } btnSub.onClick { onSubAddClick(false) } } private fun startSession() = GlobalScope.launch(Dispatchers.Main) { val hasSession = hasPreviousSession() val res = AsyncAlertDialog(R.string.restore_previous, null, if (hasSession) R.string.restore_previous else R.string.no_session, R.string.start_new, null).show(this@MainActivity) if (res == DialogResult.POSITIVE && hasSession){ //restore bank = async { Bank(ArrayList(0), this@MainActivity) }.await() } else { val list = ArrayList<Player>(0); do { val plRes = PlayerAsyncDialog().show(this@MainActivity) list.add(plRes.player) } while (!plRes.done && list.size < 6) bank = Bank(list, this@MainActivity) } for(i in 0 until MAX_PLAYERS) { if (i < bank.playerCt()){ bottomIcons[i].money = bank.getPlayer(i).money bottomIcons[i].color = bank.getPlayer(i).color } else { bottomIcons[i].money = -1 bottomIcons[i].color = Color.DISABLED } } onPlayerClick(0) } override fun onPause() { super.onPause() bank.writeToPref(this) } private fun onPlayerClick(plIndex:Int){ currPl = plIndex setSelectedPlayer() drawTotalMoney() numberQ.clear() numberQ.addFirst(0) drawQ() } private fun onNumberClick(number:Int){ val n = if(numberQ.any()) numberQ.removeFirst() else 0 numberQ.addFirst(n * 10 + number) drawQ() } private fun onUndoClick(){ if (numberQ.any()) { numberQ.removeFirst() } drawQ() } private fun onPlusClick(){ numberQ.addFirst(0) drawQ() } private fun onSubAddClick(doAdd:Boolean) { val tran = + (numberQ.sum() * if (doAdd) 1 else -1) while(bank.getPlayer(currPl).pastTransactions.size > 5){ bank.getPlayer(currPl).pastTransactions.removeLast() } bank.getPlayer(currPl).pastTransactions.addFirst(tran) bank.getPlayer(currPl).money = bank.getPlayer(currPl).money + tran numberQ.clear() drawQ() drawTotalMoney() } private fun drawQ(){ var text = "" for(num in numberQ){ text += "${num}\n" } txtCurrOp.text = text } private fun hasPreviousSession():Boolean{ return getSharedPreferences(PrefKey, Context.MODE_PRIVATE).contains("${PrefName}0") } private fun drawTotalMoney(){ var trText = "" for(tr in bank.getPlayer(currPl).pastTransactions){ trText += tr.toString() + "\n" } txtPast.text = trText txtTotal.text = "${bank.getPlayer(currPl).money}€" bottomIcons[currPl].money = bank.getPlayer(currPl).money } private fun setSelectedPlayer() { for (i in 0 until bank.playerCt()){ bottomIcons[i].plSelected = currPl == i bottomIcons[i].color = bank.getPlayer(i).color } supportActionBar?.title = bank.getPlayer(currPl).name } }
0
Kotlin
0
0
faecf207766a5093825af1e263baab1f72822aad
4,985
Elektro
MIT License
sample-app/src/main/java/com/joinforage/android/example/ui/complete/flow/payment/create/FlowCreatePaymentFragment.kt
teamforage
554,343,430
false
{"Kotlin": 450964}
package com.joinforage.android.example.ui.complete.flow.payment.create import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.ProgressBar import androidx.fragment.app.Fragment import androidx.fragment.app.viewModels import androidx.navigation.fragment.findNavController import com.google.android.material.textfield.TextInputEditText import com.joinforage.android.example.databinding.FragmentFlowCreatePaymentBinding import com.joinforage.android.example.ext.hideKeyboard import dagger.hilt.android.AndroidEntryPoint @AndroidEntryPoint class FlowCreatePaymentFragment : Fragment() { private val viewModel: FlowCreatePaymentViewModel by viewModels() private var _binding: FragmentFlowCreatePaymentBinding? = null private val binding get() = _binding!! private var lastUsedSnapPaymentRef: String? = null private var lastUsedEbtCashPaymentRef: String? = null override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? ): View { _binding = FragmentFlowCreatePaymentBinding.inflate(inflater, container, false) val root: View = binding.root val progressBar: ProgressBar = binding.progressBar viewModel.isLoading.observe(viewLifecycleOwner) { isLoading -> when (isLoading) { true -> progressBar.visibility = View.VISIBLE else -> progressBar.visibility = View.GONE } } binding.submitSnapAmount.setOnClickListener { viewModel.submitSnapAmount( getSnapAmount() ) it.context.hideKeyboard(it) } binding.setSnapRef.setOnClickListener { viewModel.setSnapRef( getPaymentRef(binding.snapAmountEditText) ) it.context.hideKeyboard(it) } binding.submitEbtCashAmount.setOnClickListener { viewModel.submitEbtCashAmount( getEbtCashAmount() ) it.context.hideKeyboard(it) } binding.setEbtCashRef.setOnClickListener { viewModel.setEbtCashRef( getPaymentRef(binding.ebtCashAmountEditText) ) it.context.hideKeyboard(it) } viewModel.snapPaymentResult.observe(viewLifecycleOwner) { binding.snapPaymentRefResponse.text = "" it?.let { binding.snapPaymentResponse.text = """ Amount: ${it.amount} Funding Type: ${it.fundingType} $it """.trimIndent() lastUsedSnapPaymentRef = it.ref } } viewModel.snapPaymentRefResult.observe(viewLifecycleOwner) { binding.snapPaymentResponse.text = "" it?.let { binding.snapPaymentRefResponse.text = "PaymentRef: $it" lastUsedSnapPaymentRef = it } } viewModel.ebtCashPaymentResult.observe(viewLifecycleOwner) { binding.ebtCashPaymentRefResponse.text = "" it?.let { binding.ebtCashResponse.text = """ Amount: ${it.amount} Funding Type: ${it.fundingType} $it """.trimIndent() lastUsedEbtCashPaymentRef = it.ref } } viewModel.ebtCashPaymentRefResult.observe(viewLifecycleOwner) { binding.ebtCashResponse.text = "" it?.let { binding.ebtCashPaymentRefResponse.text = "PaymentRef: $it" lastUsedEbtCashPaymentRef = it } } binding.nextButton.setOnClickListener { findNavController().navigate( FlowCreatePaymentFragmentDirections.actionFlowCreatePaymentFragmentToFlowCapturePaymentFragment( bearer = viewModel.bearer, merchantAccount = viewModel.merchantAccount, paymentMethodRef = viewModel.paymentMethodRef, snapPaymentRef = lastUsedSnapPaymentRef.orEmpty(), cashPaymentRef = lastUsedEbtCashPaymentRef.orEmpty() ) ) } return root } override fun onDestroyView() { super.onDestroyView() _binding = null } private fun getSnapAmount(): Long { return try { binding.snapAmountEditText.text.toString().toLong() } catch (e: NumberFormatException) { 0 } } private fun getPaymentRef(textField: TextInputEditText): String { return try { textField.text.toString() } catch (e: NumberFormatException) { "Unknown value" } } private fun getEbtCashAmount(): Long { return try { binding.ebtCashAmountEditText.text.toString().toLong() } catch (e: NumberFormatException) { 0 } } }
1
Kotlin
0
0
b4714796c1dbb6e25b9a34084f102c86ea621b2e
5,128
forage-android-sdk
MIT License
core/src/main/kotlin/pl/stosik/paygrind/core/port/driven/TimeProvider.kt
stosik
743,314,052
false
{"Kotlin": 119093, "Dockerfile": 467, "Shell": 401}
package pl.stosik.paygrind.core.port.driven import java.time.LocalDateTime interface TimeProvider { fun now(): LocalDateTime }
0
Kotlin
0
0
311bb2c445df55f7e6a334542bad9e783c11a6e6
132
paygrind
Creative Commons Zero v1.0 Universal
src/main/kotlin/no/nav/fo/veilarbregistrering/registrering/reaktivering/ReaktiveringBrukerService.kt
navikt
131,013,336
false
null
package no.nav.fo.veilarbregistrering.registrering.reaktivering import no.nav.fo.veilarbregistrering.aktorIdCache.AktorIdCacheService import no.nav.fo.veilarbregistrering.bruker.Bruker import no.nav.fo.veilarbregistrering.log.loggerFor import no.nav.fo.veilarbregistrering.log.secureLogger import no.nav.fo.veilarbregistrering.metrics.Events import no.nav.fo.veilarbregistrering.metrics.MetricsService import no.nav.fo.veilarbregistrering.oppfolging.OppfolgingGateway import no.nav.fo.veilarbregistrering.registrering.Tilstandsfeil import no.nav.fo.veilarbregistrering.registrering.bruker.BrukerTilstandService import no.nav.fo.veilarbregistrering.registrering.bruker.RegistreringType import org.springframework.transaction.annotation.Transactional open class ReaktiveringBrukerService( private val brukerTilstandService: BrukerTilstandService, private val reaktiveringRepository: ReaktiveringRepository, private val oppfolgingGateway: OppfolgingGateway, private val metricsService: MetricsService, private val aktorIdCacheService: AktorIdCacheService ) { @Transactional open fun reaktiverBruker(bruker: Bruker, erVeileder: Boolean) { val brukersTilstand = brukerTilstandService.hentBrukersTilstand(bruker) if (!brukersTilstand.kanReaktiveres()) { secureLogger.warn("Bruker, ${bruker.aktorId}, kan ikke reaktiveres fordi utledet registreringstype er ${brukersTilstand.registreringstype}") metricsService.registrer(Events.REGISTRERING_TILSTANDSFEIL, Tilstandsfeil.KAN_IKKE_REAKTIVERES) throw KanIkkeReaktiveresException( "Bruker kan ikke reaktiveres fordi utledet registreringstype er ${brukersTilstand.registreringstype}" ) } reaktiveringRepository.lagreReaktiveringForBruker(bruker) aktorIdCacheService.settInnAktorIdHvisIkkeFinnes(bruker.gjeldendeFoedselsnummer, bruker.aktorId) oppfolgingGateway.reaktiverBruker(bruker.gjeldendeFoedselsnummer) LOG.info("Reaktivering av bruker med aktørId : {}", bruker.aktorId) if (erVeileder) { metricsService.registrer(Events.MANUELL_REAKTIVERING_EVENT) } metricsService.registrer(Events.REGISTRERING_FULLFORING_REGISTRERINGSTYPE, RegistreringType.REAKTIVERING) } open fun kanReaktiveres(bruker: Bruker): Boolean { val kanReaktiveres = oppfolgingGateway.kanReaktiveres(bruker.gjeldendeFoedselsnummer) return kanReaktiveres ?: false } companion object { private val LOG = loggerFor<ReaktiveringBrukerService>() } }
16
Kotlin
4
5
ff51365eb80b34a973f5fe89bddd69b1c8e5ce0e
2,586
veilarbregistrering
MIT License
app/src/main/java/xyz/nulldev/ts/sync/SyncService.kt
TachiWeb
66,624,691
false
null
package xyz.nulldev.ts.sync import retrofit2.Call import retrofit2.http.Body import retrofit2.http.GET import retrofit2.http.POST import retrofit2.http.Path import xyz.nulldev.ts.sync.model.GetSyncStatusApiResponse import xyz.nulldev.ts.sync.model.StartSyncApiResponse import xyz.nulldev.ts.sync.model.SyncRequest /** * Retrofit sync service */ interface SyncService { @POST("/api/sync") fun startSyncTask(@Body syncRequest: SyncRequest): Call<StartSyncApiResponse> @GET("/api/task/{taskId}") fun getSyncStatus(@Path("taskId") taskId: Long): Call<GetSyncStatusApiResponse> }
0
null
0
5
9dac958ed1414338dfff825c8d7dbe78fb98209a
595
tachiyomi
Apache License 2.0
src/main/kotlin/ui/composable/elements/iconButtons/IconClickableText.kt
jskako
686,469,615
false
{"Kotlin": 160737, "VBScript": 410, "Batchfile": 108}
package ui.composable.elements.iconButtons import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.width import androidx.compose.material3.Icon import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp import utils.Colors.darkBlue import utils.EMPTY_STRING @Composable fun IconClickableText( icon: ImageVector, iconColor: Color = darkBlue, text: String, contentDescription: String = EMPTY_STRING, function: () -> Unit ) { Row( verticalAlignment = Alignment.CenterVertically ) { Icon( imageVector = icon, contentDescription = contentDescription, tint = iconColor ) Spacer(modifier = Modifier.width(8.dp)) Text( modifier = Modifier.clickable { function() }, textAlign = TextAlign.Center, text = text ) } }
7
Kotlin
1
16
19b7dff7ef4725bc0c327b2d2321139c5c6e47cf
1,291
DroidSense
Apache License 2.0
hesapmakinesi-master/app/src/main/java/com/example/hesapmakinesi/MainActivity.kt
Kodluyoruz-Flutter-Bootcamp
559,950,320
false
null
package com.example.hesapmakinesi import androidx.appcompat.app.AppCompatActivity import android.os.Bundle import android.view.View import android.widget.Button import kotlinx.android.synthetic.main.activity_main.* class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) } fun btnSayiTik(view: View) { if(yeniOperator) { sayiGoster.setText(" ") } yeniOperator=false var btnSec = view as Button var btnTikDeger: String = sayiGoster.text.toString() when(btnSec.id) { btn0.id->{ btnTikDeger+="0" } btn1.id->{ btnTikDeger+="1" } btn2.id->{ btnTikDeger+="2" } btn3.id->{ btnTikDeger+="3" } btn4.id->{ btnTikDeger+="4" } btn5.id->{ btnTikDeger+="5" } btn6.id->{ btnTikDeger+="6" } btn7.id->{ btnTikDeger+="7" } btn8.id->{ btnTikDeger+="8" } btn9.id->{ btnTikDeger+="9" } btnArtiEksi.id->{ btnTikDeger="-"+btnTikDeger } btnNokta.id-> { btnTikDeger=btnTikDeger+"." } } sayiGoster.setText(btnTikDeger) } var operator="*" var eskiSayi="" var yeniOperator=true fun btnOptik(view:View) { var btnSec=view as Button when(btnSec.id) { btnBolme.id-> { operator="/" } btnCarpi.id-> { operator="x" } btnEksi.id-> { operator="-" } btnArti.id-> { operator="+" } } eskiSayi=sayiGoster.text.toString() yeniOperator=true } fun btnEsittirTik(view:View) { var yenisayi=sayiGoster.text.toString() var sonucSayisi:Double?=null when(operator) { "/"-> { sonucSayisi=eskiSayi.toDouble()/yenisayi.toDouble() } "x"-> { sonucSayisi=eskiSayi.toDouble()*yenisayi.toDouble() } "-"-> { sonucSayisi=eskiSayi.toDouble()-yenisayi.toDouble() } "+"-> { sonucSayisi=eskiSayi.toDouble()+yenisayi.toDouble() } } sayiGoster.setText(sonucSayisi.toString()) yeniOperator=true } fun btnSilTik(view:View) { sayiGoster.setText("0") yeniOperator=true } fun btnYuzdeTik(view:View) { var sayi:Double=sayiGoster.text.toString().toDouble()/100 sayiGoster.setText(sayi.toString()) yeniOperator=true } }
0
Kotlin
0
0
cd838ca2aa58eddf9d765bab9098f2aef06077c3
3,043
week-1homework-sibergold
MIT License
src/main/kotlin/cn/gionrose/facered/hook/VaultHook.kt
13022631363
681,233,772
false
null
package cn.gionrose.facered.hook import cn.gionrose.facered.ProcessCraft import net.milkbowl.vault.economy.Economy import org.bukkit.Bukkit import org.bukkit.entity.Player object VaultHook: Hook { var isLoad = false lateinit var econ: Economy override fun load () { if (Bukkit.getPluginManager().isPluginEnabled("Vault")) { Bukkit.getServicesManager().getRegistration(Economy::class.java)?.let { econ = it.provider ProcessCraft.INSTANCE.logger.info("Vault 准备就绪") isLoad = true } } } fun getMoney (player: Player): Double { if (!isLoad) return 0.0 return econ.getBalance(player) } fun giveMoney (player: Player, amount: Double) { if (!isLoad) return econ.depositPlayer(player, amount) } fun takeMoney (player: Player, amount: Double) { if (!isLoad) return econ.withdrawPlayer(player, amount) } }
0
Kotlin
0
0
759ae53c43d889a8b9deb846a40e2adbee20b13c
1,042
Processcraft
Apache License 2.0
src/main/kotlin/com/example/paul/blog/models/User.kt
pauldragoslav
214,669,673
false
null
package com.example.paul.blog.models import javax.persistence.Entity import javax.persistence.GeneratedValue import javax.persistence.Id @Entity class User( var login: String, var firstname: String, var lastname: String, var description: String? = null, @Id @GeneratedValue var id: Long? = null )
0
Kotlin
0
0
5f149fb39e71b62148109dafeaf9364debee6592
355
Kotlin-Spring-MVC
MIT License
app/src/main/java/ru/tech/cookhelper/core/di/RepositoryModule.kt
T8RIN
483,296,940
false
null
package ru.tech.cookhelper.core.di import com.squareup.moshi.Moshi import dagger.Module import dagger.Provides import dagger.hilt.InstallIn import dagger.hilt.components.SingletonComponent import ru.tech.cookhelper.data.local.database.Database import ru.tech.cookhelper.data.remote.api.auth.AuthService import ru.tech.cookhelper.data.remote.api.chat.ChatApi import ru.tech.cookhelper.data.remote.api.ingredients.FridgeApi import ru.tech.cookhelper.data.remote.api.user.UserApi import ru.tech.cookhelper.data.remote.web_socket.feed.FeedService import ru.tech.cookhelper.data.remote.web_socket.message.MessageService import ru.tech.cookhelper.data.remote.web_socket.user.UserService import ru.tech.cookhelper.data.repository.FridgeRepositoryImpl import ru.tech.cookhelper.data.repository.MessageRepositoryImpl import ru.tech.cookhelper.data.repository.SettingsRepositoryImpl import ru.tech.cookhelper.data.repository.UserRepositoryImpl import ru.tech.cookhelper.data.utils.JsonParser import ru.tech.cookhelper.data.utils.MoshiParser import ru.tech.cookhelper.domain.repository.FridgeRepository import ru.tech.cookhelper.domain.repository.MessageRepository import ru.tech.cookhelper.domain.repository.SettingsRepository import ru.tech.cookhelper.domain.repository.UserRepository import javax.inject.Singleton @Module @InstallIn(SingletonComponent::class) object RepositoryModule { @Provides @Singleton fun provideSettingsRepository( db: Database ): SettingsRepository = SettingsRepositoryImpl( settingsDao = db.settingsDao ) @Provides @Singleton fun provideUserRepository( authService: AuthService, userApi: UserApi, db: Database, feedService: FeedService, userService: UserService ): UserRepository = UserRepositoryImpl( authService = authService, userApi = userApi, userDao = db.userDao, feedService = feedService, userService = userService ) @Provides @Singleton fun provideMessageRepository( messageService: MessageService, chatApi: ChatApi, jsonParser: JsonParser ): MessageRepository = MessageRepositoryImpl( jsonParser = jsonParser, messageService = messageService, chatApi = chatApi ) @Provides @Singleton fun provideIngredientsRepository( fridgeApi: FridgeApi ): FridgeRepository = FridgeRepositoryImpl(fridgeApi) @Provides fun provideJsonParser(): JsonParser = MoshiParser(Moshi.Builder().build()) }
1
Kotlin
10
91
cee8f8d8cd6bfc53e88c461edc1c9aaf43ce18c7
2,550
CookHelper
Apache License 2.0
modules/router/sources-js/RRoutes.kt
fluidsonic
316,835,394
false
null
package io.fluidsonic.react.router import io.fluidsonic.react.* import io.fluidsonic.react.router.external.* @PublishedApi internal external interface RRoutesProps : RProps.WithChildren { var basename: String? } @RDsl public inline fun RBuilder.Routes( basename: String? = undefined, content: RBuilder.() -> Unit, ) { ReactRouter_Routes::class { attrs.basename = basename content() } }
0
Kotlin
2
12
4cbd8a4efad8109376c8fbaf4ad355dd651c5580
402
fluid-react
Apache License 2.0
app/src/release/java/ru/luckycactus/steamroulette/ReleaseApp.kt
luckycactus
196,364,852
false
null
package ru.luckycactus.steamroulette import dagger.hilt.android.HiltAndroidApp import ru.luckycactus.steamroulette.presentation.common.App @HiltAndroidApp class ReleaseApp: App()
0
Kotlin
0
5
c6c2b00ca77f8224145ef3182b1910bd249d76ba
180
steam-roulette
Apache License 2.0
shared/src/main/kotlin/react/ReactDeclarations.kt
ScottPierce
118,350,787
false
{"Kotlin": 4456, "Objective-C": 4407, "JavaScript": 1507, "Java": 1405}
package react @JsModule("react") external object React { abstract class Component<P, S>( props: P? = definedExternally, context: Any? = definedExternally ) { abstract fun render(): dynamic } fun createElement(elementClass: dynamic, props: dynamic, vararg children: dynamic): dynamic }
0
Kotlin
9
81
da9850cd5eba3940bc9ca3110ab678d300688ea0
311
kotlin-react-native
Apache License 2.0
api/src/main/kotlin/no/nav/helsearbeidsgiver/inntektsmelding/api/response/RedisTimeoutResponse.kt
navikt
495,713,363
false
{"Kotlin": 764083, "Dockerfile": 68}
@file:UseSerializers(UuidSerializer::class) package no.nav.helsearbeidsgiver.inntektsmelding.api.response import kotlinx.serialization.Serializable import kotlinx.serialization.UseSerializers import no.nav.helsearbeidsgiver.utils.json.serializer.UuidSerializer import java.util.UUID @Serializable data class RedisTimeoutResponse( val uuid: UUID ) { val error = "Brukte for lang tid mot redis." }
15
Kotlin
0
2
e3e267c925349c7285289b94b9806cace5112008
407
helsearbeidsgiver-inntektsmelding
MIT License
backend/src/test/kotlin/nl/volt/kamerkijker/kkbackend/api/AbstractITCase.kt
jneeven
367,417,657
false
{"Python": 10288, "Kotlin": 3863, "Dockerfile": 200, "Shell": 95}
package nl.volt.kamerkijker.kkbackend.api import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper import io.kotlintest.extensions.TestListener import io.kotlintest.specs.BehaviorSpec import io.kotlintest.spring.SpringListener import org.slf4j.LoggerFactory import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.test.context.SpringBootTest import org.springframework.boot.test.web.client.TestRestTemplate import org.springframework.context.annotation.Profile import org.springframework.http.HttpHeaders import java.time.format.DateTimeFormatter @Profile(*["ci","localci"]) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) abstract class AbstractITCase : BehaviorSpec() { @Autowired lateinit var testRestTemplate: TestRestTemplate val logger = LoggerFactory.getLogger(this::class.java) val mapper = jacksonObjectMapper().registerModule(JavaTimeModule()) val formatter = DateTimeFormatter.ofPattern("dd-MM-yyyy HH:mm:ss.SSSSSS") override fun listeners(): List<TestListener> { return listOf(SpringListener) } val headers = HttpHeaders() }
5
Python
0
0
37ddf2834e2d1657dffd7482b188ddf1bd4d9e10
1,196
KamerKijker
MIT License
svg-to-compose/src/nativeMain/kotlin/dev/tonholo/s2c/extensions/Path.extension.native.kt
rafaeltonholo
659,782,425
false
{"Kotlin": 518715, "Shell": 5365}
package dev.tonholo.s2c.extensions import okio.FileSystem import okio.Path actual val Path.fileSystem: FileSystem get() = FileSystem.SYSTEM
5
Kotlin
2
61
b3e7c5ffa041d5d31c686d72b9119661b5e4ce7b
146
svg-to-compose
MIT License
app/src/main/java/com/dinhlam/sharebox/ui/home/videomixer/modelview/TiktokVideoModelView.kt
dinhlamvn
532,200,939
false
null
package com.dinhlam.sharebox.ui.home.videomixer.modelview import android.annotation.SuppressLint import android.graphics.Color import android.media.MediaPlayer import android.net.Uri import android.view.LayoutInflater import android.view.ViewGroup import androidx.core.view.isVisible import com.dinhlam.sharebox.R import com.dinhlam.sharebox.base.BaseListAdapter import com.dinhlam.sharebox.data.model.ShareDetail import com.dinhlam.sharebox.databinding.ModelViewVideoTiktokBinding import com.dinhlam.sharebox.extensions.asBookmarkIcon import com.dinhlam.sharebox.extensions.takeIfNotNullOrBlank import com.dinhlam.sharebox.imageloader.ImageLoader import com.dinhlam.sharebox.imageloader.config.ImageLoadScaleType import com.dinhlam.sharebox.imageloader.config.TransformType data class TiktokVideoModelView( val id: String, val videoUri: String, val shareDetail: ShareDetail, val actionShareToOther: BaseListAdapter.NoHashProp<Function1<String, Unit>> = BaseListAdapter.NoHashProp( null ), val actionVote: BaseListAdapter.NoHashProp<Function1<String, Unit>> = BaseListAdapter.NoHashProp( null ), val actionComment: BaseListAdapter.NoHashProp<Function1<String, Unit>> = BaseListAdapter.NoHashProp( null ), val actionBookmark: BaseListAdapter.NoHashProp<Function1<String, Unit>> = BaseListAdapter.NoHashProp( null ), ) : BaseListAdapter.BaseModelView(id) { override fun createViewHolder( inflater: LayoutInflater, container: ViewGroup ): BaseListAdapter.BaseViewHolder<*, *> { return TiktokVideoViewHolder( ModelViewVideoTiktokBinding.inflate( inflater, container, false ) ) } @SuppressLint("SetJavaScriptEnabled") private class TiktokVideoViewHolder(binding: ModelViewVideoTiktokBinding) : BaseListAdapter.BaseViewHolder<TiktokVideoModelView, ModelViewVideoTiktokBinding>(binding) { private var mediaPlayer: MediaPlayer? = null init { binding.bottomAction.apply { setVoteIcon(R.drawable.ic_arrow_up_white) setCommentIcon(R.drawable.ic_comment_white) setShareIcon(R.drawable.ic_share_white) setVoteTextColor(Color.WHITE) setCommentTextColor(Color.WHITE) } binding.imagePlay.setOnClickListener { view -> if (mediaPlayer?.isPlaying == true) { mediaPlayer?.pause() binding.imagePlay.setImageResource(R.drawable.ic_play_white) } else { mediaPlayer?.start() binding.imagePlay.setImageResource(R.drawable.ic_pause_white) } view.postDelayed({ binding.imagePlay.setImageDrawable(null) }, 2000) } binding.videoView.setOnPreparedListener { mediaPlayer -> this.mediaPlayer = mediaPlayer mediaPlayer.isLooping = true binding.videoView.start() } binding.videoView.requestFocus() } override fun onBind(model: TiktokVideoModelView, position: Int) { binding.videoView.stopPlayback() binding.videoView.setVideoURI(Uri.parse(model.videoUri)) binding.bottomAction.setBookmarkIcon( model.shareDetail.bookmarked.asBookmarkIcon( R.drawable.ic_bookmarked_white, R.drawable.ic_bookmark_white ) ) binding.bottomAction.setOnShareClickListener { model.actionShareToOther.prop?.invoke(model.shareDetail.shareId) } binding.bottomAction.setOnCommentClickListener { model.actionComment.prop?.invoke(model.shareDetail.shareId) } binding.bottomAction.setOnLikeClickListener { model.actionVote.prop?.invoke(model.shareDetail.shareId) } binding.bottomAction.setOnBookmarkClickListener { model.actionBookmark.prop?.invoke(model.shareDetail.shareId) } binding.bottomAction.setVoteNumber(model.shareDetail.voteCount) binding.bottomAction.setCommentNumber(model.shareDetail.commentCount) binding.textViewName.text = model.shareDetail.user.name ImageLoader.instance.load( buildContext, model.shareDetail.user.avatar, binding.imageAvatar ) { copy(transformType = TransformType.Circle(ImageLoadScaleType.CenterCrop)) } model.shareDetail.shareNote.takeIfNotNullOrBlank()?.let { text -> binding.textNote.isVisible = true binding.textNote.setReadMoreText(text) } ?: binding.textNote.apply { text = null isVisible = false } } override fun onUnBind() { if (binding.videoView.isPlaying) { binding.videoView.pause() binding.videoView.stopPlayback() } binding.textNote.text = null binding.bottomAction.release() ImageLoader.instance.release(buildContext, binding.imageAvatar) } } }
0
Kotlin
0
0
20e11187f2ca4ba5dc89102d030251358cd2aa40
5,373
sharebox
MIT License
composeApp/src/commonMain/kotlin/de/cacheoverflow/cashflow/ui/settings/AuthSettings.kt
Cach30verfl0w
808,336,331
false
{"Kotlin": 103104, "Swift": 661}
/* * Copyright 2024 Cach30verfl0w * * 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 de.cacheoverflow.cashflow.ui.settings import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.ColumnScope import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.padding import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Check import androidx.compose.material.icons.filled.Close import androidx.compose.material.icons.filled.Info import androidx.compose.material.icons.filled.QueryStats import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp import com.arkivanov.decompose.ComponentContext import de.cacheoverflow.cashflow.security.ISecurityProvider import de.cacheoverflow.cashflow.ui.View import de.cacheoverflow.cashflow.ui.components.Modal import de.cacheoverflow.cashflow.ui.components.ModalType import de.cacheoverflow.cashflow.ui.components.SettingsGroup import de.cacheoverflow.cashflow.utils.DI import de.cacheoverflow.cashflow.utils.algorithmUsed import de.cacheoverflow.cashflow.utils.authenticationSettings import de.cacheoverflow.cashflow.utils.keyringNotSecured import de.cacheoverflow.cashflow.utils.keyringNotUnlocked import de.cacheoverflow.cashflow.utils.keyringSecured import de.cacheoverflow.cashflow.utils.keyringUnlocked import de.cacheoverflow.cashflow.utils.rsaExplanation class AuthSettingsComponent( private val context: ComponentContext, internal val onBack: () -> Unit ): ComponentContext by context @Composable fun AutoInfo(text: String, modalTitle: String, modalContent: @Composable ColumnScope.() -> Unit) { val showModal = remember { mutableStateOf(false) } Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.clickable { showModal.value = true }) { Icon(Icons.Filled.Info, null, tint = MaterialTheme.colorScheme.onSecondary) Text(text, color = MaterialTheme.colorScheme.onSecondary) } Modal(showModal, title = modalTitle, type = ModalType.INFO, content = modalContent) } @Composable fun AuthStatus(ifTrueText: String, ifFalseText: String, value: Boolean) { Row(verticalAlignment = Alignment.CenterVertically) { if (value) { Icon(Icons.Filled.Check, null, tint = MaterialTheme.colorScheme.primary) Text(ifTrueText, color = MaterialTheme.colorScheme.primary) } else { Icon(Icons.Filled.Close, null, tint = MaterialTheme.colorScheme.error) Text(ifFalseText, color = MaterialTheme.colorScheme.error) } } } @Composable fun AuthSettings(component: AuthSettingsComponent) { val securityProvider = DI.inject<ISecurityProvider>() val asymmetricProvider = securityProvider.getAsymmetricCryptoProvider() val isAuthenticated by securityProvider.wasAuthenticated().collectAsState() View(authenticationSettings(), onButton = component.onBack) { SettingsGroup( "Status", Icons.Filled.QueryStats, innerModifier = Modifier.padding(start = 12.dp) ) { AuthStatus(keyringSecured(), keyringNotSecured(), true) AuthStatus(keyringUnlocked(), keyringNotUnlocked(), isAuthenticated) AutoInfo(algorithmUsed(asymmetricProvider.getName()), asymmetricProvider.getName()) { Text(rsaExplanation(), color = MaterialTheme.colorScheme.onSecondary) } } } }
0
Kotlin
0
0
a5cdb3838b6b49de8fd3e249e25e87b7a3141a1f
4,358
cash3fl0w
Apache License 2.0
app/src/main/java/com/parsanatech/crazycoder/MainActivity.kt
Yash-Parsana
605,085,323
false
{"Kotlin": 230490}
package com.parsanatech.crazycoder import android.content.Intent import android.os.Bundle import android.util.Log import androidx.appcompat.app.AppCompatActivity import androidx.fragment.app.Fragment import com.google.firebase.auth.FirebaseAuth import com.google.firebase.firestore.FirebaseFirestore import com.parsanatech.crazycoder.Fragment.* import com.parsanatech.crazycoder.databinding.ActivityMainBinding import android.content.SharedPreferences import android.graphics.Color import android.view.View import android.widget.Toast import com.google.android.material.snackbar.Snackbar import com.google.android.play.core.appupdate.AppUpdateManager import com.google.android.play.core.appupdate.AppUpdateManagerFactory import com.google.android.play.core.install.InstallState import com.google.android.play.core.install.model.AppUpdateType import com.google.android.play.core.install.model.InstallStatus import com.google.android.play.core.install.model.UpdateAvailability import com.google.android.play.core.review.ReviewManager import com.google.android.play.core.review.ReviewManagerFactory import com.google.android.play.core.review.model.ReviewErrorCode import io.grpc.internal.LogExceptionRunnable class MainActivity : AppCompatActivity() { private val MODE_PRIVATE: Int=0 lateinit var binding:ActivityMainBinding lateinit var auth:FirebaseAuth lateinit var fireStoreDb:FirebaseFirestore lateinit var updateManager:AppUpdateManager private val MY_REQUEST_CODE = 500 lateinit var reviewManager:ReviewManager override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) binding= ActivityMainBinding.inflate(layoutInflater) setContentView(binding.root) supportActionBar?.hide() reviewManager=ReviewManagerFactory.create(this) updateManager=AppUpdateManagerFactory.create(this) updateManager.appUpdateInfo.addOnSuccessListener { if(it.updateAvailability()==UpdateAvailability.UPDATE_AVAILABLE&&it.isUpdateTypeAllowed(AppUpdateType.FLEXIBLE)) { try { updateManager.startUpdateFlowForResult(it,AppUpdateType.FLEXIBLE,this,MY_REQUEST_CODE) } catch (e:Exception) { } } }.addOnFailureListener { Log.e("Failed to load update avaiable Dialog",it.toString()) } try { val sharedPref = this.getSharedPreferences( "com.example.CrazyCoder", this.MODE_PRIVATE)?:return with(sharedPref.edit()) { putBoolean("Goinning_in_LetUsChat_Activity",false) apply() } } catch(e:Exception) { Log.e("Exception in sharedPreference MainActivity",e.toString()) } fireStoreDb= FirebaseFirestore.getInstance() auth= FirebaseAuth.getInstance() binding.bottomnavigationbar.setItemSelected(R.id.contests) val homefragment=contestsFragment() val leaderfragment=leaderBoardFragment() val chatfragment=chatFragment() val profilefragment=profileFragment() val sdefragment=sdeFragment() setCurrentFragment(homefragment) binding.bottomnavigationbar.setOnItemSelectedListener { when(it) { R.id.contests->setCurrentFragment(homefragment) R.id.leadrboard->setCurrentFragment(leaderfragment) R.id.sde->setCurrentFragment(sdefragment) R.id.chat->setCurrentFragment(chatfragment) R.id.profile->setCurrentFragment(profilefragment) } } } private fun setCurrentFragment(fragment: Fragment)= supportFragmentManager.beginTransaction().apply { replace(R.id.flFragment,fragment) commit() } override fun onStart() { super.onStart() Log.d("Main Activity Starting","Yes") fireStoreDb.collection("users").document(auth.uid.toString()).update("status",true) } override fun onStop() { super.onStop() Log.d("Main Activity Stoping","Yes") try { val sharedPref = this.getSharedPreferences( "com.example.CrazyCoder", this.MODE_PRIVATE)?:return val flag=sharedPref.getBoolean("Goinning_in_LetUsChat_Activity",false) Log.d("Goinning_in_LetUsChat_Activity",flag.toString()) if(!flag) { fireStoreDb.collection("users").document(auth.uid.toString()).update("status",false) } else{ with(sharedPref.edit()) { putBoolean("Goinning_in_LetUsChat_Activity",false) apply() } } } catch (e:Exception) { Log.e("Exception in sharedpreference MainActivity In on stop",e.toString()) } } override fun onResume() { super.onResume() inProgressUpdate() } override fun onBackPressed() { super.onBackPressed() try { val request = reviewManager.requestReviewFlow() request.addOnCompleteListener { task -> if (task.isSuccessful) { // We got the ReviewInfo object val reviewInfo = task.result val flow = reviewManager.launchReviewFlow(this, reviewInfo) flow.addOnCompleteListener { } } else { Log.e("Exception in loading review box",task.exception.toString()) } } } catch (e:Exception) { Log.e("Exception while tacking review",e.toString()) } } private fun inProgressUpdate() { updateManager.appUpdateInfo.addOnSuccessListener { if(it.updateAvailability()==UpdateAvailability.DEVELOPER_TRIGGERED_UPDATE_IN_PROGRESS) { try { updateManager.startUpdateFlowForResult(it,AppUpdateType.FLEXIBLE,this,MY_REQUEST_CODE) } catch (e:Exception) { Log.e("inprogressUpdate process failed",e.toString()) } } } } }
5
Kotlin
34
25
18a30228d43c6fd8e6841008ca4c98913e530337
6,449
CrazyCoderApp
MIT License
core-ui/src/main/java/com/ofalvai/habittracker/core/ui/component/Layout.kt
ofalvai
324,148,039
false
{"Kotlin": 572182, "Just": 767}
/* * Copyright 2022 <NAME> * * 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.ofalvai.habittracker.core.ui.component import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.layout.Layout import androidx.compose.ui.unit.Constraints @Composable fun HorizontalGrid( modifier: Modifier = Modifier, content: @Composable () -> Unit ) { Layout(content, modifier) { measurables, constraints -> val itemConstraints = Constraints.fixedWidth(constraints.maxWidth / measurables.size) val placeables = measurables.map { it.measure(itemConstraints) } val height = placeables.maxOf { it.height } layout(constraints.maxWidth, height) { var xOffset = 0 placeables.forEach { it.placeRelative(x = xOffset, y = 0) xOffset += it.width } } } }
21
Kotlin
3
98
6b7ac6117063d39649ac80ed23b5cd926edcd027
1,443
HabitBuilder
Apache License 2.0
render/jpql/src/main/kotlin/com/linecorp/kotlinjdsl/render/jpql/serializer/impl/JpqlParamSerializer.kt
line
442,633,985
false
{"Kotlin": 1959613, "JavaScript": 5144, "Shell": 1023}
package com.linecorp.kotlinjdsl.render.jpql.serializer.impl import com.linecorp.kotlinjdsl.Internal import com.linecorp.kotlinjdsl.querymodel.jpql.expression.impl.JpqlParam import com.linecorp.kotlinjdsl.render.RenderContext import com.linecorp.kotlinjdsl.render.jpql.serializer.JpqlSerializer import com.linecorp.kotlinjdsl.render.jpql.writer.JpqlWriter import kotlin.reflect.KClass @Internal class JpqlParamSerializer : JpqlSerializer<JpqlParam<*>> { override fun handledType(): KClass<JpqlParam<*>> { return JpqlParam::class } override fun serialize(part: JpqlParam<*>, writer: JpqlWriter, context: RenderContext) { writer.writeParam(part.name, part.value) } }
4
Kotlin
86
705
3a58ff84b1c91bbefd428634f74a94a18c9b76fd
699
kotlin-jdsl
Apache License 2.0
apps/etterlatte-vilkaarsvurdering-kafka/src/main/kotlin/no/nav/etterlatte/vilkaarsvurdering/TidshendelseRiver.kt
navikt
417,041,535
false
{"Kotlin": 5788367, "TypeScript": 1519740, "Handlebars": 21334, "Shell": 12214, "HTML": 1734, "Dockerfile": 676, "CSS": 598, "PLpgSQL": 556}
package no.nav.etterlatte.vilkaarsvurdering import no.nav.etterlatte.libs.common.logging.getCorrelationId import no.nav.etterlatte.libs.common.logging.withLogContext import no.nav.etterlatte.rapidsandrivers.ALDERSOVERGANG_ID_KEY import no.nav.etterlatte.rapidsandrivers.ALDERSOVERGANG_STEG_KEY import no.nav.etterlatte.rapidsandrivers.ALDERSOVERGANG_TYPE_KEY import no.nav.etterlatte.rapidsandrivers.BEHANDLING_ID_KEY import no.nav.etterlatte.rapidsandrivers.BEHANDLING_VI_OMREGNER_FRA_KEY import no.nav.etterlatte.rapidsandrivers.DATO_KEY import no.nav.etterlatte.rapidsandrivers.DRYRUN import no.nav.etterlatte.rapidsandrivers.EventNames import no.nav.etterlatte.rapidsandrivers.HENDELSE_DATA_KEY import no.nav.etterlatte.rapidsandrivers.ListenerMedLogging import no.nav.etterlatte.rapidsandrivers.SAK_ID_KEY import no.nav.etterlatte.rapidsandrivers.asUUID import no.nav.etterlatte.rapidsandrivers.behandlingId import no.nav.etterlatte.rapidsandrivers.sakId import no.nav.etterlatte.vilkaarsvurdering.services.VilkaarsvurderingService import no.nav.helse.rapids_rivers.JsonMessage import no.nav.helse.rapids_rivers.MessageContext import no.nav.helse.rapids_rivers.RapidsConnection import org.slf4j.LoggerFactory class TidshendelseRiver( rapidsConnection: RapidsConnection, private val vilkaarsvurderingService: VilkaarsvurderingService, ) : ListenerMedLogging() { private val logger = LoggerFactory.getLogger(this::class.java) init { initialiserRiver(rapidsConnection, EventNames.ALDERSOVERGANG) { validate { it.requireAny( ALDERSOVERGANG_STEG_KEY, listOf("VURDERT_LOEPENDE_YTELSE", "BEHANDLING_OPPRETTET"), ) } validate { it.requireKey(ALDERSOVERGANG_TYPE_KEY) } validate { it.requireKey(ALDERSOVERGANG_ID_KEY) } validate { it.requireKey(SAK_ID_KEY) } validate { it.requireKey(DATO_KEY) } validate { it.requireKey(DRYRUN) } validate { it.requireKey(HENDELSE_DATA_KEY) } validate { it.interestedIn(BEHANDLING_ID_KEY) } validate { it.interestedIn(BEHANDLING_VI_OMREGNER_FRA_KEY) } } } override fun haandterPakke( packet: JsonMessage, context: MessageContext, ) { val steg = packet[ALDERSOVERGANG_STEG_KEY].asText() val type = packet[ALDERSOVERGANG_TYPE_KEY].asText() val hendelseId = packet[ALDERSOVERGANG_ID_KEY].asText() val dryrun = packet[DRYRUN].asBoolean() val sakId = packet.sakId withLogContext( correlationId = getCorrelationId(), mapOf( "hendelseId" to hendelseId, "sakId" to sakId.toString(), "type" to type, "dryRun" to dryrun.toString(), ), ) { val behandlet = when (steg) { "VURDERT_LOEPENDE_YTELSE" -> sjekkUnntaksregler(packet, type) "BEHANDLING_OPPRETTET" -> vilkaarsvurder(packet, dryrun) else -> false } if (behandlet) { // Reply med oppdatert melding context.publish(packet.toJson()) } } } private fun sjekkUnntaksregler( packet: JsonMessage, type: String, ): Boolean { val hendelseData = packet[HENDELSE_DATA_KEY] hendelseData["loependeYtelse_januar2024_behandlingId"]?.let { val behandlingId = it.asText() val result = vilkaarsvurderingService.harMigrertYrkesskadefordel(behandlingId) logger.info("Løpende ytelse: sjekk av yrkesskadefordel før 2024-01-01: $result") packet["yrkesskadefordel_pre_20240101"] = result } if (type in arrayOf("OMS_DOED_3AAR", "OMS_DOED_5AAR") && hendelseData["loependeYtelse"]?.asBoolean() == true) { val loependeBehandlingId = hendelseData["loependeYtelse_behandlingId"].asText() val result = vilkaarsvurderingService.harRettUtenTidsbegrensning(loependeBehandlingId) logger.info("OMS: sjekk av rett uten tidsbegrensning: $result") packet["oms_rett_uten_tidsbegrensning"] = result } packet[ALDERSOVERGANG_STEG_KEY] = "VURDERT_LOEPENDE_YTELSE_OG_VILKAAR" return true } private fun vilkaarsvurder( packet: JsonMessage, dryrun: Boolean, ): Boolean { val behandlingId = packet.behandlingId val forrigeBehandlingId = packet[BEHANDLING_VI_OMREGNER_FRA_KEY].asUUID() if (dryrun) { logger.info("Dryrun: skipper å behandle vilkårsvurdering for behandlingId=$behandlingId") } else { logger.info("Oppretter vilkårsvurdering for aldersovergang, behandlingId=$behandlingId") vilkaarsvurderingService.opphoerAldersovergang(behandlingId, forrigeBehandlingId) } packet[ALDERSOVERGANG_STEG_KEY] = "VILKAARSVURDERT" return true } }
13
Kotlin
0
6
abd4600c70b4188d7d6272ea2d650421ffdfcfb6
5,058
pensjon-etterlatte-saksbehandling
MIT License
src/main/kotlin/io/ysakhno/mpmp/tablespin/App.kt
YSakhno
250,378,898
false
null
/* * Solver for <NAME>'s Maths Puzzle (MPMP): Can you spin the table? * * See this YouTube video for more info about the puzzle itself: https://youtu.be/T29dydI97zY * * Written in 2020 by <NAME>. */ package io.ysakhno.mpmp.tablespin import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.FlowCollector import kotlinx.coroutines.flow.collect import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.flow import kotlinx.coroutines.flow.map import kotlinx.coroutines.runBlocking const val NUM_SEATS = 7 const val NUM_INITIAL_MATCHING_SEATS = 1 fun spin(offset: Int, size: Int): (Int) -> Int = { (it + offset) % size + 1 } fun generateTableSpins(numSeats: Int) = Array(numSeats) { IntArray(numSeats, spin(it, numSeats)) } private suspend fun FlowCollector<IntArray>.generatePermutations(available: Set<Int>, accumulated: IntArray) { if (available.isNotEmpty()) { for (next in available) { generatePermutations(available.minus(next), accumulated + next) } } else { emit(accumulated) } } suspend fun generateInvestorSeatings(numElements: Int): Flow<IntArray> = flow { generatePermutations(IntArray(numElements, spin(0, numElements)).toSet(), IntArray(0)) } fun countMatching(array1: IntArray, array2: IntArray): Int { var count = 0; for (i in array1.indices) if (array1[i] == array2[i]) count++ return count } fun matchingExactly(num: Int, otherArray: IntArray): suspend (IntArray) -> Boolean = { seating -> (countMatching(seating, otherArray) == num) } fun matchingLessThanTwoForAnySpin(tableSpins: Array<IntArray>): suspend (IntArray) -> Boolean = { seating -> tableSpins.all { tableSpin -> countMatching(seating, tableSpin) < 2 } } fun main() = runBlocking { val tableSpins = generateTableSpins(NUM_SEATS) generateInvestorSeatings(NUM_SEATS) .filter(matchingExactly(NUM_INITIAL_MATCHING_SEATS, tableSpins[0])) .filter(matchingLessThanTwoForAnySpin(tableSpins)) .map { it.asList() } .collect { println(it) } }
0
Kotlin
0
0
91f1b6371e6c407b8bad2f604b40b08e16519efb
2,059
mpmp-table-spinning
The Unlicense
src/main/kotlin/com/jacknie/test/model/MemberClient.kt
jacknie84
388,321,773
false
null
package com.jacknie.test.model import com.jacknie.test.model.TablePrefix.memberSubject import org.springframework.data.annotation.Id import org.springframework.data.relational.core.mapping.Table @Table("${memberSubject}client") data class MemberClient( @Id var id: Long? = null, var clientId: String, var clientSecret: String, var scopes: String, var redirectUris: String, var accessTokenValiditySeconds: Long, var refreshTokenValiditySeconds: Long, )
0
Kotlin
0
1
96d1657e0a59a9af8dfc860e3ddfe6d4444741c7
494
webflux-oauth2-sample
MIT License
app/src/main/java/com/miguelrr/capsshop/data/model/SignUpUserModel.kt
MiguelRom3ro
776,249,721
false
{"Kotlin": 70546}
package com.miguelrr.capsshop.data.model import com.miguelrr.capsshop.domain.model.SignUpUser data class SignUpUserModel( val name : String, val lastname : String, val email : String, val password : String, val username : String ) fun SignUpUser.toModel() = SignUpUserModel(name, lastname, email, password, username)
0
Kotlin
0
0
4474d1d07f629efe0cb3c45427d999ca972a7fbd
340
CapsShop
MIT License
app/src/main/java/com/cubifan/testandroidarticles/database/FavoritesDao.kt
LucasMaillard8
503,232,657
false
{"Kotlin": 14538}
package com.cubifan.testandroidarticles.database import androidx.room.Dao import androidx.room.Delete import androidx.room.Insert import androidx.room.OnConflictStrategy.IGNORE import androidx.room.Query import com.cubifan.testandroidarticles.database.entities.FavoriteArticleEntity @Dao interface FavoritesDao { @Insert(onConflict = IGNORE) suspend fun insertFavorites(article: FavoriteArticleEntity) @Query("SELECT * FROM favorites_table") suspend fun getFavorites(): Array<FavoriteArticleEntity> @Delete suspend fun deleteFavorite(article: FavoriteArticleEntity) }
0
Kotlin
0
0
fce48e137704317873abc2018911499f39983b38
595
testAndroidArticles
Apache License 2.0
app/src/main/java/com/github/fruzelee/friends/utils/ExtensionFunctions.kt
fruzelee
394,334,623
false
null
package com.github.fruzelee.friends.utils import android.widget.ImageView import com.bumptech.glide.Glide import com.bumptech.glide.request.RequestOptions import com.github.fruzelee.friends.R /** * @author <NAME> * github.com/fruzelee * web: fr.crevado.com */ /** * loads the url into the imageview * * shows an error placeholder or a loading placeholder when needed * * takes the image Url (nullable [String]) as a parameter */ fun ImageView.loadPortrait(url: String?) { val options = RequestOptions() .error(R.drawable.ic_image_not_found) // if the image can't be image can't be loaded icon .placeholder(R.drawable.ic_image_downloading) // show download icon when image is loading Glide.with(this.context) .setDefaultRequestOptions(options) .load(url) .into(this) }
0
Kotlin
0
1
faddda6ce67eafe9f3335f7db8442b630b8d514f
830
friends
Apache License 2.0
student/src/main/java/com/solutionteam/mindfulmentor/data/network/repositories/AuthRepository.kt
DevSkillSeekers
746,597,864
false
{"Kotlin": 412451}
package com.solutionteam.mindfulmentor.data.network.repositories import com.google.firebase.auth.AuthResult import com.google.firebase.auth.FirebaseUser import com.solutionteam.mindfulmentor.data.entity.StudentInfo interface AuthRepository { suspend fun signUp(email: String, password: String): AuthResult suspend fun addStudentInfo(studentInfo: StudentInfo,user: FirebaseUser):Boolean suspend fun signIn(email: String, password: String): AuthResult }
1
Kotlin
0
1
05d9da5efba3b9ca8b0c2e409d1329d8e22f19dd
467
GradesFromGeeks
Apache License 2.0
invirt-http4k/src/test/kotlin/invirt/http4k/JsonTest.kt
resoluteworks
762,239,437
false
{"Kotlin": 201787, "Makefile": 655, "CSS": 8}
package invirt.http4k import io.kotest.core.spec.style.StringSpec import io.kotest.matchers.shouldBe import org.http4k.core.* import org.http4k.routing.bind import org.http4k.routing.routes class JsonTest : StringSpec() { init { "json" { data class JsonTestPojo( val name: String, val enabled: Boolean ) val httpHandler = routes( "/test" bind Method.GET to { val lens = jsonLens<JsonTestPojo>() Response(Status.OK).with(lens of JsonTestPojo("John Smith", false)) } ) httpHandler(Request(Method.GET, "/test")).bodyString() shouldBe """{"name":"John Smith","enabled":false}""" } } }
0
Kotlin
0
0
c11812cd43b49e0d744fa56c149848ee592a43fd
774
invirt
Apache License 2.0
src/main/kotlin/nl/tue/setschematics/grid/rectangular/RectangularGrid.kt
stenwessel
316,495,569
false
{"Java": 137813, "Kotlin": 123105}
package nl.tue.setschematics.grid.rectangular import nl.hannahsten.utensils.math.matrix.DoubleVector import nl.hannahsten.utensils.math.matrix.doubleVectorOf import nl.tue.setschematics.util.Rectangle import nl.tue.setschematics.grid.Grid class RectangularGrid( private val locations: List<RectangularGridLocation>, override val width: Double, override val height: Double ) : Grid<RectangularGridLocation> { companion object { @JvmStatic @JvmOverloads fun evenlySpaced(width: Double, height: Double, rows: Int, columns: Int, origin: DoubleVector = doubleVectorOf(0.0, 0.0)): RectangularGrid { require(width > 0) require(height > 0) require(rows >= 1) require(columns >= 1) require(origin.size == 2) val dx = width / (columns - 1) val dy = height / (rows - 1) val locations = mutableListOf<MutableRectangularGridLocation>() for (row in 0 until rows) { for (col in 0 until columns) { val loc = MutableRectangularGridLocation(DoubleVector((origin + doubleVectorOf(col * dx, row * dy)).toList())) loc.leftNeighbor = locations.getOrNull(row * columns + col - 1)?.also { it.rightNeighbor = loc } loc.topNeighbor = locations.getOrNull((row - 1) * columns + col)?.also { it.bottomNeighbor = loc } locations += loc } } return RectangularGrid(locations, width, height) } @JvmStatic fun evenlySpaced(rectangle: Rectangle, rows: Int, columns: Int): RectangularGrid { return evenlySpaced(rectangle.width, rectangle.height, rows, columns, doubleVectorOf(rectangle.left, rectangle.bottom)) } } override operator fun iterator() = locations.iterator() }
1
null
1
1
7e26b70cb0054006897b2b0118024ee34794ab30
1,895
setschematics
MIT License
cva-common/src/main/kotlin/com/_2horizon/cva/common/copernicus/dto/CopernicusPageNode.kt
esowc
264,099,974
false
null
package com._2horizon.cva.common.copernicus.dto import com._2horizon.cva.common.elastic.ContentSource import com._2horizon.cva.common.elastic.ElasticBaseDTO import com.fasterxml.jackson.annotation.JsonFormat import com.fasterxml.jackson.annotation.JsonProperty import java.time.LocalDate import java.time.LocalDateTime /** * Created by <NAME> (liefra) on 2020-08-28. */ data class CopernicusPageNode( override val id: String, override val source: ContentSource, override val content: String, @JsonProperty("dateTime") @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss") override val dateTime: LocalDateTime, @JsonProperty("verifiedAt") @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss") override val verifiedAt: LocalDateTime, val url: String, val title: String, val nodeType: NodeType, val img: String? = null, @JsonProperty("publishedAt") @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd") val publishedAt: LocalDate? = null, @JsonProperty("startDate") @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd") val startDate: LocalDate? = null, @JsonProperty("endDate") @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd") val endDate: LocalDate? = null, val teaser: String? = null, val contentHtml: String? = null, val contentStripped: String? = null, ) : ElasticBaseDTO
3
Kotlin
1
1
e3cf8d9b5f8c76c8c0138b47d24ee91eb3043f82
1,490
ECMWF-Conversational-Virtual-Assistant
MIT License
app/src/androidTest/java/app/luisramos/ler/test/DisableAnimationsRule.kt
Orgmir
244,587,282
false
null
package app.luisramos.ler.test import android.app.Instrumentation import androidx.test.platform.app.InstrumentationRegistry import androidx.test.uiautomator.UiDevice import org.junit.rules.TestRule import org.junit.runner.Description import org.junit.runners.model.Statement class DisableAnimationsRule : TestRule { override fun apply(base: Statement?, description: Description?): Statement = object : Statement() { override fun evaluate() { disableAnimations() try { base?.evaluate() } finally { enableAnimations() } } } private fun disableAnimations() = toggleAnimations(enable = false) private fun enableAnimations() = toggleAnimations(enable = true) private fun toggleAnimations(enable: Boolean) { val scale = if (enable) "1" else "0" UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()).apply { executeShellCommand("settings put global transition_animation_scale $scale") executeShellCommand("settings put global window_animation_scale $scale") executeShellCommand("settings put global animator_duration_scale $scale") } } }
2
Kotlin
0
1
b703b241c8b0d1093ae4fe89b0d7a5ca1df03cb4
1,272
ler-android
Apache License 2.0
FinalProject/app/src/main/java/com/example/finalproject/base/BaseViewItemClickListener.kt
omercanbaltaci
425,016,312
false
{"Kotlin": 53999}
package com.example.finalproject.base import androidx.annotation.IdRes interface BaseViewItemClickListener<T> { fun onItemClicked(clickedObject: T, @IdRes id: Int = 0) }
0
Kotlin
0
4
598512407c648fb7b7dc455b418d03bb3fc7159b
175
weather-app
MIT License
features/home/src/main/java/id/sansets/infood/home/di/HomeViewModelModule.kt
sansets
294,803,938
false
null
package id.sansets.infood.home.di import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModelProvider import dagger.Binds import dagger.Module import dagger.multibindings.IntoMap import id.sansets.infood.core.di.ViewModelKey import id.sansets.infood.core.util.ViewModelFactory import id.sansets.infood.home.presenter.HomeViewModel @Suppress("unused") @Module abstract class HomeViewModelModule { @Binds abstract fun bindViewModelFactory(factory: ViewModelFactory): ViewModelProvider.Factory @Binds @IntoMap @ViewModelKey(HomeViewModel::class) abstract fun bindHomeViewModel(homeViewModel: HomeViewModel): ViewModel }
0
Kotlin
12
98
7ce8bafa0ea25d7ac6da58abb183c383a2eebae9
656
android-clean-architecture
Apache License 2.0
rest/src/main/kotlin/io/sparkled/viewmodel/sequence/SequenceViewModelConverterImpl.kt
jeffdbeats
208,570,966
true
{"Kotlin": 374254, "JavaScript": 194627, "CSS": 6973, "HTML": 1319}
package io.sparkled.viewmodel.sequence import io.sparkled.model.entity.Sequence import io.sparkled.model.entity.Song import io.sparkled.model.util.SequenceUtils import io.sparkled.persistence.sequence.SequencePersistenceService import io.sparkled.persistence.song.SongPersistenceService import io.sparkled.viewmodel.exception.ViewModelConversionException import javax.inject.Singleton @Singleton class SequenceViewModelConverterImpl( private val sequencePersistenceService: SequencePersistenceService, private val songPersistenceService: SongPersistenceService ) : SequenceViewModelConverter() { override fun toViewModel(model: Sequence): SequenceViewModel { return SequenceViewModel() .setId(model.getId()) .setSongId(model.getSongId()) .setStageId(model.getStageId()) .setName(model.getName()) .setFramesPerSecond(model.getFramesPerSecond()) .setFrameCount(getFrameCount(model)) .setStatus(model.getStatus()) } private fun getFrameCount(sequence: Sequence): Int { val song = songPersistenceService.getSongBySequenceId(sequence.getId()!!) ?: Song() return SequenceUtils.getFrameCount(song, sequence) } override fun toModel(viewModel: SequenceViewModel): Sequence { val sequenceId = viewModel.getId() val model = getSequence(sequenceId) return model .setSongId(viewModel.getSongId()) .setStageId(viewModel.getStageId()) .setName(viewModel.getName()) .setFramesPerSecond(viewModel.getFramesPerSecond()) .setStatus(viewModel.getStatus()) } private fun getSequence(sequenceId: Int?): Sequence { if (sequenceId == null) { return Sequence() } return sequencePersistenceService.getSequenceById(sequenceId) ?: throw ViewModelConversionException("Sequence with ID of '$sequenceId' not found.") } }
0
null
0
1
fe9d05789b338d17bbb46fad8cc1ba6f33b7096c
1,978
sparkled
MIT License
app/src/main/java/kniezrec/com/flightinfo/db/CitiesDatabaseHelper.kt
NieKam
456,935,840
false
{"Kotlin": 180319, "Java": 31673}
package kniezrec.com.flightinfo.db import android.content.Context import android.database.sqlite.SQLiteDatabase import com.readystatesoftware.sqliteasset.SQLiteAssetHelper /** * Copyright by <NAME> */ class CitiesDatabaseHelper(context: Context) : SQLiteAssetHelper(context, "cities_info.db", null, 2) { override fun onUpgrade(database: SQLiteDatabase, oldVersion: Int, newVersion: Int) { CitiesTable.onUpgrade(database) } }
0
Kotlin
1
1
88edda7064b955313afc9a81af5885f0381871d2
442
smart-flight
Apache License 2.0
dm-kt/dm-base/mongo/src/main/kotlin/com/ysz/dm/base/mongo/MongoConfigTools.kt
carl10086
246,727,202
false
{"Shell": 5, "Ignore List": 1, "Text": 2, "Gradle": 16, "INI": 2, "Batchfile": 1, "Makefile": 2, "Markdown": 10, "XML": 4, "Kotlin": 141, "Java": 5, "Java Properties": 1, "Lua": 4, "Protocol Buffer": 1, "YAML": 1, "desktop": 1, "Python": 112, "Jupyter Notebook": 12, "SVG": 4, "Go Module": 1, "Go": 3}
package com.ysz.dm.base.mongo import com.mongodb.MongoClientSettings import com.mongodb.ReadPreference import com.mongodb.ServerAddress import com.mongodb.client.MongoClient import com.mongodb.client.MongoClients import com.mongodb.connection.ConnectionPoolSettings import org.springframework.data.mongodb.MongoDatabaseFactory import org.springframework.data.mongodb.core.MongoTemplate import org.springframework.data.mongodb.core.SimpleMongoClientDatabaseFactory import org.springframework.data.mongodb.core.convert.* import org.springframework.data.mongodb.core.mapping.MongoMappingContext /** * @author carl * @since 2023-02-01 2:08 PM **/ object MongoConfigTools { fun buildMongoTpl(client: MongoClient, database: String): MongoTemplate = SimpleMongoClientDatabaseFactory(client, database).let { MongoTemplate(it, buildMappingMongoConvertByDefault(it)) } fun buildClient(urls: List<String>): MongoClient = buildClient(servers = urls.map(::urlToServerHost)) { } private fun urlToServerHost(url: String): ServerAddress { val hostAndPort = url.split(":") return ServerAddress(hostAndPort[0], hostAndPort[1].toInt()) } private fun buildMappingMongoConvertByDefault( factory: MongoDatabaseFactory ): MappingMongoConverter { val dbRefResolver: DbRefResolver = DefaultDbRefResolver(factory) val conversions = MongoCustomConversions(emptyList<Any>()) val mappingContext = MongoMappingContext() mappingContext.setSimpleTypeHolder(conversions.simpleTypeHolder) mappingContext.afterPropertiesSet() val converter = MappingMongoConverter(dbRefResolver, mappingContext) converter.customConversions = conversions converter.setCodecRegistryProvider(factory) // type key 设置为 null 可以禁用 _class 字段 converter.typeMapper = DefaultMongoTypeMapper(null, converter.mappingContext) converter.afterPropertiesSet() return converter } fun buildClient( servers: List<ServerAddress>, filling: MongoClientSettings.Builder.() -> Unit ): MongoClient { val builder = MongoClientSettings.builder() builder.applyToClusterSettings { it.hosts(servers) } builder.applyToConnectionPoolSettings { it.applySettings(ConnectionPoolSettings.builder().maxSize(16).build()) } builder.readPreference(ReadPreference.secondaryPreferred()) /*1. we set default values here*/ builder.filling() return MongoClients.create(builder.build()) } }
2
null
1
1
4992c4d772e942d8c72b8127315fa3635687b0ec
2,599
dm-learning
Apache License 2.0
src/main/kotlin/vyrek/phasoritenetworks/common/networks/NetworksData.kt
milosworks
866,842,833
false
{"Kotlin": 50039}
package vyrek.phasoritenetworks.common.networks import io.wispforest.owo.ui.core.Color import net.minecraft.core.HolderLookup import net.minecraft.nbt.CompoundTag import net.minecraft.nbt.ListTag import net.minecraft.nbt.Tag import net.minecraft.world.level.saveddata.SavedData import net.neoforged.neoforge.server.ServerLifecycleHooks import java.util.* import kotlin.uuid.Uuid class NetworksData : SavedData() { val networks: MutableMap<Uuid, Network> = mutableMapOf() fun createNetwork(name: String, owner: UUID, color: Color): Network { val network = Network(name, owner, color) networks[network.id] = network return network } fun removeNetwork(id: Uuid) { networks.remove(id) } fun getNetwork(id: Uuid): Network? { return networks[id] } fun getNetwork(uid: UUID) { networks.filter { (_, v) -> v.owner == uid } } override fun save( tag: CompoundTag, provider: HolderLookup.Provider ): CompoundTag { val networksList = ListTag() for (network in networks.values) { val networkTag = CompoundTag() network.saveAdditional(networkTag) networksList.add(networkTag) } tag.put(NetworkConstants.NETWORKS, networksList) return tag } fun load(tag: CompoundTag) { val networksList = tag.getList(NetworkConstants.NETWORKS, Tag.TAG_COMPOUND.toInt()) for (i in 0..networksList.size) { val networkTag = networksList.getCompound(i) val network = Network() network.loadAdditional(networkTag) networks[network.id] = network } } companion object { fun create(): NetworksData { return NetworksData() } private fun load(tag: CompoundTag): NetworksData { val data = NetworksData() data.load(tag) return data } fun get(): NetworksData { val overworld = ServerLifecycleHooks.getCurrentServer()?.overworld() ?: throw IllegalStateException("Overworld is not available. Server is in an invalid state.") return overworld.dataStorage .computeIfAbsent( Factory(this@Companion::create, { tag: CompoundTag, _: HolderLookup.Provider -> load(tag) }), "data" ) } } }
0
Kotlin
0
0
7144db44cf79575f342ab2c1f9fa2dc9396d3774
2,073
phasorite-networks
Apache License 2.0
app/src/main/kotlin/com/strk2333/purelrc/main/MainModule.kt
strk2333
208,734,200
false
{"Gradle": 3, "XML": 20, "Java Properties": 2, "Shell": 1, "Text": 1, "Ignore List": 2, "Batchfile": 1, "Markdown": 1, "INI": 1, "Proguard": 1, "Java": 2, "Kotlin": 22, "JSON": 1}
package com.strk2333.purelrc.main import com.strk2333.purelrc.di.scope.ActivityScope import dagger.Module import dagger.Provides @Module class MainModule(private val view: IMainView) { @Provides @ActivityScope internal fun provideView(): IMainView { return view } }
0
Kotlin
0
0
f323f0c56c49e543d4d59db4bb0d30760f337ffd
293
pureLrc
Apache License 2.0