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
app/src/main/java/com/eilco/cartalog/utils/BaseUrls.kt
younessbakache
756,089,412
false
{"Kotlin": 145526}
package com.vitor238.cartalog.utils object BaseUrls { const val BASE_TMDB_URL = "https://public.opendatasoft.com/api/explore/v2.1/catalog/datasets/all-vehicles-model/" const val BASE_TMDB_IMG_URL_200 = "https://image.tmdb.org/t/p/w200" }
0
Kotlin
0
0
999bfd08813b9807c95a42cc055bb912a7ab7d71
246
Cartalog-App
Apache License 2.0
libB/src/main/java/package_B_18/Foo_B_1817.kt
lekz112
118,451,085
false
null
package package_B_18 class Foo_B_1817 { fun foo0() { var i=0 i+=Math.random().toInt() i+=Math.random().toInt() i+=Math.random().toInt() i+=Math.random().toInt() i+=Math.random().toInt() i+=Math.random().toInt() i+=Math.random().toInt() i+=Math.random().toInt() i+=Math.random().toInt() i+=Math.random().toInt() i+=Math.random().toInt() i+=Math.random().toInt() i+=Math.random().toInt() i+=Math.random().toInt() i+=Math.random().toInt() i+=Math.random().toInt() i+=Math.random().toInt() i+=Math.random().toInt() i+=Math.random().toInt() i+=Math.random().toInt() Foo_B_1816().foo0() } }
0
Kotlin
0
0
8182b7f6e92f9d65efb954c32ca640fe50ae6b79
584
ModuleTest
Apache License 2.0
libB/src/main/java/package_B_18/Foo_B_1817.kt
lekz112
118,451,085
false
null
package package_B_18 class Foo_B_1817 { fun foo0() { var i=0 i+=Math.random().toInt() i+=Math.random().toInt() i+=Math.random().toInt() i+=Math.random().toInt() i+=Math.random().toInt() i+=Math.random().toInt() i+=Math.random().toInt() i+=Math.random().toInt() i+=Math.random().toInt() i+=Math.random().toInt() i+=Math.random().toInt() i+=Math.random().toInt() i+=Math.random().toInt() i+=Math.random().toInt() i+=Math.random().toInt() i+=Math.random().toInt() i+=Math.random().toInt() i+=Math.random().toInt() i+=Math.random().toInt() i+=Math.random().toInt() Foo_B_1816().foo0() } }
0
Kotlin
0
0
8182b7f6e92f9d65efb954c32ca640fe50ae6b79
584
ModuleTest
Apache License 2.0
app/src/main/java/com/ubaidmerchant/findamatch/model/LoginModel.kt
ubaid-merchant
293,975,010
false
null
package com.ubaidmerchant.findamatch.model data class LoginModel( val uuid: String?, val username: String?, val password: String?, val salt: String?, val md5: String?, val sha1: String?, val sha256: String? )
0
Kotlin
0
0
fccb8cdb68e1fdf761ecbf2c5f5036ba18e23661
237
FindAMatch
MIT License
FingerprintVerifyer/src/main/java/com/liangguo/fingerprintverifyer/BiometricHelper.kt
ldh-star
464,807,833
false
null
package com.liangguo.fingerprintverifyer import android.os.Build import androidx.fragment.app.FragmentActivity import com.liangguo.fingerprintverifyer.core.BiometricVerifier import com.liangguo.fingerprintverifyer.core.BiometricVerifierCallback import com.liangguo.fingerprintverifyer.core.FingerPrintVerifier /** * @author ldh * 时间: 2022/1/13 18:57 * 邮箱: <EMAIL> * * 指纹识别的工具类。 * 封装了安卓6以上和安卓10以上两种指纹识别方式,不支持安卓6以下。 * * @param enableSystemDialog 是否弹出系统对话框进行生物识别,默认为不弹出系统对话框 */ class BiometricHelper(activity: FragmentActivity, private val enableSystemDialog: Boolean = false) { private var mCallback: BiometricVerifierCallback? = null private val mFingerPrintVerifier = if (enableSystemDialog && Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { // >28 Android 10以上有系统自带生物识别弹窗,可以识别指纹和面部 BiometricVerifier(activity) } else { // 对指纹进行验证 // 在 Android 6.0 (API 23) 之前的设备上使用 FingerPrintVerifier(activity) } fun setCallback(callback: BiometricVerifierCallback?) = (this).apply { this.mCallback = callback } /** * 执行指纹或面部识别 */ fun authenticate() = (this).apply { mFingerPrintVerifier.authenticate(mCallback) } /** * 取消 */ fun cancel() = (this).apply { mFingerPrintVerifier.cancel() } }
0
Kotlin
0
0
189ee8ec6251f4ddae4bdc957d9bf5bdc1532675
1,362
FingerprintVerifyer
Apache License 2.0
app/src/main/java/ru/vitaliy/belyaev/wishapp/utils/Context.kt
VitaliyBelyaev
398,851,175
false
{"Kotlin": 386804, "Swift": 91562, "Ruby": 2345}
package ru.vitaliy.belyaev.wishapp.utils import android.app.ActivityManager import android.content.ActivityNotFoundException import android.content.Context import android.content.Intent import android.net.Uri import android.os.Handler import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.material.ExperimentalMaterialApi import androidx.compose.ui.ExperimentalComposeUiApi import androidx.core.os.postDelayed import ru.vitaliy.belyaev.wishapp.BuildConfig import ru.vitaliy.belyaev.wishapp.ui.AppActivity fun Context.openGooglePlay() { try { val uriString = "market://details?id=${BuildConfig.APPLICATION_ID}" startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(uriString))) } catch (e: ActivityNotFoundException) { val webUriString = "https://play.google.com/store/apps/details?id=${BuildConfig.APPLICATION_ID}" startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(webUriString))) } } @OptIn( ExperimentalFoundationApi::class, ExperimentalComposeUiApi::class, ExperimentalMaterialApi::class ) fun Context.restartAppWithDelayMillis(delayMillis: Long) { val activityManager = getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager Handler(mainLooper).postDelayed(delayMillis) { val intent = Intent(this, AppActivity::class.java).apply { flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK } startActivity(intent) kotlin.system.exitProcess(0) } }
1
Kotlin
1
23
f034eebfd9adaea16f723b3aeb0825b946beea96
1,516
WishApp
Apache License 2.0
aoc-2018/src/test/kotlin/nl/jstege/adventofcode/aoc2018/days/Day20Test.kt
JStege1206
92,714,900
false
null
package nl.jstege.adventofcode.aoc2018.days import nl.jstege.adventofcode.aoccommon.utils.DayTester class Day20Test : DayTester(Day20())
0
Kotlin
0
0
d48f7f98c4c5c59e2a2dfff42a68ac2a78b1e025
139
AdventOfCode
MIT License
app/src/main/java/com/abaferastech/marvelapp/MarvelApplication.kt
CheeseCake-Team
633,955,610
false
null
package com.abaferastech.marvelapp import android.app.Application import dagger.hilt.android.HiltAndroidApp @HiltAndroidApp class MarvelApplication : Application() { /*override fun onCreate() { super.onCreate() val refreshWorkerRequest = PeriodicWorkRequestBuilder<RefreshWorker>( repeatInterval = 24L, repeatIntervalTimeUnit = TimeUnit.HOURS ) .setConstraints(Constraints.NONE) .build() WorkManager.getInstance(applicationContext).enqueue(refreshWorkerRequest) }*/ }
0
Kotlin
0
0
7c2e38f2571e5ed5135e2461034d77750546ee23
559
MarvelApp
Apache License 2.0
app/src/main/java/com/codev/recruitment/archielogarta/app/impl/FabListener.kt
logartaa
586,470,320
false
null
package com.codev.recruitment.archielogarta.app.impl import com.codev.recruitment.archielogarta.app.enum.FabActionType import com.codev.recruitment.archielogarta.repository.entity.Contact interface FabListener { fun onFabAction(fabActionType: FabActionType) fun onFabEdit(contact: Contact) fun onFabDelete() fun onFabError(errorMessage: String) }
0
Kotlin
0
0
c2c863f3a2dd87d24b64c466d971a6f1403df0f5
364
MyContacts
Apache License 2.0
bootstrap-icons-compose/src/main/java/com/wiryadev/bootstrapiconscompose/bootstrapicons/normal/ArrowLeftShort.kt
wiryadev
380,639,096
false
null
package com.wiryadev.bootstrapiconscompose.bootstrapicons.normal import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.PathFillType.Companion.EvenOdd import androidx.compose.ui.graphics.SolidColor import androidx.compose.ui.graphics.StrokeCap.Companion.Butt import androidx.compose.ui.graphics.StrokeJoin.Companion.Miter import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.graphics.vector.ImageVector.Builder import androidx.compose.ui.graphics.vector.path import androidx.compose.ui.unit.dp import com.wiryadev.bootstrapiconscompose.bootstrapicons.NormalGroup public val NormalGroup.ArrowLeftShort: ImageVector get() { if (_arrowLeftShort != null) { return _arrowLeftShort!! } _arrowLeftShort = Builder(name = "ArrowLeftShort", defaultWidth = 16.0.dp, defaultHeight = 16.0.dp, viewportWidth = 16.0f, viewportHeight = 16.0f).apply { path(fill = SolidColor(Color(0xFF000000)), stroke = null, strokeLineWidth = 0.0f, strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = 4.0f, pathFillType = EvenOdd) { moveTo(12.0f, 8.0f) arcToRelative(0.5f, 0.5f, 0.0f, false, true, -0.5f, 0.5f) horizontalLineTo(5.707f) lineToRelative(2.147f, 2.146f) arcToRelative(0.5f, 0.5f, 0.0f, false, true, -0.708f, 0.708f) lineToRelative(-3.0f, -3.0f) arcToRelative(0.5f, 0.5f, 0.0f, false, true, 0.0f, -0.708f) lineToRelative(3.0f, -3.0f) arcToRelative(0.5f, 0.5f, 0.0f, true, true, 0.708f, 0.708f) lineTo(5.707f, 7.5f) horizontalLineTo(11.5f) arcToRelative(0.5f, 0.5f, 0.0f, false, true, 0.5f, 0.5f) close() } } .build() return _arrowLeftShort!! } private var _arrowLeftShort: ImageVector? = null
0
Kotlin
0
2
1c199d953dc96b261aab16ac230dc7f01fb14a53
1,996
bootstrap-icons-compose
MIT License
src/main/kotlin/world/cepi/kstom/util/CaseUtils.kt
Project-Cepi
320,725,364
false
null
package world.cepi.kstom.util fun String.pascalToTitle() = Regex("^[a-z]+|[A-Z][a-z]+").findAll(this) .map { it.value.replaceFirstChar(Char::uppercase) }.joinToString(" ") fun String.snakeToTitle() = this.split("_").joinToString(" ") { it.replaceFirstChar(Char::uppercase) }
1
Kotlin
4
8
2bb37b0156cbb6c5af8be845a35ac29c07fba30c
280
KStom
MIT License
app/src/main/java/com/commit451/gitlab/model/api/Label.kt
sunzcdev
100,562,921
true
{"Kotlin": 710591, "Java": 7073, "CSS": 1148}
package com.commit451.gitlab.model.api import com.squareup.moshi.Json import org.parceler.Parcel /** * A label */ @Parcel(Parcel.Serialization.BEAN) open class Label { @field:Json(name = "color") var color: String? = null @field:Json(name = "name") var name: String? = null @field:Json(name = "description") var description: String? = null @field:Json(name = "open_issues_count") var openIssuesCount: Int = 0 @field:Json(name = "closed_issues_count") var closedIssuesCount: Int = 0 @field:Json(name = "open_merge_requests_count") var openMergeRequestsCount: Int = 0 @field:Json(name = "subscribed") var isSubscribed: Boolean = false }
0
Kotlin
0
0
5827bf17c798ec362faf1286045b6396df6a4716
697
LabCoat
Apache License 2.0
app/src/main/java/de/fhe/ai/flipsen/view/ui/settings/SettingsViewModel.kt
fh-erfurt
575,489,613
false
null
package de.fhe.ai.flipsen.view.ui.settings import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel class SettingsViewModel : ViewModel() { private val _text = MutableLiveData<String>().apply { value = "Einstellungen" } val text: LiveData<String> = _text }
0
Kotlin
0
1
99df17d26563326aecb70055d94eda81fbebcaa5
335
ws2022_pme_flipsen
MIT License
android-ktx/src/main/java/io/github/raggedycoder/android/Toast.kt
RaggedyCoder
184,918,243
false
null
/* * Copyright 2019 RaggedyCoder. * * 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. */ @file:Suppress("NOTHING_TO_INLINE") package io.github.raggedycoder.android import android.content.Context import android.widget.Toast import androidx.annotation.StringRes import androidx.fragment.app.Fragment inline fun Context.showToast(message: CharSequence, duration: Int = Toast.LENGTH_SHORT) = Toast.makeText(this, message, duration).apply { this.show() } inline fun Context.showToast(@StringRes messageId: Int, duration: Int = Toast.LENGTH_SHORT) = showToast(this.getText(messageId), duration) inline fun Fragment.showToast(@StringRes messageId: Int, duration: Int = Toast.LENGTH_SHORT) = context?.showToast(messageId, duration) inline fun Fragment.showToast(message: CharSequence, duration: Int = Toast.LENGTH_SHORT) = context?.showToast(message, duration)
0
Kotlin
0
0
82e985169a8c09eadc0434cfd45619f9bc5e2fc8
1,395
AndroidKtx
Apache License 2.0
src/main/kotlin/kr/nagaza/nagazaserver/domain/service/AppInfoService.kt
NAGAZA-Team
706,076,040
false
{"Kotlin": 121612, "Shell": 637}
package kr.nagaza.nagazaserver.domain.service import kr.nagaza.nagazaserver.infrastructure.jpa.repository.JpaAppInfoRepository import org.springframework.stereotype.Service @Service class AppInfoService( private val jpaAppInfoRepository: JpaAppInfoRepository, ) { private val appInfoMap = mutableMapOf<String, Boolean>() fun updateAppInfo() { val result = jpaAppInfoRepository.findAll() result.forEach { appInfoMap[it.appVersion] = it.inService } } fun isInService(version: String): Boolean { return appInfoMap[version] == true } }
0
Kotlin
1
1
536eb9df2b8b2c171d2c5eb92f2a09332b4e278e
603
NAGAZA-Server
MIT License
fashion-tryon-compose/src/main/kotlin/com/aiuta/fashionsdk/tryon/compose/ui/internal/screens/preonboarding/PreOnboardingScreen.kt
aiuta-com
759,918,511
false
{"Kotlin": 666373, "Shell": 1462}
package com.aiuta.fashionsdk.tryon.compose.ui.internal.screens.preonboarding import androidx.compose.foundation.background import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column 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.shape.RoundedCornerShape import androidx.compose.material.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.Color import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp import com.aiuta.fashionsdk.compose.molecules.images.AiutaIcon import com.aiuta.fashionsdk.compose.molecules.images.AiutaImage import com.aiuta.fashionsdk.compose.tokens.composition.LocalTheme import com.aiuta.fashionsdk.compose.tokens.utils.clickableUnindicated import com.aiuta.fashionsdk.internal.analytic.model.AiutaAnalyticOnboardingEventType import com.aiuta.fashionsdk.internal.analytic.model.AiutaAnalyticPageId import com.aiuta.fashionsdk.internal.analytic.model.FinishSession import com.aiuta.fashionsdk.tryon.compose.ui.internal.analytic.clickClose import com.aiuta.fashionsdk.tryon.compose.ui.internal.analytic.sendOnboardingEvent import com.aiuta.fashionsdk.tryon.compose.ui.internal.analytic.sendPageEvent import com.aiuta.fashionsdk.tryon.compose.ui.internal.analytic.sendStartOnBoardingEvent import com.aiuta.fashionsdk.tryon.compose.ui.internal.controller.composition.LocalAiutaTryOnStringResources import com.aiuta.fashionsdk.tryon.compose.ui.internal.controller.composition.LocalController import com.aiuta.fashionsdk.tryon.compose.ui.internal.controller.navigateTo import com.aiuta.fashionsdk.tryon.compose.ui.internal.navigation.NavigationScreen import com.aiuta.fashionsdk.tryon.compose.ui.internal.navigation.components.appbar.AppBar import com.aiuta.fashionsdk.tryon.compose.ui.internal.navigation.components.appbar.AppBarIcon @Composable internal fun PreOnboardingScreen(modifier: Modifier = Modifier) { val controller = LocalController.current val theme = LocalTheme.current sendStartOnBoardingEvent() sendPageEvent(pageId = AiutaAnalyticPageId.WELCOME) Box( modifier = modifier.background(theme.colors.background), contentAlignment = Alignment.Center, ) { theme.images?.preonboardingImage?.let { preonboardingImage -> AiutaImage( modifier = Modifier.fillMaxSize(), image = preonboardingImage, contentScale = ContentScale.Crop, contentDescription = null, ) } AppBar( modifier = Modifier .align(Alignment.TopCenter) .fillMaxWidth() .padding(horizontal = 16.dp), actions = { AppBarIcon( modifier = Modifier.align(Alignment.CenterEnd), icon = theme.icons.close24, color = Color.White, onClick = { controller.clickClose( origin = FinishSession.Origin.PREONBOARDING_SCREEN, pageId = AiutaAnalyticPageId.WELCOME, ) }, ) }, ) PreOnboardingForeground() } } @Composable private fun PreOnboardingForeground(modifier: Modifier = Modifier) { val controller = LocalController.current val theme = LocalTheme.current val stringResources = LocalAiutaTryOnStringResources.current Column( modifier = modifier.padding(horizontal = 24.dp), horizontalAlignment = Alignment.CenterHorizontally, ) { AiutaIcon( modifier = Modifier.size(82.dp), icon = theme.icons.welcomeScreen82, contentDescription = null, tint = Color.Unspecified, ) Spacer(Modifier.height(16.dp)) Text( text = stringResources.preOnboardingTitle, style = theme.typography.titleXL, color = Color.White, textAlign = TextAlign.Center, ) Spacer(Modifier.height(16.dp)) Text( text = stringResources.preOnboardingSubtitle, style = theme.typography.welcomeText, color = Color.White, textAlign = TextAlign.Center, ) Spacer(Modifier.height(36.dp)) StartButton( modifier = Modifier.fillMaxWidth(), onClick = { controller.sendOnboardingEvent( AiutaAnalyticOnboardingEventType.WELCOME_START_CLICKED, ) controller.navigateTo(NavigationScreen.ONBOARDING) }, ) } } @Composable private fun StartButton( modifier: Modifier = Modifier, onClick: () -> Unit, ) { val theme = LocalTheme.current val stringResources = LocalAiutaTryOnStringResources.current Box( modifier = modifier .clip(RoundedCornerShape(4.dp)) .background(theme.colors.background) .clickableUnindicated { onClick() } .padding(vertical = 16.dp), contentAlignment = Alignment.Center, ) { Text( text = stringResources.preOnboardingButton, style = theme.typography.button, color = theme.colors.primary, textAlign = TextAlign.Center, ) } }
6
Kotlin
0
2
6e17d89bf031feff027315f1cc49ed0dd818708e
5,894
android-sdk
Apache License 2.0
packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromOccludedTransitionInteractor.kt
liu-wanshun
595,904,109
true
null
/* * Copyright (C) 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 com.android.systemui.keyguard.domain.interactor import android.animation.ValueAnimator import com.android.systemui.animation.Interpolators import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.keyguard.data.repository.KeyguardTransitionRepository import com.android.systemui.keyguard.shared.model.KeyguardState import com.android.systemui.keyguard.shared.model.TransitionInfo import com.android.systemui.util.kotlin.sample import javax.inject.Inject import kotlin.time.Duration import kotlin.time.Duration.Companion.milliseconds import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.flow.collect import kotlinx.coroutines.launch @SysUISingleton class FromOccludedTransitionInteractor @Inject constructor( @Application private val scope: CoroutineScope, private val keyguardInteractor: KeyguardInteractor, private val keyguardTransitionRepository: KeyguardTransitionRepository, private val keyguardTransitionInteractor: KeyguardTransitionInteractor, ) : TransitionInteractor(FromOccludedTransitionInteractor::class.simpleName!!) { override fun start() { listenForOccludedToLockscreen() listenForOccludedToDreaming() } private fun listenForOccludedToDreaming() { scope.launch { keyguardInteractor.isAbleToDream .sample(keyguardTransitionInteractor.finishedKeyguardState, ::Pair) .collect { pair -> val (isAbleToDream, keyguardState) = pair if (isAbleToDream && keyguardState == KeyguardState.OCCLUDED) { keyguardTransitionRepository.startTransition( TransitionInfo( name, KeyguardState.OCCLUDED, KeyguardState.DREAMING, getAnimator(), ) ) } } } } private fun listenForOccludedToLockscreen() { scope.launch { keyguardInteractor.isKeyguardOccluded .sample(keyguardTransitionInteractor.startedKeyguardTransitionStep, ::Pair) .collect { pair -> val (isOccluded, lastStartedKeyguardState) = pair // Occlusion signals come from the framework, and should interrupt any // existing transition if (!isOccluded && lastStartedKeyguardState.to == KeyguardState.OCCLUDED) { keyguardTransitionRepository.startTransition( TransitionInfo( name, KeyguardState.OCCLUDED, KeyguardState.LOCKSCREEN, getAnimator(TO_LOCKSCREEN_DURATION), ) ) } } } } private fun getAnimator(duration: Duration = DEFAULT_DURATION): ValueAnimator { return ValueAnimator().apply { setInterpolator(Interpolators.LINEAR) setDuration(duration.inWholeMilliseconds) } } companion object { private val DEFAULT_DURATION = 500.milliseconds val TO_LOCKSCREEN_DURATION = 933.milliseconds } }
0
Java
1
2
e99201cd9b6a123b16c30cce427a2dc31bb2f501
4,072
platform_frameworks_base
Apache License 2.0
packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromOccludedTransitionInteractor.kt
liu-wanshun
595,904,109
true
null
/* * Copyright (C) 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 com.android.systemui.keyguard.domain.interactor import android.animation.ValueAnimator import com.android.systemui.animation.Interpolators import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.keyguard.data.repository.KeyguardTransitionRepository import com.android.systemui.keyguard.shared.model.KeyguardState import com.android.systemui.keyguard.shared.model.TransitionInfo import com.android.systemui.util.kotlin.sample import javax.inject.Inject import kotlin.time.Duration import kotlin.time.Duration.Companion.milliseconds import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.flow.collect import kotlinx.coroutines.launch @SysUISingleton class FromOccludedTransitionInteractor @Inject constructor( @Application private val scope: CoroutineScope, private val keyguardInteractor: KeyguardInteractor, private val keyguardTransitionRepository: KeyguardTransitionRepository, private val keyguardTransitionInteractor: KeyguardTransitionInteractor, ) : TransitionInteractor(FromOccludedTransitionInteractor::class.simpleName!!) { override fun start() { listenForOccludedToLockscreen() listenForOccludedToDreaming() } private fun listenForOccludedToDreaming() { scope.launch { keyguardInteractor.isAbleToDream .sample(keyguardTransitionInteractor.finishedKeyguardState, ::Pair) .collect { pair -> val (isAbleToDream, keyguardState) = pair if (isAbleToDream && keyguardState == KeyguardState.OCCLUDED) { keyguardTransitionRepository.startTransition( TransitionInfo( name, KeyguardState.OCCLUDED, KeyguardState.DREAMING, getAnimator(), ) ) } } } } private fun listenForOccludedToLockscreen() { scope.launch { keyguardInteractor.isKeyguardOccluded .sample(keyguardTransitionInteractor.startedKeyguardTransitionStep, ::Pair) .collect { pair -> val (isOccluded, lastStartedKeyguardState) = pair // Occlusion signals come from the framework, and should interrupt any // existing transition if (!isOccluded && lastStartedKeyguardState.to == KeyguardState.OCCLUDED) { keyguardTransitionRepository.startTransition( TransitionInfo( name, KeyguardState.OCCLUDED, KeyguardState.LOCKSCREEN, getAnimator(TO_LOCKSCREEN_DURATION), ) ) } } } } private fun getAnimator(duration: Duration = DEFAULT_DURATION): ValueAnimator { return ValueAnimator().apply { setInterpolator(Interpolators.LINEAR) setDuration(duration.inWholeMilliseconds) } } companion object { private val DEFAULT_DURATION = 500.milliseconds val TO_LOCKSCREEN_DURATION = 933.milliseconds } }
0
Java
1
2
e99201cd9b6a123b16c30cce427a2dc31bb2f501
4,072
platform_frameworks_base
Apache License 2.0
kairo-money/src/main/kotlin/kairo/money/Money.kt
hudson155
836,940,978
false
{"Kotlin": 554879, "HCL": 1700}
package kairo.money import javax.money.Monetary import org.javamoney.moneta.Money public fun Money.round(): Money = with(Monetary.getDefaultRounding()) public fun Iterable<Money>.sumOrNull(): Money? = reduceOrNull(Money::add) public fun Iterable<Money>.sum(currencyCode: String): Money = fold(Money.of(0, currencyCode), Money::add)
0
Kotlin
1
14
8b71e7186f7a39f4d809f424752cd428479851f5
342
kairo
Apache License 2.0
app/src/main/java/com/zocky/githubapp/ui/detail/DetailViewModel.kt
raflizocky
714,308,108
false
{"Kotlin": 45433}
package com.zocky.githubapp.ui.detail import android.app.Application import android.util.Log import androidx.lifecycle.AndroidViewModel import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData import androidx.lifecycle.viewModelScope import com.zocky.githubapp.data.response.DetailResponse import com.zocky.githubapp.data.retrofit.ApiConfig import com.zocky.githubapp.data.room.db.FavoriteUser import com.zocky.githubapp.data.room.repository.FavoriteUserRepository import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch class DetailViewModel(application: Application) : AndroidViewModel(application) { private val repository: FavoriteUserRepository = FavoriteUserRepository(application) private val _isFavorite = MutableLiveData<Boolean>() val isFavorite: LiveData<Boolean> = _isFavorite private val _userDetail = MutableLiveData<DetailResponse>() val userDetail: LiveData<DetailResponse> = _userDetail fun getUserDetail(username: String) { viewModelScope.launch(Dispatchers.IO) { try { val response = ApiConfig.getApiService().getUserDetail(username).execute() if (response.isSuccessful) { val responseBody = response.body() if (responseBody != null) { _userDetail.postValue(responseBody) } else { Log.e(TAG, "getUserDetail: Response body is null") } } else { Log.e(TAG, "getUserDetail: Response is not successful") } } catch (e: Exception) { Log.e(TAG, "getUserDetail: Error - ${e.message}") } } } fun checkFavoriteStatus(username: String) { viewModelScope.launch(Dispatchers.IO) { try { val isUserInFavorites = repository.isFavorite(username) _isFavorite.postValue(isUserInFavorites == 1) // Convert to Boolean } catch (e: Exception) { Log.e(TAG, "checkFavoriteStatus: Error - ${e.message}") } } } fun toggleFavoriteStatus(username: String) { viewModelScope.launch(Dispatchers.IO) { try { val isFavorite = _isFavorite.value ?: false // Use the LiveData value if (isFavorite) { repository.delete(username) Log.d(TAG, "User removed from favorites: $username") } else { val userDetail = userDetail.value if (userDetail != null) { val isUserInFavorites = repository.getFavoriteUserByUsername(username).value != null if (!isUserInFavorites) { val newFavoriteUser = FavoriteUser( username = userDetail.login, avatarUrl = userDetail.avatarUrl ) repository.insert(newFavoriteUser) Log.d(TAG, "User added to favorites: ${userDetail.login}") } } } // Toggle isFavorite _isFavorite.postValue(!isFavorite) } catch (e: Exception) { Log.e(TAG, "Toggle Favorite Error: ${e.message}") } } } companion object { private const val TAG = "DetailViewModel" } }
0
Kotlin
0
1
75c38fe2be4366d078d77fdbc1865c7bd6bbb40a
3,572
github-app
Apache License 2.0
library/src/main/java/com/mabn/calendarlibrary/component/MonthViewCalendar.kt
mateusz800
540,003,807
false
null
package com.mabn.calendarlibrary.component import androidx.compose.foundation.layout.* import androidx.compose.foundation.lazy.grid.GridCells import androidx.compose.foundation.lazy.grid.LazyVerticalGrid import androidx.compose.foundation.lazy.grid.itemsIndexed import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalConfiguration import androidx.compose.ui.unit.dp import com.google.accompanist.flowlayout.FlowColumn import com.google.accompanist.flowlayout.FlowRow import com.mabn.calendarlibrary.core.CalendarTheme import com.mabn.calendarlibrary.utils.dayViewModifier import java.time.LocalDate import java.time.YearMonth @Composable internal fun MonthViewCalendar( loadedDates: Array<List<LocalDate>>, selectedDate: LocalDate, theme: CalendarTheme, currentMonth: YearMonth, loadDatesForMonth: (YearMonth) -> Unit, onDayClick: (LocalDate) -> Unit ) { val itemWidth = LocalConfiguration.current.screenWidthDp / 7 CalendarPager( loadedDates = loadedDates, loadNextDates = { loadDatesForMonth(currentMonth) }, loadPrevDates = { loadDatesForMonth(currentMonth.minusMonths(2)) } // why 2 ) { currentPage -> FlowRow(Modifier.height(355.dp)) { loadedDates[currentPage].forEachIndexed { index, date -> Box( Modifier .width(itemWidth.dp) .padding(5.dp), contentAlignment = Alignment.Center ) { DayView( date, theme = theme, isSelected = selectedDate == date, onDayClick = { onDayClick(date) }, weekDayLabel = index < 7, modifier = Modifier.dayViewModifier(date, currentMonth, monthView = true) ) } } } } }
3
null
6
89
c5deac66e272985b0a1299763dd757ef0163b917
2,028
Expandable-Compose-Calendar
Apache License 2.0
kutil-unit-impl/src/main/java/net/kigawa/kutil/unit/component/UnitCloserComponentImpl.kt
kigawa01
534,968,547
false
null
package net.kigawa.kutil.unit.component import net.kigawa.kutil.unitapi.annotation.getter.LateInit import net.kigawa.kutil.unitapi.component.* import net.kigawa.kutil.unitapi.extention.ComponentDatabase import net.kigawa.kutil.unitapi.extention.UnitCloser @LateInit class UnitCloserComponentImpl( container: UnitContainer, private val loggerComponent: UnitLoggerComponent, database: ComponentDatabase, ): UnitCloserComponent, ComponentHolderImpl<UnitCloser>(container, database, loggerComponent) { override fun closeUnit(identify: UnitInfo<out Any>) { last { return@last loggerComponent.catch(false) { it.closeUnit(identify) } } } }
3
Kotlin
0
0
924a20e797160fb9e93cd4331803654533c5ca59
672
kutil-unit
MIT License
app/ime/src/main/kotlin/studio/lunabee/onesafe/ime/ui/OSKeyboardStatus.kt
LunabeeStudio
624,544,471
false
{"Kotlin": 2127888, "Java": 11977, "Python": 2057}
/* * Copyright (c) 2023 Lunabee Studio * * 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. * * Created by Lunabee Studio / Date - 7/3/2023 - for the oneSafe6 SDK. * Last modified 7/3/23, 10:35 AM */ package studio.lunabee.onesafe.ime.ui import androidx.annotation.DrawableRes import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.material3.Icon import androidx.compose.material3.LocalContentColor import androidx.compose.material3.Surface import androidx.compose.runtime.Composable import androidx.compose.runtime.key import androidx.compose.ui.Modifier import androidx.compose.ui.res.painterResource import androidx.compose.ui.unit.dp import studio.lunabee.compose.core.LbcTextSpec import studio.lunabee.onesafe.commonui.R import studio.lunabee.onesafe.ime.ImeOSTheme import studio.lunabee.onesafe.utils.OsDefaultPreview import studio.lunabee.onesafe.ime.R as imeR enum class OSKeyboardStatus { LoggedIn { override val contentDescription: LbcTextSpec = LbcTextSpec.StringResource(R.string.oneSafeK_ime_status_login_description) override val logo: Int = imeR.drawable.onesafek_logo_login }, LoggedOut { override val contentDescription: LbcTextSpec = LbcTextSpec.StringResource(R.string.oneSafeK_ime_status_logout_description) override val logo: Int = imeR.drawable.onesafek_logo_logout }, ; @Composable fun Logo(modifier: Modifier = Modifier) { key(logo) { // this key seems to fix a weird issue/optim of partially drawn logo problem Icon( painter = painterResource(logo), contentDescription = contentDescription.string, modifier = modifier, tint = LocalContentColor.current, ) } } abstract val contentDescription: LbcTextSpec @get:DrawableRes abstract val logo: Int } @Composable @OsDefaultPreview private fun OSKeyboardStatusLogoPreview() { ImeOSTheme { Surface { Column(verticalArrangement = Arrangement.spacedBy(10.dp)) { OSKeyboardStatus.entries.forEach { it.Logo() } } } } }
0
Kotlin
0
1
b2f1f08531c4431ee08d3ea196bfccc47447060b
2,750
oneSafe6_SDK_Android
Apache License 2.0
app/src/main/java/com/brayskiy/example/core/log/Log.kt
brayskiy
179,559,620
false
null
package com.brayskiy.example.core.log /** * Created by brayskiy on 02/01/19. */ object Log { private lateinit var mLogger: Logger private var isEnabled = false enum class LoggerType { ANDROID, TIMBER } fun init(enable: Boolean, loggerType: LoggerType) { if (enable) { when (loggerType) { Log.LoggerType.TIMBER -> { mLogger = TimberLogger() } Log.LoggerType.ANDROID -> { mLogger = AndroidLogger() } } } isEnabled = enable } fun e(msg: String) { if (isEnabled) mLogger.e(msg) } fun e(throwable: Throwable) { if (isEnabled) mLogger.e(throwable) } fun e(msg: String, vararg args: Any) { if (isEnabled) mLogger.e(msg, *args) } fun w(msg: String) { if (isEnabled) mLogger.w(msg) } fun w(throwable: Throwable) { if (isEnabled) mLogger.w(throwable) } fun w(msg: String, vararg args: Any) { if (isEnabled) mLogger.w(msg, *args) } fun i(msg: String) { if (isEnabled) mLogger.i(msg) } fun i(msg: String, vararg args: Any) { if (isEnabled) mLogger.i(msg, *args) } fun d(msg: String?) { if (isEnabled) mLogger.d(msg) } fun d(msg: String?, vararg args: Any) { if (isEnabled) mLogger.d(msg, *args) } fun v(msg: String?) { if (isEnabled) mLogger.v(msg) } fun v(msg: String?, vararg args: Any) { if (isEnabled) mLogger.v(msg, *args) } }
0
Kotlin
0
0
330e6e4e8d0f3f5037694f82fef7182a5dc251dd
1,625
android-example
Apache License 2.0
fluent-icons-extended/src/commonMain/kotlin/com/konyaco/fluent/icons/regular/PersonSwap.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.PersonSwap: ImageVector get() { if (_personSwap != null) { return _personSwap!! } _personSwap = fluentIcon(name = "Regular.PersonSwap") { fluentPath { moveTo(15.75f, 14.0f) curveToRelative(0.98f, 0.0f, 1.82f, 0.62f, 2.12f, 1.5f) lineTo(4.25f, 15.5f) arcToRelative(0.75f, 0.75f, 0.0f, false, false, -0.75f, 0.75f) verticalLineToRelative(0.57f) curveToRelative(0.0f, 0.54f, 0.2f, 1.06f, 0.54f, 1.46f) curveTo(5.29f, 19.75f, 7.26f, 20.5f, 10.0f, 20.5f) horizontalLineToRelative(0.16f) curveToRelative(0.09f, 0.18f, 0.2f, 0.35f, 0.35f, 0.5f) lineToRelative(0.94f, 0.93f) curveToRelative(-0.47f, 0.05f, -0.95f, 0.07f, -1.45f, 0.07f) curveToRelative(-3.15f, 0.0f, -5.54f, -0.9f, -7.1f, -2.74f) arcToRelative(3.75f, 3.75f, 0.0f, false, true, -0.9f, -2.44f) verticalLineToRelative(-0.57f) curveTo(2.0f, 15.0f, 3.0f, 14.0f, 4.25f, 14.0f) horizontalLineToRelative(11.5f) close() moveTo(10.0f, 2.0f) arcToRelative(5.0f, 5.0f, 0.0f, true, true, 0.0f, 10.0f) arcToRelative(5.0f, 5.0f, 0.0f, false, true, 0.0f, -10.0f) close() moveTo(10.0f, 3.5f) arcToRelative(3.5f, 3.5f, 0.0f, true, false, 0.0f, 7.0f) arcToRelative(3.5f, 3.5f, 0.0f, false, false, 0.0f, -7.0f) close() moveTo(14.78f, 17.78f) arcToRelative(0.75f, 0.75f, 0.0f, false, false, -1.06f, -1.06f) lineToRelative(-2.5f, 2.5f) arcToRelative(0.75f, 0.75f, 0.0f, false, false, 0.0f, 1.06f) lineToRelative(2.5f, 2.5f) arcToRelative(0.75f, 0.75f, 0.0f, false, false, 1.06f, -1.06f) lineToRelative(-1.22f, -1.22f) horizontalLineToRelative(6.88f) lineToRelative(-1.22f, 1.22f) arcToRelative(0.75f, 0.75f, 0.0f, false, false, 1.06f, 1.06f) lineToRelative(2.5f, -2.5f) arcToRelative(0.75f, 0.75f, 0.0f, false, false, 0.0f, -1.06f) lineToRelative(-2.5f, -2.5f) arcToRelative(0.75f, 0.75f, 0.0f, true, false, -1.06f, 1.06f) lineTo(20.44f, 19.0f) horizontalLineToRelative(-6.88f) lineToRelative(1.22f, -1.22f) close() } } return _personSwap!! } private var _personSwap: ImageVector? = null
1
Kotlin
3
83
9e86d93bf1f9ca63a93a913c990e95f13d8ede5a
2,946
compose-fluent-ui
Apache License 2.0
app/src/main/java/behale/health/reminder/receiver/DrinkWaterReceiver.kt
Akshay-kumar79
427,837,509
false
{"Kotlin": 110919}
package behale.health.reminder.receiver import android.app.NotificationManager import android.content.BroadcastReceiver import android.content.Context import android.content.Intent import android.content.SharedPreferences import android.widget.Toast import androidx.core.content.ContextCompat import behale.health.reminder.database.ReminderDataBase import behale.health.reminder.database.water.WaterHistory import behale.health.reminder.database.water.WaterHistoryDao import behale.health.reminder.utils.ConstantUtils import kotlinx.coroutines.* import java.util.* class DrinkWaterReceiver : BroadcastReceiver() { private lateinit var sp: SharedPreferences private var waterProgress = 0 private var containerSize = 0 private lateinit var waterHistoryDatabase: WaterHistoryDao lateinit var mContext: Context override fun onReceive(context: Context?, intent: Intent?) { waterHistoryDatabase = ReminderDataBase.getInstance(context!!.applicationContext).waterHistoryDao mContext = context sp = context.getSharedPreferences(ConstantUtils.MY_SHARED_PREFERENCE, Context.MODE_PRIVATE) waterProgress = sp.getInt(ConstantUtils.WATER_PROGRESS_PREFERENCE, 0) containerSize = sp.getInt(ConstantUtils.CONTAINER_SIZE_PREFERENCE, 300) val notificationManager = ContextCompat.getSystemService(context, NotificationManager::class.java) as NotificationManager drinkWater() notificationManager.cancelAll() } private fun drinkWater() = GlobalScope.launch { // to save in history database var waterAmountGetDrunk = containerSize //check if water limit reached if (waterProgress.plus(containerSize) > 15000) { waterAmountGetDrunk = 15000 - waterProgress // run only if water progress is less then 15000 and update database if (waterAmountGetDrunk > 0) { waterProgress = 15000 sp.edit().putInt(ConstantUtils.WATER_PROGRESS_PREFERENCE, waterProgress).apply() val waterHistory = WaterHistory(time = Calendar.getInstance(), waterIntake = waterAmountGetDrunk) waterHistoryDatabase.insert(waterHistory) } withContext(Dispatchers.Main) { Toast.makeText(mContext, "you have reached upper limit of water intake of a day", Toast.LENGTH_SHORT).show() } return@launch } waterProgress += containerSize sp.edit().putInt(ConstantUtils.WATER_PROGRESS_PREFERENCE, waterProgress).apply() val waterHistory = WaterHistory(time = Calendar.getInstance(), waterIntake = waterAmountGetDrunk) waterHistoryDatabase.insert(waterHistory) } }
0
Kotlin
0
2
cdaa5b20feb2411229eccbb0d3b555b9930fcd97
2,745
Behale
MIT License
app/src/androidTest/java/me/zama/holdmywidgets/mock/arrangement/WidgetArrangementManagerTestImpl.kt
giacomozama
490,050,213
false
null
package me.zama.holdmywidgets.mock.arrangement import me.zama.holdmywidgets.model.widget.arrangement.WidgetArrangement import me.zama.holdmywidgets.model.widget.arrangement.WidgetArrangementManager class WidgetArrangementManagerTestImpl : WidgetArrangementManager { override fun store(arrangement: WidgetArrangement) { } override fun load() = WidgetArrangement.Empty }
0
Kotlin
0
0
8d237b3ec6cde6113f7c38fc6ee27413e9829619
384
hold-my-widgets
MIT License
documents_feature/src/main/java/com/flyview/documents_feature/ui/document/DocumentComponent.kt
DmiMukh
676,402,705
false
{"Kotlin": 296304, "Java": 130379}
package com.flyview.documents_feature.ui.document import com.flyview.documents_feature.ui.document.toolbar.DocumentToolbarComponent interface DocumentComponent { val toolbarComponent: DocumentToolbarComponent fun onScanClick() fun onPlacementClick() }
0
Kotlin
0
0
f2dcebe8643c068c7fd57bfddd85fd1f6d6fd8f9
267
PharmMobile
MIT License
amazon/evidently/fake/src/main/kotlin/org/http4k/connect/amazon/evidently/StoredProject.kt
http4k
295,641,058
false
{"Kotlin": 1624385, "Handlebars": 10370, "CSS": 5434, "Shell": 3178, "JavaScript": 2076, "Python": 1834, "HTML": 675}
package org.http4k.connect.amazon.evidently import org.http4k.connect.amazon.core.model.ARN import org.http4k.connect.amazon.core.model.AwsAccount import org.http4k.connect.amazon.core.model.Region import org.http4k.connect.amazon.evidently.actions.Project import org.http4k.connect.amazon.evidently.model.ProjectName import org.http4k.connect.model.Timestamp import org.http4k.connect.storage.Storage import java.time.Instant data class StoredProject( val accountId: AwsAccount, val region: Region, val name: ProjectName, val description: String?, val tags: Map<String, String>?, val created: Instant, val updated: Instant = created ) val StoredProject.arn get() = ARN.of(Evidently.awsService, region, accountId, "project", name) fun StoredProject.toProject(features: Storage<StoredFeature>) = Project( name = name, description = description, tags = tags, featureCount = features.keySet().count { it == name.value }, arn = arn, createdTime = Timestamp.of(created), activeExperimentCount = null, activeLaunchCount = null, lastUpdatedTime = Timestamp.of(updated), experimentCount = null, launchCount = null, status = "" )
7
Kotlin
17
37
3522f4a2bf5e476b849ec367700544d89e006f71
1,201
http4k-connect
Apache License 2.0
app/src/main/java/com/twilio/conversations/app/common/FirebaseTokenRetriever.kt
mayank-techeniac
366,132,427
true
{"Kotlin": 423618, "Shell": 2710}
package com.twilio.conversations.app.common import com.google.firebase.messaging.FirebaseMessaging import com.twilio.conversations.app.common.enums.ConversationsError import com.twilio.conversations.app.common.extensions.ConversationsException import kotlin.coroutines.resume import kotlin.coroutines.resumeWithException import kotlin.coroutines.suspendCoroutine class FirebaseTokenRetriever { suspend fun retrieveToken() = suspendCoroutine<String> { continuation -> FirebaseMessaging.getInstance().getToken().addOnCompleteListener { task -> try { task.result?.let { continuation.resume(it) } ?: continuation.resumeWithException(ConversationsException(ConversationsError.TOKEN_ERROR)) } catch (e: Exception) { // TOO_MANY_REGISTRATIONS thrown on devices with too many Firebase instances continuation.resumeWithException(ConversationsException(ConversationsError.TOKEN_ERROR)) } } } }
0
null
0
0
bd0d85cf9baadc30cda9013eda0cacbba6b001d0
1,015
twilio-conversations-demo-kotlin
MIT License
src/main/kotlin/no/nav/syfo/api/auth/OIDCUtil.kt
navikt
178,837,883
false
null
package no.nav.syfo.api.auth import no.nav.security.token.support.core.context.TokenValidationContextHolder import no.nav.syfo.api.auth.OIDCClaim.JWT_CLAIM_AZP import no.nav.syfo.api.auth.OIDCClaim.NAVIDENT object OIDCUtil { @JvmStatic fun tokenFraOIDC(contextHolder: TokenValidationContextHolder, issuer: String): String { return contextHolder.tokenValidationContext.getJwtToken(issuer).tokenAsString } fun getNAVIdentFraOIDC(contextHolder: TokenValidationContextHolder): String? { val context = contextHolder.tokenValidationContext return context.getClaims(OIDCIssuer.VEILEDER_AZURE_V2).getStringClaim(NAVIDENT) } fun getConsumerClientIdFraOIDC(contextHolder: TokenValidationContextHolder): String? { val context = contextHolder.tokenValidationContext return context.getClaims(OIDCIssuer.VEILEDER_AZURE_V2).getStringClaim(JWT_CLAIM_AZP) } }
0
Kotlin
0
0
b7324f1b2ed507fcc1f15591d15fa2e158bbfc89
915
fastlegerest
MIT License
shared/src/commonMain/kotlin/ui/library/menu/MyBottomMenu.kt
EvertW
629,878,605
false
{"Kotlin": 88621, "Swift": 612, "Jupyter Notebook": 539, "Shell": 228, "Ruby": 101}
package ui.library.menu import androidx.compose.foundation.background import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.RowScope import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.height import androidx.compose.material3.Icon import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.unit.dp import ui.theme.MyTheme @Composable fun MyBottomMenu( modifier: Modifier = Modifier, items: @Composable RowScope.() -> Unit ) { Row( modifier = modifier .background(MyTheme.colors.background) .height(MyTheme.dimensions.navigationBarHeight), content = items ) } @Composable fun RowScope.MyBottomMenuItem( modifier: Modifier = Modifier, icon: ImageVector, contentDescription: String?, onClick: () -> Unit, ) { Box( modifier = Modifier.fillMaxHeight().weight(1F).clickable(onClick = onClick), contentAlignment = Alignment.Center ) { Icon( modifier = modifier.fillMaxHeight().height(24.dp), imageVector = icon, tint = MyTheme.colors.text, contentDescription = contentDescription, ) } }
0
Kotlin
0
1
3eac617b85601da335fd96058098da129850dfc5
1,456
ComposeMultiplatformExperiment
Apache License 2.0
graphql-api/src/main/kotlin/io/zeebe/zeeqs/graphql/resolvers/type/MessageSubscriptionResolver.kt
camunda-community-hub
237,922,743
false
null
package io.zeebe.zeeqs.data.resolvers import graphql.kickstart.tools.GraphQLResolver import io.zeebe.zeeqs.data.entity.* import io.zeebe.zeeqs.data.repository.ElementInstanceRepository import io.zeebe.zeeqs.data.repository.MessageCorrelationRepository import io.zeebe.zeeqs.data.repository.ProcessInstanceRepository import io.zeebe.zeeqs.data.repository.ProcessRepository import io.zeebe.zeeqs.graphql.resolvers.type.BpmnElement import io.zeebe.zeeqs.graphql.resolvers.type.ResolverExtension import org.springframework.data.repository.findByIdOrNull import org.springframework.stereotype.Component @Component class MessageSubscriptionResolver( val processInstanceRepository: ProcessInstanceRepository, val elementInstanceRepository: ElementInstanceRepository, val processRepository: ProcessRepository, val messageCorrelationRepository: MessageCorrelationRepository ) : GraphQLResolver<MessageSubscription> { fun timestamp(messageSubscription: MessageSubscription, zoneId: String): String? { return messageSubscription.timestamp.let { ResolverExtension.timestampToString(it, zoneId) } } fun processInstance(messageSubscription: MessageSubscription): ProcessInstance? { return messageSubscription.processInstanceKey?.let { processInstanceRepository.findByIdOrNull(it) } } fun elementInstance(messageSubscription: MessageSubscription): ElementInstance? { return messageSubscription.elementInstanceKey?.let { elementInstanceRepository.findByIdOrNull(it) } } fun process(messageSubscription: MessageSubscription): Process? { return messageSubscription.processDefinitionKey?.let { processRepository.findByIdOrNull(it) } ?: messageSubscription.processInstanceKey?.let { processInstanceRepository.findByIdOrNull(it) ?.processDefinitionKey.let { processRepository.findByIdOrNull(it) } } } fun messageCorrelations(messageSubscription: MessageSubscription): List<MessageCorrelation> { return messageSubscription.elementInstanceKey ?.let { messageCorrelationRepository.findByMessageNameAndElementInstanceKey( messageName = messageSubscription.messageName, elementInstanceKey = it) } ?: messageSubscription.processDefinitionKey?.let { messageCorrelationRepository.findByMessageNameAndProcessDefinitionKey( messageName = messageSubscription.messageName, processDefinitionKey = it ) } ?: emptyList() } fun element(messageSubscription: MessageSubscription): BpmnElement? { val processDefinitionKeyOfSubscription = messageSubscription.processDefinitionKey ?: processInstanceRepository .findByIdOrNull(messageSubscription.processInstanceKey) ?.processDefinitionKey return processDefinitionKeyOfSubscription?.let { processDefinitionKey -> messageSubscription.elementId?.let { elementId -> BpmnElement( processDefinitionKey = processDefinitionKey, elementId = elementId ) } } } }
17
Kotlin
11
41
dd15093812273f8972eaee5c082aaacfadda8411
3,413
zeeqs
Apache License 2.0
app/src/main/java/com/example/mymoney/presenter/RegisterUser.kt
CardosofGui
454,529,864
false
null
package com.example.mymoney.presenter import android.content.Context import android.content.Intent import androidx.appcompat.app.AppCompatActivity import android.os.Bundle import android.widget.Toast import androidx.core.content.edit import com.example.mymoney.R import com.example.mymoney.databinding.ActivityRegisterUserBinding class RegisterUser : AppCompatActivity() { private val binding by lazy { ActivityRegisterUserBinding.inflate(layoutInflater) } override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(binding.root) initClick() } private fun initClick() { binding.btnEnter.setOnClickListener { if (!binding.edtName.text.isNullOrEmpty()){ registerUsername(binding.edtName.text.toString()) }else{ Toast.makeText(this, "Digite um nome", Toast.LENGTH_LONG).show() } } } private fun registerUsername(name : String) { val sharedPreferences = getSharedPreferences(SHARED_PREFERENCES, Context.MODE_PRIVATE) sharedPreferences.edit { putString(USERNAME_SHARED, name) commit() } Intent(this, BankList::class.java).let { startActivity(it) finish() } } companion object { const val SHARED_PREFERENCES = "com.example.mymoney.SHARED_PREFERENCE_USER" const val USERNAME_SHARED = "com.example.mymoney.USERNAME_SHARED" } }
0
Kotlin
0
1
8a44bf4dc5de12071490374bcd32d86a46068d71
1,522
my-money
MIT License
src/main/kotlin/com/demonwav/torchglow/psi/TorchMethod.kt
DenWav
100,835,055
false
{"Kotlin": 20857}
/* * TorchGlow * * IntelliJ JVM Bytecode PSI Equivalency Framework * * Copyright (c) 2017 <NAME> * * MIT License */ @file:JvmName("TorchMethods") package com.demonwav.torchglow.psi import com.intellij.psi.PsiType interface TorchMethod : TorchMember { val jvmReturnTypeName: String val jvmParamList: Set<String> val returnType: PsiType? val paramList: Set<PsiType?> val superMethods: Set<TorchMethod> } val TorchMethod.jvmParamListString get() = jvmParamList.joinToString("") val TorchMethod.jvmFullyQualifiedName get() = "$jvmName($jvmParamListString)$jvmReturnTypeName"
0
Kotlin
0
1
5152ae8d8a4dc775b27b44772788a49361312f54
618
TorchGlow
MIT License
kroto-plus-gradle-plugin/src/main/kotlin/com/github/marcoferrer/krotoplus/gradle/KrotoPlusGradlePlugin.kt
marcoferrer
124,468,545
false
null
/* * Copyright 2019 Kroto+ Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.github.marcoferrer.krotoplus.gradle import com.google.protobuf.gradle.GenerateProtoTask import org.gradle.api.Plugin import org.gradle.api.Project class KrotoPlusGradlePlugin : Plugin<Project> { override fun apply(project: Project) { project.pluginManager.withPlugin(PROTOBUF_PLUGIN_ID) { project.extensions.create( "krotoPlus", KrotoPlusPluginExtension::class.java, project ) val generateConfigTask = project.tasks.create( KrotoPlusGenerateConfigTask.DEFAULT_TASK_NAME, KrotoPlusGenerateConfigTask::class.java ) project.afterEvaluate { it.tasks.withType(GenerateProtoTask::class.java).forEach { task -> task.dependsOn(generateConfigTask) } } } project.configurations.all { config -> config.resolutionStrategy.eachDependency { details -> if(details.requested.group == "com.github.marcoferrer.krotoplus" && details.requested.version.isNullOrBlank()) { details.useVersion(Manifest.implVersion) } } } } companion object { private const val PROTOBUF_PLUGIN_ID = "com.google.protobuf" } } object Manifest { val implVersion = this::class.java.`package`.implementationVersion.orEmpty() }
32
Kotlin
27
486
2b0b447d47f14da93b536ef238b379eb4cc6075c
2,064
kroto-plus
Apache License 2.0
presentation/src/main/java/com/safetyheads/akademiaandroida/presentation/ui/WebViewActivity.kt
SafetyHeads
590,936,924
false
null
package com.safetyheads.akademiaandroida.presentation.ui import android.os.Bundle import androidx.appcompat.app.AppCompatActivity import com.safetyheads.akademiaandroida.presentation.databinding.ActivityWebViewBinding class WebViewActivity : AppCompatActivity() { private lateinit var binding: ActivityWebViewBinding override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) binding = ActivityWebViewBinding.inflate(layoutInflater) setContentView(binding.root) val jobUrl = intent.getStringExtra("job_url") val webView = binding.webView if (jobUrl != null) { webView.loadUrl(jobUrl) } } }
7
Kotlin
0
0
77a34fdcc2c7d374fa678b3b8c12cacdd095ad34
705
Akademia-Androida-2023
Apache License 2.0
sample-kotlin-lib/src/main/kotlin/com/slapin/napt/sample/LongProvider.kt
sergei-lapin
350,015,310
false
null
package com.slapin.napt.sample import dagger.Binds import dagger.Module import javax.inject.Inject import kotlin.random.Random interface LongProvider { fun get(): Long } class LongProviderImpl @Inject constructor() : LongProvider { override fun get(): Long = Random.nextLong() } @Module interface LongProviderModule { @Binds fun LongProviderImpl.bind(): LongProvider }
3
Kotlin
6
83
ffd874c25c33b1908317d5be0cf0dea836292be2
382
napt
MIT License
material-popup-menu/src/main/java/com/github/zawadz88/materialpopupmenu/internal/PopupMenuAdapter.kt
zawadz88
97,512,779
false
null
package com.github.zawadz88.materialpopupmenu.internal import android.annotation.SuppressLint import android.content.res.ColorStateList import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.TextView import androidx.annotation.CallSuper import androidx.appcompat.widget.AppCompatImageView import androidx.recyclerview.widget.RecyclerView import com.github.zawadz88.materialpopupmenu.MaterialPopupMenu import com.github.zawadz88.materialpopupmenu.R /** * RecyclerView adapter used for displaying popup menu items grouped in sections. * * @author <NAME> */ @SuppressLint("RestrictedApi") internal class PopupMenuAdapter( private val sections: List<MaterialPopupMenu.PopupMenuSection>, private val dismissPopupCallback: () -> Unit ) : SectionedRecyclerViewAdapter<PopupMenuAdapter.SectionHeaderViewHolder, PopupMenuAdapter.AbstractItemViewHolder>() { init { setHasStableIds(false) } override fun getItemCountForSection(section: Int): Int { return sections[section].items.size } override val sectionCount: Int get() = sections.size override fun onCreateSectionHeaderViewHolder(parent: ViewGroup, viewType: Int): SectionHeaderViewHolder { val v = LayoutInflater.from(parent.context).inflate(R.layout.mpm_popup_menu_section_header, parent, false) return SectionHeaderViewHolder(v) } override fun getSectionItemViewType(section: Int, position: Int): Int { return when (val popupMenuItem = sections[section].items[position]) { is MaterialPopupMenu.PopupMenuCustomItem -> popupMenuItem.layoutResId else -> super.getSectionItemViewType(section, position) } } override fun onCreateItemViewHolder(parent: ViewGroup, viewType: Int): AbstractItemViewHolder { return if (viewType == TYPE_ITEM) { val v = LayoutInflater.from(parent.context).inflate(R.layout.mpm_popup_menu_item, parent, false) ItemViewHolder(v, dismissPopupCallback) } else { val v = LayoutInflater.from(parent.context).inflate(viewType, parent, false) CustomItemViewHolder(v, dismissPopupCallback) } } override fun onBindSectionHeaderViewHolder(holder: SectionHeaderViewHolder, sectionPosition: Int) { val title = sections[sectionPosition].title if (title != null) { holder.label.visibility = View.VISIBLE holder.label.text = title } else { holder.label.visibility = View.GONE } holder.separator.visibility = if (sectionPosition == 0) View.GONE else View.VISIBLE } override fun onBindItemViewHolder(holder: AbstractItemViewHolder, section: Int, position: Int) { val popupMenuItem = sections[section].items[position] holder.bindItem(popupMenuItem) holder.itemView.setOnClickListener { popupMenuItem.callback() if (popupMenuItem.dismissOnSelect) { dismissPopupCallback() } } } internal abstract class AbstractItemViewHolder( itemView: View, private val dismissPopupCallback: () -> Unit ) : RecyclerView.ViewHolder(itemView) { @CallSuper open fun bindItem(popupMenuItem: MaterialPopupMenu.AbstractPopupMenuItem) { popupMenuItem.viewBoundCallback.dismissPopupAction = dismissPopupCallback popupMenuItem.viewBoundCallback.invoke(itemView) } } internal class ItemViewHolder(itemView: View, dismissPopupCallback: () -> Unit) : AbstractItemViewHolder(itemView, dismissPopupCallback) { private var label: TextView = itemView.findViewById(R.id.mpm_popup_menu_item_label) private var icon: AppCompatImageView = itemView.findViewById(R.id.mpm_popup_menu_item_icon) private var nestedIcon: AppCompatImageView = itemView.findViewById(R.id.mpm_popup_menu_item_nested_icon) override fun bindItem(popupMenuItem: MaterialPopupMenu.AbstractPopupMenuItem) { val castedPopupMenuItem = popupMenuItem as MaterialPopupMenu.PopupMenuItem if (castedPopupMenuItem.label != null) { label.text = castedPopupMenuItem.label } else { label.setText(castedPopupMenuItem.labelRes) } if (castedPopupMenuItem.icon != 0 || castedPopupMenuItem.iconDrawable != null) { icon.apply { visibility = View.VISIBLE setImageResource(castedPopupMenuItem.icon) castedPopupMenuItem.iconDrawable?.let { setImageDrawable(it) } if (castedPopupMenuItem.iconColor != 0) { supportImageTintList = ColorStateList.valueOf(castedPopupMenuItem.iconColor) } } } else { icon.visibility = View.GONE } if (castedPopupMenuItem.labelColor != 0) { label.setTextColor(castedPopupMenuItem.labelColor) } nestedIcon.visibility = if (castedPopupMenuItem.hasNestedItems) View.VISIBLE else View.GONE super.bindItem(popupMenuItem) } } internal class CustomItemViewHolder(itemView: View, dismissPopupCallback: () -> Unit) : AbstractItemViewHolder(itemView, dismissPopupCallback) internal class SectionHeaderViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { var label: TextView = itemView.findViewById(R.id.mpm_popup_menu_section_header_label) var separator: View = itemView.findViewById(R.id.mpm_popup_menu_section_separator) } }
14
Kotlin
56
644
6a1e8475b5a08665170fdca2ec5235bda462bfb0
5,686
MaterialPopupMenu
Apache License 2.0
app/src/main/java/com/pieterbommele/dunkbuzz/ui/navigation/DunkBuzzOverviewScreen.kt
piebom
736,048,297
false
{"Kotlin": 119324}
package com.pieterbommele.dunkbuzz.ui.navigation import androidx.annotation.StringRes import com.pieterbommele.dunkbuzz.R /** * Enum representing screens in the DunkBuzz overview navigation. * * @param title The title resource ID for the screen. * @param icon The icon resource ID for the screen. */ enum class DunkBuzzOverviewScreen(@StringRes val title: Int, val icon: Int) { /** * Represents the "Teams" screen. */ Teams(title = R.string.Teams, icon = R.drawable.team), /** * Represents the "Matches" screen. */ Matches(title = R.string.Matches, icon = R.drawable.matches) }
0
Kotlin
0
0
ca19c01340a3fa11f079aa92fff776601adffb84
621
DunkBuzz
MIT License
src/test/kotlin/io/provenance/abci/listener/TestProtoProducer.kt
provenance-io
575,569,863
false
{"Kotlin": 50926, "Shell": 12232, "Python": 650}
package io.provenance.abci.listener import com.google.protobuf.Message import com.typesafe.config.Config import io.confluent.kafka.serializers.AbstractKafkaSchemaSerDeConfig import org.apache.kafka.clients.producer.KafkaProducer import org.apache.kafka.clients.producer.Producer import org.apache.kafka.clients.producer.ProducerConfig import org.apache.kafka.common.serialization.StringSerializer import java.util.Properties /** * Produce Protobuf messages to Kafka. * * @param K The message key type. * @param V The specific Protobuf message value type. * @property schemaRegistryUrl Confluent Schema Registry URL * @constructor Creates a [TestProtoProducer] object. */ class TestProtoProducer<K, V : Message>( private val config: Config, private val schemaRegistryUrl: String? = null ) : TestProducer<K, V> { /** * Specifies the [bootstrapServers] for the producer properties. * @return the Kafka producer [Properties]. */ override fun createProducerProperties(bootstrapServers: String?): Properties { val props: Properties = config.getConfig("kafka.producer.kafka-clients").toProperties() props[ProducerConfig.BOOTSTRAP_SERVERS_CONFIG] = bootstrapServers!! props[ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG] = StringSerializer::class.java props[ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG] = ProtobufSerializer::class.java props[ProducerConfig.INTERCEPTOR_CLASSES_CONFIG] = LoggingProducerInterceptor::class.qualifiedName // settings this property will tell the ProtobufSerializer ^^^ which serializer to use. if (!schemaRegistryUrl.isNullOrEmpty()) { props[AbstractKafkaSchemaSerDeConfig.SCHEMA_REGISTRY_URL_CONFIG] = schemaRegistryUrl } return props } /** * Specifies the [bootstrapServers] for the Kafka producer. * @return a Kafka [Producer] object. */ override fun createProducer(bootstrapServers: String?): Producer<K, V> { val props = createProducerProperties(bootstrapServers!!) createTopics(createTopicsProps(bootstrapServers)) return KafkaProducer(props) } private fun createTopicsProps(bootstrapServers: String?): Properties { val props = Properties() props[ProducerConfig.BOOTSTRAP_SERVERS_CONFIG] = bootstrapServers!! props.putAll(config.getConfig("kafka.producer.listen-topics").toProperties()) props["topic.partitions"] = config.getString("kafka.producer.topic.partitions") props["topic.replication.factor"] = config.getString("kafka.producer.topic.replication.factor") return props } }
13
Kotlin
0
0
fb4b78b56074c87fcbf7be2723986b8f2e63f99b
2,645
provenance-abci-listener
Apache License 2.0
src/main/kotlin/local/example/draft/ui/view/WelcomeView.kt
paolomococci
139,423,040
false
{"Kotlin": 18459}
/** * * Copyright 2018 <NAME> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package local.example.draft.ui.view import com.vaadin.navigator.View import com.vaadin.navigator.ViewChangeListener import com.vaadin.spring.annotation.SpringComponent import com.vaadin.spring.annotation.SpringView import com.vaadin.spring.annotation.UIScope import com.vaadin.ui.Label import com.vaadin.ui.VerticalLayout import com.vaadin.ui.themes.ValoTheme import javax.annotation.PostConstruct @SpringComponent @UIScope @SpringView(name = WelcomeView.VIEW_NAME) class WelcomeView : VerticalLayout(), View { private val label: Label private val content: VerticalLayout init { this.label = Label(TITLE_VIEW) this.content = VerticalLayout() } @PostConstruct fun init() { label.addStyleName(ValoTheme.LABEL_H2) this.addComponents(label, content) content.setMargin(true) content.setSizeFull() } override fun enter(event: ViewChangeListener.ViewChangeEvent?) = super.enter(event) companion object { private const val serialVersionUID = -5708192920815457495L const val TITLE_VIEW = "Welcome" const val VIEW_NAME = "" } }
0
Kotlin
0
0
aff83dc869e6a3790888edf5a884c56a71aed8ac
1,735
prn-client-draft
Apache License 2.0
test/Imports.test.kt
Animeshz
336,521,787
true
{"Kotlin": 54877, "JavaScript": 11210}
// SYNTAX TEST "source.kotlin" "Imports" import com.google.test.ClassName as Test //^^^^^^ source.kotlin meta.import.kotlin keyword.other.import.kotlin // ^ source.kotlin meta.import.kotlin // ^^^^^^^^^^^^^^^^^^^^^^^^^ source.kotlin meta.import.kotlin storage.modifier.import.kotlin // ^ source.kotlin meta.import.kotlin // ^^ source.kotlin meta.import.kotlin keyword.other.kotlin // ^ source.kotlin meta.import.kotlin // ^^^^^ source.kotlin meta.import.kotlin entity.name.type
0
Kotlin
0
1
46e2761a761af1de2eda9c02eb5ef0c119187aad
623
language-kotlin
Apache License 2.0
server/apigateway/src/main/kotlin/jetty/ep/login/TwoFactorAuthEnableStep2.kt
fzuleta
123,956,049
false
null
package jetty.ep.login import com.google.gson.Gson import com.google.gson.JsonObject import common.functions.s import jetty.EndPoint import objects.EndPointReply import org.apache.shiro.SecurityUtils import shiro.Shiro import vertxl.VertX import java.time.LocalDateTime class TwoFactorAuthEnableStep2 : EndPoint() { override suspend fun doAction(gson: Gson, obj: JsonObject, endPointReply: EndPointReply, utcTime: LocalDateTime) { val subject = SecurityUtils.getSubject() val expectedToken = obj.s("expected_token") ?: return val reference = Shiro.get_reference(subject) ?: return if (expectedToken != subject.session.getAttribute("expected_token")) { return } val o = JsonObject(); o.addProperty("reference", reference) val epActivate = VertX.awaitFor("members.activate-two-factor", o) endPointReply.success = epActivate.success } }
0
Kotlin
2
9
dcc54b04ae2a5f945eecc55a1108ca5453f1da3d
917
sample-users-microservice
Apache License 2.0
libs/kbeam/src/main/kotlin/micro/apps/kbeam/coders/KryoCoder.kt
xmlking
236,108,779
false
{"Kotlin": 533847, "JavaScript": 249370, "HTML": 24462, "Shell": 7142, "Java": 6604, "Dockerfile": 2816}
package micro.apps.kbeam.coders // import org.apache.beam.sdk.extensions.kryo.KryoCoderProvider // https://beam.apache.org/documentation/sdks/java/euphoria/ class KryoCoderProvider
9
Kotlin
11
48
135c0f6b8ccfe17121a367bbfdd8024c77ea3c51
183
micro-apps
MIT License
app/src/main/java/com/yabancikelimedefteri/presentation/dictionary/DictionaryViewModel.kt
AhmetOcak
621,942,001
false
{"Kotlin": 164416}
package com.yabancikelimedefteri.presentation.dictionary import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import com.yabancikelimedefteri.core.helpers.Response import com.yabancikelimedefteri.domain.model.WordWithId import com.yabancikelimedefteri.domain.usecase.word.GetAllWordsUseCase import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.flow.update import kotlinx.coroutines.launch import javax.inject.Inject @HiltViewModel class DictionaryViewModel @Inject constructor( private val getAllWordsUseCase: GetAllWordsUseCase ) : ViewModel() { private val _uiState = MutableStateFlow(DictionaryUiState()) val uiState: StateFlow<DictionaryUiState> get() = _uiState.asStateFlow() private var wordsList: List<WordWithId> = listOf() init { getAllWords() } fun updateSearchField(newValue: String) { _uiState.update { it.copy(searchText = newValue) } searchWord() } fun onSearchClicked() { _uiState.update { it.copy( searchFieldError = _uiState.value.searchText.isBlank() ) } } private fun getAllWords() { viewModelScope.launch(Dispatchers.IO) { getAllWordsUseCase().collect { response -> when (response) { is Response.Loading -> {} is Response.Success -> { wordsList = response.data _uiState.update { it.copy(isError = false) } } is Response.Error -> { _uiState.update { it.copy(isError = true) } } } } } } private fun searchWord() { if (_uiState.value.searchText.isNotBlank()) { _uiState.update { it.copy( searchResults = wordsList.filter { word -> word.foreignWord.contains(_uiState.value.searchText) }, isSearching = true ) } } else { _uiState.update { it.copy( isSearching = false, searchResults = listOf() ) } } } fun getWordMeaning(wordWithId: WordWithId) { val meaning = _uiState.value.searchResults.first { wordWithId.wordId == it.wordId } _uiState.update { it.copy(wordMeaning = meaning.meaning) } } } data class DictionaryUiState( val searchText: String = "", val searchFieldError: Boolean = false, val searchResults: List<WordWithId> = listOf(), val isSearching: Boolean = false, val isError: Boolean = false, val wordMeaning: String? = null )
0
Kotlin
0
1
c3cbfdf189469045cba151b138efef246bc503d7
3,115
YabanciKelimeDefterim
MIT License
app/src/main/java/io/github/wulkanowy/ui/modules/about/license/LicenseFragment.kt
wezuwiusz
827,505,734
false
null
package io.github.wulkanowy.ui.modules.about.license import android.os.Bundle import android.view.View import android.view.View.GONE import android.view.View.VISIBLE import androidx.core.text.parseAsHtml import androidx.recyclerview.widget.LinearLayoutManager import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.mikepenz.aboutlibraries.Libs import com.mikepenz.aboutlibraries.entity.Library import dagger.hilt.android.AndroidEntryPoint import io.github.wulkanowy.R import io.github.wulkanowy.databinding.FragmentLicenseBinding import io.github.wulkanowy.ui.base.BaseFragment import io.github.wulkanowy.ui.modules.main.MainView import javax.inject.Inject @AndroidEntryPoint class LicenseFragment : BaseFragment<FragmentLicenseBinding>(R.layout.fragment_license), LicenseView, MainView.TitledView { @Inject lateinit var presenter: LicensePresenter @Inject lateinit var licenseAdapter: LicenseAdapter override val titleStringId get() = R.string.license_title override val appLibraries by lazy { Libs(requireContext()).libraries } companion object { fun newInstance() = LicenseFragment() } override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) binding = FragmentLicenseBinding.bind(view) presenter.onAttachView(this) } override fun initView() { licenseAdapter.onClickListener = presenter::onItemSelected with(binding.licenseRecycler) { layoutManager = LinearLayoutManager(context) adapter = licenseAdapter } } override fun updateData(data: List<Library>) { with(licenseAdapter) { items = data notifyDataSetChanged() } } override fun openLicense(licenseHtml: String) { context?.let { MaterialAlertDialogBuilder(it).apply { setTitle(R.string.license_dialog_title) setMessage(licenseHtml.parseAsHtml()) setPositiveButton(android.R.string.ok) { _, _ -> } show() } } } override fun showProgress(show: Boolean) { binding.licenseProgress.visibility = if (show) VISIBLE else GONE } override fun onDestroyView() { presenter.onDetachView() super.onDestroyView() } }
72
null
6
28
82b4ea930e64d0d6e653fb9024201b372cdb5df2
2,388
neowulkanowy
Apache License 2.0
health/connect/connect-client/src/test/java/androidx/health/connect/client/records/PlannedExerciseBlockTest.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 2024 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.health.connect.client.records import androidx.health.connect.client.units.kilometers import androidx.health.connect.client.units.meters import androidx.test.ext.junit.runners.AndroidJUnit4 import com.google.common.truth.Truth.assertThat import org.junit.Test import org.junit.runner.RunWith @RunWith(AndroidJUnit4::class) class PlannedExerciseBlockTest { @Test fun identicalBlocks_bothAreEqual() { assertThat( PlannedExerciseBlock( repetitions = 2, description = "Main set", steps = listOf( PlannedExerciseStep( ExerciseSegment.EXERCISE_SEGMENT_TYPE_RUNNING, PlannedExerciseStep.EXERCISE_PHASE_ACTIVE, completionGoal = ExerciseCompletionGoal.DistanceGoal(3.kilometers), performanceTargets = listOf() ) ) ) ) .isEqualTo( PlannedExerciseBlock( repetitions = 2, description = "Main set", steps = listOf( PlannedExerciseStep( ExerciseSegment.EXERCISE_SEGMENT_TYPE_RUNNING, PlannedExerciseStep.EXERCISE_PHASE_ACTIVE, completionGoal = ExerciseCompletionGoal.DistanceGoal(3.kilometers), performanceTargets = listOf() ) ) ) ) } @Test fun differentBlocks_notEqual() { assertThat( PlannedExerciseBlock( repetitions = 2, description = "Main set", steps = listOf( PlannedExerciseStep( ExerciseSegment.EXERCISE_SEGMENT_TYPE_RUNNING, PlannedExerciseStep.EXERCISE_PHASE_ACTIVE, completionGoal = ExerciseCompletionGoal.DistanceGoal(1.kilometers), performanceTargets = listOf() ) ) ) ) .isNotEqualTo( PlannedExerciseBlock( repetitions = 3, description = "Warmup", steps = listOf( PlannedExerciseStep( ExerciseSegment.EXERCISE_SEGMENT_TYPE_BIKING_STATIONARY, PlannedExerciseStep.EXERCISE_PHASE_WARMUP, completionGoal = ExerciseCompletionGoal.DistanceGoal(200.meters), performanceTargets = listOf() ) ) ) ) } }
29
Kotlin
1011
5,321
98b929d303f34d569e9fd8a529f022d398d1024b
3,738
androidx
Apache License 2.0
build-logic/convention/src/main/kotlin/dev/enesky/build_logic/convention/plugins/common/BenchmarkTestPlugin.kt
enesky
708,119,546
false
{"Kotlin": 338680, "Shell": 4890}
package dev.enesky.build_logic.convention.plugins.common import com.android.build.gradle.TestExtension import dev.enesky.build_logic.convention.helpers.configureKotlinAndroid import dev.enesky.build_logic.convention.helpers.libs import org.gradle.api.Plugin import org.gradle.api.Project import org.gradle.kotlin.dsl.configure /** * Configure Test libraries for Android * -> For benchmark/build.gradle.kts, not for other/build.gradle.kts <- */ class BenchmarkTestPlugin : Plugin<Project> { override fun apply(target: Project) = with(target) { with(pluginManager) { apply(libs.plugins.android.test.get().pluginId) apply(libs.plugins.kotlin.android.get().pluginId) } extensions.configure<TestExtension> { configureKotlinAndroid(this) defaultConfig.targetSdk = libs.versions.target.sdk.get().toInt() } } }
28
Kotlin
0
9
1341678e0974fc0e0292836e9a8571da679150d9
897
Doodle
Apache License 2.0
iteration7/music-matters/mobile/src/test/java/com/odesa/musicMatters/services/media/library/BrowseTreeTest.kt
Odhiambo-Michael-Allan
740,198,682
false
{"Kotlin": 9540063}
package com.odesa.musicMatters.services.media.library import com.odesa.musicMatters.core.common.media.extensions.toAlbum import com.odesa.musicMatters.core.common.media.library.BrowseTree import com.odesa.musicMatters.core.common.media.library.MUSIC_MATTERS_ALBUMS_ROOT import com.odesa.musicMatters.core.common.media.library.MUSIC_MATTERS_ARTISTS_ROOT import com.odesa.musicMatters.core.common.media.library.MUSIC_MATTERS_GENRES_ROOT import com.odesa.musicMatters.core.common.media.library.MUSIC_MATTERS_RECENT_SONGS_ROOT import com.odesa.musicMatters.core.common.media.library.MUSIC_MATTERS_SUGGESTED_ALBUMS_ROOT import com.odesa.musicMatters.core.common.media.library.MUSIC_MATTERS_SUGGESTED_ARTISTS_ROOT import com.odesa.musicMatters.core.common.media.library.MUSIC_MATTERS_TRACKS_ROOT import com.odesa.musicMatters.core.common.media.library.MusicSource import com.odesa.musicMatters.core.datatesting.media.FakeMusicSource import com.odesa.musicMatters.core.datatesting.songs.testSongMediaItems import junit.framework.TestCase.assertEquals import junit.framework.TestCase.assertNotNull import junit.framework.TestCase.assertTrue import org.junit.Before import org.junit.Test import org.junit.runner.RunWith import org.robolectric.RobolectricTestRunner @RunWith( RobolectricTestRunner::class ) class BrowseTreeTest { private lateinit var musicSource: MusicSource private lateinit var browseTree: BrowseTree @Before fun setup() { musicSource = FakeMusicSource( testSongMediaItems ) browseTree = BrowseTree( musicSource ) } @Test fun testTracksAreCorrectlyConfigured() { val trackList = browseTree[ MUSIC_MATTERS_TRACKS_ROOT ] assertNotNull( trackList ) assertEquals( 11, trackList!!.size ) } @Test fun testGenresAreCorrectlyConfigured() { val genresList = browseTree[ MUSIC_MATTERS_GENRES_ROOT ] assertNotNull( genresList ) assertEquals( 4, genresList!!.size ) } @Test fun testRecentlyAddedSongsAreCorrectlyConfigured() { val recentlyAddedSongs = browseTree[ MUSIC_MATTERS_RECENT_SONGS_ROOT ] assertNotNull( recentlyAddedSongs ) assertEquals( testSongMediaItems.size, recentlyAddedSongs!!.size ) assertEquals( "Don't Believe the Hype", recentlyAddedSongs[ 0 ].mediaMetadata.title ) } @Test fun testAlbumsAreLoadedCorrectly() { val albums = browseTree[ MUSIC_MATTERS_ALBUMS_ROOT ] assertNotNull( albums ) assertEquals( 5, albums!!.size ) assertTrue( albums.first().toAlbum().artists.isNotEmpty() ) } @Test fun testSuggestedAlbumAreLoadedCorrectly() { val suggestedAlbums = browseTree[ MUSIC_MATTERS_SUGGESTED_ALBUMS_ROOT ] assertNotNull( suggestedAlbums ) assertEquals( 5, suggestedAlbums!!.size ) } @Test fun testArtistsAreLoadedCorrectly() { val artists = browseTree[ MUSIC_MATTERS_ARTISTS_ROOT ] assertNotNull( artists ) assertEquals( 5, artists!!.size ) } @Test fun testSuggestedArtistsAreLoadedCorrectly() { val suggestedArtists = browseTree[ MUSIC_MATTERS_SUGGESTED_ARTISTS_ROOT ] assertNotNull( suggestedArtists ) assertEquals( 5, suggestedArtists!!.size ) } }
0
Kotlin
0
3
05ad5e08002a78958ed7763e6685a0e15f635fae
3,288
music-matters
Apache License 2.0
app/src/main/java/taiwan/no/one/dropbeat/presentation/services/DownloadReceiver.kt
pokk
263,073,196
false
null
/* * MIT License * * Copyright (c) 2020 Jieyi * * 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 taiwan.no.one.dropbeat.presentation.services import android.app.DownloadManager import android.app.DownloadManager.Query import android.content.BroadcastReceiver import android.content.Context import android.content.Intent import android.widget.Toast import androidx.work.Data import androidx.work.OneTimeWorkRequest import androidx.work.WorkManager import org.kodein.di.DIAware import org.kodein.di.factory import org.kodein.di.instance import org.kodein.di.on import taiwan.no.one.dropbeat.DropBeatApp import taiwan.no.one.dropbeat.di.Constant.TAG_WORKER_ADD_SONG_TO_DB import taiwan.no.one.dropbeat.di.Constant.TAG_WORKER_ADD_SONG_TO_PLAYLIST import taiwan.no.one.dropbeat.presentation.services.workers.WorkerConstant.PARAM_FILE_PATH import taiwan.no.one.dropbeat.presentation.services.workers.WorkerConstant.PARAM_PLAYLIST_ID import taiwan.no.one.dropbeat.presentation.services.workers.WorkerConstant.PARAM_SONG_PATH import taiwan.no.one.dropbeat.presentation.services.workers.WorkerConstant.PARAM_STREAM_DATA internal class DownloadReceiver : BroadcastReceiver(), DIAware { override val di by lazy { (DropBeatApp.appContext as DropBeatApp).di } override fun onReceive(context: Context?, intent: Intent?) { val action = intent?.action ?: return if (DownloadManager.ACTION_DOWNLOAD_COMPLETE == action) { val downloadId = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, -1) if (context?.applicationContext == null) return val downloadManager by di.on(context.applicationContext).instance<DownloadManager>() downloadManager.query(Query().setFilterById(downloadId)).use { cursor -> if (cursor.moveToFirst()) { val title = cursor.getString(cursor.getColumnIndex(DownloadManager.COLUMN_TITLE)) val songsStream = cursor.getString(cursor.getColumnIndex(DownloadManager.COLUMN_DESCRIPTION)) val localUri = cursor.getString(cursor.getColumnIndex(DownloadManager.COLUMN_LOCAL_URI)) Toast.makeText(context, "Finished downloading $title", Toast.LENGTH_SHORT).show() addSongsAndFavoriteList(songsStream, localUri) } } } } private fun addSongsAndFavoriteList(songsStream: String, localUri: String) { val dbData = Data.Builder() .putString(PARAM_STREAM_DATA, songsStream) .putStringArray(PARAM_FILE_PATH, arrayOf(localUri)) .build() val playlistData = Data.Builder() .putInt(PARAM_PLAYLIST_ID, 1) // Download id is 1. .putString(PARAM_SONG_PATH, localUri) .build() val workManager by instance<WorkManager>() val dbWorker: (Data) -> OneTimeWorkRequest by factory(TAG_WORKER_ADD_SONG_TO_DB) val playlistWorker: (Data) -> OneTimeWorkRequest by factory(TAG_WORKER_ADD_SONG_TO_PLAYLIST) workManager .beginWith(dbWorker(dbData)) .then(playlistWorker(playlistData)) .enqueue() } }
2
Kotlin
3
16
6d173194dcd3c44db46dfe6b0ef691b9322da975
4,204
DropBeat
MIT License
cmd/src/test/kotlin/CmdTest.kt
hannomalie
663,652,657
false
null
import de.hanno.executablefetcher.os.OperatingSystem import de.hanno.executablefetcher.os.currentOS import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test import java.io.File class CmdTest { @Test fun `compiled executable runs`() { val pathFromProjectRootToExecutable = if(currentOS is OperatingSystem.Windows) { "build/graal/executablefetcher.exe" } else { "build/graal/executablefetcher" } val file = File(pathFromProjectRootToExecutable) assertThat(file).exists() assertThat(file).isExecutable() val process = Runtime.getRuntime().exec(pathFromProjectRootToExecutable) assertThat(process.waitFor()) .`as` { process.inputStream.use { String(it.readBytes()) } + process.errorStream.use { String(it.readBytes()) } } .isEqualTo(0) } }
4
Kotlin
0
0
0510a3c4688c43a1c4d3ab25c3a712cf56e8d8c1
889
executablefetcher
MIT License
app/src/main/java/com/task/noteapp/data/NoteRepository.kt
Hichamraf
491,177,404
false
{"Kotlin": 24919}
package com.task.noteapp.data import com.task.noteapp.model.Note interface NoteRepository { suspend fun save(note : Note) suspend fun update(note: Note) suspend fun delete(note: Note) suspend fun getAllNotes() : List<Note> }
0
Kotlin
0
0
11d0afd5f64d8c408d45c754bfe7872c4589f09f
246
Notes
Apache License 2.0
app/src/main/java/com/adityagupta/gdsc_nie/presentation/main/home/connect/ConnectFragment.kt
DSCNIE
414,119,878
false
{"Kotlin": 54092}
package com.adityagupta.gdsc_nie.presentation.main.home.connect import android.os.Bundle import android.transition.TransitionInflater import androidx.fragment.app.Fragment import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import androidx.databinding.DataBindingUtil import com.adityagupta.gdsc_nie.R import com.adityagupta.gdsc_nie.databinding.FragmentConnectBinding import com.adityagupta.gdsc_nie.databinding.TeamMemberItemBinding import com.adityagupta.gdsc_nie.domain.adapters.TeamMemberAdapter import android.view.MotionEvent import com.adityagupta.gdsc_nie.data.local.TeamMemberInfo class ConnectFragment : Fragment() { lateinit var binding: FragmentConnectBinding var recyclerAdapter = TeamMemberAdapter() override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? ): View? { binding = DataBindingUtil.inflate( inflater, R.layout.fragment_connect, container, false ) binding.cfRecyclerView.adapter = recyclerAdapter var members = listOf<TeamMemberInfo>( TeamMemberInfo("<NAME>",R.drawable.aditya_gupta, "Technical Lead", "https://www.github.com/aadityagupta", "https://www.instagram.com/adi.tya_._"), TeamMemberInfo("<NAME>", R.drawable.iresh_sharma, "GDSC NIE Lead", "https://www.github.com/aadityagupta", "https://www.instagram.com/adi.tya_._"), TeamMemberInfo("<NAME>", R.drawable.deepthi_n, "Editorial Lead", "https://www.github.com/aadityagupta", "https://www.instagram.com/adi.tya_._"), TeamMemberInfo("<NAME>", R.drawable.raghav_k,"CP Lead", "https://www.github.com/aadityagupta", "https://www.instagram.com/adi.tya_._"), TeamMemberInfo("<NAME>",R.drawable.pranav_b, "Technical Advisor", "https://www.github.com/aadityagupta", "https://www.instagram.com/adi.tya_._"), TeamMemberInfo("<NAME>",R.drawable.apala_s, "Marketing Lead", "https://www.github.com/aadityagupta", "https://www.instagram.com/adi.tya_._"), TeamMemberInfo("<NAME>", R.drawable.yash_chauhan,"CP Lead", "https://www.github.com/aadityagupta", "https://www.instagram.com/adi.tya_._") ) members = members.sortedBy { it.name } recyclerAdapter.members = members return binding.root } }
1
Kotlin
3
0
267dd9bc8fd7c5b076ae97549915c28f0039290c
2,412
GDSC-NIE-Android
MIT License
samples/an-empty-journey/app/src/main/java/ninja/luke/mobi/journey2/samples/emptyjourney/EmptyApp.kt
luke-vietnam
487,814,894
false
{"Kotlin": 26203}
package ninja.luke.mobi.journey2.samples.emptyjourney import androidx.multidex.MultiDexApplication import ninja.luke.mobi.journey2.contract.J2Configs class EmptyApp : MultiDexApplication() { override fun onCreate() { super.onCreate() } }
0
Kotlin
1
8
ac5eef05ce298adb4f53ce9f15da02a516ad3695
257
journey2-samples
MIT License
src/main/kotlin/uk/gov/justice/digital/hmpps/calculatereleasedatesapi/model/ComparisonSummary.kt
ministryofjustice
387,841,000
false
{"Kotlin": 947113, "Shell": 5975, "Dockerfile": 1337}
package uk.gov.justice.digital.hmpps.calculatereleasedatesapi.model import java.time.LocalDateTime data class ComparisonSummary( val comparisonShortReference: String, val prison: String?, val calculatedAt: LocalDateTime, val calculatedByUsername: String, val numberOfMismatches: Long, val numberOfPeopleCompared: Long, )
3
Kotlin
0
5
806693e7491f76d07a39deb92bca8a766553bac6
335
calculate-release-dates-api
MIT License
app/src/main/java/com/sarbaevartur/wuwreader/screens/TestWindowWithVoiceAssistant.kt
magmadog
533,213,841
false
null
package com.sarbaevartur.wuwreader.screens import androidx.compose.animation.AnimatedContent import androidx.compose.animation.ExperimentalAnimationApi import androidx.compose.foundation.layout.* import androidx.compose.material.* import androidx.compose.material.icons.Icons import androidx.compose.material.icons.rounded.AccountBox import androidx.compose.material.icons.rounded.Add import androidx.compose.runtime.* import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp import com.sarbaevartur.wuwreader.voice.VoiceToTextParser @OptIn(ExperimentalAnimationApi::class) @Composable fun TestWindowWithVoiceAssistant(voiceToText: VoiceToTextParser, canRecord: Boolean) { val state by voiceToText.state.collectAsState( ) Scaffold( floatingActionButtonPosition = FabPosition.Center, floatingActionButton = { FloatingActionButton( onClick = { if (canRecord) { if (!state.isSpeaking) { voiceToText.startListening() } else { voiceToText.stopListening() } } } ) { AnimatedContent(targetState = state.isSpeaking) { isSpeaking -> if (isSpeaking) { Icon( imageVector = Icons.Rounded.AccountBox, contentDescription = null ) } else { Icon( imageVector = Icons.Rounded.Add, contentDescription = null ) } } } } ) { padding -> Column( modifier = Modifier .fillMaxSize() .padding(padding) .padding( 20. dp), verticalArrangement = Arrangement.Center, horizontalAlignment = Alignment.CenterHorizontally ) { AnimatedContent(targetState = state.isSpeaking) { isSpeaking -> if (isSpeaking) { Text( text = "Speak..." , style = MaterialTheme.typography.h3) } else { Text( text = state.spokenText.ifEmpty { "Нажмите на запись"}, style = MaterialTheme.typography.h3 ) } } } } }
0
Kotlin
0
0
39ebc99377e1e276f7d00cb12c57bed98669ee45
2,621
WuWReader
MIT License
librefit-service/src/main/kotlin/io/tohuwabohu/crud/util/FlywayMigration.kt
tohuwabohu-io
606,202,766
false
{"Kotlin": 166215, "Svelte": 87441, "JavaScript": 49188, "HTML": 13431, "CSS": 1155, "Shell": 517, "Dockerfile": 313}
package io.tohuwabohu.crud.util import io.quarkus.logging.Log import io.quarkus.runtime.StartupEvent import jakarta.enterprise.context.ApplicationScoped import jakarta.enterprise.event.Observes import org.eclipse.microprofile.config.inject.ConfigProperty import org.flywaydb.core.Flyway import java.util.* /** * Workaround to hook migration on startup. Currently, JDBC drivers and reactive datasources conflict with each other * and Hibernate reactive is not supported out of the box. * * https://github.com/quarkusio/quarkus/issues/10716 */ @ApplicationScoped class FlywayMigration { @ConfigProperty(name = "quarkus.flyway.migrate-at-start") private lateinit var migrateAtStart: Optional<Boolean> @ConfigProperty(name = "quarkus.datasource.reactive.url") private lateinit var datasourceUrl: String @ConfigProperty(name = "quarkus.datasource.username") private lateinit var datasourceUsername: String @ConfigProperty(name = "quarkus.datasource.password") private lateinit var datasourcePassword: String fun runFlywayMigration(@Observes event: StartupEvent?) { val migrate = migrateAtStart.isPresent && migrateAtStart.get() Log.info("Checking migration... flag is set to $migrate.") if (migrate) { val flyway = Flyway.configure().dataSource("jdbc:$datasourceUrl", datasourceUsername, datasourcePassword).load() flyway.migrate() } } }
8
Kotlin
0
0
9b1247feba1cb03e9adc4578d4734e0bc898a57c
1,458
librefit
MIT License
src/main/kotlin/extensions/TenantsExtensions.kt
novuhq
609,113,780
false
{"Kotlin": 309101}
package co.novu.extensions import co.novu.Novu import co.novu.dto.Tenant import co.novu.dto.request.TenantRequest import co.novu.dto.response.DeleteTenantResponse import co.novu.dto.response.PaginatedResponseWrapper import co.novu.dto.response.ResponseWrapper import co.novu.helpers.extractResponse import mu.KotlinLogging private val logger = KotlinLogging.logger {} suspend fun Novu.getTenants( page: Int? = null, limit: Int? = null, ): PaginatedResponseWrapper<Tenant>? { val response = tenantsApi.getTenants(page, limit) return response.extractResponse(logger, config.enableLogging) } suspend fun Novu.createTenant(request: TenantRequest): ResponseWrapper<Tenant>? { val response = tenantsApi.createTenant(request) return response.extractResponse(logger, config.enableLogging) } suspend fun Novu.getTenant(identifier: String): ResponseWrapper<Tenant>? { val response = tenantsApi.getTenant(identifier) return response.extractResponse(logger, config.enableLogging) } suspend fun Novu.updateTenant( identifier: String, request: TenantRequest, ): ResponseWrapper<Tenant>? { val response = tenantsApi.updateTenant(identifier, request) return response.extractResponse(logger, config.enableLogging) } suspend fun Novu.deleteTenant(identifier: String): DeleteTenantResponse { val response = tenantsApi.deleteTenant(identifier) return response.extractResponse(logger, config.enableLogging, DeleteTenantResponse()) }
7
Kotlin
8
19
539fac1b789de580659716349fd4e1c68641a8ef
1,475
novu-kotlin
MIT License
app/src/main/java/com/jetpack/swipecompose/MainActivity.kt
MakeItEasyDev
414,430,989
false
null
package com.jetpack.swipecompose import android.os.Bundle import android.widget.Space import androidx.activity.ComponentActivity import androidx.activity.compose.setContent import androidx.compose.animation.animateColorAsState import androidx.compose.animation.core.tween import androidx.compose.foundation.Image import androidx.compose.foundation.background import androidx.compose.foundation.gestures.Orientation import androidx.compose.foundation.layout.* import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material.* import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Delete import androidx.compose.material.icons.filled.Edit import androidx.compose.runtime.* import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.Color import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.res.painterResource import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.IntOffset import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import com.jetpack.swipecompose.ui.theme.LightGray100 import com.jetpack.swipecompose.ui.theme.Purple200 import com.jetpack.swipecompose.ui.theme.Purple500 import com.jetpack.swipecompose.ui.theme.SwipeComposeTheme import kotlin.math.roundToInt @ExperimentalMaterialApi class MainActivity : ComponentActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContent { SwipeComposeTheme { Surface(color = MaterialTheme.colors.background) { SwipeCompose() } } } } } @ExperimentalMaterialApi @Composable fun SwipeCompose() { var bgColor by remember { mutableStateOf(Purple200) } val color = animateColorAsState( targetValue = bgColor, animationSpec = tween( durationMillis = 2000 ) ) val squareSize = 150.dp val swipeAbleState = rememberSwipeableState(initialValue = 0) val sizePx = with(LocalDensity.current) { squareSize.toPx() } val anchors = mapOf(0f to 0, sizePx to 1) Column( modifier = Modifier .fillMaxSize() ) { Column( modifier = Modifier .fillMaxWidth() .background(Purple500) .padding(15.dp), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.Center ) { Text(text = "Compose Swipe", color = Color.White, fontWeight = FontWeight.Bold, fontSize = 20.sp) } Column( modifier = Modifier .fillMaxSize() .background(Color.White) .padding(15.dp), verticalArrangement = Arrangement.Center, horizontalAlignment = Alignment.CenterHorizontally ) { Box( modifier = Modifier .fillMaxWidth() .clip(RoundedCornerShape(15.dp)) .background(LightGray100) .swipeable( state = swipeAbleState, anchors = anchors, thresholds = { _, _ -> FractionalThreshold(0.3f) }, orientation = Orientation.Horizontal ) ) { Column( modifier = Modifier.padding(16.dp) ) { IconButton( onClick = { bgColor = Color.Green }, modifier = Modifier .size(50.dp) .clip(CircleShape) .background(Color.LightGray) ) { Icon( Icons.Filled.Edit, contentDescription = "Edit", tint = Color.Green ) } Spacer(modifier = Modifier.height(10.dp)) IconButton( onClick = { bgColor = Color.Red }, modifier = Modifier .size(50.dp) .clip(CircleShape) .background(Color.LightGray) ) { Icon( Icons.Filled.Delete, contentDescription = "Delete", tint = Color.Red ) } } Box( modifier = Modifier .offset { IntOffset( swipeAbleState.offset.value.roundToInt(), 0 ) } .clip(RoundedCornerShape(15.dp)) .fillMaxWidth() .height(150.dp) .fillMaxHeight() .background(color.value) .align(Alignment.CenterStart) ) { Column( modifier = Modifier .fillMaxSize() .padding(10.dp), verticalArrangement = Arrangement.Center ) { Row( verticalAlignment = Alignment.CenterVertically ) { Image( painter = painterResource(id = R.drawable.cat), contentDescription = "Circle Image", contentScale = ContentScale.Crop, modifier = Modifier .size(70.dp) .clip(CircleShape) ) Spacer(modifier = Modifier.padding(10.dp)) Column { Text( text = "Swipe Layout", color = Color.White, fontSize = 25.sp, fontWeight = FontWeight.Bold ) Spacer(modifier = Modifier.padding(10.dp)) Text( text = "Lorem Ipsum is simply dummy text of the printing and type setting industry...", color = Color.White, fontSize = 18.sp ) } } } } } } } }
0
Kotlin
1
6
18302a531b6c3e3418f138873b7337e2d64156bb
7,331
Jetpack-Compose-Swipe-to-Reveal
Apache License 2.0
cap08-q01-13/app/src/main/java/com/androiddesenv/opiniaodetudo/MainActivity.kt
vitorecomp
259,554,376
false
null
package com.androiddesenv.opiniaodetudo import androidx.appcompat.app.AppCompatActivity import android.os.Bundle import androidx.fragment.app.Fragment import com.androiddesenv.opiniaodetudo.fragment.ListFragment import com.google.android.material.bottomnavigation.BottomNavigationView class MainActivity : AppCompatActivity(){ private val fragments = mapOf(FORM_FRAGMENT to ::FormFragment, LIST_FRAGMENT to ::ListFragment) companion object { val FORM_FRAGMENT = "formFragment" val LIST_FRAGMENT = "listFragment" } public fun navigateTo(item: String) { val fragmentInstance: Fragment = fragments[item]?.invoke()!! supportFragmentManager .beginTransaction() .replace(R.id.fragment_container, fragmentInstance) .addToBackStack(item) .commit() } private fun configureBottomMenu() { val bottomNavigationMenu = findViewById<BottomNavigationView>(R.id.bottom_main_menu) bottomNavigationMenu.setOnNavigationItemSelectedListener { when (it.itemId) { R.id.menuitem_newitem -> navigateTo(FORM_FRAGMENT) R.id.menuitem_listitem -> navigateTo(LIST_FRAGMENT) } true } } override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) navigateTo(FORM_FRAGMENT) configureBottomMenu() } }
0
Kotlin
0
0
eeae5ee862a803df80304746eba2dbeba6ce0937
1,480
android-course
MIT License
app/src/main/java/com/codigodelsur/mlkit/feature/translation/presentation/TranslationScreen.kt
CodigoDelSurUY
796,365,173
false
{"Kotlin": 206179, "Java": 32945}
package com.codigodelsur.mlkit.feature.translation.presentation import androidx.compose.foundation.background import androidx.compose.foundation.layout.Column 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.rememberScrollState import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.foundation.verticalScroll import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.material3.TextField import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalFocusManager import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.input.KeyboardCapitalization import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.codigodelsur.mlkit.R import com.codigodelsur.mlkit.core.presentation.theme.MlkTheme import com.codigodelsur.mlkit.core.presentation.theme.Typography import com.codigodelsur.mlkit.core.presentation.component.LoadingButton import com.codigodelsur.mlkit.core.presentation.component.MlkTopAppBar import com.codigodelsur.mlkit.core.presentation.component.ShowSnackbarEffect import com.codigodelsur.mlkit.core.presentation.model.PSnackbar @Composable fun TranslationRoute( modifier: Modifier = Modifier, viewModel: TranslationViewModel = hiltViewModel(), onBackClick: () -> Unit ) { val state by viewModel.state.collectAsStateWithLifecycle() state.translationError?.let { ShowSnackbarEffect(snackbar = PSnackbar.Text(it)) { viewModel.hideTranslationError() } } TranslationScreen( modifier = modifier, inputText = state.inputText, outputText = state.outputText, isLoading = state.isLoading, onInputTextChange = { viewModel.updateInputText(text = it) }, onTranslateClick = { viewModel.translate() }, onBackClick = onBackClick ) } @OptIn(ExperimentalMaterial3Api::class) @Composable private fun TranslationScreen( modifier: Modifier, inputText: String, outputText: String, isLoading: Boolean, onInputTextChange: (String) -> Unit, onTranslateClick: () -> Unit, onBackClick: () -> Unit ) { val focusManager = LocalFocusManager.current Column( modifier = modifier .fillMaxSize() ) { MlkTopAppBar( titleRes = R.string.feature_translation_title, onNavigationClick = onBackClick ) Column( modifier = Modifier .background(MaterialTheme.colorScheme.surface) .weight(1.0f) .verticalScroll(rememberScrollState()) .padding(all = 16.dp) ) { Text( modifier = Modifier.fillMaxWidth(), text = stringResource(id = R.string.translation_instructions), style = Typography.bodyMedium ) Spacer(modifier = Modifier.height(16.dp)) TextField( modifier = Modifier.fillMaxWidth(), keyboardOptions = KeyboardOptions(capitalization = KeyboardCapitalization.Sentences), value = inputText, onValueChange = onInputTextChange, label = { Text(text = stringResource(id = R.string.translation_input_label)) } ) Spacer(modifier = Modifier.height(16.dp)) LoadingButton( modifier = Modifier.fillMaxWidth(), text = stringResource(id = R.string.translation_translate_button), enabled = inputText.isNotBlank(), loading = isLoading, onClick = { focusManager.clearFocus() onTranslateClick() } ) Spacer(modifier = Modifier.height(24.dp)) Text( modifier = Modifier.fillMaxWidth(), text = outputText, style = Typography.titleLarge ) } } } @Preview @Composable private fun TranslationScreenPreview() { MlkTheme { TranslationScreen( modifier = Modifier.fillMaxSize(), inputText = "¡Hola!, ¿Cómo estás?", outputText = "Hi, how are you?", isLoading = false, onInputTextChange = {}, onTranslateClick = {}, onBackClick = {} ) } }
0
Kotlin
0
2
4bf9bcf8cc9e37cdc53a655137f785a0fa872414
4,913
ml-kit-android-demo
Apache License 2.0
app/src/main/java/com/sbw/calculator/MainActivity.kt
sumantain
240,911,752
false
null
package com.sbw.calculator import androidx.appcompat.app.AppCompatActivity import android.os.Bundle import android.text.Editable import android.text.TextWatcher import kotlinx.android.synthetic.main.activity_main.* class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) // Example of a call to a native method sample_text.text = stringFromJNI() val_x.addTextChangedListener(object : TextWatcher { override fun afterTextChanged(p0: Editable?) { } override fun beforeTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) { } override fun onTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) { } }) val_x.addTextChangedListener(object : TextWatcher { override fun afterTextChanged(p0: Editable?) { } override fun beforeTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) { } override fun onTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) { } }) } /** * A native method that is implemented by the 'native-lib' native library, * which is packaged with this application. */ external fun stringFromJNI(): String external fun add(x: Int, y: Int): Int external fun sub(x: Int, y: Int): Int external fun multiply(x: Int, y: Int): Int external fun divide(x: Int, y: Int): Float companion object { // Used to load the 'native-lib' library on application startup. init { System.loadLibrary("native-lib") } } }
0
Kotlin
1
0
d20a12a548bfd752ad233bccef7cbc5545bfbe79
1,752
Calculator
Apache License 2.0
composeApp/src/commonMain/kotlin/tabs/calendar/CalendarViewState.kt
spoonofcode
829,948,208
false
{"Kotlin": 96677, "Swift": 621}
package tabs.calendar internal data class CalendarViewState( val title: String = "Calendar title" )
11
Kotlin
0
0
5233af10246b1b0b1c268ec666afd70c21f80be9
104
dojo-pro
Apache License 2.0
app/src/main/kotlin/hr/algebra/domace/domain/mailing/MailingService.kt
karlobratko
793,157,929
false
{"Kotlin": 396835}
package hr.algebra.domace.domain.mailing import arrow.core.Either import hr.algebra.domace.domain.DomainError /** * A functional interface for a mailing service. * * This interface defines a single function, `send`, which is used to send an email. * The function is a suspending function, meaning it is designed to be used with Kotlin's coroutines. * * @property send A suspending function that takes an `Email` object and returns an `Either` object. * The `Either` object will contain a `DomainError` object if the email could not be sent, or the `Email` object if * the email was sent successfully. */ fun interface MailingService { /** * Sends an email using the provided `MailingService`. * * This function takes an `Email` object and sends it using the `MailingService`. The result of the operation * is returned as an `Either` object. If the email was sent successfully, the `Either` object will contain the * `Email` object. * If the email could not be sent, the `Either` object will contain a `DomainError` object. * * This function is a suspending function, meaning it is designed to be used with Kotlin's coroutines. * * @param email The `Email` object to be sent. * * @return An `Either` object containing a `DomainError` object if the email could not be sent, or the `Email` * object if the email was sent successfully. */ suspend fun send(email: Email): Either<DomainError, Email> } /** * Sends an email using the provided `MailingService` and an `EmailTemplate`. * * This function takes an `EmailTemplate` object, converts it to an `Email` object using the `email` function, * and sends it using the `MailingService`. The result of the operation is returned as an `Either` object. * If the email was sent successfully, the `Either` object will contain the `Email` object. * If the email could not be sent, the `Either` object will contain a `DomainError` object. * * This function is a suspending function, meaning it is designed to be used with Kotlin's coroutines. * * @param template The `EmailTemplate` object to be converted to an `Email` object and sent. * * @return An `Either` object containing a `DomainError` object if the email could not be sent, or the `Email` * object if the email was sent successfully. */ suspend fun MailingService.send(template: EmailTemplate): Either<DomainError, Email> = send(template.email())
0
Kotlin
0
0
085007340832bc6f1143af18d580f8702bed9c59
2,449
domace
MIT License
dsl/src/main/kotlin/io/cloudshiftdev/awscdkdsl/services/amplifyuibuilder/_amplifyuibuilder.kt
cloudshiftinc
667,063,030
false
{"Kotlin": 63959868}
@file:Suppress( "RedundantVisibilityModifier", "RedundantUnitReturnType", "RemoveRedundantQualifierName", "unused", "UnusedImport", "ClassName", "REDUNDANT_PROJECTION", "DEPRECATION" ) package io.cloudshiftdev.awscdkdsl.services.amplifyuibuilder import kotlin.String import kotlin.Unit import software.amazon.awscdk.services.amplifyuibuilder.CfnComponent import software.amazon.awscdk.services.amplifyuibuilder.CfnComponentProps import software.amazon.awscdk.services.amplifyuibuilder.CfnForm import software.amazon.awscdk.services.amplifyuibuilder.CfnFormProps import software.amazon.awscdk.services.amplifyuibuilder.CfnTheme import software.amazon.awscdk.services.amplifyuibuilder.CfnThemeProps import software.constructs.Construct public object amplifyuibuilder { /** * The AWS::AmplifyUIBuilder::Component resource specifies a component within an Amplify app. * * A component is a user interface (UI) element that you can customize. Use `ComponentChild` to * configure an instance of a `Component` . A `ComponentChild` instance inherits the * configuration of the main `Component` . * * Example: * ``` * ``` * * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-amplifyuibuilder-component.html) */ public inline fun cfnComponent( scope: Construct, id: String, block: CfnComponentDsl.() -> Unit = {}, ): CfnComponent { val builder = CfnComponentDsl(scope, id) builder.apply(block) return builder.build() } /** * Represents the event action configuration for an element of a `Component` or `ComponentChild` * . * * Use for the workflow feature in Amplify Studio that allows you to bind events and actions to * components. `ActionParameters` defines the action that is performed when an event occurs on * the component. * * Example: * ``` * // The code below shows an example of how to instantiate this type. * // The values are placeholders you should change. * import software.amazon.awscdk.services.amplifyuibuilder.*; * ComponentPropertyProperty componentPropertyProperty_; * ActionParametersProperty actionParametersProperty = ActionParametersProperty.builder() * .anchor(ComponentPropertyProperty.builder() * .bindingProperties(ComponentPropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .bindings(Map.of( * "bindingsKey", FormBindingElementProperty.builder() * .element("element") * .property("property") * .build())) * .collectionBindingProperties(ComponentPropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .componentName("componentName") * .concat(List.of(componentPropertyProperty_)) * .condition(ComponentConditionPropertyProperty.builder() * .else(componentPropertyProperty_) * .field("field") * .operand("operand") * .operandType("operandType") * .operator("operator") * .property("property") * .then(componentPropertyProperty_) * .build()) * .configured(false) * .defaultValue("defaultValue") * .event("event") * .importedValue("importedValue") * .model("model") * .property("property") * .type("type") * .userAttribute("userAttribute") * .value("value") * .build()) * .fields(Map.of( * "fieldsKey", ComponentPropertyProperty.builder() * .bindingProperties(ComponentPropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .bindings(Map.of( * "bindingsKey", FormBindingElementProperty.builder() * .element("element") * .property("property") * .build())) * .collectionBindingProperties(ComponentPropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .componentName("componentName") * .concat(List.of(componentPropertyProperty_)) * .condition(ComponentConditionPropertyProperty.builder() * .else(componentPropertyProperty_) * .field("field") * .operand("operand") * .operandType("operandType") * .operator("operator") * .property("property") * .then(componentPropertyProperty_) * .build()) * .configured(false) * .defaultValue("defaultValue") * .event("event") * .importedValue("importedValue") * .model("model") * .property("property") * .type("type") * .userAttribute("userAttribute") * .value("value") * .build())) * .global(ComponentPropertyProperty.builder() * .bindingProperties(ComponentPropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .bindings(Map.of( * "bindingsKey", FormBindingElementProperty.builder() * .element("element") * .property("property") * .build())) * .collectionBindingProperties(ComponentPropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .componentName("componentName") * .concat(List.of(componentPropertyProperty_)) * .condition(ComponentConditionPropertyProperty.builder() * .else(componentPropertyProperty_) * .field("field") * .operand("operand") * .operandType("operandType") * .operator("operator") * .property("property") * .then(componentPropertyProperty_) * .build()) * .configured(false) * .defaultValue("defaultValue") * .event("event") * .importedValue("importedValue") * .model("model") * .property("property") * .type("type") * .userAttribute("userAttribute") * .value("value") * .build()) * .id(ComponentPropertyProperty.builder() * .bindingProperties(ComponentPropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .bindings(Map.of( * "bindingsKey", FormBindingElementProperty.builder() * .element("element") * .property("property") * .build())) * .collectionBindingProperties(ComponentPropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .componentName("componentName") * .concat(List.of(componentPropertyProperty_)) * .condition(ComponentConditionPropertyProperty.builder() * .else(componentPropertyProperty_) * .field("field") * .operand("operand") * .operandType("operandType") * .operator("operator") * .property("property") * .then(componentPropertyProperty_) * .build()) * .configured(false) * .defaultValue("defaultValue") * .event("event") * .importedValue("importedValue") * .model("model") * .property("property") * .type("type") * .userAttribute("userAttribute") * .value("value") * .build()) * .model("model") * .state(MutationActionSetStateParameterProperty.builder() * .componentName("componentName") * .property("property") * .set(ComponentPropertyProperty.builder() * .bindingProperties(ComponentPropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .bindings(Map.of( * "bindingsKey", FormBindingElementProperty.builder() * .element("element") * .property("property") * .build())) * .collectionBindingProperties(ComponentPropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .componentName("componentName") * .concat(List.of(componentPropertyProperty_)) * .condition(ComponentConditionPropertyProperty.builder() * .else(componentPropertyProperty_) * .field("field") * .operand("operand") * .operandType("operandType") * .operator("operator") * .property("property") * .then(componentPropertyProperty_) * .build()) * .configured(false) * .defaultValue("defaultValue") * .event("event") * .importedValue("importedValue") * .model("model") * .property("property") * .type("type") * .userAttribute("userAttribute") * .value("value") * .build()) * .build()) * .target(ComponentPropertyProperty.builder() * .bindingProperties(ComponentPropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .bindings(Map.of( * "bindingsKey", FormBindingElementProperty.builder() * .element("element") * .property("property") * .build())) * .collectionBindingProperties(ComponentPropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .componentName("componentName") * .concat(List.of(componentPropertyProperty_)) * .condition(ComponentConditionPropertyProperty.builder() * .else(componentPropertyProperty_) * .field("field") * .operand("operand") * .operandType("operandType") * .operator("operator") * .property("property") * .then(componentPropertyProperty_) * .build()) * .configured(false) * .defaultValue("defaultValue") * .event("event") * .importedValue("importedValue") * .model("model") * .property("property") * .type("type") * .userAttribute("userAttribute") * .value("value") * .build()) * .type(ComponentPropertyProperty.builder() * .bindingProperties(ComponentPropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .bindings(Map.of( * "bindingsKey", FormBindingElementProperty.builder() * .element("element") * .property("property") * .build())) * .collectionBindingProperties(ComponentPropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .componentName("componentName") * .concat(List.of(componentPropertyProperty_)) * .condition(ComponentConditionPropertyProperty.builder() * .else(componentPropertyProperty_) * .field("field") * .operand("operand") * .operandType("operandType") * .operator("operator") * .property("property") * .then(componentPropertyProperty_) * .build()) * .configured(false) * .defaultValue("defaultValue") * .event("event") * .importedValue("importedValue") * .model("model") * .property("property") * .type("type") * .userAttribute("userAttribute") * .value("value") * .build()) * .url(ComponentPropertyProperty.builder() * .bindingProperties(ComponentPropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .bindings(Map.of( * "bindingsKey", FormBindingElementProperty.builder() * .element("element") * .property("property") * .build())) * .collectionBindingProperties(ComponentPropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .componentName("componentName") * .concat(List.of(componentPropertyProperty_)) * .condition(ComponentConditionPropertyProperty.builder() * .else(componentPropertyProperty_) * .field("field") * .operand("operand") * .operandType("operandType") * .operator("operator") * .property("property") * .then(componentPropertyProperty_) * .build()) * .configured(false) * .defaultValue("defaultValue") * .event("event") * .importedValue("importedValue") * .model("model") * .property("property") * .type("type") * .userAttribute("userAttribute") * .value("value") * .build()) * .build(); * ``` * * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amplifyuibuilder-component-actionparameters.html) */ public inline fun cfnComponentActionParametersProperty( block: CfnComponentActionParametersPropertyDsl.() -> Unit = {} ): CfnComponent.ActionParametersProperty { val builder = CfnComponentActionParametersPropertyDsl() builder.apply(block) return builder.build() } /** * The `ComponentBindingPropertiesValueProperties` property specifies the data binding * configuration for a specific property using data stored in AWS . * * For AWS connected properties, you can bind a property to data stored in an Amazon S3 bucket, * an Amplify DataStore model or an authenticated user attribute. * * Example: * ``` * // The code below shows an example of how to instantiate this type. * // The values are placeholders you should change. * import software.amazon.awscdk.services.amplifyuibuilder.*; * PredicateProperty predicateProperty_; * ComponentBindingPropertiesValuePropertiesProperty * componentBindingPropertiesValuePropertiesProperty = * ComponentBindingPropertiesValuePropertiesProperty.builder() * .bucket("bucket") * .defaultValue("defaultValue") * .field("field") * .key("key") * .model("model") * .predicates(List.of(PredicateProperty.builder() * .and(List.of(predicateProperty_)) * .field("field") * .operand("operand") * .operandType("operandType") * .operator("operator") * .or(List.of(predicateProperty_)) * .build())) * .slotName("slotName") * .userAttribute("userAttribute") * .build(); * ``` * * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amplifyuibuilder-component-componentbindingpropertiesvalueproperties.html) */ public inline fun cfnComponentComponentBindingPropertiesValuePropertiesProperty( block: CfnComponentComponentBindingPropertiesValuePropertiesPropertyDsl.() -> Unit = {} ): CfnComponent.ComponentBindingPropertiesValuePropertiesProperty { val builder = CfnComponentComponentBindingPropertiesValuePropertiesPropertyDsl() builder.apply(block) return builder.build() } /** * The `ComponentBindingPropertiesValue` property specifies the data binding configuration for a * component at runtime. * * You can use `ComponentBindingPropertiesValue` to add exposed properties to a component to * allow different values to be entered when a component is reused in different places in an * app. * * Example: * ``` * // The code below shows an example of how to instantiate this type. * // The values are placeholders you should change. * import software.amazon.awscdk.services.amplifyuibuilder.*; * PredicateProperty predicateProperty_; * ComponentBindingPropertiesValueProperty componentBindingPropertiesValueProperty = * ComponentBindingPropertiesValueProperty.builder() * .bindingProperties(ComponentBindingPropertiesValuePropertiesProperty.builder() * .bucket("bucket") * .defaultValue("defaultValue") * .field("field") * .key("key") * .model("model") * .predicates(List.of(PredicateProperty.builder() * .and(List.of(predicateProperty_)) * .field("field") * .operand("operand") * .operandType("operandType") * .operator("operator") * .or(List.of(predicateProperty_)) * .build())) * .slotName("slotName") * .userAttribute("userAttribute") * .build()) * .defaultValue("defaultValue") * .type("type") * .build(); * ``` * * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amplifyuibuilder-component-componentbindingpropertiesvalue.html) */ public inline fun cfnComponentComponentBindingPropertiesValueProperty( block: CfnComponentComponentBindingPropertiesValuePropertyDsl.() -> Unit = {} ): CfnComponent.ComponentBindingPropertiesValueProperty { val builder = CfnComponentComponentBindingPropertiesValuePropertyDsl() builder.apply(block) return builder.build() } /** * The `ComponentChild` property specifies a nested UI configuration within a parent `Component` * . * * Example: * ``` * // The code below shows an example of how to instantiate this type. * // The values are placeholders you should change. * import software.amazon.awscdk.services.amplifyuibuilder.*; * ComponentChildProperty componentChildProperty_; * ComponentPropertyProperty componentPropertyProperty_; * ComponentChildProperty componentChildProperty = ComponentChildProperty.builder() * .componentType("componentType") * .name("name") * .properties(Map.of( * "propertiesKey", ComponentPropertyProperty.builder() * .bindingProperties(ComponentPropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .bindings(Map.of( * "bindingsKey", FormBindingElementProperty.builder() * .element("element") * .property("property") * .build())) * .collectionBindingProperties(ComponentPropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .componentName("componentName") * .concat(List.of(componentPropertyProperty_)) * .condition(ComponentConditionPropertyProperty.builder() * .else(componentPropertyProperty_) * .field("field") * .operand("operand") * .operandType("operandType") * .operator("operator") * .property("property") * .then(componentPropertyProperty_) * .build()) * .configured(false) * .defaultValue("defaultValue") * .event("event") * .importedValue("importedValue") * .model("model") * .property("property") * .type("type") * .userAttribute("userAttribute") * .value("value") * .build())) * // the properties below are optional * .children(List.of(componentChildProperty_)) * .events(Map.of( * "eventsKey", ComponentEventProperty.builder() * .action("action") * .bindingEvent("bindingEvent") * .parameters(ActionParametersProperty.builder() * .anchor(ComponentPropertyProperty.builder() * .bindingProperties(ComponentPropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .bindings(Map.of( * "bindingsKey", FormBindingElementProperty.builder() * .element("element") * .property("property") * .build())) * .collectionBindingProperties(ComponentPropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .componentName("componentName") * .concat(List.of(componentPropertyProperty_)) * .condition(ComponentConditionPropertyProperty.builder() * .else(componentPropertyProperty_) * .field("field") * .operand("operand") * .operandType("operandType") * .operator("operator") * .property("property") * .then(componentPropertyProperty_) * .build()) * .configured(false) * .defaultValue("defaultValue") * .event("event") * .importedValue("importedValue") * .model("model") * .property("property") * .type("type") * .userAttribute("userAttribute") * .value("value") * .build()) * .fields(Map.of( * "fieldsKey", ComponentPropertyProperty.builder() * .bindingProperties(ComponentPropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .bindings(Map.of( * "bindingsKey", FormBindingElementProperty.builder() * .element("element") * .property("property") * .build())) * .collectionBindingProperties(ComponentPropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .componentName("componentName") * .concat(List.of(componentPropertyProperty_)) * .condition(ComponentConditionPropertyProperty.builder() * .else(componentPropertyProperty_) * .field("field") * .operand("operand") * .operandType("operandType") * .operator("operator") * .property("property") * .then(componentPropertyProperty_) * .build()) * .configured(false) * .defaultValue("defaultValue") * .event("event") * .importedValue("importedValue") * .model("model") * .property("property") * .type("type") * .userAttribute("userAttribute") * .value("value") * .build())) * .global(ComponentPropertyProperty.builder() * .bindingProperties(ComponentPropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .bindings(Map.of( * "bindingsKey", FormBindingElementProperty.builder() * .element("element") * .property("property") * .build())) * .collectionBindingProperties(ComponentPropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .componentName("componentName") * .concat(List.of(componentPropertyProperty_)) * .condition(ComponentConditionPropertyProperty.builder() * .else(componentPropertyProperty_) * .field("field") * .operand("operand") * .operandType("operandType") * .operator("operator") * .property("property") * .then(componentPropertyProperty_) * .build()) * .configured(false) * .defaultValue("defaultValue") * .event("event") * .importedValue("importedValue") * .model("model") * .property("property") * .type("type") * .userAttribute("userAttribute") * .value("value") * .build()) * .id(ComponentPropertyProperty.builder() * .bindingProperties(ComponentPropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .bindings(Map.of( * "bindingsKey", FormBindingElementProperty.builder() * .element("element") * .property("property") * .build())) * .collectionBindingProperties(ComponentPropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .componentName("componentName") * .concat(List.of(componentPropertyProperty_)) * .condition(ComponentConditionPropertyProperty.builder() * .else(componentPropertyProperty_) * .field("field") * .operand("operand") * .operandType("operandType") * .operator("operator") * .property("property") * .then(componentPropertyProperty_) * .build()) * .configured(false) * .defaultValue("defaultValue") * .event("event") * .importedValue("importedValue") * .model("model") * .property("property") * .type("type") * .userAttribute("userAttribute") * .value("value") * .build()) * .model("model") * .state(MutationActionSetStateParameterProperty.builder() * .componentName("componentName") * .property("property") * .set(ComponentPropertyProperty.builder() * .bindingProperties(ComponentPropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .bindings(Map.of( * "bindingsKey", FormBindingElementProperty.builder() * .element("element") * .property("property") * .build())) * .collectionBindingProperties(ComponentPropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .componentName("componentName") * .concat(List.of(componentPropertyProperty_)) * .condition(ComponentConditionPropertyProperty.builder() * .else(componentPropertyProperty_) * .field("field") * .operand("operand") * .operandType("operandType") * .operator("operator") * .property("property") * .then(componentPropertyProperty_) * .build()) * .configured(false) * .defaultValue("defaultValue") * .event("event") * .importedValue("importedValue") * .model("model") * .property("property") * .type("type") * .userAttribute("userAttribute") * .value("value") * .build()) * .build()) * .target(ComponentPropertyProperty.builder() * .bindingProperties(ComponentPropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .bindings(Map.of( * "bindingsKey", FormBindingElementProperty.builder() * .element("element") * .property("property") * .build())) * .collectionBindingProperties(ComponentPropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .componentName("componentName") * .concat(List.of(componentPropertyProperty_)) * .condition(ComponentConditionPropertyProperty.builder() * .else(componentPropertyProperty_) * .field("field") * .operand("operand") * .operandType("operandType") * .operator("operator") * .property("property") * .then(componentPropertyProperty_) * .build()) * .configured(false) * .defaultValue("defaultValue") * .event("event") * .importedValue("importedValue") * .model("model") * .property("property") * .type("type") * .userAttribute("userAttribute") * .value("value") * .build()) * .type(ComponentPropertyProperty.builder() * .bindingProperties(ComponentPropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .bindings(Map.of( * "bindingsKey", FormBindingElementProperty.builder() * .element("element") * .property("property") * .build())) * .collectionBindingProperties(ComponentPropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .componentName("componentName") * .concat(List.of(componentPropertyProperty_)) * .condition(ComponentConditionPropertyProperty.builder() * .else(componentPropertyProperty_) * .field("field") * .operand("operand") * .operandType("operandType") * .operator("operator") * .property("property") * .then(componentPropertyProperty_) * .build()) * .configured(false) * .defaultValue("defaultValue") * .event("event") * .importedValue("importedValue") * .model("model") * .property("property") * .type("type") * .userAttribute("userAttribute") * .value("value") * .build()) * .url(ComponentPropertyProperty.builder() * .bindingProperties(ComponentPropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .bindings(Map.of( * "bindingsKey", FormBindingElementProperty.builder() * .element("element") * .property("property") * .build())) * .collectionBindingProperties(ComponentPropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .componentName("componentName") * .concat(List.of(componentPropertyProperty_)) * .condition(ComponentConditionPropertyProperty.builder() * .else(componentPropertyProperty_) * .field("field") * .operand("operand") * .operandType("operandType") * .operator("operator") * .property("property") * .then(componentPropertyProperty_) * .build()) * .configured(false) * .defaultValue("defaultValue") * .event("event") * .importedValue("importedValue") * .model("model") * .property("property") * .type("type") * .userAttribute("userAttribute") * .value("value") * .build()) * .build()) * .build())) * .sourceId("sourceId") * .build(); * ``` * * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amplifyuibuilder-component-componentchild.html) */ public inline fun cfnComponentComponentChildProperty( block: CfnComponentComponentChildPropertyDsl.() -> Unit = {} ): CfnComponent.ComponentChildProperty { val builder = CfnComponentComponentChildPropertyDsl() builder.apply(block) return builder.build() } /** * The `ComponentConditionProperty` property specifies a conditional expression for setting a * component property. * * Use `ComponentConditionProperty` to set a property to different values conditionally, based * on the value of another property. * * Example: * ``` * // The code below shows an example of how to instantiate this type. * // The values are placeholders you should change. * import software.amazon.awscdk.services.amplifyuibuilder.*; * ComponentConditionPropertyProperty componentConditionPropertyProperty_; * ComponentPropertyProperty componentPropertyProperty_; * ComponentConditionPropertyProperty componentConditionPropertyProperty = * ComponentConditionPropertyProperty.builder() * .else(ComponentPropertyProperty.builder() * .bindingProperties(ComponentPropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .bindings(Map.of( * "bindingsKey", FormBindingElementProperty.builder() * .element("element") * .property("property") * .build())) * .collectionBindingProperties(ComponentPropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .componentName("componentName") * .concat(List.of(componentPropertyProperty_)) * .condition(componentConditionPropertyProperty_) * .configured(false) * .defaultValue("defaultValue") * .event("event") * .importedValue("importedValue") * .model("model") * .property("property") * .type("type") * .userAttribute("userAttribute") * .value("value") * .build()) * .field("field") * .operand("operand") * .operandType("operandType") * .operator("operator") * .property("property") * .then(ComponentPropertyProperty.builder() * .bindingProperties(ComponentPropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .bindings(Map.of( * "bindingsKey", FormBindingElementProperty.builder() * .element("element") * .property("property") * .build())) * .collectionBindingProperties(ComponentPropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .componentName("componentName") * .concat(List.of(componentPropertyProperty_)) * .condition(componentConditionPropertyProperty_) * .configured(false) * .defaultValue("defaultValue") * .event("event") * .importedValue("importedValue") * .model("model") * .property("property") * .type("type") * .userAttribute("userAttribute") * .value("value") * .build()) * .build(); * ``` * * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amplifyuibuilder-component-componentconditionproperty.html) */ public inline fun cfnComponentComponentConditionPropertyProperty( block: CfnComponentComponentConditionPropertyPropertyDsl.() -> Unit = {} ): CfnComponent.ComponentConditionPropertyProperty { val builder = CfnComponentComponentConditionPropertyPropertyDsl() builder.apply(block) return builder.build() } /** * The `ComponentDataConfiguration` property specifies the configuration for binding a * component's properties to data. * * Example: * ``` * // The code below shows an example of how to instantiate this type. * // The values are placeholders you should change. * import software.amazon.awscdk.services.amplifyuibuilder.*; * PredicateProperty predicateProperty_; * ComponentDataConfigurationProperty componentDataConfigurationProperty = * ComponentDataConfigurationProperty.builder() * .model("model") * // the properties below are optional * .identifiers(List.of("identifiers")) * .predicate(PredicateProperty.builder() * .and(List.of(predicateProperty_)) * .field("field") * .operand("operand") * .operandType("operandType") * .operator("operator") * .or(List.of(predicateProperty_)) * .build()) * .sort(List.of(SortPropertyProperty.builder() * .direction("direction") * .field("field") * .build())) * .build(); * ``` * * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amplifyuibuilder-component-componentdataconfiguration.html) */ public inline fun cfnComponentComponentDataConfigurationProperty( block: CfnComponentComponentDataConfigurationPropertyDsl.() -> Unit = {} ): CfnComponent.ComponentDataConfigurationProperty { val builder = CfnComponentComponentDataConfigurationPropertyDsl() builder.apply(block) return builder.build() } /** * The `ComponentEvent` property specifies the configuration of an event. * * You can bind an event and a corresponding action to a `Component` or a `ComponentChild` . A * button click is an example of an event. * * Example: * ``` * // The code below shows an example of how to instantiate this type. * // The values are placeholders you should change. * import software.amazon.awscdk.services.amplifyuibuilder.*; * ComponentPropertyProperty componentPropertyProperty_; * ComponentEventProperty componentEventProperty = ComponentEventProperty.builder() * .action("action") * .bindingEvent("bindingEvent") * .parameters(ActionParametersProperty.builder() * .anchor(ComponentPropertyProperty.builder() * .bindingProperties(ComponentPropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .bindings(Map.of( * "bindingsKey", FormBindingElementProperty.builder() * .element("element") * .property("property") * .build())) * .collectionBindingProperties(ComponentPropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .componentName("componentName") * .concat(List.of(componentPropertyProperty_)) * .condition(ComponentConditionPropertyProperty.builder() * .else(componentPropertyProperty_) * .field("field") * .operand("operand") * .operandType("operandType") * .operator("operator") * .property("property") * .then(componentPropertyProperty_) * .build()) * .configured(false) * .defaultValue("defaultValue") * .event("event") * .importedValue("importedValue") * .model("model") * .property("property") * .type("type") * .userAttribute("userAttribute") * .value("value") * .build()) * .fields(Map.of( * "fieldsKey", ComponentPropertyProperty.builder() * .bindingProperties(ComponentPropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .bindings(Map.of( * "bindingsKey", FormBindingElementProperty.builder() * .element("element") * .property("property") * .build())) * .collectionBindingProperties(ComponentPropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .componentName("componentName") * .concat(List.of(componentPropertyProperty_)) * .condition(ComponentConditionPropertyProperty.builder() * .else(componentPropertyProperty_) * .field("field") * .operand("operand") * .operandType("operandType") * .operator("operator") * .property("property") * .then(componentPropertyProperty_) * .build()) * .configured(false) * .defaultValue("defaultValue") * .event("event") * .importedValue("importedValue") * .model("model") * .property("property") * .type("type") * .userAttribute("userAttribute") * .value("value") * .build())) * .global(ComponentPropertyProperty.builder() * .bindingProperties(ComponentPropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .bindings(Map.of( * "bindingsKey", FormBindingElementProperty.builder() * .element("element") * .property("property") * .build())) * .collectionBindingProperties(ComponentPropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .componentName("componentName") * .concat(List.of(componentPropertyProperty_)) * .condition(ComponentConditionPropertyProperty.builder() * .else(componentPropertyProperty_) * .field("field") * .operand("operand") * .operandType("operandType") * .operator("operator") * .property("property") * .then(componentPropertyProperty_) * .build()) * .configured(false) * .defaultValue("defaultValue") * .event("event") * .importedValue("importedValue") * .model("model") * .property("property") * .type("type") * .userAttribute("userAttribute") * .value("value") * .build()) * .id(ComponentPropertyProperty.builder() * .bindingProperties(ComponentPropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .bindings(Map.of( * "bindingsKey", FormBindingElementProperty.builder() * .element("element") * .property("property") * .build())) * .collectionBindingProperties(ComponentPropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .componentName("componentName") * .concat(List.of(componentPropertyProperty_)) * .condition(ComponentConditionPropertyProperty.builder() * .else(componentPropertyProperty_) * .field("field") * .operand("operand") * .operandType("operandType") * .operator("operator") * .property("property") * .then(componentPropertyProperty_) * .build()) * .configured(false) * .defaultValue("defaultValue") * .event("event") * .importedValue("importedValue") * .model("model") * .property("property") * .type("type") * .userAttribute("userAttribute") * .value("value") * .build()) * .model("model") * .state(MutationActionSetStateParameterProperty.builder() * .componentName("componentName") * .property("property") * .set(ComponentPropertyProperty.builder() * .bindingProperties(ComponentPropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .bindings(Map.of( * "bindingsKey", FormBindingElementProperty.builder() * .element("element") * .property("property") * .build())) * .collectionBindingProperties(ComponentPropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .componentName("componentName") * .concat(List.of(componentPropertyProperty_)) * .condition(ComponentConditionPropertyProperty.builder() * .else(componentPropertyProperty_) * .field("field") * .operand("operand") * .operandType("operandType") * .operator("operator") * .property("property") * .then(componentPropertyProperty_) * .build()) * .configured(false) * .defaultValue("defaultValue") * .event("event") * .importedValue("importedValue") * .model("model") * .property("property") * .type("type") * .userAttribute("userAttribute") * .value("value") * .build()) * .build()) * .target(ComponentPropertyProperty.builder() * .bindingProperties(ComponentPropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .bindings(Map.of( * "bindingsKey", FormBindingElementProperty.builder() * .element("element") * .property("property") * .build())) * .collectionBindingProperties(ComponentPropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .componentName("componentName") * .concat(List.of(componentPropertyProperty_)) * .condition(ComponentConditionPropertyProperty.builder() * .else(componentPropertyProperty_) * .field("field") * .operand("operand") * .operandType("operandType") * .operator("operator") * .property("property") * .then(componentPropertyProperty_) * .build()) * .configured(false) * .defaultValue("defaultValue") * .event("event") * .importedValue("importedValue") * .model("model") * .property("property") * .type("type") * .userAttribute("userAttribute") * .value("value") * .build()) * .type(ComponentPropertyProperty.builder() * .bindingProperties(ComponentPropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .bindings(Map.of( * "bindingsKey", FormBindingElementProperty.builder() * .element("element") * .property("property") * .build())) * .collectionBindingProperties(ComponentPropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .componentName("componentName") * .concat(List.of(componentPropertyProperty_)) * .condition(ComponentConditionPropertyProperty.builder() * .else(componentPropertyProperty_) * .field("field") * .operand("operand") * .operandType("operandType") * .operator("operator") * .property("property") * .then(componentPropertyProperty_) * .build()) * .configured(false) * .defaultValue("defaultValue") * .event("event") * .importedValue("importedValue") * .model("model") * .property("property") * .type("type") * .userAttribute("userAttribute") * .value("value") * .build()) * .url(ComponentPropertyProperty.builder() * .bindingProperties(ComponentPropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .bindings(Map.of( * "bindingsKey", FormBindingElementProperty.builder() * .element("element") * .property("property") * .build())) * .collectionBindingProperties(ComponentPropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .componentName("componentName") * .concat(List.of(componentPropertyProperty_)) * .condition(ComponentConditionPropertyProperty.builder() * .else(componentPropertyProperty_) * .field("field") * .operand("operand") * .operandType("operandType") * .operator("operator") * .property("property") * .then(componentPropertyProperty_) * .build()) * .configured(false) * .defaultValue("defaultValue") * .event("event") * .importedValue("importedValue") * .model("model") * .property("property") * .type("type") * .userAttribute("userAttribute") * .value("value") * .build()) * .build()) * .build(); * ``` * * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amplifyuibuilder-component-componentevent.html) */ public inline fun cfnComponentComponentEventProperty( block: CfnComponentComponentEventPropertyDsl.() -> Unit = {} ): CfnComponent.ComponentEventProperty { val builder = CfnComponentComponentEventPropertyDsl() builder.apply(block) return builder.build() } /** * The `ComponentPropertyBindingProperties` property specifies a component property to associate * with a binding property. * * This enables exposed properties on the top level component to propagate data to the * component's property values. * * Example: * ``` * // The code below shows an example of how to instantiate this type. * // The values are placeholders you should change. * import software.amazon.awscdk.services.amplifyuibuilder.*; * ComponentPropertyBindingPropertiesProperty componentPropertyBindingPropertiesProperty = * ComponentPropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build(); * ``` * * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amplifyuibuilder-component-componentpropertybindingproperties.html) */ public inline fun cfnComponentComponentPropertyBindingPropertiesProperty( block: CfnComponentComponentPropertyBindingPropertiesPropertyDsl.() -> Unit = {} ): CfnComponent.ComponentPropertyBindingPropertiesProperty { val builder = CfnComponentComponentPropertyBindingPropertiesPropertyDsl() builder.apply(block) return builder.build() } /** * The `ComponentProperty` property specifies the configuration for all of a component's * properties. * * Use `ComponentProperty` to specify the values to render or bind by default. * * Example: * ``` * // The code below shows an example of how to instantiate this type. * // The values are placeholders you should change. * import software.amazon.awscdk.services.amplifyuibuilder.*; * ComponentPropertyProperty componentPropertyProperty_; * ComponentPropertyProperty componentPropertyProperty = ComponentPropertyProperty.builder() * .bindingProperties(ComponentPropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .bindings(Map.of( * "bindingsKey", FormBindingElementProperty.builder() * .element("element") * .property("property") * .build())) * .collectionBindingProperties(ComponentPropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .componentName("componentName") * .concat(List.of(componentPropertyProperty_)) * .condition(ComponentConditionPropertyProperty.builder() * .else(componentPropertyProperty_) * .field("field") * .operand("operand") * .operandType("operandType") * .operator("operator") * .property("property") * .then(componentPropertyProperty_) * .build()) * .configured(false) * .defaultValue("defaultValue") * .event("event") * .importedValue("importedValue") * .model("model") * .property("property") * .type("type") * .userAttribute("userAttribute") * .value("value") * .build(); * ``` * * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amplifyuibuilder-component-componentproperty.html) */ public inline fun cfnComponentComponentPropertyProperty( block: CfnComponentComponentPropertyPropertyDsl.() -> Unit = {} ): CfnComponent.ComponentPropertyProperty { val builder = CfnComponentComponentPropertyPropertyDsl() builder.apply(block) return builder.build() } /** * The `ComponentVariant` property specifies the style configuration of a unique variation of a * main component. * * Example: * ``` * // The code below shows an example of how to instantiate this type. * // The values are placeholders you should change. * import software.amazon.awscdk.services.amplifyuibuilder.*; * Object overrides; * ComponentVariantProperty componentVariantProperty = ComponentVariantProperty.builder() * .overrides(overrides) * .variantValues(Map.of( * "variantValuesKey", "variantValues")) * .build(); * ``` * * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amplifyuibuilder-component-componentvariant.html) */ public inline fun cfnComponentComponentVariantProperty( block: CfnComponentComponentVariantPropertyDsl.() -> Unit = {} ): CfnComponent.ComponentVariantProperty { val builder = CfnComponentComponentVariantPropertyDsl() builder.apply(block) return builder.build() } /** * Describes how to bind a component property to form data. * * Example: * ``` * // The code below shows an example of how to instantiate this type. * // The values are placeholders you should change. * import software.amazon.awscdk.services.amplifyuibuilder.*; * FormBindingElementProperty formBindingElementProperty = FormBindingElementProperty.builder() * .element("element") * .property("property") * .build(); * ``` * * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amplifyuibuilder-component-formbindingelement.html) */ public inline fun cfnComponentFormBindingElementProperty( block: CfnComponentFormBindingElementPropertyDsl.() -> Unit = {} ): CfnComponent.FormBindingElementProperty { val builder = CfnComponentFormBindingElementPropertyDsl() builder.apply(block) return builder.build() } /** * Represents the state configuration when an action modifies a property of another element * within the same component. * * Example: * ``` * // The code below shows an example of how to instantiate this type. * // The values are placeholders you should change. * import software.amazon.awscdk.services.amplifyuibuilder.*; * ComponentPropertyProperty componentPropertyProperty_; * MutationActionSetStateParameterProperty mutationActionSetStateParameterProperty = * MutationActionSetStateParameterProperty.builder() * .componentName("componentName") * .property("property") * .set(ComponentPropertyProperty.builder() * .bindingProperties(ComponentPropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .bindings(Map.of( * "bindingsKey", FormBindingElementProperty.builder() * .element("element") * .property("property") * .build())) * .collectionBindingProperties(ComponentPropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .componentName("componentName") * .concat(List.of(componentPropertyProperty_)) * .condition(ComponentConditionPropertyProperty.builder() * .else(componentPropertyProperty_) * .field("field") * .operand("operand") * .operandType("operandType") * .operator("operator") * .property("property") * .then(componentPropertyProperty_) * .build()) * .configured(false) * .defaultValue("defaultValue") * .event("event") * .importedValue("importedValue") * .model("model") * .property("property") * .type("type") * .userAttribute("userAttribute") * .value("value") * .build()) * .build(); * ``` * * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amplifyuibuilder-component-mutationactionsetstateparameter.html) */ public inline fun cfnComponentMutationActionSetStateParameterProperty( block: CfnComponentMutationActionSetStateParameterPropertyDsl.() -> Unit = {} ): CfnComponent.MutationActionSetStateParameterProperty { val builder = CfnComponentMutationActionSetStateParameterPropertyDsl() builder.apply(block) return builder.build() } /** * The `Predicate` property specifies information for generating Amplify DataStore queries. * * Use `Predicate` to retrieve a subset of the data in a collection. * * Example: * ``` * // The code below shows an example of how to instantiate this type. * // The values are placeholders you should change. * import software.amazon.awscdk.services.amplifyuibuilder.*; * PredicateProperty predicateProperty_; * PredicateProperty predicateProperty = PredicateProperty.builder() * .and(List.of(predicateProperty_)) * .field("field") * .operand("operand") * .operandType("operandType") * .operator("operator") * .or(List.of(predicateProperty_)) * .build(); * ``` * * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amplifyuibuilder-component-predicate.html) */ public inline fun cfnComponentPredicateProperty( block: CfnComponentPredicatePropertyDsl.() -> Unit = {} ): CfnComponent.PredicateProperty { val builder = CfnComponentPredicatePropertyDsl() builder.apply(block) return builder.build() } /** * Properties for defining a `CfnComponent`. * * Example: * ``` * ``` * * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-amplifyuibuilder-component.html) */ public inline fun cfnComponentProps( block: CfnComponentPropsDsl.() -> Unit = {} ): CfnComponentProps { val builder = CfnComponentPropsDsl() builder.apply(block) return builder.build() } /** * The `SortProperty` property specifies how to sort the data that you bind to a component. * * Example: * ``` * // The code below shows an example of how to instantiate this type. * // The values are placeholders you should change. * import software.amazon.awscdk.services.amplifyuibuilder.*; * SortPropertyProperty sortPropertyProperty = SortPropertyProperty.builder() * .direction("direction") * .field("field") * .build(); * ``` * * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amplifyuibuilder-component-sortproperty.html) */ public inline fun cfnComponentSortPropertyProperty( block: CfnComponentSortPropertyPropertyDsl.() -> Unit = {} ): CfnComponent.SortPropertyProperty { val builder = CfnComponentSortPropertyPropertyDsl() builder.apply(block) return builder.build() } /** * The AWS::AmplifyUIBuilder::Form resource specifies all of the information that is required to * create a form. * * Example: * ``` * // The code below shows an example of how to instantiate this type. * // The values are placeholders you should change. * import software.amazon.awscdk.services.amplifyuibuilder.*; * FormInputValuePropertyProperty formInputValuePropertyProperty_; * CfnForm cfnForm = CfnForm.Builder.create(this, "MyCfnForm") * .appId("appId") * .cta(FormCTAProperty.builder() * .cancel(FormButtonProperty.builder() * .children("children") * .excluded(false) * .position(FieldPositionProperty.builder() * .below("below") * .fixed("fixed") * .rightOf("rightOf") * .build()) * .build()) * .clear(FormButtonProperty.builder() * .children("children") * .excluded(false) * .position(FieldPositionProperty.builder() * .below("below") * .fixed("fixed") * .rightOf("rightOf") * .build()) * .build()) * .position("position") * .submit(FormButtonProperty.builder() * .children("children") * .excluded(false) * .position(FieldPositionProperty.builder() * .below("below") * .fixed("fixed") * .rightOf("rightOf") * .build()) * .build()) * .build()) * .dataType(FormDataTypeConfigProperty.builder() * .dataSourceType("dataSourceType") * .dataTypeName("dataTypeName") * .build()) * .environmentName("environmentName") * .fields(Map.of( * "fieldsKey", FieldConfigProperty.builder() * .excluded(false) * .inputType(FieldInputConfigProperty.builder() * .type("type") * // the properties below are optional * .defaultChecked(false) * .defaultCountryCode("defaultCountryCode") * .defaultValue("defaultValue") * .descriptiveText("descriptiveText") * .fileUploaderConfig(FileUploaderFieldConfigProperty.builder() * .acceptedFileTypes(List.of("acceptedFileTypes")) * .accessLevel("accessLevel") * // the properties below are optional * .isResumable(false) * .maxFileCount(123) * .maxSize(123) * .showThumbnails(false) * .build()) * .isArray(false) * .maxValue(123) * .minValue(123) * .name("name") * .placeholder("placeholder") * .readOnly(false) * .required(false) * .step(123) * .value("value") * .valueMappings(ValueMappingsProperty.builder() * .values(List.of(ValueMappingProperty.builder() * .value(FormInputValuePropertyProperty.builder() * .bindingProperties(FormInputValuePropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .concat(List.of(formInputValuePropertyProperty_)) * .value("value") * .build()) * // the properties below are optional * .displayValue(FormInputValuePropertyProperty.builder() * .bindingProperties(FormInputValuePropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .concat(List.of(formInputValuePropertyProperty_)) * .value("value") * .build()) * .build())) * // the properties below are optional * .bindingProperties(Map.of( * "bindingPropertiesKey", FormInputBindingPropertiesValueProperty.builder() * .bindingProperties(FormInputBindingPropertiesValuePropertiesProperty.builder() * .model("model") * .build()) * .type("type") * .build())) * .build()) * .build()) * .label("label") * .position(FieldPositionProperty.builder() * .below("below") * .fixed("fixed") * .rightOf("rightOf") * .build()) * .validations(List.of(FieldValidationConfigurationProperty.builder() * .type("type") * // the properties below are optional * .numValues(List.of(123)) * .strValues(List.of("strValues")) * .validationMessage("validationMessage") * .build())) * .build())) * .formActionType("formActionType") * .labelDecorator("labelDecorator") * .name("name") * .schemaVersion("schemaVersion") * .sectionalElements(Map.of( * "sectionalElementsKey", SectionalElementProperty.builder() * .type("type") * // the properties below are optional * .excluded(false) * .level(123) * .orientation("orientation") * .position(FieldPositionProperty.builder() * .below("below") * .fixed("fixed") * .rightOf("rightOf") * .build()) * .text("text") * .build())) * .style(FormStyleProperty.builder() * .horizontalGap(FormStyleConfigProperty.builder() * .tokenReference("tokenReference") * .value("value") * .build()) * .outerPadding(FormStyleConfigProperty.builder() * .tokenReference("tokenReference") * .value("value") * .build()) * .verticalGap(FormStyleConfigProperty.builder() * .tokenReference("tokenReference") * .value("value") * .build()) * .build()) * .tags(Map.of( * "tagsKey", "tags")) * .build(); * ``` * * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-amplifyuibuilder-form.html) */ public inline fun cfnForm( scope: Construct, id: String, block: CfnFormDsl.() -> Unit = {}, ): CfnForm { val builder = CfnFormDsl(scope, id) builder.apply(block) return builder.build() } /** * The `FieldConfig` property specifies the configuration information for a field in a table. * * Example: * ``` * // The code below shows an example of how to instantiate this type. * // The values are placeholders you should change. * import software.amazon.awscdk.services.amplifyuibuilder.*; * FormInputValuePropertyProperty formInputValuePropertyProperty_; * FieldConfigProperty fieldConfigProperty = FieldConfigProperty.builder() * .excluded(false) * .inputType(FieldInputConfigProperty.builder() * .type("type") * // the properties below are optional * .defaultChecked(false) * .defaultCountryCode("defaultCountryCode") * .defaultValue("defaultValue") * .descriptiveText("descriptiveText") * .fileUploaderConfig(FileUploaderFieldConfigProperty.builder() * .acceptedFileTypes(List.of("acceptedFileTypes")) * .accessLevel("accessLevel") * // the properties below are optional * .isResumable(false) * .maxFileCount(123) * .maxSize(123) * .showThumbnails(false) * .build()) * .isArray(false) * .maxValue(123) * .minValue(123) * .name("name") * .placeholder("placeholder") * .readOnly(false) * .required(false) * .step(123) * .value("value") * .valueMappings(ValueMappingsProperty.builder() * .values(List.of(ValueMappingProperty.builder() * .value(FormInputValuePropertyProperty.builder() * .bindingProperties(FormInputValuePropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .concat(List.of(formInputValuePropertyProperty_)) * .value("value") * .build()) * // the properties below are optional * .displayValue(FormInputValuePropertyProperty.builder() * .bindingProperties(FormInputValuePropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .concat(List.of(formInputValuePropertyProperty_)) * .value("value") * .build()) * .build())) * // the properties below are optional * .bindingProperties(Map.of( * "bindingPropertiesKey", FormInputBindingPropertiesValueProperty.builder() * .bindingProperties(FormInputBindingPropertiesValuePropertiesProperty.builder() * .model("model") * .build()) * .type("type") * .build())) * .build()) * .build()) * .label("label") * .position(FieldPositionProperty.builder() * .below("below") * .fixed("fixed") * .rightOf("rightOf") * .build()) * .validations(List.of(FieldValidationConfigurationProperty.builder() * .type("type") * // the properties below are optional * .numValues(List.of(123)) * .strValues(List.of("strValues")) * .validationMessage("validationMessage") * .build())) * .build(); * ``` * * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amplifyuibuilder-form-fieldconfig.html) */ public inline fun cfnFormFieldConfigProperty( block: CfnFormFieldConfigPropertyDsl.() -> Unit = {} ): CfnForm.FieldConfigProperty { val builder = CfnFormFieldConfigPropertyDsl() builder.apply(block) return builder.build() } /** * The `FieldInputConfig` property specifies the configuration for the default input values to * display for a field. * * Example: * ``` * // The code below shows an example of how to instantiate this type. * // The values are placeholders you should change. * import software.amazon.awscdk.services.amplifyuibuilder.*; * FormInputValuePropertyProperty formInputValuePropertyProperty_; * FieldInputConfigProperty fieldInputConfigProperty = FieldInputConfigProperty.builder() * .type("type") * // the properties below are optional * .defaultChecked(false) * .defaultCountryCode("defaultCountryCode") * .defaultValue("defaultValue") * .descriptiveText("descriptiveText") * .fileUploaderConfig(FileUploaderFieldConfigProperty.builder() * .acceptedFileTypes(List.of("acceptedFileTypes")) * .accessLevel("accessLevel") * // the properties below are optional * .isResumable(false) * .maxFileCount(123) * .maxSize(123) * .showThumbnails(false) * .build()) * .isArray(false) * .maxValue(123) * .minValue(123) * .name("name") * .placeholder("placeholder") * .readOnly(false) * .required(false) * .step(123) * .value("value") * .valueMappings(ValueMappingsProperty.builder() * .values(List.of(ValueMappingProperty.builder() * .value(FormInputValuePropertyProperty.builder() * .bindingProperties(FormInputValuePropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .concat(List.of(formInputValuePropertyProperty_)) * .value("value") * .build()) * // the properties below are optional * .displayValue(FormInputValuePropertyProperty.builder() * .bindingProperties(FormInputValuePropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .concat(List.of(formInputValuePropertyProperty_)) * .value("value") * .build()) * .build())) * // the properties below are optional * .bindingProperties(Map.of( * "bindingPropertiesKey", FormInputBindingPropertiesValueProperty.builder() * .bindingProperties(FormInputBindingPropertiesValuePropertiesProperty.builder() * .model("model") * .build()) * .type("type") * .build())) * .build()) * .build(); * ``` * * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amplifyuibuilder-form-fieldinputconfig.html) */ public inline fun cfnFormFieldInputConfigProperty( block: CfnFormFieldInputConfigPropertyDsl.() -> Unit = {} ): CfnForm.FieldInputConfigProperty { val builder = CfnFormFieldInputConfigPropertyDsl() builder.apply(block) return builder.build() } /** * The `FieldPosition` property specifies the field position. * * Example: * ``` * // The code below shows an example of how to instantiate this type. * // The values are placeholders you should change. * import software.amazon.awscdk.services.amplifyuibuilder.*; * FieldPositionProperty fieldPositionProperty = FieldPositionProperty.builder() * .below("below") * .fixed("fixed") * .rightOf("rightOf") * .build(); * ``` * * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amplifyuibuilder-form-fieldposition.html) */ public inline fun cfnFormFieldPositionProperty( block: CfnFormFieldPositionPropertyDsl.() -> Unit = {} ): CfnForm.FieldPositionProperty { val builder = CfnFormFieldPositionPropertyDsl() builder.apply(block) return builder.build() } /** * The `FieldValidationConfiguration` property specifies the validation configuration for a * field. * * Example: * ``` * // The code below shows an example of how to instantiate this type. * // The values are placeholders you should change. * import software.amazon.awscdk.services.amplifyuibuilder.*; * FieldValidationConfigurationProperty fieldValidationConfigurationProperty = * FieldValidationConfigurationProperty.builder() * .type("type") * // the properties below are optional * .numValues(List.of(123)) * .strValues(List.of("strValues")) * .validationMessage("validationMessage") * .build(); * ``` * * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amplifyuibuilder-form-fieldvalidationconfiguration.html) */ public inline fun cfnFormFieldValidationConfigurationProperty( block: CfnFormFieldValidationConfigurationPropertyDsl.() -> Unit = {} ): CfnForm.FieldValidationConfigurationProperty { val builder = CfnFormFieldValidationConfigurationPropertyDsl() builder.apply(block) return builder.build() } /** * Describes the configuration for the file uploader field. * * Example: * ``` * // The code below shows an example of how to instantiate this type. * // The values are placeholders you should change. * import software.amazon.awscdk.services.amplifyuibuilder.*; * FileUploaderFieldConfigProperty fileUploaderFieldConfigProperty = * FileUploaderFieldConfigProperty.builder() * .acceptedFileTypes(List.of("acceptedFileTypes")) * .accessLevel("accessLevel") * // the properties below are optional * .isResumable(false) * .maxFileCount(123) * .maxSize(123) * .showThumbnails(false) * .build(); * ``` * * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amplifyuibuilder-form-fileuploaderfieldconfig.html) */ public inline fun cfnFormFileUploaderFieldConfigProperty( block: CfnFormFileUploaderFieldConfigPropertyDsl.() -> Unit = {} ): CfnForm.FileUploaderFieldConfigProperty { val builder = CfnFormFileUploaderFieldConfigPropertyDsl() builder.apply(block) return builder.build() } /** * The `FormButton` property specifies the configuration for a button UI element that is a part * of a form. * * Example: * ``` * // The code below shows an example of how to instantiate this type. * // The values are placeholders you should change. * import software.amazon.awscdk.services.amplifyuibuilder.*; * FormButtonProperty formButtonProperty = FormButtonProperty.builder() * .children("children") * .excluded(false) * .position(FieldPositionProperty.builder() * .below("below") * .fixed("fixed") * .rightOf("rightOf") * .build()) * .build(); * ``` * * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amplifyuibuilder-form-formbutton.html) */ public inline fun cfnFormFormButtonProperty( block: CfnFormFormButtonPropertyDsl.() -> Unit = {} ): CfnForm.FormButtonProperty { val builder = CfnFormFormButtonPropertyDsl() builder.apply(block) return builder.build() } /** * The `FormCTA` property specifies the call to action button configuration for the form. * * Example: * ``` * // The code below shows an example of how to instantiate this type. * // The values are placeholders you should change. * import software.amazon.awscdk.services.amplifyuibuilder.*; * FormCTAProperty formCTAProperty = FormCTAProperty.builder() * .cancel(FormButtonProperty.builder() * .children("children") * .excluded(false) * .position(FieldPositionProperty.builder() * .below("below") * .fixed("fixed") * .rightOf("rightOf") * .build()) * .build()) * .clear(FormButtonProperty.builder() * .children("children") * .excluded(false) * .position(FieldPositionProperty.builder() * .below("below") * .fixed("fixed") * .rightOf("rightOf") * .build()) * .build()) * .position("position") * .submit(FormButtonProperty.builder() * .children("children") * .excluded(false) * .position(FieldPositionProperty.builder() * .below("below") * .fixed("fixed") * .rightOf("rightOf") * .build()) * .build()) * .build(); * ``` * * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amplifyuibuilder-form-formcta.html) */ public inline fun cfnFormFormCTAProperty( block: CfnFormFormCTAPropertyDsl.() -> Unit = {} ): CfnForm.FormCTAProperty { val builder = CfnFormFormCTAPropertyDsl() builder.apply(block) return builder.build() } /** * The `FormDataTypeConfig` property specifies the data type configuration for the data source * associated with a form. * * Example: * ``` * // The code below shows an example of how to instantiate this type. * // The values are placeholders you should change. * import software.amazon.awscdk.services.amplifyuibuilder.*; * FormDataTypeConfigProperty formDataTypeConfigProperty = FormDataTypeConfigProperty.builder() * .dataSourceType("dataSourceType") * .dataTypeName("dataTypeName") * .build(); * ``` * * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amplifyuibuilder-form-formdatatypeconfig.html) */ public inline fun cfnFormFormDataTypeConfigProperty( block: CfnFormFormDataTypeConfigPropertyDsl.() -> Unit = {} ): CfnForm.FormDataTypeConfigProperty { val builder = CfnFormFormDataTypeConfigPropertyDsl() builder.apply(block) return builder.build() } /** * Represents the data binding configuration for a specific property using data stored in AWS . * * For AWS connected properties, you can bind a property to data stored in an Amplify DataStore * model. * * Example: * ``` * // The code below shows an example of how to instantiate this type. * // The values are placeholders you should change. * import software.amazon.awscdk.services.amplifyuibuilder.*; * FormInputBindingPropertiesValuePropertiesProperty * formInputBindingPropertiesValuePropertiesProperty = * FormInputBindingPropertiesValuePropertiesProperty.builder() * .model("model") * .build(); * ``` * * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amplifyuibuilder-form-forminputbindingpropertiesvalueproperties.html) */ public inline fun cfnFormFormInputBindingPropertiesValuePropertiesProperty( block: CfnFormFormInputBindingPropertiesValuePropertiesPropertyDsl.() -> Unit = {} ): CfnForm.FormInputBindingPropertiesValuePropertiesProperty { val builder = CfnFormFormInputBindingPropertiesValuePropertiesPropertyDsl() builder.apply(block) return builder.build() } /** * Represents the data binding configuration for a form's input fields at runtime.You can use * `FormInputBindingPropertiesValue` to add exposed properties to a form to allow different * values to be entered when a form is reused in different places in an app. * * Example: * ``` * // The code below shows an example of how to instantiate this type. * // The values are placeholders you should change. * import software.amazon.awscdk.services.amplifyuibuilder.*; * FormInputBindingPropertiesValueProperty formInputBindingPropertiesValueProperty = * FormInputBindingPropertiesValueProperty.builder() * .bindingProperties(FormInputBindingPropertiesValuePropertiesProperty.builder() * .model("model") * .build()) * .type("type") * .build(); * ``` * * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amplifyuibuilder-form-forminputbindingpropertiesvalue.html) */ public inline fun cfnFormFormInputBindingPropertiesValueProperty( block: CfnFormFormInputBindingPropertiesValuePropertyDsl.() -> Unit = {} ): CfnForm.FormInputBindingPropertiesValueProperty { val builder = CfnFormFormInputBindingPropertiesValuePropertyDsl() builder.apply(block) return builder.build() } /** * Associates a form property to a binding property. * * This enables exposed properties on the top level form to propagate data to the form's * property values. * * Example: * ``` * // The code below shows an example of how to instantiate this type. * // The values are placeholders you should change. * import software.amazon.awscdk.services.amplifyuibuilder.*; * FormInputValuePropertyBindingPropertiesProperty formInputValuePropertyBindingPropertiesProperty * = FormInputValuePropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build(); * ``` * * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amplifyuibuilder-form-forminputvaluepropertybindingproperties.html) */ public inline fun cfnFormFormInputValuePropertyBindingPropertiesProperty( block: CfnFormFormInputValuePropertyBindingPropertiesPropertyDsl.() -> Unit = {} ): CfnForm.FormInputValuePropertyBindingPropertiesProperty { val builder = CfnFormFormInputValuePropertyBindingPropertiesPropertyDsl() builder.apply(block) return builder.build() } /** * The `FormInputValueProperty` property specifies the configuration for an input field on a * form. * * Use `FormInputValueProperty` to specify the values to render or bind by default. * * Example: * ``` * // The code below shows an example of how to instantiate this type. * // The values are placeholders you should change. * import software.amazon.awscdk.services.amplifyuibuilder.*; * FormInputValuePropertyProperty formInputValuePropertyProperty_; * FormInputValuePropertyProperty formInputValuePropertyProperty = * FormInputValuePropertyProperty.builder() * .bindingProperties(FormInputValuePropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .concat(List.of(formInputValuePropertyProperty_)) * .value("value") * .build(); * ``` * * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amplifyuibuilder-form-forminputvalueproperty.html) */ public inline fun cfnFormFormInputValuePropertyProperty( block: CfnFormFormInputValuePropertyPropertyDsl.() -> Unit = {} ): CfnForm.FormInputValuePropertyProperty { val builder = CfnFormFormInputValuePropertyPropertyDsl() builder.apply(block) return builder.build() } /** * The `FormStyleConfig` property specifies the configuration settings for the form's style * properties. * * Example: * ``` * // The code below shows an example of how to instantiate this type. * // The values are placeholders you should change. * import software.amazon.awscdk.services.amplifyuibuilder.*; * FormStyleConfigProperty formStyleConfigProperty = FormStyleConfigProperty.builder() * .tokenReference("tokenReference") * .value("value") * .build(); * ``` * * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amplifyuibuilder-form-formstyleconfig.html) */ public inline fun cfnFormFormStyleConfigProperty( block: CfnFormFormStyleConfigPropertyDsl.() -> Unit = {} ): CfnForm.FormStyleConfigProperty { val builder = CfnFormFormStyleConfigPropertyDsl() builder.apply(block) return builder.build() } /** * The `FormStyle` property specifies the configuration for the form's style. * * Example: * ``` * // The code below shows an example of how to instantiate this type. * // The values are placeholders you should change. * import software.amazon.awscdk.services.amplifyuibuilder.*; * FormStyleProperty formStyleProperty = FormStyleProperty.builder() * .horizontalGap(FormStyleConfigProperty.builder() * .tokenReference("tokenReference") * .value("value") * .build()) * .outerPadding(FormStyleConfigProperty.builder() * .tokenReference("tokenReference") * .value("value") * .build()) * .verticalGap(FormStyleConfigProperty.builder() * .tokenReference("tokenReference") * .value("value") * .build()) * .build(); * ``` * * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amplifyuibuilder-form-formstyle.html) */ public inline fun cfnFormFormStyleProperty( block: CfnFormFormStylePropertyDsl.() -> Unit = {} ): CfnForm.FormStyleProperty { val builder = CfnFormFormStylePropertyDsl() builder.apply(block) return builder.build() } /** * Properties for defining a `CfnForm`. * * Example: * ``` * // The code below shows an example of how to instantiate this type. * // The values are placeholders you should change. * import software.amazon.awscdk.services.amplifyuibuilder.*; * FormInputValuePropertyProperty formInputValuePropertyProperty_; * CfnFormProps cfnFormProps = CfnFormProps.builder() * .appId("appId") * .cta(FormCTAProperty.builder() * .cancel(FormButtonProperty.builder() * .children("children") * .excluded(false) * .position(FieldPositionProperty.builder() * .below("below") * .fixed("fixed") * .rightOf("rightOf") * .build()) * .build()) * .clear(FormButtonProperty.builder() * .children("children") * .excluded(false) * .position(FieldPositionProperty.builder() * .below("below") * .fixed("fixed") * .rightOf("rightOf") * .build()) * .build()) * .position("position") * .submit(FormButtonProperty.builder() * .children("children") * .excluded(false) * .position(FieldPositionProperty.builder() * .below("below") * .fixed("fixed") * .rightOf("rightOf") * .build()) * .build()) * .build()) * .dataType(FormDataTypeConfigProperty.builder() * .dataSourceType("dataSourceType") * .dataTypeName("dataTypeName") * .build()) * .environmentName("environmentName") * .fields(Map.of( * "fieldsKey", FieldConfigProperty.builder() * .excluded(false) * .inputType(FieldInputConfigProperty.builder() * .type("type") * // the properties below are optional * .defaultChecked(false) * .defaultCountryCode("defaultCountryCode") * .defaultValue("defaultValue") * .descriptiveText("descriptiveText") * .fileUploaderConfig(FileUploaderFieldConfigProperty.builder() * .acceptedFileTypes(List.of("acceptedFileTypes")) * .accessLevel("accessLevel") * // the properties below are optional * .isResumable(false) * .maxFileCount(123) * .maxSize(123) * .showThumbnails(false) * .build()) * .isArray(false) * .maxValue(123) * .minValue(123) * .name("name") * .placeholder("placeholder") * .readOnly(false) * .required(false) * .step(123) * .value("value") * .valueMappings(ValueMappingsProperty.builder() * .values(List.of(ValueMappingProperty.builder() * .value(FormInputValuePropertyProperty.builder() * .bindingProperties(FormInputValuePropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .concat(List.of(formInputValuePropertyProperty_)) * .value("value") * .build()) * // the properties below are optional * .displayValue(FormInputValuePropertyProperty.builder() * .bindingProperties(FormInputValuePropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .concat(List.of(formInputValuePropertyProperty_)) * .value("value") * .build()) * .build())) * // the properties below are optional * .bindingProperties(Map.of( * "bindingPropertiesKey", FormInputBindingPropertiesValueProperty.builder() * .bindingProperties(FormInputBindingPropertiesValuePropertiesProperty.builder() * .model("model") * .build()) * .type("type") * .build())) * .build()) * .build()) * .label("label") * .position(FieldPositionProperty.builder() * .below("below") * .fixed("fixed") * .rightOf("rightOf") * .build()) * .validations(List.of(FieldValidationConfigurationProperty.builder() * .type("type") * // the properties below are optional * .numValues(List.of(123)) * .strValues(List.of("strValues")) * .validationMessage("validationMessage") * .build())) * .build())) * .formActionType("formActionType") * .labelDecorator("labelDecorator") * .name("name") * .schemaVersion("schemaVersion") * .sectionalElements(Map.of( * "sectionalElementsKey", SectionalElementProperty.builder() * .type("type") * // the properties below are optional * .excluded(false) * .level(123) * .orientation("orientation") * .position(FieldPositionProperty.builder() * .below("below") * .fixed("fixed") * .rightOf("rightOf") * .build()) * .text("text") * .build())) * .style(FormStyleProperty.builder() * .horizontalGap(FormStyleConfigProperty.builder() * .tokenReference("tokenReference") * .value("value") * .build()) * .outerPadding(FormStyleConfigProperty.builder() * .tokenReference("tokenReference") * .value("value") * .build()) * .verticalGap(FormStyleConfigProperty.builder() * .tokenReference("tokenReference") * .value("value") * .build()) * .build()) * .tags(Map.of( * "tagsKey", "tags")) * .build(); * ``` * * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-amplifyuibuilder-form.html) */ public inline fun cfnFormProps(block: CfnFormPropsDsl.() -> Unit = {}): CfnFormProps { val builder = CfnFormPropsDsl() builder.apply(block) return builder.build() } /** * The `SectionalElement` property specifies the configuration information for a visual helper * element for a form. * * A sectional element can be a header, a text block, or a divider. These elements are static * and not associated with any data. * * Example: * ``` * // The code below shows an example of how to instantiate this type. * // The values are placeholders you should change. * import software.amazon.awscdk.services.amplifyuibuilder.*; * SectionalElementProperty sectionalElementProperty = SectionalElementProperty.builder() * .type("type") * // the properties below are optional * .excluded(false) * .level(123) * .orientation("orientation") * .position(FieldPositionProperty.builder() * .below("below") * .fixed("fixed") * .rightOf("rightOf") * .build()) * .text("text") * .build(); * ``` * * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amplifyuibuilder-form-sectionalelement.html) */ public inline fun cfnFormSectionalElementProperty( block: CfnFormSectionalElementPropertyDsl.() -> Unit = {} ): CfnForm.SectionalElementProperty { val builder = CfnFormSectionalElementPropertyDsl() builder.apply(block) return builder.build() } /** * The `ValueMapping` property specifies the association between a complex object and a display * value. * * Use `ValueMapping` to store how to represent complex objects when they are displayed. * * Example: * ``` * // The code below shows an example of how to instantiate this type. * // The values are placeholders you should change. * import software.amazon.awscdk.services.amplifyuibuilder.*; * FormInputValuePropertyProperty formInputValuePropertyProperty_; * ValueMappingProperty valueMappingProperty = ValueMappingProperty.builder() * .value(FormInputValuePropertyProperty.builder() * .bindingProperties(FormInputValuePropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .concat(List.of(formInputValuePropertyProperty_)) * .value("value") * .build()) * // the properties below are optional * .displayValue(FormInputValuePropertyProperty.builder() * .bindingProperties(FormInputValuePropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .concat(List.of(formInputValuePropertyProperty_)) * .value("value") * .build()) * .build(); * ``` * * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amplifyuibuilder-form-valuemapping.html) */ public inline fun cfnFormValueMappingProperty( block: CfnFormValueMappingPropertyDsl.() -> Unit = {} ): CfnForm.ValueMappingProperty { val builder = CfnFormValueMappingPropertyDsl() builder.apply(block) return builder.build() } /** * The `ValueMappings` property specifies the data binding configuration for a value map. * * Example: * ``` * // The code below shows an example of how to instantiate this type. * // The values are placeholders you should change. * import software.amazon.awscdk.services.amplifyuibuilder.*; * FormInputValuePropertyProperty formInputValuePropertyProperty_; * ValueMappingsProperty valueMappingsProperty = ValueMappingsProperty.builder() * .values(List.of(ValueMappingProperty.builder() * .value(FormInputValuePropertyProperty.builder() * .bindingProperties(FormInputValuePropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .concat(List.of(formInputValuePropertyProperty_)) * .value("value") * .build()) * // the properties below are optional * .displayValue(FormInputValuePropertyProperty.builder() * .bindingProperties(FormInputValuePropertyBindingPropertiesProperty.builder() * .property("property") * // the properties below are optional * .field("field") * .build()) * .concat(List.of(formInputValuePropertyProperty_)) * .value("value") * .build()) * .build())) * // the properties below are optional * .bindingProperties(Map.of( * "bindingPropertiesKey", FormInputBindingPropertiesValueProperty.builder() * .bindingProperties(FormInputBindingPropertiesValuePropertiesProperty.builder() * .model("model") * .build()) * .type("type") * .build())) * .build(); * ``` * * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amplifyuibuilder-form-valuemappings.html) */ public inline fun cfnFormValueMappingsProperty( block: CfnFormValueMappingsPropertyDsl.() -> Unit = {} ): CfnForm.ValueMappingsProperty { val builder = CfnFormValueMappingsPropertyDsl() builder.apply(block) return builder.build() } /** * The AWS::AmplifyUIBuilder::Theme resource specifies a theme within an Amplify app. * * A theme is a collection of style settings that apply globally to the components associated * with the app. * * Example: * ``` * // The code below shows an example of how to instantiate this type. * // The values are placeholders you should change. * import software.amazon.awscdk.services.amplifyuibuilder.*; * ThemeValuesProperty themeValuesProperty_; * CfnTheme cfnTheme = CfnTheme.Builder.create(this, "MyCfnTheme") * .appId("appId") * .environmentName("environmentName") * .name("name") * .overrides(List.of(ThemeValuesProperty.builder() * .key("key") * .value(ThemeValueProperty.builder() * .children(List.of(themeValuesProperty_)) * .value("value") * .build()) * .build())) * .tags(Map.of( * "tagsKey", "tags")) * .values(List.of(ThemeValuesProperty.builder() * .key("key") * .value(ThemeValueProperty.builder() * .children(List.of(themeValuesProperty_)) * .value("value") * .build()) * .build())) * .build(); * ``` * * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-amplifyuibuilder-theme.html) */ public inline fun cfnTheme( scope: Construct, id: String, block: CfnThemeDsl.() -> Unit = {}, ): CfnTheme { val builder = CfnThemeDsl(scope, id) builder.apply(block) return builder.build() } /** * Properties for defining a `CfnTheme`. * * Example: * ``` * // The code below shows an example of how to instantiate this type. * // The values are placeholders you should change. * import software.amazon.awscdk.services.amplifyuibuilder.*; * ThemeValuesProperty themeValuesProperty_; * CfnThemeProps cfnThemeProps = CfnThemeProps.builder() * .appId("appId") * .environmentName("environmentName") * .name("name") * .overrides(List.of(ThemeValuesProperty.builder() * .key("key") * .value(ThemeValueProperty.builder() * .children(List.of(themeValuesProperty_)) * .value("value") * .build()) * .build())) * .tags(Map.of( * "tagsKey", "tags")) * .values(List.of(ThemeValuesProperty.builder() * .key("key") * .value(ThemeValueProperty.builder() * .children(List.of(themeValuesProperty_)) * .value("value") * .build()) * .build())) * .build(); * ``` * * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-amplifyuibuilder-theme.html) */ public inline fun cfnThemeProps(block: CfnThemePropsDsl.() -> Unit = {}): CfnThemeProps { val builder = CfnThemePropsDsl() builder.apply(block) return builder.build() } /** * The `ThemeValue` property specifies the configuration of a theme's properties. * * Example: * ``` * // The code below shows an example of how to instantiate this type. * // The values are placeholders you should change. * import software.amazon.awscdk.services.amplifyuibuilder.*; * ThemeValueProperty themeValueProperty_; * ThemeValueProperty themeValueProperty = ThemeValueProperty.builder() * .children(List.of(ThemeValuesProperty.builder() * .key("key") * .value(themeValueProperty_) * .build())) * .value("value") * .build(); * ``` * * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amplifyuibuilder-theme-themevalue.html) */ public inline fun cfnThemeThemeValueProperty( block: CfnThemeThemeValuePropertyDsl.() -> Unit = {} ): CfnTheme.ThemeValueProperty { val builder = CfnThemeThemeValuePropertyDsl() builder.apply(block) return builder.build() } /** * The `ThemeValues` property specifies key-value pair that defines a property of a theme. * * Example: * ``` * // The code below shows an example of how to instantiate this type. * // The values are placeholders you should change. * import software.amazon.awscdk.services.amplifyuibuilder.*; * ThemeValuesProperty themeValuesProperty_; * ThemeValuesProperty themeValuesProperty = ThemeValuesProperty.builder() * .key("key") * .value(ThemeValueProperty.builder() * .children(List.of(themeValuesProperty_)) * .value("value") * .build()) * .build(); * ``` * * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amplifyuibuilder-theme-themevalues.html) */ public inline fun cfnThemeThemeValuesProperty( block: CfnThemeThemeValuesPropertyDsl.() -> Unit = {} ): CfnTheme.ThemeValuesProperty { val builder = CfnThemeThemeValuesPropertyDsl() builder.apply(block) return builder.build() } }
3
Kotlin
0
3
c59c6292cf08f0fc3280d61e7f8cff813a608a62
100,433
awscdk-dsl-kotlin
Apache License 2.0
lib/sorawallet/src/commonMain/kotlin/jp/co/soramitsu/xnetworking/sorawallet/blockexplorerinfo/fiat/case2/SoraWalletFiatCase2Request.kt
soramitsu
475,838,756
false
{"Kotlin": 109437, "Swift": 339}
package jp.co.soramitsu.xnetworking.sorawallet.blockexplorerinfo.fiat.case2 internal fun graphQLRequestSoraWalletFiatCase2( cursor: String, ) = """ query FiatPriceQuery { entities: assets( first: 100 after: "$cursor") { nodes { id priceUSD } pageInfo { hasNextPage endCursor } } } """.trimIndent()
2
Kotlin
0
1
9048bf9bb1c547aa7c5c94ccda3e8d568f7b2738
486
x-networking
Apache License 2.0
ui-main/src/main/java/pl/kamilszustak/read/ui/main/quotes/QuotesEvent.kt
swistak7171
289,985,013
false
null
package pl.kamilszustak.read.ui.main.quotes import pl.kamilszustak.model.common.id.QuoteId import pl.kamilszustak.read.ui.base.view.ViewEvent sealed class QuotesEvent : ViewEvent { object OnAddQuoteButtonClicked : QuotesEvent() data class OnShareQuoteButtonClicked( val quoteId: QuoteId, ) : QuotesEvent() data class OnDeleteQuoteButtonClicked( val quoteId: QuoteId, ) : QuotesEvent() data class OnEditQuoteButtonClicked( val quoteId: QuoteId, ) : QuotesEvent() }
2
Kotlin
0
1
70d7be58042410bdb969035413b726126426e3d3
520
read
Apache License 2.0
app/src/main/java/com/pavelrekun/rekado/services/utils/DesignUtils.kt
mehmet-efe61
162,128,393
true
{"Kotlin": 64173, "C++": 1279, "Java": 817, "CMake": 145}
package com.pavelrekun.rekado.services.utils import android.app.ActivityManager import android.graphics.BitmapFactory import android.os.Build import android.util.TypedValue import android.view.View import androidx.core.content.ContextCompat import androidx.preference.PreferenceManager import com.pavelrekun.rang.data.NightMode import com.pavelrekun.rang.data.PrimaryColor import com.pavelrekun.rang.services.Rang import com.pavelrekun.rekado.R import com.pavelrekun.rekado.RekadoApplication import com.pavelrekun.rekado.base.BaseActivity object DesignUtils { fun setNightTheme() { val preferences = PreferenceManager.getDefaultSharedPreferences(RekadoApplication.instance.applicationContext) val nightMode = preferences.getString("appearance_night_mode", "enabled") when (nightMode) { "disabled" -> Rang.config(RekadoApplication.instance.applicationContext).nightMode(NightMode.DAY).oledMode(false).apply() "enabled" -> Rang.config(RekadoApplication.instance.applicationContext).nightMode(NightMode.NIGHT).oledMode(false).apply() "amoled" -> Rang.config(RekadoApplication.instance.applicationContext).primaryColor(PrimaryColor.CASTRO_OLED).nightMode(NightMode.NIGHT).oledMode(true).apply() } } private fun changeStatusBarMode(nightMode: NightMode, view: View) { when (nightMode) { NightMode.DAY -> setLightStatusBar(view) NightMode.NIGHT -> clearLightStatusBar(view) } } private fun setLightStatusBar(view: View) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { var flags = view.systemUiVisibility flags = flags and View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR view.systemUiVisibility = flags } } private fun clearLightStatusBar(view: View) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { var flags = view.systemUiVisibility flags = flags and View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR.inv() view.systemUiVisibility = flags } } fun applyColorToTaskDescription(activity: BaseActivity) { val bitmap = BitmapFactory.decodeResource(activity.resources, R.mipmap.ic_launcher) val taskDescription = ActivityManager.TaskDescription(activity.getString(R.string.app_name), bitmap, ContextCompat.getColor(activity, R.color.colorBackgroundPrimary)) activity.setTaskDescription(taskDescription) } fun convertDPtoPX(dp: Int): Int { val resources = RekadoApplication.instance.applicationContext.resources return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp.toFloat(), resources.displayMetrics).toInt() } }
0
Kotlin
0
0
2c359ea0f4322a79e1e98dc4a154b65181658ec2
2,716
Rekado
Apache License 2.0
servomatic/src/main/kotlin/crackers/kobots/app/ServoThing.kt
EAGrahamJr
564,081,499
false
{"Kotlin": 67691, "Shell": 3453}
/* * Copyright 2022-2024 by E. A. Graham, Jr. * * 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 crackers.kobots.app import com.diozero.devices.Button import crackers.kobots.app.AppCommon.REMOTE_PI import crackers.kobots.app.AppCommon.mqttClient import crackers.kobots.app.SuzerainOfServos.INTERNAL_TOPIC import crackers.kobots.mqtt.homeassistant.KobotSelectEntity import crackers.kobots.parts.app.KobotSleep import crackers.kobots.parts.app.publishToTopic import crackers.kobots.parts.enumValue import crackers.kobots.parts.movement.ActionSequence import crackers.kobots.parts.movement.SequenceRequest import crackers.kobots.parts.scheduleWithFixedDelay import org.slf4j.LoggerFactory import java.util.concurrent.atomic.AtomicReference import kotlin.concurrent.thread import kotlin.system.exitProcess import kotlin.time.Duration.Companion.milliseconds /** * Handles a bunch of different servos for various things. Everything should have an HA interface. */ val logger = LoggerFactory.getLogger("Servomatic") enum class Mode { IDLE, STOP, CLUCK, TEXT } internal interface Startable { fun start() fun stop() } // because we might be doing something else? enum class SystemState { IDLE, MOVING } private val state = AtomicReference(SystemState.IDLE) internal var systemState: SystemState get() = state.get() set(v) { if (v != state.get()) { state.set(v) // TODO trigger things? } } fun main(args: Array<String>?) { // pass any arg and we'll use the remote pi // NOTE: this reqquires a diozero daemon running on the remote pi and the diozero remote jar in the classpath if (args?.isNotEmpty() == true) System.setProperty(REMOTE_PI, args[0]) // add the shutdown hook Runtime.getRuntime().addShutdownHook(thread(start = false, block = ::stopEverything)) val button = Button(17) var lastPush = false AppCommon.executor.scheduleWithFixedDelay(20.milliseconds, 20.milliseconds) { lastPush = button.value.also { pushed -> if (!pushed && lastPush) AppCommon.applicationRunning = false } if (AppCommon.applicationRunning) Sensei.publishEvent() } SuzerainOfServos.start() HAJunk.start() mqttClient.apply { startAliveCheck() allowEmergencyStop() } AppCommon.awaitTermination() KobotSleep.seconds(1) stopEverything() exitProcess(0) } fun stopEverything() { SuzerainOfServos.stop() AppCommon.executor.shutdownNow() HAJunk.close() logger.warn("Servomatic exit") } internal fun servoRequest(sequence: ActionSequence) = publishToTopic(INTERNAL_TOPIC, SequenceRequest(sequence)) internal val selectHandler = object : KobotSelectEntity.Companion.SelectHandler { override val options = Mode.entries.map { it.name } override fun executeOption(select: String) { when (enumValue<Mode>(select)) { Mode.IDLE -> { } Mode.STOP -> AppCommon.applicationRunning = false Mode.CLUCK -> { } else -> logger.warn("No clue what to do with $select") } } }
0
Kotlin
0
1
fb958fcfd306e87ee5a18a2eeb18e4a7b662d560
3,665
kobots
Apache License 2.0
app/src/main/java/com/chani/sampleplayer/MainActivity.kt
chani01
262,197,458
false
null
package com.chani.sampleplayer import androidx.appcompat.app.AppCompatActivity import android.os.Bundle import android.util.Log import com.chani.easyexoplayer.EasyExoPlayer import com.google.android.exoplayer2.Player import kotlinx.android.synthetic.main.activity_main.* class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) //init player EasyExoPlayer.initPlayer(this, getString(R.string.app_name)) EasyExoPlayer.setAudioFocus(true) val data = listOf( "https://d29j81y63o5tr8.cloudfront.net/sound/90541336_200506225505.m4a", "https://d29j81y63o5tr8.cloudfront.net/sound/37741219_200507143325.m4a", "https://d29j81y63o5tr8.cloudfront.net/sound/20723965_200507133322.m4a", "https://d29j81y63o5tr8.cloudfront.net/sound/52331111_200507124039.m4a" ) //single play button.setOnClickListener { EasyExoPlayer.setDataSource("https://d29j81y63o5tr8.cloudfront.net/sound/90541336_200506225505.m4a") EasyExoPlayer.play() } // playlist play button2.setOnClickListener { EasyExoPlayer.setPlayListSource(data) EasyExoPlayer.play() } //play pause button3.setOnClickListener { EasyExoPlayer.pause() } button4.setOnClickListener { EasyExoPlayer.stop(true) } button5.setOnClickListener { EasyExoPlayer.rePlay() } } }
0
Kotlin
0
1
21fe872303dec49f56b8b44f208ad3ba846b6512
1,626
EasyExoPlayer
Apache License 2.0
app/src/main/java/com/puutaro/commandclick/activity_lib/event/lib/cmdIndex/ExecCmdIndexSizingInTermShort.kt
puutaro
596,852,758
false
{"Kotlin": 1472142, "JavaScript": 147417, "HTML": 19619}
package com.puutaro.commandclick.activity_lib.event.lib.cmdIndex import androidx.core.view.isVisible import com.puutaro.commandclick.R import com.puutaro.commandclick.activity.MainActivity import com.puutaro.commandclick.fragment.CommandIndexFragment import com.puutaro.commandclick.fragment_lib.command_index_fragment.variable.CmdIndexLinearWeightParam object ExecCmdIndexSizingInTermShort { fun execCmdIndexSizingInTermShort( activity: MainActivity, isKeyboardShowing: Boolean, ) { val cmdIndexFragment = try { activity.supportFragmentManager.findFragmentByTag( activity.getString(R.string.command_index_fragment) ) as CommandIndexFragment } catch (e: Exception) { return } val binding = cmdIndexFragment.binding if(isKeyboardShowing) { binding.commandIndexFragment.layoutParams = CmdIndexLinearWeightParam.listViewShortWeight binding.cmdListSwipeToRefresh.isVisible = false return } binding.cmdListSwipeToRefresh.isVisible = true binding.commandIndexFragment.layoutParams = CmdIndexLinearWeightParam.listViewLongWeight } }
2
Kotlin
3
54
000db311f5780b2861a2143f7985507b06cae5f1
1,236
CommandClick
MIT License
app/src/main/java/com/koodipuukko/dragonsquad/GLRenderer.kt
tmmvn
450,234,293
false
{"Kotlin": 297115, "Java": 366}
package com.koodipuukko.dragonsquad import android.content.Context import android.graphics.Bitmap import android.graphics.BitmapFactory import android.opengl.EGLConfig import android.opengl.GLSurfaceView import android.opengl.GLUtils import android.util.Log import com.koodipuukko.R import java.util.ArrayList import javax.microedition.khronos.opengles.GL10 class GLRenderer (passedContext: Context) : GLSurfaceView.Renderer { private var terrainFloorBuffer: Buffers? = null private var terrainWallBuffer: Buffers? = null private var friendlyUnitBuffer: Buffers? = null private var enemyUnitBuffer: Buffers? = null private var uiBuffer: Buffers? = null private val uiTextBuffer: MutableList<Buffers> = ArrayList<Buffers>() private val context: Context = passedContext // context, needed for image loading private var bitmap: Bitmap? = null // used to load textures private val textures = IntArray(NUM_TEXTURES) // texture id array private val bitmaps = IntArray(NUM_TEXTURES) // bitmaps id array private var renderingTerrain = false private var renderingUnits = false private var renderingUI = false private var clearingTerrain = false private var clearingUnits = false private var clearingUI = false /** * Constructor * @param passedContext * Description Context to get resources. */ init { try { uiTextBuffer.clear() } catch(e: UnsupportedOperationException) { if(DEBUG) { Log.e(TAG, "GLRenderer: Error clearing text item list") } } if(DEBUG) { Log.d(TAG, "GLRenderer created initialized succesfully.") } } /** * Loads textures * @param gl * Description OpenGL reference to use. */ private fun loadTextures(gl: GL10): Boolean { if(DEBUG) { Log.d(TAG, "Loading textures.") } bitmaps[0] = R.drawable.grass bitmaps[1] = R.drawable.grass bitmaps[2] = R.drawable.soldier1 bitmaps[3] = R.drawable.font01 gl.glGenTextures( NUM_TEXTURES, textures, 0 ) // generate gl-texture indexes // loop through bitmaps, decode the bitmap and assign it to the correct gl-texture index for(i in 0 until NUM_TEXTURES) { bitmap = BitmapFactory.decodeResource(context.getResources(), bitmaps[i]) if(bitmap == null) { if(DEBUG) { Log.w(TAG, "Bitmap decoding failed, aborting.") return false } } // bind textures and set paramete1rs gl.glBindTexture(GL10.GL_TEXTURE_2D, textures[i]) gl.glTexParameterx( GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR ) gl.glTexParameterx( GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_LINEAR ) gl.glTexParameterx( GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S, GL10.GL_CLAMP_TO_EDGE ) gl.glTexParameterx( GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T, GL10.GL_CLAMP_TO_EDGE ) GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0) bitmap?.recycle() // done, recycle the texture to free memory if(DEBUG) { Log.d(TAG, "Bitmap loading succesfully") } } return true } /** * Called when the surface is created * @param gl * Description OpenGL-reference. * @param config * Description Config to use. */ override fun onSurfaceCreated( gl: GL10?, config: javax.microedition.khronos.egl.EGLConfig? ) { //gl.glEnable(GL10.GL_LIGHTING); // enable lightning //gl.glEnable(GL10.GL_LIGHT0); // enable default light gl?.glEnable(GL10.GL_TEXTURE_2D) // enable textures gl?.glClearDepthf(1.0f) // set the default depht when clearing screen gl?.glEnable(GL10.GL_DEPTH_TEST) // enable depth testing gl?.glDepthFunc(GL10.GL_LEQUAL) // depth function to use gl?.glHint( GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_NICEST ) // some nice perspective correction if(DEBUG) { Log.d(TAG, "GLRenderer: Surface created.") } } /** * Called when the surface is changed * @param gl * Description OpenGL-reference * @param width * Description Width of the screen. * @param height * Description Height of the screen. */ override fun onSurfaceChanged(gl: GL10, width: Int, height: Int) { if(loadTextures(gl)) // load textures { if(DEBUG) { Log.d(TAG, "Textures loaded succesfully.") } } else { if(DEBUG) { Log.w(TAG, "Texture loading failed.") } } /*if(CreateLight(gl)) // create the default light { if(DEBUG) Log.d(TAG, "Lights created succesfully."); } else if(DEBUG) Log.w(TAG, "Light creation failed.");*/ gl.glViewport(0, 0, width, height) // set viewport again gl.glMatrixMode(GL10.GL_PROJECTION) // set matrix mode gl.glEnableClientState(GL10.GL_VERTEX_ARRAY) // enable usage of vertex arrays gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY) // enable usage of texture coordinates gl.glLoadIdentity() // load default matrix gl.glOrthof( 0F, 800F, 480F, 0F, -1F, 1F ) // orthogonal perspective works better for 2D gl.glMatrixMode(GL10.GL_MODELVIEW) // set matrix mode to model view and reset also gl.glLoadIdentity() } fun clearTerrainBuffers(): Boolean { if(!renderingTerrain) { clearingTerrain = true terrainFloorBuffer = null terrainWallBuffer = null clearingTerrain = false return true } else { return false } } fun clearUnitBuffers(): Boolean { if(!renderingUnits) { clearingUnits = true friendlyUnitBuffer = null enemyUnitBuffer = null clearingUnits = false return true } else { return false } } fun clearUIBuffers(): Boolean { if(!renderingUI) { clearingUI = true uiBuffer = null try { uiTextBuffer.clear() } catch(e: UnsupportedOperationException) { if(DEBUG) { Log.e(TAG, "GLRenderer: Error clearing UI buffer: $e") } return false } clearingUI = false return true } else { return false } } fun setTerrainFloorBuffer(buffer: Buffers?) { terrainFloorBuffer = buffer } fun setTerrainWallBuffer(buffer: Buffers?) { terrainWallBuffer = buffer } fun setFriendlyUnitBuffer(buffer: Buffers?) { friendlyUnitBuffer = buffer } fun setEnemyUnitBuffer(buffer: Buffers?) { enemyUnitBuffer = buffer } fun setUIBuffer(ui: UI) { uiBuffer = ui.getGraphicsBuffer() for(i in 0 until ui.textFields.size) { try { uiTextBuffer.add( ui.textFields.get(i).getBuffer() ) } catch(e: UnsupportedOperationException) { if(DEBUG) { Log.e(TAG, "GLRenderer: Error adding text element: $e") } } catch(e: ClassCastException) { if(DEBUG) { Log.e(TAG, "GLRenderer: Error adding text element: $e") } } catch(e: IllegalArgumentException) { if(DEBUG) { Log.e(TAG, "GLRenderer: Error adding text element: $e") } } } } /** * Draw's the scene * @param gl * Description OpenGL-reference. */ override fun onDrawFrame(gl: GL10) { gl.glClearColor(0f, 0f, 0f, 1.0f) // set clear color to black gl.glClear(GL10.GL_COLOR_BUFFER_BIT or GL10.GL_DEPTH_BUFFER_BIT) // clear buffers gl.glFrontFace(GL10.GL_CCW) // set culling direction gl.glEnable(GL10.GL_CULL_FACE) // enable back face culling gl.glCullFace(GL10.GL_FRONT) gl.glEnable(GL10.GL_TEXTURE_2D) // enable textures gl.glEnable(GL10.GL_BLEND) // enable blending gl.glBlendFunc( GL10.GL_ONE, GL10.GL_ONE_MINUS_SRC_ALPHA ) // let's use additive blending since it's nice for this type of game renderingTerrain = true if(terrainFloorBuffer != null && !clearingTerrain) { gl.glBindTexture( GL10.GL_TEXTURE_2D, textures[terrainFloorBuffer!!.getTextureId()] ) // select correct texture gl.glVertexPointer( 3, GL10.GL_FLOAT, 0, terrainFloorBuffer!!.getVertexBuffer() ) // set pointer to our buffer gl.glColor4f( 1f, 1f, 1f, 1f ) // set vertex rendering color, since we use textures not really necessary gl.glTranslatef( terrainFloorBuffer!!.getXOffset(), terrainFloorBuffer!!.getYOffset(), 0f ) // translate the quad to it's correct position gl.glRotatef(0f, 0f, 0f, 1f) gl.glTexCoordPointer( 2, GL10.GL_FLOAT, 0, terrainFloorBuffer!!.getTextureBuffer() ) // set texture pointer to texcoord buffer gl.glDrawElements( GL10.GL_TRIANGLES, terrainFloorBuffer!!.getIndicesCount(), GL10.GL_UNSIGNED_SHORT, terrainFloorBuffer!!.getIndexBuffer() ) // draw the quad buffer gl.glLoadIdentity() // to make sure everything get's translated from the correct position } renderingTerrain = false renderingUnits = true if(friendlyUnitBuffer != null && !clearingUnits) { gl.glBindTexture( GL10.GL_TEXTURE_2D, textures[friendlyUnitBuffer!!.getTextureId()] ) // select correct texture gl.glVertexPointer( 3, GL10.GL_FLOAT, 0, friendlyUnitBuffer!!.getVertexBuffer() ) // set pointer to our buffer gl.glColor4f( 1f, 1f, 1f, 1f ) // set vertex rendering color, since we use textures not really necessary gl.glTranslatef( friendlyUnitBuffer!!.getXOffset(), friendlyUnitBuffer!!.getYOffset(), 0f ) // translate the quad to it's correct position gl.glRotatef(0f, 0f, 0f, 1f) gl.glTexCoordPointer( 2, GL10.GL_FLOAT, 0, friendlyUnitBuffer!!.getTextureBuffer() ) // set texture pointer to texcoord buffer gl.glDrawElements( GL10.GL_TRIANGLES, friendlyUnitBuffer!!.getIndicesCount(), GL10.GL_UNSIGNED_SHORT, friendlyUnitBuffer!!.getIndexBuffer() ) // draw the quad buffer gl.glLoadIdentity() // to make sure everything get's translated from the correct position } if(enemyUnitBuffer != null && !clearingUnits) { gl.glBindTexture( GL10.GL_TEXTURE_2D, textures[enemyUnitBuffer!!.getTextureId()] ) // select correct texture gl.glVertexPointer( 3, GL10.GL_FLOAT, 0, enemyUnitBuffer!!.getVertexBuffer() ) // set pointer to our buffer gl.glColor4f( 1f, 1f, 1f, 1f ) // set vertex rendering color, since we use textures not really necessary gl.glTranslatef( enemyUnitBuffer!!.getXOffset(), enemyUnitBuffer!!.getYOffset (), 0f ) // translate the quad to it's correct position gl.glRotatef(0f, 0f, 0f, 1f) gl.glTexCoordPointer( 2, GL10.GL_FLOAT, 0, enemyUnitBuffer!!.getTextureBuffer() ) // set texture pointer to texcoord buffer gl.glDrawElements( GL10.GL_TRIANGLES, enemyUnitBuffer!!.getIndicesCount(), GL10.GL_UNSIGNED_SHORT, enemyUnitBuffer!!.getIndexBuffer() ) // draw the quad buffer gl.glLoadIdentity() // to make sure everything get's translated from the correct position } renderingUnits = false renderingTerrain = true if(terrainWallBuffer != null && !clearingTerrain) { gl.glBindTexture( GL10.GL_TEXTURE_2D, textures[terrainWallBuffer!!.getTextureId()] ) // select correct texture gl.glVertexPointer( 3, GL10.GL_FLOAT, 0, terrainWallBuffer!!.getVertexBuffer() ) // set pointer to our buffer gl.glColor4f( 1f, 1f, 1f, 1f ) // set vertex rendering color, since we use textures not really necessary gl.glTranslatef( terrainFloorBuffer!!.getXOffset(), terrainWallBuffer!!.getYOffset(), 0f ) // translate the quad to it's correct position gl.glRotatef(0f, 0f, 0f, 1f) gl.glTexCoordPointer( 2, GL10.GL_FLOAT, 0, terrainWallBuffer!!.getTextureBuffer() ) // set texture pointer to texcoord buffer gl.glDrawElements( GL10.GL_TRIANGLES, terrainWallBuffer!!.getIndicesCount(), GL10.GL_UNSIGNED_SHORT, terrainWallBuffer!!.getIndexBuffer() ) // draw the quad buffer gl.glLoadIdentity() // to make sure everything get's translated from the correct position } renderingTerrain = false renderingUI = true // TODO: ADD UI RENDERING HERE if(uiTextBuffer.isNotEmpty() && !clearingUI) { gl.glBindTexture( GL10.GL_TEXTURE_2D, textures[3] ) // select correct texture for(i in 0 until uiTextBuffer.size) { gl.glVertexPointer( 3, GL10.GL_FLOAT, 0, uiTextBuffer[i].getVertexBuffer() ) // set pointer to our buffer gl.glColor4f( 1f, 1f, 1f, 1f ) // set vertex rendering color, since we use textures not really necessary gl.glTranslatef( uiTextBuffer[i].getXOffset(), uiTextBuffer[i].getYOffset(), 0f ) // translate the quad to it's correct position gl.glRotatef(0f, 0f, 0f, 1f) gl.glTexCoordPointer( 2, GL10.GL_FLOAT, 0, uiTextBuffer[i].getTextureBuffer() ) // set texture pointer to texcoord buffer gl.glDrawElements( GL10.GL_TRIANGLES, uiTextBuffer[i].getIndicesCount(), GL10.GL_UNSIGNED_SHORT, uiTextBuffer[i].getIndexBuffer() ) // draw the quad buffer gl.glLoadIdentity() // to make sure everything get's translated from the correct position } } renderingUI = false //gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY); // disable stuff we enabled earlier //gl.glDisableClientState(GL10.GL_VERTEX_ARRAY); gl.glDisable(GL10.GL_TEXTURE_2D) // continue disabling stuff gl.glDisable(GL10.GL_CULL_FACE) } companion object { private const val TAG = "Dragon Squad" // Game tag in logs private const val DEBUG = true // Sets debug mode on or off private const val NUM_TEXTURES = 4 // constant for texture amount } }
0
Kotlin
0
1
aa10dfac2364fd19898614fa218ba21f3964b84c
13,253
kotlin-android-game-snippets
Eiffel Forum License v2.0
src/main/kotlin/br/eng/r2a/dokument/documents/Document.kt
r2a-engineering
315,466,235
false
null
package br.eng.r2a.dokument.documents interface Document { fun isValid(documentValue: String): Boolean }
0
Kotlin
0
7
5cfafbc207ba63b05c348d29fe5239a6689b297c
109
dokument-validate
MIT License
lib/app-db/src/main/kotlin/vdi/component/db/app/model/DeleteFlag.kt
VEuPathDB
575,990,672
false
{"Kotlin": 601562, "Java": 211932, "RAML": 63444, "Makefile": 1936, "Dockerfile": 1001, "Shell": 423}
package org.veupathdb.vdi.lib.db.app.model /** * Dataset Deletion Status Indicator * * This enum represents the different deletion statuses a dataset may be in for * install target App databases. * * Datasets that are marked with [NotDeleted] (`0` in the database) are visible * to App DB queries for user datasets and may be included in results. * * Datasets that are marked with [DeletedNotUninstalled] (`2` in the database) * or [DeletedAndUninstalled] (`3` in the database) are not visible to App DB * queries. * * The flow of deletion statuses is: * * 1. [NotDeleted] - This is the initial status that is set when a dataset is * first registered in a target App DB. * 2. [DeletedNotUninstalled] - This is the status that is set immediately when * a dataset deletion event is fired by the dataset owner. This status means * the dataset should not be visible in App DB queries, but has not yet had * its data purged/uninstalled. * 3. [DeletedAndUninstalled] - This status is set after the dataset data has * been successfully purged/uninstalled. Datasets in this status are subject * to hard deletion at some point in the future. * * The integer value representing the statuses does not change in incrementing * order as one may expect, it instead moves from `0` to `2` to `1`. This is to * maintain backwards compatibility with previous iterations of the VDI service, * where there were only two statuses. In those VDI versions, a dataset would * only be set to the status `1` after a successful uninstall. This created an * issue, however, where datasets that a user had marked as deleted would still * appear in App DB queries if the uninstall process for that dataset failed. */ enum class DeleteFlag(val value: Int) { NotDeleted(0), DeletedNotUninstalled(2), DeletedAndUninstalled(1), ; companion object { @JvmStatic fun fromInt(value: Int): DeleteFlag { for (enumValue in entries) if (value == enumValue.value) return enumValue throw IllegalArgumentException("unrecognized DeleteFlag value: $value") } } }
41
Kotlin
0
0
41aceea8e161e0d018f1e573ec8883278862de00
2,127
vdi-service
Apache License 2.0
lib/app-db/src/main/kotlin/vdi/component/db/app/model/DeleteFlag.kt
VEuPathDB
575,990,672
false
{"Kotlin": 601562, "Java": 211932, "RAML": 63444, "Makefile": 1936, "Dockerfile": 1001, "Shell": 423}
package org.veupathdb.vdi.lib.db.app.model /** * Dataset Deletion Status Indicator * * This enum represents the different deletion statuses a dataset may be in for * install target App databases. * * Datasets that are marked with [NotDeleted] (`0` in the database) are visible * to App DB queries for user datasets and may be included in results. * * Datasets that are marked with [DeletedNotUninstalled] (`2` in the database) * or [DeletedAndUninstalled] (`3` in the database) are not visible to App DB * queries. * * The flow of deletion statuses is: * * 1. [NotDeleted] - This is the initial status that is set when a dataset is * first registered in a target App DB. * 2. [DeletedNotUninstalled] - This is the status that is set immediately when * a dataset deletion event is fired by the dataset owner. This status means * the dataset should not be visible in App DB queries, but has not yet had * its data purged/uninstalled. * 3. [DeletedAndUninstalled] - This status is set after the dataset data has * been successfully purged/uninstalled. Datasets in this status are subject * to hard deletion at some point in the future. * * The integer value representing the statuses does not change in incrementing * order as one may expect, it instead moves from `0` to `2` to `1`. This is to * maintain backwards compatibility with previous iterations of the VDI service, * where there were only two statuses. In those VDI versions, a dataset would * only be set to the status `1` after a successful uninstall. This created an * issue, however, where datasets that a user had marked as deleted would still * appear in App DB queries if the uninstall process for that dataset failed. */ enum class DeleteFlag(val value: Int) { NotDeleted(0), DeletedNotUninstalled(2), DeletedAndUninstalled(1), ; companion object { @JvmStatic fun fromInt(value: Int): DeleteFlag { for (enumValue in entries) if (value == enumValue.value) return enumValue throw IllegalArgumentException("unrecognized DeleteFlag value: $value") } } }
41
Kotlin
0
0
41aceea8e161e0d018f1e573ec8883278862de00
2,127
vdi-service
Apache License 2.0
plugins/ComposeAuth/src/noDefaultMain/kotlin/io/github/jan/supabase/compose/auth/composable/GoogleAuth.kt
supabase-community
495,084,592
false
{"Kotlin": 901718}
package io.github.jan.supabase.compose.auth.composable import androidx.compose.runtime.Composable import io.github.jan.supabase.compose.auth.ComposeAuth import io.github.jan.supabase.compose.auth.defaultLoginBehavior /** * Composable function that implements Native Google Auth. * * On unsupported platforms it will use the [fallback] * * @param onResult Callback for the result of the login * @param fallback Fallback function for unsupported platforms * @return [NativeSignInState] */ @Composable actual fun ComposeAuth.rememberSignInWithGoogle(onResult: (NativeSignInResult) -> Unit, fallback: suspend () -> Unit): NativeSignInState = defaultLoginBehavior(fallback) internal actual suspend fun handleGoogleSignOut() = Unit
11
Kotlin
37
395
52abcc3d5744ad2703afc40a9d1e6cae5b74b834
736
supabase-kt
MIT License
PixabayGallery/app/src/main/java/com/junpu/pixabaygallery/ui/image/ImageFragment.kt
zhangjunpu
351,693,686
false
null
package com.junpu.pixabaygallery.ui.image import android.Manifest import android.content.ContentValues import android.content.pm.PackageManager import android.graphics.Bitmap import android.os.Bundle import android.provider.MediaStore import androidx.fragment.app.Fragment import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import androidx.core.content.ContextCompat import androidx.core.graphics.drawable.toBitmap import androidx.core.view.get import androidx.databinding.DataBindingUtil import androidx.fragment.app.activityViewModels import androidx.lifecycle.lifecycleScope import androidx.recyclerview.widget.RecyclerView import androidx.viewpager2.widget.ViewPager2 import com.junpu.pixabaygallery.R import com.junpu.pixabaygallery.databinding.FragmentImageBinding import com.junpu.pixabaygallery.ui.MainViewModel import com.junpu.toast.toast import kotlinx.android.synthetic.main.fragment_image.* import kotlinx.android.synthetic.main.fragment_image_item.view.* import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.MainScope import kotlinx.coroutines.launch import kotlinx.coroutines.withContext const val IMAGE_INDEX = "image_index" const val REQUEST_PERMISSION_CODE = 1 class ImageFragment : Fragment() { private val viewModel by activityViewModels<MainViewModel>() override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? ): View? { return DataBindingUtil.inflate<FragmentImageBinding>( inflater, R.layout.fragment_image, container, false ).apply { vm = viewModel.apply { imageIndex.value = arguments?.getInt(IMAGE_INDEX) } lifecycleOwner }.root } override fun onActivityCreated(savedInstanceState: Bundle?) { super.onActivityCreated(savedInstanceState) viewPager.run { adapter = ImageAdapter().apply { submitList(viewModel.imageList.value) } setCurrentItem(viewModel.imageIndex.value ?: 0, false) registerOnPageChangeCallback(object : ViewPager2.OnPageChangeCallback() { override fun onPageSelected(position: Int) { viewModel.imageIndex.value = position + 1 } }) orientation = ViewPager2.ORIENTATION_VERTICAL } imageDownload.setOnClickListener { val hasPermission = ContextCompat.checkSelfPermission( requireContext(), Manifest.permission.WRITE_EXTERNAL_STORAGE ) if (hasPermission == PackageManager.PERMISSION_GRANTED) { lifecycleScope.launch { savePhoto { toastResult(it) } } } else { requestPermissions( arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE), REQUEST_PERMISSION_CODE ) } } } override fun onRequestPermissionsResult( requestCode: Int, permissions: Array<out String>, grantResults: IntArray ) { super.onRequestPermissionsResult(requestCode, permissions, grantResults) if (grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED) { lifecycleScope.launch { savePhoto { toastResult(it) } } } else { toastResult(false) } } private suspend fun savePhoto(callback: (Boolean) -> Unit) { withContext(Dispatchers.IO) { val holder = (viewPager[0] as RecyclerView).findViewHolderForAdapterPosition(viewPager.currentItem) holder as ImageViewHolder val bitmap = holder.itemView.photoView.drawable.toBitmap() requireContext().contentResolver.run { val imageUri = insert( MediaStore.Images.Media.EXTERNAL_CONTENT_URI, ContentValues() ) ?: kotlin.run { MainScope().launch { callback(false) } return@withContext } openOutputStream(imageUri).use { val result = bitmap.compress(Bitmap.CompressFormat.JPEG, 90, it) MainScope().launch { callback(result) } } } } } private fun toastResult(isSuccess: Boolean) = toast(if (isSuccess) "保存成功" else "保存失败") }
0
Kotlin
0
0
4fb63390fc666c29cd898abf4c4aa64a67af8d2e
4,519
AndroidJetpackDemo
MIT License
app/src/main/java/com/grevi/masakapa/db/RecipesDataSourceImpl.kt
ahmadramadhannn
390,560,780
true
{"Kotlin": 75373}
package com.grevi.masakapa.db import com.grevi.masakapa.db.entity.Category import com.grevi.masakapa.db.entity.RecipesTable import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.flow import javax.inject.Inject class RecipesDataSourceImpl @Inject constructor(private val recipesDAO: RecipesDAO) : RecipesDataSource { override suspend fun insertRecipes(recipesTable: RecipesTable) = recipesDAO.insertRecipes(recipesTable) override suspend fun isExistRecipes(key: String) : Boolean = recipesDAO.isExistsRecipes(key) override suspend fun getMarkRecipes() : MutableList<RecipesTable> = recipesDAO.getAllMarkRecipes() override suspend fun deleteRecipes(recipesTable: RecipesTable) = recipesDAO.deleteRecipes(recipesTable) override suspend fun getFlowRecipes(): Flow<List<RecipesTable>> = flow { emit(recipesDAO.getAllMarkRecipes()) } override suspend fun insertCategory(category: Category) = recipesDAO.insertCategory(category) override suspend fun getAllCategory(): MutableList<Category> = recipesDAO.getAllCategory() override suspend fun getFlowCategory(): Flow<MutableList<Category>> = flow { emit(recipesDAO.getAllCategory()) } }
0
null
0
0
beff087a00d91ddd369fbcf98f1da36cdef074ec
1,175
masak-apa
MIT License
base/src/main/kotlin/browser/contentSettings/Constructor.kt
DATL4G
372,873,797
false
null
@file:Suppress("UNCHECKED_CAST_TO_EXTERNAL_INTERFACE") package browser.contentSettings public inline fun ResourceIdentifier(block: ResourceIdentifier.() -> Unit): ResourceIdentifier = (js("{}") as ResourceIdentifier).apply(block) public inline fun ClearDetails(block: ClearDetails.() -> Unit): ClearDetails = (js("{}") as ClearDetails).apply(block) public inline fun GetReturn(block: GetReturn.() -> Unit): GetReturn = (js("{}") as GetReturn).apply(block) public inline fun GetDetails(block: GetDetails.() -> Unit): GetDetails = (js("{}") as GetDetails).apply(block) public inline fun SetDetails(block: SetDetails.() -> Unit): SetDetails = (js("{}") as SetDetails).apply(block) public inline fun ContentSetting(block: ContentSetting.() -> Unit): ContentSetting = (js("{}") as ContentSetting).apply(block)
0
Kotlin
1
37
ab2a825dd8dd8eb704278f52c603dbdd898d1875
836
Kromex
Apache License 2.0
presentation-layer/src/main/kotlin/org/deafsapps/android/githubbrowser/presentationlayer/feature/main/view/adapter/DataRepoListAdapter.kt
pablodeafsapps
304,021,652
false
null
package org.deafsapps.android.githubbrowser.presentationlayer.feature.main.view.adapter import android.view.LayoutInflater import android.view.ViewGroup import androidx.recyclerview.widget.RecyclerView import org.deafsapps.android.githubbrowser.presentationlayer.R import org.deafsapps.android.githubbrowser.presentationlayer.base.BaseViewHolder import org.deafsapps.android.githubbrowser.presentationlayer.feature.main.view.viewholder.DataRepoViewHolder import org.deafsapps.android.githubbrowser.presentationlayer.feature.main.view.viewholder.UpdateTimestampViewHolder import java.lang.IllegalStateException class DataRepoListAdapter( private var itemList: List<DataView>, private val onItemSelected: (DataViewAction) -> Unit ) : RecyclerView.Adapter<BaseViewHolder<DataView, DataViewAction>>() { override fun onCreateViewHolder( parent: ViewGroup, viewType: Int ): BaseViewHolder<DataView, DataViewAction> = when (viewType) { DataView.DataViewType.TYPE_DATE.type -> UpdateTimestampViewHolder( itemView = LayoutInflater.from(parent.context).inflate(R.layout.update_timestamp, parent, false) ) DataView.DataViewType.TYPE_REPO.type -> DataRepoViewHolder( itemView = LayoutInflater.from(parent.context).inflate(R.layout.data_repo, parent, false) ) else -> throw IllegalStateException("No 'ViewType' defined for this particular case") } override fun getItemCount(): Int = itemList.size override fun getItemViewType(position: Int): Int = itemList[position].viewType override fun onBindViewHolder(holder: BaseViewHolder<DataView, DataViewAction>, position: Int) { holder.onBind( item = itemList[position], callback = { item -> onItemSelected.invoke(item) } ) } fun updateData(newData: List<DataView>) { itemList = newData notifyDataSetChanged() } }
0
Kotlin
0
1
efbed3f77d01cae50b95610a601f960e507427e0
1,960
github-browser
MIT License
presentation-layer/src/main/kotlin/org/deafsapps/android/githubbrowser/presentationlayer/feature/main/view/adapter/DataRepoListAdapter.kt
pablodeafsapps
304,021,652
false
null
package org.deafsapps.android.githubbrowser.presentationlayer.feature.main.view.adapter import android.view.LayoutInflater import android.view.ViewGroup import androidx.recyclerview.widget.RecyclerView import org.deafsapps.android.githubbrowser.presentationlayer.R import org.deafsapps.android.githubbrowser.presentationlayer.base.BaseViewHolder import org.deafsapps.android.githubbrowser.presentationlayer.feature.main.view.viewholder.DataRepoViewHolder import org.deafsapps.android.githubbrowser.presentationlayer.feature.main.view.viewholder.UpdateTimestampViewHolder import java.lang.IllegalStateException class DataRepoListAdapter( private var itemList: List<DataView>, private val onItemSelected: (DataViewAction) -> Unit ) : RecyclerView.Adapter<BaseViewHolder<DataView, DataViewAction>>() { override fun onCreateViewHolder( parent: ViewGroup, viewType: Int ): BaseViewHolder<DataView, DataViewAction> = when (viewType) { DataView.DataViewType.TYPE_DATE.type -> UpdateTimestampViewHolder( itemView = LayoutInflater.from(parent.context).inflate(R.layout.update_timestamp, parent, false) ) DataView.DataViewType.TYPE_REPO.type -> DataRepoViewHolder( itemView = LayoutInflater.from(parent.context).inflate(R.layout.data_repo, parent, false) ) else -> throw IllegalStateException("No 'ViewType' defined for this particular case") } override fun getItemCount(): Int = itemList.size override fun getItemViewType(position: Int): Int = itemList[position].viewType override fun onBindViewHolder(holder: BaseViewHolder<DataView, DataViewAction>, position: Int) { holder.onBind( item = itemList[position], callback = { item -> onItemSelected.invoke(item) } ) } fun updateData(newData: List<DataView>) { itemList = newData notifyDataSetChanged() } }
0
Kotlin
0
1
efbed3f77d01cae50b95610a601f960e507427e0
1,960
github-browser
MIT License
app/src/main/java/com/aldajo92/joystickwebsocket/framework/validation/IPValidator.kt
aldajo92
656,899,261
false
null
package com.aldajo92.joystickwebsocket.framework.validation; class IPValidator : FieldValidator { // private val IP_REGEX = """^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$""" private val IP_REGEX = """^(?:\d{1,3}\.){3}\d{1,3}:\d{1,5}$""" override fun isValid(value: String): Boolean { // return IP_REGEX.toRegex().matches(value) return true } }
0
Kotlin
1
0
8dd79fbc6f482a78b4b5e7b3d1ebd8f57699419e
341
AndroidKt_JoyWebSocket
MIT License
app/src/main/kotlin/com/reconnect/refuge/ui/cameracapture/CameraCapturePresenterImpl.kt
BrianLusina
118,647,777
false
null
package com.emojify.me.ui.main import android.graphics.Bitmap import android.net.Uri import com.reconnect.refuge.data.DataManager import com.reconnect.refuge.data.io.SchedulerProvider import com.reconnect.refuge.ui.base.BasePresenterImpl import com.reconnect.refuge.ui.cameracapture.CameraCapturePresenter import com.reconnect.refuge.ui.cameracapture.CameraCaptureView import io.reactivex.disposables.CompositeDisposable import javax.inject.Inject /** * @author lusinabrian on 06/11/17. * @Notes Main presenter implementation */ class CameraCapturePresenterImpl<V : CameraCaptureView> @Inject constructor(val dataManager: DataManager, val schedulerProvider: SchedulerProvider, compositeDisposable: CompositeDisposable): CameraCapturePresenter<V>, BasePresenterImpl<V>(dataManager, schedulerProvider, compositeDisposable){ // fixme: make key unique private val sharedPrefsKey = "emojifyme" override fun onAttach(baseView: V) { super.onAttach(baseView) baseView.setupViewListeners() } override fun onCapturePhotoClicked() { baseView.capturePhoto() } override fun onClearBtnClicked() { val photoPath = dataManager.getImageFilePath(sharedPrefsKey) val isFileDeleted = dataManager.deleteImageFile(photoPath) baseView.clearImage(isFileDeleted) } override fun onSaveBtnClicked(bitmap: Bitmap?) { val photoPath = dataManager.getImageFilePath(sharedPrefsKey) dataManager.deleteImageFile(photoPath) val savedImagePath = dataManager.saveImageFile(bitmap) baseView.notifyUserOfSavedImage(savedImagePath) } override fun onPermissionDenied() { baseView.displayPermissionRationale() } override fun onPermissionsGranted() { baseView.launchCamera() } override fun onResamplePicRequest() { val photoPath = dataManager.getImageFilePath(sharedPrefsKey) baseView.resamplePic(photoPath) } override fun onActivityResultFailed() { val photoPath = dataManager.getImageFilePath(sharedPrefsKey) dataManager.deleteImageFile(photoPath) } override fun onActivityResultSuccess() { baseView.processAndSetImage() } override fun onTakePicture() : Uri?{ val (tempImageFile, photoUri)= dataManager.createTempImageFile() tempImageFile?.absolutePath?.let { dataManager.saveImageFilePath(sharedPrefsKey, it) } return photoUri } }
0
Kotlin
0
0
ee66760088877c9ec5e54ec94c0a9cf561709eb6
2,457
refugereconnect
MIT License
app-lifelike/src/main/java/com/example/lifelike/composable/loggedout/Splash.kt
tchigher
231,011,739
true
{"Kotlin": 43515}
package com.example.lifelike.composable.loggedout import androidx.compose.Composable import androidx.compose.unaryPlus import androidx.ui.core.Alignment import androidx.ui.core.Text import androidx.ui.core.dp import androidx.ui.layout.* import androidx.ui.material.MaterialTheme import androidx.ui.text.ParagraphStyle import androidx.ui.text.style.TextAlign import com.example.lifelike.composable.common.BigButton interface Splash { companion object { @Composable fun Content(onNext: () -> Unit) { Column(modifier = Spacing(40.dp), arrangement = Arrangement.SpaceAround) { Text( text = "Welcome to amazing fake app", style = (+MaterialTheme.typography()).h4, paragraphStyle = ParagraphStyle( textAlign = TextAlign.Center ) ) Container( expanded = true, constraints = DpConstraints(maxHeight = 48.dp), alignment = Alignment.Center ) { BigButton( text = "Create account", onClick = onNext ) } } } } }
0
null
0
0
b6b873d715d4eba169495493ae705f1aac1067a1
1,291
backtrack
Apache License 2.0
src/main/kotlin/rest/dummy.kt
pse-parkview
475,971,278
false
null
package rest import benchmark.Format import benchmark.SpmvBenchmarkResult import benchmark.SpmvDatapoint import database.DatabaseHandler import database.MissingBenchmarkResultException import git.* val DUMMY_BRANCH = "test" val DUMMY_DEVICE = Device("meter") val DUMMY_COMMIT = Commit("peter") val SPMV_DUMMY_RESULT = SpmvBenchmarkResult(DUMMY_COMMIT, DUMMY_DEVICE, (1..5).map { SpmvDatapoint( "Datapoint_$it", it * 10, it * 10, it * 10, listOf( Format( name = "format_name", storage = 1, time = 1.0, maxRelativeNorm2 = 1.0, completed = true ) ), ) } ) class DummyRepositoryHandler : RepositoryHandler { init { DUMMY_COMMIT.addDevice(DUMMY_DEVICE) } override fun fetchGitHistoryByBranch(branch: String, page: Int, benchmarkType: BenchmarkType): Array<Commit> = if (branch == DUMMY_BRANCH) { arrayOf(DUMMY_COMMIT) } else { emptyArray() } override fun getAvailableBranches(): Array<String> = arrayOf(DUMMY_BRANCH) override fun getNumberOfPages(branch: String): Int = 1 } class DummyDatabaseHandler : DatabaseHandler { init { DUMMY_COMMIT.addDevice(DUMMY_DEVICE) } override fun insertBenchmarkResults(results: Array<BenchmarkResult>) { return } override fun fetchBenchmarkResult(commit: Commit, device: Device, benchmark: BenchmarkType): BenchmarkResult = if (hasDataAvailable(commit, device, benchmark)) { SPMV_DUMMY_RESULT } else { throw MissingBenchmarkResultException(commit, device, benchmark) } override fun hasDataAvailable(commit: Commit, device: Device, benchmark: BenchmarkType): Boolean = commit == DUMMY_COMMIT && device == DUMMY_DEVICE && benchmark == BenchmarkType.Spmv override fun getAvailableDevicesForCommit(commit: Commit, benchmark: BenchmarkType): Array<Device> = if (commit == DUMMY_COMMIT && benchmark == BenchmarkType.Spmv) { arrayOf(DUMMY_DEVICE) } else { emptyArray() } }
0
Kotlin
0
2
e80f29be82d0e9823d55fecaf8d8a681b7dde3c7
2,104
parkview-lib
MIT License
common/src/main/kotlin/org/valkyrienskies/tournament/util/BlockMap.kt
alex-s168
648,266,124
false
{"Kotlin": 311448, "Java": 42190}
package org.valkyrienskies.tournament.util import blitz.collections.* import com.fasterxml.jackson.annotation.JsonIgnore import com.fasterxml.jackson.core.JsonGenerator import com.fasterxml.jackson.core.JsonParser import com.fasterxml.jackson.databind.DeserializationContext import com.fasterxml.jackson.databind.JsonNode import com.fasterxml.jackson.databind.SerializerProvider import com.fasterxml.jackson.databind.annotation.JsonDeserialize import com.fasterxml.jackson.databind.annotation.JsonSerialize import com.fasterxml.jackson.databind.deser.std.StdDeserializer import com.fasterxml.jackson.databind.node.ArrayNode import com.fasterxml.jackson.databind.ser.std.StdSerializer import net.minecraft.core.BlockPos import net.minecraft.world.level.ChunkPos fun JsonGenerator.writeBlockPos(blockPos: BlockPos) { writeNumber(blockPos.asLong()) } fun JsonNode.readBlockPos() = if (isArray) BlockPos( get(0).asInt(), get(1).asInt(), get(2).asInt(), ) else BlockPos.of(asLong()) private class BlockMapSerializer: StdSerializer<BlockMap<*>>(BlockMap::class.java) { override fun serialize(value: BlockMap<*>, gen: JsonGenerator, provider: SerializerProvider?) { gen.writeStartArray() value.contents().forEach { (a, b) -> gen.writeStartObject() gen.writeFieldName("pos") gen.writeBlockPos(a) gen.writeFieldName("value") provider?.defaultSerializeValue(b, gen) gen.writeFieldName("type") gen.writeString(b?.let { it::class.java.name } ?: "") gen.writeEndObject() } gen.writeEndArray() } } private class BlockMapDeserializer: StdDeserializer<BlockMap<*>>(BlockMap::class.java) { override fun deserialize(p: JsonParser, ctxt: DeserializationContext?): BlockMap<*> { val res = BlockMap<Any?>() val arr = p.codec.readTree<ArrayNode>(p) arr.forEach { node -> val pos = node.get("pos").readBlockPos() val ty = node.get("type").asText() if (ty != "") { val clazz = Class.forName(ty) val v = node.get("value") val value = ctxt?.readTreeAsValue(v, clazz) res[res.index(pos)] = value } } return res } } @JsonSerialize(using = BlockMapSerializer::class) @JsonDeserialize(using = BlockMapDeserializer::class) class BlockMap<T>: BlitzMap<BlockPos, T, BlockMap.Index<T>> { private val underlying = I2HashMap<BlitzHashMap<I3HashMapKey, T>>(::mutableListOf) sealed class Index<T> private class IndexImpl<T>( val cp: BlitzHashMap.Index<I2HashMapKey, BlitzHashMap<I3HashMapKey, T>>, val bp: I3HashMapKey, ): Index<T>() override fun contents(): Contents<Pair<BlockPos, T>> = underlying.contents().flatMap { (cp, bm) -> val real = ChunkPos(cp.a, cp.b) val baseX = real.minBlockX val baseZ = real.minBlockZ bm.contents().map { (bp, v) -> BlockPos(baseX + bp.a, bp.b, baseZ + bp.c) to v } }.contents override fun set(index: Index<T>, value: T?) { val idx = (index as IndexImpl) val blockMap = underlying[idx.cp] ?: I3HashMap<T>(::mutableListOf).also { underlying[idx.cp] = it } blockMap[blockMap.index(idx.bp)] = value if (value == null && blockMap.contents().count() == 0) { underlying.remove(idx.cp) } } override fun index(key: BlockPos): Index<T> { val cp = ChunkPos(key) return IndexImpl( underlying.index(I2HashMapKey(cp.x, cp.z)), I3HashMapKey( key.x - cp.minBlockX, key.y, key.z - cp.minBlockZ, ) ) } override fun get(index: Index<T>): T? { val idx = (index as IndexImpl) return underlying[idx.cp]?.let { bm -> bm[bm.index(idx.bp)] } } } open class SyncMap<K, V, I, M: BlitzMap<K,V,I>>( val unsafe: M ): BlitzMap<K,V,I> { @JsonIgnore private val lock = Any() override fun contents(): Contents<Pair<K, V>> = synchronized(lock) { unsafe.contents() } override fun set(index: I, value: V?) { synchronized(lock) { unsafe[index] = value } } override fun index(key: K): I = unsafe.index(key) override fun get(index: I): V? = synchronized(lock) { unsafe[index] } } typealias SyncBlockMap<T> = SyncMap<BlockPos, T, BlockMap.Index<T>, BlockMap<T>>
4
Kotlin
10
8
48f2da03fab0f937805231929b7c145c69b1dab1
4,683
VS_tournament_continued
Apache License 2.0
feature/accounts/src/main/java/org/expenny/feature/accounts/view/AccountsListConfirmSelectionButton.kt
expenny-application
712,607,222
false
{"Kotlin": 958809}
package org.expenny.feature.accounts.view import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import org.expenny.core.resources.R import org.expenny.core.ui.foundation.ExpennyButton import org.expenny.core.ui.foundation.model.button.ExpennyFloatingButtonAttributes import org.expenny.core.ui.foundation.model.button.ExpennyFloatingButtonSize import org.expenny.core.ui.foundation.model.button.ExpennyFloatingButtonType @Composable internal fun AccountsListConfirmSelectionButton( modifier: Modifier = Modifier, isExpanded: Boolean, onClick: () -> Unit ) { ExpennyButton( modifier = modifier, onClick = onClick, attributes = ExpennyFloatingButtonAttributes( isExpanded = isExpanded, type = ExpennyFloatingButtonType.Primary, size = ExpennyFloatingButtonSize.Large, label = stringResource(R.string.confirm_button), icon = painterResource(R.drawable.ic_check) ) ) }
0
Kotlin
0
0
38bcfc1cbb9184d1f52ad5c0c7398aaa4d38bc4b
1,096
expenny-android
Apache License 2.0
library/src/main/java/com/angcyo/library/ex/BitmapEx.kt
hongri-xiao
289,456,694
true
{"Kotlin": 1593128, "Java": 10629}
package com.angcyo.library.ex import android.content.Context import android.content.Intent import android.graphics.Bitmap import android.graphics.BitmapFactory import android.graphics.Matrix import android.media.ExifInterface import android.net.Uri import android.provider.MediaStore import android.util.Base64 import com.angcyo.library.L import com.angcyo.library.utils.Constant.PICTURE_FOLDER_NAME import com.angcyo.library.utils.fastBlur import com.angcyo.library.utils.fileNameUUID import com.angcyo.library.utils.filePath import java.io.ByteArrayOutputStream import java.io.File import java.io.InputStream /** * * Email:angcyo@126.com * @author angcyo * @date 2020/01/21 */ fun configQQIntent(intent: Intent) { // intent.setClassName("com.tencent.mm", "com.tencent.mm.ui.tools.ShareImgUI");//微信朋友 // intent.setClassName("com.tencent.mobileqq", "cooperation.qqfav.widget.QfavJumpActivity");//保存到QQ收藏 // intent.setClassName("com.tencent.mobileqq", "cooperation.qlink.QlinkShareJumpActivity");//QQ面对面快传 // intent.setClassName("com.tencent.mobileqq", "com.tencent.mobileqq.activity.qfileJumpActivity");//传给我的电脑 intent.setClassName("com.tencent.mobileqq", "com.tencent.mobileqq.activity.JumpActivity") //QQ好友或QQ群 // intent.setClassName("com.tencent.mm", "com.tencent.mm.ui.tools.ShareToTimeLineUI");//微信朋友圈,仅支持分享图片 } fun ByteArray.toBitmap(): Bitmap { return BitmapFactory.decodeByteArray(this, 0, this.size) } fun Bitmap.share(context: Context, shareQQ: Boolean = false, chooser: Boolean = true) { val uri = Uri.parse(MediaStore.Images.Media.insertImage(context.contentResolver, this, null, null)) var intent = Intent() intent.action = Intent.ACTION_SEND //设置分享行为 intent.type = "image/*" //设置分享内容的类型 intent.putExtra(Intent.EXTRA_STREAM, uri) intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) //List<ResolveInfo> resolveInfos = context.getPackageManager().queryIntentActivities(intent, PackageManager.GET_RESOLVED_FILTER); if (shareQQ) { configQQIntent(intent) if (chooser) { intent = Intent.createChooser(intent, "分享图片") //QQ WX分享的BUG } } else { intent = Intent.createChooser(intent, "分享图片") //QQ WX分享的BUG } intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) context.startActivity(intent) } /**模糊图片*/ fun Bitmap.blur(scale: Float = 1f /*0~1*/, radius: Float = 25f /*1~25*/): Bitmap? { return fastBlur(this, scale, radius) } /**将图片转成字节数组*/ fun Bitmap.toBytes( format: Bitmap.CompressFormat = Bitmap.CompressFormat.PNG, quality: Int = 100 ): ByteArray? { var out: ByteArrayOutputStream? = null var bytes: ByteArray? = null try { out = ByteArrayOutputStream() this.compress(format, quality, out) out.flush() bytes = out.toByteArray() out.close() } finally { out?.close() } return bytes } /** * 将图片转成base64字符串 * */ fun Bitmap.toBase64( format: Bitmap.CompressFormat = Bitmap.CompressFormat.PNG, quality: Int = 100 ): String { var result = "" toBytes(format, quality)?.let { result = Base64.encodeToString(it, Base64.NO_WRAP /*去掉/n符*/) } return result } /**从流中获取图片类型*/ fun InputStream.bitmapSuffix(): String { return try { val options = BitmapFactory.Options() options.inJustDecodeBounds = true BitmapFactory.decodeStream(this, null, options) options.outMimeType.replace("image/", "") } catch (e: Exception) { L.w(e) "jpg" } } /**从流中获取图片类型*/ fun String.bitmapSuffix(): String { return file()?.inputStream()?.bitmapSuffix() ?: "jpg" } /**从流中获取图片宽高*/ fun InputStream.bitmapSize(): IntArray { val result = intArrayOf(-1, -1) try { use { val options = BitmapFactory.Options() options.inJustDecodeBounds = true options.inSampleSize = 1 BitmapFactory.decodeStream(it, null, options) result[0] = options.outWidth result[1] = options.outHeight } } catch (e: Exception) { L.w(e) } return result } fun String.bitmapSize(): IntArray { return file()?.inputStream()?.bitmapSize() ?: intArrayOf(-1, -1) } /**保存图片*/ fun Bitmap.save( path: String = filePath(PICTURE_FOLDER_NAME, fileNameUUID(".jpeg")), format: Bitmap.CompressFormat = Bitmap.CompressFormat.JPEG, quality: Int = 90 ): File { return path.file()!!.apply { outputStream().use { compress(format, quality, it) } } } /**将图片旋转指定角度 * [degrees] 需要旋转的角度[0-360] * */ fun Bitmap.rotate(degrees: Float = 0f): Bitmap = if (degrees > 0) { val matrix = Matrix() matrix.postRotate(degrees) val rotatedBitmap = Bitmap.createBitmap( this, 0, 0, width, height, matrix, false ) if (rotatedBitmap != rotatedBitmap) { // 有时候 createBitmap会复用对象 recycle() } rotatedBitmap } else { this } /**[rotate]纠正旋转角度*/ fun File.toBitmap(rotate: Boolean = true) = absolutePath.toBitmap(rotate) fun String.toBitmap(rotate: Boolean = true): Bitmap { val file = File(this) return BitmapFactory.decodeFile(this).run { if (rotate) { rotate(file.exifOrientation().toFloat()) } else { this } } } /**获取图片的旋转角度*/ fun File.exifOrientation() = try { val orientation = ExifInterface(this.absolutePath).getAttributeInt(ExifInterface.TAG_ORIENTATION, -1) when (orientation) { ExifInterface.ORIENTATION_ROTATE_90 -> 90 ExifInterface.ORIENTATION_ROTATE_180 -> 180 ExifInterface.ORIENTATION_ROTATE_270 -> 270 else -> 0 } } catch (e: Exception) { 0 }
0
null
0
0
53e533caf25d2fcd76e54d712b8857486af90632
5,773
UICore
MIT License
android/app/src/main/kotlin/com/marcustwichel/MainActivity.kt
mtwichel
595,998,021
false
null
package com.marcustwichel.slack_chat import io.flutter.embedding.android.FlutterActivity class MainActivity: FlutterActivity() { }
3
Dart
1
13
6efc222c6a70c716e2db6da711502cd966cf8d28
133
slack-chat-prototype
Apache License 2.0
app/src/main/java/com/maasbodev/marvelcomicsmd/data/network/entities/ApiReferenceList.kt
MaasboDev
663,567,382
false
{"Kotlin": 83116, "Shell": 441}
package com.maasbodev.marvelcomicsmd.data.network.entities data class ApiReferenceList( val available: Int, val collectionURI: String, val items: List<ApiReference>?, val returned: Int )
0
Kotlin
0
0
2c42573d417bd1043674ac31aedcdfb3ac3786ce
204
marvel-comics-md
Apache License 2.0
central/src/main/java/cn/lalaki/pub/BaseDeleteDeploymentTask.kt
lalakii
818,217,756
false
{"Kotlin": 18062}
package cn.lalaki.pub import org.apache.commons.io.FileUtils import org.gradle.api.tasks.TaskAction import java.io.File import java.nio.charset.Charset abstract class BaseDeleteDeploymentTask : AbstractTask() { @TaskAction fun launch() { val arg = "utId" var id = "" if (project.hasProperty(arg)) { id = project.property(arg).toString() } if (id.isEmpty()) { val lastDeployment = File(lastDeploymentsId) if (lastDeployment.exists()) { id = FileUtils.readFileToString(lastDeployment, Charset.defaultCharset()) } } if (id.isEmpty()) return client .newCall( request .addHeader("Accept", "application/json") .addHeader("Content-Type", "application/json") .url( buildUrl() .addPathSegments("api/v1/publisher/deployment") .addPathSegment(id) .build(), ).delete(null) .build(), ).execute() .use { if (it.isSuccessful) { logger.lifecycle("Artifact with deployment id {} has been deleted", id) } else { logger.error("{}: {}", it.code, it.body?.string()) } } } }
0
Kotlin
0
0
fcafc3f52b4796959314250611e7758121a2ee67
1,455
central-portal-plus
Apache License 2.0
kopring/src/test/kotlin/com/example/kopring/test/IntegrationTestExecuteListener.kt
unluckyjung
484,942,720
false
{"Kotlin": 39032}
package com.example.kopring.test import org.springframework.jdbc.core.JdbcTemplate import org.springframework.test.context.TestContext import org.springframework.test.context.support.AbstractTestExecutionListener import org.springframework.test.jdbc.JdbcTestUtils import org.springframework.transaction.TransactionStatus import org.springframework.transaction.support.TransactionCallbackWithoutResult import org.springframework.transaction.support.TransactionTemplate import java.sql.DatabaseMetaData import java.sql.SQLException class IntegrationTestExecuteListener : AbstractTestExecutionListener() { override fun beforeTestMethod(testContext: TestContext) { val jdbcTemplate = getJdbcTemplate(testContext) val transactionTemplate = getTransactionTemplate(testContext) truncateAllTables(jdbcTemplate, transactionTemplate) } override fun afterTestMethod(testContext: TestContext) { val jdbcTemplate = getJdbcTemplate(testContext) val transactionTemplate = getTransactionTemplate(testContext) truncateAllTables(jdbcTemplate, transactionTemplate) } private fun getTransactionTemplate(testContext: TestContext): TransactionTemplate { return testContext.applicationContext.getBean(TransactionTemplate::class.java) } private fun getJdbcTemplate(testContext: TestContext): JdbcTemplate { return testContext.applicationContext.getBean(JdbcTemplate::class.java) } private fun truncateAllTables(jdbcTemplate: JdbcTemplate, transactionTemplate: TransactionTemplate) { transactionTemplate.execute(object : TransactionCallbackWithoutResult() { override fun doInTransactionWithoutResult(status: TransactionStatus) { jdbcTemplate.execute("set FOREIGN_KEY_CHECKS = 0;") JdbcTestUtils.deleteFromTables(jdbcTemplate, *getAllTables(jdbcTemplate).toTypedArray()) jdbcTemplate.execute("set FOREIGN_KEY_CHECKS = 1;") } }) } private fun getAllTables(jdbcTemplate: JdbcTemplate): List<String> { try { jdbcTemplate.dataSource?.connection.use { connection -> val metaData: DatabaseMetaData = connection!!.metaData val tables: MutableList<String> = ArrayList() metaData.getTables(null, null, null, arrayOf("TABLE")).use { resultSet -> while (resultSet.next()) { tables.add(resultSet.getString("TABLE_NAME")) } } return tables.filter { NOT_DELETE_TABLES.contains(it).not() } } } catch (exception: SQLException) { throw IllegalStateException(exception) } } companion object { private val NOT_DELETE_TABLES = setOf("flyway_schema_history") } }
1
Kotlin
0
4
4e6605decefb85b546c9030ee95a1a9add5f298f
2,847
kotlin-spring-jpa-playground
MIT License
ksol-rpc/src/main/kotlin/com/dgsd/ksol/jsonrpc/networking/RpcException.kt
dlgrech
524,875,633
false
null
package com.dgsd.ksol.jsonrpc.networking internal class RpcException(message: String, cause: Throwable? = null) : RuntimeException(message, cause)
0
Kotlin
2
9
153e922fa405d6ba6c33041002bcf53d6293c7cf
147
ksol
Apache License 2.0
app/network/src/main/java/com/pubnub/demo/telemedicine/initialization/data/Encrypted.kt
pubnub
340,153,384
false
null
package com.pubnub.demo.telemedicine.initialization.data import androidx.annotation.Keep @Keep data class Encrypted( val encrypted: String, )
0
Kotlin
3
9
0f8ebf2bd9e01507b0662f5ae9230fb3deb2d832
147
kotlin-telemedicine-demo
MIT License
app/src/main/java/com/example/cameracompose/MainActivity.kt
byronsanchez0
642,587,913
false
null
package com.example.cameracompose import android.Manifest import android.app.Activity import android.content.Intent import android.net.Uri import android.os.Build import android.os.Bundle import android.provider.Settings import androidx.activity.ComponentActivity import androidx.activity.compose.rememberLauncherForActivityResult import androidx.activity.compose.setContent import androidx.activity.result.contract.ActivityResultContracts import androidx.annotation.RequiresApi import androidx.compose.runtime.LaunchedEffect import com.example.cameracompose.dialogs.PermissionDialog import com.example.cameracompose.navigation.MainScreen import com.example.cameracompose.screens.camera.CameraViewModel import com.example.cameracompose.textprovider.CameraPermissionText import com.example.cameracompose.textprovider.LocationPermissionText import com.example.cameracompose.ui.theme.CameraComposeTheme class MainActivity : ComponentActivity() { @RequiresApi(Build.VERSION_CODES.TIRAMISU) private val permissionsToRequest = arrayOf( Manifest.permission.CAMERA, Manifest.permission.ACCESS_FINE_LOCATION, ) private val viewModel = CameraViewModel() @RequiresApi(Build.VERSION_CODES.TIRAMISU) override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContent { val dialogQueue = viewModel.visiblePermissionsDialogQueue val multiplePermissionResult = rememberLauncherForActivityResult( contract = ActivityResultContracts.RequestMultiplePermissions(), onResult = { perms -> permissionsToRequest.forEach { permission -> viewModel.onPermissionResult( permission = permission, isGranted = perms[permission] == true ) } } ) dialogQueue.reversed().forEach { permission -> PermissionDialog(permissionTextProvider = when (permission) { Manifest.permission.CAMERA -> { CameraPermissionText() } Manifest.permission.ACCESS_FINE_LOCATION -> { LocationPermissionText() } else -> return@forEach }, isPermanentlyDeclined = !shouldShowRequestPermissionRationale(permission), onDismiss = viewModel::dismissDialog, onAccept = { viewModel.dismissDialog() multiplePermissionResult.launch( arrayOf(permission) ) }, onGoSetting = { openSetting() } ) } LaunchedEffect(Unit) { multiplePermissionResult.launch( permissionsToRequest ) } CameraComposeTheme { MainScreen() } } } private fun Activity.openSetting() { Intent( Settings.ACTION_APPLICATION_DETAILS_SETTINGS, Uri.fromParts("package", packageName, null) ).also(::startActivity) } }
0
Kotlin
0
0
53cd52fc94f6114cb62c68009f8d3fa691385f9d
3,281
CameraCompose
MIT License
src/jvmMain/kotlin/org/github/anisch/modules/DaoModule.kt
anisch
612,110,087
false
{"Kotlin": 18762}
package org.github.anisch.modules import org.github.anisch.dao.DefaultPersonDao import org.github.anisch.dao.PersonDao import org.koin.dsl.module val daoModule = module { single<PersonDao> { DefaultPersonDao() } }
0
Kotlin
0
0
deaa6c744772b3085cdbf36dbb9e713a98ce667c
220
kotlin-multiplatform-demo
MIT License
sql/src/main/kotlin/io/github/pdvrieze/kotlinsql/metadata/impl/TableMetaResultBase.kt
pdvrieze
55,180,714
false
null
/* * Copyright (c) 2021. * * This file is part of kotlinsql. * * This file is licenced to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You should have received a copy of the license with the source distribution. * Alternatively, you may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package io.github.pdvrieze.kotlinsql.metadata.impl import io.github.pdvrieze.kotlinsql.metadata.SchemaResultsBase interface TableMetaResultBase<D: TableMetaResultBase.Data<D>>: SchemaResultsBase<D> { val tableName: String abstract class Data<D: Data<D>>(data: TableMetaResultBase<*>): SchemaResultsBase.Data<D>(data), TableMetaResultBase<D> { override val tableName: String = data.tableName } }
1
Kotlin
1
2
3ed9e15e96251913be9d2127259f53c44c879439
1,166
kotlinsql
Apache License 2.0
app/src/main/java/tuver/manualdi/provider/impl/WebImageProviderImpl.kt
cemtuver
587,025,922
false
null
package tuver.manualdi.provider.impl import android.widget.ImageView import androidx.fragment.app.Fragment import com.bumptech.glide.Glide import com.bumptech.glide.RequestBuilder import com.bumptech.glide.load.resource.bitmap.CircleCrop import tuver.manualdi.di.AppModule import tuver.manualdi.provider.WebImageProvider class WebImageProviderImpl( private val fragment: Fragment ) : WebImageProvider { private fun <TranscodeType> RequestBuilder<TranscodeType>.transform( imageCrop: WebImageProvider.ImageCrop? ): RequestBuilder<TranscodeType> { return when (imageCrop) { WebImageProvider.ImageCrop.CIRCLE -> transform(CircleCrop()) else -> this } } override fun load(imageView: ImageView, imageUrl: String, imageCrop: WebImageProvider.ImageCrop?) { Glide.with(fragment) .load(imageUrl) .transform(imageCrop) .into(imageView) } companion object { context(AppModule) fun create(fragment: Fragment): WebImageProviderImpl { return WebImageProviderImpl(fragment) } } }
0
Kotlin
0
3
51244153a6c460159370ee278cb7dd0aec57ceca
1,133
android-manualdi
MIT License
src/main/kotlin/moirai/transport/TransportAst.kt
moirai-lang
301,230,998
false
{"Kotlin": 1308517, "ANTLR": 9622}
package moirai.transport import java.math.BigDecimal /** * This type provides a stable public surface for simple Abstract Syntax Trees. It can be used * in contexts where generating raw Moirai code may not be safe. For example, when converting * a transport format to Moirai, the transport format may contain a string interpolation that * creates a security risk if directly converted to Moirai. Instead of converting to raw code, * this AST allows a conversion to a safe in-memory object. */ sealed class TransportAst data class IntLiteralTransportAst(val canonicalForm: Int): TransportAst() data class DecimalLiteralTransportAst(val canonicalForm: BigDecimal): TransportAst() data class BooleanLiteralTransportAst(val canonicalForm: Boolean): TransportAst() data class CharLiteralTransportAst(val canonicalForm: Char): TransportAst() data class StringLiteralTransportAst(val canonicalForm: String): TransportAst() data class RefTransportAst(val name: String): TransportAst() data class ApplyTransportAst(val name: String, val args: List<TransportAst>): TransportAst()
5
Kotlin
1
24
92e34321fa32324eab62dc45057d46969999ee23
1,078
moirai-kt
MIT License