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
xof-rest-api/src/main/kotlin/com/github/danzx/xof/entrypoint/rest/response/SingleValueResponse.kt
dan-zx
220,341,123
false
null
package com.github.danzx.xof.entrypoint.rest.response data class SingleValueResponse<T>(var value: T)
0
Kotlin
0
5
379eebd63fde5c645f822fb6d816f82d58d44b83
103
xof-api
Apache License 2.0
sessionize/lib/src/commonMain/kotlin/co/touchlab/sessionize/AppContext.kt
rayworks
239,182,528
true
{"Kotlin": 203538, "Swift": 87309, "HTML": 7463, "Python": 3852, "Ruby": 2076, "Objective-C": 537, "Shell": 36}
package co.touchlab.sessionize import co.touchlab.sessionize.SettingsKeys.KEY_FIRST_RUN import co.touchlab.sessionize.api.NetworkRepo import co.touchlab.sessionize.db.SessionizeDbHelper import co.touchlab.sessionize.file.FileRepo import co.touchlab.sessionize.platform.NotificationsModel import co.touchlab.sessionize.platform.logException import kotlinx.serialization.json.Json object AppContext { //Workaround for https://github.com/Kotlin/kotlinx.serialization/issues/441 private val primeJson = Json.nonstrict fun initAppContext(networkRepo: NetworkRepo = NetworkRepo, fileRepo: FileRepo = FileRepo, serviceRegistry: ServiceRegistry = ServiceRegistry, dbHelper: SessionizeDbHelper = SessionizeDbHelper, notificationsModel: NotificationsModel = NotificationsModel) { dbHelper.initDatabase(serviceRegistry.dbDriver) serviceRegistry.notificationsApi.initializeNotifications { success -> serviceRegistry.concurrent.backgroundTask({ success }, { if (it) { notificationsModel.createNotifications() } else { notificationsModel.cancelNotifications() } }) } serviceRegistry.concurrent.backgroundTask({ maybeLoadSeedData(fileRepo, serviceRegistry) }) { networkRepo.refreshData() } } private fun maybeLoadSeedData(fileRepo: FileRepo, serviceRegistry: ServiceRegistry) { try { if (firstRun(serviceRegistry)) { fileRepo.seedFileLoad() updateFirstRun(serviceRegistry) } } catch (e: Exception) { logException(e) } } private fun firstRun(serviceRegistry: ServiceRegistry): Boolean = serviceRegistry.appSettings.getBoolean(KEY_FIRST_RUN, true) private fun updateFirstRun(serviceRegistry: ServiceRegistry) { serviceRegistry.appSettings.putBoolean(KEY_FIRST_RUN, false) } }
0
null
0
0
ad6cae767b78dc988a817903313d98152b9912c6
2,059
DroidconKotlin
Apache License 2.0
app/src/main/java/com/luxoft/blockchainlab/poc/ssi/ssimobile/domain/usecase/GetProofRequestUseCase.kt
yholovko
351,047,466
true
{"Kotlin": 46709}
/* * 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. * * SPDX-License-Identifier: Apache-2.0 */ package com.luxoft.blockchainlab.poc.ssi.ssimobile.domain.usecase import com.luxoft.blockchainlab.hyperledger.indy.models.ProofRequest import com.luxoft.blockchainlab.poc.ssi.ssimobile.domain.irepository.IndyRepository import io.reactivex.Single /** * Use case to interact between UI and data repository. * Holder receives proof request from Verifier. * */ class GetProofRequestUseCase constructor( private val indyRepository: IndyRepository ) { fun get(url: String): Single<ProofRequest> = indyRepository.receiveProofRequest(url) }
0
null
0
0
f3300a66881de52b07485fab5c60f94781a63d6c
1,167
ssi-mobile-sdk
Apache License 2.0
app/src/main/java/com/hy/baseapp/model/TestModel.kt
qwer2y
484,959,139
false
{"Kotlin": 349881, "Java": 73310}
package com.hy.baseapp.model import kotlinx.serialization.Serializable @Serializable data class TestModel(val name:String)
0
Kotlin
0
0
e96ec50468fcdda690527180b7aeefc455871b7a
125
BaseApp
Apache License 2.0
app/src/main/java/com/example/coursesearch/models/User.kt
feranmi2002
437,603,968
false
null
package com.example.coursesearch.models data class User( val name: String?, val title:String?, )
0
Kotlin
0
0
9ed4f7a5835111b43a53168ebde8cdc4610fd169
109
Course-Search
MIT License
python/test/org/jetbrains/r/codestyle/RMarkdownTypingPythonTest.kt
JetBrains
214,212,060
false
{"Kotlin": 2657533, "Java": 558927, "R": 37082, "Lex": 14307, "HTML": 10063, "Rez": 70, "Rebol": 47}
/* * Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. */ package org.jetbrains.r.codestyle import com.intellij.application.options.CodeStyle import com.intellij.psi.codeStyle.CodeStyleSettings import com.intellij.psi.codeStyle.CodeStyleSettingsManager import org.intellij.lang.annotations.Language import org.jetbrains.r.RLanguage import org.jetbrains.r.RUsefulTestCase import org.jetbrains.r.rmarkdown.RMarkdownFileType class RMarkdownTypingPythonTest : RUsefulTestCase() { fun testFunctionInPythonFence() { doTest(""" ```{python} def hello (n):<caret> foo (n) ``` """, """ ```{python} def hello (n): <caret> foo (n) ``` """, "\n") } fun testNewFunctionInPythonFence() { doTest(""" ```{python} def hello (n):<caret> foo() ``` """, """ ```{python} def hello (n): <caret> foo() ``` """, "\n") } @Suppress("SameParameterValue") private fun doTest(@Language("RMarkdown") fileText: String, @Language("RMarkdown") expected: String, insert: String) { myFixture.configureByText(RMarkdownFileType, fileText.trimIndent()) try { val settings: CodeStyleSettings = CodeStyle.getSettings(myFixture.file).clone() CodeStyleSettingsManager.getInstance(project).setTemporarySettings(settings) settings.getCommonSettings(RLanguage.INSTANCE).indentOptions?.CONTINUATION_INDENT_SIZE = 4 settings.getCommonSettings(RLanguage.INSTANCE).indentOptions?.INDENT_SIZE = 2 myFixture.type(insert) } finally { CodeStyleSettingsManager.getInstance(project).dropTemporarySettings() } myFixture.checkResult(expected.trimIndent()) } }
2
Kotlin
13
62
9225567ed712f54d019ce5ab712016acdb6fc98e
1,869
Rplugin
Apache License 2.0
src/main/java/dev/mikchan/mcnp/chat/implementation/spigot/v1_19_3/SpigotV1m19p3ChatPluginFactory.kt
MikChanNoPlugins
503,117,935
false
null
package dev.mikchan.mcnp.chat.implementation.spigot.v1_19_3 import dev.mikchan.mcnp.chat.ChatPlugin import dev.mikchan.mcnp.chat.implementation.spigot.v1_19_2.SpigotV1m19p2ChatPluginFactory internal open class SpigotV1m19p3ChatPluginFactory(plugin: ChatPlugin) : SpigotV1m19p2ChatPluginFactory(plugin)
0
Kotlin
0
5
7ecb0345d56639f48bbc19ac4791c829fee76aa0
304
Chat
MIT License
litho/src/main/java/com/guet/flexbox/litho/load/ExBitmapDrawableEncoder.kt
jiankehtt
240,469,855
false
null
package com.guet.flexbox.litho.load import android.graphics.Bitmap import com.bumptech.glide.load.EncodeStrategy import com.bumptech.glide.load.Options import com.bumptech.glide.load.ResourceEncoder import com.bumptech.glide.load.engine.Resource import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool import com.bumptech.glide.load.resource.bitmap.BitmapResource import com.guet.flexbox.litho.drawable.ExBitmapDrawable import java.io.File class ExBitmapDrawableEncoder( private val bitmapPool: BitmapPool, private val encoder: ResourceEncoder<Bitmap> ) : ResourceEncoder<ExBitmapDrawable> { override fun encode( data: Resource<ExBitmapDrawable>, file: File, options: Options): Boolean { return encoder.encode(BitmapResource( requireNotNull(data.get().bitmap), bitmapPool), file, options ) } override fun getEncodeStrategy(options: Options): EncodeStrategy { return encoder.getEncodeStrategy(options) } }
1
null
1
1
79d4fe4191ae36689f58ce3c5b5d455d3e8b8bc8
1,048
Gbox
Apache License 2.0
app/src/main/java/com/typ/muslim/features/tasbeeh/models/TasbeehConfig.kt
typ-AhmedSleem
412,899,040
false
{"Java": 2559094, "Kotlin": 199251}
package com.typ.muslim.features.tasbeeh.models import com.typ.muslim.features.tasbeeh.enums.TasbeehMode class TasbeehConfig( times: Int, mode: TasbeehMode, tasbeehat: Array<TasbeehItem>, isVibrationEnabled: Boolean, isVolumeCounterEnabled: Boolean, isSpeakTasbeehOnFlipEnabled: Boolean ) { var times = times private set var mode = mode private set var tasbeehat: Array<TasbeehItem> = tasbeehat private set var isVibrationEnabled = isVibrationEnabled private set var isVolumeCounterEnabled = isVolumeCounterEnabled private set var isSpeakTasbeehOnFlipEnabled = isSpeakTasbeehOnFlipEnabled private set fun update( times: Int = this.times, mode: TasbeehMode = this.mode, tasbeehat: Array<TasbeehItem> = this.tasbeehat, isVibrationEnabled: Boolean = this.isVibrationEnabled, isVolumeCounterEnabled: Boolean = this.isVolumeCounterEnabled, isSpeakTasbeehOnFlipEnabled: Boolean = this.isSpeakTasbeehOnFlipEnabled ) { this.times = times this.mode = mode this.tasbeehat = tasbeehat this.isVibrationEnabled = isVibrationEnabled this.isVolumeCounterEnabled = isVolumeCounterEnabled this.isSpeakTasbeehOnFlipEnabled = isSpeakTasbeehOnFlipEnabled } fun update(config: TasbeehConfig) { this.update( config.times, config.mode, config.tasbeehat, config.isVibrationEnabled, config.isVolumeCounterEnabled, config.isSpeakTasbeehOnFlipEnabled, ) } fun clone(): TasbeehConfig { return TasbeehConfig( times, mode, tasbeehat, isVibrationEnabled, isVolumeCounterEnabled, isSpeakTasbeehOnFlipEnabled ) } override fun toString(): String { return buildString { append("TasbeehConfig(times=") append(times) append(", mode=") append(mode) append(", isVibrationEnabled=") append(isVibrationEnabled) append(", isVolumeCounterEnabled=") append(isVolumeCounterEnabled) append(", isSpeakTasbeehOnFlipEnabled=") append(isSpeakTasbeehOnFlipEnabled) append(")") } } }
4
Java
0
12
31f394522fc0100d27b9bbfa82fdab8fc9bde14b
2,343
AnaMuslim
MIT License
presentation/src/main/kotlin/com/popalay/cardme/presentation/screens/cards/CardsFragment.kt
Popalay
83,484,077
false
{"Gradle": 7, "HTML": 1, "INI": 1, "Shell": 1, "Text": 1, "Ignore List": 4, "Batchfile": 1, "Markdown": 1, "XML": 109, "Kotlin": 103, "Java Properties": 1, "JSON": 1, "Proguard": 1, "Java": 1}
package com.popalay.cardme.presentation.screens.cards import android.arch.lifecycle.ViewModelProvider import android.content.Intent import android.os.Bundle import android.support.v4.app.ActivityOptionsCompat import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import com.popalay.cardme.R import com.popalay.cardme.databinding.FragmentCardsBinding import com.popalay.cardme.presentation.base.BaseFragment import com.popalay.cardme.presentation.screens.carddetails.CardDetailsActivity import com.popalay.cardme.utils.DialogFactory import com.popalay.cardme.utils.extensions.getDataBinding import com.popalay.cardme.utils.extensions.getViewModel import com.popalay.cardme.utils.extensions.hideAnimated import com.popalay.cardme.utils.extensions.showAnimated import com.popalay.cardme.utils.recycler.SpacingItemDecoration import io.card.payment.CardIOActivity import io.card.payment.CreditCard import io.reactivex.rxkotlin.addTo import javax.inject.Inject class CardsFragment : BaseFragment() { companion object { const val SCAN_REQUEST_CODE = 121 fun newInstance() = CardsFragment() } @Inject lateinit var factory: ViewModelProvider.Factory @Inject lateinit var viewModelFacade: CardsViewModelFacade private lateinit var b: FragmentCardsBinding override fun onCreateView(inflater: LayoutInflater?, container: ViewGroup?, savedInstanceState: Bundle?): View? { b = getDataBinding(inflater, R.layout.fragment_cards, container) b.vm = getViewModel<CardsViewModel>(factory) initUI() return b.root } override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { super.onActivityResult(requestCode, resultCode, data) if (requestCode == SCAN_REQUEST_CODE) { if (data != null && data.hasExtra(CardIOActivity.EXTRA_SCAN_RESULT)) { val scanResult = data.getParcelableExtra<CreditCard>(CardIOActivity.EXTRA_SCAN_RESULT) viewModelFacade.onCardScanned(scanResult) } } } override fun onResume() { super.onResume() b.buttonAdd.showAnimated() } override fun onPause() { super.onPause() b.buttonAdd.hideAnimated() } fun createCardDetailsTransition(activityIntent: Intent): Bundle { val position = viewModelFacade.getPositionOfCard(activityIntent .getStringExtra(CardDetailsActivity.KEY_CARD_NUMBER)) return ActivityOptionsCompat.makeSceneTransitionAnimation(activity, b.listCards.findViewHolderForAdapterPosition(position).itemView, getString(R.string.transition_card_details)) .toBundle() } private fun initUI() { b.listCards.addItemDecoration(SpacingItemDecoration.create { dividerSize = resources.getDimension(R.dimen.normal).toInt() showBetween = true showOnSides = true }) viewModelFacade.doOnShowCardExistsDialog() .subscribe { DialogFactory.createCustomButtonsDialog(context, R.string.error_card_exist, R.string.action_yes, R.string.action_cancel, onPositive = viewModelFacade::onWantToOverwrite, onDismiss = viewModelFacade::onShowCardExistsDialogDismiss) .apply { setCancelable(false) } .show() }.addTo(disposables) } }
1
Kotlin
3
20
271b0697095ebe5b532726ffb66826243a0b6f3b
3,600
Cardme
Apache License 2.0
mapper/logic/src/main/java/ir/ac/iust/dml/kg/mapper/logic/data/OntologyPropertyData.kt
IUST-DMLab
143,078,400
false
{"Java": 1305698, "JavaScript": 309084, "Kotlin": 291339, "HTML": 262524, "Python": 140248, "CSS": 134871, "Shell": 11166}
/* * Farsi Knowledge Graph Project * Iran University of Science and Technology (Year 2017) * Developed by Majid Asgari. */ package ir.ac.iust.dml.kg.mapper.logic.data data class OntologyPropertyData( var url: String? = null, var name: String? = null, var wasDerivedFrom: String? = null, var faLabel: String? = null, var enLabel: String? = null, var faVariantLabels: MutableList<String> = mutableListOf(), var enVariantLabels: MutableList<String> = mutableListOf(), var types: MutableList<String> = mutableListOf(), var domains: MutableList<String> = mutableListOf(), var autoDomains: MutableList<String> = mutableListOf(), var ranges: MutableList<String> = mutableListOf(), var autoRanges: MutableList<String> = mutableListOf(), var equivalentProperties: MutableList<String> = mutableListOf() )
1
null
1
1
2e020ae3d619a35ffa00079b9aeb31ca77ce2346
852
farsbase
Apache License 2.0
analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/sessions/LLFirSessionInvalidationTopics.kt
JetBrains
3,432,266
false
null
/* * Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ package org.jetbrains.kotlin.analysis.low.level.api.fir.sessions import com.intellij.util.messages.Topic import org.jetbrains.kotlin.analysis.api.projectStructure.KaModule /** * [Topic]s for events published by [LLFirSessionInvalidationService] *after* session invalidation. These topics should be subscribed to via * the Analysis API message bus: [analysisMessageBus][org.jetbrains.kotlin.analysis.api.platform.analysisMessageBus]. * * Session invalidation events are guaranteed to be published after the associated sessions have been invalidated. Because sessions are * invalidated in a write action, all session invalidation events are published during that same write action. * * When a session is garbage-collected due to being softly reachable, no session invalidation event will be published for it. See the * documentation of [LLFirSession] for background information. * * Session invalidation events are not published for unstable * [KtDanglingFileModules][org.jetbrains.kotlin.analysis.api.projectStructure.KaDanglingFileModule]. */ object LLFirSessionInvalidationTopics { val SESSION_INVALIDATION: Topic<LLFirSessionInvalidationListener> = Topic(LLFirSessionInvalidationListener::class.java, Topic.BroadcastDirection.TO_CHILDREN, true) } interface LLFirSessionInvalidationListener { /** * [afterInvalidation] is published when sessions for the given [modules] have been invalidated. Because the sessions are already * invalid, the event carries their [KaModule][KaModule]s. * * @see LLFirSessionInvalidationTopics */ fun afterInvalidation(modules: Set<KaModule>) /** * [afterGlobalInvalidation] is published when all sessions may have been invalidated. The event doesn't guarantee that all sessions * have been invalidated, but e.g. caches should be cleared as if this was the case. This event is published when the invalidated * sessions cannot be easily enumerated. * * @see LLFirSessionInvalidationTopics */ fun afterGlobalInvalidation() }
184
null
5691
48,625
bb25d2f8aa74406ff0af254b2388fd601525386a
2,263
kotlin
Apache License 2.0
buildSrc/src/main/kotlin/Exceptions.kt
paslavsky
242,379,249
false
{"JavaScript": 31704, "Kotlin": 13818, "CSS": 1902, "HTML": 1740, "TSQL": 111}
import org.gradle.api.GradleException import org.gradle.api.Project import java.io.File open class SampleProjectException(message: String, project: Project? = null, description: SampleDescription? = null) : GradleException("${project?.displayName ?: "project " + description?.name}: $message") class UnsupportedSampleConfigurationException(project: Project) : SampleProjectException("Unsupported sample project configuration", project) class ArtifactNotFoundException(project: Project) : SampleProjectException("Could not detect the artifact", project) class FoundMultipleArtifactsException(project: Project, artifacts: Iterable<File>) : SampleProjectException("Found multiple artifacts:\n\t- ${artifacts.joinToString(separator = "\n\t- ")}", project) class SampleProjectConfigurationRequiredException(project: Project, attribute: String): SampleProjectException("Attribute $attribute required! Please use gradle.properties to provide value", project) class UnsupportedSampleAuthException(project: Project, authStr: String): SampleProjectException("Unsupported authentication: $authStr", project) class SampleNotStartedException(description: SampleDescription) : SampleProjectException("Sample not started. See logs for more details", description = description)
25
JavaScript
0
1
a6878b1c0d17b3fc7881bf65331a8b73895e8306
1,324
java-microservices
MIT License
android/DartsScorecard/app/src/main/java/nl/entreco/dartsscorecard/play/score/ScoreBindings.kt
Entreco
110,022,468
false
null
package nl.entreco.dartsscorecard.play.score import androidx.databinding.BindingAdapter import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import android.widget.TextView import nl.entreco.domain.model.Score import nl.entreco.domain.model.players.Team import nl.entreco.domain.play.finish.GetFinishUsecase import nl.entreco.domain.settings.ScoreSettings /** * Created by Entreco on 20/11/2017. */ object ScoreBindings { @JvmStatic @BindingAdapter("adapter", "teams", "scores", "scoreSettings", "finishUsecase", "uiCallback", requireAll = true) fun addTeams(recyclerView: RecyclerView, adapter: ScoreAdapter, teams: ArrayList<Team>, scores: ArrayList<Score>, scoreSettings: ScoreSettings, finishUsecase: GetFinishUsecase, uiCallback: UiCallback?) { if (teams.size != scores.size) { throw IllegalStateException("state mismatch, scores.size != teams.size! -> was this game already started?") } recyclerView.setHasFixedSize(true) recyclerView.layoutManager = LinearLayoutManager(recyclerView.context) recyclerView.itemAnimator = null recyclerView.adapter = adapter adapter.clear() val listeners = mutableListOf<TeamScoreListener>() teams.forEachIndexed { index, team -> val vm = TeamScoreViewModel(team, scores[index], finishUsecase, starter = scoreSettings.teamStartIndex == index) adapter.addItem(vm) listeners.add(vm) } uiCallback?.onLetsPlayDarts(listeners) } @JvmStatic @BindingAdapter("currentTeam") fun scrollToCurrentTeam(recyclerView: RecyclerView, currentTeamIndex: Int) { recyclerView.smoothScrollToPosition(currentTeamIndex) } @JvmStatic @BindingAdapter("description") fun setMatchDescription(view: TextView, desc: String?) { if(desc?.isNotBlank() == true) { view.text = desc } } }
4
null
1
1
a031a0eeadd0aa21cd587b5008364a16f890b264
1,992
Darts-Scorecard
Apache License 2.0
dxbase/src/main/java/com/dxmovie/dxbase/utils/Utils.kt
zajhello
60,514,520
false
null
package com.dxmovie.dxbase.utils import android.annotation.SuppressLint import android.content.Context object Utils { @SuppressLint("StaticFieldLeak") private var context: Context? = null /** * 初始化工具类 * * @param context 上下文 */ @JvmStatic fun init(context: Context) { Utils.context = context.applicationContext } /** * 获取ApplicationContext * * @return ApplicationContext */ @JvmStatic fun getContext(): Context? { if (context != null) { return context } throw NullPointerException("should be initialized in application") } }
1
null
1
1
7703ab9a84e2bc65b81011795115ac57efba624e
652
example
Apache License 2.0
src/test/java/uk/gov/justice/hmpps/prison/api/resource/impl/CellResourceHistoryTest.kt
ministryofjustice
156,829,108
false
{"Java": 5298201, "Kotlin": 1168351, "PLSQL": 947199, "Gherkin": 199239, "Dockerfile": 1126, "Shell": 944}
package uk.gov.justice.hmpps.prison.api.resource.impl import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test import org.mockito.ArgumentMatchers.anyString import org.mockito.Mockito.doThrow import org.mockito.kotlin.whenever import org.springframework.boot.test.mock.mockito.MockBean import org.springframework.http.MediaType import org.springframework.test.web.reactive.server.WebTestClient.ResponseSpec import uk.gov.justice.hmpps.prison.service.AgencyService import uk.gov.justice.hmpps.prison.service.EntityNotFoundException import java.time.LocalDate import java.time.LocalDateTime import java.time.LocalDateTime.now class CellResourceHistoryTest : ResourceTest() { companion object { private const val CELL_LOCATION_ID = -16 private const val AGENCY_ID = "LEI" private val ASSIGNMENT_DATE = LocalDate.of(2020, 4, 3).toString() } @MockBean private lateinit var agencyService: AgencyService @Test fun returnAllBedHistoriesForDateAndAgency() { val response = makeRequest(AGENCY_ID, ASSIGNMENT_DATE) response.expectStatus().isOk response.expectBody() .jsonPath("$.length()").isEqualTo(2) .jsonPath("[*].agencyId").value<List<String>> { assertThat(it).containsOnly(AGENCY_ID) } .jsonPath("[*].assignmentDate").value<List<String>> { assertThat(it).containsOnly(ASSIGNMENT_DATE) } } @Test fun returnsHttpNotFoundForAgenciesOutsideOfCurrentUsersCaseload() { doThrow(EntityNotFoundException("Not found")).whenever(agencyService).verifyAgencyAccess(anyString()) makeRequest(AGENCY_ID, ASSIGNMENT_DATE).expectStatus().isNotFound } @Test fun returnAllBedHistoriesForDateRangeOnly() { val fromDateTime = LocalDateTime.of(2000, 10, 16, 10, 10, 10) val toDateTime = LocalDateTime.of(2020, 10, 10, 11, 11, 11) val response = makeRequest(CELL_LOCATION_ID, fromDateTime.toString(), toDateTime.toString()) response.expectStatus().isOk response.expectBody() .jsonPath("$.length()").isEqualTo(3) .jsonPath("[*].livingUnitId").value<List<Int>> { assertThat(it).containsOnly(CELL_LOCATION_ID) } .jsonPath("[0].assignmentDate").isEqualTo("2019-10-17") .jsonPath("[1].assignmentDate").isEqualTo("2020-04-03") .jsonPath("[2].assignmentDate").isEqualTo("1985-04-03") } @Test fun handleInvalidFromDate() { makeRequest(CELL_LOCATION_ID, "hello", now().toString()).expectStatus().isBadRequest } @Test fun handleInvalidToDate() { makeRequest(CELL_LOCATION_ID, now().toString(), "hello").expectStatus().isBadRequest } @Test fun handleCellNotFound() { makeRequest(-991873, now().toString(), now().toString()).expectStatus().isNotFound } private fun makeRequest(locationId: Int, fromDate: String, toDate: String): ResponseSpec { return webTestClient.get() .uri("/api/cell/{cellLocationId}/history?fromDate={fromDate}&toDate={toDate}", locationId, fromDate, toDate) .headers(setAuthorisation(listOf())) .header("Content-Type", MediaType.APPLICATION_JSON_VALUE) .exchange() } private fun makeRequest(agencyId: String, assignmentDate: String): ResponseSpec { return webTestClient.get() .uri("/api/cell/{agencyId}/history/{assignmentDate}", agencyId, assignmentDate) .headers(setAuthorisation(listOf())) .header("Content-Type", MediaType.APPLICATION_JSON_VALUE) .exchange() } }
1
null
1
1
40c8c8467d504f85817068e7a7b5c60d2776fbe4
3,407
prison-api
MIT License
src/main/kotlin/com/txq/nn/NetworkData.kt
flyingyizi
124,735,014
false
{"Maven POM": 1, "Shell": 1, "Dockerfile": 1, "Text": 1, "Ignore List": 1, "Markdown": 3, "XML": 2, "Java": 5, "Kotlin": 26, "YAML": 1, "INI": 1}
package com.txq.nn /** * Defines the inputs and expected outputs for a graph. */ data class NetworkData(val inputs: List<Float>, val expectedOutputs: List<Float>) { companion object { fun create(inputs: List<Int>, targets: List<Int>) = NetworkData(inputs.map { it.toFloat() }, targets.map { it.toFloat() }) } override fun toString() = inputs.toString() + " -> " + expectedOutputs }
0
Kotlin
0
0
f4ace2d018ae8a93becaee85b7db882098074b7a
421
helloworldprovider
Apache License 2.0
tmp/arrays/youTrackTests/3117.kt
DaniilStepanov
228,623,440
false
{"Git Config": 1, "Gradle": 6, "Text": 3, "INI": 5, "Shell": 2, "Ignore List": 3, "Batchfile": 2, "Markdown": 2, "Kotlin": 15942, "JavaScript": 4, "ANTLR": 2, "XML": 12, "Java": 4}
// Original bug: KT-21521 class CompilerKillingIterator<T, out R>(private val underlying: Iterator<T>, private val transform: suspend (e: T) -> Iterator<R>) { private var currentIt: Iterator<R> = null!! suspend tailrec fun next(): R { return if (currentIt.hasNext()) { currentIt.next() } else if (underlying.hasNext()) { currentIt = transform(underlying.next()) next() } else { throw IllegalArgumentException("Cannot call next() on the empty iterator") } } }
1
null
8
1
602285ec60b01eee473dcb0b08ce497b1c254983
553
bbfgradle
Apache License 2.0
app/src/main/java/com/netposa/commonsdk/myapplication/LocationComponentActivity.kt
treech
259,178,223
false
{"Java": 243345, "Kotlin": 73586}
package com.netposa.commonsdk.myapplication import android.Manifest import android.content.pm.PackageManager import android.os.Build import android.os.Bundle import android.util.Log import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AppCompatActivity import androidx.core.app.ActivityCompat import com.alibaba.android.arouter.launcher.ARouter import com.google.android.material.snackbar.Snackbar import com.netposa.component.commonservice.location.LocationService import kotlinx.android.synthetic.main.activity_location_component.* import java.text.SimpleDateFormat import java.util.* class LocationComponentActivity : AppCompatActivity() { companion object { private const val TAG = "LocationComponent" private val SDF: SimpleDateFormat by lazy { SimpleDateFormat( "yyyy-MM-dd' 'HH:mm:ss", Locale.US ) } private const val REQUEST_PERMISSIONS = 0 } private lateinit var mLocationService: LocationService override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_location_component) setSupportActionBar(toolbar) fab.setOnClickListener { view -> Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) .setAction("Action", null).show() } checkPermissions() } private fun checkPermissions() { val permissions: MutableList<String> = mutableListOf() checkLocationPermissions(permissions) if (permissions.isNotEmpty()) { ActivityCompat.requestPermissions( this, permissions.toTypedArray(), REQUEST_PERMISSIONS ) } else { onAllPermissionsApproved() } } /** * 定位权限申请说明如下: * * 1,ACCESS_FINE_LOCATION权限必须申请得到用户的授权 * * 2,Android10及以上拥有ACCESS_FINE_LOCATION权限只能保证前台定位 * * 3,Android10及以上申请ACCESS_BACKGROUND_LOCATION权限以获得后台定位权限 * * https://developer.android.com/about/versions/10/privacy/changes#app-access-device-location */ private fun checkLocationPermissions(permissions: MutableList<String>) { if (ActivityCompat.checkSelfPermission( this, Manifest.permission.ACCESS_FINE_LOCATION ) != PackageManager.PERMISSION_GRANTED ) { permissions.add(Manifest.permission.ACCESS_FINE_LOCATION) } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { if (ActivityCompat.checkSelfPermission( this, Manifest.permission.ACCESS_BACKGROUND_LOCATION ) != PackageManager.PERMISSION_GRANTED ) { // 对于Android10及以上,如果已经有前台定位权限了,暂时先不用申请后台定位权限 if (permissions.contains(Manifest.permission.ACCESS_FINE_LOCATION)) { permissions.add(Manifest.permission.ACCESS_BACKGROUND_LOCATION) } } } } override fun onRequestPermissionsResult( requestCode: Int, permissions: Array<out String>, grantResults: IntArray ) { super.onRequestPermissionsResult(requestCode, permissions, grantResults) when (requestCode) { REQUEST_PERMISSIONS -> { var allPermissionsApproved = true for (idx in grantResults.indices) { if (grantResults[idx] != PackageManager.PERMISSION_GRANTED) { // Android10及以上的后台定位权限允许不用户授予,只要用户授予了前台定位权限 if (permissions[idx] != Manifest.permission.ACCESS_BACKGROUND_LOCATION) { allPermissionsApproved = false break } else { Log.v(TAG, "ACCESS_BACKGROUND_LOCATION PERMISSION_DENIED") } } } if (allPermissionsApproved) { onAllPermissionsApproved() } } } } private fun onAllPermissionsApproved() { mLocationService = ARouter.getInstance().navigation(LocationService::class.java) mLocationService.enablePrintDebugInfo(true) mLocationService.startService() if (BuildConfig.DEBUG) { mLocationService.addLocationListenerBoundLifecycle(LocationService.LocationListener { AlertDialog.Builder(this) .setCancelable(false) .setTitle(SDF.format(Date(System.currentTimeMillis()))) .setMessage(it.toString()) .setPositiveButton(android.R.string.ok) { dialog, which -> }.show() }, this) } } override fun onDestroy() { super.onDestroy() if (this::mLocationService.isInitialized) { mLocationService.stopService() } } }
1
null
1
1
bb3aabb93a95fcedb6f3df31194e6bbb0fbd125e
5,048
CommonSDK
Apache License 2.0
app/src/main/java/pl/droidsonroids/droidsmap/base/BaseFirebaseInteractor.kt
DroidsOnRoids
92,831,794
false
{"Gradle": 3, "Java Properties": 2, "Shell": 1, "Text": 1, "Ignore List": 2, "Batchfile": 1, "Proguard": 1, "Kotlin": 65, "XML": 22, "Java": 5}
package pl.droidsonroids.droidsmap.base import com.google.firebase.database.DatabaseReference import com.google.firebase.database.FirebaseDatabase abstract class BaseFirebaseInteractor { protected val firebaseDatabase: FirebaseDatabase = FirebaseDatabase.getInstance() protected lateinit var databaseQueryNode: DatabaseReference abstract fun setDatabaseNode() companion object { const val OFFICE_NODE = "office" const val EMPLOYEES_NODE = "employees" } }
0
Kotlin
0
1
310db4cd84410691743a42834587d05f79144bf2
494
DroidsMap
MIT License
plugins/kotlin/idea/tests/testData/refactoring/rename/inplace/QuotedParameter.kt
JetBrains
2,489,216
false
null
// NEW_NAME: x // RENAME: member class A(val a: B) class B(val b: Int) fun x(<caret>`is`: A) { val `in` = `is`.a `in`.b }
284
null
5162
16,707
def6433a5dd9f0a984cbc6e2835d27c97f2cb5f0
130
intellij-community
Apache License 2.0
src/r3/atomic-swap/corda/evm-interop-workflows/src/main/kotlin/com/r3/corda/evminterop/workflows/eth2eth/GetBlockReceiptsFlow.kt
hyperledger-labs
648,500,313
false
{"Git Config": 1, "CODEOWNERS": 1, "Text": 4, "Ignore List": 11, "Markdown": 27, "YAML": 13, "Gradle": 16, "JavaScript": 96, "JSON": 14, "Dockerfile": 5, "Shell": 9, "Batchfile": 3, "TOML": 2, "Gerber Image": 30, "INI": 6, "Java Properties": 3, "Kotlin": 85, "Java": 164, "Makefile": 4, "OASv2-json": 2, "Maven POM": 1, "XML": 6, "HTML": 1, "Smarty": 1}
package com.r3.corda.evminterop.workflows.eth2eth import co.paralleluniverse.fibers.Suspendable import com.r3.corda.evminterop.services.evmInterop import net.corda.core.flows.FlowLogic import net.corda.core.flows.InitiatingFlow import net.corda.core.flows.StartableByRPC import net.corda.core.utilities.ProgressTracker import net.corda.core.utilities.loggerFor import java.math.BigInteger /** * Get all transaction receipts from a block * * @property blockNumber the number of the block * @return the ethereum transaction receipts of a block. */ @StartableByRPC @InitiatingFlow class GetBlockReceiptsFlow( private val blockNumber: BigInteger ) : FlowLogic<List<com.r3.corda.evminterop.dto.TransactionReceipt>>() { @Suppress("ClassName") companion object { object CONNECT_WEB3 : ProgressTracker.Step("Connecting WEB3 API provider.") object QUERY_BLOCK_RECEIPTS : ProgressTracker.Step("Querying block receipts.") fun tracker() = ProgressTracker( CONNECT_WEB3, QUERY_BLOCK_RECEIPTS ) val log = loggerFor<GetBlockReceiptsFlow>() } override val progressTracker: ProgressTracker = tracker() @Suspendable override fun call(): List<com.r3.corda.evminterop.dto.TransactionReceipt> { progressTracker.currentStep = CONNECT_WEB3 val web3 = evmInterop().web3Provider() progressTracker.currentStep = QUERY_BLOCK_RECEIPTS // NOTE: getBlockReceipts depends on Web3j 4.10.1 and clients supporting eth_getBlockReceipts, therefore we're // temporarily querying receipts by iterating through block transactions, one by one. //val receipts = await(web3.getBlockReceipts(blockNumber)) val block = await(web3.getBlockByNumber(blockNumber, true)) val receipts = block.transactions.map { await(web3.getTransactionReceiptByHash(it.hash)) } return receipts } }
6
Java
15
22
65759960097a714dedd9ed03ad5bf01e4099e589
1,943
harmonia
Apache License 2.0
src/test/kotlin/com/github/roroche/eoplantumlbuilder/fixtures/Fixture.kt
RoRoche
261,711,580
false
null
package com.github.roroche.eoplantumlbuilder.fixtures /** * A bunch of things to be performed before an [com.pragmaticobjects.oo.tests.Assertion]. */ interface Fixture { /** * Perform what is expected. */ fun perform() }
2
Kotlin
0
1
a5cef4bcefbdc071b5832e3ae1f925e8ea6b393b
241
eo-plantuml-builder
Apache License 2.0
guides/micronaut-security-basicauth/kotlin/src/test/kotlin/example/micronaut/AppClient.kt
micronaut-projects
326,986,278
false
null
/* * Copyright 2017-2024 original authors * * 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 * * https://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 example.micronaut import io.micronaut.http.MediaType.TEXT_PLAIN import io.micronaut.http.annotation.Consumes import io.micronaut.http.annotation.Get import io.micronaut.http.annotation.Header import io.micronaut.http.client.annotation.Client @Client("/") interface AppClient { @Consumes(TEXT_PLAIN) // <1> @Get fun home(@Header authorization: String): String // <2> }
209
null
31
36
f40e50dc8f68cdb3080cb3802d8082ada9ca6787
993
micronaut-guides
Creative Commons Attribution 4.0 International
baseAF/src/main/java/com/foundation/app/arc/activity/BaseVMVBActivity.kt
Western-parotia
617,381,942
false
{"Kotlin": 104968, "Java": 5599}
package com.foundation.app.arc.activity import android.os.Bundle import androidx.annotation.MainThread import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.ViewModelStoreOwner import androidx.viewbinding.ViewBinding import com.foundation.app.arc.fragment.BaseVMFragment import com.foundation.app.arc.utils.ext.AFViewModelLazy import com.foundation.app.arc.utils.ext.ActivityViewBindingDelegate import com.foundation.app.arc.utils.ext.lazyAtomic import com.foundation.widget.binding.ViewBindingHelper /** * ViewModel 创建与使用规范 * ViewBinding 初始化与简化 * create by zhusw on 5/18/21 15:05 */ abstract class BaseVMVBActivity : BaseParamsActivity() { val activityVMProvider by lazyAtomic { ViewModelProvider(this) } val applicationVMProvider by lazyAtomic { val app = application ?: throw IllegalStateException( "Activity 不可以在 onCreate 之前使用 ViewModel,因为此时 $this 还未绑定 application." ) when (app) { is ViewModelStoreOwner -> { ViewModelProvider( app.viewModelStore, ViewModelProvider.AndroidViewModelFactory.getInstance(app) ) } else -> { throw IllegalStateException( "application:$app 没实现" + " ViewModelStoreOwner,调用者是 Activity:$this " ) } } } protected fun <VM : ViewModel> getActivityVM(clz: Class<VM>): VM { return activityVMProvider.get(clz) } protected fun <VM : ViewModel> getGlobalVM(clz: Class<VM>): VM { return applicationVMProvider.get(clz) } /** protected val testStr = "" protected inline fun testI() { val t = { testStr // protected val testStr = "" } t.invoke() } 以上代码,在跨module中的子类中访问,将会报错 如果inline 函数 内部使用了 lambda 或者匿名内部类,并在其中访问了外部类非public的成员 就会导致无法访问的异常(仅在小米k30 os 10 上不复现) */ @MainThread inline fun <reified VM : ViewModel> lazyActivityVM(): Lazy<VM> { return AFViewModelLazy(VM::class) { activityVMProvider } } @MainThread inline fun <reified VM : ViewModel> lazyGlobalVM(): Lazy<VM> { return AFViewModelLazy(VM::class) { applicationVMProvider } } override fun onCreate(savedInstanceState: Bundle?) { val support = supportRebuildData()//1 val state = if (support) savedInstanceState else null beforeSuperOnCreate(state)//2 super.onCreate(state)//3 afterSuperOnCreate(state)//4 getContentVB()?.let { setContentView(it.root) }//5 initViewModel()//6 init(state)//7 bindData()//8 } /** * 是否支持activity被杀死后重建(是否使用 savedInstanceState中相关数据, * 系统默认在其中保存了Fragment的状态,重建会导致fragment异常展示) * * 注意:此处仅限于app杀死重建,对于fragment的内部的重建参考:[BaseVMFragment.onCreate] * * @return 默认不支持。如果返回true,则必须测试杀死后重建的流程 */ protected open fun supportRebuildData() = false /** * super.onCreate 之前回调 * 支持一些特殊的窗口配置需要在onCreate之前设置 */ protected abstract fun beforeSuperOnCreate(savedInstanceState: Bundle?) /** * super.onCreate 之后回调 */ abstract fun afterSuperOnCreate(savedInstanceState: Bundle?) /** * 将ViewBinding.root 设置为根布局 */ @Deprecated(message = "不再需要实现 getContentVB", replaceWith = ReplaceWith("lazyAndSetRoot")) open fun getContentVB(): ViewBinding? = null /** * 主要是支持在java中使用,在kotlin中可用[lazyActivityVM] */ protected abstract fun initViewModel() /** * 建议: * 1.view初始化,比如是否开启下拉刷新 */ protected abstract fun init(savedInstanceState: Bundle?) /** * 建议: * 订阅viewModel的数据并进行绑定 * 调用数据加载 */ protected abstract fun bindData() @Deprecated(message = "不再需要实现", replaceWith = ReplaceWith("lazyAndSetRoot")) protected inline fun <reified VB : ViewBinding> lazyVB() = lazyAtomic { ViewBindingHelper.getViewBindingInstanceByClass( VB::class.java, layoutInflater, null ) } protected inline fun <reified VB : ViewBinding> lazyAndSetRoot() = ActivityViewBindingDelegate(this) { ViewBindingHelper.getViewBindingInstanceByClass( VB::class.java, layoutInflater, null ) } }
0
Kotlin
2
5
70b6a39103a5c759f889ab3463e2c1283631e0c0
4,407
AndroidBaseArchitecture
MIT License
tl/src/main/kotlin/com/github/badoualy/telegram/tl/api/TLJsonArray.kt
Miha-x64
436,587,061
true
{"Kotlin": 3919807, "Java": 75352}
package com.github.badoualy.telegram.tl.api import com.github.badoualy.telegram.tl.TLObjectUtils.SIZE_CONSTRUCTOR_ID import com.github.badoualy.telegram.tl.core.TLObjectVector import com.github.badoualy.telegram.tl.serialization.TLDeserializer import com.github.badoualy.telegram.tl.serialization.TLSerializer import java.io.IOException /** * jsonArray#f7444763 * * @author <NAME> <EMAIL> * @see <a href="http://github.com/badoualy/kotlogram">http://github.com/badoualy/kotlogram</a> */ class TLJsonArray() : TLAbsJSONValue() { var value: TLObjectVector<TLAbsJSONValue> = TLObjectVector() private val _constructor: String = "jsonArray#f7444763" override val constructorId: Int = CONSTRUCTOR_ID constructor(value: TLObjectVector<TLAbsJSONValue>) : this() { this.value = value } @Throws(IOException::class) override fun serializeBody(tlSerializer: TLSerializer) = with (tlSerializer) { writeTLVector(value) } @Throws(IOException::class) override fun deserializeBody(tlDeserializer: TLDeserializer) = with (tlDeserializer) { value = readTLVector<TLAbsJSONValue>() } override fun computeSerializedSize(): Int { var size = SIZE_CONSTRUCTOR_ID size += value.computeSerializedSize() return size } override fun toString() = _constructor override fun equals(other: Any?): Boolean { if (other !is TLJsonArray) return false if (other === this) return true return value == other.value } companion object { const val CONSTRUCTOR_ID: Int = 0xf7444763.toInt() } }
1
Kotlin
2
3
1a8963dce921c1e9ef05b9d1e56d8fbcb1ea1c4b
1,620
kotlogram-resurrected
MIT License
antlr-kotlin-runtime/src/commonMain/kotlin/com/strumenta/kotlinmultiplatform/WeakHashMap.kt
Strumenta
145,450,730
false
{"Kotlin": 906270, "ANTLR": 3893}
package com.strumenta.kotlinmultiplatform expect class WeakHashMap<K, V>() : MutableMap<K, V>
30
Kotlin
46
181
04d77aa796c4a927a4cda29cc1afa58d8da8aa86
95
antlr-kotlin
Apache License 2.0
services/account-service/src/main/kotlin/org/katan/service/account/repository/AccountsRepository.kt
KatanPanel
182,468,654
false
null
package org.katan.service.account.repository import org.katan.model.account.Account internal interface AccountsRepository { suspend fun findById(id: Long): AccountEntity? suspend fun findByUsername(username: String): AccountEntity? suspend fun findHashByUsername(username: String): String? suspend fun addAccount(account: Account, hash: String) suspend fun deleteAccount(accountId: Long) suspend fun existsByUsername(username: String): Boolean }
0
Kotlin
5
55
8e2f39310ec87bf19eed5a8a73b105518cabe7d9
478
Katan
Apache License 2.0
app/src/main/java/com/jlmari/android/basepokedex/pokemondetail/di/PokemonDetailComponent.kt
jlmari
561,303,847
false
{"Kotlin": 127493}
package com.jlmari.android.basepokedex.pokemondetail.di import com.jlmari.android.basepokedex.application.scopes.PerFragment import com.jlmari.android.basepokedex.pokemondetail.PokemonDetailFragment import dagger.Subcomponent @PerFragment @Subcomponent(modules = [PokemonDetailModule::class]) interface PokemonDetailComponent { @Subcomponent.Factory interface Factory { fun create(): PokemonDetailComponent } fun inject(fragment: PokemonDetailFragment) }
0
Kotlin
0
0
3dcb577c0bf011e30c5769c21202aa6d98e94f8f
483
BasePokedex
Apache License 2.0
app/src/main/java/com/pandacorp/lechat/presentation/ui/adapter/chat/ChatItem.kt
KitsuneFolk
735,334,673
false
{"Kotlin": 114743}
package com.pandacorp.lechat.presentation.ui.adapter.chat import com.pandacorp.lechat.domain.model.MessageItem import com.pandacorp.lechat.utils.Constants data class ChatItem( var id: Long = 0, val title: String = defaultTitle, val messages: List<MessageItem> = Constants.defaultMessagesList ) { companion object { const val defaultTitle = "New Chat" } }
0
Kotlin
0
1
2b9f0f94b4d435fbf817327b993543379333f023
384
LeChat
Apache License 2.0
src/serverMain/kotlin/mce/cli/Launch.kt
mcenv
435,848,712
false
null
package mce.cli import kotlinx.cli.ArgType import kotlinx.cli.ExperimentalCli import kotlinx.cli.Subcommand import kotlinx.cli.default import kotlinx.coroutines.runBlocking import mce.pass.Config import mce.server.Server @ExperimentalCli object Launch : Subcommand("launch", "Launch server") { private const val DEFAULT_PORT: Int = 51130 private val port: Int by option(ArgType.Int, "port", "p", "Port").default(DEFAULT_PORT) override fun execute(): Unit = runBlocking { Server(Config).launch(port) } }
79
Kotlin
0
15
f63905729320733d3cae95c3b51b492e94339fca
530
mce
MIT License
app/src/androidTest/java/com/mapbox/maps/testapp/logo/generated/LogoAttributeParserDefaultValueTest.kt
mapbox
330,365,289
false
null
// This file is generated. package com.mapbox.maps.testapp.logo.generated import android.view.Gravity import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.LargeTest import com.mapbox.maps.plugin.logo.logo import com.mapbox.maps.testapp.BaseMapTest import org.junit.Assert.assertEquals import org.junit.Test import org.junit.runner.RunWith /** * Instrumented test, which will execute on an Android device. * * See [testing documentation](http://d.android.com/tools/testing). */ @RunWith(AndroidJUnit4::class) @LargeTest class LogoAttributeParserDefaultValueTest : BaseMapTest() { @Test fun testAttributeParser() { assertEquals( "enabled test failed..", true, mapView.logo.getSettings().enabled ) assertEquals( "position test failed..", Gravity.BOTTOM or Gravity.START, mapView.logo.getSettings().position ) assertEquals( "marginLeft test failed..", 4f * pixelRatio, mapView.logo.getSettings().marginLeft ) assertEquals( "marginTop test failed..", 4f * pixelRatio, mapView.logo.getSettings().marginTop ) assertEquals( "marginRight test failed..", 4f * pixelRatio, mapView.logo.getSettings().marginRight ) assertEquals( "marginBottom test failed..", 4f * pixelRatio, mapView.logo.getSettings().marginBottom ) } } // End of generated file.
216
null
131
472
2700dcaf18e70d23a19fc35b479bff6a2d490475
1,434
mapbox-maps-android
Apache License 2.0
src/main/java/timeCounter/TimeCounterWindow.kt
unq-ui
243,400,248
false
null
package timeCounter import org.uqbar.arena.widgets.Panel import org.uqbar.arena.widgets.Label import org.uqbar.arena.widgets.TextBox import org.uqbar.arena.windows.MainWindow import org.uqbar.arena.kotlin.extensions.* import org.uqbar.arena.kotlin.transformers.LocalDateTransformer fun main() = TimeCounterWindow(TimeCounter()).startApplication() class TimeCounterWindow(model: TimeCounter) : MainWindow<TimeCounter>(model) { override fun createContents(mainPanel: Panel) { title = "Cantidad de Días" setMinWidth(250) Panel(mainPanel) with { asHorizontal() Label(it) with { text = "Hoy es:" } Label(it) bindTo "now" } Panel(mainPanel) with { asHorizontal() Label(it) with { text = "Fecha:" } TextBox(it) with { withFilter(LocalDateFilter()) bindTo("anotherDate").setTransformer(LocalDateTransformer()) } } Label(mainPanel) with { text = "_______Modelo_______" } Panel(mainPanel) with { asHorizontal() Label(it) with { text = "AnotherDate:" } Label(it) bindTo "anotherDate" } } }
0
Kotlin
0
0
bd6e2ab0e1f4a290df1ba3e2a77342a34b1b32b1
1,049
ej-desktop-time-counter
ISC License
app/src/main/java/com/github/k1rakishou/kpnc/ui/main/MainActivity.kt
K1rakishou
628,245,583
false
null
package com.github.k1rakishou.kpnc.ui.main import android.content.Context import android.os.Bundle import android.widget.Toast import androidx.activity.ComponentActivity import androidx.activity.compose.setContent import androidx.compose.foundation.layout.* import androidx.compose.material.* import androidx.compose.runtime.* import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.unit.dp import com.github.k1rakishou.kpnc.domain.GoogleServicesChecker import com.github.k1rakishou.kpnc.helpers.errorMessageOrClassName import com.github.k1rakishou.kpnc.helpers.isUserIdValid import com.github.k1rakishou.kpnc.model.data.ui.AccountInfo import com.github.k1rakishou.kpnc.model.data.ui.UiResult import com.github.k1rakishou.kpnc.ui.theme.KPNCTheme import logcat.asLog import org.koin.androidx.viewmodel.ext.android.viewModel import org.koin.core.component.KoinComponent class MainActivity : ComponentActivity(), KoinComponent { private val mainViewModel: MainViewModel by viewModel<MainViewModel>() override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContent { KPNCTheme { Surface( modifier = Modifier.fillMaxSize(), color = MaterialTheme.colors.background ) { val context = LocalContext.current val firebaseToken by mainViewModel.firebaseToken val googleServicesCheckResult by mainViewModel.googleServicesCheckResult val accountInfo by mainViewModel.accountInfo val rememberedUserId by mainViewModel.rememberedUserId Box(modifier = Modifier.fillMaxSize()) { Column( modifier = Modifier .fillMaxWidth() .wrapContentHeight() .padding(8.dp) ) { Content( googleServicesCheckResult = googleServicesCheckResult, firebaseToken = firebaseToken, accountInfo = accountInfo, rememberedUserId = rememberedUserId, onLogin = { userId -> mainViewModel.login(userId) }, onLogout = { mainViewModel.logout() } ) } } } } } } } @Composable private fun ColumnScope.Content( googleServicesCheckResult: GoogleServicesChecker.Result, rememberedUserId: String?, accountInfo: UiResult<AccountInfo>, firebaseToken: UiResult<String>, onLogin: (String) -> Unit, onLogout: () -> Unit ) { val context = LocalContext.current if (googleServicesCheckResult == GoogleServicesChecker.Result.Empty) { Text(text = "Checking for Google services availability...") return } val googleServicesCheckResultText = when (googleServicesCheckResult) { GoogleServicesChecker.Result.Empty -> return GoogleServicesChecker.Result.Success -> "Google services detected" GoogleServicesChecker.Result.ServiceMissing -> "Google services are missing" GoogleServicesChecker.Result.ServiceUpdating -> "Google services are currently updating" GoogleServicesChecker.Result.ServiceUpdateRequired -> "Google services need to be updated" GoogleServicesChecker.Result.ServiceDisabled -> "Google services are disabled" GoogleServicesChecker.Result.ServiceInvalid -> "Google services are not working correctly" GoogleServicesChecker.Result.Unknown -> "Google services unknown error" } Text(text = googleServicesCheckResultText) Spacer(modifier = Modifier.height(4.dp)) if (googleServicesCheckResult != GoogleServicesChecker.Result.Success) { return } if (firebaseToken is UiResult.Empty || firebaseToken is UiResult.Loading) { Text(text = "Loading firebase token...") return } if (firebaseToken is UiResult.Error) { Text(text = "Failed to load firebase token, error: ${firebaseToken.throwable.asLog()}") return } firebaseToken as UiResult.Value Text(text = "Firebase token: ${firebaseToken.value}") Spacer(modifier = Modifier.height(16.dp)) var userId by remember { mutableStateOf(rememberedUserId ?: "") } var isError by remember { mutableStateOf(!isUserIdValid(userId)) } val isLoggedIn = ((accountInfo as? UiResult.Value)?.value?.isValid == true) || isUserIdValid(rememberedUserId) TextField( modifier = Modifier .wrapContentHeight() .fillMaxWidth(), enabled = !isLoggedIn, label = { Text(text = "UserId (${userId.length}/128)") }, isError = isError, value = userId, onValueChange = { userId = it isError = !isUserIdValid(userId) if (isError) { showToast(context, "UserId length must be within 32..128 characters range") } } ) Spacer(modifier = Modifier.height(4.dp)) if (accountInfo is UiResult.Value) { Text(text = "Account info: ${accountInfo.value}") } else if (accountInfo is UiResult.Error) { LaunchedEffect( key1 = accountInfo.throwable, block = { showToast( context = context, message = accountInfo.throwable.errorMessageOrClassName(userReadable = true) ) } ) } Spacer(modifier = Modifier.height(4.dp)) val buttonEnabled = if (isLoggedIn) { true } else { isUserIdValid(userId) && accountInfo !is UiResult.Loading } Row { Button( enabled = buttonEnabled, onClick = { if (isLoggedIn) { userId = "" onLogout() } else { onLogin(userId) } } ) { if (isLoggedIn) { Text(text = "Logout") } else { Text(text = "Login") } } } } private var prevToast: Toast? = null private fun showToast( context: Context, message: String ) { prevToast?.cancel() val toast = Toast.makeText( context, message, Toast.LENGTH_LONG ) prevToast = toast toast.show() }
0
Kotlin
0
0
0675dbf74239ea36b297ed4a7a12e05b14e148d4
5,887
KPNC-client
MIT License
core/src/main/kotlin/io/github/legion2/tosca_orchestrator/tosca/model/instance/InterfaceInstance.kt
Legion2
350,881,803
false
null
package io.github.legion2.tosca_orchestrator.tosca.model.instance import io.github.legion2.tosca_orchestrator.tosca.definitions.InterfaceAssignment import io.github.legion2.tosca_orchestrator.tosca.definitions.NotificationDefinition import io.github.legion2.tosca_orchestrator.tosca.model.combine import io.github.legion2.tosca_orchestrator.tosca.model.property.ExpressionResolverContext import io.github.legion2.tosca_orchestrator.tosca.model.resolved.OperationResolverContext import io.github.legion2.tosca_orchestrator.tosca.model.resolved.ResolvedInterface import io.github.legion2.tosca_orchestrator.tosca.model.resolved.type.ResolvedInterfaceType data class InterfaceInstance( val name: String, val type: ResolvedInterfaceType, val inputs: Map<String, PropertyInstance> = emptyMap(), val operations: Map<String, OperationInstance> = emptyMap(), val notifications: Map<String, NotificationDefinition> = emptyMap() ) { companion object { fun validate( interfaceAssignments: Map<String, InterfaceAssignment>, interfaces: Map<String, ResolvedInterface>, expressionResolverContext: ExpressionResolverContext, operationResolverContext: OperationResolverContext ): Map<String, InterfaceInstance> { return interfaces.combine(interfaceAssignments) { name, resolvedInterface, interfaceAssignment -> resolvedInterface ?: throw IllegalArgumentException("Interface Assignments must have matching Interface definitions: $name") validate( name, interfaceAssignment, resolvedInterface, expressionResolverContext, operationResolverContext ) } } private fun validate( name: String, interfaceAssignment: InterfaceAssignment?, resolvedInterface: ResolvedInterface, expressionResolverContext: ExpressionResolverContext, operationResolverContext: OperationResolverContext ): InterfaceInstance { if (!interfaceAssignment?.deprecatedOperationsSyntax.isNullOrEmpty()) { throw IllegalArgumentException("Deprecated Interface assignment without 'operations' keyname is not supported: $interfaceAssignment") } val inputs = PropertyInstance.validate( interfaceAssignment?.inputs.orEmpty(), resolvedInterface.inputs, expressionResolverContext ) val operations = OperationInstance.validate( interfaceAssignment?.operations.orEmpty(), resolvedInterface.operations, expressionResolverContext, operationResolverContext ) return InterfaceInstance(name, resolvedInterface.type, inputs, operations, resolvedInterface.notifications) } } }
6
Kotlin
0
3
fb4ef1a7bf3d79d258da2b6779381a87e0c435e9
2,998
ritam
Apache License 2.0
app/src/main/java/com/progdeelite/dca/dependency/Dependency.kt
treslines
408,171,722
false
null
package com.progdeelite.dca.dependency // +-----------------------------------------------------------------------------------------------+ // https://proandroiddev.com/better-dependencies-management-using-buildsrc-kotlin-dsl-eda31cdb81bf | // +-----------------------------------------------------------------------------------------------+ object Versions { const val appMinSdk = 23 const val appCompileSdk = 31 const val appTargetSdk = 31 val appVersionCode = parseGitCommitCount() const val appVersionName = "1.0.0" // VERSÃO QUE SEU APLICATICO TERÁ const val androidBuildTools = "7.0.3" const val androidJunit5Plugin = "1.7.0.0" const val androidJunit5Instrumentation = "1.2.0" const val androidxAnnotation = "1.2.0" const val androidxAppCompat = "1.4.0-beta01" const val androidxCamera = "1.1.0-alpha10" const val androidxCameraExtensions = "1.0.0-alpha30" const val androidxCore = "1.7.0-rc01" const val androidxLifecycle = "2.3.1" const val androidxNavigation = "2.3.5" const val androidxTestRunner = "1.4.1-alpha03" const val constraintLayout = "2.1.1" const val material = "1.4.0" const val apacheLang = "3.9" const val appCenter = "4.0.0" const val fragment = "1.3.6" const val junit = "5.7.0" const val kotlin = "1.5.31" const val kotlinCoroutines = "1.5.2-native-mt" const val kotlinxSerialization = "1.3.0" const val koinAndroid = "2.1.6" const val koinCore = "3.0.0-alpha-4" const val ktor = "1.6.3" const val mockk = "1.12.0" const val multiplatformSettings = "0.8.1" const val sonar = "3.0" const val timber = "5.0.1" const val klock = "1.12.0" const val splashScreen = "1.0.0-alpha01" } object Kotlin { val gradlePlugin by lazy { "org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.kotlin}" } val coroutinesCore by lazy { "org.jetbrains.kotlinx:kotlinx-coroutines-core:${Versions.kotlinCoroutines}" } val kotlinxSerialization by lazy { "org.jetbrains.kotlinx:kotlinx-serialization-core:${Versions.kotlinxSerialization}" } val kotlinxSerializationJson by lazy { "org.jetbrains.kotlinx:kotlinx-serialization-json:${Versions.kotlinxSerialization}" } } object Ktor { val mock by lazy { "io.ktor:ktor-client-mock:${Versions.ktor}" } val clientLogging by lazy { "io.ktor:ktor-client-logging:${Versions.ktor}" } } object AppCenter { val crashes by lazy { "com.microsoft.appcenter:appcenter-crashes:${Versions.appCenter}" } } object Multiplatform { val klock by lazy { "com.soywiz.korlibs.klock:klock:${Versions.klock}" } } object Android { val appCompat by lazy { "androidx.appcompat:appcompat:${Versions.androidxAppCompat}" } val annotation by lazy { "androidx.appcompat:appcompat:${Versions.androidxAnnotation}" } val buildTools by lazy { "com.android.tools.build:gradle:${Versions.androidBuildTools}" } val camera by lazy { "androidx.camera:camera-camera2:${Versions.androidxCamera}" } val cameraLifecycle by lazy { "androidx.camera:camera-lifecycle:${Versions.androidxCamera}" } val cameraExtensions by lazy { "androidx.camera:camera-extensions:${Versions.androidxCameraExtensions}" } val cameraView by lazy { "androidx.camera:camera-view:${Versions.androidxCameraExtensions}" } val core by lazy { "androidx.core:core-ktx:${Versions.androidxCore}" } val constraintLayout by lazy { "androidx.constraintlayout:constraintlayout:${Versions.constraintLayout}" } val fragment by lazy { "androidx.fragment:fragment:${Versions.fragment}" } val fragmentKtx by lazy { "androidx.fragment:fragment-ktx:${Versions.fragment}" } val fragmentTesting by lazy { "androidx.fragment:fragment-testing:${Versions.fragment}" } val junit5Plugin by lazy { "de.mannodermaus.gradle.plugins:android-junit5:${Versions.androidJunit5Plugin}" } val junit5InstrumentationCore by lazy { "de.mannodermaus.junit5:android-test-core:${Versions.androidJunit5Instrumentation}" } val junit5InstrumentationRunner by lazy { "de.mannodermaus.junit5:android-test-runner:${Versions.androidJunit5Instrumentation}" } val lifecycle by lazy { "androidx.lifecycle:lifecycle-common-java8:${Versions.androidxLifecycle}" } val material by lazy { "com.google.android.material:material:${Versions.material}" } val mockkInstrumentation by lazy { "io.mockk:mockk-android:${Versions.mockk}" } val navigationFragment by lazy { "androidx.navigation:navigation-fragment-ktx:${Versions.androidxNavigation}" } val navigationUi by lazy { "androidx.navigation:navigation-ui-ktx:${Versions.androidxNavigation}" } val testRunner by lazy { "androidx.test:runner:${Versions.androidxTestRunner}" } val timber by lazy { "com.jakewharton.timber:timber:${Versions.timber}" } val apacheLang by lazy { "org.apache.commons:commons-lang3:${Versions.apacheLang}" } val splashscreen by lazy { "androidx.core:core-splashscreen:${Versions.splashScreen}" } } object Koin { val android by lazy { "org.koin:koin-android:${Versions.koinAndroid}" } val viewModel by lazy { "org.koin:koin-android-viewmodel:${Versions.koinAndroid}" } val core by lazy { "org.koin:koin-core:${Versions.koinCore}" } val test by lazy { "org.koin:koin-test:${Versions.koinCore}" } } object Persistence { val multiplatformSettings by lazy { "com.russhwolf:multiplatform-settings:${Versions.multiplatformSettings}" } } object Testing { val coroutines by lazy { "org.jetbrains.kotlinx:kotlinx-coroutines-test:${Versions.kotlinCoroutines}" } val junitJupiterApi by lazy { "org.junit.jupiter:junit-jupiter-api:${Versions.junit}" } val junitJupiterEngine by lazy { "org.junit.jupiter:junit-jupiter-engine:${Versions.junit}" } val junitJupiterParams by lazy { "org.junit.jupiter:junit-jupiter-params:${Versions.junit}" } val mockk by lazy { "io.mockk:mockk:${Versions.mockk}" } }
0
Kotlin
5
23
d3f3874288f72d6ccb9a1ce9722c7bb238c53565
5,991
desafios_comuns_android
Apache License 2.0
benchmarks/commonMain/src/benchmarks/immutableList/builder/Add.kt
Kotlin
59,769,494
false
{"Kotlin": 569271}
/* * Copyright 2016-2019 JetBrains s.r.o. * Use of this source code is governed by the Apache 2.0 License that can be found in the LICENSE.txt file. */ package benchmarks.immutableList.builder import benchmarks.* import kotlinx.collections.immutable.PersistentList import kotlinx.benchmark.* @State(Scope.Benchmark) open class Add { @Param(BM_1, BM_10, BM_100, BM_1000, BM_10000, BM_100000, BM_1000000, BM_10000000) var size: Int = 0 @Param(IP_100, IP_99_09, IP_95, IP_70, IP_50, IP_30, IP_0) var immutablePercentage: Double = 0.0 @Benchmark fun addLast(): PersistentList.Builder<String> { return persistentListBuilderAdd(size, immutablePercentage) } @Benchmark fun addLastAndIterate(bh: Blackhole) { val builder = persistentListBuilderAdd(size, immutablePercentage) for (e in builder) { bh.consume(e) } } @Benchmark fun addLastAndGet(bh: Blackhole) { val builder = persistentListBuilderAdd(size, immutablePercentage) for (i in 0 until builder.size) { bh.consume(builder[i]) } } /** * Adds [size] - 1 elements to an empty persistent list builder * and then inserts one element at the beginning. * * Measures mean time and memory spent per `add` operation. * * Expected time: nearly constant. * Expected memory: nearly constant. */ @Benchmark fun addFirst(): PersistentList.Builder<String> { val builder = persistentListBuilderAdd(size - 1, immutablePercentage) builder.add(0, "another element") return builder } /** * Adds [size] - 1 elements to an empty persistent list builder * and then inserts one element at the middle. * * Measures mean time and memory spent per `add` operation. * * Expected time: nearly constant. * Expected memory: nearly constant. */ @Benchmark fun addMiddle(): PersistentList.Builder<String> { val builder = persistentListBuilderAdd(size - 1, immutablePercentage) builder.add(size / 2, "another element") return builder } }
50
Kotlin
53
996
c73ce02cf1214f14ec177cc6c2da15677ec98012
2,155
kotlinx.collections.immutable
Apache License 2.0
saveur/app/src/main/java/com/saveurmarche/saveurmarche/ui/view/main/process/BarItem.kt
kassisdion
113,703,894
false
null
package com.saveurmarche.saveurmarche.ui.view.main.process import android.support.v4.app.Fragment abstract class BarItem { /* ******************************************************************************************** ** Method every child will have to implement ******************************************************************************************** */ abstract val fragment: Fragment }
0
Kotlin
1
1
87ff2f335446a8c7443b6e601c8ab5b80ec06432
420
saveur_marche
MIT License
app/src/main/java/com/allenlabsfsm/RevisionNote.kt
DebashisINT
620,819,564
false
null
package com.allenlabsfsm class RevisionNote { }
0
Kotlin
0
0
ed63f579d2a5f13586fc1737c0935bd345814415
49
AllenLabs
Apache License 2.0
app/src/main/java/com/tixon/reminders/storage/database/RemindersDao.kt
TikhonOsipov
410,515,131
false
{"Kotlin": 58867, "Shell": 110}
package com.tixon.reminders.storage.database import androidx.room.* import com.tixon.reminders.storage.entity.LocationDb import com.tixon.reminders.storage.entity.ReminderDb import com.tixon.reminders.storage.entity.ReminderWithLocations import io.reactivex.Observable @Dao interface RemindersDao { @Transaction @Query("select * from Reminders") fun getRemindersList(): Observable<List<ReminderWithLocations>> @Transaction @Query("select * from Reminders where reminderId=:reminderId") fun getReminderById(reminderId: Long): Observable<ReminderWithLocations> @Insert fun insertReminder(reminder: ReminderDb): Long @Transaction fun insertReminderWithLocations(reminder: ReminderDb, locations: List<LocationDb>, insertLocationsLambda: (List<LocationDb>) -> Unit) { val idOfInsertedReminder = insertReminder(reminder) insertLocationsLambda.invoke( locations.map { it.copy( reminderIdRefersTo = idOfInsertedReminder, ) } ) } @Update fun updateReminder(reminder: ReminderDb) @Query("delete from Reminders where reminderId=:reminderId") fun removeReminder(reminderId: Int) @Query("delete from Reminders") fun removeAllReminders() }
0
Kotlin
0
0
da1cfec323af18286df2fc2bf8e8430bbe53b8a5
1,303
GPS-Reminders
Apache License 2.0
app/src/main/java/com/struklearn/app/modules/binarysearchtreebst/data/model/BinarySearchTreeBstModel.kt
nurkholiswakhid
737,292,232
false
{"Kotlin": 74607}
package com.struklearn.app.modules.binarysearchtreebst.`data`.model import com.struklearn.app.R import com.struklearn.app.appcomponents.di.MyApp import kotlin.String data class BinarySearchTreeBstModel( /** * TODO Replace with dynamic value */ var txtSTRUKTURDATAT: String? = MyApp.getInstance().resources.getString(R.string.msg_struktur_data_t) , /** * TODO Replace with dynamic value */ var txtBinarySearchT: String? = MyApp.getInstance().resources.getString(R.string.msg_binary_search_t2) , /** * TODO Replace with dynamic value */ var txtDefinisiBinary: String? = MyApp.getInstance().resources.getString(R.string.msg_definisi_binary) , /** * TODO Replace with dynamic value */ var txtDescription: String? = MyApp.getInstance().resources.getString(R.string.msg_binary_search_t3) , /** * TODO Replace with dynamic value */ var txtTimeZone: String? = MyApp.getInstance().resources.getString(R.string.lbl_sifat_sifat_bst) , /** * TODO Replace with dynamic value */ var txtDescriptionOne: String? = MyApp.getInstance().resources.getString(R.string.msg_sifat_pencarian) , /** * TODO Replace with dynamic value */ var txtSifatRekursif: String? = MyApp.getInstance().resources.getString(R.string.msg_sifat_rekursif) , /** * TODO Replace with dynamic value */ var txtTimeZoneOne: String? = MyApp.getInstance().resources.getString(R.string.msg_operasi_pada_bs) , /** * TODO Replace with dynamic value */ var txtPenambahanNode: String? = MyApp.getInstance().resources.getString(R.string.lbl_penambahan_node) , /** * TODO Replace with dynamic value */ var txtDescriptionTwo: String? = MyApp.getInstance().resources.getString(R.string.msg_pada_saat_menam) , /** * TODO Replace with dynamic value */ var txtPencarianNode: String? = MyApp.getInstance().resources.getString(R.string.lbl_pencarian_node) , /** * TODO Replace with dynamic value */ var txtPencariandilak: String? = MyApp.getInstance().resources.getString(R.string.msg_pencarian_dilak) , /** * TODO Replace with dynamic value */ var txtDescriptionThree: String? = MyApp.getInstance().resources.getString(R.string.msg_jika_nilai_yang) , /** * TODO Replace with dynamic value */ var txtPenghapusanNod: String? = MyApp.getInstance().resources.getString(R.string.msg_penghapusan_nod2) , /** * TODO Replace with dynamic value */ var txtAdatigaskenar: String? = MyApp.getInstance().resources.getString(R.string.msg_ada_tiga_skenar) , /** * TODO Replace with dynamic value */ var txtDescriptionFour: String? = MyApp.getInstance().resources.getString(R.string.msg_node_tersebut_a) , /** * TODO Replace with dynamic value */ var txtNodememilikid: String? = MyApp.getInstance().resources.getString(R.string.msg_node_memiliki_d) , /** * TODO Replace with dynamic value */ var txtTimeZoneTwo: String? = MyApp.getInstance().resources.getString(R.string.lbl_keuntungan_bst) , /** * TODO Replace with dynamic value */ var txtDescriptionFive: String? = MyApp.getInstance().resources.getString(R.string.msg_pencarian_cepat) , /** * TODO Replace with dynamic value */ var txtTimeZoneThree: String? = MyApp.getInstance().resources.getString(R.string.msg_pengurutan_otom) , /** * TODO Replace with dynamic value */ var txtDescriptionSix: String? = MyApp.getInstance().resources.getString(R.string.msg_penghapusan_dan) )
0
Kotlin
0
0
1ee73edb464af83e8c45e7eb41071090847dbf2c
3,618
StrukLearn
MIT License
datareceiver/src/main/java/com/ceosilvajr/datareceiver/MainActivity.kt
ceosilvajr
180,713,934
false
null
package com.ceosilvajr.datareceiver import android.content.Intent import android.os.Bundle import androidx.appcompat.app.AppCompatActivity import com.google.gson.Gson import kotlinx.android.synthetic.main.activity_main.* import kotlinx.android.synthetic.main.content_main.* import java.util.* /** * @author <EMAIL> */ class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) setSupportActionBar(toolbar) handleIntentDataFromSender() } private fun handleIntentDataFromSender() { if (intent?.action == Intent.ACTION_SEND) { val bundle = intent.extras bundle?.let { val type = it.getString("type") ?: "Not found" val data = it.getSerializable("data") as HashMap<*, *> val model = Gson().fromJson(it.getString("order"), OrderModel::class.java) val builder = StringBuilder(type) builder.append(data.entries) tv_data.text = model.toString().plus(builder.toString()) } } } }
0
Kotlin
0
0
9c7c200c932123882bb92e995b7d51ad76ed7eb2
1,183
android-sharing-poc
Apache License 2.0
src/integrationTest/kotlin/com/sourcegraph/cody/AllSuites.kt
sourcegraph
702,947,607
false
{"Kotlin": 690009, "Java": 152855, "TypeScript": 5588, "Shell": 4631, "Nix": 1122, "JavaScript": 436, "HTML": 294}
package com.sourcegraph.cody import com.sourcegraph.cody.edit.DocumentCodeTest import com.sourcegraph.cody.util.RepeatableSuite import org.junit.runner.RunWith import org.junit.runners.Suite @RunWith(RepeatableSuite::class) @Suite.SuiteClasses(DocumentCodeTest::class) class AllSuites
358
Kotlin
22
67
437e3e2e53ae85edb7e445b2a0d412fbb7a54db0
287
jetbrains
Apache License 2.0
apps/parent/src/androidTest/java/com/instructure/parentapp/ui/interaction/ManageStudentsInteractionTest.kt
instructure
179,290,947
false
{"Kotlin": 15510416, "Dart": 4448893, "HTML": 185120, "Ruby": 35686, "Java": 24752, "Shell": 19157, "Groovy": 11717, "JavaScript": 9505, "Objective-C": 7431, "Python": 2438, "CSS": 1356, "Swift": 807, "Dockerfile": 112}
/* * Copyright (C) 2024 - present Instructure, Inc. * * 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.instructure.parentapp.ui.interaction import androidx.compose.ui.platform.ComposeView import androidx.test.espresso.matcher.ViewMatchers import com.google.android.apps.common.testing.accessibility.framework.AccessibilityCheckResultUtils import com.google.android.apps.common.testing.accessibility.framework.checks.SpeakableTextPresentCheck import com.instructure.canvas.espresso.mockCanvas.MockCanvas import com.instructure.canvas.espresso.mockCanvas.init import com.instructure.parentapp.ui.pages.ManageStudentsPage import com.instructure.parentapp.utils.ParentComposeTest import com.instructure.parentapp.utils.tokenLogin import dagger.hilt.android.testing.HiltAndroidTest import org.hamcrest.Matchers import org.junit.Test @HiltAndroidTest class ManageStudentsInteractionTest : ParentComposeTest() { private val manageStudentsPage = ManageStudentsPage(composeTestRule) @Test fun testStudentsDisplayed() { val data = initData() goToManageStudents(data) composeTestRule.waitForIdle() data.students.forEach { manageStudentsPage.assertStudentItemDisplayed(it) } } @Test fun testStudentTapped() { val data = initData() goToManageStudents(data) composeTestRule.waitForIdle() manageStudentsPage.tapStudent(data.students.first().shortName!!) // TODO Assert alert settings when implemented } @Test fun testColorPickerDialog() { val data = initData() goToManageStudents(data) composeTestRule.waitForIdle() manageStudentsPage.tapStudentColor(data.students.first().shortName!!) manageStudentsPage.assertColorPickerDialogDisplayed() } private fun initData(): MockCanvas { return MockCanvas.init( parentCount = 1, studentCount = 3, courseCount = 1 ) } private fun goToManageStudents(data: MockCanvas) { val parent = data.parents.first() val token = data.tokenFor(parent)!! tokenLogin(data.domain, token, parent) dashboardPage.openNavigationDrawer() dashboardPage.tapManageStudents() } override fun enableAndConfigureAccessibilityChecks() { extraAccessibilitySupressions = Matchers.allOf( AccessibilityCheckResultUtils.matchesCheck( SpeakableTextPresentCheck::class.java ), AccessibilityCheckResultUtils.matchesViews( ViewMatchers.withParent( ViewMatchers.withClassName( Matchers.equalTo(ComposeView::class.java.name) ) ) ) ) super.enableAndConfigureAccessibilityChecks() } }
2
Kotlin
99
125
3d219a59dd0cec1a9ab88d4fc26994eaa5e10259
3,414
canvas-android
Apache License 2.0
psiminer-core/src/main/kotlin/labelextractor/MethodCommentLabelExtractor.kt
JetBrains-Research
248,702,388
false
null
package labelextractor import com.intellij.psi.PsiElement import psi.language.LanguageHandler class MethodCommentLabelExtractor(private val onlyDoc: Boolean = true) : LabelExtractor() { override val granularityLevel = GranularityLevel.Method override fun handleTree(root: PsiElement, languageHandler: LanguageHandler): Label? { val docCommentString = languageHandler.methodProvider.getDocCommentString(root) val extendedLabel = if (onlyDoc) { docCommentString } else { mutableListOf( docCommentString, languageHandler.methodProvider.getNonDocCommentsString(root) ).joinToString { "|" } } return if (extendedLabel.isEmpty()) { null } else { StringLabel(extendedLabel) } } }
13
Kotlin
11
52
6b647ea5aaa41bbad01806c12cfb0c5a700c7073
837
psiminer
Apache License 2.0
src/main/kotlin/org/meatball/flags/core/service/FlagService.kt
mainmeatball
782,892,110
false
{"Kotlin": 17471}
package org.meatball.flags.core.service import org.meatball.flags.core.config.FlagName import org.meatball.flags.core.config.getCountryRegions import org.meatball.flags.core.config.getFlagL10n import org.meatball.flags.core.dao.FlagDao import org.meatball.flags.core.entity.Flag import org.meatball.flags.core.enums.Region import org.meatball.flags.crm.user.service.getUserRegion class FlagService { private val flagDao = FlagDao() private val flagL10n = getFlagL10n() private val regions = getCountryRegions() private val europe = regions.getValue("Europe").map { it.key } private val asia = regions.getValue("Asia").map { it.key } private val oceania = regions.getValue("Oceania").map { it.key } private val asiaAndOceania = asia + oceania private val africa = regions.getValue("Africa").map { it.key } private val america = regions.getValue("Americas").map { it.key } private val world = europe + asiaAndOceania + africa + america + "AQ" private val regionMap: Map<Region, Collection<String>> = mapOf( Region.WORLD to world, Region.EUROPE to europe, Region.ASIA to asia, Region.OCEANIA to oceania, Region.ASIA_AND_OCEANIA to asiaAndOceania, Region.AFRICA to africa, Region.AMERICA to america ) private val userStateMap = hashMapOf<String, UserState>() fun getNextFlag(userId: String): Flag { val nextCountryAlpha2 = getNextCountryAlpha2(userId) val flagFile = flagDao.getByAlpha2(nextCountryAlpha2) val flagCountryName = flagL10n.getValue(nextCountryAlpha2) return Flag(constructFlagNameAnswer(flagCountryName), flagFile) } private fun constructFlagNameAnswer(flagName: FlagName): String { return "${flagName.ru.escape()} \\(${flagName.en.escape()}\\)" } private fun String.escape(): String { return replace(REGEX_MARKDOWN_V2_ESCAPE, "\\\\$1") } private fun getNextCountryAlpha2(userId: String): String { var userState = userStateMap[userId] ?: defaultUserState() val userRegionConfig = getUserRegion(userId) if (userRegionConfig !== userState.region || !userState.iterator.hasNext()) { userState = reshuffleUserCollection(userId, userRegionConfig) } return userState.iterator.next() } private fun reshuffleUserCollection(userId: String, region: Region): UserState { val userState = UserState( iterator = regionMap.getValue(region).shuffled().iterator(), region = region ) userStateMap[userId] = userState return userState } private fun defaultUserState() = UserState( iterator = world.shuffled().listIterator(), region = Region.WORLD ) private data class UserState( val iterator: Iterator<String>, val region: Region ) private companion object { private val REGEX_MARKDOWN_V2_ESCAPE = Regex("([|{\\[\\]_~}+)(#>!=\\-.])") } }
0
Kotlin
0
0
de0337d14d3a47a108376449b98c5c5a64580a78
3,007
learn-flags-bot
MIT License
app/src/main/java/com/hfut/schedule/ui/Activity/success/cube/Settings/Update/getUpdate.kt
Chiu-xaH
705,508,343
false
{"Kotlin": 1386786, "HTML": 77257, "Java": 686}
package com.hfut.schedule.ui.Activity.success.cube.Settings.Update import com.hfut.schedule.logic.datamodel.Update import com.hfut.schedule.logic.utils.SharePrefs.prefs import org.jsoup.Jsoup fun getUpdates() : Update { return try { val html = prefs.getString("versions","") val doc = Jsoup.parse(html) val pElement = doc.select("div.markdown-body > p").first() // 提取版本号 val version = doc.title().substringAfter(" ").substringBefore(" ·") // 提取后面的内容 val content = doc.select("textarea.content").text() //println("内容: $content") Update(version ?: "正在获取", content ?: "正在获取") } catch (e : Exception) { Update("正在获取","正在获取") } }
0
Kotlin
1
3
aead3d3e437531c52a0ba99d71fae27d4ea0fe4f
720
HFUT-Schedule
Apache License 2.0
src/main/kotlin/configure/Config.kt
tmdgusya
516,387,344
false
null
package configure import executors.ProcessorExecutor import operators.Processor import repository.Reader import writer.Writer abstract class Config<T, O>( private val reader: Reader<T>, private val writer: Writer, private val processorExecutor: ProcessorExecutor<T, O> ) { /** * Add Writer in Configuration Class */ abstract fun writer(writer: Writer) /** * Add Reader in Configuration Class */ abstract fun reader(reader: Reader<T>) /** * Add ProcessorExecutor in Configuration Class */ abstract fun processorExecutor(processorExecutor: ProcessorExecutor<T, O>) /** * Add Processor in Configuration Class */ abstract fun addProcessor(processor: Processor<T, O>) /** * Add Processors in Configuration Class */ abstract fun addProcessors(processors: List<Processor<T, O>>) }
0
Kotlin
0
0
51ea39eb61872206efd2e4cd173bc4efac05317a
887
kcsv
MIT License
src/main/kotlin/com/canevi/stock/manage/config/CouchbaseConfiguration.kt
YahyaBekirCanevi
866,657,377
false
{"Kotlin": 32346, "Dockerfile": 112}
package com.canevi.stock.manage.config import com.couchbase.client.core.error.BucketNotFoundException import com.couchbase.client.core.error.UnambiguousTimeoutException import com.couchbase.client.java.Bucket import com.couchbase.client.java.Cluster import com.couchbase.client.java.ClusterOptions import com.couchbase.client.java.env.ClusterEnvironment import org.slf4j.LoggerFactory import org.springframework.beans.factory.annotation.Value import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration import org.springframework.data.couchbase.config.AbstractCouchbaseConfiguration import org.springframework.data.couchbase.repository.config.EnableCouchbaseRepositories import java.time.Duration @Configuration(proxyBeanMethods = true) @EnableCouchbaseRepositories class CouchbaseConfiguration( @Value("\${db.host}") val host: String, @Value("\${db.user}") val user: String, @Value("\${db.pass}") val pass: String, @Value("\${db.nameOfBucket}") val nameOfBucket: String ) : AbstractCouchbaseConfiguration() { private val log = LoggerFactory.getLogger(this.javaClass) override fun getConnectionString(): String { return host } override fun getUserName(): String { return user } override fun getPassword(): String { return pass } override fun getBucketName(): String { return nameOfBucket } @Bean(destroyMethod = "disconnect") override fun couchbaseCluster(couchbaseClusterEnvironment: ClusterEnvironment?): Cluster { try { log.debug("Connecting to Couchbase cluster at $connectionString") val cluster = Cluster.connect(connectionString, ClusterOptions.clusterOptions(userName, password)) /* * ClusterOptions.clusterOptions( userName, password ).environment { env: ClusterEnvironment.Builder -> env.applyProfile( "wan-development" ) } * */ cluster.waitUntilReady(Duration.ofSeconds(15)) return cluster } catch (e: UnambiguousTimeoutException) { log.error("Connection to Couchbase cluster at $host timed out"); throw e; } catch (e: Exception) { log.error(e.javaClass.getName()); log.error("Could not connect to Couchbase cluster at $host"); throw e; } } @Bean fun getCouchbaseBucket(cluster: Cluster): Bucket? { try { if (!cluster.buckets().allBuckets.containsKey(bucketName)) { throw BucketNotFoundException("Bucket $bucketName does not exist") } val bucket = cluster.bucket(bucketName) bucket.waitUntilReady(Duration.ofSeconds(15)) return bucket } catch (e: UnambiguousTimeoutException) { log.error("Connection to bucket $bucketName timed out") throw e } catch (e: BucketNotFoundException) { log.error("Bucket $bucketName does not exist") throw e } catch (e: java.lang.Exception) { log.error(e.javaClass.name) log.error("Could not connect to bucket $bucketName") throw e } } }
0
Kotlin
0
1
af20faf1c9ef6c4d905351f2afd0f0b966d76a30
3,313
stock.manage
Apache License 2.0
kradle-plugin/src/main/kotlin/net/bnb1/kradle/config/dsl/jvm/DockerDsl.kt
mrkuz
400,078,467
false
{"Kotlin": 420504, "Java": 15648, "Smarty": 1822, "Shell": 695}
package net.bnb1.kradle.config.dsl.jvm import net.bnb1.kradle.Catalog import net.bnb1.kradle.blueprints.jvm.JibProperties import net.bnb1.kradle.dsl.Flag import net.bnb1.kradle.dsl.Optional import net.bnb1.kradle.dsl.Value import net.bnb1.kradle.dsl.ValueSet class DockerDsl(properties: JibProperties) { val baseImage = Value(properties.baseImage) { properties.baseImage = it } val imageName = Optional<String>(null) { properties.imageName = it } val allowInsecureRegistries = Flag { properties.allowInsecureRegistries = it } val ports = ValueSet(properties.ports) val withJvmKill = Optional(Catalog.Versions.jvmKill) { properties.withJvmKill = it } val withStartupScript = Flag { properties.withStartupScript = it } val withAppSh = withStartupScript val startupScript = withStartupScript val jvmOptions = Optional<String>(null) { properties.jvmOptions = it } val jvmOpts = jvmOptions val javaOpts = jvmOptions val arguments = Optional<String>(null) { properties.arguments = it } }
1
Kotlin
2
81
bb9969dd3d496119e2b0f47df453373d8b452d35
1,036
kradle
MIT License
dominion-app/src/commonMain/kotlin/io/ashdavies/dominion/card/CardScreen.kt
ashdavies
36,688,248
false
null
package io.ashdavies.dominion.card import androidx.compose.foundation.Image import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.ArrowBack import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.IconButton import androidx.compose.material3.Scaffold import androidx.compose.material3.SmallTopAppBar import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.vector.rememberVectorPainter import io.ashdavies.dominion.DominionCard import io.ashdavies.dominion.DominionRoot import io.ashdavies.playground.RemoteImage @Composable @OptIn(ExperimentalMaterial3Api::class) internal fun CardScreen(child: DominionRoot.Child.Card) { Scaffold(topBar = { CardTopBar(child.card) { child.navigateToKingdom(child.card.expansion) } }) { contentPadding -> CardScreen(child.card, Modifier.padding(contentPadding)) } } @Composable private fun CardTopBar(card: DominionCard, modifier: Modifier = Modifier, onBack: () -> Unit = { }) { SmallTopAppBar( title = { Text(card.name) }, modifier = modifier, navigationIcon = { BackIconButton(onBack) }, ) } @Composable private fun BackIconButton(onClick: () -> Unit) { IconButton(onClick = onClick) { Image( painter = rememberVectorPainter(Icons.Filled.ArrowBack), contentDescription = null, ) } } @Composable private fun CardScreen(card: DominionCard, modifier: Modifier = Modifier) { if (card.image == null) { Text( modifier = modifier.fillMaxSize(), text = card.name, ) } else { RemoteImage( modifier = modifier.fillMaxSize(), urlString = card.image ) } }
7
Kotlin
33
110
4a7106fd847db2d3fec8962ea1c038695ddc3b1f
1,948
playground.ashdavies.dev
Apache License 2.0
ListGridAnime/app/src/main/java/com/nursyah/composeunit3/ListActivity.kt
nursyah21
560,744,240
false
null
package com.nursyah.composeunit3 import android.os.Bundle import androidx.activity.ComponentActivity import androidx.activity.compose.setContent import androidx.compose.foundation.Image import androidx.compose.foundation.layout.* import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items import androidx.compose.material3.* import androidx.compose.runtime.* import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import com.nursyah.composeunit3.data.DataSource import com.nursyah.composeunit3.model.Anime import com.nursyah.composeunit3.ui.theme.ComposeUnit3Theme import com.nursyah.composeunit3.ui.theme.Pink80 class ListActivity : ComponentActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContent { ComposeUnit3Theme { Surface( modifier = Modifier.fillMaxSize(), color = Color.White, ) { AnimeListApp( animeList = DataSource().loadAllAnime() ) } } } } } @Composable fun AnimeListApp( animeList: List<Anime>, ) { LazyColumn( verticalArrangement = Arrangement.spacedBy(4.dp) ){ items(animeList){ AnimeCard( anime = it ) } } } @Suppress("OPT_IN_IS_NOT_ENABLED") @OptIn(ExperimentalMaterial3Api::class) @Composable private fun AnimeCard( anime: Anime, ){ var resize by remember { mutableStateOf(false) } var modifierDefault = Modifier .fillMaxWidth() .height(200.dp) if (resize) modifierDefault = Modifier .fillMaxWidth() Card( onClick = { resize = !resize }, modifier = Modifier .fillMaxWidth() .padding(4.dp), colors = CardDefaults.cardColors( containerColor = Pink80 ), elevation = CardDefaults.cardElevation(4.dp) ) { Image( modifier = modifierDefault, painter = painterResource(id = anime.imageResourceId), contentDescription = null, contentScale = ContentScale.FillWidth ) Text( text = stringResource(id = anime.titleResourceId), color = Color.White, style = MaterialTheme.typography.bodyLarge, modifier = Modifier.padding(horizontal = 4.dp) ) Text( text = stringResource(id = anime.linkResourceId), color = Color.White, style = MaterialTheme.typography.bodyMedium, modifier = Modifier.padding(horizontal = 4.dp) ) } } @Preview(showBackground = true) @Composable fun ListActivityPreview() { ComposeUnit3Theme { AnimeListApp(animeList = DataSource().loadAllAnime()) } }
0
Kotlin
0
0
0b9ca43da6868e208db5ffc19dce3fe933f8cd3a
2,847
jetpack_compose_sample_application
MIT License
kotlin/src/com/daily/algothrim/leetcode/top150/HIndex.kt
idisfkj
291,855,545
false
{"Kotlin": 552877, "Java": 40553}
package com.daily.algothrim.leetcode.top150 /** * 274. H 指数 */ /* 给你一个整数数组 citations ,其中 citations[i] 表示研究者的第 i 篇论文被引用的次数。计算并返回该研究者的 h 指数。 根据维基百科上 h 指数的定义:h 代表“高引用次数” ,一名科研人员的 h 指数 是指他(她)至少发表了 h 篇论文,并且 至少 有 h 篇论文被引用次数大于等于 h 。如果 h 有多种可能的值,h 指数 是其中最大的那个。 示例 1: 输入:citations = [3,0,6,1,5] 输出:3 解释:给定数组表示研究者总共有 5 篇论文,每篇论文相应的被引用了 3, 0, 6, 1, 5 次。 由于研究者有 3 篇论文每篇 至少 被引用了 3 次,其余两篇论文每篇被引用 不多于 3 次,所以她的 h 指数是 3。 示例 2: 输入:citations = [1,3,1] 输出:1 提示: n == citations.length 1 <= n <= 5000 0 <= citations[i] <= 1000 */ class HIndex { companion object { @JvmStatic fun main(args: Array<String>) { println(HIndex().hIndex(intArrayOf(3, 0, 6, 1, 5))) println(HIndex().hIndex(intArrayOf(1, 3, 1))) } } // citations = [3,0,6,1,5] fun hIndex(citations: IntArray): Int { citations.sort() var i = citations.size - 1 var h = 0 while (i >= 0 && citations[i] > h) { h++ i-- } return h } }
0
Kotlin
16
93
0de4209a2374ccdd619d62a64f715ce1065eb5f4
1,025
daily_algorithm
Apache License 2.0
Android/app/src/main/java/moe/tlaster/weipo/fragment/user/WeiboTabFragment.kt
Tlaster
188,583,226
false
null
package moe.tlaster.weipo.fragment.user import android.os.Bundle import android.view.View import androidx.fragment.app.viewModels import androidx.recyclerview.widget.StaggeredGridLayoutManager import kotlinx.android.synthetic.main.layout_list.* import moe.tlaster.weipo.R import moe.tlaster.weipo.common.AutoStaggeredGridLayoutManager import moe.tlaster.weipo.common.adapter.IncrementalLoadingAdapter import moe.tlaster.weipo.common.adapter.ItemSelector import moe.tlaster.weipo.common.extensions.bindLoadingCollection import moe.tlaster.weipo.common.extensions.factory import moe.tlaster.weipo.common.statusWidth import moe.tlaster.weipo.controls.StatusView import moe.tlaster.weipo.viewmodel.user.WeiboListViewModel class WeiboTabFragment : UserTabFragment() { override val contentLayoutId: Int get() = R.layout.layout_list private val viewModel by viewModels<WeiboListViewModel> { factory { WeiboListViewModel(userId, containerId) } } val adapter by lazy { IncrementalLoadingAdapter<Any>(ItemSelector(R.layout.item_status)).apply { items = viewModel.source setView<StatusView>(R.id.item_status) { view, item, _, _ -> view.data = item } } } override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) recycler_view.layoutManager = AutoStaggeredGridLayoutManager(statusWidth, StaggeredGridLayoutManager.VERTICAL) recycler_view.adapter = adapter refresh_layout.bindLoadingCollection(viewModel.source) } }
95
null
6
30
7c237cc8dd58df2293a101d69128922a2b1157ce
1,629
WeiPo
MIT License
spane-opprydding/src/main/kotlin/no/nav/helse/opprydding/SlettPersonDao.kt
navikt
511,818,071
false
{"Kotlin": 110098, "TypeScript": 36044, "CSS": 2329, "JavaScript": 537, "HTML": 358, "Dockerfile": 181}
package no.nav.helse.opprydding import javax.sql.DataSource import kotliquery.TransactionalSession import kotliquery.queryOf import kotliquery.sessionOf internal class SlettPersonDao(private val dataSource: DataSource) { internal fun slett(fødselsnummer: String) { sessionOf(dataSource).use { session -> session.transaction { it.slettPerson(fødselsnummer) } } } private fun TransactionalSession.slettPerson(fødselsnummer: String) { val query = "DELETE FROM person WHERE fnr = ?" run(queryOf(query, fødselsnummer).asExecute) } }
3
Kotlin
1
0
10422c95b4757cffec2748cce4dcc70d1d9b183b
620
helse-spane
MIT License
componentk/src/main/java/com/mozhimen/componentk/netk/file/download/DownloaderManager.kt
mozhimen
353,952,154
false
{"Kotlin": 2269633, "Java": 246468, "AIDL": 1012}
package com.mozhimen.netk.file.download import com.mozhimen.netk.file.download.bases.BaseDownloader import java.util.concurrent.ConcurrentHashMap internal object DownloaderManager { private val _downloadingMap = ConcurrentHashMap<DownloadRequest, BaseDownloader>() fun addIfAbsent(downloader: BaseDownloader) { _downloadingMap[downloader.request] = downloader } fun remove(vararg requests: DownloadRequest) { for (request in requests) _downloadingMap.remove(request) } fun runningCount() = _downloadingMap.size fun isRunning(request: DownloadRequest) = _downloadingMap.containsKey(request) fun getDownloader(request: DownloadRequest): BaseDownloader? = _downloadingMap[request] }
0
Kotlin
6
115
b8fe0041299e5e13c0479fdd92c97614676a6fe6
735
SwiftKit
Apache License 2.0
plugin/signing/src/test/kotlin/net/twisterrob/gradle/android/AndroidSigningPluginIntgTest.kt
TWiStErRob
116,494,236
false
null
package net.twisterrob.gradle.android import net.twisterrob.gradle.common.AGPVersions import net.twisterrob.gradle.test.GradleRunnerRule import net.twisterrob.gradle.test.GradleRunnerRuleExtension import net.twisterrob.gradle.test.assertHasOutputLine import net.twisterrob.gradle.test.assertSuccess import net.twisterrob.gradle.test.root import net.twisterrob.test.process.runCommand import org.hamcrest.MatcherAssert.assertThat import org.hamcrest.Matchers.allOf import org.hamcrest.Matchers.containsString import org.hamcrest.Matchers.emptyString import org.intellij.lang.annotations.Language import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith import org.junit.jupiter.api.io.TempDir import java.io.File /** * @see AndroidSigningPlugin */ @ExtendWith(GradleRunnerRuleExtension::class) class AndroidSigningPluginIntgTest : BaseAndroidIntgTest() { override lateinit var gradle: GradleRunnerRule @Test fun `logs error when keystore not valid (release)`() { @Language("properties") val props = """ # suppress inspection "UnusedProperty" RELEASE_STORE_FILE=non-existent.file """.trimIndent() gradle.root.resolve("gradle.properties").appendText(props) @Language("gradle") val script = """ apply plugin: 'net.twisterrob.android-app' """.trimIndent() val result = gradle.run(script, "assembleRelease").build() result.assertSuccess(":assembleRelease") result.assertHasOutputLine("""Keystore file \(from RELEASE_STORE_FILE\) '.*non-existent.file.*' is not valid\.""".toRegex()) verifyWithJarSigner(gradle.root.apk("release").absolutePath).also { assertThat(it, containsString("jar is unsigned.")) } } @Test fun `applies signing config from properties (release)`(@TempDir temp: File) { val generationParams = mapOf( "-alias" to "gradle.plugin.test", "-keyalg" to "RSA", "-keystore" to "gradle.plugin.test.jks", "-storetype" to "JKS", "-dname" to "CN=JUnit Test, O=net.twisterrob, L=Gradle", "-storepass" to "<PASSWORD>", "-keypass" to "<PASSWORD>" ) listOf( resolveFromJDK("keytool").absolutePath, "-genkey", *generationParams.flatMap { it.toPair().toList() }.toTypedArray() ).runCommand(temp).also { assertThat(it, emptyString()) } @Language("properties") val props = """ # suppress inspection "UnusedProperty" for whole file RELEASE_STORE_FILE=${temp.resolve(generationParams["-keystore"]!!).absolutePath.replace("\\", "\\\\")} RELEASE_STORE_PASSWORD=${generationParams["-storepass"]} RELEASE_KEY_ALIAS=${generationParams["-alias"]} RELEASE_KEY_PASSWORD=${generationParams["-keypass"]} """.trimIndent() gradle.root.resolve("gradle.properties").appendText(props) @Language("gradle") val script = """ apply plugin: 'net.twisterrob.android-app' """.trimIndent() val result = gradle.run(script, "assembleRelease").build() result.assertSuccess(":assembleRelease") verifyWithApkSigner(gradle.root.apk("release").absolutePath).also { if (AGPVersions.UNDER_TEST >= AGPVersions.v42x) { // REPORT this should be empty, AGP 4.2.0 introduced this file. assertEquals( "WARNING: " + "META-INF/com/android/build/gradle/app-metadata.properties not protected by signature." + " " + "Unauthorized modifications to this JAR entry will not be detected." + " " + "Delete or move the entry outside of META-INF/." + System.lineSeparator(), it ) } else { assertThat(it, emptyString()) } } verifyWithJarSigner(gradle.root.apk("release").absolutePath).also { assertThat(it, allOf(containsString("jar verified."), containsString(generationParams["-dname"]))) } } private fun verifyWithApkSigner(apk: String): String = listOf( // apksigner.bat doesn't work with Java 11, even though everything is set up correctly: // it says "No suitable Java found.", "you can define the JAVA_HOME environment variable" // so as an alternative launch the jar file directly resolveFromJDK("java").absolutePath, "-jar", resolveFromAndroidSDK("apksigner").parentFile.resolve("lib/apksigner.jar").absolutePath, "verify", apk ).runCommand() private fun verifyWithJarSigner(apk: String): String = listOf( resolveFromJDK("jarsigner").absolutePath, "-verify", "-verbose", apk ).runCommand() }
37
Kotlin
1
7
b207c0bce0c0f7f3405fb54d10071547f60a0eb4
4,392
net.twisterrob.gradle
MIT License
bukkit/rpk-economy-bukkit/src/main/kotlin/com/rpkit/economy/bukkit/database/table/RPKWalletTable.kt
blimyj
363,192,865
true
{"Kotlin": 2999538}
/* * Copyright 2021 <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.rpkit.economy.bukkit.database.table import com.rpkit.characters.bukkit.character.RPKCharacter import com.rpkit.characters.bukkit.character.RPKCharacterId import com.rpkit.characters.bukkit.character.RPKCharacterService import com.rpkit.core.database.Database import com.rpkit.core.database.Table import com.rpkit.core.service.Services import com.rpkit.economy.bukkit.RPKEconomyBukkit import com.rpkit.economy.bukkit.currency.RPKCurrency import com.rpkit.economy.bukkit.database.create import com.rpkit.economy.bukkit.database.jooq.Tables.RPKIT_WALLET import com.rpkit.economy.bukkit.wallet.RPKWallet /** * Represents the wallet table. */ class RPKWalletTable( private val database: Database, plugin: RPKEconomyBukkit ) : Table { private data class CharacterCurrencyCacheKey( val characterId: Int, val currencyName: String ) private val cache = if (plugin.config.getBoolean("caching.rpkit_wallet.character_id.enabled")) { database.cacheManager.createCache( "rpk-economy-bukkit.rpkit_wallet.character_id", CharacterCurrencyCacheKey::class.java, RPKWallet::class.java, plugin.config.getLong("caching.rpkit_wallet.character_id.size") ) } else { null } fun insert(entity: RPKWallet) { val characterId = entity.character.id ?: return val currencyName = entity.currency.name database.create .insertInto( RPKIT_WALLET, RPKIT_WALLET.CHARACTER_ID, RPKIT_WALLET.CURRENCY_NAME, RPKIT_WALLET.BALANCE ) .values( characterId.value, currencyName.value, entity.balance ) .execute() cache?.set(CharacterCurrencyCacheKey(characterId.value, currencyName.value), entity) } fun update(entity: RPKWallet) { val characterId = entity.character.id ?: return val currencyName = entity.currency.name database.create .update(RPKIT_WALLET) .set(RPKIT_WALLET.BALANCE, entity.balance) .where(RPKIT_WALLET.CHARACTER_ID.eq(characterId.value)) .and(RPKIT_WALLET.CURRENCY_NAME.eq(currencyName.value)) .execute() cache?.set(CharacterCurrencyCacheKey(characterId.value, currencyName.value), entity) } fun get(character: RPKCharacter, currency: RPKCurrency): RPKWallet? { val characterId = character.id ?: return null val currencyName = currency.name val cacheKey = CharacterCurrencyCacheKey(characterId.value, currencyName.value) if (cache?.containsKey(cacheKey) == true) { return cache[cacheKey] } val result = database.create .select(RPKIT_WALLET.BALANCE) .from(RPKIT_WALLET) .where(RPKIT_WALLET.CHARACTER_ID.eq(characterId.value)) .and(RPKIT_WALLET.CURRENCY_NAME.eq(currencyName.value)) .fetchOne() ?: return null val wallet = RPKWallet( character, currency, result[RPKIT_WALLET.BALANCE] ) cache?.set(cacheKey, wallet) return wallet } fun getTop(amount: Int = 5, currency: RPKCurrency): List<RPKWallet> { val currencyName = currency.name val results = database.create .select( RPKIT_WALLET.CHARACTER_ID, RPKIT_WALLET.BALANCE ) .from(RPKIT_WALLET) .where(RPKIT_WALLET.CURRENCY_NAME.eq(currencyName.value)) .orderBy(RPKIT_WALLET.BALANCE.desc()) .limit(amount) .fetch() val characterService = Services[RPKCharacterService::class.java] ?: return emptyList() return results .mapNotNull { result -> val characterId = result[RPKIT_WALLET.CHARACTER_ID] val character = characterService.getCharacter(RPKCharacterId(characterId)) ?: return@mapNotNull null val wallet = RPKWallet( character, currency, result[RPKIT_WALLET.BALANCE] ) cache?.set(CharacterCurrencyCacheKey(characterId, currencyName.value), wallet) return@mapNotNull wallet } } fun delete(entity: RPKWallet) { val characterId = entity.character.id ?: return val currencyName = entity.currency.name database.create .deleteFrom(RPKIT_WALLET) .where(RPKIT_WALLET.CHARACTER_ID.eq(characterId.value)) .and(RPKIT_WALLET.CURRENCY_NAME.eq(currencyName.value)) .execute() cache?.remove(CharacterCurrencyCacheKey(characterId.value, currencyName.value)) } }
0
null
0
0
b6f6e90fe466309a97f5620f4c5508df3131154d
5,663
RPKit
Apache License 2.0
app/src/main/java/com/apollo/timeflow/TimeAPP.kt
DIPENG-XU
773,446,749
false
{"Kotlin": 94637}
package com.apollo.timeflow import android.app.Application import dagger.hilt.android.HiltAndroidApp @HiltAndroidApp class TimeAPP : Application()
0
Kotlin
1
0
fd2231ae2e1bca8f4ecac79c13af429ff32a4990
148
TimeFlow-By-Compose
MIT License
src/main/kotlin/com/intershop/gradle/component/installation/extension/InstallationExtension.kt
IntershopCommunicationsAG
127,111,194
false
null
/* * Copyright 2018 Intershop Communications AG. * * 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.intershop.gradle.component.installation.extension import com.intershop.gradle.component.installation.filter.FilterContainer import com.intershop.gradle.component.installation.utils.getValue import com.intershop.gradle.component.installation.utils.setValue import org.gradle.api.Action import org.gradle.api.GradleException import org.gradle.api.InvalidUserDataException import org.gradle.api.Project import org.gradle.api.file.Directory import org.gradle.api.internal.project.ProjectInternal import org.gradle.api.provider.Provider import org.gradle.internal.reflect.Instantiator import org.gradle.internal.service.ServiceRegistry import java.io.File import javax.inject.Inject /** * The main extension of this plugin. * * It provides all information for the installation process * with all components and directories. * * @property project instance of the current project. * * @constructor initialize the extension for the current project. */ open class InstallationExtension @Inject constructor(val project: Project) { companion object { /** * The name of the installation extension. */ const val INSTALLATION_EXTENSION_NAME = "installation" } private val installDirProperty = project.layout.directoryProperty() private val installConfigContainer = project.objects.newInstance(InstallConfiguration::class.java, project) private val environmentProperty = project.objects.setProperty(String::class.java) private val componentSet: MutableSet<Component> = mutableSetOf() private val services: ServiceRegistry = if(project is ProjectInternal) project.services else throw GradleException("Project ${project.name} is not correct initialized!") private val filtersContainer = FilterContainer(project, services.get(Instantiator::class.java)) /** * Provider for the installation directory property. * * @property installDirProvider provider for the installation directory property. (read only) */ val installDirProvider: Provider<Directory> get() = installDirProperty /** * Installation directory for all components. * This is the root directory for all configured components. * * @property installDir the file object of the installation directory */ var installDir: File get() = installDirProperty.get().asFile set(value) = installDirProperty.set(value) /** * The container for installation configuration. * * @property installConfig the instance of the installation configuration */ val installConfig: InstallConfiguration get() = installConfigContainer /** * Configures the installation configuration container. * * @param action action or closure to configure the configuration container. */ fun installConfig(action: Action<in InstallConfiguration>) { action.execute(installConfigContainer) } /** * Provider for the environment configuration of the installation process. * * @property environmentProvider provider for the environment configuration. (read only) */ val environmentProvider: Provider<Set<String>> get() = environmentProperty /** * Environment configuration of the installation. * This set of strings will be compared with the * configuration of component items. * * @property environment set of strings with the environment configuration */ var environment: Set<String> by environmentProperty /** * Add an environment configuration to the set * of configuration strings. * * @param config environment configuration. */ fun environment(config: String) { environmentProperty.add(config) } /** * Set of components that will be installed in the project. * * @property components */ val components: Set<Component> get() = componentSet /** * Adds a dependency to the list of components. * * @param component a dependency of a component. */ @Throws(GradleException::class) fun add(component: Any): Component { val dependency = project.dependencies.create(component) val componentExt = Component(dependency.group ?: "", dependency.name, dependency.version ?: "", "") with(componentExt) { if (componentSet.any { it.group == group && it.module == module && it.path == path }) { throw InvalidUserDataException("It is not possible to install the same component twice " + "in the same path. Verify the configuration of '${this.dependency}'") } } componentSet.add(componentExt) return componentExt } /** * Adds a dependency to the list of components and * configures the path of the component. * * @param component a dependency of a component. * @param path the install path of the component */ fun add(component: Any, path: String): Component { val dependency = project.dependencies.create(component) val componentExt = Component(dependency.group ?: "", dependency.name, dependency.version ?: "", path) with(componentExt) { if (componentSet.any { it.group == group && it.module == module && it.path == path }) { throw InvalidUserDataException("It is not possible to install the same component twice " + "in the same path. Verify the configuration of '${this.dependency}'") } } componentSet.add(componentExt) return componentExt } /** * Adds a dependency to the list of components. * The component is configured with an action * or closure. * * @param component a dependency of a component. */ fun add(component: Any, action: Action<in Component>): Component { val componentExt = add(component) action.execute(componentExt) return componentExt } /** * Adds a dependency to the list of components and * configures the path of the component. * The component is configured with an action * or closure. * * @param component a dependency of a component. * @param path the install path of the component */ fun add(component: Any, path: String, action: Action<in Component>): Component { val componentExt = add(component, path) action.execute(componentExt) return componentExt } /** * This is the filter configuration container. It contains * all file filter to adapt an installation. * * @property filters the instance of the configuration container. */ val filters: FilterContainer get() = filtersContainer /** * This method configures the filter container. * * @param action this can be an closure or action to configure the container. */ fun filters(action:Action<in FilterContainer>) { action.execute(filtersContainer) } }
0
Kotlin
0
0
9491574357ea3cbbf0ded1b52e7f598e633ce3ca
7,693
component-installation-plugin
Apache License 2.0
project/src/main/kotlin/cga/exercise/game/level/Event.kt
JannikAlx
389,366,062
true
{"Kotlin": 171322, "GLSL": 16707}
package cga.exercise.game.level import chart.difficulty._events class Event ( val beat: Float, val light: Type, val effect: Effect, ){ enum class Type(val _type: Int){ BackLasers(0), RingLights(1), LeftRotatingLasers(2), RightRotationgLasers(3), CenterLights(5), } enum class Effect(val _value: Int){ LightOff(0), LightOnBlue(1), LightFlashBlue(2), LightFadeBlue(3), LightOnRed(5), LightFlashRed(6), LightFadeRed(7), } }
0
Kotlin
0
0
36b6fe8d014673cfab60b54722b150594235b3a1
548
Cayuga
MIT License
app/src/main/java/br/com/helpdev/githubers/data/repository/NetworkServiceStatus.kt
gbzarelli
168,407,845
false
null
package br.com.helpdev.githubers.data.repository /** * Class for network status control */ class NetworkServiceStatus(var status: Int = STATUS_NULL, var exception: Throwable? = null) { companion object { const val STATUS_NULL = 0 const val STATUS_FETCHING = 1 const val STATUS_SUCCESS = 2 const val STATUS_ERROR = 3 } override fun toString(): String { return "NetworkServiceStatus(status=$status, exception=$exception)" } }
0
Kotlin
1
4
b09ebd33fc772d1cd3df5911675a933382a85ba7
484
githubers
Apache License 2.0
v2-model-enumeration/src/commonMain/kotlin/com/bselzer/gw2/v2/model/enumeration/SkillCategory.kt
Woody230
388,820,096
false
{"Kotlin": 750899}
package com.bselzer.gw2.v2.model.enumeration import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @Serializable enum class SkillCategory { @SerialName("Physical") PHYSICAL, @SerialName("Glyph") GLYPH, @SerialName("Signet") SIGNET, @SerialName("Shout") SHOUT, @SerialName("Well") WELL, @SerialName("Consecration") CONSECRATION, @SerialName("Meditation") MEDITATION, @SerialName("SpiritWeapon") SPIRIT_WEAPON, @SerialName("Symbol") SYMBOL, @SerialName("Virtue") VIRTUE, @SerialName("Ward") WARD, @SerialName("Legend") LEGEND, @SerialName("LegendaryAssassin") LEGENDARY_ASSASSIN, @SerialName("LegendaryCentaur") LEGNEDARY_CENTAUR, @SerialName("LegendaryDemon") LEGENDARY_DEMON, @SerialName("LegendaryDragon") LEGENDARY_DRAGON, @SerialName("LegendaryDwarf") LEGENDARY_DWARF, @SerialName("Banner") BANNER, @SerialName("Burst") BURST, @SerialName("PrimalBurst") PRIMAL_BURST, @SerialName("Rage") RAGE, @SerialName("Stance") STANCE, @SerialName("kit") TOOLKIT, @SerialName("Elixir") ELIXIR, @SerialName("Gadget") GADGET, @SerialName("Gyro") GYRO, @SerialName("Turret") TURRET, @SerialName("CelestialAvatar") CELESTIAL_AVATAR, @SerialName("Pet") PET, @SerialName("Spirit") SPIRIT, @SerialName("Survival") SURVIVAL, @SerialName("Deception") DECEPTION, @SerialName("DualWield") DUAL_WIELD, @SerialName("StealthAttack") STEALTH_ATTACK, @SerialName("Trick") TRICK, @SerialName("Venom") VENOM, @SerialName("Arcane") ARCANE, @SerialName("Cantrip") CANTRIP, @SerialName("Conjure") CONJURE, @SerialName("Overload") OVERLOAD, @SerialName("Clone") CLONE, @SerialName("Glamour") GLAMOUR, @SerialName("Manipulation") MANIPULATION, @SerialName("Mantra") MANTRA, @SerialName("Phantasm") PHANTASM, @SerialName("Corruption") CORRUPTION, @SerialName("Mark") MARK, @SerialName("Minion") MINION, @SerialName("Spectral") SPECTRAL, @SerialName("Transform") TRANSFORM, @SerialName("Kit") KIT, @SerialName("Trap") TRAP }
2
Kotlin
0
2
32f1fd4fc4252dbe886b6fc0f4310cf34ac2ef27
2,387
GW2Wrapper
Apache License 2.0
app/src/main/java/com/kuloud/android/location/app/GoogleLocationUpdateFragment.kt
kuloud
645,803,742
false
null
package com.kuloud.android.location.app import android.os.Bundle import android.view.View import com.kuloud.android.location.common.HiveLocation import com.kuloud.android.location.google.GoogleLocationBackend class GoogleLocationUpdateFragment : LocationUpdateFragment() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) HiveLocation.setBackend(requireContext(), GoogleLocationBackend(requireContext())) } override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) binding.topAppBar.title = "谷歌地图" } }
0
Kotlin
0
0
ef14a8e8f8551935837a0e3e7f172319931ee56d
649
HiveLocation
Apache License 2.0
platform/testGuiFramework/src/com/intellij/testGuiFramework/impl/GuiTestCase.kt
noti0na1
82,760,271
true
{"Java": 161636356, "Python": 24171364, "Kotlin": 3195578, "Groovy": 3137053, "HTML": 1841771, "JavaScript": 570364, "CSS": 201445, "C++": 195362, "C": 195249, "Lex": 184313, "XSLT": 113040, "Jupyter Notebook": 93222, "Shell": 64469, "Batchfile": 60476, "NSIS": 49837, "Roff": 35232, "Objective-C": 27941, "TeX": 25473, "AMPL": 20665, "Scala": 11698, "TypeScript": 9469, "Protocol Buffer": 6680, "J": 5050, "Makefile": 2352, "Thrift": 1846, "CoffeeScript": 1759, "CMake": 1675, "C#": 1264, "Ruby": 1217, "Perl": 903, "Smalltalk": 338, "AspectJ": 182, "Visual Basic": 77, "HLSL": 57, "Perl 6": 26, "Erlang": 10}
/* * Copyright 2000-2016 JetBrains s.r.o. * * 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.intellij.testGuiFramework.impl import com.intellij.ide.GeneralSettings import com.intellij.openapi.ui.TextFieldWithBrowseButton import com.intellij.testGuiFramework.cellReader.ExtendedJListCellReader import com.intellij.testGuiFramework.cellReader.SettingsTreeCellReader import com.intellij.testGuiFramework.fixtures.* import com.intellij.testGuiFramework.fixtures.newProjectWizard.NewProjectWizardFixture import com.intellij.testGuiFramework.framework.GuiTestBase import com.intellij.testGuiFramework.framework.GuiTestUtil import com.intellij.testGuiFramework.framework.GuiTestUtil.waitUntilFound import com.intellij.ui.components.labels.LinkLabel import com.intellij.util.net.HttpConfigurable import org.fest.swing.core.ComponentMatcher import org.fest.swing.core.GenericTypeMatcher import org.fest.swing.core.SmartWaitRobot import org.fest.swing.exception.LocationUnavailableException import org.fest.swing.fixture.* import java.awt.Component import java.awt.Container import java.lang.reflect.InvocationTargetException import javax.swing.* import javax.swing.text.JTextComponent /** * @author Sergey Karashevich */ open class GuiTestCase : GuiTestBase() { class GuiSettings internal constructor() { init { GeneralSettings.getInstance().isShowTipsOnStartup = false GuiTestUtil.setUpDefaultProjectCreationLocationPath() val ideSettings = HttpConfigurable.getInstance() ideSettings.USE_HTTP_PROXY = false ideSettings.PROXY_HOST = "" ideSettings.PROXY_PORT = 80 } companion object { private val lock = Any() private var SETTINGS: GuiSettings? = null fun setUp(): GuiSettings { synchronized(lock) { if (SETTINGS == null) SETTINGS = GuiSettings() return SETTINGS as GuiSettings } } } } @Throws(Exception::class) override fun setUp() { super.setUp() myRobot = SmartWaitRobot() GuiSettings.setUp() } @Throws(InvocationTargetException::class, InterruptedException::class) override fun tearDown() { super.tearDown() } companion object { val IS_UNDER_TEAMCITY = System.getenv("TEAMCITY_VERSION") != null } //*********CONTEXT FUNCTIONS ON LAMBDA RECEIVERS fun welcomeFrame(func: WelcomeFrameFixture.() -> Unit) {func.invoke(welcomeFrame())} fun ideaFrame(func: IdeFrameFixture.() -> Unit) { func.invoke(findIdeFrame())} fun dialog(title: String? = null, func: JDialogFixture.() -> Unit) {func.invoke(dialog(title))} fun simpleProject(func: IdeFrameFixture.() -> Unit) {func.invoke(importSimpleProject())} fun projectWizard(func: NewProjectWizardFixture.() -> Unit) {func.invoke(findNewProjectWizard())} fun IdeFrameFixture.projectView(func: ProjectViewFixture.() -> Unit) {func.invoke(this.projectView)} //*********FIXTURES METHODS WITHOUT ROBOT and TARGET; KOTLIN ONLY fun <S, C : Component> ComponentFixture<S, C>.jList(containingItem: String? = null): JListFixture = if (target() is Container) jList( target() as Container, containingItem) else throw UnsupportedOperationException("Sorry, unable to find JList component with ${target().toString()} as a Container") fun <S, C : Component> ComponentFixture<S, C>.button(name: String): JButtonFixture = if (target() is Container) button( target() as Container, name) else throw UnsupportedOperationException( "Sorry, unable to find JButton component named by \"${name}\" with ${target().toString()} as a Container") fun <S, C : Component> ComponentFixture<S, C>.combobox(labelText: String): JComboBoxFixture = if (target() is Container) combobox( target() as Container, labelText) else throw UnsupportedOperationException( "Sorry, unable to find JComboBox component near label by \"${labelText}\" with ${target().toString()} as a Container") fun <S, C : Component> ComponentFixture<S, C>.checkbox(labelText: String): CheckBoxFixture = if (target() is Container) checkbox( target() as Container, labelText) else throw UnsupportedOperationException( "Sorry, unable to find JCheckBox component near label by \"${labelText}\" with ${target().toString()} as a Container") fun <S, C : Component> ComponentFixture<S, C>.actionLink(name: String): ActionLinkFixture = if (target() is Container) actionLink( target() as Container, name) else throw UnsupportedOperationException( "Sorry, unable to find ActionLink component by name \"${name}\" with ${target().toString()} as a Container") fun <S, C : Component> ComponentFixture<S, C>.actionButton(actionName: String): ActionButtonFixture = if (target() is Container) actionButton( target() as Container, actionName) else throw UnsupportedOperationException( "Sorry, unable to find ActionButton component by action name \"${actionName}\" with ${target().toString()} as a Container") fun <S, C : Component> ComponentFixture<S, C>.radioButton(textLabel: String): JRadioButtonFixture = if (target() is Container) radioButton( target() as Container, textLabel) else throw UnsupportedOperationException( "Sorry, unable to find RadioButton component by label \"${textLabel}\" with ${target().toString()} as a Container") fun <S, C : Component> ComponentFixture<S, C>.textfield(textLabel: String?): JTextComponentFixture = if (target() is Container) textfield( target() as Container, textLabel) else throw UnsupportedOperationException( "Sorry, unable to find JTextComponent (JTextField) component by label \"${textLabel}\" with ${target().toString()} as a Container") fun <S, C : Component> ComponentFixture<S, C>.jTree(path: String? = null): JTreeFixture = if (target() is Container) jTree( target() as Container, path) else throw UnsupportedOperationException( "Sorry, unable to find JTree component \"${if (path != null) "by path ${path}" else ""}\" with ${target().toString()} as a Container") fun <S, C : Component> ComponentFixture<S, C>.popupClick(itemName: String) = if (target() is Container) popupClick( target() as Container, itemName) else throw UnsupportedOperationException( "Sorry, unable to find Popup component with ${target().toString()} as a Container") fun <S, C : Component> ComponentFixture<S, C>.linkLabel(itemName: String) = if (target() is Container) linkLabel( target() as Container, itemName) else throw UnsupportedOperationException( "Sorry, unable to find LinkLabel component with ${target().toString()} as a Container") //*********COMMON FUNCTIONS WITHOUT CONTEXT fun typeText(text: String) = GuiTestUtil.typeText(text, myRobot, 10) fun shortcut(keyStroke: String) = GuiTestUtil.invokeActionViaShortcut(myRobot, keyStroke) fun ideFrame() = findIdeFrame()!! fun welcomeFrame() = findWelcomeFrame() fun dialog(title: String? = null): JDialogFixture { if (title == null) { val jDialog = waitUntilFound(myRobot, object : GenericTypeMatcher<JDialog>(JDialog::class.java) { override fun isMatching(p0: JDialog): Boolean = true }) return JDialogFixture(myRobot, jDialog) } else { return JDialogFixture.find(myRobot, title) } } private fun jList(container: Container, containingItem: String? = null): JListFixture { val extCellReader = ExtendedJListCellReader() val myJList = waitUntilFound(myRobot, container, object : GenericTypeMatcher<JList<*>>(JList::class.java) { override fun isMatching(myList: JList<*>): Boolean { if (containingItem == null) return true //if were searching for any jList() val elements = (0..myList.model.size - 1).map { it -> extCellReader.valueAt(myList, it) } return elements.any { it.toString() == containingItem } } }) val jListFixture = JListFixture(myRobot, myJList) jListFixture.replaceCellReader(extCellReader) return jListFixture } private fun button(container: Container, name: String): JButtonFixture { val jButton = GuiTestUtil.waitUntilFound(myRobot, container, object : GenericTypeMatcher<JButton>(JButton::class.java) { override fun isMatching(jButton: JButton): Boolean = (jButton.isShowing && jButton.text == name) }) return JButtonFixture(myRobot, jButton) } private fun combobox(container: Container, labelText: String): JComboBoxFixture { //wait until label has appeared GuiTestUtil.waitUntilFound(myRobot, container, object : GenericTypeMatcher<JLabel>(JLabel::class.java) { override fun isMatching(jLabel: JLabel): Boolean = (jLabel.isShowing && jLabel.text == labelText) }) return GuiTestUtil.findComboBox(myRobot, container, labelText) } private fun checkbox(container: Container, labelText: String): CheckBoxFixture { //wait until label has appeared GuiTestUtil.waitUntilFound(myRobot, container, object : GenericTypeMatcher<JCheckBox>(JCheckBox::class.java) { override fun isMatching(checkBox: JCheckBox): Boolean = (checkBox.isShowing && checkBox.text == labelText) }) return CheckBoxFixture.findByText(labelText, container, myRobot, false) } private fun actionLink(container: Container, name: String) = ActionLinkFixture.findActionLinkByName(name, myRobot, container) private fun actionButton(container: Container, actionName: String) = ActionButtonFixture.findByActionId(actionName, myRobot, container) private fun radioButton(container: Container, labelText: String) = GuiTestUtil.findRadioButton(myRobot, container, labelText) private fun textfield(container: Container, labelText: String?): JTextComponentFixture { //if 'textfield()' goes without label if (labelText == null) { val jTextField = myRobot.finder().find(ComponentMatcher { component -> component!!.isShowing && component is JTextField }) as JTextField return JTextComponentFixture(myRobot, jTextField) } val jLabel = GuiTestUtil.waitUntilFound(myRobot, container, object : GenericTypeMatcher<JLabel>(JLabel::class.java) { override fun isMatching(jLabel: JLabel): Boolean = (jLabel.isShowing && jLabel.text == labelText) }) if (jLabel.labelFor != null && jLabel.labelFor is TextFieldWithBrowseButton) return JTextComponentFixture(myRobot, (jLabel.labelFor as TextFieldWithBrowseButton).textField) else return JTextComponentFixture(myRobot, myRobot.finder().findByLabel(labelText, JTextComponent::class.java)) } private fun linkLabel(container: Container, labelText: String): ComponentFixture<ComponentFixture<*, *>, LinkLabel<*>> { val myLinkLabel = waitUntilFound(myRobot, container, object: GenericTypeMatcher<LinkLabel<*>>(LinkLabel::class.java) { override fun isMatching(someLinkLabel: LinkLabel<*>) = (someLinkLabel.isShowing && (someLinkLabel.text == labelText)) }) return ComponentFixture<ComponentFixture<*, *>, LinkLabel<*>>(ComponentFixture::class.java, myRobot, myLinkLabel) } private fun popupClick(container: Container, itemName: String) { GuiTestUtil.clickPopupMenuItem(itemName, false, container, myRobot) } private fun jTree(container: Container, path: String? = null): JTreeFixture { val myTree: JTree? if (path == null) { myTree = waitUntilFound(myRobot, container, object : GenericTypeMatcher<JTree>(JTree::class.java) { override fun isMatching(p0: JTree) = true }) } else { myTree = waitUntilFound(myRobot, container, object : GenericTypeMatcher<JTree>(JTree::class.java) { override fun isMatching(p0: JTree): Boolean { try { JTreeFixture(myRobot, p0).node(path) return true } catch(locationUnavailableException: LocationUnavailableException) { return false } } }) } if (myTree.javaClass.name == "com.intellij.openapi.options.newEditor.SettingsTreeView\$MyTree") { //replace cellreader return JTreeFixture(myRobot, myTree).replaceCellReader(SettingsTreeCellReader()) } else return JTreeFixture(myRobot, myTree) } //*********SOME EXTENSION FUNCTIONS FOR FIXTURES }
0
Java
0
1
b8af29ff552e564d23ee97cec93d5f4f51636be9
12,636
intellij-community
Apache License 2.0
app/src/main/java/org/stepic/droid/events/loading/StartLoadEvent.kt
pk-codebox-evo
63,860,826
true
{"Java Properties": 2, "Gradle": 3, "Shell": 1, "Text": 3, "Markdown": 2, "Batchfile": 1, "Ignore List": 2, "Proguard": 1, "Java": 299, "Kotlin": 128, "XML": 143, "JavaScript": 162, "JSON": 1}
package org.stepic.droid.events.loading class StartLoadEvent
0
Java
0
0
9dc3778f34c6e2cb4efc002680ebb2b79a54778b
61
android-apps-stepic-android
Apache License 2.0
app/src/main/java/org/stepic/droid/events/loading/StartLoadEvent.kt
pk-codebox-evo
63,860,826
true
{"Java Properties": 2, "Gradle": 3, "Shell": 1, "Text": 3, "Markdown": 2, "Batchfile": 1, "Ignore List": 2, "Proguard": 1, "Java": 299, "Kotlin": 128, "XML": 143, "JavaScript": 162, "JSON": 1}
package org.stepic.droid.events.loading class StartLoadEvent
0
Java
0
0
9dc3778f34c6e2cb4efc002680ebb2b79a54778b
61
android-apps-stepic-android
Apache License 2.0
core/core/src/jsMain/kotlin/zakadabar/core/browser/util/w3c/ResizeObserverEntry.kt
spxbhuhb
290,390,793
false
{"Kotlin": 2390839, "HTML": 2835, "JavaScript": 1021, "Dockerfile": 269, "Shell": 253}
/* * Copyright © 2020-2021, <NAME> and contributors. Use of this source code is governed by the Apache 2.0 license. */ package zakadabar.core.browser.util.w3c import org.w3c.dom.DOMRectReadOnly import org.w3c.dom.Element @Suppress("unused") // api external class ResizeObserverEntry { val contentRect: DOMRectReadOnly val target: Element }
12
Kotlin
3
24
00859b62570bf455addc9723015ba2c48b77028b
351
zakadabar-stack
Apache License 2.0
shell/src/main/java/com/stewemetal/takehometemplate/shell/navigation/model/ForwardBackTransitions.kt
stewemetal
673,927,337
false
{"Kotlin": 70954}
package com.stewemetal.takehometemplate.shell.navigation.model import androidx.annotation.AnimRes import androidx.annotation.AnimatorRes data class ForwardBackTransitions( val startAnim: EnterExitTransitions, val backAnim: EnterExitTransitions, ) data class EnterExitTransitions( @AnimatorRes @AnimRes val enterAnim: Int, @AnimatorRes @AnimRes val exitAnim: Int, )
7
Kotlin
0
0
d6ba6bb847c20929e19631227b1bb308141b7b38
384
android-takehometemplate-multimodule
Apache License 2.0
core/src/main/java/ru/fabit/gentleman/internal/Dummy.kt
FabitMobile
728,099,639
false
{"Kotlin": 17080}
package ru.fabit.gentleman.internal import android.content.Intent import android.os.Bundle import androidx.appcompat.app.AppCompatActivity import ru.fabit.gentleman.Gentleman internal class Dummy : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) Gentleman.bind(this) log("Dummy_${hashCode()} created") } override fun onNewIntent(intent: Intent?) { super.onNewIntent(intent) Gentleman.bind(this) } override fun onDestroy() { super.onDestroy() log("Dummy_${hashCode()} destroyed") } override fun onResume() { super.onResume() Gentleman.onResume(this) } }
1
Kotlin
0
0
42495948f318d16dca4ce5c340b34cb0b95a29d2
723
Gentleman
MIT License
modules/gclib/src/main/kotlin/com/github/guqt178/utils/ext/DialogExt.kt
nakupenda178
246,516,496
false
{"Java": 4888326, "Kotlin": 281154}
package com.github.guqt178.utils.ext import android.app.ProgressDialog import android.content.Context import android.support.v4.content.ContextCompat import com.github.guqt178.R // <editor-fold defaultstate="collapsed" desc="AlertDialog"> fun Context.showSystemDialog(cancelable: Boolean = false, msg: String = "请稍后...") = ProgressDialog.show(this, "", msg, false, false).also { it.setIndeterminateDrawable(ContextCompat.getDrawable(this, R.drawable.progress_ios_loading)) }!! // </editor-fold>
1
Java
1
2
d35e7758dab47776290e86b9306d0a8530be1a16
526
gclib
Apache License 2.0
app/src/main/kotlin/com/silentium/di/scope/ActivityScope.kt
BrianLusina
112,729,940
false
null
package com.silentium.di.scope import javax.inject.Scope /** * @author lusinabrian on 02/12/17. * @Notes Scope to use for Activities */ @Scope @Retention(AnnotationRetention.RUNTIME) annotation class ActivityScope
0
Kotlin
1
0
e0132c5827879dec393ed89340414add906a2348
218
silentium
MIT License
api_viewing/src/main/kotlin/com/madness/collision/unit/api_viewing/origin/PackageRetriever.kt
cliuff
231,891,447
false
null
/* * Copyright 2021 <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.madness.collision.unit.api_viewing.origin import android.content.Context import android.content.pm.PackageInfo import com.madness.collision.misc.PackageCompat /** * Retrieve packages from user's device */ internal class PackageRetriever(private val context: Context) : OriginRetriever<PackageInfo> { override fun get(predicate: ((PackageInfo) -> Boolean)?): List<PackageInfo> { val list = PackageCompat.getAllPackages(context.packageManager) return if (predicate != null) list.filter(predicate) else list } }
0
Kotlin
4
36
ae3007e5660d73eb8e3d6e21335612e26e3a81ae
1,141
boundo
Apache License 2.0
src/main/kotlin/aoc2023/Day22.kt
j4velin
572,870,735
false
{"Kotlin": 212097, "Python": 1446}
package aoc2023 import readInput object Day22 { fun part1(input: List<String>): Int { return 0 } fun part2(input: List<String>): Int { return 0 } } fun main() { val testInput = readInput("Day22_test", 2023) check(Day22.part1(testInput) == 0) check(Day22.part2(testInput) == 0) val input = readInput("Day22", 2023) println(Day22.part1(input)) println(Day22.part2(input)) }
0
Kotlin
0
0
a9f56bb01e27e501cad124bfcebb8e25763acb35
391
adventOfCode
Apache License 2.0
feature/profilecard/src/androidUnitTest/kotlin/io/github/droidkaigi/confsched/profilecard/ProfileCardScreenTest.kt
DroidKaigi
776,354,672
false
{"Kotlin": 1119401, "Swift": 211686, "Shell": 2954, "Makefile": 1314, "Ruby": 386}
package io.github.droidkaigi.confsched.profilecard import dagger.hilt.android.testing.BindValue import dagger.hilt.android.testing.HiltAndroidTest import io.github.droidkaigi.confsched.testing.DescribedBehavior import io.github.droidkaigi.confsched.testing.describeBehaviors import io.github.droidkaigi.confsched.testing.execute import io.github.droidkaigi.confsched.testing.robot.DefaultSensorRobot.CustomShadowSensorManager import io.github.droidkaigi.confsched.testing.robot.ProfileCardDataStoreRobot.ProfileCardInputStatus import io.github.droidkaigi.confsched.testing.robot.ProfileCardScreenRobot import io.github.droidkaigi.confsched.testing.robot.runRobot import io.github.droidkaigi.confsched.testing.rules.RobotTestRule import org.junit.After import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import org.robolectric.ParameterizedRobolectricTestRunner import org.robolectric.annotation.Config import javax.inject.Inject @RunWith(ParameterizedRobolectricTestRunner::class) @Config( shadows = [CustomShadowSensorManager::class], ) @HiltAndroidTest class ProfileCardScreenTest( private val testCase: DescribedBehavior<ProfileCardScreenRobot>, ) { @get:Rule @BindValue val robotTestRule: RobotTestRule = RobotTestRule(this) @Inject lateinit var robot: ProfileCardScreenRobot @Test fun runTest() { runRobot(robot) { testCase.execute(robot) } } @After fun tearDown() { robot.cleanUp() } companion object { @JvmStatic @ParameterizedRobolectricTestRunner.Parameters(name = "{0}") fun behaviors(): List<DescribedBehavior<ProfileCardScreenRobot>> { return describeBehaviors("ProfileCardScreen") { describe("when profile card is does not exists") { doIt { setupSavedProfileCard(ProfileCardInputStatus.AllNotEntered) setupScreenContent() } itShould("show edit screen") { captureScreenWithChecks { checkEditScreenDisplayed() } } describe("when url protocol is invalid") { val url = "ttps://example.com" doIt { inputLink("ttps://example.com") } itShould("show error message") { captureScreenWithChecks { checkLinkError(url) } } } describe("when url top level domain is missing") { val url = "https://example" doIt { inputLink(url) } itShould("show error message") { captureScreenWithChecks { checkLinkError(url) } } } describe("when url contains IDN domain name") { val url = "https://example.xn--com" doIt { inputLink(url) } itShould("not show error message") { captureScreenWithChecks { checkLinkNotError(url) } } } describe("when protocol is missing") { val url = "example.com/foobar" doIt { inputLink(url) } itShould("not show error message") { captureScreenWithChecks { checkLinkNotError(url) } } } describe("when url contains sub domain") { val url = "https://www.example.co.jp/foobar" doIt { inputLink(url) } itShould("not show error message") { captureScreenWithChecks { checkLinkNotError(url) } } } // FIXME Add a test to confirm that it is possible to transition to the Card screen after entering the required input fields, including images. // FIXME Currently, the test code does not allow the user to select and input an image from the Add Image button. } describe("when profile card is exists") { doIt { setupSavedProfileCard(ProfileCardInputStatus.NoInputOtherThanImage) setupScreenContent() } itShould("show card screen") { captureScreenWithChecks { checkCardScreenDisplayed() checkProfileCardFrontDisplayed() } } describe("tilt tests") { doIt { setupMockSensor() } describe("tilt to horizontal") { doIt { tiltToHorizontal() } itShould("show card in horizontal") { captureScreenWithChecks { checkCardScreenDisplayed() checkProfileCardFrontDisplayed() } } } describe("tilt to mid-range") { doIt { tiltToMidRange() } itShould("show card at mid-range") { captureScreenWithChecks { checkCardScreenDisplayed() checkProfileCardFrontDisplayed() } } } describe("tilt to upper bound") { doIt { tiltToUpperBound() } itShould("show card at upper bound") { captureScreenWithChecks { checkCardScreenDisplayed() checkProfileCardFrontDisplayed() } } } describe("tilt pitch out of bounds") { doIt { tiltPitchOutOfBounds() } itShould("keep last valid pitch") { captureScreenWithChecks { checkCardScreenDisplayed() checkProfileCardFrontDisplayed() } } } describe("tilt roll out of bounds") { doIt { tiltRollOutOfBounds() } itShould("keep last valid roll") { captureScreenWithChecks { checkCardScreenDisplayed() checkProfileCardFrontDisplayed() } } } describe("tilt both axes out of bounds") { doIt { tiltBothAxesOutOfBounds() } itShould("keep last valid orientation") { captureScreenWithChecks { checkCardScreenDisplayed() checkProfileCardFrontDisplayed() } } } describe("tilt to boundary") { doIt { tiltToPitchRollBoundary() } itShould("show card at boundary") { captureScreenWithChecks { checkCardScreenDisplayed() checkProfileCardFrontDisplayed() } } } describe("tilt to opposite boundary") { doIt { tiltToPitchRollBoundaryOpposite() } itShould("show card at opposite boundary") { captureScreenWithChecks { checkCardScreenDisplayed() checkProfileCardFrontDisplayed() } } } } describe("flip profile card") { doIt { flipProfileCard() } itShould("back side of the profile card is displayed") { captureScreenWithChecks { checkProfileCardBackDisplayed() } } } describe("when click edit button") { doIt { clickEditButton() } itShould("show edit screen") { captureScreenWithChecks { checkEditScreenDisplayed() } } describe("when if a required field has not been filled in") { doIt { scrollToTestTag(ProfileCardCreateButtonTestTag) } itShould("make sure the Create button is deactivated") { captureScreenWithChecks { checkCreateButtonDisabled() } } } describe("if all required fields are filled in") { val nickname = "test" val occupation = "test" val link = "test" doIt { inputNickName(nickname) inputOccupation(occupation) inputLink(link) scrollToTestTag(ProfileCardCreateButtonTestTag) } itShould("make sure the Create button is activated") { captureScreenWithChecks { checkNickName(nickname) checkOccupation(occupation) checkLink(link) checkCreateButtonEnabled() } } } } } } } } }
49
Kotlin
201
438
57c38a76beb5b75edc9220833162e1257f40ac06
12,194
conference-app-2024
Apache License 2.0
dsl/src/main/kotlin/cloudshift/awscdk/dsl/services/appmesh/CfnVirtualGatewaySubjectAlternativeNamesPropertyDsl.kt
cloudshiftinc
667,063,030
false
null
@file:Suppress("RedundantVisibilityModifier","RedundantUnitReturnType","RemoveRedundantQualifierName","unused","UnusedImport","ClassName","REDUNDANT_PROJECTION","DEPRECATION") package cloudshift.awscdk.dsl.services.appmesh import cloudshift.awscdk.common.CdkDslMarker import software.amazon.awscdk.IResolvable import software.amazon.awscdk.services.appmesh.CfnVirtualGateway /** * An object that represents the subject alternative names secured by the certificate. * * Example: * * ``` * // The code below shows an example of how to instantiate this type. * // The values are placeholders you should change. * import software.amazon.awscdk.services.appmesh.*; * SubjectAlternativeNamesProperty subjectAlternativeNamesProperty = * SubjectAlternativeNamesProperty.builder() * .match(SubjectAlternativeNameMatchersProperty.builder() * .exact(List.of("exact")) * .build()) * .build(); * ``` * * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-appmesh-virtualgateway-subjectalternativenames.html) */ @CdkDslMarker public class CfnVirtualGatewaySubjectAlternativeNamesPropertyDsl { private val cdkBuilder: CfnVirtualGateway.SubjectAlternativeNamesProperty.Builder = CfnVirtualGateway.SubjectAlternativeNamesProperty.builder() /** * @param match An object that represents the criteria for determining a SANs match. */ public fun match(match: IResolvable) { cdkBuilder.match(match) } /** * @param match An object that represents the criteria for determining a SANs match. */ public fun match(match: CfnVirtualGateway.SubjectAlternativeNameMatchersProperty) { cdkBuilder.match(match) } public fun build(): CfnVirtualGateway.SubjectAlternativeNamesProperty = cdkBuilder.build() }
1
Kotlin
0
0
17c41bdaffb2e10d31b32eb2282b73dd18be09fa
1,783
awscdk-dsl-kotlin
Apache License 2.0
composeApp/src/commonMain/kotlin/ui/components/FieldDescription.kt
thaapasa
702,418,399
false
{"Kotlin": 476702, "Swift": 661, "Shell": 262}
package fi.tuska.beerclock.ui.components import androidx.compose.foundation.layout.padding import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.dp @Composable fun FieldDescription( text: String, modifier: Modifier = Modifier, color: Color = MaterialTheme.colorScheme.onSurfaceVariant ) { Text( text, modifier = modifier.padding(horizontal = 16.dp), style = MaterialTheme.typography.bodySmall, color = color ) }
1
Kotlin
0
2
2fd90678ed1f66ba8f23adec85cb74f90fa2165e
652
beerclock
Apache License 2.0
src/main/kotlin/dev/lutergs/lutergsbackend/repository/pageRepositoryImpl/PageRepositoryImpl.kt
lutergs-dev
634,272,311
false
{"Kotlin": 109574, "Shell": 142}
package dev.lutergs.lutergsbackend.repository.pageRepositoryImpl import dev.lutergs.lutergsbackend.repository.userInterfaceImpl.UserEntityReactiveRepository import dev.lutergs.lutergsbackend.service.page.* import dev.lutergs.lutergsbackend.service.user.NickName import dev.lutergs.lutergsbackend.service.user.User import dev.lutergs.lutergsbackend.utils.toDefaultZoneLocalDateTime import org.springframework.data.domain.Pageable import org.springframework.r2dbc.core.DatabaseClient import org.springframework.stereotype.Component import org.springframework.transaction.annotation.Transactional import reactor.core.publisher.Flux import reactor.core.publisher.Mono @Component class PageRepositoryImpl( private val pageKeyReactiveRepository: PageKeyReactiveRepository, private val pageValueReactiveRepository: PageValueReactiveRepository, private val userEntityReactiveRepository: UserEntityReactiveRepository ): PageRepository { @Transactional override fun getPageByEndpoint(endpoint: Endpoint): Mono<Page> { return this.pageKeyReactiveRepository.findByEndpoint(endpoint.value) .flatMap { pageKeyEntity -> Mono.zip( this.toPageKey(pageKeyEntity), this.pageValueReactiveRepository.findByPageKeyId(pageKeyEntity.id!!) .flatMap { Mono.just(it.toPageValue()) } )}.flatMap { Mono.just(Page(it.t1, it.t2)) } } @Transactional override fun getPageKeyList(pageIndex: Int, pageSize: Int): Flux<PageKey> { return this.pageKeyReactiveRepository.findByOrderByIdDesc(Pageable.ofSize(pageSize).withPage(pageIndex)) .flatMap { this.toPageKey(it) } } @Transactional override fun getPageOfUser(user: User): Flux<PageKey> { return this.userEntityReactiveRepository.findDistinctFirstByEmail(user.email.toString()) .flatMapMany { this.pageKeyReactiveRepository.findByUserId(it.id!!) } .flatMap { Mono.just(this.toPageKey(it, user)) } } @Transactional override fun getPageValue(pageKey: PageKey): Mono<PageValue> { return pageKey.id ?.let { this.pageValueReactiveRepository.findByPageKeyId(it) } ?.flatMap { Mono.just(it.toPageValue()) } ?: Mono.error(IllegalArgumentException("page ID 가 존재하지 않습니다.")) } @Transactional override fun savePage(page: Page, user: User): Mono<Page> { return PageKeyEntity.fromPageKey(page.pageKey, user.id!!) .let { this.pageKeyReactiveRepository.save(it) } .flatMap { pageKeyEntity -> PageValueEntity.fromPageValue(page.pageValue, pageKeyEntity) .let { this.pageValueReactiveRepository.save(it) } .flatMap { Mono.just(Page( this.toPageKey(pageKeyEntity, user), it.toPageValue() )) } } } private fun toPageKey(from: PageKeyEntity): Mono<PageKey> { return this.userEntityReactiveRepository.findById(from.userId!!) .flatMap { Mono.just(PageKey(from.id, from.title!!, Endpoint(from.endpoint!!), NickName(it.nickName!!), from.createdAt!!.toDefaultZoneLocalDateTime())) } } private fun toPageKey(from: PageKeyEntity, user: User): PageKey { return PageKey(from.id!!, from.title!!, Endpoint(from.endpoint!!), user.nickName, from.createdAt!!.toDefaultZoneLocalDateTime()) } }
0
Kotlin
0
0
d3a6f0f451a310b1537da49c361bec9b4089ca5c
3,447
lutergs-backend
MIT License
pleo-antaeus-core/src/test/kotlin/io/pleo/antaeus/context/customer/CustomerServiceTest.kt
dmorenoh
301,955,017
true
{"Kotlin": 96174, "Shell": 861, "Dockerfile": 249}
package io.pleo.antaeus.context.customer import io.mockk.every import io.mockk.mockk import io.pleo.antaeus.core.exceptions.CustomerNotFoundException import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows class CustomerServiceTest { private val repository = mockk<CustomerRepository> { every { load(404) } returns null } private val customerService = CustomerService(repository = repository) @Test fun `will throw if customer is not found`() { assertThrows<CustomerNotFoundException> { customerService.fetch(404) } } }
0
Kotlin
0
0
a6947cdab04525ed0add6ca48f8c41f79cbfd64c
604
antaeus
Creative Commons Zero v1.0 Universal
year2019/day10/part1/src/main/kotlin/com/curtislb/adventofcode/year2019/day10/part1/Year2019Day10Part1.kt
curtislb
226,797,689
false
{"Kotlin": 1905641}
/* --- Day 10: Monitoring Station --- You fly into the asteroid belt and reach the Ceres monitoring station. The Elves here have an emergency: they're having trouble tracking all of the asteroids and can't be sure they're safe. The Elves would like to build a new monitoring station in a nearby area of space; they hand you a map of all of the asteroids in that region (your puzzle input). The map indicates whether each position is empty (.) or contains an asteroid (#). The asteroids are much smaller than they appear on the map, and every asteroid is exactly in the center of its marked position. The asteroids can be described with X,Y coordinates where X is the distance from the left edge and Y is the distance from the top edge (so the top-left corner is 0,0 and the position immediately to its right is 1,0). Your job is to figure out which asteroid would be the best place to build a new monitoring station. A monitoring station can detect any asteroid to which it has direct line of sight - that is, there cannot be another asteroid exactly between them. This line of sight can be at any angle, not just lines aligned to the grid or diagonally. The best location is the asteroid that can detect the largest number of other asteroids. For example, consider the following map: .#..# ..... ##### ....# ...## The best location for a new monitoring station on this map is the highlighted asteroid at 3,4 because it can detect 8 asteroids, more than any other location. (The only asteroid it cannot detect is the one at 1,0; its view of this asteroid is blocked by the asteroid at 2,2.) All other asteroids are worse locations; they can detect 7 or fewer other asteroids. Here is the number of other asteroids a monitoring station on each asteroid could detect: .7..7 ..... 67775 ....7 ...87 Here is an asteroid (#) and some examples of the ways its line of sight might be blocked. If there were another asteroid at the location of a capital letter, the locations marked with the corresponding lowercase letter would be blocked and could not be detected: #......... ...A...... ...B..a... .EDCG....a ..F.c.b... .....c.... ..efd.c.gb .......c.. ....f...c. ...e..d..c Here are some larger examples: - Best is 5,8 with 33 other asteroids detected: ......#.#. #..#.#.... ..#######. .#.#.###.. .#..#..... ..#....#.# #..#....#. .##.#..### ##...#..#. .#....#### - Best is 1,2 with 35 other asteroids detected: #.#...#.#. .###....#. .#....#... ##.#.#.#.# ....#.#.#. .##..###.# ..#...##.. ..##....## ......#... .####.###. - Best is 6,3 with 41 other asteroids detected: .#..#..### ####.###.# ....###.#. ..###.##.# ##.##.#.#. ....###..# ..#.#..#.# #..#.#.### .##...##.# .....#.#.. - Best is 11,13 with 210 other asteroids detected: .#..##.###...####### ##.############..##. .#.######.########.# .###.#######.####.#. #####.##.#.##.###.## ..#####..#.######### #################### #.####....###.#.#.## ##.################# #####.##.###..####.. ..######..##.####### ####.##.####...##..# .#####..#.######.### ##...#.##########... #.##########.####### .####.#.###.###.#.## ....##.##.###..##### .#.#.###########.### #.#.#.#####.####.### ###.##.####.##.#..## Find the best location for a new monitoring station. How many other asteroids can be detected from that location? */ package com.curtislb.adventofcode.year2019.day10.part1 import com.curtislb.adventofcode.year2019.day10.asteroid.AsteroidField import java.nio.file.Path import java.nio.file.Paths /** * Returns the solution to the puzzle for 2019, day 10, part 1. * * @param inputPath The path to the input file for this puzzle. */ fun solve(inputPath: Path = Paths.get("..", "input", "input.txt")): Int? { val asteroidField = AsteroidField(inputPath.toFile()) val (bestStation, asteroidCount) = asteroidField.findBestStation() return if (bestStation != null) asteroidCount else null } fun main() = when (val solution = solve()) { null -> println("No station location found.") else -> println(solution) }
0
Kotlin
1
1
addf5ae8d002d30abf1ab816e23502a296debc4e
4,099
AdventOfCode
MIT License
core/domain/src/main/java/com/tomaszrykala/recsandfx/core/domain/repository/EffectsRepository.kt
tomaszrykala
672,373,610
false
null
package com.tomaszrykala.recsandfx.core.domain.repository import androidx.annotation.StringRes import com.tomaszrykala.recsandfx.core.domain.R import com.tomaszrykala.recsandfx.core.domain.effect.EffectCategory import com.tomaszrykala.recsandfx.core.domain.effect.Effect import com.tomaszrykala.recsandfx.core.domain.effect.toParam import com.tomaszrykala.recsandfx.core.domain.native.NativeInterfaceWrapper interface EffectsRepository { suspend fun getAllEffects(): List<Effect> suspend fun getEffect(effectName: String): EffectResult } data class EffectResult(val effect: Effect?, val hasCached: Boolean) internal class EffectsRepositoryImpl( private val nativeInterface: NativeInterfaceWrapper, ) : EffectsRepository { private var cachedEffect: Effect? = null override suspend fun getAllEffects(): List<Effect> = effects override suspend fun getEffect(effectName: String): EffectResult { val effect: Effect? = getAllEffects().find { it.name == effectName } val hasCached = cachedEffect != null cachedEffect = effect return EffectResult(effect, hasCached) } private val effects: List<Effect> by lazy { nativeInterface.getAllEffectsMap().map { Effect( id = it.value.id, name = it.key, params = it.value.paramValues.map { pd -> pd.toParam() }, category = it.value.category.toCategory(), description = getDescription(it.key) ) } } @StringRes private fun getDescription(name: String): Int { return when (name) { "Echo" -> R.string.effect_desc_echo "Doubling" -> R.string.effect_desc_doubling "Slapback" -> R.string.effect_desc_slapback "Flanger" -> R.string.effect_desc_flanger "Vibrato" -> R.string.effect_desc_vibrato "White Chorus" -> R.string.effect_desc_white_chorus "Overdrive" -> R.string.effect_desc_overdrive "Distortion" -> R.string.effect_desc_distortion "AllPass" -> R.string.effect_desc_allpass "FIR" -> R.string.effect_desc_fir "IIR" -> R.string.effect_desc_iir "Gain" -> R.string.effect_desc_gain "Tremolo" -> R.string.effect_desc_tremolo "Passthrough" -> R.string.effect_desc_passthrough else -> R.string.effect_desc_no_info } } } private fun String.toCategory(): EffectCategory = EffectCategory.values().find { it.name == this } ?: EffectCategory.None
2
Kotlin
0
0
45bb9580fcd020006b6f1356bb6c0180d8fc164d
2,576
RecsAndFx
Apache License 2.0
src/main/java/dev/alphaserpentis/bots/laevitasmarketdata/data/api/FuturesOiBreakdown.kt
Alpha-Serpentis-Developments
718,665,638
false
{"Kotlin": 48352}
package dev.alphaserpentis.bots.laevitasmarketdata.data.api data class FuturesOiBreakdown( val date: Long, val data: BreakdownData ) { data class BreakdownData( val all: FuturesOiForMarket, val future: FuturesOiForMarket?, val perpetual: FuturesOiForMarket? ) { data class FuturesOiForMarket( val usd: Map<String, Double>, val notional: Map<String, Double> ) } }
0
Kotlin
0
0
a65fe10408ab8078ea02f3adccb8d21007a1a08c
448
Laevitas-Market-Bot
Apache License 2.0
line-awesome/src/commonMain/kotlin/compose/icons/lineawesomeicons/HandRockSolid.kt
DevSrSouza
311,134,756
false
{"Kotlin": 36719092}
package compose.icons.lineawesomeicons 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 compose.icons.LineAwesomeIcons public val LineAwesomeIcons.HandRockSolid: ImageVector get() { if (_handRockSolid != null) { return _handRockSolid!! } _handRockSolid = Builder(name = "HandRockSolid", defaultWidth = 32.0.dp, defaultHeight = 32.0.dp, viewportWidth = 32.0f, viewportHeight = 32.0f).apply { path(fill = SolidColor(Color(0xFF000000)), stroke = null, strokeLineWidth = 0.0f, strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = 4.0f, pathFillType = NonZero) { moveTo(15.0f, 6.0f) curveTo(13.938f, 6.0f, 13.004f, 6.563f, 12.469f, 7.406f) curveTo(12.031f, 7.156f, 11.535f, 7.0f, 11.0f, 7.0f) curveTo(9.355f, 7.0f, 8.0f, 8.355f, 8.0f, 10.0f) lineTo(8.0f, 13.656f) lineTo(5.906f, 16.344f) curveTo(4.629f, 17.996f, 4.715f, 20.367f, 6.094f, 21.938f) lineTo(8.469f, 24.625f) curveTo(9.797f, 26.137f, 11.707f, 27.0f, 13.719f, 27.0f) lineTo(19.0f, 27.0f) curveTo(22.855f, 27.0f, 26.0f, 23.855f, 26.0f, 20.0f) lineTo(26.0f, 11.0f) curveTo(26.0f, 9.355f, 24.645f, 8.0f, 23.0f, 8.0f) curveTo(22.465f, 8.0f, 21.969f, 8.156f, 21.531f, 8.406f) curveTo(20.996f, 7.563f, 20.063f, 7.0f, 19.0f, 7.0f) curveTo(18.465f, 7.0f, 17.969f, 7.156f, 17.531f, 7.406f) curveTo(16.996f, 6.563f, 16.063f, 6.0f, 15.0f, 6.0f) close() moveTo(15.0f, 8.0f) curveTo(15.566f, 8.0f, 16.0f, 8.434f, 16.0f, 9.0f) lineTo(16.0f, 12.0f) lineTo(18.0f, 12.0f) lineTo(18.0f, 10.0f) curveTo(18.0f, 9.434f, 18.434f, 9.0f, 19.0f, 9.0f) curveTo(19.566f, 9.0f, 20.0f, 9.434f, 20.0f, 10.0f) lineTo(20.0f, 12.0f) lineTo(22.0f, 12.0f) lineTo(22.0f, 11.0f) curveTo(22.0f, 10.434f, 22.434f, 10.0f, 23.0f, 10.0f) curveTo(23.566f, 10.0f, 24.0f, 10.434f, 24.0f, 11.0f) lineTo(24.0f, 20.0f) curveTo(24.0f, 22.773f, 21.773f, 25.0f, 19.0f, 25.0f) lineTo(13.719f, 25.0f) curveTo(12.281f, 25.0f, 10.918f, 24.395f, 9.969f, 23.313f) lineTo(7.594f, 20.594f) curveTo(6.84f, 19.734f, 6.801f, 18.5f, 7.5f, 17.594f) lineTo(8.0f, 16.938f) lineTo(8.0f, 18.0f) lineTo(10.0f, 18.0f) lineTo(10.0f, 10.0f) curveTo(10.0f, 9.434f, 10.434f, 9.0f, 11.0f, 9.0f) curveTo(11.566f, 9.0f, 12.0f, 9.434f, 12.0f, 10.0f) lineTo(12.0f, 12.0f) lineTo(14.0f, 12.0f) lineTo(14.0f, 9.0f) curveTo(14.0f, 8.434f, 14.434f, 8.0f, 15.0f, 8.0f) close() } } .build() return _handRockSolid!! } private var _handRockSolid: ImageVector? = null
17
Kotlin
25
571
a660e5f3033e3222e3553f5a6e888b7054aed8cd
3,689
compose-icons
MIT License
app/src/main/java/com/calvinnor/progress/util/ListUtils.kt
calvinnor
126,571,244
false
null
package com.calvinnor.progress.util fun <T> MutableList<T>.swap(left: Int, right: Int) { val leftElem = this.get(left) val rightElem = this.get(right) this.apply { set(left, rightElem) set(right, leftElem) } } fun <T> MutableList<T>.positionOf(elem: T): Int { this.forEachIndexed { index, t -> if (elem!!.equals(t)) return index } return -1 }
0
Kotlin
2
1
56f554ce179eea2b601b6e570467abc94b3ce818
397
Progress
MIT License
Problem Solving/Algorithms/Basic - Mini-Max Sum.kt
MechaArms
525,331,223
false
{"Kotlin": 30017}
/* Given five positive integers, find the minimum and maximum values that can be calculated by summing exactly four of the five integers. Then print the respective minimum and maximum values as a single line of two space-separated long integers. Example arr = [1,3,5,7,9] The minimum sum is 1+3+5+7=16 and the maximum sum is 3+5+7+9=24. The function prints 16 24 Function Description Complete the miniMaxSum function in the editor below. miniMaxSum has the following parameter(s): arr: an array of integers Print Print two space-separated integers on one line: the minimum sum and the maximum sum of 4 of 5 elements. Input Format A single line of five space-separated integers. Output Format Print two space-separated long integers denoting the respective minimum and maximum values that can be calculated by summing exactly four of the five integers. (The output can be greater than a 32 bit integer.) Sample Input 1 2 3 4 5 Sample Output 10 14 Explanation The numbers are 1, 2, 3, 4, and 5. Calculate the following sums using four of the five integers: Sum everything except 1, the sum is 2+3+4+5=14. Sum everything except 2, the sum is 1+3+4+5=13. Sum everything except 3, the sum is 1+2+4+5=12. Sum everything except 4, the sum is 1+2+3+5=11. Sum everything except 5, the sum is 1+2+3+4=10. Hints: Beware of integer overflow! Use 64-bit Integer. */ fun miniMaxSum(arr: Array<Int>): Unit { // Write your code here var ordered: List<Long> = arr.map { it.toLong() } var max = ordered.max()!! var min = ordered.min()!! print("${ordered.sum() - max} ${ordered.sum() - min }") } fun main(args: Array<String>) { val arr = readLine()!!.trimEnd().split(" ").map{ it.toInt() }.toTypedArray() miniMaxSum(arr) }
0
Kotlin
0
1
eda7f92fca21518f6ee57413138a0dadf023f596
1,760
My-HackerRank-Solutions
MIT License
client-jaxrs/src/main/kotlin/rockitt/erpnext/client/Annotation.kt
rockitt-erp
212,895,932
false
null
package rockitt.erpnext.client import kotlin.reflect.KClass annotation class Resource(val name: String) annotation class Link(val name: Resource, val type: KClass<*>) annotation class Id
0
Kotlin
0
0
961c86b1102e4e9df56be11a762916def1064279
190
erpnext-client
MIT License
app/src/main/java/com/wjx/android/wanandroidmvvm/ui/meshare/data/MeShareResponse.kt
LoveLifeEveryday
258,932,329
false
null
package com.wjx.android.wanandroidmvvm.module.meshare.model /** * Created with Android Studio. * Description: * @author: Wangjianxian * @date: 2020/03/26 * Time: 16:56 */ data class MeShareResponse<T>(var shareArticles : T)
3
null
44
3
c681db14548fce716cd5baab31bf704ce344bf1b
231
WanAndroidMVVM
Apache License 2.0
android/app/src/main/kotlin/com/ventricles/animore/animore/MainActivity.kt
raysummee
329,422,570
false
{"Dart": 276888, "HTML": 1503, "Ruby": 1354, "Swift": 417, "Kotlin": 275, "Objective-C": 39}
package com.ventricles.animore.animore import io.flutter.embedding.android.FlutterActivity class MainActivity: FlutterActivity() { }
0
Dart
0
2
5e609b105defc26f5bf1c5ea26c06eca0f338085
135
animore-app
The Unlicense
hazelnet-cardano-shared/src/main/kotlin/io/hazelnet/cardano/connect/data/stakepool/DelegationInfo.kt
nilscodes
446,203,879
false
{"TypeScript": 1045486, "Kotlin": 810416, "Dockerfile": 4476, "Shell": 1830, "JavaScript": 1384}
package io.hazelnet.cardano.connect.data.stakepool data class DelegationInfo( val poolHash: String, val amount: Long, val stakeAddress: String ) { override fun toString(): String { return "DelegationInfo(poolHash='$poolHash', amount=$amount, stakeAddress='$stakeAddress')" } }
0
TypeScript
4
13
79f8b096f599255acb03cc809464d0570a51d82c
317
hazelnet
Apache License 2.0
app/src/main/java/com/codewithshadow/filmrave/core/network/ApiClient.kt
SakshamSharma2026
645,629,276
false
{"Kotlin": 107759}
package com.codewithshadow.filmrave.core.network import com.codewithshadow.filmrave.data.model.MovieResponseList import com.codewithshadow.filmrave.data.model.MovieResponseVideoList import com.codewithshadow.filmrave.data.model.WatchProvidersResponse import retrofit2.Response import retrofit2.http.GET import retrofit2.http.Path import retrofit2.http.Query interface ApiClient { @GET("3/movie/popular") suspend fun fetchPopularMoviesApiCall( @Query("language") lang: String? = "en-US", @Query("page") page: Int = 1 ): Response<MovieResponseList> @GET("3/movie/now_playing") suspend fun fetchNowPlayingMoviesApiCall( @Query("language") lang: String? = "en-US", @Query("page") page: Int = 1 ): Response<MovieResponseList> @GET("3/movie/top_rated") suspend fun fetchTopRatedMoviesApiCall( @Query("region") region: String = "IN", @Query("language") lang: String? = "en-US", @Query("page") page: Int = 1 ): Response<MovieResponseList> @GET("3/tv/popular") suspend fun fetchPopularTvShowsApiCall( @Query("language") lang: String? = "en-US", @Query("page") page: Int = 1 ): Response<MovieResponseList> @GET("3/discover/tv") suspend fun fetchNetflixTvShowsApiCall( @Query("language") lang: String? = "en-US", @Query("with_networks") page: String = "213" // network code for NetFlix ): Response<MovieResponseList> @GET("3/movie/upcoming") suspend fun fetchUpcomingMoviesApiCall( @Query("language") lang: String? = "en-US", @Query("page") page: Int = 1, @Query("region") region: String = "US" ): Response<MovieResponseList> @GET("3/discover/tv") suspend fun fetchAnimeSeriesApiCall( @Query("with_genres") genres: String = "16", // Animation genre = "16" @Query("sort_by") sortBy: String? = "popularity.desc", @Query("first_air_date.gte") firstAirDateGreaterThan: String = "2010-01-01", @Query("page") page: Int = 1, @Query("language") lang: String? = "en-US", @Query("with_original_language") origLang: String = "en", @Query("include_null_first_air_dates") include: Boolean = false ): Response<MovieResponseList> @GET("3/discover/movie") suspend fun fetchBollywoodMoviesApiCall( @Query("sort_by") sortBy: String? = "popularity.desc", @Query("primary_release_date.gte") releaseDateGreaterThan: String = "2012-08-01", @Query("page") page: Int = 1, @Query("region") region: String = "IN", @Query("with_release_type") releaseType: String = "3|2", @Query("watch_region") watchRegion: String = "IN", @Query("language") lang: String? = "hi-IN", @Query("with_original_language") origLang: String = "hi", ): Response<MovieResponseList> @GET("3/movie/{movie_id}/recommendations") suspend fun fetchRecommendedMoviesApiCall( @Path("movie_id") movieId: Int, @Query("language") lang: String? = "en-US", @Query("page") page: Int = 1 ): Response<MovieResponseList> @GET("3/trending/{media_type}/{time_window}") suspend fun fetchTrendingApiCall( @Path("media_type") mediaType: String = "movie", // movie, tv, person, all @Path("time_window") timeWindow: String = "day", // day, week @Query("language") lang: String? = "en-US", @Query("page") page: Int = 1 ): Response<MovieResponseList> @GET("3/search/movie") suspend fun fetchMovieSearchedResultsApiCall( @Query("language") lang: String? = "en-US", @Query("page") page: Int = 1, @Query("include_adult") includeAdult: Boolean = false, @Query("query") searchQuery: String ): Response<MovieResponseList> @GET("3/movie/{movie_id}/videos") suspend fun fetchMovieVideoApiCall( @Path("movie_id") movieId: Int, @Query("language") lang: String? = "en-US", @Query("page") page: Int = 1 ): Response<MovieResponseVideoList> @GET("3/movie/{movie_id}/watch/providers") suspend fun getMovieWatchProvidersApiCall( @Path("movie_id") movieId: Int, ): Response<WatchProvidersResponse> }
0
Kotlin
2
6
48b4f92e82117a43ae8aa727b017c83da37d584b
4,222
FilmRave
MIT License
app/src/main/java/com/freshdigitable/dlfeey/feed/FeedItemBindingAdapter.kt
akihito104
172,190,294
false
{"Kotlin": 20667}
package com.freshdigitable.dlfeey.feed import android.widget.ImageView import androidx.databinding.BindingAdapter import com.bumptech.glide.Glide import com.rometools.rome.feed.synd.SyndEntry @BindingAdapter("imageUrl") fun ImageView.loadImageUrl(entry: SyndEntry?) { val url = entry?.foreignMarkup?.firstOrNull { it.qualifiedName == "hatena:imageurl" } ?.content?.get(0)?.value if (url == null) { Glide.with(this) .clear(this) } else { Glide.with(this) .load(url) .into(this) } }
2
Kotlin
0
0
80f6e52a55449fd991918156bd5292a7397e04e7
559
dlfeey
Apache License 2.0
data/RF02634/rnartist.kts
fjossinet
449,239,232
false
{"Kotlin": 8214424}
import io.github.fjossinet.rnartist.core.* rnartist { ss { rfam { id = "RF02634" name = "consensus" use alignment numbering } } theme { details { value = 3 } color { location { 11 to 16 33 to 38 } value = "#04b23c" } color { location { 19 to 22 27 to 30 } value = "#3b0c5e" } color { location { 41 to 42 69 to 70 } value = "#217f4a" } color { location { 45 to 53 58 to 66 } value = "#7140e2" } color { location { 71 to 82 86 to 97 } value = "#8ce4f5" } color { location { 112 to 118 135 to 141 } value = "#4aa268" } color { location { 120 to 124 129 to 133 } value = "#b22f2c" } color { location { 17 to 18 31 to 32 } value = "#dd98e1" } color { location { 23 to 26 } value = "#6c1c32" } color { location { 43 to 44 67 to 68 } value = "#ba7fd0" } color { location { 54 to 57 } value = "#f412d0" } color { location { 83 to 85 } value = "#9344cb" } color { location { 119 to 119 134 to 134 } value = "#d8e3a7" } color { location { 125 to 128 } value = "#b0a485" } color { location { 1 to 10 } value = "#dd766d" } color { location { 39 to 40 } value = "#8c219f" } color { location { 98 to 111 } value = "#aaf640" } } }
0
Kotlin
0
0
3016050675602d506a0e308f07d071abf1524b67
2,583
Rfam-for-RNArtist
MIT License
src/main/kotlin/ee/leola/kassa/models/Product.kt
v3rm0n
5,783,042
false
{"Pug": 30447, "Kotlin": 24576, "JavaScript": 23847, "Shell": 700, "CSS": 569, "Jinja": 321}
package ee.leola.kassa.models import jakarta.persistence.Entity import jakarta.validation.constraints.NotNull import java.math.BigDecimal @Entity class Product( var name: @NotNull String, var price: @NotNull BigDecimal = BigDecimal.ZERO, var quantity: Int, ) : Model() { fun incrementQuantity(increment: Int): Product { quantity += increment return this } }
5
Pug
2
2
ddafcf2afa20e797324f1b09441a1a8598348f50
396
fratpos
MIT License
livemap-demo/src/jvmBrowserMain/kotlin/livemap/demo/EmptyLiveMapDemoBrowser.kt
tchigher
229,856,588
true
{"Kotlin": 4345032, "Python": 257583, "CSS": 1842, "C": 1638, "Shell": 1590, "JavaScript": 1584}
/* * Copyright (c) 2019. JetBrains s.r.o. * Use of this source code is governed by the MIT license that can be found in the LICENSE file. */ package jetbrains.livemap.demo import jetbrains.livemap.demo.BrowserDemoUtil.BASE_MAPPER_LIBS import jetbrains.livemap.demo.BrowserDemoUtil.DEMO_COMMON_LIBS import jetbrains.livemap.demo.BrowserDemoUtil.KOTLIN_LIBS import jetbrains.livemap.demo.BrowserDemoUtil.PLOT_LIBS import jetbrains.livemap.demo.BrowserDemoUtil.mapperDemoHtml private const val DEMO_PROJECT = "livemap-demo" private const val CALL_FUN = "jetbrains.livemap.demo.emptyLiveMapDemo" private val LIBS = KOTLIN_LIBS + BASE_MAPPER_LIBS + PLOT_LIBS + DEMO_COMMON_LIBS fun main() { BrowserDemoUtil.openInBrowser(DEMO_PROJECT) { mapperDemoHtml(DEMO_PROJECT, CALL_FUN, LIBS, "Simple map Demo") } }
0
null
0
0
f6fd07e9f44c789206a720dcf213d0202392976f
823
lets-plot
MIT License
shared/src/commonMain/kotlin/ui/mainUI/splash/SplashScreen.kt
erenalpaslan
697,706,268
false
{"Kotlin": 8920, "Swift": 632, "Shell": 228}
package ui.mainUI.splash import androidx.compose.foundation.Image import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding import androidx.compose.material3.Scaffold import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import cafe.adriel.voyager.core.screen.Screen import common.BaseScreen import common.resources.Icons import org.jetbrains.compose.resources.ExperimentalResourceApi import org.jetbrains.compose.resources.painterResource import org.koin.core.component.get /** * Created by erenalpaslan on 30.09.2023 */ class SplashScreen(): BaseScreen<SplashViewModel>() { override val viewModel: SplashViewModel = get() @OptIn(ExperimentalResourceApi::class) @Composable override fun Screen() { Scaffold { Column(modifier = Modifier .fillMaxSize() .padding(it), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.Center ) { Image(painterResource(Icons.Default), null) } } } }
0
Kotlin
0
0
79d15cd036531b230e7dad898eb14f88cd4ce1a1
1,285
Fusion
Apache License 2.0
app/src/main/java/org/simple/clinic/scanid/QRCodeJsonParser.kt
simpledotorg
132,515,649
false
{"Kotlin": 6129044, "Shell": 1660, "HTML": 545}
package org.simple.clinic.scanid import com.squareup.moshi.Moshi import javax.inject.Inject class QRCodeJsonParser @Inject constructor( moshi: Moshi ) { private val adapter = moshi.adapter(IndiaNHIDInfoPayload::class.java) fun parseQRCodeJson(text: String): IndiaNHIDInfoPayload? { return adapter.fromJson(text) } }
13
Kotlin
73
236
ff699800fbe1bea2ed0492df484777e583c53714
333
simple-android
MIT License
tangem-demo/src/main/java/com/tangem/tangemtest/_arch/structure/abstraction/ModelConverter.kt
byennen
259,809,719
true
{"Kotlin": 449827}
package com.tangem.tangemtest._arch.structure.abstraction import ru.dev.gbixahue.eu4d.lib.kotlin.common.Converter /** * Created by Anton Zhilenkov on 03/04/2020. */ interface DefaultConverter<A, B> { fun convert(from: A, default: B): B } interface ItemsToModel<M> : DefaultConverter<List<Item>, M> interface ModelToItems<M> : Converter<M, List<Item>> interface ModelConverter<M> : DefaultConverter<List<Item>, M>, Converter<M, List<Item>>
0
null
0
1
92e1f653522aefde668fdc100230d62492487182
448
tangem-sdk-android
MIT License
core/core/src/jvmMain/kotlin/zakadabar/core/business/EntityBusinessLogicBase.kt
spxbhuhb
290,390,793
false
null
/* * Copyright © 2020-2021, <NAME> and contributors. Use of this source code is governed by the Apache 2.0 license. */ package zakadabar.core.business import zakadabar.core.route.RoutedModule import zakadabar.core.data.EntityBo import zakadabar.core.data.EntityBoCompanion import kotlin.reflect.KClass import kotlin.reflect.full.companionObject abstract class EntityBusinessLogicBase<T : EntityBo<T>>( boClass: KClass<T> ): EntityBusinessLogicCommon<T>( boClass ), RoutedModule { override val namespace: String get() = (boClass.companionObject !!.objectInstance as EntityBoCompanion<*>).boNamespace }
12
Kotlin
3
24
2e0d94b6a77f79566c6cf0d0cff17b3ba6a9c6a1
626
zakadabar-stack
Apache License 2.0
src/main/kotlin/daikon/core/DummyRouteAction.kt
DaikonWeb
247,061,074
false
null
package daikon.core class DummyRouteAction(private val action: (Request, Response) -> Unit) : RouteAction { override fun handle(request: Request, response: Response, context: Context) { action.invoke(request, response) } } class ContextRouteAction(private val action: (Request, Response, Context) -> Unit) : RouteAction { override fun handle(request: Request, response: Response, context: Context) { action.invoke(request, response, context) } }
0
Kotlin
0
2
8b7ade032749d7cc99bf0922e613cc885a05de5e
479
daikon-core
Apache License 2.0
tokisaki-server/src/main/kotlin/io/micro/server/dict/domain/repository/ISystemDictRepository.kt
spcookie
730,690,607
false
{"Kotlin": 205742, "Java": 19768}
package io.micro.server.dict.domain.repository import io.micro.server.dict.domain.model.entity.SystemDictDO import io.quarkus.panache.common.Page import io.smallrye.mutiny.Uni interface ISystemDictRepository { fun findSystemDictPage(page: Page): Uni<List<SystemDictDO>> fun countSystemDictPage(): Uni<Long> fun findById(id: Long): Uni<SystemDictDO> fun updateById(systemDictDO: SystemDictDO): Uni<SystemDictDO> fun save(systemDictDO: SystemDictDO): Uni<SystemDictDO> fun findByKey(key: String): Uni<SystemDictDO> }
0
Kotlin
0
0
35722cd0014cd13f336fb86949326171061f51ee
547
Tokisaki
Apache License 2.0