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
buildSrc/src/main/java/AppSettings.kt
YuanLiou
111,275,765
false
{"Kotlin": 199712, "Shell": 1384}
object AppSettings { const val VERSION_CODE = 1922210103 const val VERSION_NAME = "2.1.2" const val COMPILE_SDK_VERSION = 34 const val MIN_SDK_VERSION = 23 const val TARGET_SDK_VERSION = 34 }
0
Kotlin
4
40
d767ad0d5b778b14fc68809e265bec5633b2aaed
211
TaiwanEbookSearch
MIT License
src/main/kotlin/me/elgregos/reakteves/domain/EventVersionException.kt
GregoryBevan
414,496,977
false
null
package me.elgregos.reakteves.domain import org.springframework.http.HttpStatus class EventVersionException(message: String, httpStatus: HttpStatus = HttpStatus.BAD_REQUEST): Exception(message)
10
Kotlin
0
1
938b9ab010a010da28a423921ccbe63d4a5dca87
195
reakt-eves
MIT License
app/src/main/java/com/aposiamp/smartliving/data/repository/RoomRepositoryImpl.kt
ApostolisSiampanis
783,913,411
false
{"Kotlin": 490999}
package com.aposiamp.smartliving.data.repository import com.aposiamp.smartliving.data.model.RoomDataDTO import com.aposiamp.smartliving.data.source.remote.FirebaseDataSource import com.aposiamp.smartliving.domain.repository.RoomRepository class RoomRepositoryImpl( private val firebaseDataSource: FirebaseDataSource ) : RoomRepository { override suspend fun setRoomData(userId: String, spaceId: String, roomDataDTO: RoomDataDTO) { firebaseDataSource.setRoomData(userId, spaceId, roomDataDTO) } override suspend fun getRoomList(userId: String, spaceId: String): List<RoomDataDTO>? { return firebaseDataSource.getRoomList(userId, spaceId) } override suspend fun checkIfAnyRoomExists(userId: String, spaceId: String): Boolean { return firebaseDataSource.checkIfAnyRoomExists(userId, spaceId) } }
0
Kotlin
0
3
8184e402e0121dba16a08675395184bd5413f20f
848
Smart_Living
MIT License
src/test/kotlin/com/goulash/core/ActivityManagerTest.kt
Goulash-Engine
515,495,249
false
null
package com.goulash.core import assertk.assertThat import assertk.assertions.isEqualTo import assertk.assertions.isNotNull import assertk.assertions.isTrue import com.goulash.core.activity.Activity import com.goulash.core.domain.Actor import com.goulash.core.extension.toDuration import io.mockk.every import io.mockk.mockk import org.junit.jupiter.api.Test internal class ActivityManagerTest { private val activityManager: ActivityManager = ActivityManager() @Test fun `should set abort state for activity`() { val actor: Actor = mockk(relaxed = true) val activity: Activity = mockk(relaxed = true) every { activity.duration() } returns 10.0.toDuration() activityManager.setActivity(actor, activity) activityManager.abortActivity(actor) val aborted = activityManager.isAborted(actor) assertThat(aborted).isTrue() } @Test fun `should count down duration of activity`() { val actor: Actor = mockk(relaxed = true) val activity: Activity = mockk(relaxed = true) every { activity.duration() } returns 10.0.toDuration() activityManager.setActivity(actor, activity) activityManager.countDown(actor) val duration = activityManager.getDuration(actor) assertThat(duration).isEqualTo(9.0) } @Test fun `should set duration of set activity`() { val actor: Actor = mockk(relaxed = true) val activity: Activity = mockk(relaxed = true) every { activity.duration() } returns 10.0.toDuration() activityManager.setActivity(actor, activity) val duration = activityManager.getDuration(actor) assertThat(duration).isEqualTo(10.0) } @Test fun `should set and retrieve an actor activity`() { val actor: Actor = mockk(relaxed = true) val activity: Activity = mockk(relaxed = true) activityManager.setActivity(actor, activity) val actual = activityManager.getActivity(actor) assertThat(actual).isNotNull() assertThat(actual).isEqualTo(activity) } }
3
Kotlin
0
0
66d18491e99b3316acb52192cdbabbab489cb588
2,099
goulash-engine
MIT License
app/src/main/java/com/jpb/scratchtappy/ui/home/HomeFragment.kt
jpbandroid
462,414,361
false
{"Kotlin": 128048, "C++": 6528, "Java": 3694, "CMake": 2010, "C": 153}
package com.jpb.scratchtappy.ui.home import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.Button import android.widget.TextView import androidx.fragment.app.Fragment import androidx.lifecycle.Observer import androidx.lifecycle.ViewModelProvider import com.google.android.material.floatingactionbutton.FloatingActionButton import com.google.android.material.snackbar.Snackbar import com.jpb.scratchtappy.R class HomeFragment : Fragment() { private lateinit var homeViewModel: HomeViewModel var tap = 0 override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? ): View? { homeViewModel = ViewModelProvider(this).get(HomeViewModel::class.java) val root = inflater.inflate(R.layout.fragment_home, container, false) homeViewModel.text.observe(viewLifecycleOwner, Observer { }) val but = root.findViewById<View>(R.id.button) as Button val text = root.findViewById<View>(R.id.text3) as TextView but.setOnClickListener { tap++ text.setText(tap.toString()) } return root } }
5
Kotlin
0
1
953017a381bd0d908c4b675fb3adeef0483a0e9a
1,182
ScratchTappy
Apache License 2.0
design/src/main/kotlin/com/kotlinground/design/behavioralpatterns/visitor/shapes/Circle.kt
BrianLusina
113,182,832
false
null
package com.kotlinground.design.behavioralpatterns.visitor.shapes class Circle(val id: Int, val x: Int, val y: Int, val radius: Int) : Shape { override fun move(x: Int, y: Int) { TODO("Not yet implemented") } override fun draw() { TODO("Not yet implemented") } override fun accept(visitor: Visitor): String { return visitor.visitCircle(this) } }
0
Kotlin
1
2
abf4ff467a7ffe8bdac4ac5a846c56a6e797be44
397
KotlinGround
MIT License
src/main/kotlin/enumstorage/master/MasterMessage.kt
BAC2-Graf-Rohatynski
208,084,369
false
null
package enumstorage.master enum class MasterMessage { Message, Timestamp }
0
Kotlin
0
0
cdbd49c5f2977be5a53ef2c2b29fadd7aaa0c3dc
83
EnumStorage
MIT License
src/main/kotlin/com/slackow/func/parser/value/Value.kt
Slackow
308,636,638
false
null
package com.slackow.func.parser.value abstract class Value(open val type: Type?) { open val properties: MutableMap<String, Value?> = HashMap() open fun toJsonValue(): String = throw UnsupportedOperationException() open val canChangeProperties: Boolean get() { val currentType = type return currentType != null && currentType.canChangeProperties } }
0
Kotlin
0
1
f9c54261f1d3ec0c6892ad19cf3b269ccc8d74f8
403
FuncPlugin
MIT License
src/main/kotlin/edu/team449/WPIConstructors.kt
ysthakur
239,231,347
false
null
package edu.team449 /** * TODO Use this for actual typechecking and stuff * A map where the keys are the (qualified) names of WPI classes * and the values are the names of the parameters to those classes' * constructors. */ val wpiCtors = mapOf<String, List<Pair<String, String?>>>( /*"edu.wpi.first.wpilibj2.command.SequentialCommandGroup" to listOf( "requiredSubsystems" to "edu.wpi.first.wpilibj2.command.Subsystem", "commands" to "List<edu.wpi.first.wpilibj2.command.Command>" ), "edu.wpi.first.wpilibj.geometry.Rotation2d" to listOf( "radians" to null )*/ )
0
Kotlin
0
0
f3bd06e079948f0e28315ca9278803a22afeb1b2
588
YamlPlugin
MIT License
src/main/kotlin/edu/team449/WPIConstructors.kt
ysthakur
239,231,347
false
null
package edu.team449 /** * TODO Use this for actual typechecking and stuff * A map where the keys are the (qualified) names of WPI classes * and the values are the names of the parameters to those classes' * constructors. */ val wpiCtors = mapOf<String, List<Pair<String, String?>>>( /*"edu.wpi.first.wpilibj2.command.SequentialCommandGroup" to listOf( "requiredSubsystems" to "edu.wpi.first.wpilibj2.command.Subsystem", "commands" to "List<edu.wpi.first.wpilibj2.command.Command>" ), "edu.wpi.first.wpilibj.geometry.Rotation2d" to listOf( "radians" to null )*/ )
0
Kotlin
0
0
f3bd06e079948f0e28315ca9278803a22afeb1b2
588
YamlPlugin
MIT License
shared/src/commonMain/kotlin/ui/BirdsViewModel.kt
alinbabu2010
677,614,271
false
null
package ui import data.repos.BirdsImagesRepository import data.repos.BirdsRepository import dev.icerock.moko.mvvm.viewmodel.ViewModel import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.flow.update import kotlinx.coroutines.launch class BirdsViewModel( private val birdsRepository: BirdsRepository = BirdsImagesRepository() ) : ViewModel() { private val _uiState = MutableStateFlow(BirdsUiState()) val uiState = _uiState.asStateFlow() init { updateImages() } fun selectCategory(category: String){ _uiState.update { it.copy(selectedCategory = category) } } private fun updateImages() { viewModelScope.launch { val images = birdsRepository.getImages() _uiState.update { it.copy(images = images) } } } override fun onCleared() { birdsRepository.closeConnection() } }
0
Kotlin
0
0
362d444652cdb7f3e20f7aba18af621d874d323c
992
BirdsApp
Apache License 2.0
libs/project/SDK/Umeng/src/main/java/com/hl/umeng/sdk/SharePlatformParam.kt
Heart-Beats
473,996,742
false
{"Kotlin": 1386641, "Java": 40623, "HTML": 2897, "AIDL": 1581}
package com.hl.umeng.sdk import com.umeng.socialize.bean.SHARE_MEDIA /** * @author 张磊 on 2022/06/14 at 22:05 * Email: [email protected] */ data class SharePlatformParam( /** * 标题 */ var title: String = "", /** * 描述 */ var description: String = "", /** * 链接 */ var link: String = "", /** * 封面图 */ var coverUrl: String = "", /** * 分享平台 */ var platform: SHARE_MEDIA = SHARE_MEDIA.WEIXIN, /** * 分享平台集合, 供分享面板使用 */ var sharePlatforms: List<SHARE_MEDIA> = listOf(SHARE_MEDIA.WEIXIN) )
1
Kotlin
2
2
3f4fded14746e7aecc5b5625e3b824ab728a865e
527
BaseProject
Apache License 2.0
test_runner/src/main/kotlin/ftl/adapter/GcStorageDownload.kt
Flank
84,221,974
false
{"Kotlin": 1748173, "Java": 101254, "Swift": 41229, "Shell": 10674, "Objective-C": 10006, "Dart": 9705, "HTML": 7235, "Gherkin": 4210, "TypeScript": 2717, "Ruby": 2272, "JavaScript": 1764, "SCSS": 1365, "Batchfile": 1183, "EJS": 1061, "Go": 159}
package ftl.adapter import ftl.adapter.google.toApiModel import ftl.api.FileReference import ftl.client.google.fileReferenceDownload object GcStorageDownload : FileReference.Download, (FileReference, Boolean, Boolean) -> FileReference by { fileReference, ifNeeded, ignoreErrors -> fileReferenceDownload(fileReference, ifNeeded, ignoreErrors).toApiModel(fileReference) }
64
Kotlin
115
676
b40904b4e74a670cf72ee53dc666fc3a801e7a95
392
flank
Apache License 2.0
src/test/kotlin/com/cultureamp/eventsourcing/AggregateTest.kt
cultureamp
252,301,864
false
{"Kotlin": 213724, "Java": 2634, "Shell": 1465}
package com.cultureamp.eventsourcing import com.cultureamp.eventsourcing.example.ParticipantAggregate import com.cultureamp.eventsourcing.example.SimpleThingAggregate import com.cultureamp.eventsourcing.example.ThingAggregate import io.kotest.core.spec.style.DescribeSpec import io.kotest.matchers.shouldBe class AggregateTest : DescribeSpec({ describe("aggregateType") { it("interface-based AggregateConstructors have a sane default aggregateType") { SimpleThingAggregate.aggregateType() shouldBe "SimpleThingAggregate" } it("interface-based AggregateConstructors can have a custom aggregateType") { ThingAggregate.aggregateType() shouldBe "thing" } it("function-based AggregateConstructors have a sane default aggregateType") { val aggregateConstructor = AggregateConstructor.from( ParticipantAggregate.Companion::create, ParticipantAggregate::update, ParticipantAggregate.Companion::created, ParticipantAggregate::updated ) aggregateConstructor.aggregateType() shouldBe "ParticipantAggregate" } it("function-based AggregateConstructors can have a custom aggregateType") { val aggregateConstructor = AggregateConstructor.from( ParticipantAggregate.Companion::create, ParticipantAggregate::update, ParticipantAggregate.Companion::created, ParticipantAggregate::updated ) { "participant" } aggregateConstructor.aggregateType() shouldBe "participant" } it("stateless function-based AggregateConstructors have a sane default aggregateType") { val aggregateConstructor = AggregateConstructor.fromStateless( PaymentSagaAggregate::create, PaymentSagaAggregate::update, PaymentSagaAggregate ) aggregateConstructor.aggregateType() shouldBe "PaymentSagaAggregate" } it("stateless function-based AggregateConstructors can have a custom aggregateType") { val aggregateConstructor = AggregateConstructor.fromStateless( PaymentSagaAggregate::create, PaymentSagaAggregate::update, PaymentSagaAggregate ) { "paymentSaga" } aggregateConstructor.aggregateType() shouldBe "paymentSaga" } } })
3
Kotlin
6
53
3b71cd86f075e2d7c124d9706698cacc559f9db5
2,479
kestrel
Apache License 2.0
src/test/kotlin/ExampleTest.kt
UnknownJoe796
204,261,139
false
null
package com.test import org.junit.Test class ExampleTest { @Test fun works() { } }
8
Kotlin
1
3
d84441bd532a44499813d0e2ef492ca8c58f133f
97
skate
Apache License 2.0
src/main/kotlin/com/intworkers/application/model/auditing/Auditable.kt
bw-international-school-social-worker
193,161,657
false
null
package com.intworkers.application.model.auditing import com.fasterxml.jackson.annotation.JsonIgnore import io.swagger.annotations.ApiModelProperty import org.springframework.data.annotation.CreatedBy import org.springframework.data.annotation.CreatedDate import org.springframework.data.annotation.LastModifiedBy import org.springframework.data.annotation.LastModifiedDate import org.springframework.data.jpa.domain.support.AuditingEntityListener import java.util.* import javax.persistence.EntityListeners import javax.persistence.MappedSuperclass import javax.persistence.Temporal import javax.persistence.TemporalType @MappedSuperclass @EntityListeners(AuditingEntityListener::class) abstract class Auditable { @ApiModelProperty(name = "createdBy", value = "What the table item was created by", required = false, example = "SYSTEM") @CreatedBy @JsonIgnore protected var createdBy: String? = null @ApiModelProperty(name = "createdDate", value = "Date and time the table item was created at", required = false) @CreatedDate @Temporal(TemporalType.TIMESTAMP) @JsonIgnore protected var createdDate: Date? = null @ApiModelProperty(name = "lastModifiedBy", value = "What the table item was last modified by", required = false, example = "SYSTEM") @LastModifiedBy @JsonIgnore protected var lastModifiedBy: String? = null @ApiModelProperty(name = "lastModifiedDate", value = "When the table item was last modified", required = false) @LastModifiedDate @Temporal(TemporalType.TIMESTAMP) @JsonIgnore protected var lastModifiedDate: Date? = null }
1
Kotlin
2
0
eb876f9862af3b1731788e67952f05850ce96304
1,667
international-school-socialworker-BE
MIT License
straight/src/commonMain/kotlin/me/localx/icons/straight/filled/Percent40.kt
localhostov
808,861,591
false
{"Kotlin": 79430321, "HTML": 331, "CSS": 102}
package me.localx.icons.straight.filled import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.PathFillType.Companion.NonZero import androidx.compose.ui.graphics.SolidColor import androidx.compose.ui.graphics.StrokeCap.Companion.Butt import androidx.compose.ui.graphics.StrokeJoin.Companion.Miter import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.graphics.vector.ImageVector.Builder import androidx.compose.ui.graphics.vector.path import androidx.compose.ui.unit.dp import me.localx.icons.straight.Icons public val Icons.Filled.Percent40: ImageVector get() { if (_percent40 != null) { return _percent40!! } _percent40 = Builder(name = "Percent40", defaultWidth = 24.0.dp, defaultHeight = 24.0.dp, viewportWidth = 24.0f, viewportHeight = 24.0f).apply { path(fill = SolidColor(Color(0xFF000000)), stroke = null, strokeLineWidth = 0.0f, strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = 4.0f, pathFillType = NonZero) { moveToRelative(12.0f, 0.0f) curveTo(5.373f, 0.0f, 0.0f, 5.373f, 0.0f, 12.0f) reflectiveCurveToRelative(5.373f, 12.0f, 12.0f, 12.0f) reflectiveCurveToRelative(12.0f, -5.373f, 12.0f, -12.0f) reflectiveCurveTo(18.627f, 0.0f, 12.0f, 0.0f) close() moveTo(16.25f, 7.981f) curveToRelative(0.69f, 0.0f, 1.25f, 0.56f, 1.25f, 1.25f) reflectiveCurveToRelative(-0.56f, 1.25f, -1.25f, 1.25f) reflectiveCurveToRelative(-1.25f, -0.56f, -1.25f, -1.25f) reflectiveCurveToRelative(0.56f, -1.25f, 1.25f, -1.25f) close() moveTo(8.0f, 16.0f) horizontalLineToRelative(-1.6f) verticalLineToRelative(-2.0f) horizontalLineToRelative(-1.601f) curveToRelative(-0.993f, 0.0f, -1.8f, -0.807f, -1.8f, -1.8f) verticalLineToRelative(-4.2f) horizontalLineToRelative(1.6f) verticalLineToRelative(4.2f) curveToRelative(0.0f, 0.11f, 0.09f, 0.2f, 0.2f, 0.2f) horizontalLineToRelative(1.601f) verticalLineToRelative(-4.4f) horizontalLineToRelative(1.6f) verticalLineToRelative(8.0f) close() moveTo(14.0f, 13.5f) curveToRelative(0.0f, 1.381f, -1.119f, 2.5f, -2.5f, 2.5f) reflectiveCurveToRelative(-2.5f, -1.119f, -2.5f, -2.5f) verticalLineToRelative(-3.0f) curveToRelative(0.0f, -1.381f, 1.119f, -2.5f, 2.5f, -2.5f) reflectiveCurveToRelative(2.5f, 1.119f, 2.5f, 2.5f) verticalLineToRelative(3.0f) close() moveTo(14.867f, 15.981f) lineToRelative(5.222f, -8.0f) horizontalLineToRelative(1.911f) lineToRelative(-5.222f, 8.0f) horizontalLineToRelative(-1.911f) close() moveTo(20.75f, 15.981f) curveToRelative(-0.69f, 0.0f, -1.25f, -0.56f, -1.25f, -1.25f) reflectiveCurveToRelative(0.56f, -1.25f, 1.25f, -1.25f) reflectiveCurveToRelative(1.25f, 0.56f, 1.25f, 1.25f) reflectiveCurveToRelative(-0.56f, 1.25f, -1.25f, 1.25f) close() moveTo(12.4f, 10.5f) verticalLineToRelative(3.0f) curveToRelative(0.0f, 0.496f, -0.404f, 0.9f, -0.9f, 0.9f) reflectiveCurveToRelative(-0.9f, -0.404f, -0.9f, -0.9f) verticalLineToRelative(-3.0f) curveToRelative(0.0f, -0.496f, 0.404f, -0.9f, 0.9f, -0.9f) reflectiveCurveToRelative(0.9f, 0.404f, 0.9f, 0.9f) close() } } .build() return _percent40!! } private var _percent40: ImageVector? = null
1
Kotlin
0
5
cbd8b510fca0e5e40e95498834f23ec73cc8f245
4,078
icons
MIT License
projects/android/eyeonit/src/main/java/io/eyeonit/eyeonit/repositories/EyesRepo.kt
isabella232
450,082,024
true
{"HTML": 5727164, "JavaScript": 39008, "CSS": 34142, "Kotlin": 29656}
package io.eyeonit.eyeonit.repositories import androidx.compose.ui.graphics.vector.ImageVector import io.eyeonit.eyeonit.data.Watchable import kotlinx.serialization.Serializable /** * Let's store the resource tenant as well... until we have a correct resource identifier * The combination of Watchable Type, Query and Account Id will auto derive that in the short term */ @Serializable data class Eye( val watchableName: String, val name: String, val query: String, val accountId: String, val resourceTenantId: String ) /** * Going to just store this in memory for now.... * Will serialize to JSON Later or to Protobufs... * * https://kotlinlang.org/docs/serialization.html * https://developer.android.com/topic/libraries/architecture/datastore#proto-datastore */ object EyesRepo { val eyes: MutableList<Eye> = ArrayList() fun addEye(eye: Eye){ eyes.add(eye); } }
1
null
0
0
72fc0dbc65df2ae3db4ab4b5c10b87949be3cf32
920
declaredaccess
MIT License
src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsinterventionsservice/jpa/repository/CaseNoteRepository.kt
ministryofjustice
312,544,431
false
{"Kotlin": 1706888, "Mustache": 5562, "Shell": 2684, "PLpgSQL": 2362, "Dockerfile": 1980}
package uk.gov.justice.digital.hmpps.hmppsinterventionsservice.jpa.repository import org.springframework.data.domain.Page import org.springframework.data.domain.Pageable import org.springframework.data.repository.PagingAndSortingRepository import uk.gov.justice.digital.hmpps.hmppsinterventionsservice.jpa.entity.CaseNote import java.util.UUID interface CaseNoteRepository : PagingAndSortingRepository<CaseNote, UUID> { fun findAllByReferralId(referralId: UUID, pageable: Pageable?): Page<CaseNote> }
8
Kotlin
1
2
ba44e866429054452016b73eb71936a61e8ca645
505
hmpps-interventions-service
MIT License
src/test/problem6/SumSquareDifferenceTest.kt
lorenzo-piersante
515,177,846
false
{"Kotlin": 15798, "Java": 4893}
package problem6 import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.Test class SumSquareDifferenceTest { @Test fun shouldSolveTheProblem() { Assertions.assertEquals(0, calculateSumSquareDifference(1)) Assertions.assertEquals(22, calculateSumSquareDifference(3)) Assertions.assertEquals(2640, calculateSumSquareDifference(10)) Assertions.assertEquals(2500166641665000, calculateSumSquareDifference(10000)) } }
0
Kotlin
0
0
6159bb49cdfe94310a34edad138de2998352f1c2
475
HackerRank-ProjectEuler
MIT License
lib/src/main/kotlin/be/zvz/klover/filter/ChannelCountPcmAudioFilter.kt
organization
673,130,266
false
null
package be.zvz.klover.filter import java.nio.ShortBuffer import kotlin.math.min /** * For short PCM buffers, guarantees that the output has the required number of channels and that no outgoing * buffer contains any partial frames. * * For example if the input is three channels, and output is two channels, then: * in [0, 1, 2, 0, 1, 2, 0, 1] out [0, 1, 0, 1] saved [0, 1] * in [2, 0, 1, 2] out [0, 1, 0, 1] saved [] * * @param inputChannels Number of input channels * @param outputChannels Number of output channels * @param downstream The next filter in line */ class ChannelCountPcmAudioFilter( private val inputChannels: Int, private val outputChannels: Int, private val downstream: UniversalPcmAudioFilter?, ) : UniversalPcmAudioFilter { private val outputBuffer: ShortBuffer = ShortBuffer.allocate(2048 * inputChannels) private val commonChannels: Int = min(outputChannels, inputChannels) private val channelsToAdd: Int = outputChannels - commonChannels private val inputSet: ShortArray = ShortArray(inputChannels) private val splitFloatOutput: Array<FloatArray> = Array(outputChannels) { FloatArray(1) } private val splitShortOutput: Array<ShortArray> = Array(outputChannels) { ShortArray(1) } private var inputIndex: Int = 0 @Throws(InterruptedException::class) override fun process(input: ShortArray, offset: Int, length: Int) { if (canPassThrough(length)) { downstream!!.process(input, offset, length) } else { if (inputChannels == 1 && outputChannels == 2) { processMonoToStereo(ShortBuffer.wrap(input, offset, length)) } else { processNormalizer(ShortBuffer.wrap(input, offset, length)) } } } @Throws(InterruptedException::class) override fun process(buffer: ShortBuffer) { if (canPassThrough(buffer.remaining())) { downstream!!.process(buffer) } else { if (inputChannels == 1 && outputChannels == 2) { processMonoToStereo(buffer) } else { processNormalizer(buffer) } } } @Throws(InterruptedException::class) private fun processNormalizer(buffer: ShortBuffer) { while (buffer.hasRemaining()) { inputSet[inputIndex++] = buffer.get() if (inputIndex == inputChannels) { outputBuffer.put(inputSet, 0, commonChannels) for (i in 0 until channelsToAdd) { outputBuffer.put(inputSet[0]) } if (!outputBuffer.hasRemaining()) { outputBuffer.flip() downstream!!.process(outputBuffer) outputBuffer.clear() } inputIndex = 0 } } } @Throws(InterruptedException::class) private fun processMonoToStereo(buffer: ShortBuffer) { while (buffer.hasRemaining()) { val sample = buffer.get() outputBuffer.put(sample) outputBuffer.put(sample) if (!outputBuffer.hasRemaining()) { outputBuffer.flip() downstream!!.process(outputBuffer) outputBuffer.clear() } } } private fun canPassThrough(length: Int): Boolean { return inputIndex == 0 && inputChannels == outputChannels && length % inputChannels == 0 } @Throws(InterruptedException::class) override fun process(input: Array<FloatArray>, offset: Int, length: Int) { if (commonChannels >= 0) System.arraycopy(input, 0, splitFloatOutput, 0, commonChannels) for (i in commonChannels until outputChannels) { splitFloatOutput[i] = input[0] } downstream!!.process(splitFloatOutput, offset, length) } @Throws(InterruptedException::class) override fun process(input: Array<ShortArray>, offset: Int, length: Int) { if (commonChannels >= 0) System.arraycopy(input, 0, splitShortOutput, 0, commonChannels) for (i in commonChannels until outputChannels) { splitShortOutput[i] = input[0] } downstream!!.process(splitShortOutput, offset, length) } override fun seekPerformed(requestedTime: Long, providedTime: Long) { outputBuffer.clear() } @Throws(InterruptedException::class) override fun flush() { // Nothing to do. } override fun close() { // Nothing to do. } }
1
Kotlin
0
2
06e801808933ff8c627543d579c4be00061eb305
4,536
Klover
Apache License 2.0
meteor-viewmodel/src/commonTest/kotlin/flow/NullableCommonFlowTest.kt
getspherelabs
646,328,849
false
null
package flow import io.spherelabs.meteorviewmodel.commonflow.NullableCommonFlow import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.test.runTest import kotlin.test.Test import kotlin.test.assertContentEquals class NullableCommonFlowTest { @Test fun `should invoke values callback with nullable value`() = runTest { val flowResult = flowOf(1, 2, 3, 4, 5, null) val commonFlow = NullableCommonFlow(flowResult) val numbers = mutableListOf<Int?>() var failure = null as Throwable? var completed = false commonFlow.bind( scope = this, values = { numbers += it }, failure = { failure = it }, completion = { completed = true } ).join() assertContentEquals(expected = listOf(1, 2, 3, 4, 5, null), actual = numbers) } }
6
Kotlin
1
9
0e6b5aecfcea88d5c6ff7070df2e0ce07edc5457
937
meteor
Apache License 2.0
chat-core/src/main/kotlin/com/demo/chat/service/security/AuthorizationService.kt
marios-code-path
181,180,043
false
{"Kotlin": 924762, "Shell": 36602, "C": 3160, "HTML": 2714, "Starlark": 278}
package com.demo.chat.service.security import com.demo.chat.domain.AuthMetadata import com.demo.chat.domain.AuthorizationRequest import com.demo.chat.domain.Key import reactor.core.publisher.Flux import reactor.core.publisher.Mono /** * A service that determines when entity given Key<T> has Authorizations [M && N] where * T = Key Type * M = Authorization Type (out bound) * N = Authorization Type (in bound) */ interface AuthorizationService<T, out M> { fun authorize(authorization: AuthMetadata<T>, exist: Boolean): Mono<Void> fun getAuthorizationsForTarget(uid: Key<T>): Flux<out M> fun getAuthorizationsForPrincipal(uid: Key<T>): Flux<out M> fun getAuthorizationsAgainst(uidA: Key<T>, uidB: Key<T>): Flux<out M> fun getAuthorizationsAgainstMany(uidA: Key<T>, uidB: List<Key<T>>): Flux<out M> }
2
Kotlin
1
9
2ae59375cd44e8fb58093b0f24596fc3111fd447
826
demo-chat
MIT License
fluent-icons-extended/src/commonMain/kotlin/com/konyaco/fluent/icons/regular/TableResizeRow.kt
Konyaco
574,321,009
false
null
package com.konyaco.fluent.icons.regular import androidx.compose.ui.graphics.vector.ImageVector import com.konyaco.fluent.icons.Icons import com.konyaco.fluent.icons.fluentIcon import com.konyaco.fluent.icons.fluentPath public val Icons.Regular.TableResizeRow: ImageVector get() { if (_tableResizeRow != null) { return _tableResizeRow!! } _tableResizeRow = fluentIcon(name = "Regular.TableResizeRow") { fluentPath { moveTo(12.75f, 15.58f) lineTo(12.75f, 8.42f) lineToRelative(1.0f, 0.9f) arcToRelative(0.75f, 0.75f, 0.0f, false, false, 1.0f, -1.13f) lineToRelative(-2.25f, -2.0f) arcToRelative(0.75f, 0.75f, 0.0f, false, false, -1.0f, 0.0f) lineToRelative(-2.25f, 2.0f) arcToRelative(0.75f, 0.75f, 0.0f, true, false, 1.0f, 1.12f) lineToRelative(1.0f, -0.89f) verticalLineToRelative(7.16f) lineToRelative(-1.0f, -0.89f) arcToRelative(0.75f, 0.75f, 0.0f, true, false, -1.0f, 1.12f) lineToRelative(2.25f, 2.0f) lineToRelative(0.01f, 0.01f) arcToRelative(0.75f, 0.75f, 0.0f, false, false, 1.0f, -0.01f) lineToRelative(2.24f, -2.0f) arcToRelative(0.75f, 0.75f, 0.0f, false, false, -1.0f, -1.12f) lineToRelative(-1.0f, 0.89f) close() moveTo(17.75f, 21.0f) curveToRelative(1.8f, 0.0f, 3.25f, -1.46f, 3.25f, -3.25f) lineTo(21.0f, 6.25f) curveTo(21.0f, 4.45f, 19.54f, 3.0f, 17.75f, 3.0f) lineTo(6.25f, 3.0f) arcTo(3.25f, 3.25f, 0.0f, false, false, 3.0f, 6.25f) verticalLineToRelative(11.5f) curveTo(3.0f, 19.55f, 4.46f, 21.0f, 6.25f, 21.0f) horizontalLineToRelative(11.5f) close() moveTo(19.5f, 17.75f) curveToRelative(0.0f, 0.97f, -0.78f, 1.75f, -1.75f, 1.75f) lineTo(6.25f, 19.5f) curveToRelative(-0.97f, 0.0f, -1.75f, -0.78f, -1.75f, -1.75f) verticalLineToRelative(-0.25f) horizontalLineToRelative(5.15f) lineToRelative(-1.06f, -0.94f) arcToRelative(1.75f, 1.75f, 0.0f, false, true, -0.42f, -0.56f) lineTo(4.5f, 16.0f) lineTo(4.5f, 8.0f) horizontalLineToRelative(3.67f) curveToRelative(0.1f, -0.2f, 0.24f, -0.4f, 0.42f, -0.56f) lineToRelative(1.06f, -0.94f) lineTo(4.5f, 6.5f) verticalLineToRelative(-0.25f) curveToRelative(0.0f, -0.97f, 0.78f, -1.75f, 1.75f, -1.75f) horizontalLineToRelative(11.5f) curveToRelative(0.97f, 0.0f, 1.75f, 0.78f, 1.75f, 1.75f) verticalLineToRelative(0.25f) horizontalLineToRelative(-5.15f) lineToRelative(1.06f, 0.94f) curveToRelative(0.18f, 0.16f, 0.32f, 0.35f, 0.42f, 0.56f) horizontalLineToRelative(3.67f) verticalLineToRelative(8.0f) horizontalLineToRelative(-3.67f) curveToRelative(-0.1f, 0.2f, -0.24f, 0.4f, -0.42f, 0.56f) lineToRelative(-1.06f, 0.94f) horizontalLineToRelative(5.15f) verticalLineToRelative(0.25f) close() } } return _tableResizeRow!! } private var _tableResizeRow: ImageVector? = null
1
Kotlin
3
83
9e86d93bf1f9ca63a93a913c990e95f13d8ede5a
3,666
compose-fluent-ui
Apache License 2.0
src/main/kotlin/uk/gov/justice/digital/hmpps/nomisprisonerapi/visits/VisitFilter.kt
ministryofjustice
444,895,409
false
{"Kotlin": 2500624, "PLSQL": 299943, "Dockerfile": 1112}
package uk.gov.justice.digital.hmpps.nomisprisonerapi.visits import io.swagger.v3.oas.annotations.media.Schema import java.time.LocalDateTime data class VisitFilter( @Schema(description = "List of prison Ids (AKA Agency Ids) to migrate visits from", example = "MDI") val prisonIds: List<String>, @Schema( description = "Visit types to include", example = "SCON", allowableValues = ["SCON", "OFFI"], ) val visitTypes: List<String>, @Schema( description = "Only include visits created before this date. NB this is creation date not the actual visit date", example = "2020-03-24T12:00:00", ) val toDateTime: LocalDateTime?, @Schema( description = "Only include visits created after this date. NB this is creation date not the actual visit date", example = "2020-03-23T12:00:00", ) val fromDateTime: LocalDateTime?, @Schema( description = "if true only include visits that are after today", example = "true", ) val futureVisits: Boolean? = false, @Schema( description = "if true exclude erroneous visits ( determined by visit date being more than 1 year in the future )", example = "true", ) val excludeExtremeFutureDates: Boolean? = false, )
0
Kotlin
1
0
03f9643b2e25a42717cd56a469ee0959a7b554dc
1,222
hmpps-nomis-prisoner-api
MIT License
app/src/main/java/com/daisydev/daisy/ui/compose/sintomas/SintomasScreen.kt
axlserial
643,653,441
false
null
package com.daisydev.daisy.ui.compose.sintomas import android.graphics.Rect import android.view.ViewTreeObserver import androidx.compose.foundation.Image import androidx.compose.foundation.OverscrollEffect import androidx.compose.foundation.background import androidx.compose.foundation.border import androidx.compose.foundation.gestures.Orientation import androidx.compose.foundation.gestures.scrollable import androidx.compose.foundation.interaction.MutableInteractionSource import androidx.compose.foundation.interaction.collectIsPressedAsState import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.width import androidx.compose.foundation.layout.wrapContentSize import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.CornerSize import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.text.BasicTextField import androidx.compose.foundation.text.KeyboardActions import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Search import androidx.compose.material3.ButtonDefaults import androidx.compose.material3.CircularProgressIndicator import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Icon import androidx.compose.material3.IconButton import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Surface import androidx.compose.material3.Text import androidx.compose.material3.TextField import androidx.compose.material3.TextFieldDefaults import androidx.compose.runtime.Composable import androidx.compose.runtime.DisposableEffect import androidx.compose.runtime.State import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.focus.FocusRequester import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.RectangleShape import androidx.compose.ui.input.key.KeyEvent import androidx.compose.ui.input.key.KeyEventType import androidx.compose.ui.input.key.onKeyEvent import androidx.compose.ui.platform.LocalSoftwareKeyboardController import androidx.compose.ui.platform.LocalView import androidx.compose.ui.res.painterResource import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import androidx.lifecycle.viewmodel.compose.viewModel import androidx.navigation.NavController import com.daisydev.daisy.R data class Message(val name: String, val body: String) @OptIn(ExperimentalMaterial3Api::class, ExperimentalComposeUiApi::class) @Composable fun SintomasScreen(navController: NavController) { val viewModel = viewModel<MainViewModel>() val searchText by viewModel.searchText.collectAsState() val sintomas by viewModel.sintomas.collectAsState() val isSearching by viewModel.isSearching.collectAsState() val keyboardController = LocalSoftwareKeyboardController.current val isKeyboardOpen by keyboardAsState() Column( modifier = Modifier .fillMaxSize() .wrapContentSize(Alignment.TopCenter) ) { Spacer(modifier = Modifier.height(24.dp)) // Sección del buscador Box( modifier = Modifier .border(1.5.dp, MaterialTheme.colorScheme.secondary, CircleShape) .width(350.dp) .wrapContentSize(Alignment.TopCenter) .align(Alignment.CenterHorizontally) .background(MaterialTheme.colorScheme.outlineVariant, CircleShape), ) { TextField( value = searchText, onValueChange = viewModel::onSearchTextChange, textStyle = TextStyle(fontSize = 17.sp), leadingIcon = { IconButton( onClick = { busqueda(searchText);keyboardController?.hide()} ) { Icon(Icons.Filled.Search, null, tint = Color.Gray) } }, modifier = Modifier .padding(11.dp) .background(Color.White, CircleShape) .fillMaxWidth(), placeholder = { Text(text = "Buscar sintomas") }, keyboardOptions = KeyboardOptions( imeAction = ImeAction.Search, keyboardType = KeyboardType.Text ), keyboardActions = KeyboardActions(onSearch = { keyboardController?.hide() busqueda(searchText) }), colors = TextFieldDefaults.textFieldColors( focusedIndicatorColor = Color.Transparent, unfocusedIndicatorColor = Color.Transparent, cursorColor = Color.Transparent, containerColor = MaterialTheme.colorScheme.outlineVariant ), maxLines = 1 ) } Spacer(modifier = Modifier.height(16.dp)) // Cuando se realiza la busqueda muestra la lista de las plantas if (isKeyboardOpen == Keyboard.Closed) { // Sección de sintomas más comunes Text( text = "Plantas más comunes", modifier = Modifier.padding(start = 16.dp), style = MaterialTheme.typography.bodyMedium ) Spacer(modifier = Modifier.height(8.dp)) //lista de elementos favoritos val SampleData: Array<Message> = arrayOf( Message( "Nombre", "Descripción " ), Message("Nombre", "Descripción"), Message("Nombre", "Descripción"), Message("Nombre", "Descripción"), Message("Nombre", "Descripción"), Message("Nombre", "Descripción"), Message("Nombre7", "Descripción"), Message("Nombre8", "Descripción") ) Conversation(messages = SampleData) Spacer(modifier = Modifier.height(-16.dp)) } if (isSearching) { LazyColumn( modifier = Modifier .fillMaxWidth() .weight(1f) .padding(16.dp) ) { // Muestra la lista de los sintomas items(sintomas) { sintoma -> Text( text = "${sintoma.sintoma}", modifier = Modifier .fillMaxWidth() .padding(vertical = 16.dp), style = MaterialTheme.typography.bodyMedium ) } } } } } enum class Keyboard { Opened, Closed } @Composable fun keyboardAsState(): State<Keyboard> { val keyboardState = remember { mutableStateOf(Keyboard.Closed) } val view = LocalView.current DisposableEffect(view) { val onGlobalListener = ViewTreeObserver.OnGlobalLayoutListener { val rect = Rect() view.getWindowVisibleDisplayFrame(rect) val screenHeight = view.rootView.height val keypadHeight = screenHeight - rect.bottom keyboardState.value = if (keypadHeight > screenHeight * 0.15) { Keyboard.Opened } else { Keyboard.Closed } } view.viewTreeObserver.addOnGlobalLayoutListener(onGlobalListener) onDispose { view.viewTreeObserver.removeOnGlobalLayoutListener(onGlobalListener) } } return keyboardState } fun busqueda(value: String) { println("busqueda $value") } @OptIn(ExperimentalComposeUiApi::class) @Composable fun MessageCard(msg: Message) { // Add padding around our message Row( modifier = Modifier .padding(all = 10.dp) .background(MaterialTheme.colorScheme.surface, shape = RoundedCornerShape(20)) .fillMaxWidth(), ) { Box( modifier = Modifier.padding(start = 20.dp) ) { Row() { Image( painter = painterResource(R.drawable.ic_daisy_bg), contentDescription = "Contact profile picture", modifier = Modifier // Set image size to 40 dp .size(50.dp) // Clip image to be shaped as a circle .clip(CircleShape) .border(1.5.dp, MaterialTheme.colorScheme.secondary, CircleShape) .align(Alignment.CenterVertically), ) // Add a horizontal space between the image and the column Spacer(modifier = Modifier.width(20.dp)) Column(modifier = Modifier.align(Alignment.CenterVertically)) { Text( text = msg.name, color = MaterialTheme.colorScheme.secondary, style = MaterialTheme.typography.headlineSmall ) // Add a vertical space between the author and message texts Spacer(modifier = Modifier.height(4.dp)) Text( text = msg.body, modifier = Modifier.padding(all = 4.dp), style = MaterialTheme.typography.bodyMedium ) } } } } } @Composable fun Conversation(messages: Array<Message>) { LazyColumn( ) { items(messages) { message -> MessageCard(message) Spacer( modifier = Modifier.height(8.dp) ) } } }
0
Kotlin
0
0
0fd254c0637ca23644bcb18036da0b40907e1690
10,839
Daisy
MIT License
src/main/kotlin/model/Action.kt
NebuPookins
370,215,596
false
null
package model sealed class Action data class UpdateCiphertextAction( val cipherText: String ) : Action() data class UpdateKeyAction( val key: String ) : Action() object IncrementSlider: Action() object DecrementSlider: Action() data class HighlightNormalizedIndex( val index: Int? ): Action()
0
Kotlin
0
0
cac76f06e7c584c2ba8c93bc9b729dff2177441d
301
vigenere-breaker
MIT License
app/src/main/java/com/avex/ragraa/ui/marks/MarksScreen.kt
avexxx3
778,981,508
false
{"Kotlin": 224969}
package com.avex.ragraa.ui.marks import android.annotation.SuppressLint import androidx.activity.compose.BackHandler import androidx.compose.animation.slideInHorizontally import androidx.compose.animation.slideOutHorizontally import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.runtime.Composable import androidx.compose.runtime.collectAsState import androidx.navigation.NavHostController import androidx.navigation.compose.NavHost import androidx.navigation.compose.composable import androidx.navigation.compose.rememberNavController import com.avex.ragraa.data.Datasource @SuppressLint("StateFlowValueCalledInComposition") @Composable fun MarksScreen( viewModel: MarksViewModel, newNavController: NavHostController = rememberNavController() ) { BackHandler { viewModel.navController.navigate("home") } val uiState = viewModel.uiState.collectAsState().value NavHost( navController = newNavController, startDestination = "marks", ) { composable("marks") { LazyColumn { item { for (course in Datasource.courses) { CourseCard(course, { newNavController.navigate("course") }) { viewModel.showCourse( it ) } } } } } composable("course", enterTransition = { slideInHorizontally(initialOffsetX = { it }) }, exitTransition = { slideOutHorizontally(targetOffsetX = { it }) }) { CourseDetails(course = uiState.currentCourse!!) { viewModel.showAttendance() } } } }
0
Kotlin
0
5
205480d7cb81bff98ba3f9c9dc2f96b3d7ba8287
1,751
Ragraa
Apache License 2.0
app/src/main/java/paging/android/example/com/pagingsample/MainActivity.kt
casolorz
197,623,635
false
null
/* * Copyright (C) 2017 The Android Open Source Project * * 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 paging.android.example.com.pagingsample import android.os.Bundle import android.util.Log import android.view.KeyEvent import android.view.inputmethod.EditorInfo import androidx.appcompat.app.AppCompatActivity import androidx.lifecycle.Observer import androidx.lifecycle.ViewModelProviders import androidx.recyclerview.widget.ItemTouchHelper import androidx.recyclerview.widget.ItemTouchHelper.ACTION_STATE_DRAG import androidx.recyclerview.widget.RecyclerView import kotlinx.android.synthetic.main.activity_main.* import java.util.concurrent.Executors /** * Shows a list of Cheeses, with swipe-to-delete, and an input field at the top to add. * <p> * Cheeses are stored in a database, so swipes and additions edit the database directly, and the UI * is updated automatically using paging components. */ class MainActivity : AppCompatActivity() { private val TAG: String = "MainActivity" private val viewModel by lazy(LazyThreadSafetyMode.NONE) { ViewModelProviders.of(this).get(CheeseViewModel::class.java) } override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) // Create adapter for the RecyclerView val adapter = CheeseAdapter() cheeseList.adapter = adapter // Subscribe the adapter to the ViewModel, so the items in the adapter are refreshed // when the list changes viewModel.allCheeses.observe(this, Observer() { Log.i(TAG, "Submit list ") adapter.submitList(it) }) initAddButtonListener() initSwipeToDeleteAndDrag(adapter) } private fun initSwipeToDeleteAndDrag(adapter: CheeseAdapter) { ItemTouchHelper(object : ItemTouchHelper.Callback() { // enable the items to swipe to the left or right override fun getMovementFlags(recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder): Int = makeMovementFlags(ItemTouchHelper.UP or ItemTouchHelper.DOWN or ItemTouchHelper.LEFT or ItemTouchHelper.RIGHT, ItemTouchHelper.LEFT or ItemTouchHelper.RIGHT) override fun onMove(recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean { val from = viewHolder.adapterPosition val to = target.adapterPosition Log.i(TAG, "swap $from:$to") val item1 = adapter.getItem(from) val item2 = adapter.getItem(to) if (item1 != null && item2 != null) { // Notify database to swap items here /* Thread(Runnable { viewModel.swap(item1,item2) }).start()*/ viewModel.swap(from, to) return true } return false } // When an item is swiped, remove the item via the view model. The list item will be // automatically removed in response, because the adapter is observing the live list. override fun onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int) { (viewHolder as CheeseViewHolder).cheese?.let { viewModel.remove(it) } } override fun onSelectedChanged(viewHolder: RecyclerView.ViewHolder?, actionState: Int) { super.onSelectedChanged(viewHolder, actionState) if (actionState == ACTION_STATE_DRAG) { viewHolder?.itemView?.alpha = 0.5f } } override fun isLongPressDragEnabled(): Boolean { // It has to be true return true } override fun clearView(recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder) { super.clearView(recyclerView, viewHolder) viewHolder.itemView.alpha = 1.0f // Don't need to do anything here } }).attachToRecyclerView(cheeseList) } private fun addCheese() { val newCheese = inputText.text.trim() if (newCheese.isNotEmpty()) { viewModel.insert(newCheese) inputText.setText("") } } private fun initAddButtonListener() { addButton.setOnClickListener { addCheese() } // when the user taps the "Done" button in the on screen keyboard, save the item. inputText.setOnEditorActionListener { _, actionId, _ -> if (actionId == EditorInfo.IME_ACTION_DONE) { addCheese() return@setOnEditorActionListener true } false // action that isn't DONE occurred - ignore } // When the user clicks on the button, or presses enter, save the item. inputText.setOnKeyListener { _, keyCode, event -> if (event.action == KeyEvent.ACTION_DOWN && keyCode == KeyEvent.KEYCODE_ENTER) { addCheese() return@setOnKeyListener true } false // event that isn't DOWN or ENTER occurred - ignore } } }
0
Kotlin
0
0
14df80a2ccb1f4cbdb15f591ad58525172aedc12
5,967
roompagingtest
Apache License 2.0
src/main/kotlin/mods/betterfoliage/client/render/RenderConnectedGrassLog.kt
Ghostlyr
54,911,434
true
{"Kotlin": 221613}
package mods.betterfoliage.client.render import mods.betterfoliage.BetterFoliageMod import mods.betterfoliage.client.config.Config import mods.octarinecore.client.render.* import net.minecraft.client.renderer.RenderBlocks import net.minecraftforge.common.util.ForgeDirection.* class RenderConnectedGrassLog : AbstractBlockRenderingHandler(BetterFoliageMod.MOD_ID) { val grassCheckDirs = listOf(EAST, WEST, NORTH, SOUTH) override fun isEligible(ctx: BlockContext) = Config.enabled && Config.roundLogs.enabled && Config.roundLogs.connectGrass && Config.blocks.dirt.matchesID(ctx.block) && Config.blocks.logs.matchesID(ctx.block(up1)) override fun render(ctx: BlockContext, parent: RenderBlocks): Boolean { val grassDir = grassCheckDirs.find { Config.blocks.grass.matchesID(ctx.block(it.offset)) } return if (grassDir != null) { ctx.withOffset(Int3.zero, grassDir.offset) { renderWorldBlockBase(parent, face = alwaysRender) } } else { renderWorldBlockBase(parent, face = alwaysRender) } } }
0
Kotlin
0
0
a5cd7c8c8052e6218fd25d3e2578a2f2c055ad8c
1,137
BetterFoliage
MIT License
kotlin-generator/src/commonMain/kotlin/com.chrynan.graphkl/kotlin/modifier/SoftKeyword.kt
chRyNaN
230,310,677
false
null
package com.chrynan.graphkl.kotlin.modifier enum class SoftKeyword(override val value: String) : Keyword { BY(value = "by"), CATCH(value = "catch"), CONSTRUCTOR(value = "constructor"), DELEGATE(value = "delegate"), DYNAMIC(value = "dynamic"), FIELD(value = "field"), FILE(value = "file"), FINALLY(value = "finally"), GET(value = "get"), IMPORT(value = "import"), INIT(value = "init"), PARAM(value = "param"), PROPERTY(value = "property"), RECEIVER(value = "receiver"), SET(value = "set"), SET_PARAM(value = "setparam"), WHERE(value = "where") }
0
Kotlin
0
2
2526cedddc0a5b5777dea0ec7fc67bc2cd16fe05
614
graphkl
Apache License 2.0
src/jvmTest/kotlin/com/durganmcbroom/artifact/resolver/test/ExceptionalTest.kt
durganmcbroom
515,613,430
false
null
package com.durganmcbroom.artifact.resolver.test import com.durganmcbroom.artifact.resolver.ArtifactMetadata import com.durganmcbroom.artifact.resolver.ArtifactException import kotlin.test.Test class ExceptionalTest { @Test fun `Test Artifact not found message`() { val ex = ArtifactException.ArtifactNotFound( object : ArtifactMetadata.Descriptor { override val name: String = "asdf" }, listOf("Maven", "More maven", "even more maven", "Hopscotch") ) println(ex.message) } }
0
Kotlin
0
1
ac390d57f5a9ce91a07b284d8e7ca1c69f86fc3a
566
artifact-resolver
MIT License
src/test/kotlin/test/tests/utils/FileHelperTest.kt
sourcerer-io
96,525,128
false
null
// Copyright 2017 Sourcerer Inc. All Rights Reserved. // Author: <NAME> (<EMAIL>) package test.tests.utils import org.jetbrains.spek.api.Spek import org.jetbrains.spek.api.dsl.given import org.jetbrains.spek.api.dsl.it import kotlin.test.assertEquals import app.utils.FileHelper.toPath import java.nio.file.Paths fun testPath(expectedPath: String, actualPath: String) { assertEquals(Paths.get(expectedPath), actualPath.toPath()) } class FileHelperTest : Spek({ given("relative path test") { it("basic") { val home = System.getProperty("user.home") testPath("/Users/user/repo", "/Users/user/repo") testPath("/Users/user/repo", "/Users/user/../user/repo/../repo") testPath("$home/test", "~/test") testPath("$home/test1", "~/test/../test1") } } })
205
Kotlin
288
6,697
af3d7737ba20ccd4734546b03defae10f6627573
837
sourcerer-app
MIT License
app/src/main/java/com/example/androiddevchallenge/CountdownManager.kt
nezih94
344,540,855
false
null
/* * Copyright 2021 The Android Open Source Project * * 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 com.example.androiddevchallenge import android.os.CountDownTimer import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import kotlinx.coroutines.delay import kotlinx.coroutines.launch import java.text.DateFormat import java.text.SimpleDateFormat import java.util.Date import java.util.Locale class CountdownManager : ViewModel() { var clockState = MutableLiveData<ClockStateInfo>(ClockStateInfo(10, 10, 10, 10, 10, 10, 10, 10, false)) var counting = MutableLiveData<Boolean>(false) var countDownTimer: CountDownTimer? = null init { viewModelScope.launch { delay(2000) updateClockState(11, 11, 11, 11, animDuration = 2000) delay(3000) updateClockState(10, 10, 10, 10, animDuration = 2000) } } fun startCountdown(millis: Long) { countDownTimer?.cancel() countDownTimer = object : CountDownTimer(millis, 1000) { override fun onTick(remainingMillis: Long) { processMillis(remainingMillis) } override fun onFinish() { counting.value = false } }.start() counting.value = true } fun stopCountdown() { countDownTimer?.cancel() counting.value = false } fun processMillis(millis: Long) { val formatter: DateFormat = SimpleDateFormat("mm:ss", Locale.US) val timeText: String = formatter.format(Date(millis)) val digit1 = timeText.get(0).toString() val digit2 = timeText.get(1).toString() val digit3 = timeText.get(3).toString() val digit4 = timeText.get(4).toString() updateClockState(digit1.toInt(), digit2.toInt(), digit3.toInt(), digit4.toInt()) } fun updateClockState( state1: Int, state2: Int, state3: Int, state4: Int, animDuration: Int = 900 ) { val currentClockState = clockState.value!! val newClockState = ClockStateInfo( o1 = currentClockState.n1, n1 = state1, o2 = currentClockState.n2, n2 = state2, o3 = currentClockState.n3, n3 = state3, o4 = currentClockState.o4, n4 = state4, animDuration = animDuration ) clockState.value = newClockState } fun stabilizeAtState(state1: Int, state2: Int, state3: Int, state4: Int) { val state = ClockStateInfo(state1, state1, state2, state2, state3, state3, state4, state4, false) clockState.value = state } override fun onCleared() { super.onCleared() countDownTimer?.cancel() } }
0
Kotlin
9
115
819bce1dd7344d428f78d903ed4a83045a66055f
3,373
chromie
Apache License 2.0
src/main/kotlin/me/codyq/spikot/extensions/MiscExtensions.kt
CatDevz
414,816,475
false
null
package me.codyq.spikot.extensions import org.bukkit.Bukkit val server get() = Bukkit.getServer() val pluginManager get() = Bukkit.getPluginManager() val worlds get() = Bukkit.getWorlds()
0
Kotlin
0
1
bfae5badf7bc0fa695a04d34623e893a9e240628
190
Spikot
MIT License
app/src/main/java/io/github/edgardobarriam/techkandroidchallenge/ui/activity/UploadActivity.kt
edgardobarriam
148,704,226
true
{"Kotlin": 34163}
package io.github.edgardobarriam.techkandroidchallenge.ui.activity import android.Manifest import android.annotation.SuppressLint import android.content.Intent import android.content.pm.PackageManager import android.graphics.Bitmap import android.os.Build import android.os.Bundle import android.provider.MediaStore import android.support.v7.app.AppCompatActivity import io.github.edgardobarriam.techkandroidchallenge.R import io.github.edgardobarriam.techkandroidchallenge.server.ImgurApiService import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.disposables.Disposable import io.reactivex.schedulers.Schedulers import kotlinx.android.synthetic.main.activity_upload.* import okhttp3.MediaType import okhttp3.MultipartBody import okhttp3.RequestBody import org.jetbrains.anko.toast import java.io.File class UploadActivity : AppCompatActivity() { private val imgurApiService by lazy { ImgurApiService.getInstance() } var disposable: Disposable? = null override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_upload) button_upload_gallery.setOnClickListener { permissionHandle() } button_upload_camera.setOnClickListener { pickImageFromCamera() } } @SuppressLint("NewApi") private fun permissionHandle() { if ( hasStoragePermission() ) { pickImageFromGallery() } else { val permission = arrayOf(Manifest.permission.READ_EXTERNAL_STORAGE) requestPermissions(permission, PERMISSION_CODE_STORAGE) } } private fun hasStoragePermission() : Boolean { return if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED } else { true } } private fun pickImageFromGallery() { val galleryIntent = Intent(Intent.ACTION_PICK) galleryIntent.type = "image/*" startActivityForResult(galleryIntent, PICK_IMAGE_FROM_GALLERY) } private fun pickImageFromCamera() { val cameraIntent = Intent(MediaStore.ACTION_IMAGE_CAPTURE) startActivityForResult(cameraIntent, TAKE_IMAGE_FROM_CAMERA) } override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { super.onActivityResult(requestCode, resultCode, data) when(requestCode) { PICK_IMAGE_FROM_GALLERY -> { val imageuri = data!!.data val imageFile = File(imageuri.path) val requestFile = RequestBody.create(MediaType.parse("image/*"), imageFile) val fileBody = MultipartBody.Part.createFormData("image", imageFile.name, requestFile) val title = RequestBody.create(MediaType.parse("text/plain"), "TitleTest") val description = RequestBody.create(MediaType.parse("text/plain"), "TestDescription") //TODO: File upload not working disposable = imgurApiService.postImage(fileBody, title, description) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe( {result -> toast("Success") }, {error -> toast(error.message!!)} ) imageView_uploaded_image.setImageURI(imageuri) } TAKE_IMAGE_FROM_CAMERA -> { //TODO: Upload from camera val selectedImage = data!!.extras.get("data") as Bitmap imageView_uploaded_image.setImageBitmap(selectedImage) } } } override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>, grantResults: IntArray) { super.onRequestPermissionsResult(requestCode, permissions, grantResults) when(requestCode) { PERMISSION_CODE_STORAGE -> if (grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED) { pickImageFromGallery() } } } companion object { const val PICK_IMAGE_FROM_GALLERY = 0 const val TAKE_IMAGE_FROM_CAMERA = 1 const val PERMISSION_CODE_STORAGE = 42 } }
0
Kotlin
0
1
abadcb984c9f2f852a7e29eca1f305403f2daf18
4,467
android-challenge
MIT License
processors/src/main/kotlin/com/alecarnevale/claymore/utils/DaggerAnnotations.kt
alecarnevale
559,250,665
false
{"Kotlin": 91465}
package com.alecarnevale.claymore.utils import com.squareup.kotlinpoet.ClassName internal val applicationContext = ClassName(packageName = "dagger.hilt.android.qualifiers", "ApplicationContext")
5
Kotlin
0
5
807822f060b71bbff410f8d3302a42f383356c48
196
claymore
Apache License 2.0
src/lib/kotlin/slatekit-common/src/main/kotlin/slatekit/common/status/RunStatusNotifier.kt
ddalex
108,861,476
true
{"Kotlin": 1461898, "Scala": 1124254, "Batchfile": 17450, "Shell": 3673, "HTML": 303, "CSS": 35, "JavaScript": 28}
/** * <slate_header> * url: www.slatekit.com * git: www.github.com/code-helix/slatekit * org: www.codehelix.co * author: Kishore Reddy * copyright: 2016 CodeHelix Solutions Inc. * license: refer to website and/or github * about: A tool-kit, utility library and server-backend * mantra: Simplicity above all else * </slate_header> */ package slatekit.common.status interface RunStatusNotifier { fun statusUpdate(value: RunState, success: Boolean, code: Int, message: String?): Unit { } }
0
Kotlin
0
0
cd1fdcae6bf52c63249e3be894c0ddd1a391e46f
509
slatekit
Apache License 2.0
feature/launch/app/src/main/java/com/dawn/launch/app/LaunchModuleInit.kt
blank-space
304,529,347
false
null
package com.dawn.launch.app import android.app.Application import android.util.Log import com.dawn.base.BaseAppInit import com.dawn.base.log.L import com.google.auto.service.AutoService /** * @author : LeeZhaoXing * @date : 2021/11/3 * @desc : */ @AutoService(BaseAppInit::class) class LaunchModuleInit : BaseAppInit { override fun onInitSpeed(app: Application) { Log.d("@@","LaunchModuleInit#onInitSpeed") } override fun onInitLow(app: Application) { Log.d("@@","LaunchModuleInit#onInitLow") } }
0
Kotlin
2
6
bc95dce263adc6968e1c55eccf18ebfc8362c2b5
542
scaffold
Apache License 2.0
buildSrc/private/src/main/kotlin/androidx/build/transform/ExtractClassesJarTransform.kt
androidx
256,589,781
false
{"Kotlin": 112114129, "Java": 66594571, "C++": 9132142, "AIDL": 635065, "Python": 325169, "Shell": 194520, "TypeScript": 40647, "HTML": 35176, "Groovy": 27178, "ANTLR": 26700, "Svelte": 20397, "CMake": 15512, "C": 15043, "GLSL": 3842, "Swift": 3153, "JavaScript": 3019}
/* * Copyright 2022 The Android Open Source Project * * 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 androidx.build.transform import com.google.common.io.Files import java.util.zip.ZipInputStream import org.gradle.api.artifacts.transform.InputArtifact import org.gradle.api.artifacts.transform.TransformAction import org.gradle.api.artifacts.transform.TransformOutputs import org.gradle.api.artifacts.transform.TransformParameters import org.gradle.api.file.FileSystemLocation import org.gradle.api.provider.Provider import org.gradle.api.tasks.PathSensitive import org.gradle.api.tasks.PathSensitivity import org.gradle.work.DisableCachingByDefault @DisableCachingByDefault abstract class ExtractClassesJarTransform : TransformAction<TransformParameters.None> { @get:PathSensitive(PathSensitivity.NAME_ONLY) @get:InputArtifact abstract val primaryInput: Provider<FileSystemLocation> override fun transform(outputs: TransformOutputs) { val inputFile = primaryInput.get().asFile val outputFile = outputs.file("${inputFile.nameWithoutExtension}.jar") ZipInputStream(inputFile.inputStream().buffered()).use { zipInputStream -> while (true) { val entry = zipInputStream.nextEntry ?: break if (entry.name != "classes.jar") continue Files.asByteSink(outputFile).writeFrom(zipInputStream) break } } } }
29
Kotlin
1011
5,321
98b929d303f34d569e9fd8a529f022d398d1024b
1,963
androidx
Apache License 2.0
module-main/src/main/java/com/wsdydeni/module_main/ui/me/MeViewModel.kt
wsdydeni
294,493,450
false
null
package com.wsdydeni.module_main.ui.me import androidx.lifecycle.MutableLiveData import com.wsdydeni.library_base.base.BaseViewModel import com.wsdydeni.module_main.model.User class MeViewModel : BaseViewModel() { var user = MutableLiveData<User>() }
1
null
1
5
e908db6bcf7cefa43500cc334c07c0bcc655819a
257
WanAndroid
MIT License
app/src/main/java/com/summer/base/library/http/HttpHeaderInterceptor.kt
Summer-yang
135,402,976
false
null
package com.summer.base.library.http import android.os.Build import android.util.Log import com.summer.base.library.BuildConfig import okhttp3.Headers import okhttp3.Interceptor /** * Created by * User -> Summer * Date -> 2018/6/15 * * Description: * */ class HttpHeaderInterceptor { /** * 修改Http请求头 */ fun getHeaderInterceptor(): Interceptor { return Interceptor { val headers = Headers.Builder() .add("Content-Type", "application/json; charset=UTF-8") .add("User-Agent", "Android/" + "Package:" + BuildConfig.APPLICATION_ID + "-" + "Version Name:" + BuildConfig.VERSION_NAME + "-" + "Phone Info:" + Build.PRODUCT + "(" + Build.VERSION.RELEASE + ")") .build() val request = it.request().newBuilder().headers(headers).build() if (BuildConfig.DEBUG) { Log.d("Http Headers", request.toString()) } it.proceed(request) } } }
1
null
1
1
c33ccffeae94430bdfc4ab868415d5603d2ceaae
1,433
KotlinCaidao
Apache License 2.0
games/sevenWonders/src/main/java/com/caseyjbrooks/games/basic/SevenWondersGameModule.kt
cjbrooks12
115,218,851
false
{"Gradle": 7, "Java Properties": 2, "Shell": 1, "Ignore List": 6, "Batchfile": 1, "Markdown": 1, "XML": 44, "Proguard": 5, "Kotlin": 43, "Java": 4}
package com.caseyjbrooks.games.basic import com.caseyjbrooks.scorekeeper.core.DrawerMenuItem import dagger.Module import dagger.Provides import dagger.multibindings.ElementsIntoSet @Module class SevenWondersGameModule { private val enabled get() = true @Provides @ElementsIntoSet fun provideSevenWondersGameMenuItem(): Set<DrawerMenuItem> { return if(enabled) setOf(SevenWondersGameMenuItem()) else emptySet() } }
0
Kotlin
0
0
0801efc7b9a55060f07d7124245a78ccca9f4a55
451
KotlinScoreKeeper
Creative Commons Attribution 3.0 Unported
compiler/testData/diagnostics/tests/inference/forks/overloadResolutionByLambdaReturnTypeAndExpectedType.fir.kt
JetBrains
3,432,266
false
null
// SKIP_TXT // WITH_STDLIB import kotlin.experimental.ExperimentalTypeInference interface MyList<E> interface MySequence<E> fun <E> myListOf(e: E): MyList<E> = TODO() interface C : MyList<String> fun <E> foo(m: MyList<E>, c: C) { if (c === m) { val x1: MyList<String> = m.noOverloadResolutionByLambdaReturnType { x -> myListOf(x) } // ok in K1 and K2 val x2: MyList<E> = m.noOverloadResolutionByLambdaReturnType { x -> myListOf(x) } // ok in K2, error in k1 val y1: MyList<String> = m.limitedFlatMap { x -> myListOf(x) } // ok in K1 and K2 val y2: MyList<E> = <!INITIALIZER_TYPE_MISMATCH, TYPE_MISMATCH!>m.limitedFlatMap { x -> myListOf(x) }<!> // error in K1 and K2 } } fun <T> MyList<T>.noOverloadResolutionByLambdaReturnType(producer: (T) -> MyList<T>): MyList<T> = TODO() fun <T> MyList<T>.limitedFlatMap(producer: (T) -> MyList<T>): MyList<T> = TODO() @OptIn(ExperimentalTypeInference::class) @OverloadResolutionByLambdaReturnType @kotlin.jvm.JvmName("limitedFlatMapSeq") fun <T> MyList<T>.limitedFlatMap(producer: (T) -> MySequence<T>): MyList<T> = TODO()
181
null
5748
49,172
33eb9cef3d146062c103f9853d772f0a1da0450e
1,192
kotlin
Apache License 2.0
custom_view/src/main/java/com/jesen/custom_view/MainActivity.kt
Jesen0823
399,377,675
false
{"Java": 566130, "Kotlin": 70141}
package com.jesen.custom_view import android.os.Bundle import android.widget.TextView import androidx.annotation.Dimension import androidx.appcompat.app.AppCompatActivity import com.blankj.utilcode.util.StringUtils import com.blankj.utilcode.util.ToastUtils import java.math.BigDecimal class MainActivity : AppCompatActivity() { lateinit var fatingBar :SimpleRatingBar lateinit var newScoreSelector:SimpleRatingBar lateinit var myScoreTitle:TextView private var score = 0f override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) fatingBar = findViewById(R.id.video_srb_new_score_current_scorer) myScoreTitle = findViewById(R.id.video_tv_new_score_my_score) val videoScore: Float = BigDecimal("8") .setScale(0, BigDecimal.ROUND_HALF_UP) .divide(BigDecimal(2), 1, BigDecimal.ROUND_HALF_UP) .toFloat() fatingBar.setRating(videoScore) newScoreSelector = findViewById(R.id.video_srb_new_score_selector) newScoreSelector.setStarSize(40F, Dimension.DP) newScoreSelector.setBottomArray(R.array.video_score_bottom_array) if (!StringUtils.isEmpty("4")) { score = BigDecimal("4") .setScale(0, BigDecimal.ROUND_HALF_UP) .divide(BigDecimal(2), 1, BigDecimal.ROUND_HALF_UP) .toFloat() } newScoreSelector.rating = score newScoreSelector.setOnRatingBarChangeListener { simpleRatingBar, rating, fromUser -> score = rating ToastUtils.showShort("评分:$score") } } }
1
null
1
1
ccaacefd15aa74f42d0cf449cb31c7ca809a6602
1,679
AndUITalk
Apache License 2.0
AnidroApp/app/src/main/java/app/anidro/modules/about/AboutActivity.kt
luboganev
754,639,369
false
{"Text": 1, "Git Attributes": 1, "Gradle Kotlin DSL": 4, "Java Properties": 2, "Shell": 1, "Ignore List": 3, "Batchfile": 1, "JSON": 1, "Proguard": 1, "XML": 41, "Kotlin": 37, "Java": 25}
package app.anidro.modules.about import android.content.Intent import android.net.Uri import android.os.Bundle import android.view.Menu import android.view.MenuItem import androidx.appcompat.app.ActionBar import androidx.appcompat.widget.Toolbar import app.anidro.R import app.anidro.common.BaseAnidroActivity import app.anidro.common.viewBinding import app.anidro.databinding.ActivityAboutBinding class AboutActivity : BaseAnidroActivity() { private val viewBinding by viewBinding(ActivityAboutBinding::inflate) override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) viewBinding.run { setContentView(root) aboutTerms.setOnClickListener { onClickTerms() } aboutPrivacy.setOnClickListener { onClickPrivacy() } } } override fun customizeActionBar(actionBar: ActionBar) { super.customizeActionBar(actionBar) actionBar.setDisplayHomeAsUpEnabled(true) } override fun customizeToolbar(toolbar: Toolbar) { super.customizeToolbar(toolbar) toolbar.setTitle(R.string.title_activity_about) } override fun onCreateOptionsMenu(menu: Menu): Boolean { menuInflater.inflate(R.menu.menu_about, menu) return super.onCreateOptionsMenu(menu) } private fun onClickTerms() { openUrl("http://luboganev.github.io/anidro/terms/") } private fun onClickPrivacy() { openUrl("http://luboganev.github.io/anidro/privacy/") } private fun openUrl(url: String) { val webpage = Uri.parse(url) val intent = Intent(Intent.ACTION_VIEW, webpage) if (intent.resolveActivity(packageManager) != null) { startActivity(intent) } } override fun onOptionsItemSelected(item: MenuItem): Boolean { if (item.itemId == android.R.id.home) { finish() return true } when (item.itemId) { android.R.id.home -> { finish() return true } R.id.menu_about_share -> { val shareIntent = Intent(Intent.ACTION_SEND) shareIntent.type = "text/plain" val appLink = "https://play.google.com/store/apps/details?id=app.anidro" shareIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.app_share_subject)) shareIntent.putExtra(Intent.EXTRA_TEXT, getString(R.string.app_share_text) + " " + appLink) if (shareIntent.resolveActivity(packageManager) != null) { startActivity(shareIntent) } return true } } return super.onOptionsItemSelected(item) } }
0
Java
0
0
91900638ed3f465f6b4cfeb887e9ec08f26d53ce
2,749
anidro-open-source
MIT License
app/src/main/java/com/yourssu/notissu/feature/majorNotiList/MajorNotiActivity.kt
islandparadise14
227,648,327
false
null
package com.yourssu.notissu.feature.majorNotiList import android.content.DialogInterface import android.content.Intent import android.net.Uri import androidx.appcompat.app.AppCompatActivity import android.os.Bundle import android.widget.Toast import com.yourssu.notissu.R import com.yourssu.notissu.data.KEYWORD_INTENT_KEY import com.yourssu.notissu.data.MAJOR_INTENT_KEY import com.yourssu.notissu.data.MAJOR_KEY import com.yourssu.notissu.data.MajorData import com.yourssu.notissu.feature.selectNotiList.SelectNotiListFragment import com.yourssu.notissu.utils.AlertDialogUtil import com.yourssu.notissu.utils.SharedPreferenceUtil import kotlinx.android.synthetic.main.activity_major_noti.* class MajorNotiActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_major_noti) initSetting() } fun initSetting() { val majorNumber = intent.getIntExtra(MAJOR_INTENT_KEY, -2) val keyword = intent.getStringExtra(KEYWORD_INTENT_KEY) notissuTopbar.setBackButtonClicked { finish() } notissuTopbar.setPlusButtonClicked { AlertDialogUtil.createDialogWithCancelButton("메인 전공 등록", resources.getString(R.string.major_change), this, "취소", "확인", DialogInterface.OnClickListener { dialog, _ -> SharedPreferenceUtil.setIntValue(MAJOR_KEY, majorNumber) dialog.cancel() setResult(1) finish() }) } when { majorNumber > -1 -> { supportFragmentManager.beginTransaction().replace( R.id.majorNotiMain, SelectNotiListFragment.getInstance(majorNumber, keyword)).commit() notissuTopbar.setTitle(MajorData.getInstance().getMajorByIndex(majorNumber).name) } majorNumber == -1 -> { supportFragmentManager.beginTransaction().replace( R.id.majorNotiMain, SelectNotiListFragment.getInstance(majorNumber, keyword)).commit() notissuTopbar.setTitle("SSU:Catch") } else -> Toast.makeText(applicationContext, "다시 시도해주세요", Toast.LENGTH_SHORT).show() } } }
0
null
1
5
c7891a2aa82af0281ba0f29675446b1be2bf0bcd
2,312
Notissu
Apache License 2.0
http/src/main/java/com/yww/http/manager/other/OnUrlChangeListener.kt
wavening
180,977,597
false
{"Gradle": 14, "Java Properties": 4, "Shell": 1, "Text": 9, "Ignore List": 12, "Batchfile": 1, "Markdown": 1, "Proguard": 11, "XML": 65, "Kotlin": 113, "Java": 2, "JSON": 12, "SQL": 2, "Motorola 68K Assembly": 3, "Unix Assembly": 1}
package com.yww.http.manager.other import okhttp3.HttpUrl /** * @author WAVENING */ /** * ================================================ * Url 监听器 * <p> * Created by JessYan on 20/07/2017 14:18 * <a href="mailto:<EMAIL>">Contact me</a> * <a href="https://github.com/JessYanCoding">Follow me</a> * ================================================ */ interface OnUrlChangeListener { /** * 此方法在框架使用 `domainName` 作为 key,从 [RetrofitUrlManager.mDomainNameHub] * 中取出对应的 BaseUrl 构建新的 Url 之前会被调用 * * * 可以使用此回调确保 [RetrofitUrlManager.mDomainNameHub] 中是否已经存在自己期望的 BaseUrl * 如果不存在可以在此方法中进行 [RetrofitUrlManager.putDomain] * * @param oldUrl * @param domainName */ fun onUrlChangeBefore(oldUrl: HttpUrl, domainName: String) /** * 当 Url 的 BaseUrl 被切换时回调 * 调用时间是在接口请求服务器之前 * * @param newUrl * @param oldUrl */ fun onUrlChanged(newUrl: HttpUrl, oldUrl: HttpUrl) }
1
null
1
1
964e3eaa52e2aefdc10b883394910e61fdb2e467
956
KotlinLibs
Apache License 2.0
Kotiln/kotlin_master/src/main/kotlin/chapter03/question11/Solution.kt
bekurin
558,176,225
false
{"Git Config": 1, "Text": 12, "Ignore List": 96, "Markdown": 58, "YAML": 55, "JSON with Comments": 2, "JSON": 46, "HTML": 104, "robots.txt": 6, "SVG": 10, "TSX": 15, "CSS": 64, "Gradle Kotlin DSL": 107, "Shell": 72, "Batchfile": 71, "HTTP": 15, "INI": 112, "Kotlin": 682, "EditorConfig": 1, "Gradle": 40, "Java": 620, "JavaScript": 53, "Go": 8, "XML": 38, "Go Module": 1, "SQL": 7, "Dockerfile": 1, "Gherkin": 1, "Python": 153, "SCSS": 113, "Java Properties": 3, "AsciiDoc": 5, "Java Server Pages": 6, "Unity3D Asset": 451, "C#": 48, "Objective-C": 51, "C": 8, "Objective-C++": 1, "Smalltalk": 1, "OpenStep Property List": 12, "Dart": 17, "Swift": 8, "Ruby": 1}
package chapter03.question11 class Solution { fun <A, B, C> swapArgs(f: (A) -> (B) -> C): (B) -> (A) -> C = { b -> { a -> f(a)(b) } } } /** * Q: 커리한 함수의 두 인자를 뒤바꾼 새로운 함수를 반환하는 swapArgs를 만들어라. * 두 인자를 뒤바꿔서 얻는 이득에 대해서 이해가 되지 않는다. 일반적인 Curry 함수와 다를 것이 무엇인지? */ fun main() { val (amount, rate) = Pair(1000.0, 10.0) val payment = { amount: Double -> { rate: Double -> amount + amount * (rate / 100) } } val solution = Solution() val swapArgs = solution.swapArgs(payment) println("swapArgs = ${swapArgs(rate)(amount)}") }
0
Java
0
2
ede7cdb0e164ed1d3d2ee91c7770327b2ee71e4d
552
blog_and_study
MIT License
src/app/src/main/java/com/huawei/training/kotlin/database/tables/CoursePlatformTable.kt
huaweicodelabs
368,851,944
false
null
/* * Copyright (c) Huawei Technologies Co., Ltd. 2019-2019. All rights reserved. * Generated by the CloudDB ObjectType compiler. DO NOT EDIT! */ package com.huawei.training.kotlin.database.tables import com.huawei.agconnect.cloud.database.CloudDBZoneObject import com.huawei.agconnect.cloud.database.annotations.PrimaryKey /** * @since 2020 * @author Huawei DTSE India */ class CoursePlatformTable : CloudDBZoneObject() { @PrimaryKey var platformId: Int? = null var platformName: String? = null var platformDescription: String? = null }
1
null
1
1
9e038c432077d2bf0b0749f5c12cf8f58dbe5454
562
HMS-Learning-Application
Apache License 2.0
adt-ui/src/main/java/com/android/tools/adtui/common/StudioColors.kt
zakharchanka
314,699,321
true
{"Text": 342, "EditorConfig": 1, "Markdown": 54, "Ignore List": 133, "Starlark": 86, "XML": 11605, "Java": 8168, "Kotlin": 4229, "Gradle": 802, "Proguard": 121, "INI": 42, "JSON": 77, "Graphviz (DOT)": 1, "Ant Build System": 1, "Protocol Buffer": 1, "HTML": 60, "Shell": 19, "Batchfile": 12, "Java Properties": 130, "Gradle Kotlin DSL": 51, "C": 26, "Checksums": 248, "CMake": 14, "C++": 7, "Smali": 5, "SVG": 1109, "AIDL": 9, "JFlex": 8, "Prolog": 6, "QMake": 2, "RenderScript": 1, "NSIS": 4, "Diff": 1, "Python": 2, "GraphQL": 5, "Makefile": 8, "YAML": 1, "HAProxy": 1, "Org": 2, "Fluent": 1, "JavaScript": 3}
/* * Copyright (C) 2017 The Android Open Source Project * * 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.android.tools.adtui.common import com.intellij.ui.JBColor import com.intellij.util.ui.JBUI import java.awt.Color /** * Colors defined in the UX prototype */ /** * Background color for panels that have a primary role. * * Example: central panel of the layout editor. */ val primaryPanelBackground = JBColor.namedColor("UIDesigner.Canvas.background", JBColor(0xf5f5f5, 0x2D2F31)) /** * Background color for panels that have a secondary role * * Example: the palette or component tree in the layout editor. */ val secondaryPanelBackground = JBColor.namedColor("UIDesigner.Panel.background", JBColor(0xfcfcfc, 0x313435)) /** * Color of the border that separates panels. * * Example : Between the component tree and the main panel of the layout editor */ val border = JBColor.namedColor("UIDesigner.Panel.borderColor", JBColor(0xc9c9c9, 0x282828)) /** * Border color to use when separating element inside the same panel. * * Example: border between the category list and widget list in the * layout editor's palette */ val borderLight = JBColor.namedColor("Canvas.Tooltip.borderColor", JBColor(0xD9D9D9, 0x4A4A4A)) /** * Background color for tooltips on canvases * * Example: Hover tooltips for chart data points, tooltips on designer surfaces */ val canvasTooltipBackground = JBColor.namedColor("Canvas.Tooltip.background", JBColor(0xf7f7f7, 0x4A4C4C)) /** * Background color for content (same background colors as Editors) * * Example: Background for charts, editors */ val primaryContentBackground = JBColor.namedColor("Content.background", JBColor(0xffffff, 0x2b2b2b)) /** * Background color for selected content. * * Example: selected range in profilers. */ val contentSelectionBackground = JBColor.namedColor("Content.selectionBackground", JBColor(Color(0x330478DA, true), Color(0x4C2395F5, true))) /** * Background color for an active selection. * * Example: selected track in a track group. */ val selectionBackground = JBColor.namedColor("List.selectionBackground", JBColor(0x4874D7, 0x1E67CE)) /** * Foreground color for an active selection. * * Example: title label of a selected track in a track group. */ val selectionForeground = JBColor.namedColor("List.selectionForeground", JBColor(0xFFFFFF, 0xFFFFFF)) /** * Color of the underline when a intellij style tab is focused. * * Example: Analysis tab of a cpu profiling capture. */ val tabbedPaneFocus = JBUI.CurrentTheme.TabbedPane.ENABLED_SELECTED_COLOR /** * Color of the background when user mouse overs an intellij style tab. * * Example: Analysis tab of a cpu profiling capture. */ val tabbedPaneHoverHighlight = JBUI.CurrentTheme.TabbedPane.HOVER_COLOR
0
null
0
0
cd393da1a11d2dfe572f4baa6eef882256e95d6a
3,360
android-1
Apache License 2.0
src/main/kotlin/org/ethereum/discv5/Simulator.kt
zilm13
240,323,938
false
null
package org.ethereum.discv5 import io.libp2p.core.PeerId import io.libp2p.core.multiformats.Multiaddr import org.ethereum.discv5.core.Enr import org.ethereum.discv5.core.Node import org.ethereum.discv5.core.Router import org.ethereum.discv5.util.ByteArrayWrapper import org.ethereum.discv5.util.InsecureRandom import org.ethereum.discv5.util.KeyUtils import org.ethereum.discv5.util.RoundCounter import org.ethereum.discv5.util.calcKademliaPeers import org.ethereum.discv5.util.calcPeerDistribution import org.ethereum.discv5.util.calcTraffic import org.ethereum.discv5.util.formatTable val PEER_COUNT = 10000 val RANDOM: InsecureRandom = InsecureRandom().apply { setInsecureSeed(1) } val REGISTER_ROUNDS = 300 val SEARCH_ROUNDS = 300 val SUBNET_SHARE_PCT = 5 // Which part of all peers are validators from one tracked subnet, in % val TARGET_PERCENTILE = 95 val SUBNET_13 = ByteArrayWrapper(ByteArray(1) { 13.toByte() }) val REQUIRE_ADS = 8 val SEACHERS_COUNT = 10 fun main(args: Array<String>) { println("Creating private key - enr pairs for $PEER_COUNT nodes") val router = Router(RANDOM) val peers = (0 until (PEER_COUNT)).map { val ip = "127.0.0.1" val privKey = KeyUtils.genPrivKey(RANDOM) val addr = Multiaddr("/ip4/$ip/tcp/$it") val enr = Enr( addr, PeerId(KeyUtils.privToPubCompressed(privKey)) ) Node(enr, privKey, RANDOM, router).apply { router.register(this) } } // It's believed that p2p node uptime is complied with Pareto distribution // See <NAME>, <NAME>, <NAME> "A Measurement Study of Peer-to-Peer File Sharing Systems" // https://www.researchgate.net/publication/2854843_A_Measurement_Study_of_Peer-to-Peer_File_Sharing_Systems // For simulations lets assume that it's Pareto with alpha = 0.18 and xm = 1. // With such distribution 40% of peers are mature enough to pass through its Kademlia table all peers in network. val alpha = 0.18 val xm = 1.0 println("""Calculating distribution of peer tables fullness with alpha = $alpha and Xm = $xm""") val peerDistribution = calcPeerDistribution( PEER_COUNT, alpha, xm, 240.0 ) assert(peers.size == peerDistribution.size) println("Filling peer's Kademlia tables according to distribution") peers.forEachIndexed() { index, peer -> (1..peerDistribution[index]).map { peers[RANDOM.nextInt(PEER_COUNT)] } .forEach { peer.table.put(it.enr) { enr, cb -> cb(true) } } if (index > 0 && index % 1000 == 0) { println("$index peer tables filled") } } // TODO: Uncomment when need to see only initial fill of Kademlia tables // printKademliaTableStats(peers) // System.exit(-1) // TODO: Uncomment to set churn rate // router.churnPcts = 25 // TODO: Uncomment when need simulation with placement of topic advertisement // println("Run simulation with placing topic ads Discovery V5 protocol") // val topicSimulator = TopicSimulator() // topicSimulator.runTopicAdSimulationUntilSuccessfulPlacement(peers, RoundCounter(REGISTER_ROUNDS), router) // peers.forEach(Node::resetAll) // topicSimulator.runTopicSearch(peers, RoundCounter(SEARCH_ROUNDS), SEACHERS_COUNT, REQUIRE_ADS) // TODO: Uncomment when need simulation with using ENR attribute for advertisement println("Run simulation with ENR attribute advertisement") val enrSimulator = EnrSimulator() val enrStats = enrSimulator.runEnrUpdateSimulationUntilDistributed(peers, RoundCounter(REGISTER_ROUNDS)) // enrSimulator.visualizeSubnetPeersStats(peers) enrSimulator.printSubnetPeersStats(enrStats) peers.forEach(Node::resetAll) enrSimulator.runEnrSubnetSearch(peers, RoundCounter(SEARCH_ROUNDS), SEACHERS_COUNT, REQUIRE_ADS) } fun gatherTrafficStats(peers: List<Node>): List<Long> { return peers.map { calcTraffic(it) }.sorted() } fun printKademliaTableStats(peers: List<Node>) { println("Kademlia table stats for every peer") println("===================================") val header = "Peer #\t Stored nodes\n" val stats = peers.mapIndexed { index, peer -> index.toString() + "\t" + calcKademliaPeers( peer.table ) }.joinToString("\n") println((header + stats).formatTable(true)) }
0
null
1
3
49d817ab5155f8eea978ed9a74c0a2be32ced79c
4,364
discv5
Apache License 2.0
src/main/kotlin/com/nonnulldinu/clionmeson/runconfigurations/clion/CLionMesonBuildTarget.kt
IntellijMesonIntegration
268,624,073
false
null
package com.nonnulldinu.clionmeson.runconfigurations.clion import com.intellij.icons.AllIcons import com.intellij.openapi.project.Project import com.jetbrains.cidr.execution.CidrBuildTarget import com.nonnulldinu.clionmeson.icons.PluginIcons import javax.swing.Icon class CLionMesonBuildTarget(private val _projectName: String, private val _name: String, private val project: Project) : CidrBuildTarget<CLionMesonBuildConfiguration> { override fun getIcon(): Icon? = AllIcons.Actions.Compile override fun getName(): String = _name override fun getProjectName(): String = _projectName override fun isExecutable(): Boolean = true override fun getBuildConfigurations(): List<CLionMesonBuildConfiguration> = CLionMesonBuildConfigurationProvider().getBuildableConfigurations(project) }
0
null
0
3
4f5a52e69b3f37d9d4e151405e5c6a64b287be67
808
IntellijMesonIntegration
MIT License
openfeign/src/main/kotlin/pl/damianhoppe/spring/requestidgenerator/subconfig/OpenFeignConfig.kt
damianhoppe
734,869,330
false
{"Kotlin": 81276}
package pl.damianhoppe.spring.requestidgenerator.subconfig import feign.RequestTemplate import pl.damianhoppe.spring.requestidgenerator.RIdGProperties import pl.damianhoppe.spring.requestidgenerator.config.RIdGSubConfig import pl.damianhoppe.spring.requestidgenerator.interfaces.Matcher import pl.damianhoppe.spring.requestidgenerator.matchers.AlwaysMatches /** * Stores config for openFeign module */ class OpenFeignConfig( properties: RIdGProperties ) : RIdGSubConfig { /** * Disables interceptor */ var disabled: Boolean = properties.openFeign.disableInterceptor private set /** * Disables interceptor * @return [OpenFeignConfig] for further customizations */ fun disable() = apply { this.disabled = true } /** * A matcher that checks outgoing requests. * Only for matching requests, ids are injected */ var requestMatcher: Matcher<RequestTemplate> = AlwaysMatches() private set /** * Changing the matcher for outgoing requests for which ids are injected * @return [OpenFeignConfig] for further customizations */ fun requestMatcher(requestMatcher: Matcher<RequestTemplate>) = apply { this.requestMatcher = requestMatcher } }
0
Kotlin
0
0
834c4a162d11bfc86ebda91bfb5bae2f7d6d2e32
1,241
RequestIDGeneratorForSpringBoot
Apache License 2.0
src/main/kotlin/no/fdk/fdk_event_harvester/repository/CatalogMetaRepository.kt
Informasjonsforvaltning
335,976,565
false
{"Kotlin": 153717, "Dockerfile": 226}
package no.fdk.fdk_event_harvester.repository import no.fdk.fdk_event_harvester.model.CatalogMeta import org.springframework.data.mongodb.repository.MongoRepository import org.springframework.stereotype.Repository @Repository interface CatalogMetaRepository : MongoRepository<CatalogMeta, String>
6
Kotlin
0
0
d7ed4046d6501f880b5c7991ea663fe35c38010f
299
fdk-event-harvester
Apache License 2.0
app/shared/state-machine/ui/public/src/commonMain/kotlin/build/wallet/statemachine/settings/helpcenter/HelpCenterUiStateMachineImpl.kt
proto-at-block
761,306,853
false
{"C": 10551861, "Kotlin": 6455657, "Rust": 1874547, "Swift": 629125, "Python": 329146, "HCL": 257498, "Shell": 97542, "TypeScript": 81148, "C++": 64770, "Meson": 64252, "JavaScript": 36229, "Just": 26345, "Ruby": 9265, "Dockerfile": 5755, "Makefile": 3839, "Open Policy Agent": 1456, "Procfile": 80}
package build.wallet.statemachine.settings.helpcenter import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import build.wallet.platform.web.InAppBrowserNavigator import build.wallet.statemachine.core.InAppBrowserModel import build.wallet.statemachine.core.ScreenModel import build.wallet.statemachine.settings.helpcenter.HelpCenterUiState.ViewingContactUsUiState import build.wallet.statemachine.settings.helpcenter.HelpCenterUiState.ViewingFaqUiState import build.wallet.statemachine.settings.helpcenter.HelpCenterUiState.ViewingHelpCenterUiState class HelpCenterUiStateMachineImpl( private val inAppBrowserNavigator: InAppBrowserNavigator, ) : HelpCenterUiStateMachine { @Composable override fun model(props: HelpCenterUiProps): ScreenModel { var uiState: HelpCenterUiState by remember { mutableStateOf(ViewingHelpCenterUiState) } return when (uiState) { is ViewingHelpCenterUiState -> ScreenModel( body = HelpCenterScreenModel( onFaqClick = { uiState = ViewingFaqUiState }, onContactUsClick = { uiState = ViewingContactUsUiState }, onBack = props.onBack ) ) is ViewingContactUsUiState -> InAppBrowserModel( open = { inAppBrowserNavigator.open( url = "https://support.bitkey.build/hc/requests/new", onClose = { uiState = ViewingHelpCenterUiState } ) } ).asModalScreen() is ViewingFaqUiState -> InAppBrowserModel( open = { inAppBrowserNavigator.open( url = "https://support.bitkey.build/hc", onClose = { uiState = ViewingHelpCenterUiState } ) } ).asModalScreen() } } } private sealed interface HelpCenterUiState { /** * Viewing the Main Help Center screen */ data object ViewingHelpCenterUiState : HelpCenterUiState /** * Viewing the Contact us screen */ data object ViewingContactUsUiState : HelpCenterUiState /** * Viewing the Faq screen */ data object ViewingFaqUiState : HelpCenterUiState }
0
C
6
74
b7401e0b96f9378cbd96eb01914a4f888e0a9303
2,430
bitkey
MIT License
app/src/main/java/com/rivaldy/id/mvvmtemplateapp/data/model/db/movie/MovieEntity.kt
im-o
389,489,002
false
null
package com.rivaldy.id.mvvmtemplateapp.data.model.db.movie import androidx.room.ColumnInfo import androidx.room.Entity import org.jetbrains.annotations.NotNull /** * Created by rivaldy on 05/07/21 * Find me on my Github -> https://github.com/im-o **/ @Entity(tableName = "tbl_movie", primaryKeys = ["id"]) data class MovieEntity( @NotNull @ColumnInfo(name = "id") val id: Int, @ColumnInfo(name = "title") val title: String? = null, @ColumnInfo(name = "release_date") val releaseDate: String? = null, @ColumnInfo(name = "vote_average") val voteAverage: Double? = 0.0, @ColumnInfo(name = "backdrop_path") val backdropPath: String? = null, @ColumnInfo(name = "overview") val overview: String? = null, @ColumnInfo(name = "info_genre") val infoGenre: String? = null, )
0
Kotlin
0
5
443266dbbb08066fe6e581e6622addbdba7bcde9
836
kotlin-android-mvvm-architecture
MIT License
maps-compose/src/main/java/com/google/maps/android/compose/InputHandler.kt
googlemaps
455,343,699
false
{"Kotlin": 263096}
package com.google.maps.android.compose import androidx.annotation.RestrictTo import androidx.compose.runtime.Composable import androidx.compose.runtime.ComposeNode import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.setValue import com.google.android.gms.maps.model.Circle import com.google.android.gms.maps.model.GroundOverlay import com.google.android.gms.maps.model.Marker import com.google.android.gms.maps.model.Polygon import com.google.android.gms.maps.GoogleMap.OnMarkerClickListener import com.google.android.gms.maps.model.Polyline /** * A generic handler for map input. * Non-null lambdas will be invoked if no other node was able to handle that input. * For example, if [OnMarkerClickListener.onMarkerClick] was invoked and no matching [MarkerNode] * was found, this [onMarkerClick] will be invoked. */ @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) @Composable public fun InputHandler( onCircleClick: ((Circle) -> Unit)? = null, onGroundOverlayClick: ((GroundOverlay) -> Unit)? = null, onPolygonClick: ((Polygon) -> Unit)? = null, onPolylineClick: ((Polyline) -> Unit)? = null, onMarkerClick: ((Marker) -> Boolean)? = null, onInfoWindowClick: ((Marker) -> Unit)? = null, onInfoWindowClose: ((Marker) -> Unit)? = null, onInfoWindowLongClick: ((Marker) -> Unit)? = null, onMarkerDrag: ((Marker) -> Unit)? = null, onMarkerDragEnd: ((Marker) -> Unit)? = null, onMarkerDragStart: ((Marker) -> Unit)? = null, ) { ComposeNode<InputHandlerNode, MapApplier>( factory = { InputHandlerNode( onCircleClick, onGroundOverlayClick, onPolygonClick, onPolylineClick, onMarkerClick, onInfoWindowClick, onInfoWindowClose, onInfoWindowLongClick, onMarkerDrag, onMarkerDragEnd, onMarkerDragStart, ) }, update = { update(onCircleClick) { this.onCircleClick = it } update(onGroundOverlayClick) { this.onGroundOverlayClick = it } update(onPolygonClick) { this.onPolygonClick = it } update(onPolylineClick) { this.onPolylineClick = it } update(onMarkerClick) { this.onMarkerClick = it } update(onInfoWindowClick) { this.onInfoWindowClick = it } update(onInfoWindowClose) { this.onInfoWindowClose = it } update(onInfoWindowLongClick) { this.onInfoWindowLongClick = it } update(onMarkerDrag) { this.onMarkerDrag = it } update(onMarkerDragEnd) { this.onMarkerDragEnd = it } update(onMarkerDragStart) { this.onMarkerDragStart = it } } ) } internal class InputHandlerNode( onCircleClick: ((Circle) -> Unit)? = null, onGroundOverlayClick: ((GroundOverlay) -> Unit)? = null, onPolygonClick: ((Polygon) -> Unit)? = null, onPolylineClick: ((Polyline) -> Unit)? = null, onMarkerClick: ((Marker) -> Boolean)? = null, onInfoWindowClick: ((Marker) -> Unit)? = null, onInfoWindowClose: ((Marker) -> Unit)? = null, onInfoWindowLongClick: ((Marker) -> Unit)? = null, onMarkerDrag: ((Marker) -> Unit)? = null, onMarkerDragEnd: ((Marker) -> Unit)? = null, onMarkerDragStart: ((Marker) -> Unit)? = null, ) : MapNode { var onCircleClick: ((Circle) -> Unit)? by mutableStateOf(onCircleClick) var onGroundOverlayClick: ((GroundOverlay) -> Unit)? by mutableStateOf(onGroundOverlayClick) var onPolygonClick: ((Polygon) -> Unit)? by mutableStateOf(onPolygonClick) var onPolylineClick: ((Polyline) -> Unit)? by mutableStateOf(onPolylineClick) var onMarkerClick: ((Marker) -> Boolean)? by mutableStateOf(onMarkerClick) var onInfoWindowClick: ((Marker) -> Unit)? by mutableStateOf(onInfoWindowClick) var onInfoWindowClose: ((Marker) -> Unit)? by mutableStateOf(onInfoWindowClose) var onInfoWindowLongClick: ((Marker) -> Unit)? by mutableStateOf(onInfoWindowLongClick) var onMarkerDrag: ((Marker) -> Unit)? by mutableStateOf(onMarkerDrag) var onMarkerDragEnd: ((Marker) -> Unit)? by mutableStateOf(onMarkerDragEnd) var onMarkerDragStart: ((Marker) -> Unit)? by mutableStateOf(onMarkerDragStart) }
100
Kotlin
108
998
4b7967d15f8add4589e7d02cf8bf71f1c594f59d
4,334
android-maps-compose
Apache License 2.0
core/preferences/src/test/java/com/chesire/nekome/core/preferences/flags/ThemeTests.kt
Chesire
223,272,337
false
null
package com.chesire.nekome.core.preferences.flags import android.content.Context import com.chesire.nekome.core.R import io.mockk.every import io.mockk.mockk import org.junit.Assert.assertEquals import org.junit.Test class ThemeTests { @Test fun `getValueMap returns expected map`() { val mockContext = mockk<Context> { every { getString(R.string.settings_theme_system) } returns "system" every { getString(R.string.settings_theme_dark) } returns "dark" every { getString(R.string.settings_theme_light) } returns "light" every { getString(R.string.settings_theme_dynamic_dark) } returns "dynamicDark" every { getString(R.string.settings_theme_dynamic_light) } returns "dynamicLight" } val map = Theme.getValueMap(mockContext) assertEquals("system", map.getValue(-1)) assertEquals("dark", map.getValue(2)) assertEquals("light", map.getValue(1)) assertEquals("dynamicDark", map.getValue(3)) assertEquals("dynamicLight", map.getValue(4)) } @Test fun `fromValue with Theme#System returns expected value`() { assertEquals( Theme.System, Theme.fromValue("-1") ) } @Test fun `fromValue with Theme#Dark returns expected value`() { assertEquals( Theme.Dark, Theme.fromValue("2") ) } @Test fun `fromValue with Theme#Light returns expected value`() { assertEquals( Theme.Light, Theme.fromValue("1") ) } @Test fun `fromValue with Theme#DynamicDark returns expected value`() { assertEquals( Theme.DynamicDark, Theme.fromValue("3") ) } @Test fun `fromValue with Theme#DynamicLight returns expected value`() { assertEquals( Theme.DynamicLight, Theme.fromValue("4") ) } @Test fun `fromValue with unexpected value returns default of System`() { assertEquals( Theme.System, Theme.fromValue("999") ) } @Test fun `fromValue with non-numerical value returns default of System`() { assertEquals( Theme.System, Theme.fromValue("parse") ) } }
20
Kotlin
37
330
4fa367a1e00581f547172095cd234ff8d8274cae
2,330
Nekome
Apache License 2.0
module/mapper/src/main/kotlin/io/github/siyual_park/mapper/TypeReference.kt
siyual-park
403,557,925
false
null
package io.github.siyual_park.mapper import java.io.Serializable import java.lang.reflect.ParameterizedType import java.lang.reflect.Type import java.util.Objects abstract class TypeReference<T> : Serializable { val type: Type init { val superClass: Type = javaClass.genericSuperclass type = (superClass as ParameterizedType).actualTypeArguments[0] } override fun hashCode(): Int { return Objects.hash(type) } override fun equals(other: Any?): Boolean { if (this === other) return true if (other !is TypeReference<*>) { return false } return type == other.type } }
3
Kotlin
0
18
e96087d9b5b50c863efa39eee590c11a09330659
667
spring-webflux-multi-module-boilerplate
MIT License
main-course-project/src/main/kotlin/br/com/leuras/app/infrastructure/sql/CustomerAccountSQL.kt
leuras
672,251,747
false
null
package br.com.leuras.app.infrastructure.sql object CustomerAccountSQL { private const val COLUMNS = """ customer_id, customer_name, qualified_investor, shares, orders """ const val SELECT = """ SELECT $COLUMNS FROM customer_account WHERE customer_id = ? """ }
0
Kotlin
0
0
a781207b157a87e22b4ddfa58b87fba060ea5a87
335
kotlin-unit-testing-course
MIT License
mission-heart/shared/src/commonMain/kotlin/ru/mission/heart/component/factory/RootComponentFactory.kt
KYamshanov
805,006,151
false
{"Kotlin": 37512}
package ru.mission.heart.component.factory import com.arkivanov.decompose.ComponentContext import ru.mission.heart.component.RootComponent import ru.mission.heart.api.MissionAuthApiImpl import ru.mission.heart.impl.RootComponentImpl import ru.mission.heart.network.NetworkConfig import ru.mission.heart.network.RequestFactoryImpl import ru.mission.heart.preferences import ru.mission.heart.session.JwtSessionInteractor /** * Factory for instantiate RootComponent */ class RootComponentFactory { operator fun invoke(componentContext: ComponentContext): RootComponent { var sessionInteractor: JwtSessionInteractor? = null sessionInteractor = JwtSessionInteractor( accessTokenKey = "", refreshTokenKey = "", preferences = preferences(), missionAuthApi = MissionAuthApiImpl(RequestFactoryImpl(NetworkConfig(""), lazy { sessionInteractor!! })) ) return RootComponentImpl( componentContext, sessionInteractor ) } }
0
Kotlin
0
0
ac75d16965865939e4e1662256b257967a1aab28
1,023
Mission-LSP
Apache License 2.0
samples/SkiaNativeSample/src/macosX64Main/kotlin/org.jetbrains.skiko.sample.native/App.kt
Schahen
402,355,128
true
{"Kotlin": 948892, "C++": 478268, "Objective-C++": 20299, "Dockerfile": 2368, "Shell": 555}
package org.jetbrains.skiko.sample.native import platform.AppKit.* import org.jetbrains.skiko.skia.native.* import org.jetbrains.skiko.native.SkiaLayer import org.jetbrains.skiko.native.SkiaRenderer import org.jetbrains.skiko.native.SkiaWindow import kotlinx.cinterop.* import kotlin.math.cos import kotlin.math.sin fun main(args: Array<String>) { // TODO: Remove me! This is to run all cleaners before main() exits. kotlin.native.internal.Debugging.forceCheckedShutdown = true NSApplication.sharedApplication() createWindow("Skia/Native macos sample") NSApp?.run() } fun createWindow(title: String) { val window = SkiaWindow() var angle = 0.0f window.layer.renderer = Renderer(window.layer) { renderer, w, h, nanoTime -> displayScene(renderer, nanoTime) } window.nsWindow.orderFrontRegardless() } class Renderer( val layer: SkiaLayer, val displayScene: (Renderer, Int, Int, Long) -> Unit ): SkiaRenderer { var canvas: Canvas? = null override fun onRender(canvas: Canvas, width: Int, height: Int, nanoTime: Long) { this.canvas = canvas val contentScale = layer.contentScale canvas.scale(contentScale, contentScale) displayScene(this, (width / contentScale).toInt(), (height / contentScale).toInt(), nanoTime) layer.needRedraw() } } fun displayScene(renderer: Renderer, nanoTime: Long) { val canvas = renderer.canvas!! val paint = Paint() paint.setColor(SK_ColorGREEN) canvas.clear(SK_ColorRED); canvas.save(); canvas.translate(128.0f, 128.0f) canvas.rotate(nanoTime.toFloat() / 1e7f) val rect = SkRect.MakeXYWH(-90.5f, -90.5f, 181.0f, 181.0f) canvas.drawRect(rect, paint) canvas.restore(); }
0
null
0
0
c9dda21dea90abfa68db1fdf8932d8f12141c1f8
1,756
skiko
Apache License 2.0
cathway/src/main/java/info/vcartera/cathway/androidBindableControls/BindableControlFactory.kt
vcartera81
148,905,303
false
{"Gradle": 4, "Java Properties": 2, "Text": 1, "Markdown": 1, "Proguard": 2, "Ignore List": 2, "Java": 2, "XML": 11, "Kotlin": 19}
package info.vcartera.cathway.androidBindableControls import info.vcartera.cathway.binder.IBindableControlFactory import info.vcartera.cathway.binder.IOneWayBindableControl import info.vcartera.cathway.binder.ITwoWayBindableControl abstract class BindableControlFactory : IBindableControlFactory { protected val registeredOneWayBindableControls = mutableListOf<IOneWayBindableControl<*, *>>() protected val registeredTwoWayBindableControls = mutableListOf<ITwoWayBindableControl<*, *>>() protected abstract fun registerStandardControls() }
1
null
1
1
23987c0f357da3422f422331b21ae82b8a6b02d8
554
CathWay
MIT License
app/src/main/kotlin/de/sambalmueslie/open/col/app/settlement/api/SettlementAPI.kt
Black-Forrest-Development
643,479,746
false
{"Kotlin": 25546}
package de.sambalmueslie.open.col.app.settlement.api interface SettlementAPI { }
1
Kotlin
0
1
6168e9cfba4e4c0c352553af17da4c68dfeaad0f
82
open-colonization
Apache License 2.0
backend/src/main/kotlin/org/rm3l/devfeed/DevFeedApplication.kt
vinhhapm
270,893,084
true
{"Dart": 88754, "Kotlin": 69579, "Objective-C": 4107, "Dockerfile": 1730, "Java": 362, "Shell": 336}
//The MIT License (MIT) // //Copyright (c) 2019 Armel Soro // //Permission is hereby granted, free of charge, to any person obtaining a copy //of this software and associated documentation files (the "Software"), to deal //in the Software without restriction, including without limitation the rights //to use, copy, modify, merge, publish, distribute, sublicense, and/or sell //copies of the Software, and to permit persons to whom the Software is //furnished to do so, subject to the following conditions: // //The above copyright notice and this permission notice shall be included in all //copies or substantial portions of the Software. // //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR //IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, //FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE //AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER //LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, //OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE //SOFTWARE. package org.rm3l.devfeed import org.springframework.boot.SpringApplication import org.springframework.boot.autoconfigure.SpringBootApplication import org.springframework.context.annotation.PropertySource import org.springframework.context.annotation.PropertySources import org.springframework.scheduling.annotation.EnableScheduling /** * Entry-point */ @SpringBootApplication @PropertySources(value = [ //The order matters here. If a same property key is found in many files, the last one wins. PropertySource(value = ["classpath:application.properties"]), PropertySource(value = ["file:/etc/dev-feed/backend.properties"], ignoreResourceNotFound = true)] ) @EnableScheduling class DevFeedApplication fun main(args: Array<String>) { SpringApplication.run(DevFeedApplication::class.java, *args) }
0
null
0
0
82805d4cc79704ed83f2874e08e1061d81c33b0c
1,936
dev-feed
MIT License
backend/src/main/kotlin/org/rm3l/devfeed/DevFeedApplication.kt
vinhhapm
270,893,084
true
{"Dart": 88754, "Kotlin": 69579, "Objective-C": 4107, "Dockerfile": 1730, "Java": 362, "Shell": 336}
//The MIT License (MIT) // //Copyright (c) 2019 Armel Soro // //Permission is hereby granted, free of charge, to any person obtaining a copy //of this software and associated documentation files (the "Software"), to deal //in the Software without restriction, including without limitation the rights //to use, copy, modify, merge, publish, distribute, sublicense, and/or sell //copies of the Software, and to permit persons to whom the Software is //furnished to do so, subject to the following conditions: // //The above copyright notice and this permission notice shall be included in all //copies or substantial portions of the Software. // //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR //IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, //FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE //AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER //LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, //OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE //SOFTWARE. package org.rm3l.devfeed import org.springframework.boot.SpringApplication import org.springframework.boot.autoconfigure.SpringBootApplication import org.springframework.context.annotation.PropertySource import org.springframework.context.annotation.PropertySources import org.springframework.scheduling.annotation.EnableScheduling /** * Entry-point */ @SpringBootApplication @PropertySources(value = [ //The order matters here. If a same property key is found in many files, the last one wins. PropertySource(value = ["classpath:application.properties"]), PropertySource(value = ["file:/etc/dev-feed/backend.properties"], ignoreResourceNotFound = true)] ) @EnableScheduling class DevFeedApplication fun main(args: Array<String>) { SpringApplication.run(DevFeedApplication::class.java, *args) }
0
null
0
0
82805d4cc79704ed83f2874e08e1061d81c33b0c
1,936
dev-feed
MIT License
src/commonMain/kotlin/com/github/shaart/pstorage/multiplatform/service/mask/Masker.kt
shaart
643,580,361
false
null
package com.github.shaart.pstorage.multiplatform.service.mask interface Masker { fun username(login: String): String fun alias(alias: String): String }
4
Kotlin
0
0
b0bc580daa6e93296b4dc550fbe724695af3e6ca
161
pstorage-multiplatform
Apache License 2.0
solar/src/main/java/com/chiksmedina/solar/linear/essentionalui/Masks.kt
CMFerrer
689,442,321
false
{"Kotlin": 36591890}
package com.chiksmedina.solar.linear.essentionalui 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.StrokeCap.Companion.Round 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 com.chiksmedina.solar.linear.EssentionalUiGroup val EssentionalUiGroup.Masks: ImageVector get() { if (_masks != null) { return _masks!! } _masks = Builder( name = "Masks", defaultWidth = 24.0.dp, defaultHeight = 24.0.dp, viewportWidth = 24.0f, viewportHeight = 24.0f ).apply { path( fill = SolidColor(Color(0x00000000)), stroke = SolidColor(Color(0xFF000000)), strokeLineWidth = 1.5f, strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = 4.0f, pathFillType = NonZero ) { moveTo(16.7582f, 12.6766f) lineTo(15.9131f, 9.3793f) curveTo(15.4725f, 7.6604f, 15.2522f, 6.8009f, 14.677f, 6.3689f) curveTo(14.4841f, 6.224f, 14.268f, 6.1166f, 14.0388f, 6.0516f) curveTo(13.3551f, 5.8578f, 12.5782f, 6.2216f, 11.0242f, 6.9493f) curveTo(9.8735f, 7.4882f, 9.2981f, 7.7576f, 8.6977f, 7.9482f) curveTo(8.489f, 8.0145f, 8.2782f, 8.0735f, 8.0658f, 8.1252f) curveTo(7.4547f, 8.274f, 6.8276f, 8.3414f, 5.5733f, 8.4762f) curveTo(3.8795f, 8.6583f, 3.0325f, 8.7493f, 2.5332f, 9.2745f) curveTo(2.3658f, 9.4505f, 2.23f, 9.6566f, 2.1323f, 9.8828f) curveTo(1.8407f, 10.5577f, 2.061f, 11.4171f, 2.5016f, 13.136f) lineTo(3.3467f, 16.4334f) curveTo(4.3402f, 20.3093f, 7.6433f, 21.5286f, 9.8629f, 21.9058f) curveTo(10.5401f, 22.0208f, 10.8787f, 22.0784f, 11.907f, 21.7903f) curveTo(12.9353f, 21.5023f, 13.201f, 21.2755f, 13.7324f, 20.8219f) curveTo(15.4742f, 19.335f, 17.7517f, 16.5526f, 16.7582f, 12.6766f) close() } path( fill = SolidColor(Color(0x00000000)), stroke = SolidColor(Color(0xFF000000)), strokeLineWidth = 1.5f, strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = 4.0f, pathFillType = NonZero ) { moveTo(16.5f, 17.221f) curveTo(18.2411f, 16.4706f, 19.9791f, 15.0638f, 20.6533f, 12.4334f) lineTo(21.4984f, 9.136f) curveTo(21.939f, 7.4171f, 22.1593f, 6.5577f, 21.8677f, 5.8828f) curveTo(21.77f, 5.6566f, 21.6342f, 5.4505f, 21.4668f, 5.2745f) curveTo(20.9675f, 4.7493f, 20.1206f, 4.6583f, 18.4267f, 4.4762f) curveTo(17.1724f, 4.3414f, 16.5453f, 4.274f, 15.9342f, 4.1252f) curveTo(15.7218f, 4.0735f, 15.511f, 4.0145f, 15.3023f, 3.9482f) curveTo(14.7019f, 3.7576f, 14.1265f, 3.4882f, 12.9758f, 2.9493f) curveTo(11.4218f, 2.2216f, 10.6449f, 1.8578f, 9.9612f, 2.0516f) curveTo(9.732f, 2.1166f, 9.5159f, 2.224f, 9.323f, 2.3689f) curveTo(8.7478f, 2.8009f, 8.5275f, 3.6604f, 8.087f, 5.3793f) lineTo(7.3874f, 8.1085f) } path( fill = SolidColor(Color(0x00000000)), stroke = SolidColor(Color(0xFF000000)), strokeLineWidth = 1.5f, strokeLineCap = Round, strokeLineJoin = Miter, strokeLineMiter = 4.0f, pathFillType = NonZero ) { moveTo(5.2588f, 13.2955f) curveTo(5.3189f, 12.6763f, 5.78f, 12.1206f, 6.4489f, 11.9414f) curveTo(7.1178f, 11.7621f, 7.7949f, 12.0128f, 8.1566f, 12.5191f) } path( fill = SolidColor(Color(0x00000000)), stroke = SolidColor(Color(0xFF000000)), strokeLineWidth = 1.5f, strokeLineCap = Round, strokeLineJoin = Miter, strokeLineMiter = 4.0f, pathFillType = NonZero ) { moveTo(19.1797f, 8.9356f) curveTo(19.1195f, 8.3164f, 18.6585f, 7.7607f, 17.9896f, 7.5815f) curveTo(17.3207f, 7.4023f, 16.6436f, 7.653f, 16.2819f, 8.1592f) } path( fill = SolidColor(Color(0x00000000)), stroke = SolidColor(Color(0xFF000000)), strokeLineWidth = 1.5f, strokeLineCap = Round, strokeLineJoin = Miter, strokeLineMiter = 4.0f, pathFillType = NonZero ) { moveTo(11.0547f, 11.7423f) curveTo(11.1148f, 11.123f, 11.5759f, 10.5674f, 12.2448f, 10.3881f) curveTo(12.9137f, 10.2089f, 13.5908f, 10.4596f, 13.9525f, 10.9658f) } path( fill = SolidColor(Color(0xFF000000)), stroke = null, strokeLineWidth = 0.0f, strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = 4.0f, pathFillType = NonZero ) { moveTo(11.0962f, 7.042f) curveTo(10.8554f, 7.379f, 10.387f, 7.457f, 10.05f, 7.2162f) curveTo(9.7129f, 6.9754f, 9.6349f, 6.507f, 9.8757f, 6.17f) lineTo(11.0962f, 7.042f) close() moveTo(11.9996f, 6.7527f) curveTo(11.6209f, 6.6512f, 11.2691f, 6.8f, 11.0962f, 7.042f) lineTo(9.8757f, 6.17f) curveTo(10.4262f, 5.3995f, 11.4287f, 5.0468f, 12.3878f, 5.3038f) lineTo(11.9996f, 6.7527f) close() moveTo(12.4781f, 7.0656f) curveTo(12.3674f, 6.9229f, 12.204f, 6.8075f, 11.9996f, 6.7527f) lineTo(12.3878f, 5.3038f) curveTo(12.9123f, 5.4444f, 13.3544f, 5.7479f, 13.6635f, 6.1464f) lineTo(12.4781f, 7.0656f) close() } path( fill = SolidColor(Color(0x00000000)), stroke = SolidColor(Color(0xFF000000)), strokeLineWidth = 1.5f, strokeLineCap = Round, strokeLineJoin = Miter, strokeLineMiter = 4.0f, pathFillType = NonZero ) { moveTo(13.2006f, 16.231f) curveTo(13.2006f, 16.231f, 12.1758f, 15.4703f, 10.3883f, 15.9492f) curveTo(8.6009f, 16.4282f, 8.0937f, 17.5994f, 8.0937f, 17.5994f) } } .build() return _masks!! } private var _masks: ImageVector? = null
0
Kotlin
0
0
3414a20650d644afac2581ad87a8525971222678
6,868
SolarIconSetAndroid
MIT License
QuickUtil/src/main/java/com/wpf/app/quickutil/helper/UiSizeHelper.kt
walgr
487,438,913
false
{"Kotlin": 793775, "Shell": 946}
package com.wpf.app.quickutil.helper import android.annotation.SuppressLint import android.content.Context import android.graphics.Point import android.os.Build import android.util.DisplayMetrics import android.view.WindowManager import com.wpf.app.quickutil.init.ApplicationInitRegister import com.wpf.app.quickutil.init.QuickInit import java.lang.ref.SoftReference object UiSizeHelper : ApplicationInitRegister { override var context: SoftReference<Context>? = null init { QuickInit.register(this) } fun getDisplayMetrics(): DisplayMetrics { val displayMetrics = DisplayMetrics() if (context?.get() == null) return displayMetrics val windowManager: WindowManager = (context?.get()?.getSystemService(Context.WINDOW_SERVICE) as WindowManager) windowManager.defaultDisplay.getMetrics(displayMetrics) return displayMetrics } fun getScreeSize(): Point { val size = Point() if (context?.get() == null) return size val windowManager: WindowManager = (context?.get()?.getSystemService(Context.WINDOW_SERVICE) as WindowManager) if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) { windowManager.defaultDisplay.getSize(size) } else { val rect = windowManager.currentWindowMetrics.bounds size.x = rect.width() size.y = rect.height() } return size } fun getScreeWidth(): Int { return getScreeSize().x } fun getScreeHeight(): Int { return getScreeSize().y } @SuppressLint("DiscouragedApi", "InternalInsetResource") fun getStatusBarHeight(): Int { if (context?.get() == null) return 0 val resources = context?.get()?.resources!! return resources.getDimensionPixelSize( resources.getIdentifier( "status_bar_height", "dimen", "android" ) ) } }
0
Kotlin
3
26
696786c105b13ea09f4edf95f84612a90d6eec41
1,933
Quick
MIT License
native/objcexport-header-generator/testData/headers/topLevelInterfaceExtensionProperty/Foo.kt
JetBrains
3,432,266
false
{"Kotlin": 79571273, "Java": 6776465, "Swift": 4063829, "C": 2609744, "C++": 1957654, "Objective-C++": 175279, "JavaScript": 130754, "Python": 59855, "Shell": 34920, "Objective-C": 21463, "Lex": 21452, "Batchfile": 11382, "CSS": 11368, "Ruby": 10470, "Dockerfile": 9907, "Groovy": 7092, "EJS": 5241, "CMake": 4473, "HTML": 2699, "Puppet": 1698, "FreeMarker": 1393, "Roff": 725, "Scala": 80}
interface Bar public val Bar.fooExtension: Bar get() = TODO()
181
Kotlin
5748
49,172
33eb9cef3d146062c103f9853d772f0a1da0450e
62
kotlin
Apache License 2.0
local/local/src/test/java/com/nimbusframework/nimbuslocal/clients/LocalInternalClientBuilderTest.kt
thomasjallerton
163,180,980
false
{"YAML": 3, "Ignore List": 2, "XML": 4, "Maven POM": 9, "Dockerfile": 1, "Text": 1, "Markdown": 35, "Kotlin": 570, "Java": 167, "JSON": 2, "JavaScript": 4, "SVG": 4, "CSS": 1}
package com.nimbusframework.nimbuslocal.clients import io.kotest.core.spec.style.StringSpec import io.kotest.matchers.shouldBe internal class LocalInternalClientBuilderTest: StringSpec({ "Correct is local" { LocalInternalClientBuilder.isLocal() shouldBe true } })
4
Kotlin
4
39
5c3325caaf3fe9de9ffad130fd1e773c6f680e89
284
nimbus-framework
MIT License
kompack-base/src/commonTest/kotlin/com/wunderbee/kompack/mpack/testsuite/BigNums.kt
dedee
621,699,131
false
null
package com.wunderbee.kompack.mpack.testsuite import com.wunderbee.kompack.mpack.unpack.InMemoryUnpacker import com.wunderbee.kompack.mpack.util.dehex import kotlin.test.Test import kotlin.test.assertEquals class BigNums { @Test fun `23 number-bignum`() { // "23.number-bignum.yaml": [ // { // "number": 4294967296, // "bignum": "4294967296", // "msgpack": [ // "cf-00-00-00-01-00-00-00-00", // "d3-00-00-00-01-00-00-00-00", // "ca-4f-80-00-00", // "cb-41-f0-00-00-00-00-00-00" // ] // }, assertEquals(4294967296uL, InMemoryUnpacker("cf-00-00-00-01-00-00-00-00".dehex()).unpackULong()) assertEquals(4294967296, InMemoryUnpacker("d3-00-00-00-01-00-00-00-00".dehex()).unpackLong()) assertEquals( 4294967296.0, InMemoryUnpacker("ca-4f-80-00-00".dehex()).unpackFloat()!!.toDouble(), 0.01 ) assertEquals( 4294967296.0, InMemoryUnpacker("cb-41-f0-00-00-00-00-00-00".dehex()).unpackDouble()!!, 0.01 ) // { // "number": -4294967296, // "bignum": "-4294967296", // "msgpack": [ // "d3-ff-ff-ff-ff-00-00-00-00", // "cb-c1-f0-00-00-00-00-00-00" // ] // }, assertEquals(-4294967296, InMemoryUnpacker("d3-ff-ff-ff-ff-00-00-00-00".dehex()).unpackLong()) assertEquals( -4294967296.0, InMemoryUnpacker("cb-c1-f0-00-00-00-00-00-00".dehex()).unpackDouble()!!, 0.01 ) // { // "number": 281474976710656, // "bignum": "281474976710656", // "msgpack": [ // "cf-00-01-00-00-00-00-00-00", // "d3-00-01-00-00-00-00-00-00", // "ca-57-80-00-00", // "cb-42-f0-00-00-00-00-00-00" // ] // }, assertEquals(281474976710656uL, InMemoryUnpacker("cf-00-01-00-00-00-00-00-00".dehex()).unpackULong()) assertEquals(281474976710656, InMemoryUnpacker("d3-00-01-00-00-00-00-00-00".dehex()).unpackLong()) assertEquals( 281474976710656.0, InMemoryUnpacker("ca-57-80-00-00".dehex()).unpackFloat()!!.toDouble(), 0.01 ) assertEquals( 281474976710656.0, InMemoryUnpacker("cb-42-f0-00-00-00-00-00-00".dehex()).unpackDouble()!!, 0.01 ) // { // "number": -281474976710656, // "bignum": "-281474976710656", // "msgpack": [ // "d3-ff-ff-00-00-00-00-00-00", // "ca-d7-80-00-00", // "cb-c2-f0-00-00-00-00-00-00" // ] // }, assertEquals(-281474976710656, InMemoryUnpacker("d3-ff-ff-00-00-00-00-00-00".dehex()).unpackLong()) assertEquals( -281474976710656.0, InMemoryUnpacker("ca-d7-80-00-00".dehex()).unpackFloat()!!.toDouble(), 0.01 ) assertEquals( -281474976710656.0, InMemoryUnpacker("cb-c2-f0-00-00-00-00-00-00".dehex()).unpackDouble()!!, 0.01 ) // { // "bignum": "9223372036854775807", // "msgpack": [ // "d3-7f-ff-ff-ff-ff-ff-ff-ff", // "cf-7f-ff-ff-ff-ff-ff-ff-ff" // ] // }, assertEquals( 9223372036854775807, InMemoryUnpacker("d3-7f-ff-ff-ff-ff-ff-ff-ff".dehex()).unpackLong() ) assertEquals( 9223372036854775807uL, InMemoryUnpacker("cf-7f-ff-ff-ff-ff-ff-ff-ff".dehex()).unpackULong() ) // { // "bignum": "-9223372036854775807", // "msgpack": [ // "d3-80-00-00-00-00-00-00-01" // ] // }, assertEquals( -9223372036854775807, InMemoryUnpacker("d3-80-00-00-00-00-00-00-01".dehex()).unpackLong() ) // { // "bignum": "9223372036854775808", // "msgpack": [ // "cf-80-00-00-00-00-00-00-00" // ] // }, assertEquals( 9223372036854775808uL, InMemoryUnpacker("cf-80-00-00-00-00-00-00-00".dehex()).unpackULong() ) // { // "bignum": "-9223372036854775808", // "msgpack": [ // "d3-80-00-00-00-00-00-00-00" // ] // }, assertEquals( "-9223372036854775808", InMemoryUnpacker("d3-80-00-00-00-00-00-00-00".dehex()).unpackLong().toString() ) assertEquals( "-9223372036854775808".toLong(), InMemoryUnpacker("d3-80-00-00-00-00-00-00-00".dehex()).unpackLong() ) // { // "bignum": "18446744073709551615", // "msgpack": [ // "cf-ff-ff-ff-ff-ff-ff-ff-ff" // ] // } // ], assertEquals( 18446744073709551615uL, InMemoryUnpacker("cf-ff-ff-ff-ff-ff-ff-ff-ff".dehex()).unpackULong() ) } }
7
Kotlin
0
0
62ddc06864526bfcacdb2575b7eb91d576a684af
5,339
kompack
Apache License 2.0
shared/src/androidMain/kotlin/di/Utils.kt
adelsaramii
727,620,001
false
{"Kotlin": 1014333, "Swift": 2299, "Shell": 228}
package com.attendace.leopard.di import android.util.Log import dev.icerock.moko.mvvm.viewmodel.ViewModel import org.koin.androidx.viewmodel.dsl.viewModel import org.koin.core.definition.Definition import org.koin.core.definition.KoinDefinition import org.koin.core.module.Module import org.koin.core.parameter.ParametersHolder import org.koin.core.qualifier.Qualifier import org.koin.core.scope.Scope import org.koin.dsl.module actual inline fun <reified T : ViewModel> Module.viewModelDefinition( qualifier: Qualifier?, noinline definition: Definition<T>, ): KoinDefinition<T> = viewModel(qualifier = qualifier, definition = definition) actual fun loge(message : String) { Log.e("adelLog", message ) }
0
Kotlin
0
0
ed51d4c99caafefc5fc70cedbe0dd0fa62cce271
718
Leopard-Multiplatform
Apache License 2.0
trees/src/main/kotlin/tree/CoarseGrainedTree.kt
ksenmel
807,262,823
false
{"Kotlin": 20819}
package tree import node.TreeNode import kotlinx.coroutines.sync.Mutex class CoarseGrainedTree<T : Comparable<T>> : AbstractTree<T>() { private val mutex = Mutex() override suspend fun add(key: T) { mutex.lock() insertNode(key) mutex.unlock() } private fun createNewNode(key: T) = TreeNode(key) private fun insertNode(key: T): TreeNode<T>? { if (root == null) { val newNode = createNewNode(key) root = newNode return newNode } var currentNode = root ?: throw IllegalStateException("case when the root is null is processed above") while (true) { val res = key.compareTo(currentNode.key) if (res < 0) { if (currentNode.left == null) { val createdNode = createNewNode(key) currentNode.left = createdNode createdNode.parent = currentNode return createdNode } currentNode = currentNode.left ?: throw IllegalStateException("case when the left child of the currentNode is null is processed above") } else if (res > 0) { if (currentNode.right == null) { val createdNode = createNewNode(key) currentNode.right = createdNode createdNode.parent = currentNode return createdNode } currentNode = currentNode.right ?: throw IllegalStateException("case when the right child of the currentNode is null is processed above") } else { currentNode.key = key return null } } } override suspend fun search(key: T): T? { mutex.lock() searchNode(key) mutex.unlock() return searchNode(key)?.key } private fun searchNode(key: T): TreeNode<T>? { var currentNode = root while (currentNode != null) { val res = key.compareTo(currentNode.key) currentNode = when { res < 0 -> currentNode.left res > 0 -> currentNode.right else -> return currentNode } } return null } override suspend fun delete(key: T): T? { val node = searchNode(key) ?: return null val dataToDelete = node.key mutex.lock() deleteNode(node) mutex.unlock() return dataToDelete } private fun deleteNode(node: TreeNode<T>): TreeNode<T>? { return when { node.left == null && node.right == null -> deleteLeafNode(node) node.left == null || node.right == null -> deleteNodeWithOneChild(node) else -> deleteNodeWithTwoChildren(node) } } private fun replaceChild(wasChild: TreeNode<T>, newChild: TreeNode<T>?) { val parent = wasChild.parent if (parent == null) { root = newChild } else if (parent.left == wasChild) { parent.left = newChild } else { parent.right = newChild } newChild?.parent = wasChild.parent } private fun findPredecessor(node: TreeNode<T>): TreeNode<T> { var nodeToReplaceWith = node.left ?: throw IllegalStateException("node must have two children") while (nodeToReplaceWith.right != null) { nodeToReplaceWith = nodeToReplaceWith.right ?: throw IllegalStateException("nodeToReplaceWith must have right child") } return nodeToReplaceWith } private fun deleteLeafNode(node: TreeNode<T>): TreeNode<T> { replaceChild(node, null) return node } private fun deleteNodeWithOneChild(node: TreeNode<T>): TreeNode<T> { val nodeToReplaceWith = if (node.left == null) node.right else node.left replaceChild(node, nodeToReplaceWith) return node } private fun deleteNodeWithTwoChildren(node: TreeNode<T>): TreeNode<T>? { val nodePredecessor = findPredecessor(node) node.key = nodePredecessor.key return deleteNode(nodePredecessor) } }
0
Kotlin
0
0
2a2d7e1dbbce78f338d6ca671d342d43b4e334ae
4,273
bst-concurrent
MIT License
src/main/kotlin/me/fzzyhmstrs/imbued_gear/registry/RegisterTag.kt
fzzyhmstrs
678,587,058
false
null
package me.fzzyhmstrs.imbued_gear.registry import me.fzzyhmstrs.amethyst_core.AC import me.fzzyhmstrs.amethyst_core.scepter_util.ScepterTier import net.minecraft.item.Item import net.minecraft.registry.RegistryKeys import net.minecraft.registry.tag.TagKey import net.minecraft.util.Identifier @Suppress("unused") object RegisterTag { val TIER_4_SPELL_SCEPTERS: TagKey<Item> = TagKey.of(RegistryKeys.ITEM, Identifier(AC.MOD_ID,"tier_four_spell_scepters")) val FOUR = ScepterTier(TIER_4_SPELL_SCEPTERS,4) fun registerAll(){} }
0
Kotlin
0
0
4fdf08980d24ce66620e6a13150d33943fe5da28
540
ig
MIT License
trip_cost_app/android/app/src/main/kotlin/com/example/trip_cost_app/MainActivity.kt
ufukkaraca
331,323,446
false
{"Dart": 27678, "HTML": 3022, "Swift": 1616, "Kotlin": 649, "Objective-C": 152}
package com.example.trip_cost_app import io.flutter.embedding.android.FlutterActivity class MainActivity: FlutterActivity() { }
0
Dart
0
0
34e0e0525465ef0581c1c19605f66556ac920ebf
130
flutterProjects
MIT License
bundles/github.com/korlibs/korge-bundles/7439e5c7de7442f2cd33a1944846d44aea31af0a/korau-opus/src/commonMain/kotlin/com/soywiz/korau/format/org/gragravarr/skeleton/SkeletonFisbone.kt
jfbilodeau
402,501,246
false
null
/* * 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 korlibs.audio.format.org.gragravarr.skeleton import korlibs.memory.* import korlibs.audio.format.org.gragravarr.ogg.* /** * The Fisbone (note - no h) provides details about * what the other streams in the file are. * See http://wiki.xiph.org/SkeletonHeaders for a list of * the suggested "Message Headers", and what they mean. */ class SkeletonFisbone : HighLevelOggStreamPacket, SkeletonPacket { private var messageHeaderOffset: Int = 0 var serialNumber: Int = 0 var numHeaderPackets: Int = 0 var granulerateNumerator: Long = 0 var granulerateDenominator: Long = 0 var baseGranule: Long = 0 var preroll: Int = 0 var granuleShift: Byte = 0 private var contentType: String? = null private val messageHeaders = HashMap<String, String>() constructor() : super() { messageHeaderOffset = MESSAGE_HEADER_OFFSET contentType = OggStreamIdentifier.UNKNOWN.mimetype } constructor(pkt: OggPacket) : super(pkt, null) { // Verify the type val data = this.data!! if (!IOUtils.byteRangeMatches(SkeletonPacket.MAGIC_FISBONE_BYTES, data, 0)) { throw IllegalArgumentException("Invalid type, not a Skeleton Fisbone Header") } // Parse messageHeaderOffset = IOUtils.getInt4(data!!, 8).toInt() if (messageHeaderOffset != MESSAGE_HEADER_OFFSET) { throw IllegalArgumentException("Unsupported Skeleton message offset $messageHeaderOffset detected") } serialNumber = IOUtils.getInt4(data, 12).toInt() numHeaderPackets = IOUtils.getInt4(data, 16).toInt() granulerateNumerator = IOUtils.getInt8(data, 20) granulerateDenominator = IOUtils.getInt8(data, 28) baseGranule = IOUtils.getInt8(data, 36) preroll = IOUtils.getInt4(data, 44).toInt() granuleShift = data[48] // Next 3 are padding // Rest should be the message headers, in html/mime style val headers = IOUtils.getUTF8(data, 52, data.size - 52) if (!headers.contains(HEADER_CONTENT_TYPE)) { throw IllegalArgumentException("No Content Type header found in $headers") } for (line in headers.split("\r\n")) { val splitAt = line.indexOf(": ") val k = line.substring(0, splitAt) val v = line.substring(splitAt + 2) messageHeaders[k] = v if (HEADER_CONTENT_TYPE == k) { contentType = v } } } override fun write(): OggPacket { // Encode the message headers first val headersStr = StringBuilder() for (k in messageHeaders.keys) { headersStr.append(k) headersStr.append(": ") headersStr.append(messageHeaders[k]) headersStr.append("\r\n") } val headers = IOUtils.toUTF8Bytes(headersStr.toString()) // Now calculate the size val size = 52 + headers.size val data = ByteArray(size) arraycopy(SkeletonPacket.MAGIC_FISBONE_BYTES, 0, data, 0, 8) IOUtils.putInt4(data, 8, messageHeaderOffset) IOUtils.putInt4(data, 12, serialNumber) IOUtils.putInt4(data, 16, numHeaderPackets) IOUtils.putInt8(data, 20, granulerateNumerator) IOUtils.putInt8(data, 28, granulerateDenominator) IOUtils.putInt8(data, 36, baseGranule) IOUtils.putInt4(data, 44, preroll) data[48] = granuleShift // Next 3 are zero padding // Finally the message headers arraycopy(headers, 0, data, 52, headers.size) this.data = data return super.write() } fun getContentType(): String? { return contentType } fun setContentType(contentType: String) { this.contentType = contentType messageHeaders[HEADER_CONTENT_TYPE] = contentType } /** * Provides read and write access to the Message Headers, * which are used to describe the stream. * http://wiki.xiph.org/SkeletonHeaders provides documentation * on the common headers, and the meaning of their values. */ fun getMessageHeaders(): Map<String, String> { return messageHeaders } companion object { private val MESSAGE_HEADER_OFFSET = 52 - SkeletonPacket.MAGIC_FISBONE_BYTES.size private val HEADER_CONTENT_TYPE = "Content-Type" } }
0
Kotlin
1
2
306f034be2d9832743c3fb0acfbfd46b53c7f01f
4,435
BeyondBeachball
Apache License 2.0
CoughExtractor/app/src/main/java/com/coughextractor/MainActivity.kt
VSU-CS-MCS
294,459,385
false
null
package com.coughextractor import android.Manifest import android.bluetooth.BluetoothAdapter import android.content.Intent import android.content.pm.PackageManager import android.os.Bundle import android.util.Log import android.view.View import androidx.activity.ComponentActivity import androidx.activity.viewModels import androidx.databinding.DataBindingUtil import kotlin.concurrent.timer import dagger.hilt.android.AndroidEntryPoint import com.github.mikephil.charting.charts.LineChart import com.github.mikephil.charting.data.Entry import com.github.mikephil.charting.data.LineData import com.github.mikephil.charting.data.LineDataSet import com.github.mikephil.charting.utils.ColorTemplate import com.coughextractor.databinding.ActivityMainBinding import com.coughextractor.device.CoughDeviceError enum class MainActivityRequestCodes(val code: Int) { EnableBluetooth(1) } private const val TAG = "MainActivity" private const val REQUEST_PERMISSION_CODE = 200 @AndroidEntryPoint class MainActivity() : ComponentActivity() { val viewModel: MainViewModel by viewModels() override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) viewModel.baseDir = externalCacheDir?.absolutePath ?: "" requestPermissions(permissions, REQUEST_PERMISSION_CODE) val binding: ActivityMainBinding = DataBindingUtil.setContentView(this, R.layout.activity_main) binding.viewModel = viewModel binding.lifecycleOwner = this val chart = findViewById<View>(R.id.chart) as LineChart val amplitudesEntries: MutableList<Entry> = ArrayList(viewModel.amplitudesLength) val amplitudesDataSet = LineDataSet(amplitudesEntries, getString(R.string.chart_amplitude_label)) amplitudesDataSet.setDrawCircles(false) amplitudesDataSet.color = ColorTemplate.VORDIPLOM_COLORS[0] val amplitudeThresholdEntries: MutableList<Entry> = ArrayList(viewModel.amplitudesLength) val amplitudeThresholdDataSet = LineDataSet(amplitudeThresholdEntries, getString(R.string.amplitude_label)) amplitudeThresholdDataSet.setDrawCircles(false) amplitudeThresholdDataSet.color = ColorTemplate.VORDIPLOM_COLORS[1] val amplitudesDataSetLineData = LineData(amplitudesDataSet, amplitudeThresholdDataSet) chart.data = amplitudesDataSetLineData viewModel.amplitudeObservable.observe(this) { val amplitudeThreshold = viewModel.coughRecorder.amplitudeThreshold amplitudeThresholdDataSet.clear() if (amplitudeThreshold != null) { amplitudeThresholdDataSet.addEntry(Entry(0.0f, amplitudeThreshold.toFloat())) amplitudeThresholdDataSet.addEntry(Entry(viewModel.amplitudesLength.toFloat(), amplitudeThreshold.toFloat())) } amplitudeThresholdDataSet.notifyDataSetChanged() amplitudesDataSetLineData.notifyDataChanged() chart.notifyDataSetChanged() chart.invalidate() } timer("Chart Updater", period = 1000 / 24) { runOnUiThread { synchronized(viewModel.amplitudesLock) { val amplitudes = viewModel.amplitudes.value!! amplitudesDataSet.clear() for (amplitude in amplitudes.withIndex()) { amplitudesDataSet.addEntry(Entry(amplitude.index.toFloat(), amplitude.value)) } amplitudesDataSet.notifyDataSetChanged() amplitudesDataSetLineData.notifyDataChanged() chart.notifyDataSetChanged() chart.invalidate() } } } } override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { super.onActivityResult(requestCode, resultCode, data) when (requestCode) { MainActivityRequestCodes.EnableBluetooth.code -> { when (resultCode) { RESULT_OK -> { connectToDevice() } RESULT_CANCELED -> { Log.w(TAG, "Bluetooth not enabled") } } } } } private var permissionToRecordAccepted = false private var permissions: Array<String> = arrayOf(Manifest.permission.RECORD_AUDIO) override fun onRequestPermissionsResult( requestCode: Int, permissions: Array<String>, grantResults: IntArray ) { super.onRequestPermissionsResult(requestCode, permissions, grantResults) permissionToRecordAccepted = if (requestCode == REQUEST_PERMISSION_CODE) { grantResults[0] == PackageManager.PERMISSION_GRANTED } else { false } if (!permissionToRecordAccepted) finish() } private fun askToEnableBluetooth() { val enableBtIntent = Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE) startActivityForResult(enableBtIntent, MainActivityRequestCodes.EnableBluetooth.code) } private fun connectToDevice() { when (viewModel.coughDevice.connect()) { CoughDeviceError.BluetoothAdapterNotFound -> Log.wtf(TAG, "Bluetooth adapter not found") CoughDeviceError.BluetoothDisabled -> askToEnableBluetooth() CoughDeviceError.CoughDeviceNotFound -> Log.e(TAG, "Cough device not found") } } }
0
Kotlin
1
0
5e9236613826cb7bf417704ed238729a9ef0d270
5,488
CoughRecognition
MIT License
domain/src/main/java/com/apx6/domain/dto/CmdCheckListWithCategory.kt
volt772
506,075,620
false
null
package com.apx6.domain.dto data class CmdCheckListWithCategory ( val id: Int = 0, val cid: Int, val uid: Int, val title: String, val memo: String?= "", val startDate: Long, val endDate: Long, val categoryName: String ) { companion object { } }
0
Kotlin
0
0
bd8b2a81a97e10c7dddc6a202c4316364b328ad2
297
chipmunk
Apache License 2.0
src/main/java/pe/chalk/bukkit/pos/Util.kt
ChalkPE
166,050,909
false
null
package pe.chalk.bukkit.pos import org.bukkit.ChatColor import org.bukkit.block.Biome fun format(x: Int): String { return "${ChatColor.BOLD}${ChatColor.AQUA}$x${ChatColor.RESET}" } fun getBiomeName(biome: Biome): String { // from .minecraft/assets 1.16 (minecraft/lang/ko_kr.json) return when(biome.name.toLowerCase()) { "badlands" -> "악지 지형" "badlands_plateau" -> "악지 지형 고원" "bamboo_jungle" -> "대나무 정글" "bamboo_jungle_hills" -> "대나무 정글 언덕" "basalt_deltas" -> "현무암 삼각주" "beach" -> "해변" "birch_forest" -> "자작나무 숲" "birch_forest_hills" -> "자작나무 숲 언덕" "cold_ocean" -> "차가운 바다" "crimson_forest" -> "진홍빛 숲" "dark_forest" -> "어두운 숲" "dark_forest_hills" -> "어두운 숲 언덕" "deep_cold_ocean" -> "깊고 차가운 바다" "deep_frozen_ocean" -> "깊고 얼어붙은 바다" "deep_lukewarm_ocean" -> "깊고 미지근한 바다" "deep_ocean" -> "깊은 바다" "deep_warm_ocean" -> "깊고 따뜻한 바다" "desert" -> "사막" "desert_hills" -> "사막 언덕" "desert_lakes" -> "사막 호수" "end_barrens" -> "엔드 불모지" "end_highlands" -> "엔드 고지" "end_midlands" -> "엔드 중지" "eroded_badlands" -> "침식된 악지 지형" "flower_forest" -> "꽃 숲" "forest" -> "숲" "frozen_ocean" -> "얼어붙은 바다" "frozen_river" -> "얼어붙은 강" "giant_spruce_taiga" -> "거대 가문비나무 타이가" "giant_spruce_taiga_hills" -> "거대 가문비나무 타이가 언덕" "giant_tree_taiga" -> "거대 나무 타이가" "giant_tree_taiga_hills" -> "거대 나무 타이가 언덕" "gravelly_mountains" -> "자갈투성이 산" "ice_spikes" -> "역고드름" "jungle" -> "정글" "jungle_edge" -> "정글 변두리" "jungle_hills" -> "정글 언덕" "lukewarm_ocean" -> "미지근한 바다" "modified_badlands_plateau" -> "변형된 악지 지형 고원" "modified_gravelly_mountains" -> "자갈투성이 산+" "modified_jungle" -> "변형된 정글" "modified_jungle_edge" -> "변형된 정글 변두리" "modified_wooded_badlands_plateau" -> "변형된 나무가 우거진 악지 지형 고원" "mountain_edge" -> "산 변두리" "mountains" -> "산" "mushroom_field_shore" -> "버섯 들판 해안" "mushroom_fields" -> "버섯 들판" "nether_wastes" -> "네더 황무지" "ocean" -> "바다" "plains" -> "평원" "river" -> "강" "savanna" -> "사바나" "savanna_plateau" -> "사바나 고원" "shattered_savanna" -> "산산이 조각난 사바나" "shattered_savanna_plateau" -> "산산이 조각난 사바나 고원" "small_end_islands" -> "작은 엔드 섬" "snowy_beach" -> "눈 덮인 해변" "snowy_mountains" -> "눈 덮인 산" "snowy_taiga" -> "눈 덮인 타이가" "snowy_taiga_hills" -> "눈 덮인 타이가 언덕" "snowy_taiga_mountains" -> "눈 덮인 타이가 산" "snowy_tundra" -> "눈 덮인 툰드라" "soul_sand_valley" -> "영혼 모래 골짜기" "stone_shore" -> "돌 해안" "sunflower_plains" -> "해바라기 평원" "swamp" -> "늪" "swamp_hills" -> "늪 언덕" "taiga" -> "타이가" "taiga_hills" -> "타이가 언덕" "taiga_mountains" -> "타이가 산" "tall_birch_forest" -> "키 큰 자작나무 숲" "tall_birch_hills" -> "키 큰 자작나무 언덕" "the_end" -> "디 엔드" "the_void" -> "공허" "warm_ocean" -> "따뜻한 바다" "warped_forest" -> "뒤틀린 숲" "wooded_badlands_plateau" -> "나무가 우거진 악지 지형 고원" "wooded_hills" -> "나무가 우거진 언덕" "wooded_mountains" -> "나무가 우거진 산" else -> "[위치 링크를 표시할 수 없는 지역입니다]" } }
0
Kotlin
0
0
b2113168ae2b9846bf652e2edbbbd5f5ce529d37
3,361
bukkit-pos
MIT License
src/test/kotlin/io/dkozak/sudoku/model/SudokuPuzzleTest.kt
d-kozak
235,422,673
false
null
package io.dkozak.sudoku.model import assertk.assertThat import assertk.assertions.isEqualTo import assertk.assertions.isNotEqualTo import io.dkozak.sudoku.io.loadPuzzle import org.junit.jupiter.api.Nested import org.junit.jupiter.api.Test /** * Abstract test class verifying the interface of SudokuPuzzle * For each concrete puzzle, on subclass should be created and a given factory method implemented, * this way the common interface can be tested for all implementation without copy pasting the code */ abstract class SudokuPuzzleTest { abstract fun factory(size: Int): SudokuPuzzle<*> @Nested inner class ToStringTest { @Test fun simple() { val puzzle = loadPuzzle("src/test/resources/puzzles/first.sudoku", ::factory) assertThat(puzzle.toPrintableString()) .isEqualTo("""------------------------------ | 1 3 | 8 | 4 5 | | 2 4 | 6 5 | | | 8 7 | | 9 3 | ------------------------------ | 4 9 | 3 6 | | | 1 | | 5 | | | 7 1 | 9 3 | ------------------------------ | 6 9 | | 7 4 | | | 2 7 | 6 8 | | 1 2 | 8 | 3 5 | ------------------------------ """) } } @Nested inner class EqualsTest { @Test fun `simple comparison`() { val simple1 = loadPuzzle("src/test/resources/puzzles/first.sudoku", ::factory) val simple2 = loadPuzzle("src/test/resources/puzzles/first.sudoku", ::factory) val second = loadPuzzle("src/test/resources/puzzles/second.sudoku", ::factory) assertThat(simple1).isEqualTo(simple2) assertThat(simple2).isEqualTo(simple1) assertThat(simple1).isNotEqualTo(second) assertThat(second).isNotEqualTo(simple1) } @Test fun `compare and change`() { val simple1 = loadPuzzle("src/test/resources/puzzles/first.sudoku", ::factory) val simple2 = loadPuzzle("src/test/resources/puzzles/first.sudoku", ::factory) assertThat(simple1).isEqualTo(simple2) assertThat(simple2).isEqualTo(simple1) simple2[1, 1] = 3 assertThat(simple1).isNotEqualTo(simple2) assertThat(simple2).isNotEqualTo(simple1) } } }
0
Kotlin
0
0
dc3b23604bd7c7b6274f8057136f6493531b8281
2,365
sudoku-solver
MIT License
app/src/main/java/space/mrandika/gitbook/viewmodel/users/UserViewModel.kt
mrandika
639,822,197
false
null
package space.mrandika.gitbook.viewmodel.users import android.app.Application import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch import retrofit2.Call import retrofit2.Callback import retrofit2.Response import space.mrandika.gitbook.config.ApiConfig import space.mrandika.gitbook.model.local.user.UserLocal import space.mrandika.gitbook.model.remote.repository.Repository import space.mrandika.gitbook.model.remote.user.UserDetail import space.mrandika.gitbook.repository.UserRepository class UserViewModel(application: Application): ViewModel() { // Room private val mUserRepository: UserRepository = UserRepository(application) // Loading state private val _isLoading = MutableLiveData<Boolean>() val isLoading: LiveData<Boolean> = _isLoading // Error state private val _isError = MutableLiveData<Boolean>() val isError: LiveData<Boolean> = _isError // Result private val _user = MutableLiveData<UserDetail>() val user: LiveData<UserDetail> = _user private val _repositories = MutableLiveData<List<Repository>>() val repositories: LiveData<List<Repository>> = _repositories fun getUserDetail(username: String) { _isLoading.value = true val client = ApiConfig.getApiService().getUser(username) client.enqueue(object : Callback<UserDetail> { override fun onResponse(call: Call<UserDetail>, response: Response<UserDetail>) { _isLoading.value = false if (response.isSuccessful) { _user.value = response.body() } else { _isError.value = true } } override fun onFailure(call: Call<UserDetail>, t: Throwable) { _isLoading.value = false _isError.value = true } }) } private fun addToFavorites(user: UserLocal) { mUserRepository.insert(user) } private fun removeFromFavorites(user: UserLocal) { mUserRepository.delete(user) } fun isUserExist(callback: (result: Boolean, user: UserLocal) -> Unit) { CoroutineScope(Dispatchers.IO).launch { val user = mapRemoteToLocal(_user.value) val isExist = mUserRepository.isUserExist(user) callback.invoke(isExist, user) } } fun onFavorited(callback: (result: Boolean) -> Unit) { isUserExist { exist, user -> var result = false if (exist) { removeFromFavorites(user) } else { result = true addToFavorites(user) } callback.invoke(result) } } private fun mapRemoteToLocal(user: UserDetail?): UserLocal { return UserLocal(user?.id ?: 0, user?.login ?: "", user?.avatarUrl ?: "") } }
0
Kotlin
0
0
c82d5ceb4ce4752164db7c1498075e71313e41f0
3,017
android-gitbook
MIT License
app/src/main/java/com/microsoft/research/karya/injection/DatabaseModule.kt
microsoft
463,097,428
false
null
package com.microsoft.research.karya.injection import android.content.Context import androidx.room.Room import com.microsoft.research.karya.data.manager.KaryaDatabase import dagger.Module import dagger.Provides import dagger.hilt.InstallIn import dagger.hilt.android.qualifiers.ApplicationContext import dagger.hilt.components.SingletonComponent import javax.inject.Singleton @Module @InstallIn(SingletonComponent::class) class DatabaseModule { @Provides @Singleton fun providesKaryaDatabase(@ApplicationContext context: Context): KaryaDatabase { return Room.databaseBuilder(context, KaryaDatabase::class.java, "karya.db").build() } }
5
Kotlin
2
5
f967a2a8e78551446d8beaff26ba2bdc6f9c56cc
650
rural-crowdsourcing-toolkit-client
MIT License
src/com/hxz/mpxjs/model/source/MpxUnresolvedComponent.kt
wuxianqiang
508,329,768
false
null
// 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 com.hxz.mpxjs.model.source import com.intellij.lang.javascript.psi.JSType import com.intellij.lang.javascript.psi.types.JSAnyType import com.intellij.psi.PsiElement import com.hxz.mpxjs.model.VueComponent import com.hxz.mpxjs.model.VueEntitiesContainer import com.hxz.mpxjs.model.getDefaultVueComponentInstanceType class VueUnresolvedComponent(private val context: PsiElement) : VueComponent { override val defaultName: String? = null override val source: PsiElement? = null override val parents: List<VueEntitiesContainer> = emptyList() override val thisType: JSType get() = getDefaultVueComponentInstanceType(context) ?: JSAnyType.get(context, false) }
0
Kotlin
0
1
324941e55e9c55f4d2536a8b3e60e29e50aecb08
821
intellij-plugin-mpx
Apache License 2.0
eclipse-pde-partial-idea/src/main/kotlin/cn/varsa/idea/pde/partial/plugin/framework/TcRacFrameworkSupportProvider.kt
JaneWardSandy
361,593,873
false
null
package cn.varsa.idea.pde.partial.plugin.framework import cn.varsa.idea.pde.partial.plugin.facet.* import com.intellij.facet.ui.* import com.intellij.ide.util.frameworkSupport.* import com.intellij.openapi.roots.* class TcRacFrameworkSupportProvider : FacetBasedFrameworkSupportProvider<PDEFacet>(PDEFacetType.getInstance()) { override fun setupConfiguration(facet: PDEFacet, rootModel: ModifiableRootModel, version: FrameworkVersion?) {} }
3
null
5
9
5c8192b92d5b0d3eba9e7a6218d180a0996aea49
447
eclipse-pde-partial-idea
Apache License 2.0
app/src/main/java/com/redeyesncode/write/base/CommonResponseModel.kt
RedEyesNCode
570,919,856
false
{"Kotlin": 41189}
package com.redeyesncode.write.base import com.google.gson.annotations.SerializedName data class CommonResponseModel(@SerializedName("status" ) var status : String? = null, @SerializedName("code" ) var code : Int? = null, @SerializedName("message" ) var message : String? = null)
0
Kotlin
0
0
3d4d9ceadbea4f1f6cbf408ace01e7e1286b3998
293
Write_
MIT License
android/src/main/kotlin/live/hms/hmssdk_flutter/methods/HMSSessionStoreAction.kt
100mslive
381,963,509
false
null
package live.hms.hmssdk_flutter.methods import io.flutter.plugin.common.MethodCall import io.flutter.plugin.common.MethodChannel.Result import live.hms.hmssdk_flutter.HMSCommonAction import live.hms.hmssdk_flutter.HMSErrorLogger import live.hms.hmssdk_flutter.HMSExceptionExtension import live.hms.hmssdk_flutter.HMSResultExtension import live.hms.video.error.HMSException import live.hms.video.sdk.HMSSessionMetadataListener import live.hms.video.sessionstore.HmsSessionStore class HMSSessionStoreAction { companion object { fun sessionStoreActions(call: MethodCall, result: Result, hmsSessionStore: HmsSessionStore?) { when (call.method) { "get_session_metadata_for_key" -> { getSessionMetadataForKey(call, result, hmsSessionStore) } "set_session_metadata_for_key" -> { setSessionMetadataForKey(call, result, hmsSessionStore) } } } /*** * This is used to get session metadata corresponding to the provided key * * If the key is null we log the error and return from method since we have the let * block in place already * * This method returns [sessionMetadata] is the session metadata is available for corresponding key */ private fun getSessionMetadataForKey(call: MethodCall, result: Result, hmsSessionStore: HmsSessionStore?) { val key = call.argument<String?>("key") ?: run { HMSErrorLogger.returnArgumentsError("key is null") } key?.let { key as String hmsSessionStore?.get( key, object : HMSSessionMetadataListener { override fun onError(error: HMSException) { result.success(HMSResultExtension.toDictionary(false, HMSExceptionExtension.toDictionary(error))) } override fun onSuccess(sessionMetadata: Any?) { if (sessionMetadata is String?) { result.success(HMSResultExtension.toDictionary(true, sessionMetadata)) } else { HMSErrorLogger.returnHMSException("getSessionMetadataForKey", "Session metadata type is not compatible, Please use String? type while setting metadata", "Type Incompatibility Error", result) } } }, ) } } /*** * This is used to set session metadata corresponding to the provided key * * If the key is null we log the error and return from method since we have the let * block in place already * * This method sets the [data] provided during the method call * The completion of this method is marked by actionResultListener's [onSuccess] or [onError] callback */ private fun setSessionMetadataForKey(call: MethodCall, result: Result, hmsSessionStore: HmsSessionStore?) { val key = call.argument<String?>("key") ?: run { HMSErrorLogger.returnArgumentsError("key is null") } val data = call.argument<String?>("data") key?.let { key as String hmsSessionStore?.set(data, key, HMSCommonAction.getActionListener(result)) } } } }
62
Dart
49
87
743ea5d5260f61e0209ca2301fb4cefc038dbd74
3,550
100ms-flutter
MIT License
src/main/kotlin/no/nav/amt/person/service/kafka/ingestor/OppfolgingsperiodeIngestor.kt
navikt
618,357,446
false
{"Kotlin": 356332, "PLpgSQL": 635, "Dockerfile": 156}
package no.nav.amt.person.service.kafka.ingestor import no.nav.amt.person.service.nav_bruker.NavBrukerService import no.nav.amt.person.service.nav_bruker.Oppfolgingsperiode import no.nav.amt.person.service.person.PersonService import no.nav.amt.person.service.utils.JsonUtils.fromJsonString import org.slf4j.LoggerFactory import org.springframework.stereotype.Service import java.time.ZonedDateTime import java.util.UUID @Service class OppfolgingsperiodeIngestor( private val personService: PersonService, private val navBrukerService: NavBrukerService, ) { private val log = LoggerFactory.getLogger(javaClass) fun ingest(value: String) { val sisteOppfolgingsperiode = fromJsonString<SisteOppfolgingsperiodeV1>(value) val gjeldendeIdent = personService.hentGjeldendeIdent(sisteOppfolgingsperiode.aktorId) val brukerId = navBrukerService.finnBrukerId(gjeldendeIdent.ident) if (brukerId == null) { log.info("Oppfølgingsperiode endret. NavBruker finnes ikke, hopper over kafka melding") return } navBrukerService.oppdaterOppfolgingsperiode( brukerId, Oppfolgingsperiode( id = sisteOppfolgingsperiode.uuid, startdato = sisteOppfolgingsperiode.startDato.toLocalDateTime(), sluttdato = sisteOppfolgingsperiode.sluttDato?.toLocalDateTime() ) ) log.info("Oppdatert oppfølgingsperiode med id ${sisteOppfolgingsperiode.uuid} for bruker $brukerId") } data class SisteOppfolgingsperiodeV1( val uuid: UUID, val aktorId: String, val startDato: ZonedDateTime, val sluttDato: ZonedDateTime?, ) }
0
Kotlin
0
0
a99a93eb640cc7f9cd16ac2375579b5aeffd49d7
1,546
amt-person-service
MIT License
app/src/main/java/com/nullpointer/userscompose/domain/users/UserRepoImpl.kt
Hcnc100
490,083,706
false
null
package com.nullpointer.userscompose.domain.users import android.accounts.NetworkErrorException import com.nullpointer.userscompose.core.utils.InternetCheck import com.nullpointer.userscompose.data.local.datasource.UsersLocalDataSourceImpl import com.nullpointer.userscompose.data.remote.UsersRemoteDataSourceImpl import com.nullpointer.userscompose.models.User import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.withTimeoutOrNull import javax.inject.Inject class UserRepoImpl @Inject constructor( private val usersLocalDataSource: UsersLocalDataSourceImpl, private val usersRemoteDataSource: UsersRemoteDataSourceImpl ) : UsersRepository { override val listUsers: Flow<List<User>> = usersLocalDataSource.listUsers override suspend fun addNewUser(): User { // * if the internet is not available throw exception if (!InternetCheck.isNetworkAvailable()) throw NetworkErrorException() val newUser = withTimeoutOrNull(5_000) { usersRemoteDataSource.getNewUser() }?.also { usersLocalDataSource.addNewUser(it) } // * if time out so send time out error return newUser!! } override suspend fun deleterUser(user: User) = usersLocalDataSource.deleterUser(user) override suspend fun deleterAllUsers() = usersLocalDataSource.deleterAllUsers() override suspend fun deleterUserByIds(list: List<Long>) = usersLocalDataSource.deleterUserById(list) override suspend fun getUserById(id: Long): User? = usersLocalDataSource.getUserById(id) }
0
Kotlin
0
1
a058dcc664c2ecedda8b67c092b025b0263315aa
1,589
UsersCompose
MIT License
sange/src/main/java/zlc/season/sange/SangeAdapter.kt
DoveBarnett
256,474,347
true
{"Kotlin": 36244, "Java": 377}
package zlc.season.sange import android.view.View import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView.Adapter import androidx.recyclerview.widget.RecyclerView.ViewHolder abstract class SangeAdapter<T : Any, VH : ViewHolder>( protected open val dataSource: DataSource<T> ) : Adapter<VH>() { override fun onAttachedToRecyclerView(recyclerView: RecyclerView) { super.onAttachedToRecyclerView(recyclerView) dataSource.setAdapter(this) //To avoid memory leaks, clean up automatically registerAutoClear(recyclerView) } override fun onDetachedFromRecyclerView(recyclerView: RecyclerView) { super.onDetachedFromRecyclerView(recyclerView) dataSource.setAdapter(null) } open fun getItem(position: Int): T { return dataSource.getItemInner(position) } override fun getItemCount(): Int { return dataSource.getItemCount() } private fun registerAutoClear(recyclerView: RecyclerView) { recyclerView.addOnAttachStateChangeListener( object : View.OnAttachStateChangeListener { override fun onViewDetachedFromWindow(v: View?) { recyclerView.adapter = null dataSource.setAdapter(null) recyclerView.removeOnAttachStateChangeListener(this) //Clean up when the Adapter is not needed if (!hasObservers()) { dataSource.cleanUp() } } override fun onViewAttachedToWindow(v: View?) { } }) } }
0
null
0
0
cd9d6cdfa805da940bc4d05fbd49e076f2d04e6f
1,668
Sange
Apache License 2.0
src/main/kotlin/com/baulsupp/okurl/authenticator/authflow/AuthFlow.kt
yschimke
48,341,449
false
{"Kotlin": 515385, "Shell": 843, "Smarty": 777}
package com.baulsupp.okurl.authenticator.authflow import com.baulsupp.okurl.credentials.ServiceDefinition import okhttp3.OkHttpClient interface AuthFlow<T> { val type: AuthFlowType val serviceDefinition: ServiceDefinition<T> suspend fun init(client: OkHttpClient) fun options(): List<AuthOption<*>> }
16
Kotlin
15
126
32ad9f89d17500399ac16b735f1398ad6ca32f41
313
okurl
Apache License 2.0
app/src/main/java/tech/salroid/filmy/ui/fragment/SearchFragment.kt
salRoid
64,316,425
false
null
package tech.salroid.filmy.ui.fragment import android.content.Context import android.content.Intent import android.content.res.Configuration import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.view.inputmethod.InputMethodManager import androidx.fragment.app.Fragment import androidx.preference.PreferenceManager import androidx.recyclerview.widget.GridLayoutManager import tech.salroid.filmy.ui.activities.MovieDetailsActivity import tech.salroid.filmy.ui.adapters.SearchResultAdapter import tech.salroid.filmy.data.local.model.SearchResult import tech.salroid.filmy.databinding.FragmentSearchBinding class SearchFragment : Fragment() { private var _binding: FragmentSearchBinding? = null private val binding get() = _binding!! override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? ): View { _binding = FragmentSearchBinding.inflate(inflater, container, false) val view = binding.root val sp = PreferenceManager.getDefaultSharedPreferences(requireContext()) //val nightMode = sp.getBoolean("dark", false) when (activity?.resources?.configuration?.orientation) { Configuration.ORIENTATION_PORTRAIT -> { val gridLayoutManager = GridLayoutManager( context, 3, ) binding.searchResultsRecycler.layoutManager = gridLayoutManager } else -> { val gridLayoutManager = GridLayoutManager( context, 5, ) binding.searchResultsRecycler.layoutManager = gridLayoutManager } } return view } private fun itemClicked(searchData: SearchResult, position: Int) { Intent(activity, MovieDetailsActivity::class.java).run { putExtra("network_applicable", true) putExtra("title", searchData.originalTitle) putExtra("id", searchData.id.toString()) putExtra("activity", false) startActivity(this) } } fun getSearchedResult(query: String) { /* NetworkUtil.searchMovies(finalQuery, { searchResultResponse -> searchResultResponse?.let { showSearchResults(it.results) } }, { })*/ } fun showSearchResults(results: List<SearchResult>) { val adapter = SearchResultAdapter(results) { searchData, position -> itemClicked(searchData, position) } binding.searchResultsRecycler.adapter = adapter hideProgress() hideSoftKeyboard() } fun showProgress() { binding.breathingProgress.visibility = View.VISIBLE binding.searchResultsRecycler.visibility = View.INVISIBLE } private fun hideProgress() { binding.breathingProgress.visibility = View.INVISIBLE binding.searchResultsRecycler.visibility = View.VISIBLE } private fun hideSoftKeyboard() { if (activity != null && activity?.currentFocus != null) { val inputMethodManager = activity?.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager inputMethodManager.hideSoftInputFromWindow(activity?.currentFocus?.windowToken, 0) } } override fun onDestroyView() { super.onDestroyView() _binding = null } }
0
Kotlin
185
712
89bba9d6ba3ec0caed3ce1df859ca3859cff6b61
3,538
Filmy
Apache License 2.0
app/src/main/java/com/faigenbloom/testtask/ui/common/FileUtils.kt
ZakharchenkoWork
770,109,532
false
{"Kotlin": 135379}
package com.faigenbloom.testtask.ui.common import android.net.Uri import android.provider.OpenableColumns import androidx.compose.runtime.Composable import androidx.compose.ui.platform.LocalContext @Composable fun Uri.getName(): String { return LocalContext.current.contentResolver .query(this, null, null, null, null) ?.let { it.moveToFirst() val index = it.getColumnIndex(OpenableColumns.DISPLAY_NAME) if (index >= 0) { val name = it.getString(index) it.close() name } else { "" } } ?: "" }
0
Kotlin
0
0
d2612bd1e7882acadba48072177b2a58b8527606
646
WittixTestTask
Apache License 2.0
fetch2/src/main/java/com/tonyodev/fetch2/helper/QueuedReportingRunnable.kt
mirshahbazi
145,403,213
true
{"Java": 1166313, "Kotlin": 500258}
package com.tonyodev.fetch2.helper import com.tonyodev.fetch2.Download import com.tonyodev.fetch2.database.DownloadInfo abstract class QueuedReportingRunnable : Runnable { var download: Download = DownloadInfo() var waitingOnNetwork: Boolean = false }
0
Java
0
0
fefc264b66ee8d90175e6e1f8be909f54e4c331b
264
Fetch
Apache License 2.0
app/src/main/java/com/pachatary/presentation/register/RegisterPresenter.kt
jordifierro
116,311,809
false
null
package com.pachatary.presentation.register import android.annotation.SuppressLint import android.arch.lifecycle.LifecycleObserver import com.pachatary.data.auth.AuthRepository import com.pachatary.data.common.ClientException import com.pachatary.presentation.common.injection.scheduler.SchedulerProvider import javax.inject.Inject class RegisterPresenter @Inject constructor(private val authRepository: AuthRepository, private val schedulerProvider: SchedulerProvider) : LifecycleObserver { lateinit var view: RegisterView @SuppressLint("CheckResult") fun doneButtonClick() { view.showLoader() view.blockDoneButton(true) authRepository.register(view.getUsername(), view.getEmail()) .subscribeOn(schedulerProvider.subscriber()) .observeOn(schedulerProvider.observer()) .subscribe({ view.hideLoader() view.blockDoneButton(false) if (it.isSuccess()) { view.showSuccessMessage() view.finishApplication() } else if (it.error is ClientException && it.error.code == "already_registered") view.finish() else view.showErrorMessage(it.error!!.message!!) }, { throw it }) } }
0
Kotlin
0
2
ac6ba680b0d149027bb0e75266f160fce30fd5de
1,421
pachatary-android
Apache License 2.0
danbooru/network-check/src/test/kotlin/com/makentoshe/booruchan/danbooru/post/context/XmlDanbooruPostsContextTest.kt
Makentoshe
147,361,920
false
null
package com.makentoshe.booruchan.danbooru.post.context import DanbooruPostsNetworkManager import com.makentoshe.booruchan.danbooru.post.network.DanbooruPostsFilter import com.makentoshe.booruchan.danbooru.post.network.XmlDanbooruPostsRequest import io.ktor.client.* import kotlinx.coroutines.runBlocking import org.junit.Assert.assertEquals import org.junit.Test class XmlDanbooruPostsContextTest: DanbooruPostsContextTest() { override val context = XmlDanbooruPostsContext { DanbooruPostsNetworkManager(HttpClient()).getPosts(it) } @Test fun `should request xml posts`() = runBlocking { val filterBuilder = DanbooruPostsFilter.Builder() val count = filterBuilder.count.build(5) val request = XmlDanbooruPostsRequest(filterBuilder.build(count)) logger.info { "Xml url request: ${request.url}" } assertEquals("https://danbooru.donmai.us/posts.xml?limit=5", request.url) val result = context.get(request) logger.info { "Result: $result" } val successResult = context.get(request).getOrNull()!! assertEquals(5, successResult.deserializes.size) } }
0
Kotlin
1
6
d0f40fb8011967e212df1f21beb43e4c4ec03356
1,139
Booruchan
Apache License 2.0
Step45/Step45KMM/wearapp/src/main/java/com/example/wearapp/MainActivity.kt
beeradmoore
486,762,277
false
{"C#": 75205, "Objective-C": 13851, "Swift": 6592, "Kotlin": 4990, "Shell": 149}
package com.example.wearapp import android.app.Activity import android.os.Bundle import com.example.step45kmm.Platform import com.example.wearapp.databinding.ActivityMainBinding class MainActivity : Activity() { private lateinit var binding: ActivityMainBinding override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) binding = ActivityMainBinding.inflate(layoutInflater) binding.text.text = Platform().platform setContentView(binding.root) } }
0
C#
1
15
171d64de5a45c88d7fe89f3413b15d006c45373e
526
MAUI-Watch-n-Wear
MIT License
app/src/main/java/rocks/flawless/marveltestapp/api/retrofit/models/responses/DataResponse.kt
tperraut
184,448,958
false
null
package rocks.flawless.marveltestapp.api.retrofit.models.responses import com.google.gson.annotations.SerializedName import rocks.flawless.marveltestapp.api.retrofit.models.Data data class DataResponse<T>( @SerializedName("data") val data: Data<T> )
0
Kotlin
0
0
bb83235657fb90cfb70b46d3d5c7aa13f9474342
255
marvel-android-test
MIT License
src/main/kotlin/de/tobiasgies/ootr/draftbot/data/DraftPool.kt
tobiasgies
702,804,530
false
{"Kotlin": 47466}
package de.tobiasgies.ootr.draftbot.data data class DraftPool( val major: Map<String, Draftable>, val minor: Map<String, Draftable>, ) { fun without(name: String) = DraftPool( major = major - name, minor = minor - name, ) }
0
Kotlin
0
0
6fe52f480e53363ae75e345ac582f3f3d8105489
256
ootr-draftbot
MIT License