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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
reposilite-backend/src/main/kotlin/com/reposilite/frontend/infrastructure/DashboardHandler.kt | dzikoysk | 96,474,388 | false | null | /*
* Copyright (c) 2021 dzikoysk
*
* 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.reposilite.frontend.infrastructure
import com.reposilite.frontend.FrontendFacade
import com.reposilite.storage.api.toLocation
import com.reposilite.storage.getExtension
import com.reposilite.storage.getSimpleName
import com.reposilite.storage.inputStream
import com.reposilite.web.api.ReposiliteRoute
import com.reposilite.web.api.ReposiliteRoutes
import com.reposilite.web.http.ErrorResponse
import com.reposilite.web.http.encoding
import com.reposilite.web.http.notFoundError
import com.reposilite.web.routing.RouteMethod.GET
import io.javalin.http.ContentType
import io.javalin.http.ContentType.Companion.PLAIN
import io.javalin.http.Context
import panda.std.Result
import panda.std.Result.ok
import java.nio.file.Files
import java.nio.file.Path
import kotlin.io.path.isDirectory
import kotlin.streams.asSequence
import kotlin.text.Charsets.UTF_8
internal sealed class FrontendHandler(private val frontendFacade: FrontendFacade) : ReposiliteRoutes() {
protected fun respondWithFile(ctx: Context, uri: String, source: () -> String?): Result<String, ErrorResponse> =
frontendFacade.resolve(uri, source)
?.let {
ctx.encoding(UTF_8)
ctx.contentType(ContentType.getMimeTypeByExtension(uri.getExtension()) ?: PLAIN)
ok(it)
}
?: notFoundError("Resource not found");
}
internal class ResourcesFrontendHandler(frontendFacade: FrontendFacade, val resourcesDirectory: String) : FrontendHandler(frontendFacade) {
private val defaultHandler = ReposiliteRoute<String>("/", GET) {
response = respondWithResource(ctx, "index.html")
}
private val indexHandler = ReposiliteRoute<String>("/index.html", GET) {
response = respondWithResource(ctx, "index.html")
}
private val assetsHandler = ReposiliteRoute<String>("/assets/<path>", GET) {
response = respondWithResource(ctx, "assets/${ctx.pathParam("path")}")
}
private fun respondWithResource(ctx: Context, uri: String): Result<String, ErrorResponse> =
respondWithFile(ctx, uri) {
FrontendFacade::class.java.getResourceAsStream("/$resourcesDirectory/$uri")
?.use { it.readBytes().decodeToString() }
?: ""
}
override val routes = routes(defaultHandler, indexHandler, assetsHandler)
}
internal class CustomFrontendHandler(frontendFacade: FrontendFacade, directory: Path) : FrontendHandler(frontendFacade) {
override val routes =
Files.list(directory)
.asSequence()
.map {
if (it.isDirectory())
ReposiliteRoute<String>("/${it.fileName}/<path>", GET) {
response = respondWithFile(ctx, it.getSimpleName()) {
parameter("path")
.toLocation()
.toPath()
.map { path -> it.resolve(path) }
.orNull()
?.decodeToString()
}
}
else
ReposiliteRoute("/${it.getSimpleName()}", GET) {
response = respondWithFile(ctx, it.getSimpleName()) {
it.decodeToString()
}
}
}
.toMutableSet()
.also {
it.add(ReposiliteRoute("/", GET) {
response = respondWithFile(ctx, "index.html") { directory.resolve("index.html").decodeToString() }
})
}
.let { routes(*it.toTypedArray()) }
}
private fun Path.decodeToString(): String? =
inputStream()
.map { it.use { input -> input.readBytes().decodeToString() } }
.orNull() | 27 | null | 85 | 541 | 2d116b595c64c6b5a71b694ba6d044c40ef16b6a | 4,442 | reposilite | Apache License 2.0 |
app/src/main/java/com/shicheeng/copymanga/dao/MangeLocalHistoryDao.kt | shizheng233 | 475,870,275 | false | null | package com.shicheeng.copymanga.dao
import androidx.room.*
import com.shicheeng.copymanga.data.MangaHistoryDataModel
import kotlinx.coroutines.flow.Flow
@Dao
interface MangeLocalHistoryDao {
@Query("SELECT * FROM manga_history_key ORDER by time DESC")
fun getAllHistory(): Flow<List<MangaHistoryDataModel>>
@Query("SELECT * FROM manga_history_key WHERE pathWord LIKE :pathWord LIMIT 1")
suspend fun getHistoryForInfoByPathWord(pathWord:String): MangaHistoryDataModel?
@Insert(onConflict = OnConflictStrategy.IGNORE)
suspend fun addLocal(manga: MangaHistoryDataModel)
@Update
suspend fun updateLocal(manga: MangaHistoryDataModel)
@Query("DELETE FROM manga_history_key")
suspend fun deleteAllHistory()
} | 5 | Kotlin | 0 | 58 | 0ac29592bde2b108b4da2f189db9f7b81f542b4b | 749 | CopyMangaJava | MIT License |
integration/camunda-bpm/taskpool-job-sender/src/main/kotlin/io/holunda/polyflow/taskpool/sender/CamundaJobSenderConfiguration.kt | holunda-io | 135,994,693 | false | {"Kotlin": 1271745} | package io.holunda.polyflow.taskpool.sender
import com.fasterxml.jackson.annotation.JsonTypeInfo
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.databind.jsontype.impl.LaissezFaireSubTypeValidator
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import io.holunda.polyflow.bus.jackson.annotation.ConditionalOnMissingQualifiedBean
import io.holunda.polyflow.bus.jackson.configurePolyflowJacksonObjectMapper
import io.holunda.polyflow.taskpool.sender.gateway.CommandListGateway
import io.holunda.polyflow.taskpool.sender.task.EngineTaskCommandSender
import io.holunda.polyflow.taskpool.sender.task.accumulator.EngineTaskCommandAccumulator
import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl
import org.camunda.bpm.engine.spring.SpringProcessEnginePlugin
import org.springframework.beans.factory.annotation.Qualifier
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
import org.springframework.context.annotation.Bean
/**
* Spring configuration building task sender, using Camunda job to decouple from originated transaction..
*/
class CamundaJobSenderConfiguration(
private val senderProperties: SenderProperties
) {
companion object {
const val COMMAND_BYTEARRAY_OBJECT_MAPPER = "commandByteArrayObjectMapper"
}
/**
* Creates transactional command sender for tasks.
*/
@Bean
@ConditionalOnProperty(value = ["polyflow.integration.sender.task.type"], havingValue = "txjob")
fun camundaJobTaskCommandSender(
processEngineConfiguration: ProcessEngineConfigurationImpl,
@Qualifier(COMMAND_BYTEARRAY_OBJECT_MAPPER)
objectMapper: ObjectMapper,
engineTaskCommandAccumulator: EngineTaskCommandAccumulator
): EngineTaskCommandSender =
TxAwareAccumulatingCamundaJobEngineTaskCommandSender(
processEngineConfiguration = processEngineConfiguration,
objectMapper = objectMapper,
senderProperties = senderProperties,
engineTaskCommandAccumulator = engineTaskCommandAccumulator
)
/**
* Build the engine plugin to install the job handler.
*/
@Bean
@ConditionalOnProperty(value = ["polyflow.integration.sender.task.type"], havingValue = "txjob")
fun camundaEngineTaskCommandSendingJobHandlerEnginePlugin(
@Qualifier(COMMAND_BYTEARRAY_OBJECT_MAPPER)
objectMapper: ObjectMapper,
commandListGateway: CommandListGateway
) = object : SpringProcessEnginePlugin() {
override fun preInit(processEngineConfiguration: ProcessEngineConfigurationImpl) {
processEngineConfiguration.customJobHandlers =
(processEngineConfiguration.customJobHandlers ?: mutableListOf()) + EngineTaskCommandsSendingJobHandler(
objectMapper = objectMapper,
commandListGateway = commandListGateway
)
}
}
/**
* Object mapper for serializing and deserializing commands to camunda bytearray and back.
*/
@Bean
@Qualifier(COMMAND_BYTEARRAY_OBJECT_MAPPER)
@ConditionalOnMissingQualifiedBean(beanClass = ObjectMapper::class, qualifier = COMMAND_BYTEARRAY_OBJECT_MAPPER)
fun fallbackCommandByteArrayObjectMapper(): ObjectMapper =
jacksonObjectMapper()
.configurePolyflowJacksonObjectMapper()
.apply {
activateDefaultTyping(LaissezFaireSubTypeValidator(), ObjectMapper.DefaultTyping.EVERYTHING, JsonTypeInfo.As.WRAPPER_ARRAY)
}
}
| 29 | Kotlin | 26 | 68 | 0a80b87e49127b355d62f8a32e91a6c355d11419 | 3,448 | camunda-bpm-taskpool | Apache License 2.0 |
firebase/src/main/java/si/inova/kotlinova/testing/firebase/MockFirestore.kt | ksenchy | 248,297,669 | false | null | /*
* Copyright 2020 INOVA IT d.o.o.
*
* 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 si.inova.kotlinova.testing.firebase
import com.google.android.gms.tasks.Tasks
import com.google.firebase.firestore.CollectionReference
import com.google.firebase.firestore.DocumentReference
import com.google.firebase.firestore.FirebaseFirestore
import com.google.firebase.firestore.Transaction
import com.nhaarman.mockitokotlin2.any
import com.nhaarman.mockitokotlin2.mock
import com.nhaarman.mockitokotlin2.whenever
/**
* @author Matej Drobnic
*/
class MockFirestore {
private val collections = HashMap<String, CollectionReference>()
fun <T> createCollection(name: String): MockCollection<T> {
val collection = MockCollection<T>()
insert(name, collection.toColRef())
return collection
}
fun insert(name: String, collection: CollectionReference) {
collections[name] = collection
}
fun toFirestore(): FirebaseFirestore {
return mock {
whenever(it.collection(any())).then {
val name = it.arguments[0] as String
collections[name] ?: MockCollection<Any>().toColRef()
}
whenever(it.runTransaction<Any>(any())).thenAnswer {
val transFunc = it.arguments[0] as Transaction.Function<*>
val result = transFunc.apply(transaction)
Tasks.forResult(result)
}
}
}
private val transaction: Transaction by lazy {
mock<Transaction> {
whenever(it.get(any())).then {
val ref = it.arguments[0] as DocumentReference
ref.get().result
}
whenever(it.delete(any())).then {
val ref = it.arguments[0] as DocumentReference
ref.delete()
it.mock
}
whenever(it.set(any(), any<Map<String, Any>>())).then {
val ref = it.arguments[0] as DocumentReference
@Suppress("UNCHECKED_CAST")
ref.set(it.arguments[1] as Map<String, Any>)
it.mock
}
whenever(it.set(any(), any<Any>())).then {
val ref = it.arguments[0] as DocumentReference
ref.set(it.arguments[1] as Any)
it.mock
}
whenever(it.update(any(), any<Map<String, Any>>())).then {
val ref = it.arguments[0] as DocumentReference
@Suppress("UNCHECKED_CAST")
ref.update(it.arguments[1] as Map<String, Any>)
it.mock
}
}
}
} | 1 | Kotlin | 1 | 1 | d385e2198a647432283265ce25a50b1268b0a19a | 3,643 | kotlinova | MIT License |
buffer/src/commonMain/kotlin/mqtt/buffer/BufferDeserializer.kt | thebehera | 171,056,445 | false | null | @file:Suppress("EXPERIMENTAL_API_USAGE", "EXPERIMENTAL_UNSIGNED_LITERALS")
package mqtt.buffer
interface BufferDeserializer<T : Any> {
fun deserialize(params: DeserializationParameters): GenericType<T>?
}
data class DeserializationParameters(
val buffer: ReadBuffer,
val length: UInt = 0u,
val path: CharSequence = "",
val properties: Map<Int, Any> = emptyMap(),
val headers: Map<CharSequence, Set<CharSequence>> = emptyMap()
)
fun HashMap<CharSequence, HashSet<CharSequence>>.add(k: CharSequence, v: CharSequence) {
val set = get(k) ?: HashSet()
set += v
put(k, set)
} | 2 | Kotlin | 1 | 32 | 2f2d176ca1d042f928fba3a9c49f4bc5ff39495f | 609 | mqtt | Apache License 2.0 |
wci-core/src/main/kotlin/com/luggsoft/wci/core/system/Version.kt | dan-lugg | 724,463,915 | false | {"Kotlin": 85996, "TypeScript": 64763, "Java": 6199, "JavaScript": 1433, "SCSS": 444, "HTML": 364, "Markdown": 361, "Gherkin": 344} | package com.luggsoft.wci.core.system
import com.luggsoft.wci.core.Transmittable
import com.luggsoft.wci.core.util.EMPTY_STRING
import org.intellij.lang.annotations.Language
import java.util.regex.Pattern
/**
* Represents a semantic version, following the pattern:
*
* ```
* [ MAJOR [ "." MINOR [ "." PATCH ] ] ] [ "-" BUILD ]
* ```
*
* Such as:
*
* - 1.2.3-912ec803b2ce49e4a541068d495ab570
* - 1.2.3
* - 1.2
*
* @see Transmittable
*/
data class Version(
val major: Int,
val minor: Int,
val patch: Int,
val build: String? = null,
) : Comparable<Version>, Transmittable
{
override fun compareTo(other: Version): Int
{
if (this.major == other.major)
{
if (this.minor == other.minor)
{
if (this.patch == other.patch)
{
if (this.build == other.build)
{
return 0
}
return this.build?.compareTo(other.build ?: EMPTY_STRING) ?: 0
}
return this.patch.compareTo(other.patch)
}
return this.minor.compareTo(other.minor)
}
return this.major.compareTo(other.major)
}
override fun toString(): String
{
return when (this.build)
{
null -> "${this.major}.${this.minor}.${this.patch}"
else -> "${this.major}.${this.minor}.${this.patch}-${this.build}"
}
}
companion object
{
private const val MAJOR = "MAJOR"
private const val MINOR = "MINOR"
private const val PATCH = "PATCH"
private const val BUILD = "BUILD"
@Language("RegExp")
private const val VERSION_EXPRESSION = "^(?<$MAJOR>[0-9]|[1-9][0-9]+)(?:\\.(?<$MINOR>[0-9]|[1-9][0-9]+)(?:\\.(?<$PATCH>[0-9]|[1-9][0-9]+))?)?(?:-(?<$BUILD>[a-zA-Z0-9-]+))?\$"
private val versionPattern by lazy { Pattern.compile(VERSION_EXPRESSION) }
fun parse(input: String): Version
{
val matcher = versionPattern.matcher(input)
if (matcher.matches())
{
return Version(
major = matcher.group(MAJOR)?.toInt() ?: 0,
minor = matcher.group(MINOR)?.toInt() ?: 0,
patch = matcher.group(PATCH)?.toInt() ?: 0,
build = matcher.group(BUILD),
)
}
throw IllegalArgumentException("Failed to parse $input")
}
}
}
| 1 | Kotlin | 0 | 1 | 76c3cd23a0cebe41a667c45e5c3952a8d3098fae | 2,668 | luggsoft-wci | MIT License |
examples/url/list/listYourShortenedUrls/main.kt | GWT-M3O-TEST | 485,009,715 | false | null |
package examples.url.list
import com.m3o.m3okotlin.M3O
import com.m3o.m3okotlin.services.url
suspend fun main() {
M3O.initialize(System.getenv("M3O_API_TOKEN"))
val req = UrlListRequest()
try {
val response = UrlServ.list(req)
println(response)
} catch (e: Exception) {
println(e)
}
}
| 1 | Kotlin | 1 | 0 | 54158b584ba47bd7323a484804dcd78c55ef7f69 | 320 | m3o-kotlin | Apache License 2.0 |
app/src/main/java/gt/com/pixela/jetfm/ui/composables/animations/JetCircle.kt | pblinux | 293,392,813 | false | null | package gt.com.pixela.jetfm.ui.composables.animations
import androidx.compose.animation.core.*
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.size
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.alpha
import androidx.compose.ui.draw.rotate
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.drawscope.Stroke
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
@Preview
@Composable
fun PreviewJetCircles() {
JetCircles(modifier = Modifier.alpha(0.5f), size = 200)
}
@Composable
fun JetCircles(size: Int, modifier: Modifier) {
val infiniteTransition = rememberInfiniteTransition()
val firstRotation by infiniteTransition.animateFloat(
initialValue = 0f,
targetValue = 365f,
animationSpec = infiniteRepeatable(
animation = keyframes {
durationMillis = 5000
},
repeatMode = RepeatMode.Restart
)
)
val secondRotation by infiniteTransition.animateFloat(
initialValue = 365f,
targetValue = 0f,
animationSpec = infiniteRepeatable(
animation = keyframes {
durationMillis = 10000
},
repeatMode = RepeatMode.Reverse
)
)
val thirdRotation by infiniteTransition.animateFloat(
initialValue = 365f,
targetValue = 0f,
animationSpec = infiniteRepeatable(
animation = keyframes {
durationMillis = 7000
},
repeatMode = RepeatMode.Restart
)
)
Box(modifier) {
JetCircle(
modifier = Modifier
.size(size.dp)
.align(Alignment.Center)
.rotate(firstRotation)
)
JetCircle(
modifier = Modifier
.size((size * 0.95).dp)
.align(Alignment.Center)
.rotate(secondRotation)
)
JetCircle(
modifier = Modifier
.size((size * 0.9).dp)
.align(Alignment.Center)
.rotate(thirdRotation)
)
}
}
@Composable
fun JetCircle(modifier: Modifier = Modifier) {
Canvas(
modifier = modifier,
onDraw = {
drawCircle(
brush = Brush.linearGradient(listOf(Color.Blue, Color.Magenta, Color.Red)),
style = Stroke(),
)
},
)
} | 0 | Kotlin | 0 | 0 | 94ac464f2026f0a4993e36fc2d0770c779d7b81f | 2,403 | jetfm | MIT License |
app/src/main/java/vn/com/detai/todolist/alarm/AlarmSetter.kt | stephenct | 647,062,341 | false | null | package vn.com.detai.todolist.alarm
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import java.util.ArrayList
import vn.com.detai.todolist.database.DBHelper
import vn.com.detai.todolist.model.ModelTask
/**
* Class for restoring all notifications after device reboot.
*/
class AlarmSetter : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
val helper = DBHelper.getInstance(context)
AlarmHelper.getInstance().init(context)
val alarmHelper = AlarmHelper.getInstance()
val tasks = ArrayList<ModelTask>()
tasks.addAll(helper.getAllTasks())
for (task in tasks) {
if (task.date != 0L) {
alarmHelper.setAlarm(task)
}
}
}
}
| 0 | Kotlin | 1 | 0 | 5d4e4b81fff05f856f803fb7b15b1ffa4585630b | 816 | TodoList | MIT License |
app/src/main/java/vn/com/detai/todolist/alarm/AlarmSetter.kt | stephenct | 647,062,341 | false | null | package vn.com.detai.todolist.alarm
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import java.util.ArrayList
import vn.com.detai.todolist.database.DBHelper
import vn.com.detai.todolist.model.ModelTask
/**
* Class for restoring all notifications after device reboot.
*/
class AlarmSetter : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
val helper = DBHelper.getInstance(context)
AlarmHelper.getInstance().init(context)
val alarmHelper = AlarmHelper.getInstance()
val tasks = ArrayList<ModelTask>()
tasks.addAll(helper.getAllTasks())
for (task in tasks) {
if (task.date != 0L) {
alarmHelper.setAlarm(task)
}
}
}
}
| 0 | Kotlin | 1 | 0 | 5d4e4b81fff05f856f803fb7b15b1ffa4585630b | 816 | TodoList | MIT License |
app/src/test/java/com/holiday/domain/repository/FakeHolidayRepository.kt | kelvinkioko | 595,959,798 | false | null | package com.holiday.domain.repository
import com.holiday.domain.model.HolidaysModel
import com.holiday.util.Response
import com.holiday.util.countryWideHolidaysModel
import com.holiday.util.worldWideHolidaysModel
class FakeHolidaysRepository : HolidaysRepository {
override suspend fun fetchAllPublicHolidays(
year: Int,
countryCode: String
): Response<List<HolidaysModel>> {
return Response.Success(responseData = countryWideHolidaysModel)
}
override suspend fun fetchNextPublicHolidaysWorldWide(): Response<List<HolidaysModel>> {
return Response.Success(responseData = worldWideHolidaysModel)
}
}
| 0 | Kotlin | 0 | 0 | 183d6e084e1803f8ea818697885fa0c51027aa2d | 654 | Public-Holiday | Apache License 2.0 |
app/src/test/java/com/example/airlines/presentation/airlines/list/AirlineListViewModelTest.kt | gabrielmoreira-dev | 506,308,112 | false | null | package com.example.airlines.presentation.airlines.list
import androidx.arch.core.executor.testing.InstantTaskExecutorRule
import com.appmattus.kotlinfixture.kotlinFixture
import com.example.airlines.MainCoroutineRule
import com.example.airlines.presentation.airlines.list.models.AirlinePM
import com.example.airlines.presentation.common.AppDispatchers
import com.example.airlines.presentation.common.State
import com.example.domain.model.Airline
import com.example.domain.use_case.GetAirlineListUC
import com.google.common.truth.Truth.assertThat
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.UnconfinedTestDispatcher
import kotlinx.coroutines.test.runTest
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.mockito.kotlin.mock
import org.mockito.kotlin.whenever
class AirlineListViewModelStateSpy {
sealed class Message {
data class SuccessStateReceived(val airlineLst: List<AirlinePM>): Message()
object LoadingStateReceived: Message()
object ErrorStateReceived: Message()
}
val messageList = arrayListOf<Message>()
fun addState(state: State<List<AirlinePM>>) {
when (state) {
is State.Success -> messageList.add(Message.SuccessStateReceived(state.model))
is State.Loading -> messageList.add(Message.LoadingStateReceived)
is State.Error -> messageList.add(Message.ErrorStateReceived)
}
}
}
@ExperimentalCoroutinesApi
class AirlineListViewModelTest {
private lateinit var sut: AirlineListViewModel
private val getAirlineListUC = mock<GetAirlineListUC>()
private val viewModelStateSpy = AirlineListViewModelStateSpy()
private val fixture = kotlinFixture()
private val airlineList = fixture<List<Airline>>()
@get:Rule
val instantTaskExecutorRule = InstantTaskExecutorRule()
@get:Rule
val mainCoroutineRule = MainCoroutineRule()
@Before
fun setup() {
val dispatcher = AppDispatchers(IO = UnconfinedTestDispatcher())
sut = AirlineListViewModel(getAirlineListUC, dispatcher)
sut.state.observeForever {
viewModelStateSpy.addState(it)
}
}
@Test
fun `when use case returns airline list should set success state`() = runTest {
whenever(getAirlineListUC.invoke(Unit)).thenReturn(airlineList)
sut.getAirlineList()
val airlinePMList = airlineList.map { it.toPM() }
assertThat(viewModelStateSpy.messageList).isEqualTo(arrayListOf(
AirlineListViewModelStateSpy.Message.LoadingStateReceived,
AirlineListViewModelStateSpy.Message.SuccessStateReceived(airlinePMList)
))
}
@Test
fun `when use case returns empty list should set success state`() = runTest {
whenever(getAirlineListUC.invoke(Unit)).thenReturn(arrayListOf())
sut.getAirlineList()
assertThat(viewModelStateSpy.messageList).isEqualTo(arrayListOf(
AirlineListViewModelStateSpy.Message.LoadingStateReceived,
AirlineListViewModelStateSpy.Message.SuccessStateReceived(arrayListOf<AirlinePM>())
))
}
@Test
fun `when use case throws an exception should set error state`() = runTest {
whenever(getAirlineListUC.invoke(Unit)).thenThrow(RuntimeException())
sut.getAirlineList()
assertThat(viewModelStateSpy.messageList).isEqualTo(arrayListOf(
AirlineListViewModelStateSpy.Message.LoadingStateReceived,
AirlineListViewModelStateSpy.Message.ErrorStateReceived
))
}
} | 0 | Kotlin | 0 | 1 | 569e4669becae2676e38b3466b658fb50a6674e1 | 3,583 | airlines-android | MIT License |
door-runtime/src/commonMain/kotlin/com/ustadmobile/door/DoorDatabaseJdbc.kt | UstadMobile | 344,538,858 | false | null | package com.ustadmobile.door
import com.ustadmobile.door.room.InvalidationTracker
import com.ustadmobile.door.room.RoomDatabase
import com.ustadmobile.door.attachments.AttachmentFilter
import com.ustadmobile.door.jdbc.Connection
import com.ustadmobile.door.jdbc.DataSource
import com.ustadmobile.door.replication.ReplicationNotificationDispatcher
import com.ustadmobile.door.util.NodeIdAuthCache
import com.ustadmobile.door.util.TransactionDepthCounter
import com.ustadmobile.door.util.DoorInvalidationTracker
/**
* This interface is implemented by all generated JDBC implementations of a database.
*/
interface DoorDatabaseJdbc {
/**
* The JNDI DataSource which will be used to open connections.
*/
val dataSource: DataSource
/**
* When this instance is a repository or ReplicationWrapper, the sourceDatabase must be the database that they
* connect to.
* When this instance is an actual implementation (e.g. JdbcKt) transaction wrapper, sourceDatabase will point
* to the underlying (original) database instance.
* When this instance is the actual original database instance, this will be null.
*/
val doorJdbcSourceDatabase: RoomDatabase?
/**
* If this database is the root database, e.g. doorJdbcSourceDatabase == null, then it will hold a primary key
* manager
*/
val realPrimaryKeyManager: DoorPrimaryKeyManager
/**
* The name as it was provided to the builder function
*/
val dbName: String
/**
* The real replication notification dispatcher (which is generally accessed
* using multiplatform extension properties)
*/
val realReplicationNotificationDispatcher: ReplicationNotificationDispatcher
val realNodeIdAuthCache: NodeIdAuthCache
val realIncomingReplicationListenerHelper: IncomingReplicationListenerHelper
val realAttachmentStorageUri: DoorUri?
val realAttachmentFilters: List<AttachmentFilter>
/**
* The query timeout to use: in seconds
*/
val jdbcQueryTimeout: Int
} | 0 | Kotlin | 0 | 89 | 58f93d9057ece78cc3f8be3d4d235c0204a15f11 | 2,051 | door | Apache License 2.0 |
compiler/tests/org/jetbrains/kotlin/jvm/compiler/fir/FirPsiJvmIrLinkageModeTest.kt | JetBrains | 3,432,266 | false | {"Kotlin": 78963920, "Java": 6943075, "Swift": 4063829, "C": 2609498, "C++": 1947933, "Objective-C++": 170573, "JavaScript": 106044, "Python": 59695, "Shell": 32949, "Objective-C": 22132, "Lex": 21352, "Batchfile": 11382, "CSS": 11368, "Ruby": 10470, "Dockerfile": 9907, "Groovy": 7092, "EJS": 5241, "CMake": 4473, "HTML": 2699, "Pascal": 1698, "FreeMarker": 1393, "Roff": 725, "Scala": 80} | /*
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.jvm.compiler.fir
import org.jetbrains.kotlin.jvm.compiler.ir.IrJvmIrLinkageModeTest
import org.jetbrains.kotlin.test.FirParser
@Suppress("JUnitTestCaseWithNoTests")
class FirPsiJvmIrLinkageModeTest : IrJvmIrLinkageModeTest() {
override val useFir: Boolean
get() = true
override val firParser: FirParser
get() = FirParser.Psi
}
| 184 | Kotlin | 5691 | 48,625 | bb25d2f8aa74406ff0af254b2388fd601525386a | 593 | kotlin | Apache License 2.0 |
sample/src/main/java/ru/volkdown/sample/features/samplefeature/presentation/SampleFeatureFragment.kt | volkdown | 237,741,034 | false | null | package ru.volkdown.sample.features.samplefeature.presentation
import android.content.Context
import android.os.Bundle
import android.view.View
import android.widget.Toast
import com.arellomobile.mvp.presenter.InjectPresenter
import com.arellomobile.mvp.presenter.ProvidePresenter
import kotlinx.android.synthetic.main.fragment_sample_feature.*
import ru.volkdown.coreoctopus.utils.getFeatureIdentifier
import ru.volkdown.sample.App
import ru.volkdown.sample.R
import ru.volkdown.sample.base.BaseFragment
import ru.volkdown.sample.features.samplefeature.di.SampleFeatureComponent
class SampleFeatureFragment : BaseFragment<SampleFeaturePresenter>(), SampleFeatureView {
private lateinit var component: SampleFeatureComponent
override val layoutResId: Int = R.layout.fragment_sample_feature
@InjectPresenter
override lateinit var presenter: SampleFeaturePresenter
@ProvidePresenter
override fun providePresenter(): SampleFeaturePresenter {
return component.getPresenter()
}
override fun showSingleOwnerMessage(messageRes: Int) {
Toast.makeText(requireContext(), messageRes, Toast.LENGTH_LONG).show()
}
override fun onAttach(context: Context) {
super.onAttach(context)
val applicationProvider = (requireActivity().application as App).getApplicationProvider()
component = SampleFeatureComponent.build(applicationProvider, getFeatureIdentifier())
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
btnSendInnerEvent.setOnClickListener { presenter.onSendInnerEventClicked() }
}
override fun showMultiOwnerMessage(messageResId: Int, featureId: String) {
Toast.makeText(requireContext(), getString(messageResId, featureId), Toast.LENGTH_LONG).show()
}
companion object {
fun newInstance() = SampleFeatureFragment()
}
} | 0 | Kotlin | 0 | 6 | 090509a0fba784a6a109c7944a012515a20c0d75 | 1,930 | octopus | MIT License |
core/src/commonMain/kotlin/com/aitorgf/threekt/core/RenderTarget.kt | tokkenno | 276,641,018 | false | null | package com.aitorgf.threekt.core
@ExperimentalJsExport
@JsExport
external interface RenderTarget {
}
| 0 | Kotlin | 0 | 0 | ae7731892ca6784f382c858bf623d68f73819fe9 | 102 | threekt | MIT License |
eth-blockprocessor/src/main/kotlin/org/apache/tuweni/blockprocessor/ProtoBlock.kt | apache | 178,461,625 | false | null | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 org.apache.tuweni.blockprocessor
import org.apache.tuweni.bytes.Bytes
import org.apache.tuweni.eth.Address
import org.apache.tuweni.eth.Block
import org.apache.tuweni.eth.BlockBody
import org.apache.tuweni.eth.BlockHeader
import org.apache.tuweni.eth.Hash
import org.apache.tuweni.eth.Transaction
import org.apache.tuweni.eth.TransactionReceipt
import org.apache.tuweni.eth.repository.TransientStateRepository
import org.apache.tuweni.rlp.RLP
import org.apache.tuweni.units.bigints.UInt256
import org.apache.tuweni.units.bigints.UInt64
import org.apache.tuweni.units.ethereum.Gas
import java.time.Instant
/**
* A block header that has not finished being sealed.
*/
data class SealableHeader(
val parentHash: Hash,
val stateRoot: Hash,
val transactionsRoot: Hash,
val receiptsRoot: Hash,
val logsBloom: Bytes,
val number: UInt256,
val gasLimit: Gas,
val gasUsed: Gas
) {
/**
* Seals the header into a block header
*/
fun toHeader(
ommersHash: Hash,
coinbase: Address,
difficulty: UInt256,
timestamp: Instant,
extraData: Bytes,
mixHash: Hash,
nonce: UInt64
): BlockHeader {
return BlockHeader(
parentHash,
ommersHash,
coinbase,
stateRoot,
transactionsRoot,
receiptsRoot,
logsBloom,
difficulty,
number,
gasLimit,
gasUsed,
timestamp,
extraData,
mixHash,
nonce
)
}
}
/**
* A proto-block body is the representation of the intermediate form of a block body before being sealed.
*/
data class ProtoBlockBody(val transactions: List<Transaction>) {
/**
* Transforms the proto-block body into a valid block body by adding ommers.
*/
fun toBlockBody(ommers: List<BlockHeader>): BlockBody {
return BlockBody(transactions, ommers)
}
}
/**
* A proto-block is a block that has been executed but has not been sealed.
* The header is missing the nonce and mixhash, and can still accept extra data.
*
* Proto-blocks are produced when transactions are executed, and can be turned into full valid blocks.
*/
class ProtoBlock(
val header: SealableHeader,
val body: ProtoBlockBody,
val transactionReceipts: List<TransactionReceipt>,
val stateChanges: TransientStateRepository
) {
fun toBlock(
ommers: List<BlockHeader>,
coinbase: Address,
difficulty: UInt256,
timestamp: Instant,
extraData: Bytes,
mixHash: Hash,
nonce: UInt64
): Block {
val ommersHash = Hash.hash(RLP.encodeList { writer -> ommers.forEach { writer.writeValue(it.hash) } })
return Block(
header.toHeader(ommersHash, coinbase, difficulty, timestamp, extraData, mixHash, nonce),
body.toBlockBody(ommers)
)
}
}
| 6 | null | 78 | 171 | 0852e0b01ad126b47edae51b26e808cb73e294b1 | 3,516 | incubator-tuweni | Apache License 2.0 |
dsl/src/main/kotlin/io/cloudshiftdev/awscdkdsl/services/sagemaker/CfnModelExplainabilityJobDefinitionDatasetFormatPropertyDsl.kt | cloudshiftinc | 667,063,030 | false | null | @file:Suppress("RedundantVisibilityModifier","RedundantUnitReturnType","RemoveRedundantQualifierName","unused","UnusedImport","ClassName","REDUNDANT_PROJECTION","DEPRECATION")
package cloudshift.awscdk.dsl.services.sagemaker
import cloudshift.awscdk.common.CdkDslMarker
import kotlin.Boolean
import software.amazon.awscdk.IResolvable
import software.amazon.awscdk.services.sagemaker.CfnModelExplainabilityJobDefinition
/**
* The dataset format of the data to monitor.
*
* 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.sagemaker.*;
* DatasetFormatProperty datasetFormatProperty = DatasetFormatProperty.builder()
* .csv(CsvProperty.builder()
* .header(false)
* .build())
* .json(JsonProperty.builder()
* .line(false)
* .build())
* .parquet(false)
* .build();
* ```
*
* [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sagemaker-modelexplainabilityjobdefinition-datasetformat.html)
*/
@CdkDslMarker
public class CfnModelExplainabilityJobDefinitionDatasetFormatPropertyDsl {
private val cdkBuilder: CfnModelExplainabilityJobDefinition.DatasetFormatProperty.Builder =
CfnModelExplainabilityJobDefinition.DatasetFormatProperty.builder()
/**
* @param csv The CSV format.
*/
public fun csv(csv: IResolvable) {
cdkBuilder.csv(csv)
}
/**
* @param csv The CSV format.
*/
public fun csv(csv: CfnModelExplainabilityJobDefinition.CsvProperty) {
cdkBuilder.csv(csv)
}
/**
* @param json The Json format.
*/
public fun json(json: IResolvable) {
cdkBuilder.json(json)
}
/**
* @param json The Json format.
*/
public fun json(json: CfnModelExplainabilityJobDefinition.JsonProperty) {
cdkBuilder.json(json)
}
/**
* @param parquet A flag indicating if the dataset format is Parquet.
*/
public fun parquet(parquet: Boolean) {
cdkBuilder.parquet(parquet)
}
/**
* @param parquet A flag indicating if the dataset format is Parquet.
*/
public fun parquet(parquet: IResolvable) {
cdkBuilder.parquet(parquet)
}
public fun build(): CfnModelExplainabilityJobDefinition.DatasetFormatProperty = cdkBuilder.build()
}
| 4 | null | 0 | 3 | c59c6292cf08f0fc3280d61e7f8cff813a608a62 | 2,298 | awscdk-dsl-kotlin | Apache License 2.0 |
straight/src/commonMain/kotlin/me/localx/icons/straight/bold/BracketCurlyRight.kt | localhostov | 808,861,591 | false | {"Kotlin": 79430321, "HTML": 331, "CSS": 102} | package me.localx.icons.straight.bold
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.graphics.StrokeCap.Companion.Butt
import androidx.compose.ui.graphics.StrokeJoin.Companion.Miter
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp
import me.localx.icons.straight.Icons
public val Icons.Bold.BracketCurlyRight: ImageVector
get() {
if (_bracketCurlyRight != null) {
return _bracketCurlyRight!!
}
_bracketCurlyRight = Builder(name = "BracketCurlyRight", defaultWidth = 512.0.dp,
defaultHeight = 512.0.dp, viewportWidth = 24.0f, viewportHeight = 24.0f).apply {
path(fill = SolidColor(Color(0xFF000000)), stroke = null, strokeLineWidth = 0.0f,
strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = 4.0f,
pathFillType = NonZero) {
moveTo(11.5f, 24.0f)
horizontalLineToRelative(-3.5f)
verticalLineToRelative(-3.0f)
horizontalLineToRelative(3.5f)
curveToRelative(0.28f, 0.0f, 0.5f, -0.22f, 0.5f, -0.5f)
verticalLineToRelative(-6.12f)
lineToRelative(2.38f, -2.38f)
lineToRelative(-2.38f, -2.38f)
verticalLineTo(3.5f)
curveToRelative(0.0f, -0.28f, -0.22f, -0.5f, -0.5f, -0.5f)
horizontalLineToRelative(-3.5f)
verticalLineTo(0.0f)
horizontalLineToRelative(3.5f)
curveToRelative(1.93f, 0.0f, 3.5f, 1.57f, 3.5f, 3.5f)
verticalLineToRelative(4.88f)
lineToRelative(3.62f, 3.62f)
lineToRelative(-3.62f, 3.62f)
verticalLineToRelative(4.88f)
curveToRelative(0.0f, 1.93f, -1.57f, 3.5f, -3.5f, 3.5f)
close()
}
}
.build()
return _bracketCurlyRight!!
}
private var _bracketCurlyRight: ImageVector? = null
| 1 | Kotlin | 0 | 5 | cbd8b510fca0e5e40e95498834f23ec73cc8f245 | 2,252 | icons | MIT License |
app/src/main/java/com/udacity/asteroidradar/adapters/BindingAdapters.kt | MostafaMohamed2002 | 528,334,729 | false | {"Kotlin": 23356} | package com.udacity.asteroidradar
import android.view.View
import android.widget.ImageView
import android.widget.TextView
import androidx.databinding.BindingAdapter
import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide
import com.bumptech.glide.request.RequestOptions
import com.udacity.asteroidradar.main.AsteroidAdapter
@BindingAdapter("goneIfNotNull")
fun goneIfNotNull(view: View, it: Any?) {
view.visibility = if (it != null) View.GONE else View.VISIBLE
}
@BindingAdapter("listData")
fun bindRecyclerView(recyclerView: RecyclerView, data: List<Asteroid>?) {
if (!data.isNullOrEmpty()){
val adapter = recyclerView.adapter as AsteroidAdapter
adapter.submitList(data)
}
}
@BindingAdapter("statusIcon")
fun bindAsteroidStatusImage(imageView: ImageView, isHazardous: Boolean) {
if (isHazardous) {
imageView.setImageResource(R.drawable.ic_status_potentially_hazardous)
} else {
imageView.setImageResource(R.drawable.ic_status_normal)
}
}
@BindingAdapter("asteroidStatusImage")
fun bindDetailsStatusImage(imageView: ImageView, isHazardous: Boolean) {
if (isHazardous) {
imageView.contentDescription = imageView.context.getString(
R.string.potentially_hazardous_asteroid_image
)
imageView.setImageResource(R.drawable.asteroid_hazardous)
} else {
imageView.contentDescription = imageView.context.getString(
R.string.not_hazardous_asteroid_image
)
imageView.setImageResource(R.drawable.asteroid_safe)
}
}
@BindingAdapter("astronomicalUnitText")
fun bindTextViewToAstronomicalUnit(textView: TextView, number: Double) {
val context = textView.context
textView.text = String.format(context.getString(R.string.astronomical_unit_format), number)
}
@BindingAdapter("kmUnitText")
fun bindTextViewToKmUnit(textView: TextView, number: Double) {
val context = textView.context
textView.text = String.format(context.getString(R.string.km_unit_format), number)
}
@BindingAdapter("velocityText")
fun bindTextViewToDisplayVelocity(textView: TextView, number: Double) {
val context = textView.context
textView.text = String.format(context.getString(R.string.km_s_unit_format), number)
}
@BindingAdapter("imageUrl")
fun bindImage(imgView: ImageView, imgUrl: String?) {
imgUrl?.let {
Glide.with(imgView.context)
.load(imgUrl)
.apply(
RequestOptions()
.placeholder(R.drawable.loading_animation)
.error(R.drawable.ic_broken_image))
.into(imgView)
}
}
| 0 | Kotlin | 0 | 2 | 6cbf5792249aff7decee4392aaed927818c16c60 | 2,631 | Asteroid-Radar | MIT License |
src/main/kotlin/ui/settings/SettingsView.kt | renjithk | 291,260,758 | false | null | package com.bodiart.ui.settings
import com.bodiart.model.FileType
import com.bodiart.model.ScreenElement
interface SettingsView {
fun setUpListeners()
fun addScreenElement(screenElement: ScreenElement)
fun selectScreenElement(index: Int)
fun showName(name: String)
fun addTextChangeListeners()
fun removeTextChangeListeners()
fun updateScreenElement(index: Int, screenElement: ScreenElement)
fun removeScreenElement(index: Int)
fun showScreenElements(screenElements: List<ScreenElement>)
fun clearScreenElements()
fun showSampleCode(text: String)
fun showTemplate(template: String)
fun showActivityBaseClass(text: String)
fun showFragmentBaseClass(text: String)
fun addBaseClassTextChangeListeners()
fun removeBaseClassTextChangeListeners()
fun showFileType(fileType: FileType)
fun showCodeTextFields(fileType: FileType)
fun swapToKotlinTemplateListener(addListener: Boolean)
fun swapToXmlTemplateListener(addListener: Boolean)
fun showFileNameTemplate(text: String)
fun showFileNameSample(text: String)
fun showHelp()
fun setScreenElementDetailsEnabled(isEnabled: Boolean)
} | 0 | Kotlin | 0 | 0 | d1a2f51d05957ae70afdd16192c1739d239b09aa | 1,173 | screen-generator-plugin | Apache License 2.0 |
js/js.translator/testData/api/stdlib/org.khronos.webgl-0.kt | jordanrjames | 271,690,591 | true | {"Kotlin": 48428233, "Java": 7690677, "JavaScript": 185101, "HTML": 77858, "Lex": 23805, "TypeScript": 21756, "Groovy": 11196, "CSS": 9270, "Swift": 8450, "Shell": 7220, "Batchfile": 5727, "Ruby": 1300, "Objective-C": 404, "Scala": 80} | package org.khronos.webgl
@kotlin.internal.InlineOnly public inline fun WebGLContextAttributes(/*0*/ alpha: kotlin.Boolean? = ..., /*1*/ depth: kotlin.Boolean? = ..., /*2*/ stencil: kotlin.Boolean? = ..., /*3*/ antialias: kotlin.Boolean? = ..., /*4*/ premultipliedAlpha: kotlin.Boolean? = ..., /*5*/ preserveDrawingBuffer: kotlin.Boolean? = ..., /*6*/ preferLowPowerToHighPerformance: kotlin.Boolean? = ..., /*7*/ failIfMajorPerformanceCaveat: kotlin.Boolean? = ...): org.khronos.webgl.WebGLContextAttributes
@kotlin.internal.InlineOnly public inline fun WebGLContextEventInit(/*0*/ statusMessage: kotlin.String? = ..., /*1*/ bubbles: kotlin.Boolean? = ..., /*2*/ cancelable: kotlin.Boolean? = ..., /*3*/ composed: kotlin.Boolean? = ...): org.khronos.webgl.WebGLContextEventInit
@kotlin.internal.InlineOnly public inline operator fun org.khronos.webgl.Float32Array.get(/*0*/ index: kotlin.Int): kotlin.Float
@kotlin.internal.InlineOnly public inline operator fun org.khronos.webgl.Float64Array.get(/*0*/ index: kotlin.Int): kotlin.Double
@kotlin.internal.InlineOnly public inline operator fun org.khronos.webgl.Int16Array.get(/*0*/ index: kotlin.Int): kotlin.Short
@kotlin.internal.InlineOnly public inline operator fun org.khronos.webgl.Int32Array.get(/*0*/ index: kotlin.Int): kotlin.Int
@kotlin.internal.InlineOnly public inline operator fun org.khronos.webgl.Int8Array.get(/*0*/ index: kotlin.Int): kotlin.Byte
@kotlin.internal.InlineOnly public inline operator fun org.khronos.webgl.Uint16Array.get(/*0*/ index: kotlin.Int): kotlin.Short
@kotlin.internal.InlineOnly public inline operator fun org.khronos.webgl.Uint32Array.get(/*0*/ index: kotlin.Int): kotlin.Int
@kotlin.internal.InlineOnly public inline operator fun org.khronos.webgl.Uint8Array.get(/*0*/ index: kotlin.Int): kotlin.Byte
@kotlin.internal.InlineOnly public inline operator fun org.khronos.webgl.Uint8ClampedArray.get(/*0*/ index: kotlin.Int): kotlin.Byte
@kotlin.internal.InlineOnly public inline operator fun org.khronos.webgl.Float32Array.set(/*0*/ index: kotlin.Int, /*1*/ value: kotlin.Float): kotlin.Unit
@kotlin.internal.InlineOnly public inline operator fun org.khronos.webgl.Float64Array.set(/*0*/ index: kotlin.Int, /*1*/ value: kotlin.Double): kotlin.Unit
@kotlin.internal.InlineOnly public inline operator fun org.khronos.webgl.Int16Array.set(/*0*/ index: kotlin.Int, /*1*/ value: kotlin.Short): kotlin.Unit
@kotlin.internal.InlineOnly public inline operator fun org.khronos.webgl.Int32Array.set(/*0*/ index: kotlin.Int, /*1*/ value: kotlin.Int): kotlin.Unit
@kotlin.internal.InlineOnly public inline operator fun org.khronos.webgl.Int8Array.set(/*0*/ index: kotlin.Int, /*1*/ value: kotlin.Byte): kotlin.Unit
@kotlin.internal.InlineOnly public inline operator fun org.khronos.webgl.Uint16Array.set(/*0*/ index: kotlin.Int, /*1*/ value: kotlin.Short): kotlin.Unit
@kotlin.internal.InlineOnly public inline operator fun org.khronos.webgl.Uint32Array.set(/*0*/ index: kotlin.Int, /*1*/ value: kotlin.Int): kotlin.Unit
@kotlin.internal.InlineOnly public inline operator fun org.khronos.webgl.Uint8Array.set(/*0*/ index: kotlin.Int, /*1*/ value: kotlin.Byte): kotlin.Unit
@kotlin.internal.InlineOnly public inline operator fun org.khronos.webgl.Uint8ClampedArray.set(/*0*/ index: kotlin.Int, /*1*/ value: kotlin.Byte): kotlin.Unit
public open external class ArrayBuffer : org.khronos.webgl.BufferDataSource {
/*primary*/ public constructor ArrayBuffer(/*0*/ length: kotlin.Int)
public open val byteLength: kotlin.Int
public open fun <get-byteLength>(): kotlin.Int
public final fun slice(/*0*/ begin: kotlin.Int, /*1*/ end: kotlin.Int = ...): org.khronos.webgl.ArrayBuffer
public companion object Companion {
public final fun isView(/*0*/ value: kotlin.Any?): kotlin.Boolean
}
}
public external interface ArrayBufferView : org.khronos.webgl.BufferDataSource {
public abstract val buffer: org.khronos.webgl.ArrayBuffer
public abstract fun <get-buffer>(): org.khronos.webgl.ArrayBuffer
public abstract val byteLength: kotlin.Int
public abstract fun <get-byteLength>(): kotlin.Int
public abstract val byteOffset: kotlin.Int
public abstract fun <get-byteOffset>(): kotlin.Int
}
public external interface BufferDataSource {
}
public open external class DataView : org.khronos.webgl.ArrayBufferView {
/*primary*/ public constructor DataView(/*0*/ buffer: org.khronos.webgl.ArrayBuffer, /*1*/ byteOffset: kotlin.Int = ..., /*2*/ byteLength: kotlin.Int = ...)
public open override /*1*/ val buffer: org.khronos.webgl.ArrayBuffer
public open override /*1*/ fun <get-buffer>(): org.khronos.webgl.ArrayBuffer
public open override /*1*/ val byteLength: kotlin.Int
public open override /*1*/ fun <get-byteLength>(): kotlin.Int
public open override /*1*/ val byteOffset: kotlin.Int
public open override /*1*/ fun <get-byteOffset>(): kotlin.Int
public final fun getFloat32(/*0*/ byteOffset: kotlin.Int, /*1*/ littleEndian: kotlin.Boolean = ...): kotlin.Float
public final fun getFloat64(/*0*/ byteOffset: kotlin.Int, /*1*/ littleEndian: kotlin.Boolean = ...): kotlin.Double
public final fun getInt16(/*0*/ byteOffset: kotlin.Int, /*1*/ littleEndian: kotlin.Boolean = ...): kotlin.Short
public final fun getInt32(/*0*/ byteOffset: kotlin.Int, /*1*/ littleEndian: kotlin.Boolean = ...): kotlin.Int
public final fun getInt8(/*0*/ byteOffset: kotlin.Int): kotlin.Byte
public final fun getUint16(/*0*/ byteOffset: kotlin.Int, /*1*/ littleEndian: kotlin.Boolean = ...): kotlin.Short
public final fun getUint32(/*0*/ byteOffset: kotlin.Int, /*1*/ littleEndian: kotlin.Boolean = ...): kotlin.Int
public final fun getUint8(/*0*/ byteOffset: kotlin.Int): kotlin.Byte
public final fun setFloat32(/*0*/ byteOffset: kotlin.Int, /*1*/ value: kotlin.Float, /*2*/ littleEndian: kotlin.Boolean = ...): kotlin.Unit
public final fun setFloat64(/*0*/ byteOffset: kotlin.Int, /*1*/ value: kotlin.Double, /*2*/ littleEndian: kotlin.Boolean = ...): kotlin.Unit
public final fun setInt16(/*0*/ byteOffset: kotlin.Int, /*1*/ value: kotlin.Short, /*2*/ littleEndian: kotlin.Boolean = ...): kotlin.Unit
public final fun setInt32(/*0*/ byteOffset: kotlin.Int, /*1*/ value: kotlin.Int, /*2*/ littleEndian: kotlin.Boolean = ...): kotlin.Unit
public final fun setInt8(/*0*/ byteOffset: kotlin.Int, /*1*/ value: kotlin.Byte): kotlin.Unit
public final fun setUint16(/*0*/ byteOffset: kotlin.Int, /*1*/ value: kotlin.Short, /*2*/ littleEndian: kotlin.Boolean = ...): kotlin.Unit
public final fun setUint32(/*0*/ byteOffset: kotlin.Int, /*1*/ value: kotlin.Int, /*2*/ littleEndian: kotlin.Boolean = ...): kotlin.Unit
public final fun setUint8(/*0*/ byteOffset: kotlin.Int, /*1*/ value: kotlin.Byte): kotlin.Unit
}
public open external class Float32Array : org.khronos.webgl.ArrayBufferView {
public constructor Float32Array(/*0*/ array: kotlin.Array<kotlin.Float>)
public constructor Float32Array(/*0*/ length: kotlin.Int)
public constructor Float32Array(/*0*/ buffer: org.khronos.webgl.ArrayBuffer, /*1*/ byteOffset: kotlin.Int = ..., /*2*/ length: kotlin.Int = ...)
public constructor Float32Array(/*0*/ array: org.khronos.webgl.Float32Array)
public open override /*1*/ val buffer: org.khronos.webgl.ArrayBuffer
public open override /*1*/ fun <get-buffer>(): org.khronos.webgl.ArrayBuffer
public open override /*1*/ val byteLength: kotlin.Int
public open override /*1*/ fun <get-byteLength>(): kotlin.Int
public open override /*1*/ val byteOffset: kotlin.Int
public open override /*1*/ fun <get-byteOffset>(): kotlin.Int
public open val length: kotlin.Int
public open fun <get-length>(): kotlin.Int
public final fun set(/*0*/ array: kotlin.Array<kotlin.Float>, /*1*/ offset: kotlin.Int = ...): kotlin.Unit
public final fun set(/*0*/ array: org.khronos.webgl.Float32Array, /*1*/ offset: kotlin.Int = ...): kotlin.Unit
public final fun subarray(/*0*/ start: kotlin.Int, /*1*/ end: kotlin.Int): org.khronos.webgl.Float32Array
public companion object Companion {
public final val BYTES_PER_ELEMENT: kotlin.Int
public final fun <get-BYTES_PER_ELEMENT>(): kotlin.Int
}
}
public open external class Float64Array : org.khronos.webgl.ArrayBufferView {
public constructor Float64Array(/*0*/ array: kotlin.Array<kotlin.Double>)
public constructor Float64Array(/*0*/ length: kotlin.Int)
public constructor Float64Array(/*0*/ buffer: org.khronos.webgl.ArrayBuffer, /*1*/ byteOffset: kotlin.Int = ..., /*2*/ length: kotlin.Int = ...)
public constructor Float64Array(/*0*/ array: org.khronos.webgl.Float64Array)
public open override /*1*/ val buffer: org.khronos.webgl.ArrayBuffer
public open override /*1*/ fun <get-buffer>(): org.khronos.webgl.ArrayBuffer
public open override /*1*/ val byteLength: kotlin.Int
public open override /*1*/ fun <get-byteLength>(): kotlin.Int
public open override /*1*/ val byteOffset: kotlin.Int
public open override /*1*/ fun <get-byteOffset>(): kotlin.Int
public open val length: kotlin.Int
public open fun <get-length>(): kotlin.Int
public final fun set(/*0*/ array: kotlin.Array<kotlin.Double>, /*1*/ offset: kotlin.Int = ...): kotlin.Unit
public final fun set(/*0*/ array: org.khronos.webgl.Float64Array, /*1*/ offset: kotlin.Int = ...): kotlin.Unit
public final fun subarray(/*0*/ start: kotlin.Int, /*1*/ end: kotlin.Int): org.khronos.webgl.Float64Array
public companion object Companion {
public final val BYTES_PER_ELEMENT: kotlin.Int
public final fun <get-BYTES_PER_ELEMENT>(): kotlin.Int
}
}
public open external class Int16Array : org.khronos.webgl.ArrayBufferView {
public constructor Int16Array(/*0*/ array: kotlin.Array<kotlin.Short>)
public constructor Int16Array(/*0*/ length: kotlin.Int)
public constructor Int16Array(/*0*/ buffer: org.khronos.webgl.ArrayBuffer, /*1*/ byteOffset: kotlin.Int = ..., /*2*/ length: kotlin.Int = ...)
public constructor Int16Array(/*0*/ array: org.khronos.webgl.Int16Array)
public open override /*1*/ val buffer: org.khronos.webgl.ArrayBuffer
public open override /*1*/ fun <get-buffer>(): org.khronos.webgl.ArrayBuffer
public open override /*1*/ val byteLength: kotlin.Int
public open override /*1*/ fun <get-byteLength>(): kotlin.Int
public open override /*1*/ val byteOffset: kotlin.Int
public open override /*1*/ fun <get-byteOffset>(): kotlin.Int
public open val length: kotlin.Int
public open fun <get-length>(): kotlin.Int
public final fun set(/*0*/ array: kotlin.Array<kotlin.Short>, /*1*/ offset: kotlin.Int = ...): kotlin.Unit
public final fun set(/*0*/ array: org.khronos.webgl.Int16Array, /*1*/ offset: kotlin.Int = ...): kotlin.Unit
public final fun subarray(/*0*/ start: kotlin.Int, /*1*/ end: kotlin.Int): org.khronos.webgl.Int16Array
public companion object Companion {
public final val BYTES_PER_ELEMENT: kotlin.Int
public final fun <get-BYTES_PER_ELEMENT>(): kotlin.Int
}
}
public open external class Int32Array : org.khronos.webgl.ArrayBufferView {
public constructor Int32Array(/*0*/ array: kotlin.Array<kotlin.Int>)
public constructor Int32Array(/*0*/ length: kotlin.Int)
public constructor Int32Array(/*0*/ buffer: org.khronos.webgl.ArrayBuffer, /*1*/ byteOffset: kotlin.Int = ..., /*2*/ length: kotlin.Int = ...)
public constructor Int32Array(/*0*/ array: org.khronos.webgl.Int32Array)
public open override /*1*/ val buffer: org.khronos.webgl.ArrayBuffer
public open override /*1*/ fun <get-buffer>(): org.khronos.webgl.ArrayBuffer
public open override /*1*/ val byteLength: kotlin.Int
public open override /*1*/ fun <get-byteLength>(): kotlin.Int
public open override /*1*/ val byteOffset: kotlin.Int
public open override /*1*/ fun <get-byteOffset>(): kotlin.Int
public open val length: kotlin.Int
public open fun <get-length>(): kotlin.Int
public final fun set(/*0*/ array: kotlin.Array<kotlin.Int>, /*1*/ offset: kotlin.Int = ...): kotlin.Unit
public final fun set(/*0*/ array: org.khronos.webgl.Int32Array, /*1*/ offset: kotlin.Int = ...): kotlin.Unit
public final fun subarray(/*0*/ start: kotlin.Int, /*1*/ end: kotlin.Int): org.khronos.webgl.Int32Array
public companion object Companion {
public final val BYTES_PER_ELEMENT: kotlin.Int
public final fun <get-BYTES_PER_ELEMENT>(): kotlin.Int
}
}
public open external class Int8Array : org.khronos.webgl.ArrayBufferView {
public constructor Int8Array(/*0*/ array: kotlin.Array<kotlin.Byte>)
public constructor Int8Array(/*0*/ length: kotlin.Int)
public constructor Int8Array(/*0*/ buffer: org.khronos.webgl.ArrayBuffer, /*1*/ byteOffset: kotlin.Int = ..., /*2*/ length: kotlin.Int = ...)
public constructor Int8Array(/*0*/ array: org.khronos.webgl.Int8Array)
public open override /*1*/ val buffer: org.khronos.webgl.ArrayBuffer
public open override /*1*/ fun <get-buffer>(): org.khronos.webgl.ArrayBuffer
public open override /*1*/ val byteLength: kotlin.Int
public open override /*1*/ fun <get-byteLength>(): kotlin.Int
public open override /*1*/ val byteOffset: kotlin.Int
public open override /*1*/ fun <get-byteOffset>(): kotlin.Int
public open val length: kotlin.Int
public open fun <get-length>(): kotlin.Int
public final fun set(/*0*/ array: kotlin.Array<kotlin.Byte>, /*1*/ offset: kotlin.Int = ...): kotlin.Unit
public final fun set(/*0*/ array: org.khronos.webgl.Int8Array, /*1*/ offset: kotlin.Int = ...): kotlin.Unit
public final fun subarray(/*0*/ start: kotlin.Int, /*1*/ end: kotlin.Int): org.khronos.webgl.Int8Array
public companion object Companion {
public final val BYTES_PER_ELEMENT: kotlin.Int
public final fun <get-BYTES_PER_ELEMENT>(): kotlin.Int
}
}
public external interface TexImageSource {
}
public open external class Uint16Array : org.khronos.webgl.ArrayBufferView {
public constructor Uint16Array(/*0*/ array: kotlin.Array<kotlin.Short>)
public constructor Uint16Array(/*0*/ length: kotlin.Int)
public constructor Uint16Array(/*0*/ buffer: org.khronos.webgl.ArrayBuffer, /*1*/ byteOffset: kotlin.Int = ..., /*2*/ length: kotlin.Int = ...)
public constructor Uint16Array(/*0*/ array: org.khronos.webgl.Uint16Array)
public open override /*1*/ val buffer: org.khronos.webgl.ArrayBuffer
public open override /*1*/ fun <get-buffer>(): org.khronos.webgl.ArrayBuffer
public open override /*1*/ val byteLength: kotlin.Int
public open override /*1*/ fun <get-byteLength>(): kotlin.Int
public open override /*1*/ val byteOffset: kotlin.Int
public open override /*1*/ fun <get-byteOffset>(): kotlin.Int
public open val length: kotlin.Int
public open fun <get-length>(): kotlin.Int
public final fun set(/*0*/ array: kotlin.Array<kotlin.Short>, /*1*/ offset: kotlin.Int = ...): kotlin.Unit
public final fun set(/*0*/ array: org.khronos.webgl.Uint16Array, /*1*/ offset: kotlin.Int = ...): kotlin.Unit
public final fun subarray(/*0*/ start: kotlin.Int, /*1*/ end: kotlin.Int): org.khronos.webgl.Uint16Array
public companion object Companion {
public final val BYTES_PER_ELEMENT: kotlin.Int
public final fun <get-BYTES_PER_ELEMENT>(): kotlin.Int
}
}
public open external class Uint32Array : org.khronos.webgl.ArrayBufferView {
public constructor Uint32Array(/*0*/ array: kotlin.Array<kotlin.Int>)
public constructor Uint32Array(/*0*/ length: kotlin.Int)
public constructor Uint32Array(/*0*/ buffer: org.khronos.webgl.ArrayBuffer, /*1*/ byteOffset: kotlin.Int = ..., /*2*/ length: kotlin.Int = ...)
public constructor Uint32Array(/*0*/ array: org.khronos.webgl.Uint32Array)
public open override /*1*/ val buffer: org.khronos.webgl.ArrayBuffer
public open override /*1*/ fun <get-buffer>(): org.khronos.webgl.ArrayBuffer
public open override /*1*/ val byteLength: kotlin.Int
public open override /*1*/ fun <get-byteLength>(): kotlin.Int
public open override /*1*/ val byteOffset: kotlin.Int
public open override /*1*/ fun <get-byteOffset>(): kotlin.Int
public open val length: kotlin.Int
public open fun <get-length>(): kotlin.Int
public final fun set(/*0*/ array: kotlin.Array<kotlin.Int>, /*1*/ offset: kotlin.Int = ...): kotlin.Unit
public final fun set(/*0*/ array: org.khronos.webgl.Uint32Array, /*1*/ offset: kotlin.Int = ...): kotlin.Unit
public final fun subarray(/*0*/ start: kotlin.Int, /*1*/ end: kotlin.Int): org.khronos.webgl.Uint32Array
public companion object Companion {
public final val BYTES_PER_ELEMENT: kotlin.Int
public final fun <get-BYTES_PER_ELEMENT>(): kotlin.Int
}
}
public open external class Uint8Array : org.khronos.webgl.ArrayBufferView {
public constructor Uint8Array(/*0*/ array: kotlin.Array<kotlin.Byte>)
public constructor Uint8Array(/*0*/ length: kotlin.Int)
public constructor Uint8Array(/*0*/ buffer: org.khronos.webgl.ArrayBuffer, /*1*/ byteOffset: kotlin.Int = ..., /*2*/ length: kotlin.Int = ...)
public constructor Uint8Array(/*0*/ array: org.khronos.webgl.Uint8Array)
public open override /*1*/ val buffer: org.khronos.webgl.ArrayBuffer
public open override /*1*/ fun <get-buffer>(): org.khronos.webgl.ArrayBuffer
public open override /*1*/ val byteLength: kotlin.Int
public open override /*1*/ fun <get-byteLength>(): kotlin.Int
public open override /*1*/ val byteOffset: kotlin.Int
public open override /*1*/ fun <get-byteOffset>(): kotlin.Int
public open val length: kotlin.Int
public open fun <get-length>(): kotlin.Int
public final fun set(/*0*/ array: kotlin.Array<kotlin.Byte>, /*1*/ offset: kotlin.Int = ...): kotlin.Unit
public final fun set(/*0*/ array: org.khronos.webgl.Uint8Array, /*1*/ offset: kotlin.Int = ...): kotlin.Unit
public final fun subarray(/*0*/ start: kotlin.Int, /*1*/ end: kotlin.Int): org.khronos.webgl.Uint8Array
public companion object Companion {
public final val BYTES_PER_ELEMENT: kotlin.Int
public final fun <get-BYTES_PER_ELEMENT>(): kotlin.Int
}
}
public open external class Uint8ClampedArray : org.khronos.webgl.ArrayBufferView {
public constructor Uint8ClampedArray(/*0*/ array: kotlin.Array<kotlin.Byte>)
public constructor Uint8ClampedArray(/*0*/ length: kotlin.Int)
public constructor Uint8ClampedArray(/*0*/ buffer: org.khronos.webgl.ArrayBuffer, /*1*/ byteOffset: kotlin.Int = ..., /*2*/ length: kotlin.Int = ...)
public constructor Uint8ClampedArray(/*0*/ array: org.khronos.webgl.Uint8ClampedArray)
public open override /*1*/ val buffer: org.khronos.webgl.ArrayBuffer
public open override /*1*/ fun <get-buffer>(): org.khronos.webgl.ArrayBuffer
public open override /*1*/ val byteLength: kotlin.Int
public open override /*1*/ fun <get-byteLength>(): kotlin.Int
public open override /*1*/ val byteOffset: kotlin.Int
public open override /*1*/ fun <get-byteOffset>(): kotlin.Int
public open val length: kotlin.Int
public open fun <get-length>(): kotlin.Int
public final fun set(/*0*/ array: kotlin.Array<kotlin.Byte>, /*1*/ offset: kotlin.Int = ...): kotlin.Unit
public final fun set(/*0*/ array: org.khronos.webgl.Uint8ClampedArray, /*1*/ offset: kotlin.Int = ...): kotlin.Unit
public final fun subarray(/*0*/ start: kotlin.Int, /*1*/ end: kotlin.Int): org.khronos.webgl.Uint8ClampedArray
public companion object Companion {
public final val BYTES_PER_ELEMENT: kotlin.Int
public final fun <get-BYTES_PER_ELEMENT>(): kotlin.Int
}
}
public abstract external class WebGLActiveInfo {
/*primary*/ public constructor WebGLActiveInfo()
public open val name: kotlin.String
public open fun <get-name>(): kotlin.String
public open val size: kotlin.Int
public open fun <get-size>(): kotlin.Int
public open val type: kotlin.Int
public open fun <get-type>(): kotlin.Int
}
public abstract external class WebGLBuffer : org.khronos.webgl.WebGLObject {
/*primary*/ public constructor WebGLBuffer()
}
public external interface WebGLContextAttributes {
public open var alpha: kotlin.Boolean?
public open fun <get-alpha>(): kotlin.Boolean?
public open fun <set-alpha>(/*0*/ value: kotlin.Boolean?): kotlin.Unit
public open var antialias: kotlin.Boolean?
public open fun <get-antialias>(): kotlin.Boolean?
public open fun <set-antialias>(/*0*/ value: kotlin.Boolean?): kotlin.Unit
public open var depth: kotlin.Boolean?
public open fun <get-depth>(): kotlin.Boolean?
public open fun <set-depth>(/*0*/ value: kotlin.Boolean?): kotlin.Unit
public open var failIfMajorPerformanceCaveat: kotlin.Boolean?
public open fun <get-failIfMajorPerformanceCaveat>(): kotlin.Boolean?
public open fun <set-failIfMajorPerformanceCaveat>(/*0*/ value: kotlin.Boolean?): kotlin.Unit
public open var preferLowPowerToHighPerformance: kotlin.Boolean?
public open fun <get-preferLowPowerToHighPerformance>(): kotlin.Boolean?
public open fun <set-preferLowPowerToHighPerformance>(/*0*/ value: kotlin.Boolean?): kotlin.Unit
public open var premultipliedAlpha: kotlin.Boolean?
public open fun <get-premultipliedAlpha>(): kotlin.Boolean?
public open fun <set-premultipliedAlpha>(/*0*/ value: kotlin.Boolean?): kotlin.Unit
public open var preserveDrawingBuffer: kotlin.Boolean?
public open fun <get-preserveDrawingBuffer>(): kotlin.Boolean?
public open fun <set-preserveDrawingBuffer>(/*0*/ value: kotlin.Boolean?): kotlin.Unit
public open var stencil: kotlin.Boolean?
public open fun <get-stencil>(): kotlin.Boolean?
public open fun <set-stencil>(/*0*/ value: kotlin.Boolean?): kotlin.Unit
}
public open external class WebGLContextEvent : org.w3c.dom.events.Event {
/*primary*/ public constructor WebGLContextEvent(/*0*/ type: kotlin.String, /*1*/ eventInit: org.khronos.webgl.WebGLContextEventInit = ...)
public open val statusMessage: kotlin.String
public open fun <get-statusMessage>(): kotlin.String
public companion object Companion {
public final val AT_TARGET: kotlin.Short
public final fun <get-AT_TARGET>(): kotlin.Short
public final val BUBBLING_PHASE: kotlin.Short
public final fun <get-BUBBLING_PHASE>(): kotlin.Short
public final val CAPTURING_PHASE: kotlin.Short
public final fun <get-CAPTURING_PHASE>(): kotlin.Short
public final val NONE: kotlin.Short
public final fun <get-NONE>(): kotlin.Short
}
}
public external interface WebGLContextEventInit : org.w3c.dom.EventInit {
public open var statusMessage: kotlin.String?
public open fun <get-statusMessage>(): kotlin.String?
public open fun <set-statusMessage>(/*0*/ value: kotlin.String?): kotlin.Unit
}
public abstract external class WebGLFramebuffer : org.khronos.webgl.WebGLObject {
/*primary*/ public constructor WebGLFramebuffer()
}
public abstract external class WebGLObject {
/*primary*/ public constructor WebGLObject()
}
public abstract external class WebGLProgram : org.khronos.webgl.WebGLObject {
/*primary*/ public constructor WebGLProgram()
}
public abstract external class WebGLRenderbuffer : org.khronos.webgl.WebGLObject {
/*primary*/ public constructor WebGLRenderbuffer()
}
public abstract external class WebGLRenderingContext : org.khronos.webgl.WebGLRenderingContextBase, org.w3c.dom.RenderingContext {
/*primary*/ public constructor WebGLRenderingContext()
public companion object Companion {
public final val ACTIVE_ATTRIBUTES: kotlin.Int
public final fun <get-ACTIVE_ATTRIBUTES>(): kotlin.Int
public final val ACTIVE_TEXTURE: kotlin.Int
public final fun <get-ACTIVE_TEXTURE>(): kotlin.Int
public final val ACTIVE_UNIFORMS: kotlin.Int
public final fun <get-ACTIVE_UNIFORMS>(): kotlin.Int
public final val ALIASED_LINE_WIDTH_RANGE: kotlin.Int
public final fun <get-ALIASED_LINE_WIDTH_RANGE>(): kotlin.Int
public final val ALIASED_POINT_SIZE_RANGE: kotlin.Int
public final fun <get-ALIASED_POINT_SIZE_RANGE>(): kotlin.Int
public final val ALPHA: kotlin.Int
public final fun <get-ALPHA>(): kotlin.Int
public final val ALPHA_BITS: kotlin.Int
public final fun <get-ALPHA_BITS>(): kotlin.Int
public final val ALWAYS: kotlin.Int
public final fun <get-ALWAYS>(): kotlin.Int
public final val ARRAY_BUFFER: kotlin.Int
public final fun <get-ARRAY_BUFFER>(): kotlin.Int
public final val ARRAY_BUFFER_BINDING: kotlin.Int
public final fun <get-ARRAY_BUFFER_BINDING>(): kotlin.Int
public final val ATTACHED_SHADERS: kotlin.Int
public final fun <get-ATTACHED_SHADERS>(): kotlin.Int
public final val BACK: kotlin.Int
public final fun <get-BACK>(): kotlin.Int
public final val BLEND: kotlin.Int
public final fun <get-BLEND>(): kotlin.Int
public final val BLEND_COLOR: kotlin.Int
public final fun <get-BLEND_COLOR>(): kotlin.Int
public final val BLEND_DST_ALPHA: kotlin.Int
public final fun <get-BLEND_DST_ALPHA>(): kotlin.Int
public final val BLEND_DST_RGB: kotlin.Int
public final fun <get-BLEND_DST_RGB>(): kotlin.Int
public final val BLEND_EQUATION: kotlin.Int
public final fun <get-BLEND_EQUATION>(): kotlin.Int
public final val BLEND_EQUATION_ALPHA: kotlin.Int
public final fun <get-BLEND_EQUATION_ALPHA>(): kotlin.Int
public final val BLEND_EQUATION_RGB: kotlin.Int
public final fun <get-BLEND_EQUATION_RGB>(): kotlin.Int
public final val BLEND_SRC_ALPHA: kotlin.Int
public final fun <get-BLEND_SRC_ALPHA>(): kotlin.Int
public final val BLEND_SRC_RGB: kotlin.Int
public final fun <get-BLEND_SRC_RGB>(): kotlin.Int
public final val BLUE_BITS: kotlin.Int
public final fun <get-BLUE_BITS>(): kotlin.Int
public final val BOOL: kotlin.Int
public final fun <get-BOOL>(): kotlin.Int
public final val BOOL_VEC2: kotlin.Int
public final fun <get-BOOL_VEC2>(): kotlin.Int
public final val BOOL_VEC3: kotlin.Int
public final fun <get-BOOL_VEC3>(): kotlin.Int
public final val BOOL_VEC4: kotlin.Int
public final fun <get-BOOL_VEC4>(): kotlin.Int
public final val BROWSER_DEFAULT_WEBGL: kotlin.Int
public final fun <get-BROWSER_DEFAULT_WEBGL>(): kotlin.Int
public final val BUFFER_SIZE: kotlin.Int
public final fun <get-BUFFER_SIZE>(): kotlin.Int
public final val BUFFER_USAGE: kotlin.Int
public final fun <get-BUFFER_USAGE>(): kotlin.Int
public final val BYTE: kotlin.Int
public final fun <get-BYTE>(): kotlin.Int
public final val CCW: kotlin.Int
public final fun <get-CCW>(): kotlin.Int
public final val CLAMP_TO_EDGE: kotlin.Int
public final fun <get-CLAMP_TO_EDGE>(): kotlin.Int
public final val COLOR_ATTACHMENT0: kotlin.Int
public final fun <get-COLOR_ATTACHMENT0>(): kotlin.Int
public final val COLOR_BUFFER_BIT: kotlin.Int
public final fun <get-COLOR_BUFFER_BIT>(): kotlin.Int
public final val COLOR_CLEAR_VALUE: kotlin.Int
public final fun <get-COLOR_CLEAR_VALUE>(): kotlin.Int
public final val COLOR_WRITEMASK: kotlin.Int
public final fun <get-COLOR_WRITEMASK>(): kotlin.Int
public final val COMPILE_STATUS: kotlin.Int
public final fun <get-COMPILE_STATUS>(): kotlin.Int
public final val COMPRESSED_TEXTURE_FORMATS: kotlin.Int
public final fun <get-COMPRESSED_TEXTURE_FORMATS>(): kotlin.Int
public final val CONSTANT_ALPHA: kotlin.Int
public final fun <get-CONSTANT_ALPHA>(): kotlin.Int
public final val CONSTANT_COLOR: kotlin.Int
public final fun <get-CONSTANT_COLOR>(): kotlin.Int
public final val CONTEXT_LOST_WEBGL: kotlin.Int
public final fun <get-CONTEXT_LOST_WEBGL>(): kotlin.Int
public final val CULL_FACE: kotlin.Int
public final fun <get-CULL_FACE>(): kotlin.Int
public final val CULL_FACE_MODE: kotlin.Int
public final fun <get-CULL_FACE_MODE>(): kotlin.Int
public final val CURRENT_PROGRAM: kotlin.Int
public final fun <get-CURRENT_PROGRAM>(): kotlin.Int
public final val CURRENT_VERTEX_ATTRIB: kotlin.Int
public final fun <get-CURRENT_VERTEX_ATTRIB>(): kotlin.Int
public final val CW: kotlin.Int
public final fun <get-CW>(): kotlin.Int
public final val DECR: kotlin.Int
public final fun <get-DECR>(): kotlin.Int
public final val DECR_WRAP: kotlin.Int
public final fun <get-DECR_WRAP>(): kotlin.Int
public final val DELETE_STATUS: kotlin.Int
public final fun <get-DELETE_STATUS>(): kotlin.Int
public final val DEPTH_ATTACHMENT: kotlin.Int
public final fun <get-DEPTH_ATTACHMENT>(): kotlin.Int
public final val DEPTH_BITS: kotlin.Int
public final fun <get-DEPTH_BITS>(): kotlin.Int
public final val DEPTH_BUFFER_BIT: kotlin.Int
public final fun <get-DEPTH_BUFFER_BIT>(): kotlin.Int
public final val DEPTH_CLEAR_VALUE: kotlin.Int
public final fun <get-DEPTH_CLEAR_VALUE>(): kotlin.Int
public final val DEPTH_COMPONENT: kotlin.Int
public final fun <get-DEPTH_COMPONENT>(): kotlin.Int
public final val DEPTH_COMPONENT16: kotlin.Int
public final fun <get-DEPTH_COMPONENT16>(): kotlin.Int
public final val DEPTH_FUNC: kotlin.Int
public final fun <get-DEPTH_FUNC>(): kotlin.Int
public final val DEPTH_RANGE: kotlin.Int
public final fun <get-DEPTH_RANGE>(): kotlin.Int
public final val DEPTH_STENCIL: kotlin.Int
public final fun <get-DEPTH_STENCIL>(): kotlin.Int
public final val DEPTH_STENCIL_ATTACHMENT: kotlin.Int
public final fun <get-DEPTH_STENCIL_ATTACHMENT>(): kotlin.Int
public final val DEPTH_TEST: kotlin.Int
public final fun <get-DEPTH_TEST>(): kotlin.Int
public final val DEPTH_WRITEMASK: kotlin.Int
public final fun <get-DEPTH_WRITEMASK>(): kotlin.Int
public final val DITHER: kotlin.Int
public final fun <get-DITHER>(): kotlin.Int
public final val DONT_CARE: kotlin.Int
public final fun <get-DONT_CARE>(): kotlin.Int
public final val DST_ALPHA: kotlin.Int
public final fun <get-DST_ALPHA>(): kotlin.Int
public final val DST_COLOR: kotlin.Int
public final fun <get-DST_COLOR>(): kotlin.Int
public final val DYNAMIC_DRAW: kotlin.Int
public final fun <get-DYNAMIC_DRAW>(): kotlin.Int
public final val ELEMENT_ARRAY_BUFFER: kotlin.Int
public final fun <get-ELEMENT_ARRAY_BUFFER>(): kotlin.Int
public final val ELEMENT_ARRAY_BUFFER_BINDING: kotlin.Int
public final fun <get-ELEMENT_ARRAY_BUFFER_BINDING>(): kotlin.Int
public final val EQUAL: kotlin.Int
public final fun <get-EQUAL>(): kotlin.Int
public final val FASTEST: kotlin.Int
public final fun <get-FASTEST>(): kotlin.Int
public final val FLOAT: kotlin.Int
public final fun <get-FLOAT>(): kotlin.Int
public final val FLOAT_MAT2: kotlin.Int
public final fun <get-FLOAT_MAT2>(): kotlin.Int
public final val FLOAT_MAT3: kotlin.Int
public final fun <get-FLOAT_MAT3>(): kotlin.Int
public final val FLOAT_MAT4: kotlin.Int
public final fun <get-FLOAT_MAT4>(): kotlin.Int
public final val FLOAT_VEC2: kotlin.Int
public final fun <get-FLOAT_VEC2>(): kotlin.Int
public final val FLOAT_VEC3: kotlin.Int
public final fun <get-FLOAT_VEC3>(): kotlin.Int
public final val FLOAT_VEC4: kotlin.Int
public final fun <get-FLOAT_VEC4>(): kotlin.Int
public final val FRAGMENT_SHADER: kotlin.Int
public final fun <get-FRAGMENT_SHADER>(): kotlin.Int
public final val FRAMEBUFFER: kotlin.Int
public final fun <get-FRAMEBUFFER>(): kotlin.Int
public final val FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: kotlin.Int
public final fun <get-FRAMEBUFFER_ATTACHMENT_OBJECT_NAME>(): kotlin.Int
public final val FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: kotlin.Int
public final fun <get-FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE>(): kotlin.Int
public final val FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: kotlin.Int
public final fun <get-FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE>(): kotlin.Int
public final val FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: kotlin.Int
public final fun <get-FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL>(): kotlin.Int
public final val FRAMEBUFFER_BINDING: kotlin.Int
public final fun <get-FRAMEBUFFER_BINDING>(): kotlin.Int
public final val FRAMEBUFFER_COMPLETE: kotlin.Int
public final fun <get-FRAMEBUFFER_COMPLETE>(): kotlin.Int
public final val FRAMEBUFFER_INCOMPLETE_ATTACHMENT: kotlin.Int
public final fun <get-FRAMEBUFFER_INCOMPLETE_ATTACHMENT>(): kotlin.Int
public final val FRAMEBUFFER_INCOMPLETE_DIMENSIONS: kotlin.Int
public final fun <get-FRAMEBUFFER_INCOMPLETE_DIMENSIONS>(): kotlin.Int
public final val FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: kotlin.Int
public final fun <get-FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT>(): kotlin.Int
public final val FRAMEBUFFER_UNSUPPORTED: kotlin.Int
public final fun <get-FRAMEBUFFER_UNSUPPORTED>(): kotlin.Int
public final val FRONT: kotlin.Int
public final fun <get-FRONT>(): kotlin.Int
public final val FRONT_AND_BACK: kotlin.Int
public final fun <get-FRONT_AND_BACK>(): kotlin.Int
public final val FRONT_FACE: kotlin.Int
public final fun <get-FRONT_FACE>(): kotlin.Int
public final val FUNC_ADD: kotlin.Int
public final fun <get-FUNC_ADD>(): kotlin.Int
public final val FUNC_REVERSE_SUBTRACT: kotlin.Int
public final fun <get-FUNC_REVERSE_SUBTRACT>(): kotlin.Int
public final val FUNC_SUBTRACT: kotlin.Int
public final fun <get-FUNC_SUBTRACT>(): kotlin.Int
public final val GENERATE_MIPMAP_HINT: kotlin.Int
public final fun <get-GENERATE_MIPMAP_HINT>(): kotlin.Int
public final val GEQUAL: kotlin.Int
public final fun <get-GEQUAL>(): kotlin.Int
public final val GREATER: kotlin.Int
public final fun <get-GREATER>(): kotlin.Int
public final val GREEN_BITS: kotlin.Int
public final fun <get-GREEN_BITS>(): kotlin.Int
public final val HIGH_FLOAT: kotlin.Int
public final fun <get-HIGH_FLOAT>(): kotlin.Int
public final val HIGH_INT: kotlin.Int
public final fun <get-HIGH_INT>(): kotlin.Int
public final val IMPLEMENTATION_COLOR_READ_FORMAT: kotlin.Int
public final fun <get-IMPLEMENTATION_COLOR_READ_FORMAT>(): kotlin.Int
public final val IMPLEMENTATION_COLOR_READ_TYPE: kotlin.Int
public final fun <get-IMPLEMENTATION_COLOR_READ_TYPE>(): kotlin.Int
public final val INCR: kotlin.Int
public final fun <get-INCR>(): kotlin.Int
public final val INCR_WRAP: kotlin.Int
public final fun <get-INCR_WRAP>(): kotlin.Int
public final val INT: kotlin.Int
public final fun <get-INT>(): kotlin.Int
public final val INT_VEC2: kotlin.Int
public final fun <get-INT_VEC2>(): kotlin.Int
public final val INT_VEC3: kotlin.Int
public final fun <get-INT_VEC3>(): kotlin.Int
public final val INT_VEC4: kotlin.Int
public final fun <get-INT_VEC4>(): kotlin.Int
public final val INVALID_ENUM: kotlin.Int
public final fun <get-INVALID_ENUM>(): kotlin.Int
public final val INVALID_FRAMEBUFFER_OPERATION: kotlin.Int
public final fun <get-INVALID_FRAMEBUFFER_OPERATION>(): kotlin.Int
public final val INVALID_OPERATION: kotlin.Int
public final fun <get-INVALID_OPERATION>(): kotlin.Int
public final val INVALID_VALUE: kotlin.Int
public final fun <get-INVALID_VALUE>(): kotlin.Int
public final val INVERT: kotlin.Int
public final fun <get-INVERT>(): kotlin.Int
public final val KEEP: kotlin.Int
public final fun <get-KEEP>(): kotlin.Int
public final val LEQUAL: kotlin.Int
public final fun <get-LEQUAL>(): kotlin.Int
public final val LESS: kotlin.Int
public final fun <get-LESS>(): kotlin.Int
public final val LINEAR: kotlin.Int
public final fun <get-LINEAR>(): kotlin.Int
public final val LINEAR_MIPMAP_LINEAR: kotlin.Int
public final fun <get-LINEAR_MIPMAP_LINEAR>(): kotlin.Int
public final val LINEAR_MIPMAP_NEAREST: kotlin.Int
public final fun <get-LINEAR_MIPMAP_NEAREST>(): kotlin.Int
public final val LINES: kotlin.Int
public final fun <get-LINES>(): kotlin.Int
public final val LINE_LOOP: kotlin.Int
public final fun <get-LINE_LOOP>(): kotlin.Int
public final val LINE_STRIP: kotlin.Int
public final fun <get-LINE_STRIP>(): kotlin.Int
public final val LINE_WIDTH: kotlin.Int
public final fun <get-LINE_WIDTH>(): kotlin.Int
public final val LINK_STATUS: kotlin.Int
public final fun <get-LINK_STATUS>(): kotlin.Int
public final val LOW_FLOAT: kotlin.Int
public final fun <get-LOW_FLOAT>(): kotlin.Int
public final val LOW_INT: kotlin.Int
public final fun <get-LOW_INT>(): kotlin.Int
public final val LUMINANCE: kotlin.Int
public final fun <get-LUMINANCE>(): kotlin.Int
public final val LUMINANCE_ALPHA: kotlin.Int
public final fun <get-LUMINANCE_ALPHA>(): kotlin.Int
public final val MAX_COMBINED_TEXTURE_IMAGE_UNITS: kotlin.Int
public final fun <get-MAX_COMBINED_TEXTURE_IMAGE_UNITS>(): kotlin.Int
public final val MAX_CUBE_MAP_TEXTURE_SIZE: kotlin.Int
public final fun <get-MAX_CUBE_MAP_TEXTURE_SIZE>(): kotlin.Int
public final val MAX_FRAGMENT_UNIFORM_VECTORS: kotlin.Int
public final fun <get-MAX_FRAGMENT_UNIFORM_VECTORS>(): kotlin.Int
public final val MAX_RENDERBUFFER_SIZE: kotlin.Int
public final fun <get-MAX_RENDERBUFFER_SIZE>(): kotlin.Int
public final val MAX_TEXTURE_IMAGE_UNITS: kotlin.Int
public final fun <get-MAX_TEXTURE_IMAGE_UNITS>(): kotlin.Int
public final val MAX_TEXTURE_SIZE: kotlin.Int
public final fun <get-MAX_TEXTURE_SIZE>(): kotlin.Int
public final val MAX_VARYING_VECTORS: kotlin.Int
public final fun <get-MAX_VARYING_VECTORS>(): kotlin.Int
public final val MAX_VERTEX_ATTRIBS: kotlin.Int
public final fun <get-MAX_VERTEX_ATTRIBS>(): kotlin.Int
public final val MAX_VERTEX_TEXTURE_IMAGE_UNITS: kotlin.Int
public final fun <get-MAX_VERTEX_TEXTURE_IMAGE_UNITS>(): kotlin.Int
public final val MAX_VERTEX_UNIFORM_VECTORS: kotlin.Int
public final fun <get-MAX_VERTEX_UNIFORM_VECTORS>(): kotlin.Int
public final val MAX_VIEWPORT_DIMS: kotlin.Int
public final fun <get-MAX_VIEWPORT_DIMS>(): kotlin.Int
public final val MEDIUM_FLOAT: kotlin.Int
public final fun <get-MEDIUM_FLOAT>(): kotlin.Int
public final val MEDIUM_INT: kotlin.Int
public final fun <get-MEDIUM_INT>(): kotlin.Int
public final val MIRRORED_REPEAT: kotlin.Int
public final fun <get-MIRRORED_REPEAT>(): kotlin.Int
public final val NEAREST: kotlin.Int
public final fun <get-NEAREST>(): kotlin.Int
public final val NEAREST_MIPMAP_LINEAR: kotlin.Int
public final fun <get-NEAREST_MIPMAP_LINEAR>(): kotlin.Int
public final val NEAREST_MIPMAP_NEAREST: kotlin.Int
public final fun <get-NEAREST_MIPMAP_NEAREST>(): kotlin.Int
public final val NEVER: kotlin.Int
public final fun <get-NEVER>(): kotlin.Int
public final val NICEST: kotlin.Int
public final fun <get-NICEST>(): kotlin.Int
public final val NONE: kotlin.Int
public final fun <get-NONE>(): kotlin.Int
public final val NOTEQUAL: kotlin.Int
public final fun <get-NOTEQUAL>(): kotlin.Int
public final val NO_ERROR: kotlin.Int
public final fun <get-NO_ERROR>(): kotlin.Int
public final val ONE: kotlin.Int
public final fun <get-ONE>(): kotlin.Int
public final val ONE_MINUS_CONSTANT_ALPHA: kotlin.Int
public final fun <get-ONE_MINUS_CONSTANT_ALPHA>(): kotlin.Int
public final val ONE_MINUS_CONSTANT_COLOR: kotlin.Int
public final fun <get-ONE_MINUS_CONSTANT_COLOR>(): kotlin.Int
public final val ONE_MINUS_DST_ALPHA: kotlin.Int
public final fun <get-ONE_MINUS_DST_ALPHA>(): kotlin.Int
public final val ONE_MINUS_DST_COLOR: kotlin.Int
public final fun <get-ONE_MINUS_DST_COLOR>(): kotlin.Int
public final val ONE_MINUS_SRC_ALPHA: kotlin.Int
public final fun <get-ONE_MINUS_SRC_ALPHA>(): kotlin.Int
public final val ONE_MINUS_SRC_COLOR: kotlin.Int
public final fun <get-ONE_MINUS_SRC_COLOR>(): kotlin.Int
public final val OUT_OF_MEMORY: kotlin.Int
public final fun <get-OUT_OF_MEMORY>(): kotlin.Int
public final val PACK_ALIGNMENT: kotlin.Int
public final fun <get-PACK_ALIGNMENT>(): kotlin.Int
public final val POINTS: kotlin.Int
public final fun <get-POINTS>(): kotlin.Int
public final val POLYGON_OFFSET_FACTOR: kotlin.Int
public final fun <get-POLYGON_OFFSET_FACTOR>(): kotlin.Int
public final val POLYGON_OFFSET_FILL: kotlin.Int
public final fun <get-POLYGON_OFFSET_FILL>(): kotlin.Int
public final val POLYGON_OFFSET_UNITS: kotlin.Int
public final fun <get-POLYGON_OFFSET_UNITS>(): kotlin.Int
public final val RED_BITS: kotlin.Int
public final fun <get-RED_BITS>(): kotlin.Int
public final val RENDERBUFFER: kotlin.Int
public final fun <get-RENDERBUFFER>(): kotlin.Int
public final val RENDERBUFFER_ALPHA_SIZE: kotlin.Int
public final fun <get-RENDERBUFFER_ALPHA_SIZE>(): kotlin.Int
public final val RENDERBUFFER_BINDING: kotlin.Int
public final fun <get-RENDERBUFFER_BINDING>(): kotlin.Int
public final val RENDERBUFFER_BLUE_SIZE: kotlin.Int
public final fun <get-RENDERBUFFER_BLUE_SIZE>(): kotlin.Int
public final val RENDERBUFFER_DEPTH_SIZE: kotlin.Int
public final fun <get-RENDERBUFFER_DEPTH_SIZE>(): kotlin.Int
public final val RENDERBUFFER_GREEN_SIZE: kotlin.Int
public final fun <get-RENDERBUFFER_GREEN_SIZE>(): kotlin.Int
public final val RENDERBUFFER_HEIGHT: kotlin.Int
public final fun <get-RENDERBUFFER_HEIGHT>(): kotlin.Int
public final val RENDERBUFFER_INTERNAL_FORMAT: kotlin.Int
public final fun <get-RENDERBUFFER_INTERNAL_FORMAT>(): kotlin.Int
public final val RENDERBUFFER_RED_SIZE: kotlin.Int
public final fun <get-RENDERBUFFER_RED_SIZE>(): kotlin.Int
public final val RENDERBUFFER_STENCIL_SIZE: kotlin.Int
public final fun <get-RENDERBUFFER_STENCIL_SIZE>(): kotlin.Int
public final val RENDERBUFFER_WIDTH: kotlin.Int
public final fun <get-RENDERBUFFER_WIDTH>(): kotlin.Int
public final val RENDERER: kotlin.Int
public final fun <get-RENDERER>(): kotlin.Int
public final val REPEAT: kotlin.Int
public final fun <get-REPEAT>(): kotlin.Int
public final val REPLACE: kotlin.Int
public final fun <get-REPLACE>(): kotlin.Int
public final val RGB: kotlin.Int
public final fun <get-RGB>(): kotlin.Int
public final val RGB565: kotlin.Int
public final fun <get-RGB565>(): kotlin.Int
public final val RGB5_A1: kotlin.Int
public final fun <get-RGB5_A1>(): kotlin.Int
public final val RGBA: kotlin.Int
public final fun <get-RGBA>(): kotlin.Int
public final val RGBA4: kotlin.Int
public final fun <get-RGBA4>(): kotlin.Int
public final val SAMPLER_2D: kotlin.Int
public final fun <get-SAMPLER_2D>(): kotlin.Int
public final val SAMPLER_CUBE: kotlin.Int
public final fun <get-SAMPLER_CUBE>(): kotlin.Int
public final val SAMPLES: kotlin.Int
public final fun <get-SAMPLES>(): kotlin.Int
public final val SAMPLE_ALPHA_TO_COVERAGE: kotlin.Int
public final fun <get-SAMPLE_ALPHA_TO_COVERAGE>(): kotlin.Int
public final val SAMPLE_BUFFERS: kotlin.Int
public final fun <get-SAMPLE_BUFFERS>(): kotlin.Int
public final val SAMPLE_COVERAGE: kotlin.Int
public final fun <get-SAMPLE_COVERAGE>(): kotlin.Int
public final val SAMPLE_COVERAGE_INVERT: kotlin.Int
public final fun <get-SAMPLE_COVERAGE_INVERT>(): kotlin.Int
public final val SAMPLE_COVERAGE_VALUE: kotlin.Int
public final fun <get-SAMPLE_COVERAGE_VALUE>(): kotlin.Int
public final val SCISSOR_BOX: kotlin.Int
public final fun <get-SCISSOR_BOX>(): kotlin.Int
public final val SCISSOR_TEST: kotlin.Int
public final fun <get-SCISSOR_TEST>(): kotlin.Int
public final val SHADER_TYPE: kotlin.Int
public final fun <get-SHADER_TYPE>(): kotlin.Int
public final val SHADING_LANGUAGE_VERSION: kotlin.Int
public final fun <get-SHADING_LANGUAGE_VERSION>(): kotlin.Int
public final val SHORT: kotlin.Int
public final fun <get-SHORT>(): kotlin.Int
public final val SRC_ALPHA: kotlin.Int
public final fun <get-SRC_ALPHA>(): kotlin.Int
public final val SRC_ALPHA_SATURATE: kotlin.Int
public final fun <get-SRC_ALPHA_SATURATE>(): kotlin.Int
public final val SRC_COLOR: kotlin.Int
public final fun <get-SRC_COLOR>(): kotlin.Int
public final val STATIC_DRAW: kotlin.Int
public final fun <get-STATIC_DRAW>(): kotlin.Int
public final val STENCIL_ATTACHMENT: kotlin.Int
public final fun <get-STENCIL_ATTACHMENT>(): kotlin.Int
public final val STENCIL_BACK_FAIL: kotlin.Int
public final fun <get-STENCIL_BACK_FAIL>(): kotlin.Int
public final val STENCIL_BACK_FUNC: kotlin.Int
public final fun <get-STENCIL_BACK_FUNC>(): kotlin.Int
public final val STENCIL_BACK_PASS_DEPTH_FAIL: kotlin.Int
public final fun <get-STENCIL_BACK_PASS_DEPTH_FAIL>(): kotlin.Int
public final val STENCIL_BACK_PASS_DEPTH_PASS: kotlin.Int
public final fun <get-STENCIL_BACK_PASS_DEPTH_PASS>(): kotlin.Int
public final val STENCIL_BACK_REF: kotlin.Int
public final fun <get-STENCIL_BACK_REF>(): kotlin.Int
public final val STENCIL_BACK_VALUE_MASK: kotlin.Int
public final fun <get-STENCIL_BACK_VALUE_MASK>(): kotlin.Int
public final val STENCIL_BACK_WRITEMASK: kotlin.Int
public final fun <get-STENCIL_BACK_WRITEMASK>(): kotlin.Int
public final val STENCIL_BITS: kotlin.Int
public final fun <get-STENCIL_BITS>(): kotlin.Int
public final val STENCIL_BUFFER_BIT: kotlin.Int
public final fun <get-STENCIL_BUFFER_BIT>(): kotlin.Int
public final val STENCIL_CLEAR_VALUE: kotlin.Int
public final fun <get-STENCIL_CLEAR_VALUE>(): kotlin.Int
public final val STENCIL_FAIL: kotlin.Int
public final fun <get-STENCIL_FAIL>(): kotlin.Int
public final val STENCIL_FUNC: kotlin.Int
public final fun <get-STENCIL_FUNC>(): kotlin.Int
public final val STENCIL_INDEX: kotlin.Int
public final fun <get-STENCIL_INDEX>(): kotlin.Int
public final val STENCIL_INDEX8: kotlin.Int
public final fun <get-STENCIL_INDEX8>(): kotlin.Int
public final val STENCIL_PASS_DEPTH_FAIL: kotlin.Int
public final fun <get-STENCIL_PASS_DEPTH_FAIL>(): kotlin.Int
public final val STENCIL_PASS_DEPTH_PASS: kotlin.Int
public final fun <get-STENCIL_PASS_DEPTH_PASS>(): kotlin.Int
public final val STENCIL_REF: kotlin.Int
public final fun <get-STENCIL_REF>(): kotlin.Int
public final val STENCIL_TEST: kotlin.Int
public final fun <get-STENCIL_TEST>(): kotlin.Int
public final val STENCIL_VALUE_MASK: kotlin.Int
public final fun <get-STENCIL_VALUE_MASK>(): kotlin.Int
public final val STENCIL_WRITEMASK: kotlin.Int
public final fun <get-STENCIL_WRITEMASK>(): kotlin.Int
public final val STREAM_DRAW: kotlin.Int
public final fun <get-STREAM_DRAW>(): kotlin.Int
public final val SUBPIXEL_BITS: kotlin.Int
public final fun <get-SUBPIXEL_BITS>(): kotlin.Int
public final val TEXTURE: kotlin.Int
public final fun <get-TEXTURE>(): kotlin.Int
public final val TEXTURE0: kotlin.Int
public final fun <get-TEXTURE0>(): kotlin.Int
public final val TEXTURE1: kotlin.Int
public final fun <get-TEXTURE1>(): kotlin.Int
public final val TEXTURE10: kotlin.Int
public final fun <get-TEXTURE10>(): kotlin.Int
public final val TEXTURE11: kotlin.Int
public final fun <get-TEXTURE11>(): kotlin.Int
public final val TEXTURE12: kotlin.Int
public final fun <get-TEXTURE12>(): kotlin.Int
public final val TEXTURE13: kotlin.Int
public final fun <get-TEXTURE13>(): kotlin.Int
public final val TEXTURE14: kotlin.Int
public final fun <get-TEXTURE14>(): kotlin.Int
public final val TEXTURE15: kotlin.Int
public final fun <get-TEXTURE15>(): kotlin.Int
public final val TEXTURE16: kotlin.Int
public final fun <get-TEXTURE16>(): kotlin.Int
public final val TEXTURE17: kotlin.Int
public final fun <get-TEXTURE17>(): kotlin.Int
public final val TEXTURE18: kotlin.Int
public final fun <get-TEXTURE18>(): kotlin.Int
public final val TEXTURE19: kotlin.Int
public final fun <get-TEXTURE19>(): kotlin.Int
public final val TEXTURE2: kotlin.Int
public final fun <get-TEXTURE2>(): kotlin.Int
public final val TEXTURE20: kotlin.Int
public final fun <get-TEXTURE20>(): kotlin.Int
public final val TEXTURE21: kotlin.Int
public final fun <get-TEXTURE21>(): kotlin.Int
public final val TEXTURE22: kotlin.Int
public final fun <get-TEXTURE22>(): kotlin.Int
public final val TEXTURE23: kotlin.Int
public final fun <get-TEXTURE23>(): kotlin.Int
public final val TEXTURE24: kotlin.Int
public final fun <get-TEXTURE24>(): kotlin.Int
public final val TEXTURE25: kotlin.Int
public final fun <get-TEXTURE25>(): kotlin.Int
public final val TEXTURE26: kotlin.Int
public final fun <get-TEXTURE26>(): kotlin.Int
public final val TEXTURE27: kotlin.Int
public final fun <get-TEXTURE27>(): kotlin.Int
public final val TEXTURE28: kotlin.Int
public final fun <get-TEXTURE28>(): kotlin.Int
public final val TEXTURE29: kotlin.Int
public final fun <get-TEXTURE29>(): kotlin.Int
public final val TEXTURE3: kotlin.Int
public final fun <get-TEXTURE3>(): kotlin.Int
public final val TEXTURE30: kotlin.Int
public final fun <get-TEXTURE30>(): kotlin.Int
public final val TEXTURE31: kotlin.Int
public final fun <get-TEXTURE31>(): kotlin.Int
public final val TEXTURE4: kotlin.Int
public final fun <get-TEXTURE4>(): kotlin.Int
public final val TEXTURE5: kotlin.Int
public final fun <get-TEXTURE5>(): kotlin.Int
public final val TEXTURE6: kotlin.Int
public final fun <get-TEXTURE6>(): kotlin.Int
public final val TEXTURE7: kotlin.Int
public final fun <get-TEXTURE7>(): kotlin.Int
public final val TEXTURE8: kotlin.Int
public final fun <get-TEXTURE8>(): kotlin.Int
public final val TEXTURE9: kotlin.Int
public final fun <get-TEXTURE9>(): kotlin.Int
public final val TEXTURE_2D: kotlin.Int
public final fun <get-TEXTURE_2D>(): kotlin.Int
public final val TEXTURE_BINDING_2D: kotlin.Int
public final fun <get-TEXTURE_BINDING_2D>(): kotlin.Int
public final val TEXTURE_BINDING_CUBE_MAP: kotlin.Int
public final fun <get-TEXTURE_BINDING_CUBE_MAP>(): kotlin.Int
public final val TEXTURE_CUBE_MAP: kotlin.Int
public final fun <get-TEXTURE_CUBE_MAP>(): kotlin.Int
public final val TEXTURE_CUBE_MAP_NEGATIVE_X: kotlin.Int
public final fun <get-TEXTURE_CUBE_MAP_NEGATIVE_X>(): kotlin.Int
public final val TEXTURE_CUBE_MAP_NEGATIVE_Y: kotlin.Int
public final fun <get-TEXTURE_CUBE_MAP_NEGATIVE_Y>(): kotlin.Int
public final val TEXTURE_CUBE_MAP_NEGATIVE_Z: kotlin.Int
public final fun <get-TEXTURE_CUBE_MAP_NEGATIVE_Z>(): kotlin.Int
public final val TEXTURE_CUBE_MAP_POSITIVE_X: kotlin.Int
public final fun <get-TEXTURE_CUBE_MAP_POSITIVE_X>(): kotlin.Int
public final val TEXTURE_CUBE_MAP_POSITIVE_Y: kotlin.Int
public final fun <get-TEXTURE_CUBE_MAP_POSITIVE_Y>(): kotlin.Int
public final val TEXTURE_CUBE_MAP_POSITIVE_Z: kotlin.Int
public final fun <get-TEXTURE_CUBE_MAP_POSITIVE_Z>(): kotlin.Int
public final val TEXTURE_MAG_FILTER: kotlin.Int
public final fun <get-TEXTURE_MAG_FILTER>(): kotlin.Int
public final val TEXTURE_MIN_FILTER: kotlin.Int
public final fun <get-TEXTURE_MIN_FILTER>(): kotlin.Int
public final val TEXTURE_WRAP_S: kotlin.Int
public final fun <get-TEXTURE_WRAP_S>(): kotlin.Int
public final val TEXTURE_WRAP_T: kotlin.Int
public final fun <get-TEXTURE_WRAP_T>(): kotlin.Int
public final val TRIANGLES: kotlin.Int
public final fun <get-TRIANGLES>(): kotlin.Int
public final val TRIANGLE_FAN: kotlin.Int
public final fun <get-TRIANGLE_FAN>(): kotlin.Int
public final val TRIANGLE_STRIP: kotlin.Int
public final fun <get-TRIANGLE_STRIP>(): kotlin.Int
public final val UNPACK_ALIGNMENT: kotlin.Int
public final fun <get-UNPACK_ALIGNMENT>(): kotlin.Int
public final val UNPACK_COLORSPACE_CONVERSION_WEBGL: kotlin.Int
public final fun <get-UNPACK_COLORSPACE_CONVERSION_WEBGL>(): kotlin.Int
public final val UNPACK_FLIP_Y_WEBGL: kotlin.Int
public final fun <get-UNPACK_FLIP_Y_WEBGL>(): kotlin.Int
public final val UNPACK_PREMULTIPLY_ALPHA_WEBGL: kotlin.Int
public final fun <get-UNPACK_PREMULTIPLY_ALPHA_WEBGL>(): kotlin.Int
public final val UNSIGNED_BYTE: kotlin.Int
public final fun <get-UNSIGNED_BYTE>(): kotlin.Int
public final val UNSIGNED_INT: kotlin.Int
public final fun <get-UNSIGNED_INT>(): kotlin.Int
public final val UNSIGNED_SHORT: kotlin.Int
public final fun <get-UNSIGNED_SHORT>(): kotlin.Int
public final val UNSIGNED_SHORT_4_4_4_4: kotlin.Int
public final fun <get-UNSIGNED_SHORT_4_4_4_4>(): kotlin.Int
public final val UNSIGNED_SHORT_5_5_5_1: kotlin.Int
public final fun <get-UNSIGNED_SHORT_5_5_5_1>(): kotlin.Int
public final val UNSIGNED_SHORT_5_6_5: kotlin.Int
public final fun <get-UNSIGNED_SHORT_5_6_5>(): kotlin.Int
public final val VALIDATE_STATUS: kotlin.Int
public final fun <get-VALIDATE_STATUS>(): kotlin.Int
public final val VENDOR: kotlin.Int
public final fun <get-VENDOR>(): kotlin.Int
public final val VERSION: kotlin.Int
public final fun <get-VERSION>(): kotlin.Int
public final val VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: kotlin.Int
public final fun <get-VERTEX_ATTRIB_ARRAY_BUFFER_BINDING>(): kotlin.Int
public final val VERTEX_ATTRIB_ARRAY_ENABLED: kotlin.Int
public final fun <get-VERTEX_ATTRIB_ARRAY_ENABLED>(): kotlin.Int
public final val VERTEX_ATTRIB_ARRAY_NORMALIZED: kotlin.Int
public final fun <get-VERTEX_ATTRIB_ARRAY_NORMALIZED>(): kotlin.Int
public final val VERTEX_ATTRIB_ARRAY_POINTER: kotlin.Int
public final fun <get-VERTEX_ATTRIB_ARRAY_POINTER>(): kotlin.Int
public final val VERTEX_ATTRIB_ARRAY_SIZE: kotlin.Int
public final fun <get-VERTEX_ATTRIB_ARRAY_SIZE>(): kotlin.Int
public final val VERTEX_ATTRIB_ARRAY_STRIDE: kotlin.Int
public final fun <get-VERTEX_ATTRIB_ARRAY_STRIDE>(): kotlin.Int
public final val VERTEX_ATTRIB_ARRAY_TYPE: kotlin.Int
public final fun <get-VERTEX_ATTRIB_ARRAY_TYPE>(): kotlin.Int
public final val VERTEX_SHADER: kotlin.Int
public final fun <get-VERTEX_SHADER>(): kotlin.Int
public final val VIEWPORT: kotlin.Int
public final fun <get-VIEWPORT>(): kotlin.Int
public final val ZERO: kotlin.Int
public final fun <get-ZERO>(): kotlin.Int
}
}
public external interface WebGLRenderingContextBase {
public abstract val canvas: org.w3c.dom.HTMLCanvasElement
public abstract fun <get-canvas>(): org.w3c.dom.HTMLCanvasElement
public abstract val drawingBufferHeight: kotlin.Int
public abstract fun <get-drawingBufferHeight>(): kotlin.Int
public abstract val drawingBufferWidth: kotlin.Int
public abstract fun <get-drawingBufferWidth>(): kotlin.Int
public abstract fun activeTexture(/*0*/ texture: kotlin.Int): kotlin.Unit
public abstract fun attachShader(/*0*/ program: org.khronos.webgl.WebGLProgram?, /*1*/ shader: org.khronos.webgl.WebGLShader?): kotlin.Unit
public abstract fun bindAttribLocation(/*0*/ program: org.khronos.webgl.WebGLProgram?, /*1*/ index: kotlin.Int, /*2*/ name: kotlin.String): kotlin.Unit
public abstract fun bindBuffer(/*0*/ target: kotlin.Int, /*1*/ buffer: org.khronos.webgl.WebGLBuffer?): kotlin.Unit
public abstract fun bindFramebuffer(/*0*/ target: kotlin.Int, /*1*/ framebuffer: org.khronos.webgl.WebGLFramebuffer?): kotlin.Unit
public abstract fun bindRenderbuffer(/*0*/ target: kotlin.Int, /*1*/ renderbuffer: org.khronos.webgl.WebGLRenderbuffer?): kotlin.Unit
public abstract fun bindTexture(/*0*/ target: kotlin.Int, /*1*/ texture: org.khronos.webgl.WebGLTexture?): kotlin.Unit
public abstract fun blendColor(/*0*/ red: kotlin.Float, /*1*/ green: kotlin.Float, /*2*/ blue: kotlin.Float, /*3*/ alpha: kotlin.Float): kotlin.Unit
public abstract fun blendEquation(/*0*/ mode: kotlin.Int): kotlin.Unit
public abstract fun blendEquationSeparate(/*0*/ modeRGB: kotlin.Int, /*1*/ modeAlpha: kotlin.Int): kotlin.Unit
public abstract fun blendFunc(/*0*/ sfactor: kotlin.Int, /*1*/ dfactor: kotlin.Int): kotlin.Unit
public abstract fun blendFuncSeparate(/*0*/ srcRGB: kotlin.Int, /*1*/ dstRGB: kotlin.Int, /*2*/ srcAlpha: kotlin.Int, /*3*/ dstAlpha: kotlin.Int): kotlin.Unit
public abstract fun bufferData(/*0*/ target: kotlin.Int, /*1*/ size: kotlin.Int, /*2*/ usage: kotlin.Int): kotlin.Unit
public abstract fun bufferData(/*0*/ target: kotlin.Int, /*1*/ data: org.khronos.webgl.BufferDataSource?, /*2*/ usage: kotlin.Int): kotlin.Unit
public abstract fun bufferSubData(/*0*/ target: kotlin.Int, /*1*/ offset: kotlin.Int, /*2*/ data: org.khronos.webgl.BufferDataSource?): kotlin.Unit
public abstract fun checkFramebufferStatus(/*0*/ target: kotlin.Int): kotlin.Int
public abstract fun clear(/*0*/ mask: kotlin.Int): kotlin.Unit
public abstract fun clearColor(/*0*/ red: kotlin.Float, /*1*/ green: kotlin.Float, /*2*/ blue: kotlin.Float, /*3*/ alpha: kotlin.Float): kotlin.Unit
public abstract fun clearDepth(/*0*/ depth: kotlin.Float): kotlin.Unit
public abstract fun clearStencil(/*0*/ s: kotlin.Int): kotlin.Unit
public abstract fun colorMask(/*0*/ red: kotlin.Boolean, /*1*/ green: kotlin.Boolean, /*2*/ blue: kotlin.Boolean, /*3*/ alpha: kotlin.Boolean): kotlin.Unit
public abstract fun compileShader(/*0*/ shader: org.khronos.webgl.WebGLShader?): kotlin.Unit
public abstract fun compressedTexImage2D(/*0*/ target: kotlin.Int, /*1*/ level: kotlin.Int, /*2*/ internalformat: kotlin.Int, /*3*/ width: kotlin.Int, /*4*/ height: kotlin.Int, /*5*/ border: kotlin.Int, /*6*/ data: org.khronos.webgl.ArrayBufferView): kotlin.Unit
public abstract fun compressedTexSubImage2D(/*0*/ target: kotlin.Int, /*1*/ level: kotlin.Int, /*2*/ xoffset: kotlin.Int, /*3*/ yoffset: kotlin.Int, /*4*/ width: kotlin.Int, /*5*/ height: kotlin.Int, /*6*/ format: kotlin.Int, /*7*/ data: org.khronos.webgl.ArrayBufferView): kotlin.Unit
public abstract fun copyTexImage2D(/*0*/ target: kotlin.Int, /*1*/ level: kotlin.Int, /*2*/ internalformat: kotlin.Int, /*3*/ x: kotlin.Int, /*4*/ y: kotlin.Int, /*5*/ width: kotlin.Int, /*6*/ height: kotlin.Int, /*7*/ border: kotlin.Int): kotlin.Unit
public abstract fun copyTexSubImage2D(/*0*/ target: kotlin.Int, /*1*/ level: kotlin.Int, /*2*/ xoffset: kotlin.Int, /*3*/ yoffset: kotlin.Int, /*4*/ x: kotlin.Int, /*5*/ y: kotlin.Int, /*6*/ width: kotlin.Int, /*7*/ height: kotlin.Int): kotlin.Unit
public abstract fun createBuffer(): org.khronos.webgl.WebGLBuffer?
public abstract fun createFramebuffer(): org.khronos.webgl.WebGLFramebuffer?
public abstract fun createProgram(): org.khronos.webgl.WebGLProgram?
public abstract fun createRenderbuffer(): org.khronos.webgl.WebGLRenderbuffer?
public abstract fun createShader(/*0*/ type: kotlin.Int): org.khronos.webgl.WebGLShader?
public abstract fun createTexture(): org.khronos.webgl.WebGLTexture?
public abstract fun cullFace(/*0*/ mode: kotlin.Int): kotlin.Unit
public abstract fun deleteBuffer(/*0*/ buffer: org.khronos.webgl.WebGLBuffer?): kotlin.Unit
public abstract fun deleteFramebuffer(/*0*/ framebuffer: org.khronos.webgl.WebGLFramebuffer?): kotlin.Unit
public abstract fun deleteProgram(/*0*/ program: org.khronos.webgl.WebGLProgram?): kotlin.Unit
public abstract fun deleteRenderbuffer(/*0*/ renderbuffer: org.khronos.webgl.WebGLRenderbuffer?): kotlin.Unit
public abstract fun deleteShader(/*0*/ shader: org.khronos.webgl.WebGLShader?): kotlin.Unit
public abstract fun deleteTexture(/*0*/ texture: org.khronos.webgl.WebGLTexture?): kotlin.Unit
public abstract fun depthFunc(/*0*/ func: kotlin.Int): kotlin.Unit
public abstract fun depthMask(/*0*/ flag: kotlin.Boolean): kotlin.Unit
public abstract fun depthRange(/*0*/ zNear: kotlin.Float, /*1*/ zFar: kotlin.Float): kotlin.Unit
public abstract fun detachShader(/*0*/ program: org.khronos.webgl.WebGLProgram?, /*1*/ shader: org.khronos.webgl.WebGLShader?): kotlin.Unit
public abstract fun disable(/*0*/ cap: kotlin.Int): kotlin.Unit
public abstract fun disableVertexAttribArray(/*0*/ index: kotlin.Int): kotlin.Unit
public abstract fun drawArrays(/*0*/ mode: kotlin.Int, /*1*/ first: kotlin.Int, /*2*/ count: kotlin.Int): kotlin.Unit
public abstract fun drawElements(/*0*/ mode: kotlin.Int, /*1*/ count: kotlin.Int, /*2*/ type: kotlin.Int, /*3*/ offset: kotlin.Int): kotlin.Unit
public abstract fun enable(/*0*/ cap: kotlin.Int): kotlin.Unit
public abstract fun enableVertexAttribArray(/*0*/ index: kotlin.Int): kotlin.Unit
public abstract fun finish(): kotlin.Unit
public abstract fun flush(): kotlin.Unit
public abstract fun framebufferRenderbuffer(/*0*/ target: kotlin.Int, /*1*/ attachment: kotlin.Int, /*2*/ renderbuffertarget: kotlin.Int, /*3*/ renderbuffer: org.khronos.webgl.WebGLRenderbuffer?): kotlin.Unit
public abstract fun framebufferTexture2D(/*0*/ target: kotlin.Int, /*1*/ attachment: kotlin.Int, /*2*/ textarget: kotlin.Int, /*3*/ texture: org.khronos.webgl.WebGLTexture?, /*4*/ level: kotlin.Int): kotlin.Unit
public abstract fun frontFace(/*0*/ mode: kotlin.Int): kotlin.Unit
public abstract fun generateMipmap(/*0*/ target: kotlin.Int): kotlin.Unit
public abstract fun getActiveAttrib(/*0*/ program: org.khronos.webgl.WebGLProgram?, /*1*/ index: kotlin.Int): org.khronos.webgl.WebGLActiveInfo?
public abstract fun getActiveUniform(/*0*/ program: org.khronos.webgl.WebGLProgram?, /*1*/ index: kotlin.Int): org.khronos.webgl.WebGLActiveInfo?
public abstract fun getAttachedShaders(/*0*/ program: org.khronos.webgl.WebGLProgram?): kotlin.Array<org.khronos.webgl.WebGLShader>?
public abstract fun getAttribLocation(/*0*/ program: org.khronos.webgl.WebGLProgram?, /*1*/ name: kotlin.String): kotlin.Int
public abstract fun getBufferParameter(/*0*/ target: kotlin.Int, /*1*/ pname: kotlin.Int): kotlin.Any?
public abstract fun getContextAttributes(): org.khronos.webgl.WebGLContextAttributes?
public abstract fun getError(): kotlin.Int
public abstract fun getExtension(/*0*/ name: kotlin.String): dynamic
public abstract fun getFramebufferAttachmentParameter(/*0*/ target: kotlin.Int, /*1*/ attachment: kotlin.Int, /*2*/ pname: kotlin.Int): kotlin.Any?
public abstract fun getParameter(/*0*/ pname: kotlin.Int): kotlin.Any?
public abstract fun getProgramInfoLog(/*0*/ program: org.khronos.webgl.WebGLProgram?): kotlin.String?
public abstract fun getProgramParameter(/*0*/ program: org.khronos.webgl.WebGLProgram?, /*1*/ pname: kotlin.Int): kotlin.Any?
public abstract fun getRenderbufferParameter(/*0*/ target: kotlin.Int, /*1*/ pname: kotlin.Int): kotlin.Any?
public abstract fun getShaderInfoLog(/*0*/ shader: org.khronos.webgl.WebGLShader?): kotlin.String?
public abstract fun getShaderParameter(/*0*/ shader: org.khronos.webgl.WebGLShader?, /*1*/ pname: kotlin.Int): kotlin.Any?
public abstract fun getShaderPrecisionFormat(/*0*/ shadertype: kotlin.Int, /*1*/ precisiontype: kotlin.Int): org.khronos.webgl.WebGLShaderPrecisionFormat?
public abstract fun getShaderSource(/*0*/ shader: org.khronos.webgl.WebGLShader?): kotlin.String?
public abstract fun getSupportedExtensions(): kotlin.Array<kotlin.String>?
public abstract fun getTexParameter(/*0*/ target: kotlin.Int, /*1*/ pname: kotlin.Int): kotlin.Any?
public abstract fun getUniform(/*0*/ program: org.khronos.webgl.WebGLProgram?, /*1*/ location: org.khronos.webgl.WebGLUniformLocation?): kotlin.Any?
public abstract fun getUniformLocation(/*0*/ program: org.khronos.webgl.WebGLProgram?, /*1*/ name: kotlin.String): org.khronos.webgl.WebGLUniformLocation?
public abstract fun getVertexAttrib(/*0*/ index: kotlin.Int, /*1*/ pname: kotlin.Int): kotlin.Any?
public abstract fun getVertexAttribOffset(/*0*/ index: kotlin.Int, /*1*/ pname: kotlin.Int): kotlin.Int
public abstract fun hint(/*0*/ target: kotlin.Int, /*1*/ mode: kotlin.Int): kotlin.Unit
public abstract fun isBuffer(/*0*/ buffer: org.khronos.webgl.WebGLBuffer?): kotlin.Boolean
public abstract fun isContextLost(): kotlin.Boolean
public abstract fun isEnabled(/*0*/ cap: kotlin.Int): kotlin.Boolean
public abstract fun isFramebuffer(/*0*/ framebuffer: org.khronos.webgl.WebGLFramebuffer?): kotlin.Boolean
public abstract fun isProgram(/*0*/ program: org.khronos.webgl.WebGLProgram?): kotlin.Boolean
public abstract fun isRenderbuffer(/*0*/ renderbuffer: org.khronos.webgl.WebGLRenderbuffer?): kotlin.Boolean
public abstract fun isShader(/*0*/ shader: org.khronos.webgl.WebGLShader?): kotlin.Boolean
public abstract fun isTexture(/*0*/ texture: org.khronos.webgl.WebGLTexture?): kotlin.Boolean
public abstract fun lineWidth(/*0*/ width: kotlin.Float): kotlin.Unit
public abstract fun linkProgram(/*0*/ program: org.khronos.webgl.WebGLProgram?): kotlin.Unit
public abstract fun pixelStorei(/*0*/ pname: kotlin.Int, /*1*/ param: kotlin.Int): kotlin.Unit
public abstract fun polygonOffset(/*0*/ factor: kotlin.Float, /*1*/ units: kotlin.Float): kotlin.Unit
public abstract fun readPixels(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.Int, /*2*/ width: kotlin.Int, /*3*/ height: kotlin.Int, /*4*/ format: kotlin.Int, /*5*/ type: kotlin.Int, /*6*/ pixels: org.khronos.webgl.ArrayBufferView?): kotlin.Unit
public abstract fun renderbufferStorage(/*0*/ target: kotlin.Int, /*1*/ internalformat: kotlin.Int, /*2*/ width: kotlin.Int, /*3*/ height: kotlin.Int): kotlin.Unit
public abstract fun sampleCoverage(/*0*/ value: kotlin.Float, /*1*/ invert: kotlin.Boolean): kotlin.Unit
public abstract fun scissor(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.Int, /*2*/ width: kotlin.Int, /*3*/ height: kotlin.Int): kotlin.Unit
public abstract fun shaderSource(/*0*/ shader: org.khronos.webgl.WebGLShader?, /*1*/ source: kotlin.String): kotlin.Unit
public abstract fun stencilFunc(/*0*/ func: kotlin.Int, /*1*/ ref: kotlin.Int, /*2*/ mask: kotlin.Int): kotlin.Unit
public abstract fun stencilFuncSeparate(/*0*/ face: kotlin.Int, /*1*/ func: kotlin.Int, /*2*/ ref: kotlin.Int, /*3*/ mask: kotlin.Int): kotlin.Unit
public abstract fun stencilMask(/*0*/ mask: kotlin.Int): kotlin.Unit
public abstract fun stencilMaskSeparate(/*0*/ face: kotlin.Int, /*1*/ mask: kotlin.Int): kotlin.Unit
public abstract fun stencilOp(/*0*/ fail: kotlin.Int, /*1*/ zfail: kotlin.Int, /*2*/ zpass: kotlin.Int): kotlin.Unit
public abstract fun stencilOpSeparate(/*0*/ face: kotlin.Int, /*1*/ fail: kotlin.Int, /*2*/ zfail: kotlin.Int, /*3*/ zpass: kotlin.Int): kotlin.Unit
public abstract fun texImage2D(/*0*/ target: kotlin.Int, /*1*/ level: kotlin.Int, /*2*/ internalformat: kotlin.Int, /*3*/ width: kotlin.Int, /*4*/ height: kotlin.Int, /*5*/ border: kotlin.Int, /*6*/ format: kotlin.Int, /*7*/ type: kotlin.Int, /*8*/ pixels: org.khronos.webgl.ArrayBufferView?): kotlin.Unit
public abstract fun texImage2D(/*0*/ target: kotlin.Int, /*1*/ level: kotlin.Int, /*2*/ internalformat: kotlin.Int, /*3*/ format: kotlin.Int, /*4*/ type: kotlin.Int, /*5*/ source: org.khronos.webgl.TexImageSource?): kotlin.Unit
public abstract fun texParameterf(/*0*/ target: kotlin.Int, /*1*/ pname: kotlin.Int, /*2*/ param: kotlin.Float): kotlin.Unit
public abstract fun texParameteri(/*0*/ target: kotlin.Int, /*1*/ pname: kotlin.Int, /*2*/ param: kotlin.Int): kotlin.Unit
public abstract fun texSubImage2D(/*0*/ target: kotlin.Int, /*1*/ level: kotlin.Int, /*2*/ xoffset: kotlin.Int, /*3*/ yoffset: kotlin.Int, /*4*/ width: kotlin.Int, /*5*/ height: kotlin.Int, /*6*/ format: kotlin.Int, /*7*/ type: kotlin.Int, /*8*/ pixels: org.khronos.webgl.ArrayBufferView?): kotlin.Unit
public abstract fun texSubImage2D(/*0*/ target: kotlin.Int, /*1*/ level: kotlin.Int, /*2*/ xoffset: kotlin.Int, /*3*/ yoffset: kotlin.Int, /*4*/ format: kotlin.Int, /*5*/ type: kotlin.Int, /*6*/ source: org.khronos.webgl.TexImageSource?): kotlin.Unit
public abstract fun uniform1f(/*0*/ location: org.khronos.webgl.WebGLUniformLocation?, /*1*/ x: kotlin.Float): kotlin.Unit
public abstract fun uniform1fv(/*0*/ location: org.khronos.webgl.WebGLUniformLocation?, /*1*/ v: kotlin.Array<kotlin.Float>): kotlin.Unit
public abstract fun uniform1fv(/*0*/ location: org.khronos.webgl.WebGLUniformLocation?, /*1*/ v: org.khronos.webgl.Float32Array): kotlin.Unit
public abstract fun uniform1i(/*0*/ location: org.khronos.webgl.WebGLUniformLocation?, /*1*/ x: kotlin.Int): kotlin.Unit
public abstract fun uniform1iv(/*0*/ location: org.khronos.webgl.WebGLUniformLocation?, /*1*/ v: kotlin.Array<kotlin.Int>): kotlin.Unit
public abstract fun uniform1iv(/*0*/ location: org.khronos.webgl.WebGLUniformLocation?, /*1*/ v: org.khronos.webgl.Int32Array): kotlin.Unit
public abstract fun uniform2f(/*0*/ location: org.khronos.webgl.WebGLUniformLocation?, /*1*/ x: kotlin.Float, /*2*/ y: kotlin.Float): kotlin.Unit
public abstract fun uniform2fv(/*0*/ location: org.khronos.webgl.WebGLUniformLocation?, /*1*/ v: kotlin.Array<kotlin.Float>): kotlin.Unit
public abstract fun uniform2fv(/*0*/ location: org.khronos.webgl.WebGLUniformLocation?, /*1*/ v: org.khronos.webgl.Float32Array): kotlin.Unit
public abstract fun uniform2i(/*0*/ location: org.khronos.webgl.WebGLUniformLocation?, /*1*/ x: kotlin.Int, /*2*/ y: kotlin.Int): kotlin.Unit
public abstract fun uniform2iv(/*0*/ location: org.khronos.webgl.WebGLUniformLocation?, /*1*/ v: kotlin.Array<kotlin.Int>): kotlin.Unit
public abstract fun uniform2iv(/*0*/ location: org.khronos.webgl.WebGLUniformLocation?, /*1*/ v: org.khronos.webgl.Int32Array): kotlin.Unit
public abstract fun uniform3f(/*0*/ location: org.khronos.webgl.WebGLUniformLocation?, /*1*/ x: kotlin.Float, /*2*/ y: kotlin.Float, /*3*/ z: kotlin.Float): kotlin.Unit
public abstract fun uniform3fv(/*0*/ location: org.khronos.webgl.WebGLUniformLocation?, /*1*/ v: kotlin.Array<kotlin.Float>): kotlin.Unit
public abstract fun uniform3fv(/*0*/ location: org.khronos.webgl.WebGLUniformLocation?, /*1*/ v: org.khronos.webgl.Float32Array): kotlin.Unit
public abstract fun uniform3i(/*0*/ location: org.khronos.webgl.WebGLUniformLocation?, /*1*/ x: kotlin.Int, /*2*/ y: kotlin.Int, /*3*/ z: kotlin.Int): kotlin.Unit
public abstract fun uniform3iv(/*0*/ location: org.khronos.webgl.WebGLUniformLocation?, /*1*/ v: kotlin.Array<kotlin.Int>): kotlin.Unit
public abstract fun uniform3iv(/*0*/ location: org.khronos.webgl.WebGLUniformLocation?, /*1*/ v: org.khronos.webgl.Int32Array): kotlin.Unit
public abstract fun uniform4f(/*0*/ location: org.khronos.webgl.WebGLUniformLocation?, /*1*/ x: kotlin.Float, /*2*/ y: kotlin.Float, /*3*/ z: kotlin.Float, /*4*/ w: kotlin.Float): kotlin.Unit
public abstract fun uniform4fv(/*0*/ location: org.khronos.webgl.WebGLUniformLocation?, /*1*/ v: kotlin.Array<kotlin.Float>): kotlin.Unit
public abstract fun uniform4fv(/*0*/ location: org.khronos.webgl.WebGLUniformLocation?, /*1*/ v: org.khronos.webgl.Float32Array): kotlin.Unit
public abstract fun uniform4i(/*0*/ location: org.khronos.webgl.WebGLUniformLocation?, /*1*/ x: kotlin.Int, /*2*/ y: kotlin.Int, /*3*/ z: kotlin.Int, /*4*/ w: kotlin.Int): kotlin.Unit
public abstract fun uniform4iv(/*0*/ location: org.khronos.webgl.WebGLUniformLocation?, /*1*/ v: kotlin.Array<kotlin.Int>): kotlin.Unit
public abstract fun uniform4iv(/*0*/ location: org.khronos.webgl.WebGLUniformLocation?, /*1*/ v: org.khronos.webgl.Int32Array): kotlin.Unit
public abstract fun uniformMatrix2fv(/*0*/ location: org.khronos.webgl.WebGLUniformLocation?, /*1*/ transpose: kotlin.Boolean, /*2*/ value: kotlin.Array<kotlin.Float>): kotlin.Unit
public abstract fun uniformMatrix2fv(/*0*/ location: org.khronos.webgl.WebGLUniformLocation?, /*1*/ transpose: kotlin.Boolean, /*2*/ value: org.khronos.webgl.Float32Array): kotlin.Unit
public abstract fun uniformMatrix3fv(/*0*/ location: org.khronos.webgl.WebGLUniformLocation?, /*1*/ transpose: kotlin.Boolean, /*2*/ value: kotlin.Array<kotlin.Float>): kotlin.Unit
public abstract fun uniformMatrix3fv(/*0*/ location: org.khronos.webgl.WebGLUniformLocation?, /*1*/ transpose: kotlin.Boolean, /*2*/ value: org.khronos.webgl.Float32Array): kotlin.Unit
public abstract fun uniformMatrix4fv(/*0*/ location: org.khronos.webgl.WebGLUniformLocation?, /*1*/ transpose: kotlin.Boolean, /*2*/ value: kotlin.Array<kotlin.Float>): kotlin.Unit
public abstract fun uniformMatrix4fv(/*0*/ location: org.khronos.webgl.WebGLUniformLocation?, /*1*/ transpose: kotlin.Boolean, /*2*/ value: org.khronos.webgl.Float32Array): kotlin.Unit
public abstract fun useProgram(/*0*/ program: org.khronos.webgl.WebGLProgram?): kotlin.Unit
public abstract fun validateProgram(/*0*/ program: org.khronos.webgl.WebGLProgram?): kotlin.Unit
public abstract fun vertexAttrib1f(/*0*/ index: kotlin.Int, /*1*/ x: kotlin.Float): kotlin.Unit
public abstract fun vertexAttrib1fv(/*0*/ index: kotlin.Int, /*1*/ values: dynamic): kotlin.Unit
public abstract fun vertexAttrib2f(/*0*/ index: kotlin.Int, /*1*/ x: kotlin.Float, /*2*/ y: kotlin.Float): kotlin.Unit
public abstract fun vertexAttrib2fv(/*0*/ index: kotlin.Int, /*1*/ values: dynamic): kotlin.Unit
public abstract fun vertexAttrib3f(/*0*/ index: kotlin.Int, /*1*/ x: kotlin.Float, /*2*/ y: kotlin.Float, /*3*/ z: kotlin.Float): kotlin.Unit
public abstract fun vertexAttrib3fv(/*0*/ index: kotlin.Int, /*1*/ values: dynamic): kotlin.Unit
public abstract fun vertexAttrib4f(/*0*/ index: kotlin.Int, /*1*/ x: kotlin.Float, /*2*/ y: kotlin.Float, /*3*/ z: kotlin.Float, /*4*/ w: kotlin.Float): kotlin.Unit
public abstract fun vertexAttrib4fv(/*0*/ index: kotlin.Int, /*1*/ values: dynamic): kotlin.Unit
public abstract fun vertexAttribPointer(/*0*/ index: kotlin.Int, /*1*/ size: kotlin.Int, /*2*/ type: kotlin.Int, /*3*/ normalized: kotlin.Boolean, /*4*/ stride: kotlin.Int, /*5*/ offset: kotlin.Int): kotlin.Unit
public abstract fun viewport(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.Int, /*2*/ width: kotlin.Int, /*3*/ height: kotlin.Int): kotlin.Unit
public companion object Companion {
public final val ACTIVE_ATTRIBUTES: kotlin.Int
public final fun <get-ACTIVE_ATTRIBUTES>(): kotlin.Int
public final val ACTIVE_TEXTURE: kotlin.Int
public final fun <get-ACTIVE_TEXTURE>(): kotlin.Int
public final val ACTIVE_UNIFORMS: kotlin.Int
public final fun <get-ACTIVE_UNIFORMS>(): kotlin.Int
public final val ALIASED_LINE_WIDTH_RANGE: kotlin.Int
public final fun <get-ALIASED_LINE_WIDTH_RANGE>(): kotlin.Int
public final val ALIASED_POINT_SIZE_RANGE: kotlin.Int
public final fun <get-ALIASED_POINT_SIZE_RANGE>(): kotlin.Int
public final val ALPHA: kotlin.Int
public final fun <get-ALPHA>(): kotlin.Int
public final val ALPHA_BITS: kotlin.Int
public final fun <get-ALPHA_BITS>(): kotlin.Int
public final val ALWAYS: kotlin.Int
public final fun <get-ALWAYS>(): kotlin.Int
public final val ARRAY_BUFFER: kotlin.Int
public final fun <get-ARRAY_BUFFER>(): kotlin.Int
public final val ARRAY_BUFFER_BINDING: kotlin.Int
public final fun <get-ARRAY_BUFFER_BINDING>(): kotlin.Int
public final val ATTACHED_SHADERS: kotlin.Int
public final fun <get-ATTACHED_SHADERS>(): kotlin.Int
public final val BACK: kotlin.Int
public final fun <get-BACK>(): kotlin.Int
public final val BLEND: kotlin.Int
public final fun <get-BLEND>(): kotlin.Int
public final val BLEND_COLOR: kotlin.Int
public final fun <get-BLEND_COLOR>(): kotlin.Int
public final val BLEND_DST_ALPHA: kotlin.Int
public final fun <get-BLEND_DST_ALPHA>(): kotlin.Int
public final val BLEND_DST_RGB: kotlin.Int
public final fun <get-BLEND_DST_RGB>(): kotlin.Int
public final val BLEND_EQUATION: kotlin.Int
public final fun <get-BLEND_EQUATION>(): kotlin.Int
public final val BLEND_EQUATION_ALPHA: kotlin.Int
public final fun <get-BLEND_EQUATION_ALPHA>(): kotlin.Int
public final val BLEND_EQUATION_RGB: kotlin.Int
public final fun <get-BLEND_EQUATION_RGB>(): kotlin.Int
public final val BLEND_SRC_ALPHA: kotlin.Int
public final fun <get-BLEND_SRC_ALPHA>(): kotlin.Int
public final val BLEND_SRC_RGB: kotlin.Int
public final fun <get-BLEND_SRC_RGB>(): kotlin.Int
public final val BLUE_BITS: kotlin.Int
public final fun <get-BLUE_BITS>(): kotlin.Int
public final val BOOL: kotlin.Int
public final fun <get-BOOL>(): kotlin.Int
public final val BOOL_VEC2: kotlin.Int
public final fun <get-BOOL_VEC2>(): kotlin.Int
public final val BOOL_VEC3: kotlin.Int
public final fun <get-BOOL_VEC3>(): kotlin.Int
public final val BOOL_VEC4: kotlin.Int
public final fun <get-BOOL_VEC4>(): kotlin.Int
public final val BROWSER_DEFAULT_WEBGL: kotlin.Int
public final fun <get-BROWSER_DEFAULT_WEBGL>(): kotlin.Int
public final val BUFFER_SIZE: kotlin.Int
public final fun <get-BUFFER_SIZE>(): kotlin.Int
public final val BUFFER_USAGE: kotlin.Int
public final fun <get-BUFFER_USAGE>(): kotlin.Int
public final val BYTE: kotlin.Int
public final fun <get-BYTE>(): kotlin.Int
public final val CCW: kotlin.Int
public final fun <get-CCW>(): kotlin.Int
public final val CLAMP_TO_EDGE: kotlin.Int
public final fun <get-CLAMP_TO_EDGE>(): kotlin.Int
public final val COLOR_ATTACHMENT0: kotlin.Int
public final fun <get-COLOR_ATTACHMENT0>(): kotlin.Int
public final val COLOR_BUFFER_BIT: kotlin.Int
public final fun <get-COLOR_BUFFER_BIT>(): kotlin.Int
public final val COLOR_CLEAR_VALUE: kotlin.Int
public final fun <get-COLOR_CLEAR_VALUE>(): kotlin.Int
public final val COLOR_WRITEMASK: kotlin.Int
public final fun <get-COLOR_WRITEMASK>(): kotlin.Int
public final val COMPILE_STATUS: kotlin.Int
public final fun <get-COMPILE_STATUS>(): kotlin.Int
public final val COMPRESSED_TEXTURE_FORMATS: kotlin.Int
public final fun <get-COMPRESSED_TEXTURE_FORMATS>(): kotlin.Int
public final val CONSTANT_ALPHA: kotlin.Int
public final fun <get-CONSTANT_ALPHA>(): kotlin.Int
public final val CONSTANT_COLOR: kotlin.Int
public final fun <get-CONSTANT_COLOR>(): kotlin.Int
public final val CONTEXT_LOST_WEBGL: kotlin.Int
public final fun <get-CONTEXT_LOST_WEBGL>(): kotlin.Int
public final val CULL_FACE: kotlin.Int
public final fun <get-CULL_FACE>(): kotlin.Int
public final val CULL_FACE_MODE: kotlin.Int
public final fun <get-CULL_FACE_MODE>(): kotlin.Int
public final val CURRENT_PROGRAM: kotlin.Int
public final fun <get-CURRENT_PROGRAM>(): kotlin.Int
public final val CURRENT_VERTEX_ATTRIB: kotlin.Int
public final fun <get-CURRENT_VERTEX_ATTRIB>(): kotlin.Int
public final val CW: kotlin.Int
public final fun <get-CW>(): kotlin.Int
public final val DECR: kotlin.Int
public final fun <get-DECR>(): kotlin.Int
public final val DECR_WRAP: kotlin.Int
public final fun <get-DECR_WRAP>(): kotlin.Int
public final val DELETE_STATUS: kotlin.Int
public final fun <get-DELETE_STATUS>(): kotlin.Int
public final val DEPTH_ATTACHMENT: kotlin.Int
public final fun <get-DEPTH_ATTACHMENT>(): kotlin.Int
public final val DEPTH_BITS: kotlin.Int
public final fun <get-DEPTH_BITS>(): kotlin.Int
public final val DEPTH_BUFFER_BIT: kotlin.Int
public final fun <get-DEPTH_BUFFER_BIT>(): kotlin.Int
public final val DEPTH_CLEAR_VALUE: kotlin.Int
public final fun <get-DEPTH_CLEAR_VALUE>(): kotlin.Int
public final val DEPTH_COMPONENT: kotlin.Int
public final fun <get-DEPTH_COMPONENT>(): kotlin.Int
public final val DEPTH_COMPONENT16: kotlin.Int
public final fun <get-DEPTH_COMPONENT16>(): kotlin.Int
public final val DEPTH_FUNC: kotlin.Int
public final fun <get-DEPTH_FUNC>(): kotlin.Int
public final val DEPTH_RANGE: kotlin.Int
public final fun <get-DEPTH_RANGE>(): kotlin.Int
public final val DEPTH_STENCIL: kotlin.Int
public final fun <get-DEPTH_STENCIL>(): kotlin.Int
public final val DEPTH_STENCIL_ATTACHMENT: kotlin.Int
public final fun <get-DEPTH_STENCIL_ATTACHMENT>(): kotlin.Int
public final val DEPTH_TEST: kotlin.Int
public final fun <get-DEPTH_TEST>(): kotlin.Int
public final val DEPTH_WRITEMASK: kotlin.Int
public final fun <get-DEPTH_WRITEMASK>(): kotlin.Int
public final val DITHER: kotlin.Int
public final fun <get-DITHER>(): kotlin.Int
public final val DONT_CARE: kotlin.Int
public final fun <get-DONT_CARE>(): kotlin.Int
public final val DST_ALPHA: kotlin.Int
public final fun <get-DST_ALPHA>(): kotlin.Int
public final val DST_COLOR: kotlin.Int
public final fun <get-DST_COLOR>(): kotlin.Int
public final val DYNAMIC_DRAW: kotlin.Int
public final fun <get-DYNAMIC_DRAW>(): kotlin.Int
public final val ELEMENT_ARRAY_BUFFER: kotlin.Int
public final fun <get-ELEMENT_ARRAY_BUFFER>(): kotlin.Int
public final val ELEMENT_ARRAY_BUFFER_BINDING: kotlin.Int
public final fun <get-ELEMENT_ARRAY_BUFFER_BINDING>(): kotlin.Int
public final val EQUAL: kotlin.Int
public final fun <get-EQUAL>(): kotlin.Int
public final val FASTEST: kotlin.Int
public final fun <get-FASTEST>(): kotlin.Int
public final val FLOAT: kotlin.Int
public final fun <get-FLOAT>(): kotlin.Int
public final val FLOAT_MAT2: kotlin.Int
public final fun <get-FLOAT_MAT2>(): kotlin.Int
public final val FLOAT_MAT3: kotlin.Int
public final fun <get-FLOAT_MAT3>(): kotlin.Int
public final val FLOAT_MAT4: kotlin.Int
public final fun <get-FLOAT_MAT4>(): kotlin.Int
public final val FLOAT_VEC2: kotlin.Int
public final fun <get-FLOAT_VEC2>(): kotlin.Int
public final val FLOAT_VEC3: kotlin.Int
public final fun <get-FLOAT_VEC3>(): kotlin.Int
public final val FLOAT_VEC4: kotlin.Int
public final fun <get-FLOAT_VEC4>(): kotlin.Int
public final val FRAGMENT_SHADER: kotlin.Int
public final fun <get-FRAGMENT_SHADER>(): kotlin.Int
public final val FRAMEBUFFER: kotlin.Int
public final fun <get-FRAMEBUFFER>(): kotlin.Int
public final val FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: kotlin.Int
public final fun <get-FRAMEBUFFER_ATTACHMENT_OBJECT_NAME>(): kotlin.Int
public final val FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: kotlin.Int
public final fun <get-FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE>(): kotlin.Int
public final val FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: kotlin.Int
public final fun <get-FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE>(): kotlin.Int
public final val FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: kotlin.Int
public final fun <get-FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL>(): kotlin.Int
public final val FRAMEBUFFER_BINDING: kotlin.Int
public final fun <get-FRAMEBUFFER_BINDING>(): kotlin.Int
public final val FRAMEBUFFER_COMPLETE: kotlin.Int
public final fun <get-FRAMEBUFFER_COMPLETE>(): kotlin.Int
public final val FRAMEBUFFER_INCOMPLETE_ATTACHMENT: kotlin.Int
public final fun <get-FRAMEBUFFER_INCOMPLETE_ATTACHMENT>(): kotlin.Int
public final val FRAMEBUFFER_INCOMPLETE_DIMENSIONS: kotlin.Int
public final fun <get-FRAMEBUFFER_INCOMPLETE_DIMENSIONS>(): kotlin.Int
public final val FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: kotlin.Int
public final fun <get-FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT>(): kotlin.Int
public final val FRAMEBUFFER_UNSUPPORTED: kotlin.Int
public final fun <get-FRAMEBUFFER_UNSUPPORTED>(): kotlin.Int
public final val FRONT: kotlin.Int
public final fun <get-FRONT>(): kotlin.Int
public final val FRONT_AND_BACK: kotlin.Int
public final fun <get-FRONT_AND_BACK>(): kotlin.Int
public final val FRONT_FACE: kotlin.Int
public final fun <get-FRONT_FACE>(): kotlin.Int
public final val FUNC_ADD: kotlin.Int
public final fun <get-FUNC_ADD>(): kotlin.Int
public final val FUNC_REVERSE_SUBTRACT: kotlin.Int
public final fun <get-FUNC_REVERSE_SUBTRACT>(): kotlin.Int
public final val FUNC_SUBTRACT: kotlin.Int
public final fun <get-FUNC_SUBTRACT>(): kotlin.Int
public final val GENERATE_MIPMAP_HINT: kotlin.Int
public final fun <get-GENERATE_MIPMAP_HINT>(): kotlin.Int
public final val GEQUAL: kotlin.Int
public final fun <get-GEQUAL>(): kotlin.Int
public final val GREATER: kotlin.Int
public final fun <get-GREATER>(): kotlin.Int
public final val GREEN_BITS: kotlin.Int
public final fun <get-GREEN_BITS>(): kotlin.Int
public final val HIGH_FLOAT: kotlin.Int
public final fun <get-HIGH_FLOAT>(): kotlin.Int
public final val HIGH_INT: kotlin.Int
public final fun <get-HIGH_INT>(): kotlin.Int
public final val IMPLEMENTATION_COLOR_READ_FORMAT: kotlin.Int
public final fun <get-IMPLEMENTATION_COLOR_READ_FORMAT>(): kotlin.Int
public final val IMPLEMENTATION_COLOR_READ_TYPE: kotlin.Int
public final fun <get-IMPLEMENTATION_COLOR_READ_TYPE>(): kotlin.Int
public final val INCR: kotlin.Int
public final fun <get-INCR>(): kotlin.Int
public final val INCR_WRAP: kotlin.Int
public final fun <get-INCR_WRAP>(): kotlin.Int
public final val INT: kotlin.Int
public final fun <get-INT>(): kotlin.Int
public final val INT_VEC2: kotlin.Int
public final fun <get-INT_VEC2>(): kotlin.Int
public final val INT_VEC3: kotlin.Int
public final fun <get-INT_VEC3>(): kotlin.Int
public final val INT_VEC4: kotlin.Int
public final fun <get-INT_VEC4>(): kotlin.Int
public final val INVALID_ENUM: kotlin.Int
public final fun <get-INVALID_ENUM>(): kotlin.Int
public final val INVALID_FRAMEBUFFER_OPERATION: kotlin.Int
public final fun <get-INVALID_FRAMEBUFFER_OPERATION>(): kotlin.Int
public final val INVALID_OPERATION: kotlin.Int
public final fun <get-INVALID_OPERATION>(): kotlin.Int
public final val INVALID_VALUE: kotlin.Int
public final fun <get-INVALID_VALUE>(): kotlin.Int
public final val INVERT: kotlin.Int
public final fun <get-INVERT>(): kotlin.Int
public final val KEEP: kotlin.Int
public final fun <get-KEEP>(): kotlin.Int
public final val LEQUAL: kotlin.Int
public final fun <get-LEQUAL>(): kotlin.Int
public final val LESS: kotlin.Int
public final fun <get-LESS>(): kotlin.Int
public final val LINEAR: kotlin.Int
public final fun <get-LINEAR>(): kotlin.Int
public final val LINEAR_MIPMAP_LINEAR: kotlin.Int
public final fun <get-LINEAR_MIPMAP_LINEAR>(): kotlin.Int
public final val LINEAR_MIPMAP_NEAREST: kotlin.Int
public final fun <get-LINEAR_MIPMAP_NEAREST>(): kotlin.Int
public final val LINES: kotlin.Int
public final fun <get-LINES>(): kotlin.Int
public final val LINE_LOOP: kotlin.Int
public final fun <get-LINE_LOOP>(): kotlin.Int
public final val LINE_STRIP: kotlin.Int
public final fun <get-LINE_STRIP>(): kotlin.Int
public final val LINE_WIDTH: kotlin.Int
public final fun <get-LINE_WIDTH>(): kotlin.Int
public final val LINK_STATUS: kotlin.Int
public final fun <get-LINK_STATUS>(): kotlin.Int
public final val LOW_FLOAT: kotlin.Int
public final fun <get-LOW_FLOAT>(): kotlin.Int
public final val LOW_INT: kotlin.Int
public final fun <get-LOW_INT>(): kotlin.Int
public final val LUMINANCE: kotlin.Int
public final fun <get-LUMINANCE>(): kotlin.Int
public final val LUMINANCE_ALPHA: kotlin.Int
public final fun <get-LUMINANCE_ALPHA>(): kotlin.Int
public final val MAX_COMBINED_TEXTURE_IMAGE_UNITS: kotlin.Int
public final fun <get-MAX_COMBINED_TEXTURE_IMAGE_UNITS>(): kotlin.Int
public final val MAX_CUBE_MAP_TEXTURE_SIZE: kotlin.Int
public final fun <get-MAX_CUBE_MAP_TEXTURE_SIZE>(): kotlin.Int
public final val MAX_FRAGMENT_UNIFORM_VECTORS: kotlin.Int
public final fun <get-MAX_FRAGMENT_UNIFORM_VECTORS>(): kotlin.Int
public final val MAX_RENDERBUFFER_SIZE: kotlin.Int
public final fun <get-MAX_RENDERBUFFER_SIZE>(): kotlin.Int
public final val MAX_TEXTURE_IMAGE_UNITS: kotlin.Int
public final fun <get-MAX_TEXTURE_IMAGE_UNITS>(): kotlin.Int
public final val MAX_TEXTURE_SIZE: kotlin.Int
public final fun <get-MAX_TEXTURE_SIZE>(): kotlin.Int
public final val MAX_VARYING_VECTORS: kotlin.Int
public final fun <get-MAX_VARYING_VECTORS>(): kotlin.Int
public final val MAX_VERTEX_ATTRIBS: kotlin.Int
public final fun <get-MAX_VERTEX_ATTRIBS>(): kotlin.Int
public final val MAX_VERTEX_TEXTURE_IMAGE_UNITS: kotlin.Int
public final fun <get-MAX_VERTEX_TEXTURE_IMAGE_UNITS>(): kotlin.Int
public final val MAX_VERTEX_UNIFORM_VECTORS: kotlin.Int
public final fun <get-MAX_VERTEX_UNIFORM_VECTORS>(): kotlin.Int
public final val MAX_VIEWPORT_DIMS: kotlin.Int
public final fun <get-MAX_VIEWPORT_DIMS>(): kotlin.Int
public final val MEDIUM_FLOAT: kotlin.Int
public final fun <get-MEDIUM_FLOAT>(): kotlin.Int
public final val MEDIUM_INT: kotlin.Int
public final fun <get-MEDIUM_INT>(): kotlin.Int
public final val MIRRORED_REPEAT: kotlin.Int
public final fun <get-MIRRORED_REPEAT>(): kotlin.Int
public final val NEAREST: kotlin.Int
public final fun <get-NEAREST>(): kotlin.Int
public final val NEAREST_MIPMAP_LINEAR: kotlin.Int
public final fun <get-NEAREST_MIPMAP_LINEAR>(): kotlin.Int
public final val NEAREST_MIPMAP_NEAREST: kotlin.Int
public final fun <get-NEAREST_MIPMAP_NEAREST>(): kotlin.Int
public final val NEVER: kotlin.Int
public final fun <get-NEVER>(): kotlin.Int
public final val NICEST: kotlin.Int
public final fun <get-NICEST>(): kotlin.Int
public final val NONE: kotlin.Int
public final fun <get-NONE>(): kotlin.Int
public final val NOTEQUAL: kotlin.Int
public final fun <get-NOTEQUAL>(): kotlin.Int
public final val NO_ERROR: kotlin.Int
public final fun <get-NO_ERROR>(): kotlin.Int
public final val ONE: kotlin.Int
public final fun <get-ONE>(): kotlin.Int
public final val ONE_MINUS_CONSTANT_ALPHA: kotlin.Int
public final fun <get-ONE_MINUS_CONSTANT_ALPHA>(): kotlin.Int
public final val ONE_MINUS_CONSTANT_COLOR: kotlin.Int
public final fun <get-ONE_MINUS_CONSTANT_COLOR>(): kotlin.Int
public final val ONE_MINUS_DST_ALPHA: kotlin.Int
public final fun <get-ONE_MINUS_DST_ALPHA>(): kotlin.Int
public final val ONE_MINUS_DST_COLOR: kotlin.Int
public final fun <get-ONE_MINUS_DST_COLOR>(): kotlin.Int
public final val ONE_MINUS_SRC_ALPHA: kotlin.Int
public final fun <get-ONE_MINUS_SRC_ALPHA>(): kotlin.Int
public final val ONE_MINUS_SRC_COLOR: kotlin.Int
public final fun <get-ONE_MINUS_SRC_COLOR>(): kotlin.Int
public final val OUT_OF_MEMORY: kotlin.Int
public final fun <get-OUT_OF_MEMORY>(): kotlin.Int
public final val PACK_ALIGNMENT: kotlin.Int
public final fun <get-PACK_ALIGNMENT>(): kotlin.Int
public final val POINTS: kotlin.Int
public final fun <get-POINTS>(): kotlin.Int
public final val POLYGON_OFFSET_FACTOR: kotlin.Int
public final fun <get-POLYGON_OFFSET_FACTOR>(): kotlin.Int
public final val POLYGON_OFFSET_FILL: kotlin.Int
public final fun <get-POLYGON_OFFSET_FILL>(): kotlin.Int
public final val POLYGON_OFFSET_UNITS: kotlin.Int
public final fun <get-POLYGON_OFFSET_UNITS>(): kotlin.Int
public final val RED_BITS: kotlin.Int
public final fun <get-RED_BITS>(): kotlin.Int
public final val RENDERBUFFER: kotlin.Int
public final fun <get-RENDERBUFFER>(): kotlin.Int
public final val RENDERBUFFER_ALPHA_SIZE: kotlin.Int
public final fun <get-RENDERBUFFER_ALPHA_SIZE>(): kotlin.Int
public final val RENDERBUFFER_BINDING: kotlin.Int
public final fun <get-RENDERBUFFER_BINDING>(): kotlin.Int
public final val RENDERBUFFER_BLUE_SIZE: kotlin.Int
public final fun <get-RENDERBUFFER_BLUE_SIZE>(): kotlin.Int
public final val RENDERBUFFER_DEPTH_SIZE: kotlin.Int
public final fun <get-RENDERBUFFER_DEPTH_SIZE>(): kotlin.Int
public final val RENDERBUFFER_GREEN_SIZE: kotlin.Int
public final fun <get-RENDERBUFFER_GREEN_SIZE>(): kotlin.Int
public final val RENDERBUFFER_HEIGHT: kotlin.Int
public final fun <get-RENDERBUFFER_HEIGHT>(): kotlin.Int
public final val RENDERBUFFER_INTERNAL_FORMAT: kotlin.Int
public final fun <get-RENDERBUFFER_INTERNAL_FORMAT>(): kotlin.Int
public final val RENDERBUFFER_RED_SIZE: kotlin.Int
public final fun <get-RENDERBUFFER_RED_SIZE>(): kotlin.Int
public final val RENDERBUFFER_STENCIL_SIZE: kotlin.Int
public final fun <get-RENDERBUFFER_STENCIL_SIZE>(): kotlin.Int
public final val RENDERBUFFER_WIDTH: kotlin.Int
public final fun <get-RENDERBUFFER_WIDTH>(): kotlin.Int
public final val RENDERER: kotlin.Int
public final fun <get-RENDERER>(): kotlin.Int
public final val REPEAT: kotlin.Int
public final fun <get-REPEAT>(): kotlin.Int
public final val REPLACE: kotlin.Int
public final fun <get-REPLACE>(): kotlin.Int
public final val RGB: kotlin.Int
public final fun <get-RGB>(): kotlin.Int
public final val RGB565: kotlin.Int
public final fun <get-RGB565>(): kotlin.Int
public final val RGB5_A1: kotlin.Int
public final fun <get-RGB5_A1>(): kotlin.Int
public final val RGBA: kotlin.Int
public final fun <get-RGBA>(): kotlin.Int
public final val RGBA4: kotlin.Int
public final fun <get-RGBA4>(): kotlin.Int
public final val SAMPLER_2D: kotlin.Int
public final fun <get-SAMPLER_2D>(): kotlin.Int
public final val SAMPLER_CUBE: kotlin.Int
public final fun <get-SAMPLER_CUBE>(): kotlin.Int
public final val SAMPLES: kotlin.Int
public final fun <get-SAMPLES>(): kotlin.Int
public final val SAMPLE_ALPHA_TO_COVERAGE: kotlin.Int
public final fun <get-SAMPLE_ALPHA_TO_COVERAGE>(): kotlin.Int
public final val SAMPLE_BUFFERS: kotlin.Int
public final fun <get-SAMPLE_BUFFERS>(): kotlin.Int
public final val SAMPLE_COVERAGE: kotlin.Int
public final fun <get-SAMPLE_COVERAGE>(): kotlin.Int
public final val SAMPLE_COVERAGE_INVERT: kotlin.Int
public final fun <get-SAMPLE_COVERAGE_INVERT>(): kotlin.Int
public final val SAMPLE_COVERAGE_VALUE: kotlin.Int
public final fun <get-SAMPLE_COVERAGE_VALUE>(): kotlin.Int
public final val SCISSOR_BOX: kotlin.Int
public final fun <get-SCISSOR_BOX>(): kotlin.Int
public final val SCISSOR_TEST: kotlin.Int
public final fun <get-SCISSOR_TEST>(): kotlin.Int
public final val SHADER_TYPE: kotlin.Int
public final fun <get-SHADER_TYPE>(): kotlin.Int
public final val SHADING_LANGUAGE_VERSION: kotlin.Int
public final fun <get-SHADING_LANGUAGE_VERSION>(): kotlin.Int
public final val SHORT: kotlin.Int
public final fun <get-SHORT>(): kotlin.Int
public final val SRC_ALPHA: kotlin.Int
public final fun <get-SRC_ALPHA>(): kotlin.Int
public final val SRC_ALPHA_SATURATE: kotlin.Int
public final fun <get-SRC_ALPHA_SATURATE>(): kotlin.Int
public final val SRC_COLOR: kotlin.Int
public final fun <get-SRC_COLOR>(): kotlin.Int
public final val STATIC_DRAW: kotlin.Int
public final fun <get-STATIC_DRAW>(): kotlin.Int
public final val STENCIL_ATTACHMENT: kotlin.Int
public final fun <get-STENCIL_ATTACHMENT>(): kotlin.Int
public final val STENCIL_BACK_FAIL: kotlin.Int
public final fun <get-STENCIL_BACK_FAIL>(): kotlin.Int
public final val STENCIL_BACK_FUNC: kotlin.Int
public final fun <get-STENCIL_BACK_FUNC>(): kotlin.Int
public final val STENCIL_BACK_PASS_DEPTH_FAIL: kotlin.Int
public final fun <get-STENCIL_BACK_PASS_DEPTH_FAIL>(): kotlin.Int
public final val STENCIL_BACK_PASS_DEPTH_PASS: kotlin.Int
public final fun <get-STENCIL_BACK_PASS_DEPTH_PASS>(): kotlin.Int
public final val STENCIL_BACK_REF: kotlin.Int
public final fun <get-STENCIL_BACK_REF>(): kotlin.Int
public final val STENCIL_BACK_VALUE_MASK: kotlin.Int
public final fun <get-STENCIL_BACK_VALUE_MASK>(): kotlin.Int
public final val STENCIL_BACK_WRITEMASK: kotlin.Int
public final fun <get-STENCIL_BACK_WRITEMASK>(): kotlin.Int
public final val STENCIL_BITS: kotlin.Int
public final fun <get-STENCIL_BITS>(): kotlin.Int
public final val STENCIL_BUFFER_BIT: kotlin.Int
public final fun <get-STENCIL_BUFFER_BIT>(): kotlin.Int
public final val STENCIL_CLEAR_VALUE: kotlin.Int
public final fun <get-STENCIL_CLEAR_VALUE>(): kotlin.Int
public final val STENCIL_FAIL: kotlin.Int
public final fun <get-STENCIL_FAIL>(): kotlin.Int
public final val STENCIL_FUNC: kotlin.Int
public final fun <get-STENCIL_FUNC>(): kotlin.Int
public final val STENCIL_INDEX: kotlin.Int
public final fun <get-STENCIL_INDEX>(): kotlin.Int
public final val STENCIL_INDEX8: kotlin.Int
public final fun <get-STENCIL_INDEX8>(): kotlin.Int
public final val STENCIL_PASS_DEPTH_FAIL: kotlin.Int
public final fun <get-STENCIL_PASS_DEPTH_FAIL>(): kotlin.Int
public final val STENCIL_PASS_DEPTH_PASS: kotlin.Int
public final fun <get-STENCIL_PASS_DEPTH_PASS>(): kotlin.Int
public final val STENCIL_REF: kotlin.Int
public final fun <get-STENCIL_REF>(): kotlin.Int
public final val STENCIL_TEST: kotlin.Int
public final fun <get-STENCIL_TEST>(): kotlin.Int
public final val STENCIL_VALUE_MASK: kotlin.Int
public final fun <get-STENCIL_VALUE_MASK>(): kotlin.Int
public final val STENCIL_WRITEMASK: kotlin.Int
public final fun <get-STENCIL_WRITEMASK>(): kotlin.Int
public final val STREAM_DRAW: kotlin.Int
public final fun <get-STREAM_DRAW>(): kotlin.Int
public final val SUBPIXEL_BITS: kotlin.Int
public final fun <get-SUBPIXEL_BITS>(): kotlin.Int
public final val TEXTURE: kotlin.Int
public final fun <get-TEXTURE>(): kotlin.Int
public final val TEXTURE0: kotlin.Int
public final fun <get-TEXTURE0>(): kotlin.Int
public final val TEXTURE1: kotlin.Int
public final fun <get-TEXTURE1>(): kotlin.Int
public final val TEXTURE10: kotlin.Int
public final fun <get-TEXTURE10>(): kotlin.Int
public final val TEXTURE11: kotlin.Int
public final fun <get-TEXTURE11>(): kotlin.Int
public final val TEXTURE12: kotlin.Int
public final fun <get-TEXTURE12>(): kotlin.Int
public final val TEXTURE13: kotlin.Int
public final fun <get-TEXTURE13>(): kotlin.Int
public final val TEXTURE14: kotlin.Int
public final fun <get-TEXTURE14>(): kotlin.Int
public final val TEXTURE15: kotlin.Int
public final fun <get-TEXTURE15>(): kotlin.Int
public final val TEXTURE16: kotlin.Int
public final fun <get-TEXTURE16>(): kotlin.Int
public final val TEXTURE17: kotlin.Int
public final fun <get-TEXTURE17>(): kotlin.Int
public final val TEXTURE18: kotlin.Int
public final fun <get-TEXTURE18>(): kotlin.Int
public final val TEXTURE19: kotlin.Int
public final fun <get-TEXTURE19>(): kotlin.Int
public final val TEXTURE2: kotlin.Int
public final fun <get-TEXTURE2>(): kotlin.Int
public final val TEXTURE20: kotlin.Int
public final fun <get-TEXTURE20>(): kotlin.Int
public final val TEXTURE21: kotlin.Int
public final fun <get-TEXTURE21>(): kotlin.Int
public final val TEXTURE22: kotlin.Int
public final fun <get-TEXTURE22>(): kotlin.Int
public final val TEXTURE23: kotlin.Int
public final fun <get-TEXTURE23>(): kotlin.Int
public final val TEXTURE24: kotlin.Int
public final fun <get-TEXTURE24>(): kotlin.Int
public final val TEXTURE25: kotlin.Int
public final fun <get-TEXTURE25>(): kotlin.Int
public final val TEXTURE26: kotlin.Int
public final fun <get-TEXTURE26>(): kotlin.Int
public final val TEXTURE27: kotlin.Int
public final fun <get-TEXTURE27>(): kotlin.Int
public final val TEXTURE28: kotlin.Int
public final fun <get-TEXTURE28>(): kotlin.Int
public final val TEXTURE29: kotlin.Int
public final fun <get-TEXTURE29>(): kotlin.Int
public final val TEXTURE3: kotlin.Int
public final fun <get-TEXTURE3>(): kotlin.Int
public final val TEXTURE30: kotlin.Int
public final fun <get-TEXTURE30>(): kotlin.Int
public final val TEXTURE31: kotlin.Int
public final fun <get-TEXTURE31>(): kotlin.Int
public final val TEXTURE4: kotlin.Int
public final fun <get-TEXTURE4>(): kotlin.Int
public final val TEXTURE5: kotlin.Int
public final fun <get-TEXTURE5>(): kotlin.Int
public final val TEXTURE6: kotlin.Int
public final fun <get-TEXTURE6>(): kotlin.Int
public final val TEXTURE7: kotlin.Int
public final fun <get-TEXTURE7>(): kotlin.Int
public final val TEXTURE8: kotlin.Int
public final fun <get-TEXTURE8>(): kotlin.Int
public final val TEXTURE9: kotlin.Int
public final fun <get-TEXTURE9>(): kotlin.Int
public final val TEXTURE_2D: kotlin.Int
public final fun <get-TEXTURE_2D>(): kotlin.Int
public final val TEXTURE_BINDING_2D: kotlin.Int
public final fun <get-TEXTURE_BINDING_2D>(): kotlin.Int
public final val TEXTURE_BINDING_CUBE_MAP: kotlin.Int
public final fun <get-TEXTURE_BINDING_CUBE_MAP>(): kotlin.Int
public final val TEXTURE_CUBE_MAP: kotlin.Int
public final fun <get-TEXTURE_CUBE_MAP>(): kotlin.Int
public final val TEXTURE_CUBE_MAP_NEGATIVE_X: kotlin.Int
public final fun <get-TEXTURE_CUBE_MAP_NEGATIVE_X>(): kotlin.Int
public final val TEXTURE_CUBE_MAP_NEGATIVE_Y: kotlin.Int
public final fun <get-TEXTURE_CUBE_MAP_NEGATIVE_Y>(): kotlin.Int
public final val TEXTURE_CUBE_MAP_NEGATIVE_Z: kotlin.Int
public final fun <get-TEXTURE_CUBE_MAP_NEGATIVE_Z>(): kotlin.Int
public final val TEXTURE_CUBE_MAP_POSITIVE_X: kotlin.Int
public final fun <get-TEXTURE_CUBE_MAP_POSITIVE_X>(): kotlin.Int
public final val TEXTURE_CUBE_MAP_POSITIVE_Y: kotlin.Int
public final fun <get-TEXTURE_CUBE_MAP_POSITIVE_Y>(): kotlin.Int
public final val TEXTURE_CUBE_MAP_POSITIVE_Z: kotlin.Int
public final fun <get-TEXTURE_CUBE_MAP_POSITIVE_Z>(): kotlin.Int
public final val TEXTURE_MAG_FILTER: kotlin.Int
public final fun <get-TEXTURE_MAG_FILTER>(): kotlin.Int
public final val TEXTURE_MIN_FILTER: kotlin.Int
public final fun <get-TEXTURE_MIN_FILTER>(): kotlin.Int
public final val TEXTURE_WRAP_S: kotlin.Int
public final fun <get-TEXTURE_WRAP_S>(): kotlin.Int
public final val TEXTURE_WRAP_T: kotlin.Int
public final fun <get-TEXTURE_WRAP_T>(): kotlin.Int
public final val TRIANGLES: kotlin.Int
public final fun <get-TRIANGLES>(): kotlin.Int
public final val TRIANGLE_FAN: kotlin.Int
public final fun <get-TRIANGLE_FAN>(): kotlin.Int
public final val TRIANGLE_STRIP: kotlin.Int
public final fun <get-TRIANGLE_STRIP>(): kotlin.Int
public final val UNPACK_ALIGNMENT: kotlin.Int
public final fun <get-UNPACK_ALIGNMENT>(): kotlin.Int
public final val UNPACK_COLORSPACE_CONVERSION_WEBGL: kotlin.Int
public final fun <get-UNPACK_COLORSPACE_CONVERSION_WEBGL>(): kotlin.Int
public final val UNPACK_FLIP_Y_WEBGL: kotlin.Int
public final fun <get-UNPACK_FLIP_Y_WEBGL>(): kotlin.Int
public final val UNPACK_PREMULTIPLY_ALPHA_WEBGL: kotlin.Int
public final fun <get-UNPACK_PREMULTIPLY_ALPHA_WEBGL>(): kotlin.Int
public final val UNSIGNED_BYTE: kotlin.Int
public final fun <get-UNSIGNED_BYTE>(): kotlin.Int
public final val UNSIGNED_INT: kotlin.Int
public final fun <get-UNSIGNED_INT>(): kotlin.Int
public final val UNSIGNED_SHORT: kotlin.Int
public final fun <get-UNSIGNED_SHORT>(): kotlin.Int
public final val UNSIGNED_SHORT_4_4_4_4: kotlin.Int
public final fun <get-UNSIGNED_SHORT_4_4_4_4>(): kotlin.Int
public final val UNSIGNED_SHORT_5_5_5_1: kotlin.Int
public final fun <get-UNSIGNED_SHORT_5_5_5_1>(): kotlin.Int
public final val UNSIGNED_SHORT_5_6_5: kotlin.Int
public final fun <get-UNSIGNED_SHORT_5_6_5>(): kotlin.Int
public final val VALIDATE_STATUS: kotlin.Int
public final fun <get-VALIDATE_STATUS>(): kotlin.Int
public final val VENDOR: kotlin.Int
public final fun <get-VENDOR>(): kotlin.Int
public final val VERSION: kotlin.Int
public final fun <get-VERSION>(): kotlin.Int
public final val VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: kotlin.Int
public final fun <get-VERTEX_ATTRIB_ARRAY_BUFFER_BINDING>(): kotlin.Int
public final val VERTEX_ATTRIB_ARRAY_ENABLED: kotlin.Int
public final fun <get-VERTEX_ATTRIB_ARRAY_ENABLED>(): kotlin.Int
public final val VERTEX_ATTRIB_ARRAY_NORMALIZED: kotlin.Int
public final fun <get-VERTEX_ATTRIB_ARRAY_NORMALIZED>(): kotlin.Int
public final val VERTEX_ATTRIB_ARRAY_POINTER: kotlin.Int
public final fun <get-VERTEX_ATTRIB_ARRAY_POINTER>(): kotlin.Int
public final val VERTEX_ATTRIB_ARRAY_SIZE: kotlin.Int
public final fun <get-VERTEX_ATTRIB_ARRAY_SIZE>(): kotlin.Int
public final val VERTEX_ATTRIB_ARRAY_STRIDE: kotlin.Int
public final fun <get-VERTEX_ATTRIB_ARRAY_STRIDE>(): kotlin.Int
public final val VERTEX_ATTRIB_ARRAY_TYPE: kotlin.Int
public final fun <get-VERTEX_ATTRIB_ARRAY_TYPE>(): kotlin.Int
public final val VERTEX_SHADER: kotlin.Int
public final fun <get-VERTEX_SHADER>(): kotlin.Int
public final val VIEWPORT: kotlin.Int
public final fun <get-VIEWPORT>(): kotlin.Int
public final val ZERO: kotlin.Int
public final fun <get-ZERO>(): kotlin.Int
}
}
| 0 | null | 0 | 1 | 2bf31ae3c302278dc9e8c5fad75f2fc7700552d3 | 113,575 | kotlin | Apache License 2.0 |
modules/core/src/main/java/de/deutschebahn/bahnhoflive/backend/BaseRequest.kt | dbbahnhoflive | 267,806,942 | false | {"Kotlin": 1313069, "Java": 729702, "HTML": 43823} | /*
* SPDX-FileCopyrightText: 2020 DB Station&Service AG <[email protected]>
*
* SPDX-License-Identifier: Apache-2.0
*/
package de.deutschebahn.bahnhoflive.backend
import com.android.volley.Request
import com.android.volley.VolleyError
import de.deutschebahn.bahnhoflive.util.DebugX
abstract class BaseRequest<T>(
method: Int,
url: String?,
private val restListener: VolleyRestListener<T>
) : Request<T>(method, url, RestErrorListener(restListener)) {
init {
DebugX.logVolleyRequest(this,url)
}
override fun parseNetworkError(volleyError: VolleyError): VolleyError {
DebugX.logVolleyResponseError(
this,
url,
volleyError
)
return volleyError as? DetailedVolleyError
?: DetailedVolleyError(
this,
volleyError
)
}
override fun deliverResponse(response: T) {
DebugX.logVolleyResponseOk(this,url)
restListener.onSuccess(response)
}
} | 0 | Kotlin | 4 | 33 | 63bc6c63013f187aff9942e9f74d1c7f7082cfb7 | 1,039 | dbbahnhoflive-android | Apache License 2.0 |
baselibrary/src/main/java/com/nice/baselibrary/base/utils/PatchDexUtils.kt | purejiang | 177,133,718 | false | null | package com.nice.baselibrary.base.utils
import android.content.Context
import dalvik.system.DexClassLoader
import dalvik.system.PathClassLoader
import java.io.File
import java.lang.reflect.Array
/**
* 热修复工具类,暂时只使用dex热修复
* 参考:https://juejin.im/post/5a0ad2b551882531ba1077a2
* @author JPlus
* @date 2019/4/23.
*/
object PatchDexUtils {
private var mDexList: MutableList<File> = ArrayList()
/**
* 获取需要热修复的dex
* @param context
* @param dexFile
*/
fun loadDex(context: Context, dexFile: File) {
dexFile.getDirFiles()?.forEach {
if (it.name.endsWith(".dex")) { // .dex结尾
mDexList.add(it)
LogUtils.d("[${this.javaClass.simpleName}] --loadDex:" + it.absolutePath)
}
}
mergeDex(context)
}
/**
* 合并dex
* @param context
*/
private fun mergeDex(context: Context) {
//应用内私有文件夹
val dexFileInApp = File(context.writePrivateDir("patch").absolutePath)
if (!dexFileInApp.exists()) {
dexFileInApp.mkdirs()
}
mDexList.forEach {
LogUtils.d("[${this.javaClass.simpleName}] --mergeDex:${it.absolutePath}")
//PathClassLoader只能加载系统已安装的apk
val pathLoader = context.classLoader as PathClassLoader
//DexClassLoader用来加载外部的dex、apk、jar
val dexClassLoader = DexClassLoader(it.absolutePath, dexFileInApp.absolutePath, null, pathLoader)
//通过反射拿到基类的pathList对象
val dexPathList = getPathList(dexClassLoader)
val pathPathList = getPathList(pathLoader)
//通过反射拿到基pathList对象的dexElements数组
val newDexElements = getDexElements(dexPathList)
val oldDexElements = getDexElements(pathPathList)
// 合并完成
val dexElements = mergeArrays(newDexElements, oldDexElements)
//重新设置属性
val pathPathList2 = getPathList(pathLoader)// 一定要重新获取,不要用pathPathList,会报错
setFiled(pathPathList2, pathPathList2.javaClass, "dexElements", dexElements)
}
}
/**
* 通过反射设置属性
* @param pathPathList
* @param clazz
* @param filed
* @param dexElements
*/
private fun setFiled(pathPathList: Any, clazz: Class<Any>, filed: String, dexElements: Any) {
clazz.getDeclaredField(filed).run {
isAccessible = true
//返回值
set(pathPathList, dexElements)
}
}
/**
* 合并数组
* @param newDexElements
* @param oldDexElements
* @return
*/
@Throws(Exception::class)
private fun mergeArrays(newDexElements: Any, oldDexElements: Any): Any {
//获取组件类型
val componentType: Class<*>? = newDexElements.javaClass.componentType
//新建数组
val new = Array.getLength(newDexElements)
val old = Array.getLength(oldDexElements)
val result = new + old
val componentList = Array.newInstance(componentType, result)
//拼接数组,外部加载的数组放在系统apk数组的前面
System.arraycopy(newDexElements, 0, componentList, 0, new)
System.arraycopy(oldDexElements, 0, componentList, new, old)
return componentList
}
/**
* 获取Element数组dexElements
* @param dexPathList
*/
private fun getDexElements(dexPathList: Any): Any {
return getFiled(dexPathList, dexPathList.javaClass, "dexElements")
}
/**
* 获取DexPathList对象pathList
* @param dexLoader
*/
private fun getPathList(dexLoader: Any): Any {
return getFiled(dexLoader, Class.forName("dalvik.system.BaseDexClassLoader"), "pathList")
}
/**
* 反射获取属性
* @param any
* @param clazz
* @param filed
*/
@Throws(NoSuchFieldException::class)
private fun getFiled(any: Any, clazz: Class<*>, filed: String): Any {
return clazz.getDeclaredField(filed).run {
isAccessible = true
//返回值
get(any)
}
}
}
| 0 | null | 2 | 3 | 2d51556a204cba746682b2a14e838161cac3e56a | 3,983 | baselibrary | Apache License 2.0 |
core/src/main/java/com/infinitepower/newquiz/core/ui/home/ExpandCategoriesButton.kt | joaomanaia | 443,198,327 | false | {"Kotlin": 1336523} | package com.infinitepower.newquiz.core.ui.home
import androidx.compose.animation.animateContentSize
import androidx.compose.animation.core.animateFloat
import androidx.compose.animation.core.updateTransition
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.rounded.ExpandMore
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.PreviewParameter
import com.infinitepower.newquiz.core.R
import com.infinitepower.newquiz.core.common.annotation.compose.PreviewNightLight
import com.infinitepower.newquiz.core.common.compose.preview.BooleanPreviewParameterProvider
import com.infinitepower.newquiz.core.theme.NewQuizTheme
@Composable
internal fun ExpandCategoriesButton(
modifier: Modifier = Modifier,
seeAllCategories: Boolean,
onSeeAllCategoriesClick: () -> Unit
) {
val transition = updateTransition(
targetState = seeAllCategories,
label = "Expand Categories Button"
)
val seeAllText = if (seeAllCategories) {
stringResource(id = R.string.see_less_categories)
} else {
stringResource(id = R.string.see_all_categories)
}
// Rotates the icon when the button is pressed
val rotation by transition.animateFloat(
label = "Icon Rotation",
) { state ->
if (state) 180f else 0f
}
Box(
modifier = modifier,
contentAlignment = Alignment.Center
) {
TextButton(onClick = onSeeAllCategoriesClick) {
Icon(
imageVector = Icons.Rounded.ExpandMore,
contentDescription = seeAllText,
modifier = Modifier
.size(ButtonDefaults.IconSize)
.graphicsLayer {
rotationZ = rotation
}
)
Spacer(modifier = Modifier.width(ButtonDefaults.IconSpacing))
Text(
text = seeAllText,
style = MaterialTheme.typography.bodyMedium,
modifier = Modifier.animateContentSize()
)
}
}
}
@Composable
@PreviewNightLight
private fun ExpandCategoriesButtonPreview(
@PreviewParameter(BooleanPreviewParameterProvider::class) seeAllCategories: Boolean
) {
NewQuizTheme {
Surface {
ExpandCategoriesButton(
seeAllCategories = seeAllCategories,
onSeeAllCategoriesClick = {}
)
}
}
}
| 2 | Kotlin | 18 | 145 | c333f78d95afba3ac5210a531783a9ad22da3ad1 | 3,124 | newquiz | Apache License 2.0 |
src/main/kotlin/uk/gov/justice/digital/hmpps/manageoffencesapi/config/CacheConfiguration.kt | ministryofjustice | 460,455,417 | false | {"Kotlin": 396525, "Shell": 1564, "Dockerfile": 1558} | package uk.gov.justice.digital.hmpps.manageoffencesapi.config
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.springframework.cache.CacheManager
import org.springframework.cache.annotation.CacheEvict
import org.springframework.cache.annotation.EnableCaching
import org.springframework.cache.concurrent.ConcurrentMapCacheManager
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.scheduling.annotation.EnableScheduling
import org.springframework.scheduling.annotation.Scheduled
import java.util.concurrent.TimeUnit.HOURS
@Configuration
@EnableCaching
@EnableScheduling
class CacheConfiguration {
@Bean
fun cacheManager(): CacheManager {
return ConcurrentMapCacheManager(
PCSC_LISTS,
PCSC_MARKERS,
SDS_EARLY_RELEASE_EXCLUSION_LISTS,
SDS_EARLY_RELEASE_EXCLUSIONS,
TORERA_OFFENCE_CODES,
)
}
@CacheEvict(
allEntries = true,
cacheNames = [PCSC_LISTS, PCSC_MARKERS, SDS_EARLY_RELEASE_EXCLUSION_LISTS, SDS_EARLY_RELEASE_EXCLUSIONS, TORERA_OFFENCE_CODES],
)
@Scheduled(fixedDelay = 2, timeUnit = HOURS)
fun cacheEvict() {
log.info(
"Evicting caches: {}, {}, {}, {}, {}",
PCSC_LISTS,
PCSC_MARKERS,
SDS_EARLY_RELEASE_EXCLUSION_LISTS,
SDS_EARLY_RELEASE_EXCLUSIONS,
TORERA_OFFENCE_CODES,
)
}
companion object {
val log: Logger = LoggerFactory.getLogger(CacheConfiguration::class.java)
const val PCSC_LISTS: String = "pcscLists"
const val PCSC_MARKERS: String = "pcscMarkers"
const val SDS_EARLY_RELEASE_EXCLUSION_LISTS: String = "sdsEarlyReleaseExclusionLists"
const val SDS_EARLY_RELEASE_EXCLUSIONS: String = "sdsEarlyReleaseExclusions"
const val TORERA_OFFENCE_CODES: String = "toreraOffenceCodes"
}
}
| 3 | Kotlin | 0 | 0 | 513dc1af1fc39f2484ba6e465581fb2cc84182e5 | 1,835 | hmpps-manage-offences-api | MIT License |
core/src/main/java/com/afdhal_fa/core/data/remote/network/ApiService.kt | Fuadafdhal | 298,238,007 | false | null | package com.afdhal_fa.core.data.remote.network
/**
* Copyright 2020 <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.
*/
import com.afdhal_fa.core.data.remote.response.GameResponse
import com.afdhal_fa.core.data.remote.response.ListGameResponse
import retrofit2.http.GET
import retrofit2.http.Path
import retrofit2.http.Query
interface ApiService {
@GET("games")
suspend fun getList(
@Query("page") page: Int,
@Query("page_size") page_size: Int
): ListGameResponse
@GET("games/{id}")
suspend fun getDetail(@Path("id") id: String): GameResponse
}
| 0 | Kotlin | 1 | 1 | e234cc9f74c9cf1ec632d019d5bcc5c0ba64a55b | 1,066 | InGame | Apache License 2.0 |
dagger/testSrc/com/android/tools/idea/dagger/concepts/ComponentProvisionMethodConceptTest.kt | JetBrains | 60,701,247 | false | {"Kotlin": 47327090, "Java": 36711107, "HTML": 1217549, "Starlark": 856686, "C++": 321587, "Python": 100400, "C": 71515, "Lex": 66732, "NSIS": 58538, "AIDL": 35209, "Shell": 28699, "CMake": 26717, "JavaScript": 18437, "Batchfile": 7828, "Smali": 7580, "RenderScript": 4411, "Makefile": 2298, "IDL": 269, "QMake": 18} | /*
* Copyright (C) 2023 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.tools.idea.dagger.concepts
import com.android.tools.idea.dagger.addDaggerAndHiltClasses
import com.android.tools.idea.kotlin.toPsiType
import com.android.tools.idea.testing.AndroidProjectRule
import com.android.tools.idea.testing.findParentElement
import com.android.tools.idea.testing.onEdt
import com.google.common.truth.Truth.assertThat
import com.google.common.truth.Truth.assertWithMessage
import com.intellij.ide.highlighter.JavaFileType
import com.intellij.openapi.project.Project
import com.intellij.psi.PsiMethod
import com.intellij.testFramework.RunsInEdt
import com.intellij.testFramework.fixtures.CodeInsightTestFixture
import org.jetbrains.kotlin.idea.KotlinFileType
import org.jetbrains.kotlin.idea.base.util.projectScope
import org.jetbrains.kotlin.psi.KtClass
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.psi.KtFunction
import org.jetbrains.kotlin.psi.KtProperty
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.JUnit4
@RunWith(JUnit4::class)
@RunsInEdt
class ComponentProvisionMethodConceptTest {
@get:Rule val projectRule = AndroidProjectRule.inMemory().onEdt()
private lateinit var myFixture: CodeInsightTestFixture
private lateinit var myProject: Project
@Before
fun setup() {
myFixture = projectRule.fixture
myProject = myFixture.project
}
@Test
fun indexer_provisionMethod() {
val psiFile =
myFixture.configureByText(
KotlinFileType.INSTANCE,
// language=kotlin
"""
package com.example
import dagger.Component
import dagger.Subcomponent
@Component
interface MyComponent {
fun provisionMethodComponent(): Foo
fun nonProvisionMethodComponent(bar: Bar): Foo
fun methodWithoutTypeComponent() = { return "" }
val provisionPropertyComponent: Foo
val provisionPropertyNotAbstractComponent = Foo()
}
@Subcomponent
interface MySubcomponent {
fun provisionMethodSubcomponent(): Foo
fun nonProvisionMethodSubcomponent(bar: Bar): Foo
fun methodWithoutTypeSubcomponent() = { return "" }
val provisionPropertySubcomponent: Foo
val provisionPropertyNotAbstractComponent = Foo()
}
interface NotAComponent {
fun provisionMethodNotAComponent(): Foo
fun nonProvisionMethodNotAComponent(bar: Bar): Foo
fun methodWithoutTypeNotAComponent() = { return "" }
val provisionPropertyNotAComponent: Foo
val provisionPropertyNotAbstractNotAComponent = Foo()
}
fun provisionMethodOutsideClass(): Foo
"""
.trimIndent()
) as KtFile
val indexResults = ComponentProvisionMethodConcept.indexers.runIndexerOn(psiFile)
assertThat(indexResults)
.containsExactly(
"Foo",
setOf(
ComponentProvisionMethodIndexValue("com.example.MyComponent", "provisionMethodComponent"),
ComponentProvisionMethodIndexValue(
"com.example.MySubcomponent",
"provisionMethodSubcomponent"
),
ComponentProvisionPropertyIndexValue(
"com.example.MyComponent",
"provisionPropertyComponent"
),
ComponentProvisionPropertyIndexValue(
"com.example.MySubcomponent",
"provisionPropertySubcomponent"
)
)
)
}
@Test
fun componentProvisionMethodIndexValue_serialization() {
val indexValue = ComponentProvisionMethodIndexValue("abc", "def")
assertThat(serializeAndDeserializeIndexValue(indexValue)).isEqualTo(indexValue)
}
@Test
fun componentProvisionMethodAndProperty_resolveToPsiElements_kotlin() {
addDaggerAndHiltClasses(myFixture)
myFixture.configureByText(
KotlinFileType.INSTANCE,
// language=kotlin
"""
package com.example
import dagger.Component
import dagger.Subcomponent
@Component
interface MyComponent {
fun provisionMethodComponent(): Foo
fun nonProvisionMethodComponent(bar: Bar): Foo
fun concreteMethodComponent() = { return "" }
val fooPropertyComponent: Foo
val fooPropertyConcreteComponent = Foo()
}
@Subcomponent
interface MySubcomponent {
fun provisionMethodSubcomponent(): Foo
fun nonProvisionMethodSubcomponent(bar: Bar): Foo
fun concreteMethodSubcomponent() = { return "" }
val fooPropertySubcomponent: Foo
val fooPropertyConcreteSubComponent = Foo()
}
interface NotAComponent {
fun provisionMethodNotAComponent(): Foo
fun nonProvisionMethodNotAComponent(bar: Bar): Foo
fun concreteMethodNotAComponent() = { return "" }
val fooPropertyNotAComponent: Foo
val fooPropertyConcreteNotAComponent = Foo()
}
class Foo
class Bar
"""
.trimIndent()
)
val fooPsiType = myFixture.findParentElement<KtClass>("class F|oo").toPsiType()!!
val provisionMethodComponentDaggerElement =
ComponentProvisionMethodDaggerElement(
myFixture.findParentElement<KtFunction>("provisionMethod|Component")
)
val provisionMethodSubcomponentDaggerElement =
ComponentProvisionMethodDaggerElement(
myFixture.findParentElement<KtFunction>("provisionMethod|Subcomponent")
)
val provisionPropertyComponentDaggerElement =
ComponentProvisionMethodDaggerElement(
myFixture.findParentElement<KtProperty>("fooProperty|Component"),
fooPsiType
)
val provisionPropertySubcomponentDaggerElement =
ComponentProvisionMethodDaggerElement(
myFixture.findParentElement<KtProperty>("fooProperty|Subcomponent"),
fooPsiType
)
// Expected to resolve
assertThat(
ComponentProvisionMethodIndexValue("com.example.MyComponent", "provisionMethodComponent")
.resolveToDaggerElements(myProject, myProject.projectScope())
)
.containsExactly(provisionMethodComponentDaggerElement)
assertThat(
ComponentProvisionPropertyIndexValue("com.example.MyComponent", "fooPropertyComponent")
.resolveToDaggerElements(myProject, myProject.projectScope())
)
.containsExactly(provisionPropertyComponentDaggerElement)
assertThat(
ComponentProvisionMethodIndexValue(
"com.example.MySubcomponent",
"provisionMethodSubcomponent"
)
.resolveToDaggerElements(myProject, myProject.projectScope())
)
.containsExactly(provisionMethodSubcomponentDaggerElement)
assertThat(
ComponentProvisionPropertyIndexValue(
"com.example.MySubcomponent",
"fooPropertySubcomponent"
)
.resolveToDaggerElements(myProject, myProject.projectScope())
)
.containsExactly(provisionPropertySubcomponentDaggerElement)
// Expected to not resolve
val nonResolving =
listOf(
"com.example.MyComponent" to "nonProvisionMethodComponent",
"com.example.MyComponent" to "concreteMethodComponent",
"com.example.MyComponent" to "fooPropertyConcreteComponent",
"com.example.MySubcomponent" to "nonProvisionMethodSubcomponent",
"com.example.MySubcomponent" to "concreteMethodSubcomponent",
"com.example.MySubcomponent" to "fooPropertyConcreteSubComponent",
"com.example.NotAComponent" to "provisionMethodNotAComponent",
"com.example.NotAComponent" to "nonProvisionMethodNotAComponent",
"com.example.NotAComponent" to "concreteMethodNotAComponent",
"com.example.NotAComponent" to "fooPropertyNotAComponent",
"com.example.NotAComponent" to "fooPropertyConcreteNotAComponent",
)
for ((classFqName, methodName) in nonResolving) {
assertWithMessage("Resolution for ($classFqName, $methodName)")
.that(
ComponentProvisionMethodIndexValue(classFqName, methodName)
.resolveToDaggerElements(myProject, myProject.projectScope()),
)
.isEmpty()
assertWithMessage("Resolution for ($classFqName, $methodName)")
.that(
ComponentProvisionPropertyIndexValue(classFqName, methodName)
.resolveToDaggerElements(myProject, myProject.projectScope()),
)
.isEmpty()
}
}
@Test
fun componentProvisionMethod_resolveToPsiElements_java() {
addDaggerAndHiltClasses(myFixture)
myFixture.configureByText(
JavaFileType.INSTANCE,
// language=java
"""
package com.example;
import dagger.Component;
import dagger.Subcomponent;
@Component
interface MyComponent {
Foo provisionMethodComponent();
Foo nonProvisionMethodComponent(Bar bar);
Foo concreteMethodComponent() { return new Foo(); }
}
@Subcomponent
interface MySubcomponent {
Foo provisionMethodSubcomponent();
Foo nonProvisionMethodSubcomponent(Bar bar);
Foo concreteMethodSubcomponent() { return new Foo(); }
}
interface NotAComponent {
Foo provisionMethodNotAComponent();
Foo nonProvisionMethodNotAComponent(Bar bar);
Foo concreteMethodNotAComponent() { return new Foo(); }
}
class Foo {}
class Bar {}
"""
.trimIndent()
)
val provisionMethodComponentDaggerElement =
ComponentProvisionMethodDaggerElement(
myFixture.findParentElement<PsiMethod>("provisionMethod|Component")
)
val provisionMethodSubcomponentDaggerElement =
ComponentProvisionMethodDaggerElement(
myFixture.findParentElement<PsiMethod>("provisionMethod|Subcomponent")
)
// Expected to resolve
assertThat(
ComponentProvisionMethodIndexValue("com.example.MyComponent", "provisionMethodComponent")
.resolveToDaggerElements(myProject, myProject.projectScope())
)
.containsExactly(provisionMethodComponentDaggerElement)
assertThat(
ComponentProvisionMethodIndexValue(
"com.example.MySubcomponent",
"provisionMethodSubcomponent"
)
.resolveToDaggerElements(myProject, myProject.projectScope())
)
.containsExactly(provisionMethodSubcomponentDaggerElement)
// Expected to not resolve
val nonResolving =
listOf(
"com.example.MyComponent" to "nonProvisionMethodComponent",
"com.example.MyComponent" to "concreteMethodComponent",
"com.example.MySubcomponent" to "nonProvisionMethodSubcomponent",
"com.example.MySubcomponent" to "concreteMethodSubcomponent",
"com.example.NotAComponent" to "provisionMethodNotAComponent",
"com.example.NotAComponent" to "nonProvisionMethodNotAComponent",
"com.example.NotAComponent" to "concreteMethodNotAComponent"
)
for ((classFqName, methodName) in nonResolving) {
assertWithMessage("Resolution for ($classFqName, $methodName)")
.that(
ComponentProvisionMethodIndexValue(classFqName, methodName)
.resolveToDaggerElements(myProject, myProject.projectScope()),
)
.isEmpty()
}
}
@Test
fun componentProvisionPropertyIndexValue_serialization() {
val indexValue = ComponentProvisionPropertyIndexValue("abc", "def")
assertThat(serializeAndDeserializeIndexValue(indexValue)).isEqualTo(indexValue)
}
}
| 3 | Kotlin | 220 | 912 | d88742a5542b0852e7cb2dd6571e01576cb52841 | 12,146 | android | Apache License 2.0 |
nlp/front/storage-mongo/target/generated-sources/kapt/compile/fr/vsct/tock/nlp/front/shared/config/ApplicationDefinition_.kt | cooksane | 151,793,390 | true | {"Kotlin": 2507910, "TypeScript": 358055, "HTML": 140949, "CSS": 33484, "JavaScript": 5174, "Shell": 1591} | package fr.vsct.tock.nlp.front.shared.config
import fr.vsct.tock.nlp.core.NlpEngineType
import java.util.Locale
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.collections.Collection
import kotlin.collections.Map
import kotlin.collections.Set
import kotlin.reflect.KProperty1
import org.litote.kmongo.Id
import org.litote.kmongo.property.KCollectionPropertyPath
import org.litote.kmongo.property.KCollectionSimplePropertyPath
import org.litote.kmongo.property.KMapPropertyPath
import org.litote.kmongo.property.KMapSimplePropertyPath
import org.litote.kmongo.property.KPropertyPath
class ApplicationDefinition_<T>(previous: KPropertyPath<T, *>?, property: KProperty1<*, ApplicationDefinition?>) : KPropertyPath<T, ApplicationDefinition?>(previous,property) {
val name_: KPropertyPath<T, String?>
get() = org.litote.kmongo.property.KPropertyPath<T, kotlin.String?>(this,ApplicationDefinition::name)
val namespace: KPropertyPath<T, String?>
get() = org.litote.kmongo.property.KPropertyPath<T, kotlin.String?>(this,ApplicationDefinition::namespace)
val intents: KCollectionSimplePropertyPath<T, Id<IntentDefinition>?>
get() = org.litote.kmongo.property.KCollectionSimplePropertyPath<T, org.litote.kmongo.Id<fr.vsct.tock.nlp.front.shared.config.IntentDefinition>?>(this,ApplicationDefinition::intents)
val supportedLocales: KCollectionSimplePropertyPath<T, Locale?>
get() = org.litote.kmongo.property.KCollectionSimplePropertyPath<T, java.util.Locale?>(this,ApplicationDefinition::supportedLocales)
val intentStatesMap: KMapSimplePropertyPath<T, Id<IntentDefinition>?, Set<String>?>
get() = org.litote.kmongo.property.KMapSimplePropertyPath<T, org.litote.kmongo.Id<fr.vsct.tock.nlp.front.shared.config.IntentDefinition>?, kotlin.collections.Set<kotlin.String>?>(this,ApplicationDefinition::intentStatesMap)
val nlpEngineType: KPropertyPath<T, NlpEngineType?>
get() = org.litote.kmongo.property.KPropertyPath<T, fr.vsct.tock.nlp.core.NlpEngineType?>(this,ApplicationDefinition::nlpEngineType)
val mergeEngineTypes: KPropertyPath<T, Boolean?>
get() = org.litote.kmongo.property.KPropertyPath<T, kotlin.Boolean?>(this,ApplicationDefinition::mergeEngineTypes)
val useEntityModels: KPropertyPath<T, Boolean?>
get() = org.litote.kmongo.property.KPropertyPath<T, kotlin.Boolean?>(this,ApplicationDefinition::useEntityModels)
val supportSubEntities: KPropertyPath<T, Boolean?>
get() = org.litote.kmongo.property.KPropertyPath<T, kotlin.Boolean?>(this,ApplicationDefinition::supportSubEntities)
val _id: KPropertyPath<T, Id<ApplicationDefinition>?>
get() = org.litote.kmongo.property.KPropertyPath<T, org.litote.kmongo.Id<fr.vsct.tock.nlp.front.shared.config.ApplicationDefinition>?>(this,ApplicationDefinition::_id)
companion object {
val Name: KProperty1<ApplicationDefinition, String?>
get() = ApplicationDefinition::name
val Namespace: KProperty1<ApplicationDefinition, String?>
get() = ApplicationDefinition::namespace
val Intents: KCollectionSimplePropertyPath<ApplicationDefinition, Id<IntentDefinition>?>
get() = KCollectionSimplePropertyPath(null, ApplicationDefinition::intents)
val SupportedLocales: KCollectionSimplePropertyPath<ApplicationDefinition, Locale?>
get() = KCollectionSimplePropertyPath(null, ApplicationDefinition::supportedLocales)
val IntentStatesMap: KMapSimplePropertyPath<ApplicationDefinition, Id<IntentDefinition>?, Set<String>?>
get() = KMapSimplePropertyPath(null, ApplicationDefinition::intentStatesMap)
val NlpEngineType: KProperty1<ApplicationDefinition, NlpEngineType?>
get() = ApplicationDefinition::nlpEngineType
val MergeEngineTypes: KProperty1<ApplicationDefinition, Boolean?>
get() = ApplicationDefinition::mergeEngineTypes
val UseEntityModels: KProperty1<ApplicationDefinition, Boolean?>
get() = ApplicationDefinition::useEntityModels
val SupportSubEntities: KProperty1<ApplicationDefinition, Boolean?>
get() = ApplicationDefinition::supportSubEntities
val _id: KProperty1<ApplicationDefinition, Id<ApplicationDefinition>?>
get() = ApplicationDefinition::_id}
}
class ApplicationDefinition_Col<T>(previous: KPropertyPath<T, *>?, property: KProperty1<*, Collection<ApplicationDefinition>?>) : KCollectionPropertyPath<T, ApplicationDefinition?, ApplicationDefinition_<T>>(previous,property) {
val name_: KPropertyPath<T, String?>
get() = org.litote.kmongo.property.KPropertyPath<T, kotlin.String?>(this,ApplicationDefinition::name)
val namespace: KPropertyPath<T, String?>
get() = org.litote.kmongo.property.KPropertyPath<T, kotlin.String?>(this,ApplicationDefinition::namespace)
val intents: KCollectionSimplePropertyPath<T, Id<IntentDefinition>?>
get() = org.litote.kmongo.property.KCollectionSimplePropertyPath<T, org.litote.kmongo.Id<fr.vsct.tock.nlp.front.shared.config.IntentDefinition>?>(this,ApplicationDefinition::intents)
val supportedLocales: KCollectionSimplePropertyPath<T, Locale?>
get() = org.litote.kmongo.property.KCollectionSimplePropertyPath<T, java.util.Locale?>(this,ApplicationDefinition::supportedLocales)
val intentStatesMap: KMapSimplePropertyPath<T, Id<IntentDefinition>?, Set<String>?>
get() = org.litote.kmongo.property.KMapSimplePropertyPath<T, org.litote.kmongo.Id<fr.vsct.tock.nlp.front.shared.config.IntentDefinition>?, kotlin.collections.Set<kotlin.String>?>(this,ApplicationDefinition::intentStatesMap)
val nlpEngineType: KPropertyPath<T, NlpEngineType?>
get() = org.litote.kmongo.property.KPropertyPath<T, fr.vsct.tock.nlp.core.NlpEngineType?>(this,ApplicationDefinition::nlpEngineType)
val mergeEngineTypes: KPropertyPath<T, Boolean?>
get() = org.litote.kmongo.property.KPropertyPath<T, kotlin.Boolean?>(this,ApplicationDefinition::mergeEngineTypes)
val useEntityModels: KPropertyPath<T, Boolean?>
get() = org.litote.kmongo.property.KPropertyPath<T, kotlin.Boolean?>(this,ApplicationDefinition::useEntityModels)
val supportSubEntities: KPropertyPath<T, Boolean?>
get() = org.litote.kmongo.property.KPropertyPath<T, kotlin.Boolean?>(this,ApplicationDefinition::supportSubEntities)
val _id: KPropertyPath<T, Id<ApplicationDefinition>?>
get() = org.litote.kmongo.property.KPropertyPath<T, org.litote.kmongo.Id<fr.vsct.tock.nlp.front.shared.config.ApplicationDefinition>?>(this,ApplicationDefinition::_id)
@Suppress("UNCHECKED_CAST")
override fun memberWithAdditionalPath(additionalPath: String): ApplicationDefinition_<T> = ApplicationDefinition_(this, customProperty(this, additionalPath))}
class ApplicationDefinition_Map<T, K>(previous: KPropertyPath<T, *>?, property: KProperty1<*, Map<K, ApplicationDefinition>?>) : KMapPropertyPath<T, K, ApplicationDefinition?, ApplicationDefinition_<T>>(previous,property) {
val name_: KPropertyPath<T, String?>
get() = org.litote.kmongo.property.KPropertyPath<T, kotlin.String?>(this,ApplicationDefinition::name)
val namespace: KPropertyPath<T, String?>
get() = org.litote.kmongo.property.KPropertyPath<T, kotlin.String?>(this,ApplicationDefinition::namespace)
val intents: KCollectionSimplePropertyPath<T, Id<IntentDefinition>?>
get() = org.litote.kmongo.property.KCollectionSimplePropertyPath<T, org.litote.kmongo.Id<fr.vsct.tock.nlp.front.shared.config.IntentDefinition>?>(this,ApplicationDefinition::intents)
val supportedLocales: KCollectionSimplePropertyPath<T, Locale?>
get() = org.litote.kmongo.property.KCollectionSimplePropertyPath<T, java.util.Locale?>(this,ApplicationDefinition::supportedLocales)
val intentStatesMap: KMapSimplePropertyPath<T, Id<IntentDefinition>?, Set<String>?>
get() = org.litote.kmongo.property.KMapSimplePropertyPath<T, org.litote.kmongo.Id<fr.vsct.tock.nlp.front.shared.config.IntentDefinition>?, kotlin.collections.Set<kotlin.String>?>(this,ApplicationDefinition::intentStatesMap)
val nlpEngineType: KPropertyPath<T, NlpEngineType?>
get() = org.litote.kmongo.property.KPropertyPath<T, fr.vsct.tock.nlp.core.NlpEngineType?>(this,ApplicationDefinition::nlpEngineType)
val mergeEngineTypes: KPropertyPath<T, Boolean?>
get() = org.litote.kmongo.property.KPropertyPath<T, kotlin.Boolean?>(this,ApplicationDefinition::mergeEngineTypes)
val useEntityModels: KPropertyPath<T, Boolean?>
get() = org.litote.kmongo.property.KPropertyPath<T, kotlin.Boolean?>(this,ApplicationDefinition::useEntityModels)
val supportSubEntities: KPropertyPath<T, Boolean?>
get() = org.litote.kmongo.property.KPropertyPath<T, kotlin.Boolean?>(this,ApplicationDefinition::supportSubEntities)
val _id: KPropertyPath<T, Id<ApplicationDefinition>?>
get() = org.litote.kmongo.property.KPropertyPath<T, org.litote.kmongo.Id<fr.vsct.tock.nlp.front.shared.config.ApplicationDefinition>?>(this,ApplicationDefinition::_id)
@Suppress("UNCHECKED_CAST")
override fun memberWithAdditionalPath(additionalPath: String): ApplicationDefinition_<T> = ApplicationDefinition_(this, customProperty(this, additionalPath))}
| 0 | Kotlin | 0 | 0 | cd5c55e99cda91b5f7d790503de88137d3a3cc3c | 9,355 | tock | Apache License 2.0 |
app/src/main/java/com/filip/cryptoViewer/presentation/ui/screens/coin_detail/CoinDetailState.kt | filipus959 | 852,338,147 | false | {"Kotlin": 131654} | package com.filip.cryptoViewer.presentation.ui.screens.coin_detail
import com.filip.cryptoViewer.domain.model.CoinDetail
import com.filip.cryptoViewer.presentation.UIState
data class CoinDetailState(
override val isLoading: Boolean = false,
val coin: CoinDetail? = null,
override val error: String = ""
) : UIState | 0 | Kotlin | 0 | 0 | 292eff37a8bb7d659cf39bd7f0d24a49e77f9795 | 328 | CryptoViewer | Apache License 2.0 |
compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/UnresolvedExpressionTypeAccess.kt | JetBrains | 3,432,266 | false | {"Kotlin": 79571273, "Java": 6776465, "Swift": 4063829, "C": 2609744, "C++": 1957654, "Objective-C++": 175279, "JavaScript": 130754, "Python": 59855, "Shell": 34920, "Objective-C": 21463, "Lex": 21452, "Batchfile": 11382, "CSS": 11368, "Ruby": 10470, "Dockerfile": 9907, "Groovy": 7092, "EJS": 5241, "CMake": 4473, "HTML": 2699, "Puppet": 1698, "FreeMarker": 1393, "Roff": 725, "Scala": 80} | /*
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.fir.expressions
@RequiresOptIn("Accessing `coneTypeOrNull` hides potential bugs if at the given point all expression and their types should be resolved. Consider using `resolvedType` instead.")
annotation class UnresolvedExpressionTypeAccess
| 181 | Kotlin | 5748 | 49,172 | 33eb9cef3d146062c103f9853d772f0a1da0450e | 482 | kotlin | Apache License 2.0 |
idea/testData/intentions/operatorToFunction/binaryNotIn.kt | JakeWharton | 99,388,807 | true | null | // WITH_RUNTIME
fun foo(a: Int, b: Array<Int>) {
a <caret>!in b
}
| 0 | Kotlin | 28 | 83 | 4383335168338df9bbbe2a63cb213a68d0858104 | 70 | kotlin | Apache License 2.0 |
core/builtins/src/kotlin/reflect/KClass.kt | flire | 39,203,446 | true | {"Java": 15418565, "Kotlin": 8965491, "JavaScript": 176060, "HTML": 23089, "Lex": 17327, "Protocol Buffer": 13056, "ANTLR": 9689, "CSS": 9431, "Shell": 3931, "IDL": 3257, "Groovy": 3010, "Batchfile": 2831} | /*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package kotlin.reflect
/**
* Represents a class and provides introspection capabilities.
* Instances of this class are obtainable by the `::class` syntax.
* See the [Kotlin language documentation](http://kotlinlang.org/docs/reference/reflection.html#class-references)
* for more information.
*
* @param T the type of the class.
*/
public interface KClass<T> : KDeclarationContainer {
/**
* The simple name of the class as it was declared in the source code,
* or `null` if the class has no name (if, for example, it is an anonymous object literal).
*/
public val simpleName: String?
/**
* The fully qualified name of the class which consists of names of the declaring package,
* all outer classes of this class and the class itself separated by dots,
* or `null` if the class is local or it is an anonymous object literal.
*/
public val qualifiedName: String?
/**
* Returns non-extension properties declared in this class and all of its superclasses.
*/
public val properties: Collection<KProperty1<T, *>>
/**
* Returns extension properties declared in this class and all of its superclasses.
*/
public val extensionProperties: Collection<KProperty2<T, *, *>>
}
| 0 | Java | 0 | 0 | 2fbceb3e1dee90d5a34dbc7730c7f6da8497a4da | 1,862 | kotlin | Apache License 2.0 |
build-tools/aaptcompiler/src/main/java/com/android/aaptcompiler/XmlResourceBuilder.kt | RivanParmar | 526,653,590 | false | {"Java": 48334972, "Kotlin": 8897422, "HTML": 109232, "Lex": 13233, "ReScript": 3232, "Makefile": 2194} | package com.android.aaptcompiler
import com.android.aapt.Resources
import com.google.common.base.Preconditions
/**
* Tracks the active namespaces of all active elements in the [XmlResourceBuilder]
*
* This maps prefix -> a stack of uris. As prefixes may be redefined as new child elements are
* added, and need to be undefined as elements are finished.
*/
class NamespaceContext {
private val prefixMap = mutableMapOf<String, MutableList<String>>()
internal fun push(prefix: String, uri: String) {
val prefixList = prefixMap[prefix] ?: mutableListOf()
prefixList.add(uri)
prefixMap[prefix] = prefixList
}
internal fun pop(prefix: String) {
Preconditions.checkState(prefixMap[prefix] != null)
val list = prefixMap[prefix]!!
list.removeAt(list.lastIndex)
if (list.isEmpty()) {
prefixMap.remove(prefix)
}
}
fun namespacePrefixes() = prefixMap.keys
fun uriForPrefix(prefix: String) = prefixMap[prefix]?.lastOrNull()
}
class XmlResourceBuilder(val file: ResourceFile, val skipWhitespaceText: Boolean = true) {
/** The stack of the current element and all ancestors. */
private val elementStack = mutableListOf<Resources.XmlElement.Builder>()
private val elementSourceStack = mutableListOf<Resources.SourcePosition>()
/** Storage for the completed XmlResource when it is finished building. */
private var result: XmlResource? = null
/**
* The text in the current text state, since consecutive text elements should be joined to be
* in line with aapt2.
*/
private var currentTextState = ""
private lateinit var textSource: Resources.SourcePosition
/**
* Tracks the active namespaces of all active elements.
*/
val namespaceContext = NamespaceContext()
fun build(): XmlResource {
Preconditions.checkState(isFinished())
return result!!
}
fun isFinished(): Boolean = result != null
fun startElement(
name: String,
namespace: String,
lineNumber: Int = 0,
columnNumber: Int = 0): XmlResourceBuilder {
Preconditions.checkState(!isFinished())
finishTextState()
val newElement = Resources.XmlElement.newBuilder()
.setName(name)
.setNamespaceUri(namespace)
elementStack.add(newElement)
elementSourceStack.add(
Resources.SourcePosition.newBuilder()
.setLineNumber(lineNumber)
.setColumnNumber(columnNumber)
.build()
)
return this
}
fun endElement(): XmlResourceBuilder {
Preconditions.checkState(elementStack.isNotEmpty())
finishTextState()
// Build the xml Node.
val node = Resources.XmlNode.newBuilder()
.setElement(elementStack.last())
.setSource(elementSourceStack.last())
elementStack.removeAt(elementStack.lastIndex)
elementSourceStack.removeAt(elementSourceStack.lastIndex)
// Clean up namespaces
for (namespace in node.getElement().getNamespaceDeclarationList()) {
namespaceContext.pop(namespace.getPrefix())
}
if (elementStack.isEmpty()) {
// We've finished the top level element so store it to be fetched later.
result = XmlResource(file, node.build())
return this
}
// If not, then this is a child element and should be added to the next stack element.
elementStack.last().addChild(node)
return this
}
fun addNamespaceDeclaration(
uri: String, prefix: String, lineNumber: Int = 0, columnNumber: Int = 0): XmlResourceBuilder {
Preconditions.checkState(elementStack.isNotEmpty())
val currentElement = elementStack.last()
currentElement.addNamespaceDeclaration(
Resources.XmlNamespace.newBuilder()
.setUri(uri)
.setPrefix(prefix)
.setSource(
Resources.SourcePosition.newBuilder()
.setLineNumber(lineNumber)
.setColumnNumber(columnNumber)))
// Manage the namespace context.
namespaceContext.push(prefix, uri)
return this
}
fun addAttribute(
name: String,
namespace: String,
value: String,
lineNumber: Int = 0,
columnNumber: Int = 0
): XmlResourceBuilder {
Preconditions.checkState(elementStack.isNotEmpty())
val currentElement = elementStack.last()
currentElement.addAttribute(
Resources.XmlAttribute.newBuilder()
.setName(name)
.setNamespaceUri(namespace)
.setValue(value)
.setSource(
Resources.SourcePosition.newBuilder()
.setLineNumber(lineNumber)
.setColumnNumber(columnNumber)))
return this
}
fun findAttribute(name: String, namespace: String): String? {
val attrList = elementStack.last().getAttributeList()
return attrList.find {it.getName() == name && it.getNamespaceUri() == namespace}?.getValue()
}
/**
* Adds a text element to the current XML element.
*
* The text is not immediately added, but is held by the builder so that consecutive text elements
* can be accumulated as a single element for the protocol buffer. Whenever the current XML tag is
* finished or a non-text element is encountered such as a comment or new tag, the current text
* state is flushed, and the text element is added.
*/
fun addText(text: String, lineNumber: Int = 0, columnNumber: Int = 0): XmlResourceBuilder {
if ((skipWhitespaceText && text.isBlank()) || text.isEmpty()) return this
if (currentTextState.isEmpty()) {
textSource = Resources.SourcePosition.newBuilder()
.setLineNumber(lineNumber)
.setColumnNumber(columnNumber)
.build()
currentTextState = text
return this
}
currentTextState += text
return this
}
/**
* Tells the proto builder that a comment was encountered in the XML.
*
* Comments are not written to the protocol buffer, but they do indicate that any previously
* recorded text is finished. I.e.
*
* <element>
* Some text.
* <!--comment-->
* Some other text.
* </element>
*
* should be treated differently than:
*
* <element>
* Some text
* that is continued here.
* </element>
*
*/
fun addComment(): XmlResourceBuilder {
Preconditions.checkState(elementStack.isNotEmpty())
finishTextState()
return this
}
private fun finishTextState() {
if (currentTextState.isEmpty()) return
val currentElement = elementStack.last()
currentElement.addChild(
Resources.XmlNode.newBuilder()
.setText(currentTextState)
.setSource(textSource))
currentTextState = ""
}
}
| 0 | Java | 2 | 17 | a497291d77bba1aa34271808088fe1e8aab5efe2 | 6,541 | androlabs | Apache License 2.0 |
plugin-build/plugin/src/main/java/com/ncorti/ktfmt/gradle/tasks/KtfmtBaseTask.kt | cortinico | 312,611,660 | false | {"Kotlin": 98202} | package com.ncorti.ktfmt.gradle.tasks
import com.ncorti.ktfmt.gradle.FormattingOptionsBean
import com.ncorti.ktfmt.gradle.tasks.worker.KtfmtWorkAction
import com.ncorti.ktfmt.gradle.tasks.worker.Result
import com.ncorti.ktfmt.gradle.util.d
import java.util.UUID
import org.gradle.api.file.ConfigurableFileCollection
import org.gradle.api.file.FileCollection
import org.gradle.api.file.FileTree
import org.gradle.api.file.ProjectLayout
import org.gradle.api.provider.Property
import org.gradle.api.tasks.Classpath
import org.gradle.api.tasks.IgnoreEmptyDirectories
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.InputFiles
import org.gradle.api.tasks.PathSensitive
import org.gradle.api.tasks.PathSensitivity
import org.gradle.api.tasks.SkipWhenEmpty
import org.gradle.api.tasks.SourceTask
import org.gradle.api.tasks.TaskAction
import org.gradle.api.tasks.options.Option
import org.gradle.workers.WorkQueue
import org.gradle.workers.WorkerExecutor
/** ktfmt-gradle base Gradle tasks. Contains methods to properly process a single file with ktfmt */
@Suppress("LeakingThis")
abstract class KtfmtBaseTask
internal constructor(
private val workerExecutor: WorkerExecutor,
private val layout: ProjectLayout,
) : SourceTask() {
init {
includeOnly.convention("")
}
@get:Classpath @get:InputFiles internal abstract val ktfmtClasspath: ConfigurableFileCollection
@get:Input internal abstract val formattingOptionsBean: Property<FormattingOptionsBean>
@get:Option(
option = "include-only",
description =
"A comma separate list of relative file paths to include exclusively. " +
"If set the task will run the processing only on such files.",
)
@get:Input
abstract val includeOnly: Property<String>
@PathSensitive(PathSensitivity.RELATIVE)
@InputFiles
@IgnoreEmptyDirectories
@SkipWhenEmpty
override fun getSource(): FileTree = super.getSource()
@TaskAction
internal fun taskAction() {
val workQueue =
workerExecutor.processIsolation { spec -> spec.classpath.from(ktfmtClasspath) }
execute(workQueue)
}
protected abstract fun execute(workQueue: WorkQueue)
internal fun <T : KtfmtWorkAction> FileCollection.submitToQueue(
queue: WorkQueue,
action: Class<T>,
): List<Result> {
val workingDir = temporaryDir.resolve(UUID.randomUUID().toString())
workingDir.mkdirs()
try {
val includedFiles =
IncludedFilesParser.parse(includeOnly.get(), layout.projectDirectory.asFile)
logger.d(
"Preparing to format: includeOnly=${includeOnly.orNull}, includedFiles = $includedFiles"
)
forEach {
queue.submit(action) { parameters ->
parameters.sourceFile.set(it)
parameters.formattingOptions.set(formattingOptionsBean.get())
parameters.includedFiles.set(includedFiles)
parameters.projectDir.set(layout.projectDirectory)
parameters.workingDir.set(workingDir)
}
}
queue.await()
val files = workingDir.listFiles() ?: emptyArray()
return files
.asSequence()
.filter { it.isFile }
.map { Result.fromResultString(it.readText()) }
.toList()
} finally {
// remove working directory and everything in it
workingDir.deleteRecursively()
}
}
}
| 10 | Kotlin | 19 | 154 | 46b6df2d6f909e7352e153403913b2758629db1c | 3,600 | ktfmt-gradle | MIT License |
elasticsearch/src/test/kotlin/com/oneliang/ktx/frame/test/elasticsearch/TestElasticSearch.kt | oneliang | 262,052,605 | false | null | package com.oneliang.ktx.frame.test.elasticsearch
import co.elastic.clients.elasticsearch.ElasticsearchClient
import co.elastic.clients.elasticsearch._types.FieldValue
import co.elastic.clients.elasticsearch._types.query_dsl.MatchQuery
import co.elastic.clients.elasticsearch._types.query_dsl.Query
import co.elastic.clients.elasticsearch._types.query_dsl.TermQuery
import co.elastic.clients.elasticsearch.core.IndexResponse
import co.elastic.clients.elasticsearch.core.SearchRequest
import co.elastic.clients.elasticsearch.core.SearchResponse
import co.elastic.clients.elasticsearch.core.search.TotalHitsRelation
import co.elastic.clients.json.jackson.JacksonJsonpMapper
import co.elastic.clients.transport.ElasticsearchTransport
import co.elastic.clients.transport.rest_client.RestClientTransport
import com.oneliang.ktx.frame.elasticsearch.get
import com.oneliang.ktx.frame.elasticsearch.index
import io.github.bonigarcia.wdm.WebDriverManager
import org.apache.http.HttpHost
import org.apache.http.ssl.SSLContextBuilder
import org.apache.http.ssl.SSLContexts
import org.elasticsearch.client.RestClient
import org.openqa.selenium.WebDriver
import org.openqa.selenium.chrome.ChromeDriver
import org.openqa.selenium.chrome.ChromeOptions
import org.openqa.selenium.support.events.EventFiringDecorator
import org.openqa.selenium.support.events.WebDriverListener
import java.nio.file.Files
import java.nio.file.Path
import java.nio.file.Paths
import java.security.KeyStore
import java.security.cert.Certificate
import java.security.cert.CertificateFactory
import javax.net.ssl.SSLContext
private fun indexWithHttp(esClient: ElasticsearchClient) {
val product = Product("bk-1", "City bike", 123.0)
val response: IndexResponse = esClient.index("products", product.sku, product)
println("Indexed with version " + response.version())
}
private fun getWithHttp(esClient: ElasticsearchClient) {
esClient.get("products", "bk-1", Product::class, { getResponse, product ->
println("Product name " + product.name)
}, { getResponse ->
println("Product not found")
})
}
private fun searchWithHttp(esClient: ElasticsearchClient) {
val searchText = "bike"
val searchResponse = esClient.search(
{ s: SearchRequest.Builder ->
s.index("products").query { q: Query.Builder ->
q.match { t: MatchQuery.Builder ->
t.field("name").query(searchText)
}
}
},
Product::class.java
)
val total = searchResponse.hits().total()
val isExactResult = total!!.relation() == TotalHitsRelation.Eq
if (isExactResult) {
println("There are " + total.value() + " results")
} else {
println("There are more than " + total.value() + " results")
}
val hits = searchResponse.hits().hits()
for (hit in hits) {
val product = hit.source()
println("Found product " + product!!.sku + ", score " + hit.score())
}
}
private fun withHttp() {
// Create the low-level client
val restClient: RestClient = RestClient.builder(HttpHost("localhost", 9200)).build()
// Create the transport with a Jackson mapper
val transport: ElasticsearchTransport = RestClientTransport(restClient, JacksonJsonpMapper())
// And create the API client
val esClient = ElasticsearchClient(transport)
// indexWithHttp(esClient)
getWithHttp(esClient)
searchWithHttp(esClient)
}
private fun withHttps() {
val caPath = "D:/Dandelion/tool/elasticsearch/elasticsearch-8.4.2/config/certs/http_ca.crt"
val caCertificatePath: Path = Paths.get(caPath)
val factory: CertificateFactory = CertificateFactory.getInstance("X.509")
var trustedCa: Certificate
Files.newInputStream(caCertificatePath).use { inputStream -> trustedCa = factory.generateCertificate(inputStream) }
val trustStore = KeyStore.getInstance("pkcs12")
trustStore.load(null, null)
trustStore.setCertificateEntry("ca", trustedCa)
val sslContextBuilder: SSLContextBuilder = SSLContexts.custom()
.loadTrustMaterial(trustStore, null)
val sslContext: SSLContext = sslContextBuilder.build()
val restClient: RestClient = RestClient.builder(HttpHost("localhost", 9200, "https")).setHttpClientConfigCallback { httpClientBuilder ->
httpClientBuilder.setSSLContext(sslContext)
}.build()
// Create the low-level client
// val restClient: RestClient = RestClient.builder(HttpHost("localhost", 9200)).build()
// Create the transport with a Jackson mapper
val transport: ElasticsearchTransport = RestClientTransport(restClient, JacksonJsonpMapper())
// And create the API client
val client = ElasticsearchClient(transport)
val search: SearchResponse<Product> = client.search(
{ s: SearchRequest.Builder ->
s.index("products").query { q: Query.Builder ->
q.term { t: TermQuery.Builder ->
t.field("name").value { v: FieldValue.Builder ->
v.stringValue("bicycle")
}
}
}
},
Product::class.java
)
for (hit in search.hits().hits()) {
println(hit.source())
}
}
fun main() {
// WebDriverManager.chromedriver().config().isUseMirror = true
WebDriverManager.chromedriver().setup()
// val driver: WebDriver = ChromeDriver()
val chromeOptions = ChromeOptions()
chromeOptions.addArguments("--headless")
val prefs = mapOf<String, Any>(
"permissions.default.stylesheet" to 2,
"profile.default_content_settings.images" to 2
)
// chromeOptions.setExperimentalOption("permissions.default.stylesheet",2)
chromeOptions.setExperimentalOption("prefs", prefs)
val driver = ChromeDriver(chromeOptions)
val listener: WebDriverListener = WebEventListener()
val decorated: WebDriver = EventFiringDecorator<WebDriver>(listener).decorate(driver)
decorated.get("https://www.baidu.com")
println(decorated.title)
decorated.quit()
// withHttp()
} | 0 | Kotlin | 1 | 0 | dfde37b0b72fe99b44ec20629fdf804031328f63 | 6,141 | frame-kotlin | Apache License 2.0 |
app/src/main/java/com/kilomobi/cigobox/ui/screen/InventoryScreen.kt | fkistner-dev | 734,864,503 | false | {"Kotlin": 34762} | /*
* Created by fkistner.
* <EMAIL>
* Last modified on 31/12/2023 01:07.
* Copyright (c) 2023.
* All rights reserved.
*/
package com.kilomobi.cigobox.presentation.list
import android.widget.Toast
import androidx.compose.foundation.Image
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.KeyboardArrowDown
import androidx.compose.material.icons.filled.KeyboardArrowUp
import androidx.compose.material.icons.outlined.Warning
import androidx.compose.material3.Button
import androidx.compose.material3.Card
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.Icon
import androidx.compose.material3.LinearProgressIndicator
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.kilomobi.cigobox.domain.Appetizer
import com.kilomobi.cigobox.domain.BoxOperation
import com.kilomobi.cigobox.domain.Category
import com.kilomobi.cigobox.domain.usecase.GetBoxItemTextUseCase
import com.kilomobi.cigobox.presentation.ui.HeaderItem
import com.kilomobi.cigobox.presentation.ui.HorizontalFilterRow
import com.kilomobi.cigobox.ui.theme.CigOrange
import com.kilomobi.cigobox.ui.theme.CigoGrey
@Composable
fun InventoryScreen(
state: InventoryScreenState,
toggleEdit: () -> Unit,
subtractBox: () -> Unit,
validateStock: () -> Unit,
getBoxOperationList: (playerCount: Int) -> List<BoxOperation>,
selectBoxAction: (playerCount: Int) -> Unit,
filterAction: (category: Category) -> Unit,
updateQuantity: (id: Int, quantity: Int) -> Unit,
loadInventory: () -> Unit
) {
LazyColumn(
contentPadding = PaddingValues(
vertical = 8.dp,
horizontal = 8.dp
)
) {
item {
HeaderItem(
state.allowEdit,
state.isBoxScreen,
state.selectedPlayerBox,
{ toggleEdit() },
{ subtractBox() },
{ validateStock() })
}
if (state.isBoxScreen) {
val boxList = listOf(3, 4, 5, 6, 7)
items(boxList) { playerCount ->
val boxOperations = getBoxOperationList(playerCount)
BoxItem(
playerCount.toString(),
boxOperations,
state.selectedPlayerBox
) { id -> selectBoxAction(id) }
}
} else {
item {
val filterList = listOf(
Category.TOUT,
Category.ALCOOL,
Category.SOFT,
Category.FRAIS,
Category.SEC
)
HorizontalFilterRow(
filterList,
selectedFilter = state.selectedFilter,
onFilterSelected = { selectedFilter ->
filterAction(selectedFilter)
})
}
items(state.appetizers) { appetizer ->
if (appetizer.isVisible) {
AppetizerItem(
item = appetizer,
state.allowEdit,
onIncreaseAction = { id, quantity ->
updateQuantity(
id,
quantity
)
},
onDecreaseAction = { id, quantity ->
updateQuantity(
id,
quantity
)
})
}
}
}
}
if (state.isLoading) LinearProgressIndicator()
if (state.error != null) {
Box(modifier = Modifier.fillMaxSize()) {
Text(
text = state.error,
modifier = Modifier.align(Alignment.Center),
)
Button(
onClick = { loadInventory() },
modifier = Modifier.align(Alignment.BottomCenter)
) {
Text(text = "Retry")
}
}
}
}
@Composable
fun AppetizerItem(
item: Appetizer,
isEditable: Boolean,
onIncreaseAction: (id: Int, quantity: Int) -> Unit,
onDecreaseAction: (id: Int, quantity: Int) -> Unit
) {
Card(
elevation = CardDefaults.cardElevation(),
modifier = Modifier.padding(8.dp, 4.dp),
colors = CardDefaults.cardColors(containerColor = CigoGrey)
) {
Row(
verticalAlignment = Alignment.CenterVertically,
modifier = Modifier.padding(8.dp)
) {
if (isEditable) {
AppetizerIcon(
Icons.Filled.KeyboardArrowDown,
Modifier.weight(0.15f)
) { onDecreaseAction(item.id, item.quantity - 1) }
AppetizerQuantity(item.quantity, item.bufferSize, modifier = Modifier.weight(0.20f))
AppetizerDetails(item.title, item.supplier, Modifier.weight(0.50f))
AppetizerIcon(
Icons.Filled.KeyboardArrowUp,
Modifier.weight(0.15f)
) { onIncreaseAction(item.id, item.quantity + 1) }
} else {
AppetizerQuantity(item.quantity, item.bufferSize, modifier = Modifier.weight(0.20f))
AppetizerDetails(item.title, item.supplier, Modifier.weight(0.80f))
}
}
}
}
@Composable
fun BoxItem(
playerCount: String,
boxOperations: List<BoxOperation>,
selectedBox: Int,
onBoxSelected: (id: Int) -> Unit
) {
Card(
elevation = CardDefaults.cardElevation(),
modifier = Modifier
.padding(8.dp, 4.dp)
.clickable {
onBoxSelected(playerCount.toInt())
},
colors = CardDefaults.cardColors(containerColor = if (selectedBox == playerCount.toInt()) CigOrange else CigoGrey)
) {
Row(
verticalAlignment = Alignment.CenterVertically,
modifier = Modifier.padding(8.dp)
) {
val appetizersText = GetBoxItemTextUseCase().invoke(boxOperations)
AppetizerDetails("Box pour $playerCount", appetizersText, Modifier.weight(0.80f))
}
}
}
@Composable
private fun AppetizerQuantity(quantity: Int = 1, bufferSize: Int? = null, modifier: Modifier) {
val context = LocalContext.current
var hasBuffer = false
bufferSize?.let {
if (quantity <= it)
hasBuffer = true
}
Row(
verticalAlignment = Alignment.CenterVertically,
modifier = modifier
) {
Text(
text = quantity.toString(),
fontSize = 26.sp,
fontWeight = FontWeight.Bold,
color = CigOrange,
textAlign = TextAlign.Center,
modifier = Modifier.alignByBaseline()
)
if (hasBuffer) {
Spacer(modifier = Modifier.width(10.dp))
Icon(
imageVector = Icons.Outlined.Warning,
tint = Color.Black,
contentDescription = "stock alert",
modifier = Modifier.clickable {
val message = "Le stock est inférieur au stock tampon ($bufferSize)"
Toast.makeText(context, message, Toast.LENGTH_SHORT).show()
}
)
}
}
}
@Composable
private fun AppetizerIcon(icon: ImageVector, modifier: Modifier, onClick: () -> Unit = { }) {
Image(
imageVector = icon,
contentDescription = "Appetizer icon",
modifier = modifier
.padding(8.dp)
.clickable { onClick() }
)
}
@Composable
private fun AppetizerDetails(
title: String,
description: String,
modifier: Modifier
) {
Column(modifier = modifier) {
Text(
text = title,
color = Color.Black,
style = MaterialTheme.typography.headlineMedium
)
Text(
text = description,
color = Color.Black,
style = MaterialTheme.typography.bodyMedium
)
}
} | 0 | Kotlin | 0 | 0 | b0d50245d3bf1f9c37560156d0b0d3faffcb013d | 9,165 | inventory-android | MIT License |
app/src/main/java/com/dammak/mahdi/di/FavouritesListModule.kt | dinfooo | 308,149,178 | false | null | package com.dammak.mahdi.di
import androidx.lifecycle.ViewModel
import com.dammak.mahdi.viewmodels.FavouriteViewModel
import dagger.Binds
import dagger.Module
import dagger.multibindings.IntoMap
@Module
abstract class FavouritesListModule {
@Binds
@IntoMap
@ViewModelKey(FavouriteViewModel::class)
abstract fun bindViewModel(viewmodel: FavouriteViewModel): ViewModel
}
| 1 | Kotlin | 1 | 3 | 5924aeab36609c2ce1d15fa9b33753522a8a8393 | 388 | Kotlin_LiveData_DataBinding_Retrofit_MVVM | Apache License 2.0 |
src/main/kotlin/dev/ekvedaras/laravelquery/reference/TableOrViewReferenceProvider.kt | ekvedaras | 325,768,601 | false | null | package dev.ekvedaras.laravelquery.reference
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.project.Project
import com.intellij.psi.PsiElement
import com.intellij.psi.PsiReference
import com.intellij.psi.PsiReferenceProvider
import com.intellij.util.ProcessingContext
import com.jetbrains.php.lang.psi.elements.MethodReference
import dev.ekvedaras.laravelquery.models.DbReferenceExpression
import dev.ekvedaras.laravelquery.utils.LaravelUtils.Companion.isBuilderMethodByName
import dev.ekvedaras.laravelquery.utils.LaravelUtils.Companion.isEloquentModel
import dev.ekvedaras.laravelquery.utils.LaravelUtils.Companion.isInsideRegularFunction
import dev.ekvedaras.laravelquery.utils.LaravelUtils.Companion.isInteresting
import dev.ekvedaras.laravelquery.utils.LaravelUtils.Companion.isTableParam
import dev.ekvedaras.laravelquery.utils.LaravelUtils.Companion.shouldCompleteOnlyColumns
import dev.ekvedaras.laravelquery.utils.MethodUtils
class TableOrViewReferenceProvider : PsiReferenceProvider() {
override fun getReferencesByElement(element: PsiElement, context: ProcessingContext): Array<PsiReference> {
val method = MethodUtils.resolveMethodReference(element) ?: return PsiReference.EMPTY_ARRAY
val project = method.project
if (shouldNotInspect(project, method, element)) {
return PsiReference.EMPTY_ARRAY
}
return arrayOf(
SchemaPsiReference(element, DbReferenceExpression.Companion.Type.Table),
TableOrViewPsiReference(element, DbReferenceExpression.Companion.Type.Table),
)
}
private fun shouldNotInspect(project: Project, method: MethodReference, element: PsiElement) =
!ApplicationManager.getApplication().isReadAccessAllowed ||
!method.isBuilderMethodByName() ||
!element.isTableParam() ||
element.isInsideRegularFunction() ||
(method.isEloquentModel(project) && method.shouldCompleteOnlyColumns()) ||
!method.isInteresting(project)
}
| 3 | null | 3 | 42 | 4f8b4822eaa329e2f643c8d6b4299f7d99861c1c | 2,052 | laravel-query-intellij | MIT License |
JSEnv/src/main/java/com/aolig/jsenv/JSEnv.kt | NiuGuohui | 340,277,620 | false | null | package com.aolig.jsenv
import com.aolig.jsenv.event.JSEvent
import com.orhanobut.logger.AndroidLogAdapter
import com.orhanobut.logger.FormatStrategy
import com.orhanobut.logger.Logger
import com.orhanobut.logger.PrettyFormatStrategy
import kotlin.reflect.KClass
class JSEnv(script: String, interfaces: List<KClass<out JSInterface>>) {
private val jsActuator: JSActuator
init {
val formatStrategy: FormatStrategy = PrettyFormatStrategy.newBuilder()
.showThreadInfo(false)
.methodCount(0)
.tag("JSEnv:")
.build()
Logger.addLogAdapter(AndroidLogAdapter(formatStrategy))
jsActuator = JSActuator(script, interfaces)
jsActuator.start()
Logger.e("JSEnv is Ready!")
}
} | 0 | Kotlin | 0 | 1 | 6e74d1f87e101ed0aa86375b445214b9c08c760f | 772 | JSEnv | MIT License |
ui/lists/src/commonTest/kotlin/dev/alvr/katana/ui/lists/entities/mappers/MangaListItemMapperTest.kt | alvr | 446,535,707 | false | {"Kotlin": 450399, "Swift": 594} | package dev.alvr.katana.ui.lists.entities.mappers
import dev.alvr.katana.domain.lists.models.entries.MediaEntry
import dev.alvr.katana.ui.lists.COLLECTION_SIZE
import dev.alvr.katana.ui.lists.entities.MediaListItem
import dev.alvr.katana.ui.lists.randomCollection
import io.kotest.core.spec.style.FreeSpec
import io.kotest.matchers.collections.shouldHaveSize
import io.kotest.matchers.types.shouldBeTypeOf
internal class MangaListItemMapperTest : FreeSpec({
"a random collection of manga" {
randomCollection<MediaEntry.Manga>()
.toMediaItems()
.shouldHaveSize(COLLECTION_SIZE * COLLECTION_SIZE)
.first().shouldBeTypeOf<MediaListItem.MangaListItem>()
}
})
| 4 | Kotlin | 0 | 52 | 36977eaf91cef21fce4ac88d7d587a74fbb2ec6c | 709 | katana | Apache License 2.0 |
src/main/kotlin/com/zeta/system/service/ISysOptLogService.kt | xia5800 | 449,936,024 | false | {"Kotlin": 493437, "Lua": 347} | package com.zeta.system.service
import com.baomidou.mybatisplus.extension.service.IService
import com.zeta.system.model.dto.sysOptLog.SysOptLogTableDTO
import com.zeta.system.model.entity.SysOptLog
import com.zeta.system.model.param.SysOptLogQueryParam
import org.zetaframework.base.param.PageParam
import org.zetaframework.base.result.PageResult
import org.zetaframework.core.log.model.LogDTO
/**
* 操作日志 服务类
*
* @author gcc
* @date 2022-03-18 15:27:15
*/
interface ISysOptLogService: IService<SysOptLog> {
/**
* 保存系统用户操作日志
*
* 说明:
* [@SysLog]注解的业务实现
* @param logDTO [LogDTO]
*/
fun save(logDTO: LogDTO)
/**
* 分页查询 前端数据表格用
* @param param PageParam<SysOptLogQueryParam>
*/
fun pageTable(param: PageParam<SysOptLogQueryParam>): PageResult<SysOptLogTableDTO>
}
| 0 | Kotlin | 2 | 8 | 5a0500ec6c122c6b20f33f7a8e763dfbd2ce8f2e | 828 | zeta-kotlin | MIT License |
kotlin-recycler/src/main/java/com/abed/kotlin_recycler/adapters/SimpleRecyclerAdapter.kt | vipafattal | 225,963,998 | false | null | package com.abed.kotlin_recycler.adapters
import android.view.View
import android.view.animation.AnimationUtils
import androidx.annotation.LayoutRes
import com.abed.kotlin_recycler.baseComponent.BaseRecyclerAdapter
import com.abed.kotlin_recycler.baseComponent.BaseViewHolder
open class SimpleRecyclerAdapter<RecyclerData : Any>(
data: List<RecyclerData>, @LayoutRes layoutID: Int,
private val animationRes: Int,
private val onBindView: BaseViewHolder.(data: RecyclerData) -> Unit,
onClickListener: (View.(Int) -> Unit)?
) : BaseRecyclerAdapter<RecyclerData>(data,onClickListener) {
override val layoutItemId: Int = layoutID
override fun onBindViewHolder(holder: BaseViewHolder, position: Int) {
val data = dataList[position]
holder.onBindView(data)
if (animationRes != NO_TURN_UP_ANIMATION)
holder.itemView.setAnimation(position)
}
private var lastPosition = -1
private fun View.setAnimation(position: Int) {
if (position > lastPosition) {
val animation =
AnimationUtils.loadAnimation(context, animationRes)
startAnimation(animation)
lastPosition = position
}
}
override fun onViewDetachedFromWindow(holder: BaseViewHolder) {
holder.clearAnimation()
}
companion object {
const val NO_TURN_UP_ANIMATION = -1
}
}
| 0 | Kotlin | 0 | 4 | 58c774de84b3913c8dbeda4686b24e34ee7b74c8 | 1,398 | KotlinRecycler | MIT License |
core/src/main/java/com/vk/api/sdk/exceptions/ApiErrorViewType.kt | VKCOM | 16,025,583 | false | null | package com.vk.api.sdk.exceptions
import android.util.Log
enum class ApiErrorViewType {
INPUT,
FULLSCREEN,
ALERT,
CUSTOM,
SKIP;
companion object {
private const val TAG = "VkApiErrorViewType"
private val DEFAULT_VIEW_TYPE = CUSTOM
fun fromString(errorType: String): ApiErrorViewType? {
if (errorType.isBlank()) {
Log.d(TAG, "Empty error view type")
return null
}
return try {
valueOf(errorType.uppercase())
} catch (exception: IllegalArgumentException) {
Log.e(TAG, "Unknown error view type: $errorType", exception)
DEFAULT_VIEW_TYPE
}
}
}
}
| 69 | null | 233 | 440 | 3dd6d9e3bc10ce9e77c3ea9331cc753f704f8f79 | 747 | vk-android-sdk | MIT License |
core/src/main/java/com/vk/api/sdk/exceptions/ApiErrorViewType.kt | VKCOM | 16,025,583 | false | null | package com.vk.api.sdk.exceptions
import android.util.Log
enum class ApiErrorViewType {
INPUT,
FULLSCREEN,
ALERT,
CUSTOM,
SKIP;
companion object {
private const val TAG = "VkApiErrorViewType"
private val DEFAULT_VIEW_TYPE = CUSTOM
fun fromString(errorType: String): ApiErrorViewType? {
if (errorType.isBlank()) {
Log.d(TAG, "Empty error view type")
return null
}
return try {
valueOf(errorType.uppercase())
} catch (exception: IllegalArgumentException) {
Log.e(TAG, "Unknown error view type: $errorType", exception)
DEFAULT_VIEW_TYPE
}
}
}
}
| 69 | null | 233 | 440 | 3dd6d9e3bc10ce9e77c3ea9331cc753f704f8f79 | 747 | vk-android-sdk | MIT License |
plugins/devkit/devkit-kotlin-tests/testSrc/org/jetbrains/idea/devkit/kotlin/inspections/KtRetrievingServiceInspectionTest.kt | JetBrains | 2,489,216 | false | null | // Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.idea.devkit.kotlin.inspections
import com.intellij.testFramework.TestDataPath
import org.jetbrains.idea.devkit.inspections.quickfix.RetrievingServiceInspectionTestBase
import org.jetbrains.idea.devkit.kotlin.DevkitKtTestsUtil
@TestDataPath("\$CONTENT_ROOT/testData/inspections/retrievingService")
class KtRetrievingServiceInspectionTest : RetrievingServiceInspectionTestBase() {
override fun getBasePath() = DevkitKtTestsUtil.TESTDATA_PATH + "inspections/retrievingService/"
override fun getFileExtension() = "kt"
fun testAppLevelServiceAsProjectLevel() {
doTest()
}
fun testProjectLevelServiceAsAppLevel() {
doTest()
}
}
| 214 | null | 4829 | 15,129 | 5578c1c17d75ca03071cc95049ce260b3a43d50d | 791 | intellij-community | Apache License 2.0 |
app-cross-promoter/src/main/java/com/mobapphome/appcrosspromoter/tools/HttpUtils.kt | hummatli | 34,382,766 | false | {"Kotlin": 72493, "Java": 15744} | package com.mobapphome.appcrosspromoter.tools
import android.content.Context
import android.util.Log
import org.json.JSONException
import org.json.JSONObject
import org.jsoup.Jsoup
import java.io.IOException
import java.util.LinkedList
/**
* Created by settar on 12/20/16.
*/
object HttpUtils {
@Throws(IOException::class)
fun requestPrograms(context: Context, url: String): MAHRequestResult {
val doc = Jsoup
.connect(url.trim { it <= ' ' })
.ignoreContentType(true)
.timeout(3000)
// .header("Host", "172.16.31.10")
.header("Connection", "keep-alive")
// .header("Content-Length", "111")
.header("Cache-Control", "max-age=0")
.header("Accept",
"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8")
// .header("Origin", "http://172.16.31.10")
.header("User-Agent",
"Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36")
.header("Content-Type", "application/x-www-form-urlencoded")
.header("Referer", url.trim { it <= ' ' })
// This is Needed
.header("Accept-Encoding", "gzip,deflate,sdch")
.header("Accept-Language", "en-US,en;q=0.8,ru;q=0.6")
// .userAgent("Mozilla")
.get()
val jsonStr = doc.body().text()
Log.i(Constants.LOG_TAG_MAH_ADS, "Programlist json = " + jsonStr)
writeStringToCache(context, jsonStr)
val requestResult = jsonToProgramList(jsonStr)
requestResult.isReadFromWeb = true
return requestResult
}
fun jsonToProgramList(jsonStr: String?): MAHRequestResult {
val ret = LinkedList<Program>()
if (jsonStr == null || jsonStr.isEmpty()) {
Log.i(Constants.LOG_TAG_MAH_ADS, "Json is null or empty")
return MAHRequestResult(ret, MAHRequestResult.ResultState.ERR_JSON_IS_NULL_OR_EMPTY)
}
try {
var stateForRead: MAHRequestResult.ResultState = MAHRequestResult.ResultState.SUCCESS
val reader = JSONObject(jsonStr)
val programs = reader.getJSONArray("programs")
// Log.i(ACPController.LOG_TAG_MAH_ADS, "Programs size = " + programs.length());
for (i in 0..programs.length() - 1) {
try {
val jsonProgram = programs.getJSONObject(i)
val name = jsonProgram.getString("name")
val desc = jsonProgram.getString("desc")
val uri = jsonProgram.getString("uri")
val img = jsonProgram.getString("img")
val releaseDate = jsonProgram.optString("release_date")
val updateDate = jsonProgram.optString("update_date")
ret.add(Program(0, name, desc, uri, img, releaseDate, updateDate))
//Log.i(ACPController.LOG_TAG_MAH_ADS, "Added = " + name);
} catch (e: JSONException) {
Log.d(Constants.LOG_TAG_MAH_ADS, "Program item in json has a syntax problem " + e.toString(), e)
stateForRead = MAHRequestResult.ResultState.ERR_SOME_ITEMS_HAS_JSON_SYNTAX_ERROR
}
}
return MAHRequestResult(ret, stateForRead)
} catch (e: JSONException) {
Log.d(Constants.LOG_TAG_MAH_ADS, e.toString(), e)
return MAHRequestResult(ret, MAHRequestResult.ResultState.ERR_JSON_HAS_TOTAL_ERROR)
}
}
@Throws(IOException::class)
fun requestProgramsVersion(context: Context, url: String): Int {
var ret = 0
val response = Jsoup
.connect(url.trim { it <= ' ' })
.ignoreContentType(true)
.timeout(3000)
// .header("Host", "172.16.31.10")
.header("Connection", "keep-alive")
// .header("Content-Length", "111")
.header("Cache-Control", "max-age=0")
.header("Accept",
"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8")
// .header("Origin", "http://172.16.31.10")
.header("User-Agent",
"Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36")
.header("Content-Type", "application/x-www-form-urlencoded")
.header("Referer", url.trim { it <= ' ' })
// This is Needed
.header("Accept-Encoding", "gzip,deflate,sdch")
.header("Accept-Language", "en-US,en;q=0.8,ru;q=0.6")
// .userAgent("Mozilla")
.execute()
Log.i(Constants.LOG_TAG_MAH_ADS, "Response content type = " + response.contentType())
val doc = response.parse()
val jsonStr = doc.body().text()
//Log.i(ACPController.LOG_TAG_MAH_ADS, jsonStr);
try {
val reader = JSONObject(jsonStr)
ret = Integer.parseInt(reader.getString("version"))
getSharedPref(context).edit().putInt(Constants.MAH_ADS_VERSION, ret).apply()
} catch (e: JSONException) {
Log.d(Constants.LOG_TAG_MAH_ADS, e.toString(), e)
} catch (nfe: NumberFormatException) {
Log.d(Constants.LOG_TAG_MAH_ADS, nfe.toString(), nfe)
}
return ret
}
}
| 6 | Kotlin | 17 | 55 | b8031dec32f808919790232882b37274b5d8e35b | 5,601 | AppCrossPromoter | Apache License 2.0 |
telegram/src/main/kotlin/com/github/kotlintelegrambot/updater/Updater.kt | kotlin-telegram-bot | 121,235,631 | false | null | package com.github.kotlintelegrambot.updater
import com.github.kotlintelegrambot.entities.Update
import com.github.kotlintelegrambot.errors.RetrieveUpdatesError
import com.github.kotlintelegrambot.network.ApiClient
import com.github.kotlintelegrambot.types.DispatchableObject
import com.github.kotlintelegrambot.types.TelegramBotResult
import kotlinx.coroutines.channels.Channel
internal class Updater(
private val looper: Looper,
private val updatesChannel: Channel<DispatchableObject>,
private val apiClient: ApiClient,
private val botTimeout: Int,
) {
@Volatile private var lastUpdateId: Long? = null
internal fun startPolling() {
looper.loop {
val getUpdatesResult = apiClient.getUpdates(
offset = lastUpdateId,
limit = null,
timeout = botTimeout,
allowedUpdates = null,
)
getUpdatesResult.fold(
ifSuccess = { onUpdatesReceived(it) },
ifError = { onErrorGettingUpdates(it) },
)
}
}
internal fun stopPolling() {
looper.quit()
}
private suspend fun onUpdatesReceived(updates: List<Update>) {
if (updates.isEmpty()) {
return
}
updates.forEach {
updatesChannel.send(it)
}
lastUpdateId = updates.last().updateId + 1
}
private suspend fun onErrorGettingUpdates(error: TelegramBotResult.Error<List<Update>>) {
val errorDescription: String? = when (error) {
is TelegramBotResult.Error.HttpError -> "${error.httpCode} ${error.description}"
is TelegramBotResult.Error.TelegramApi -> "${error.errorCode} ${error.description}"
is TelegramBotResult.Error.InvalidResponse -> "${error.httpCode} ${error.httpStatusMessage}"
is TelegramBotResult.Error.Unknown -> error.exception.message
}
val dispatchableError = RetrieveUpdatesError(
errorDescription ?: "Error retrieving updates",
)
updatesChannel.send(dispatchableError)
}
}
| 67 | null | 161 | 794 | 18013912c6a8c395b6491c2323a8f5eb7288b4f5 | 2,110 | kotlin-telegram-bot | Apache License 2.0 |
samples/bipak-sample-android/src/main/java/fr/haan/bipak/sample/android/presentation/compose/ItemListComposeFragment.kt | nicolashaan | 519,223,234 | false | null | package fr.haan.bipak.sample.android.presentation.compose
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.material.Button
import androidx.compose.material.CircularProgressIndicator
import androidx.compose.material.Icon
import androidx.compose.material.IconButton
import androidx.compose.material.Text
import androidx.compose.material.TopAppBar
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Settings
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.fragment.app.Fragment
import androidx.fragment.app.setFragmentResultListener
import androidx.fragment.app.viewModels
import androidx.lifecycle.viewmodel.compose.viewModel
import fr.haan.bipak.PagingData
import fr.haan.bipak.compose.LazyPagingItems
import fr.haan.bipak.compose.collectAsLazyPagingItems
import fr.haan.bipak.compose.itemsIndexed
import fr.haan.bipak.sample.android.domain.DomainItem
import fr.haan.bipak.sample.android.presentation.ON_SETTING_CHANGED
import fr.haan.bipak.sample.android.presentation.recyclerview.ItemListFragment
import fr.haan.bipak.sample.android.presentation.recyclerview.ItemListViewModel
import fr.haan.bipak.sample.android.presentation.settings.PagingSourceSettingsFragment
import fr.haan.bipak.sample.android.recyclerview.R
import fr.haan.bipak.sample.android.recyclerview.databinding.FragmentItemListComposeBinding
class ItemListComposeFragment : Fragment() {
lateinit var binding: FragmentItemListComposeBinding
val viewModel: ItemListViewModel by viewModels()
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?,
): View {
binding = FragmentItemListComposeBinding.inflate(inflater, container, false)
setFragmentResultListener(ON_SETTING_CHANGED) { _, _ ->
viewModel.resetRepository()
setupComposeView()
}
return binding.root
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
setupComposeView()
}
fun setupComposeView() {
binding.composeView.setContent {
ItemListScreen(
onViewsClick = {
val fragment = ItemListFragment()
requireActivity().supportFragmentManager
.beginTransaction()
.replace(R.id.fragment_container, fragment)
.commit()
},
onSettingsClick = {
val fragment = PagingSourceSettingsFragment()
requireActivity().supportFragmentManager
.beginTransaction()
.replace(R.id.fragment_container, fragment)
.addToBackStack(PagingSourceSettingsFragment::class.simpleName)
.commit()
}
)
}
}
}
@Composable
private fun ItemListScreen(
onViewsClick: () -> Unit,
onSettingsClick: () -> Unit,
) {
val viewModel: ItemListComposeViewModel = viewModel()
val pagingData: LazyPagingItems<DomainItem> = viewModel.pagingDataFlow.collectAsLazyPagingItems()
viewModel.setViewEventFlow(pagingData.eventFlow)
Column {
TopAppBar(title = { Text("Compose Paging") }, actions = {
IconButton(onClick = onViewsClick) {
Text("Views")
}
IconButton(onClick = onSettingsClick) {
Icon(Icons.Filled.Settings, contentDescription = "Localized description")
}
})
LazyColumn(modifier = Modifier.padding(horizontal = 16.dp)) {
itemsIndexed(pagingDataState = pagingData, itemContent = { index, item ->
item?.let { ListItem(index, it.content) }
})
when (val loadState = pagingData.loadState) {
PagingData.LoadState.Loading -> {
item { LoadingListItem() }
}
is PagingData.LoadState.Error -> {
item { ErrorListItem(loadState.error.message.orEmpty()) { pagingData.retry() } }
}
PagingData.LoadState.NotLoading -> { /* noop */
}
}
}
}
}
@Composable
private fun ListItem(id: Int, content: String) {
Row(
modifier = Modifier.fillMaxWidth()
) {
Text(
modifier = Modifier.padding(16.dp),
text = "pos: $id",
fontSize = 16.sp,
)
Text(
modifier = Modifier.padding(16.dp),
text = content,
fontSize = 16.sp,
)
}
}
@Composable
private fun LoadingListItem() {
Row(
modifier = Modifier
.fillMaxWidth()
.padding(vertical = 4.dp)
.height(48.dp),
horizontalArrangement = Arrangement.Center
) {
CircularProgressIndicator()
}
}
@Composable
private fun ErrorListItem(
errorMessage: String,
onRetryClick: () -> Unit,
) {
Row(
modifier = Modifier
.fillMaxWidth()
.padding(vertical = 4.dp)
.height(48.dp),
horizontalArrangement = Arrangement.Center
) {
Row {
Text(errorMessage)
Button(
modifier = Modifier.padding(horizontal = 16.dp),
onClick = onRetryClick
) {
Text("Retry")
}
}
}
}
@Preview
@Composable
private fun Preview() {
ItemListScreen({}, {})
}
@Preview
@Composable
private fun PreviewLoadingListItem() {
LoadingListItem()
}
@Preview
@Composable
private fun ErrorLoadingListItem() {
ErrorListItem("Error in data source!", {})
}
| 0 | Kotlin | 2 | 36 | cf1d78c0062b36d33331b648f77de5c15535d17d | 6,379 | bipak | Apache License 2.0 |
app/src/main/java/com/fafadiatech/newscout/model/ArticleLikeDetailData.kt | Vicky-Vicky27 | 484,837,384 | true | {"Kotlin": 430654} | package com.fafadiatech.newscout.model
data class ArticleLikeDetailData(var id: Int, var article: Int, var is_like: Int) | 0 | null | 0 | 0 | aa136721998e6c1fa0ab1e2fa1215584a1384b84 | 121 | newscout_android | Apache License 2.0 |
shared/src/commonMain/kotlin/com/darrenthiores/ecoswap/data/core/remote/client/HttpClientFactory.kt | darrenthiores | 688,372,873 | false | {"Kotlin": 770054, "Swift": 362583} | package com.darrenthiores.ecoswap.data.core.remote.client
import com.darrenthiores.ecoswap.domain.core.preferences.TokenPreferences
import io.ktor.client.HttpClient
expect class HttpClientFactory {
fun create(tokenPreferences: TokenPreferences): HttpClient
} | 0 | Kotlin | 0 | 0 | 6da03175466a0458ba4a28392f7371f8a429d4cf | 264 | EcoSwap | MIT License |
diktat-rules/src/test/resources/test/chapter6/compact_initialization/SimpleExampleExpected.kt | saveourtool | 275,879,956 | false | {"Kotlin": 2386437, "TeX": 190514, "Shell": 2900, "Batchfile": 541, "Makefile": 47} | fun main() {
val httpClient = HttpClient("myConnection").apply {
url = "http://example.com"
port = "8080"
timeout = 100}
httpClient.doRequest()
} | 149 | Kotlin | 39 | 535 | 9e73d811d9fd9900af5917ba82ddeed0177ac52e | 145 | diktat | MIT License |
common/src/main/kotlin/com/daylifecraft/common/seasons/SeasonsList.kt | daylifecraft | 786,506,082 | false | {"Kotlin": 565827, "Java": 16608, "Dockerfile": 751} | package com.daylifecraft.common.seasons
/** Represents system of seasons with ability to get active seasons ordered by their priorities */
class SeasonsList(val allSeasons: List<Season>) {
private val seasonsByNames: MutableMap<String, Season> = HashMap()
private var activeSeasonsCache: List<Season>? = null
private val cacheLock = Any()
init {
for (season in allSeasons) {
require(!seasonsByNames.containsKey(season.name)) { "Names of seasons in list should be unique" }
seasonsByNames[season.name] = season
season.attachedList = this
}
}
fun getSeasonByName(name: String): Season? = seasonsByNames[name]
/**
* Returns list of active seasons sorted by their priority. Note that this method returns cache if
* possible.
*/
val activeSeasonsPrioritized: List<Season>
get() {
synchronized(cacheLock) {
return activeSeasonsCache ?: allSeasons
.filter(Season::isActive)
.sortedByDescending { it.priority }
.also { activeSeasonsCache = it }
}
}
/** Returns list of inactive seasons. Note that this method generates new list every call. */
val inactiveSeasons: List<Season>
get() = allSeasons.filter { !it.isActive }
/** Drops active seasons cache. This used when some season change its priority or activeness. */
fun dropCaches() {
synchronized(cacheLock) {
activeSeasonsCache = null
}
}
}
| 1 | Kotlin | 1 | 6 | 60ce20adc7005c2f4fae9175600e58c14992a782 | 1,433 | minigames | Apache License 2.0 |
app/src/main/java/com/kenkoro/taurus/client/core/local/Arrangement.kt | kenkoro | 746,982,789 | false | {"Kotlin": 260677, "JavaScript": 64} | package com.kenkoro.taurus.client.core.local
import androidx.compose.runtime.compositionLocalOf
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
data class Arrangement(
val small: Dp = 3.dp,
val standard: Dp = 10.dp,
)
val LocalArrangement = compositionLocalOf { Arrangement() } | 6 | Kotlin | 0 | 4 | 3e386a0348ca26657ef56e3bea02c1130fc27b38 | 306 | taurus | Apache License 2.0 |
platform/util/ui/src/com/intellij/util/ui/html/HiDpiScalingImageView.kt | EntryPointKR | 276,865,060 | false | {"Text": 7234, "INI": 506, "YAML": 418, "Ant Build System": 11, "Batchfile": 31, "Shell": 614, "Markdown": 607, "Ignore List": 108, "Git Attributes": 10, "EditorConfig": 242, "XML": 6537, "SVG": 3009, "Java": 78454, "Kotlin": 44842, "HTML": 3015, "Java Properties": 200, "JFlex": 31, "JSON": 1237, "CSS": 69, "Groovy": 3484, "XSLT": 113, "JavaScript": 208, "desktop": 1, "Python": 14720, "Maven POM": 76, "JAR Manifest": 16, "PHP": 47, "Gradle Kotlin DSL": 427, "Protocol Buffer": 3, "Microsoft Visual Studio Solution": 4, "C#": 33, "Smalltalk": 17, "Diff": 133, "Erlang": 1, "Rich Text Format": 2, "AspectJ": 2, "Perl": 6, "HLSL": 2, "Objective-C": 27, "CoffeeScript": 3, "HTTP": 2, "JSON with Comments": 63, "GraphQL": 51, "OpenStep Property List": 46, "Tcl": 1, "fish": 1, "Gradle": 422, "Dockerfile": 3, "Prolog": 2, "ColdFusion": 2, "Turtle": 2, "TeX": 11, "Elixir": 2, "Ruby": 5, "XML Property List": 80, "Starlark": 2, "E-mail": 18, "Roff": 39, "Roff Manpage": 3, "Swift": 3, "C": 87, "TOML": 146, "Proguard": 2, "Checksums": 58, "Java Server Pages": 8, "reStructuredText": 59, "SQL": 1, "Vim Snippet": 8, "AMPL": 4, "Linux Kernel Module": 1, "Makefile": 2, "CMake": 16, "C++": 32, "VBScript": 1, "NSIS": 5, "PlantUML": 5, "Thrift": 3, "Cython": 14, "Regular Expression": 3, "JSON5": 4} | // Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.util.ui.html
import com.intellij.ui.scale.ScaleContext
import com.intellij.ui.scale.ScaleType
import com.intellij.util.ui.ImageUtil
import com.intellij.util.ui.StartupUiUtil
import java.awt.Graphics
import java.awt.Rectangle
import java.awt.Shape
import java.awt.image.BufferedImage
import javax.swing.text.Element
import javax.swing.text.Position
import javax.swing.text.View
class HiDpiScalingImageView(elem: Element, private val originalView: View) : View(elem) {
private val scaleContext: ScaleContext?
get() = container?.let(ScaleContext::create)
private val sysScale: Float
get() = scaleContext?.getScale(ScaleType.SYS_SCALE)?.toFloat() ?: 1f
override fun getMaximumSpan(axis: Int): Float = originalView.getMaximumSpan(axis) / sysScale
override fun getMinimumSpan(axis: Int): Float = originalView.getMinimumSpan(axis) / sysScale
override fun getPreferredSpan(axis: Int): Float = originalView.getPreferredSpan(axis) / sysScale
override fun paint(g: Graphics, a: Shape) {
val scaleContext = scaleContext
if (scaleContext == null) {
originalView.paint(g, a)
return
}
val bounds = a.bounds
val width = originalView.getPreferredSpan(X_AXIS).toInt()
val height = originalView.getPreferredSpan(Y_AXIS).toInt()
if (width <= 0 || height <= 0) return
val image = ImageUtil.createImage(width, height, BufferedImage.TYPE_INT_ARGB)
val graphics = image.createGraphics()
originalView.paint(graphics, Rectangle(image.width, image.height))
StartupUiUtil.drawImage(g, ImageUtil.ensureHiDPI(image, scaleContext), bounds.x, bounds.y, null)
}
override fun modelToView(pos: Int, a: Shape?, b: Position.Bias?): Shape =
originalView.modelToView(pos, a, b)
override fun viewToModel(x: Float, y: Float, a: Shape?, biasReturn: Array<out Position.Bias>?): Int =
originalView.viewToModel(x, y, a, biasReturn)
override fun getToolTipText(x: Float, y: Float, allocation: Shape?): String? =
originalView.getToolTipText(x, y, allocation)
} | 1 | null | 1 | 1 | e00b4ef916a6c6059758e1384554e0be0c608925 | 2,163 | intellij-community | Apache License 2.0 |
devtools/android/src/main/kotlin/com/maximbircu/devtools/android/presentation/tools/text/EditTextInputTypeProvider.kt | maximbircu | 247,318,697 | false | null | package com.maximbircu.devtools.android.presentation.tools.text
import android.text.InputType.TYPE_CLASS_NUMBER
import android.text.InputType.TYPE_CLASS_TEXT
import android.text.InputType.TYPE_NUMBER_FLAG_DECIMAL
import kotlin.reflect.KClass
internal object EditTextInputTypeProvider {
fun getInputTypeFor(type: KClass<*>) = when (type) {
String::class -> TYPE_CLASS_TEXT
Int::class, Long::class -> TYPE_CLASS_NUMBER
Float::class, Double::class -> TYPE_CLASS_NUMBER or TYPE_NUMBER_FLAG_DECIMAL
else -> throw IllegalArgumentException("$type not supported")
}
}
| 9 | Kotlin | 3 | 15 | 14a484b169c709b22739e556ab799e263f60f168 | 602 | devtools-library | Apache License 2.0 |
app/src/main/java/com/example/scankitdemo/core_example/WifiOperation.kt | albertpatera | 690,790,271 | false | {"Kotlin": 328450, "Java": 78652} | package com.example.scankitdemo.core
import android.Manifest
import android.content.Context
import android.content.pm.PackageManager
import android.net.ConnectivityManager
import android.net.NetworkCapabilities
import android.net.wifi.WifiConfiguration
import android.net.wifi.WifiManager
import android.os.Build
import android.widget.Toast
import androidx.annotation.RequiresApi
import androidx.core.app.ActivityCompat
class WifiOperation : IWifi{
@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
override fun isOnline(context: Context): Boolean {
val connectivityManager =
context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
if (connectivityManager != null) {
val capabilities =
connectivityManager.getNetworkCapabilities(connectivityManager.activeNetwork)
if (capabilities != null) {
if (capabilities.hasTransport(NetworkCapabilities.TRANSPORT_CELLULAR)) {
Toast.makeText(context, "Your internet connection was lost. Please try again later...", Toast.LENGTH_LONG).show()
// Log.i("Internet", "NetworkCapabilities.TRANSPORT_CELLULAR")
return true
} else if (capabilities.hasTransport(NetworkCapabilities.TRANSPORT_WIFI)) {
//Log.i("Internet", "NetworkCapabilities.TRANSPORT_WIFI")
Toast.makeText(context, "You are successfully conected", Toast.LENGTH_LONG).show()
return true
} else if (capabilities.hasTransport(NetworkCapabilities.TRANSPORT_ETHERNET)) {
//Log.i("Internet", "NetworkCapabilities.TRANSPORT_ETHERNET")
Toast.makeText(context, "You are successfully connected via ethernet", Toast.LENGTH_LONG).show()
return true
}
}
}
return false
}
/*override fun initWifiSettings(context: Context) {
val networkSSID = "ProWifi"
val networkPass = "Patera@0654"
val conf = WifiConfiguration()
conf.SSID =
"\"" + networkSSID + "\"" // Please note the quotes. String should contain ssid in quotes
conf.wepKeys[0] = "\"" + networkPass + "\"";
conf.wepTxKeyIndex = 0;
conf.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);
conf.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP40);
conf.preSharedKey = "\""+ networkPass +"\"";
context.applicationContext.getSystemService(Context.WIFI_SERVICE)
val wifiManager = context.getSystemService(Context.WIFI_SERVICE) as WifiManager
wifiManager.addNetwork(conf)
if (ActivityCompat.checkSelfPermission(
context,
Manifest.permission.ACCESS_FINE_LOCATION
) != PackageManager.PERMISSION_GRANTED
) {
// TODO: Consider calling
// ActivityCompat#requestPermissions
// here to request the missing permissions, and then overriding
// public void onRequestPermissionsResult(int requestCode, String[] permissions,
// int[] grantResults)
// to handle the case where the user grants the permission. See the documentation
// for ActivityCompat#requestPermissions for more details.
return
}
wifiManager.configuredNetworks
val list = wifiManager.configuredNetworks
for (i in list) {
if (i.SSID != null && i.SSID == "\"" + networkSSID + "\"") {
wifiManager.disconnect()
wifiManager.enableNetwork(i.networkId, true)
wifiManager.reconnect()
break
}
}
}*/
override fun wifiMagerSettings() {
}
} | 0 | Kotlin | 0 | 0 | ac936d0b90979cdfd5c0b7873c525e81ed2a11e9 | 3,878 | barCodeScanner | Apache License 2.0 |
151004/Bashlikov/rv_task05/publisher/src/main/kotlin/data/local/dao/EditorOfflineSource.kt | ermakus655 | 782,141,446 | true | {"Markdown": 21, "Text": 11, "Ignore List": 180, "Maven POM": 232, "Shell": 74, "Batchfile": 71, "Java": 7132, "INI": 213, "XML": 576, "JSON": 604, "YAML": 204, "JSON with Comments": 5, "SQL": 20, "Microsoft Visual Studio Solution": 124, "Dockerfile": 83, "C#": 5749, "HTTP": 97, "Java Server Pages": 28, "Go Checksums": 2, "Go Module": 2, "Go": 33, "Java Properties": 51, "HTML": 9, "Git Attributes": 4, "Gradle": 16, "PHP": 177, "robots.txt": 1, "CSS": 20, "TSX": 20, "JavaScript": 5, "Gradle Kotlin DSL": 50, "Kotlin": 675, "OASv3-yaml": 1, "TOML": 1, "EditorConfig": 6, "HTML+Razor": 6, "Protocol Buffer": 1} | package by.bashlikovvv.data.local.dao
import by.bashlikovvv.data.local.contract.DatabaseContract.EditorsTable
import by.bashlikovvv.data.local.model.EditorEntity
import by.bashlikovvv.domain.exception.DataSourceExceptions
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import java.sql.Connection
import java.sql.Statement
class EditorOfflineSource(private val connection: Connection) {
companion object {
/* Create editors table */
private const val CREATE_TABLE_EDITORS =
"CREATE TABLE ${EditorsTable.TABLE_NAME} (" +
"${EditorsTable.COLUMN_ID} SERIAL PRIMARY KEY, " +
"${EditorsTable.COLUMN_LOGIN} VARCHAR(64) UNIQUE, " +
"${EditorsTable.COLUMN_PASSWORD} VARCHAR(128), " +
"${EditorsTable.COLUMN_FIRSTNAME} VARCHAR(64), " +
"${EditorsTable.COLUMN_LASTNAME} VARCHAR(64)" +
");"
/* Add new editor at table */
private const val INSERT_EDITOR =
"INSERT INTO ${EditorsTable.TABLE_NAME} (" +
"${EditorsTable.COLUMN_LOGIN}, " +
"${EditorsTable.COLUMN_PASSWORD}, " +
"${EditorsTable.COLUMN_FIRSTNAME}, " +
EditorsTable.COLUMN_LASTNAME +
") VALUES (?, ?, ?, ?);"
/* Get editor by id */
private const val SELECT_EDITOR_BY_ID =
"SELECT " +
"${EditorsTable.COLUMN_LOGIN}, " +
"${EditorsTable.COLUMN_PASSWORD}, " +
"${EditorsTable.COLUMN_FIRSTNAME}, " +
"${EditorsTable.COLUMN_LASTNAME} " +
"FROM ${EditorsTable.TABLE_NAME} " +
"WHERE ${EditorsTable.COLUMN_ID} = ?;"
/* Get all editors */
private const val SELECT_EDITORS =
"SELECT " +
"${EditorsTable.COLUMN_ID}, " +
"${EditorsTable.COLUMN_LOGIN}, " +
"${EditorsTable.COLUMN_PASSWORD}, " +
"${EditorsTable.COLUMN_FIRSTNAME}, " +
"${EditorsTable.COLUMN_LASTNAME} " +
"FROM ${EditorsTable.TABLE_NAME};"
/* Update exists editor */
private const val UPDATE_EDITOR =
"UPDATE ${EditorsTable.TABLE_NAME} " +
"SET " +
"${EditorsTable.COLUMN_LOGIN} = ?, " +
"${EditorsTable.COLUMN_PASSWORD} = ?, " +
"${EditorsTable.COLUMN_FIRSTNAME} = ?, " +
"${EditorsTable.COLUMN_LASTNAME} = ? " +
"WHERE ${EditorsTable.COLUMN_ID} = ?;"
/* Delete exists editor */
private const val DELETE_EDITOR =
"DELETE FROM ${EditorsTable.TABLE_NAME} " +
"WHERE ${EditorsTable.COLUMN_ID} = ?;"
}
init {
val statement = connection.createStatement()
statement.executeUpdate(CREATE_TABLE_EDITORS)
}
suspend fun create(editorEntity: EditorEntity): Long = withContext(Dispatchers.IO) {
val statement = connection.prepareStatement(INSERT_EDITOR, Statement.RETURN_GENERATED_KEYS)
statement.apply {
setString(1, editorEntity.login)
setString(2, editorEntity.password)
setString(3, editorEntity.firstname)
setString(4, editorEntity.lastname)
executeUpdate()
}
val generatedKeys = statement.generatedKeys
if (generatedKeys.next()) {
return@withContext generatedKeys.getLong(1)
} else {
throw DataSourceExceptions.RecordCreationException("Unable to retrieve the id of the newly inserted editor")
}
}
suspend fun read(id: Long): EditorEntity = withContext(Dispatchers.IO) {
val statement = connection.prepareStatement(SELECT_EDITOR_BY_ID)
statement.setLong(1, id)
val resultSet = statement.executeQuery()
if (resultSet.next()) {
val login = resultSet.getString(EditorsTable.COLUMN_LOGIN)
val password = resultSet.getString(EditorsTable.COLUMN_PASSWORD)
val firstname = resultSet.getString(EditorsTable.COLUMN_FIRSTNAME)
val lastname = resultSet.getString(EditorsTable.COLUMN_LASTNAME)
return@withContext EditorEntity(
id = id,
login = login,
password = <PASSWORD>,
firstname = firstname,
lastname = lastname
)
} else {
throw DataSourceExceptions.RecordNotFoundException("Editor record not found")
}
}
suspend fun readAll(): List<EditorEntity?> = withContext(Dispatchers.IO) {
val result = mutableListOf<EditorEntity>()
val statement = connection.prepareStatement(SELECT_EDITORS)
val resultSet = statement.executeQuery()
while (resultSet.next()) {
val id = resultSet.getLong(EditorsTable.COLUMN_ID)
val login = resultSet.getString(EditorsTable.COLUMN_LOGIN)
val password = resultSet.getString(EditorsTable.COLUMN_PASSWORD)
val firstname = resultSet.getString(EditorsTable.COLUMN_FIRSTNAME)
val lastname = resultSet.getString(EditorsTable.COLUMN_LASTNAME)
result.add(
EditorEntity(
id = id,
login = login,
password = password,
firstname = firstname,
lastname = lastname
)
)
}
result
}
suspend fun update(id: Long, editorEntity: EditorEntity) = withContext(Dispatchers.IO) {
val statement = connection.prepareStatement(UPDATE_EDITOR)
statement.apply {
setString(1, editorEntity.login)
setString(2, editorEntity.password)
setString(3, editorEntity.firstname)
setString(4, editorEntity.lastname)
setLong(5, id)
}
return@withContext try {
statement.executeUpdate()
} catch (e: Exception) {
throw DataSourceExceptions.RecordModificationException("Can not modify editor record")
}
}
suspend fun delete(id: Long) = withContext(Dispatchers.IO) {
val statement = connection.prepareStatement(DELETE_EDITOR)
statement.setLong(1, id)
return@withContext try {
statement.executeUpdate()
} catch (e: Exception) {
throw DataSourceExceptions.RecordDeletionException("Can not delete editor record")
}
}
} | 0 | Java | 0 | 0 | 50707b4de3ec58495e3d2be9b95984019cb84a2a | 6,609 | DC2024-01-27 | MIT License |
plugins/kotlin/j2k/shared/tests/testData/newJ2k/postProcessing/IfToElvis.k2.kt | JetBrains | 2,489,216 | false | {"Text": 9788, "INI": 517, "YAML": 423, "Ant Build System": 11, "Batchfile": 34, "Dockerfile": 10, "Shell": 633, "Markdown": 750, "Ignore List": 141, "Git Revision List": 1, "Git Attributes": 11, "EditorConfig": 260, "XML": 7904, "SVG": 4537, "Kotlin": 60205, "Java": 84268, "HTML": 3803, "Java Properties": 217, "Gradle": 462, "Maven POM": 95, "JavaScript": 232, "CSS": 79, "JSON": 1436, "JFlex": 33, "Makefile": 5, "Diff": 137, "XSLT": 113, "Gradle Kotlin DSL": 735, "Groovy": 3102, "desktop": 1, "JAR Manifest": 17, "PHP": 47, "Microsoft Visual Studio Solution": 2, "C#": 33, "Smalltalk": 17, "Erlang": 1, "Perl": 9, "Jupyter Notebook": 13, "Rich Text Format": 2, "AspectJ": 2, "HLSL": 2, "Objective-C": 15, "CoffeeScript": 2, "HTTP": 2, "JSON with Comments": 73, "GraphQL": 127, "Nginx": 1, "HAProxy": 1, "OpenStep Property List": 47, "Python": 17095, "C": 110, "C++": 42, "Protocol Buffer": 3, "fish": 2, "PowerShell": 3, "Go": 36, "Prolog": 2, "ColdFusion": 2, "Turtle": 2, "TeX": 11, "HCL": 4, "F#": 1, "GLSL": 1, "Elixir": 2, "Ruby": 4, "XML Property List": 85, "E-mail": 18, "Roff": 289, "Roff Manpage": 40, "Swift": 3, "TOML": 196, "Checksums": 49, "Java Server Pages": 11, "Vue": 1, "Dotenv": 1, "reStructuredText": 67, "SQL": 1, "Vim Snippet": 8, "AMPL": 4, "Linux Kernel Module": 1, "CMake": 15, "Handlebars": 1, "Rust": 20, "Go Checksums": 1, "Go Module": 1, "NSIS": 8, "PlantUML": 6, "SCSS": 2, "Thrift": 3, "Cython": 13, "Regular Expression": 3, "JSON5": 4, "OASv3-json": 3, "OASv3-yaml": 1} | internal class C {
fun foo(s: String?): String {
return if (s != null) s else ""
}
}
| 1 | null | 1 | 1 | 0d546ea6a419c7cb168bc3633937a826d4a91b7c | 101 | intellij-community | Apache License 2.0 |
swipebackhelper/src/main/java/com/messy/swipebackhelper/ShadowView.kt | nicolite | 106,815,276 | false | null | package com.microtears.swipebackhelper
import android.content.Context
import android.graphics.Canvas
import android.graphics.drawable.Drawable
import android.graphics.drawable.GradientDrawable
import android.view.View
class ShadowView(context: Context) : View(context) {
private var drawable: Drawable
init {
val colors = intArrayOf(0x00000000, 0x17000000, 0x43000000)
drawable = GradientDrawable(GradientDrawable.Orientation.LEFT_RIGHT, colors)
}
override fun onDraw(canvas: Canvas) {
super.onDraw(canvas)
drawable.setBounds(0, 0, measuredWidth, measuredHeight)
drawable.draw(canvas)
}
} | 1 | null | 6 | 28 | bbcb222b96316208d479c75544b4bc910b09a778 | 654 | HutHelper | Apache License 2.0 |
app/src/main/java/com/github/kieuthang/login_chat/data/common/cache/DataCacheApiImpl.kt | KieuThang | 155,848,776 | false | null | package com.github.kieuthang.login_chat.data.common.cache
import android.content.Context
import android.text.TextUtils
import com.github.kieuthang.login_chat.common.AppConstants
import com.github.kieuthang.login_chat.data.entity.AccessToken
import com.github.kieuthang.login_chat.data.entity.UserModel
import com.google.gson.Gson
class DataCacheApiImpl(context: Context) : Cache(context), IDataCacheApi {
override fun getAccessToken(): AccessToken? {
val userModelJson = getJsonData(AppConstants.Cache.ACCESS_TOKEN)
if (TextUtils.isEmpty(userModelJson)) {
return null
}
return Gson().fromJson(userModelJson, AccessToken::class.java)
}
override fun getUserModel(): UserModel? {
val userModelJson = getJsonData(AppConstants.Cache.USER_MODEL)
if (TextUtils.isEmpty(userModelJson)) {
return null
}
return Gson().fromJson(userModelJson, UserModel::class.java)
}
override fun saveDataToCache(cacheName: String, jsonData: String) {
clearCache(cacheName)
put(cacheName, jsonData)
}
override fun doClearCache(cacheName: String) {
clearCache(cacheName)
}
override fun isExpired(mapCacheName: String): Boolean {
return isCacheExpired(mapCacheName)
}
}
| 1 | null | 1 | 1 | 6285c0a85430f1c2133c531f5ae7b0b106fc2ec6 | 1,309 | Socket.Chat_Android | MIT License |
wallpaper/app/src/androidTest/java/gparap/apps/wallpaper/ui/AppSuite.kt | gparap | 253,560,705 | false | null | /*
* Copyright (c) 2022 gparap
*
* 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 gparap.apps.wallpaper.ui
import gparap.apps.wallpaper.utils.UtilsInstrumentedTest
import org.junit.runner.RunWith
import org.junit.runners.Suite
@RunWith(Suite::class)
@Suite.SuiteClasses(
MainActivityInstrumentedTest::class,
WallpaperActivityInstrumentedTest::class,
UtilsInstrumentedTest::class
)
class AppSuite | 1 | null | 1 | 7 | a292356ba95dfd1cb357b2c24cf01fe5db11f154 | 929 | android | Apache License 2.0 |
kamp-core/src/test/kotlin/ch/leadrian/samp/kamp/core/runtime/command/PrimitiveDoubleCommandParameterResolverTest.kt | Double-O-Seven | 142,487,686 | false | {"Kotlin": 3854710, "C": 23964, "C++": 23699, "Java": 4753, "Dockerfile": 769, "Objective-C": 328, "Batchfile": 189} | package ch.leadrian.samp.kamp.core.runtime.command
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test
internal class PrimitiveDoubleCommandParameterResolverTest {
private val primitiveDoubleCommandParameterResolver = PrimitiveDoubleCommandParameterResolver()
@Test
fun shouldReturnDoubleJavaPrimitiveTypeAsParameterType() {
val parameterType = primitiveDoubleCommandParameterResolver.parameterType
assertThat(parameterType)
.isEqualTo(Double::class.javaPrimitiveType!!)
}
@Test
fun shouldResolveDoubleString() {
val value = primitiveDoubleCommandParameterResolver.resolve("1.23")
assertThat(value)
.isEqualTo(1.23)
}
@Test
fun givenNonNumericStringItShouldReturnNull() {
val value = primitiveDoubleCommandParameterResolver.resolve("hahaha")
assertThat(value)
.isNull()
}
} | 1 | Kotlin | 1 | 7 | af07b6048210ed6990e8b430b3a091dc6f64c6d9 | 951 | kamp | Apache License 2.0 |
plugins/gradle-plugin/src/test/kotlin/com/neva/osgi/toolkit/gradle/InstanceTest.kt | neva-dev | 61,142,851 | false | {"Gradle": 19, "INI": 1, "Shell": 3, "Text": 1, "Ignore List": 1, "Batchfile": 3, "Git Attributes": 1, "EditorConfig": 1, "Markdown": 2, "Kotlin": 28, "Java": 1, "Java Properties": 1} | package com.neva.osgi.toolkit.gradle
import org.junit.Test
class InstanceTest : BuildTest() {
@Test
fun shouldCreateValidDistribution() {
build("instance", ":osgiDistribution", { result ->
val distro = result.file("build/osgi/distributions/example-1.0.0.jar")
assertFile(distro)
})
}
}
| 6 | null | 1 | 1 | bed6ce44834d5b1e716def7b1955c8ffde47eb67 | 342 | gradle-osgi-plugin | Apache License 2.0 |
android/src/main/kotlin/top/kikt/imagescanner/core/utils/DBUtils.kt | vitor-gyant | 232,130,063 | false | {"Markdown": 8, "XML": 19, "YAML": 3, "Text": 1, "Ignore List": 6, "Git Attributes": 1, "Gradle": 5, "INI": 5, "Shell": 2, "Batchfile": 2, "Java Properties": 2, "Kotlin": 20, "Java": 4, "Dart": 25, "Ruby": 3, "OpenStep Property List": 4, "Objective-C": 34, "JSON": 3} | package top.kikt.imagescanner.core.utils
import android.annotation.SuppressLint
import android.content.ContentUris
import android.content.ContentValues
import android.content.Context
import android.graphics.Bitmap
import android.graphics.BitmapFactory
import android.net.Uri
import android.provider.MediaStore
import android.provider.MediaStore.Files.FileColumns.MEDIA_TYPE_IMAGE
import android.provider.MediaStore.Files.FileColumns.MEDIA_TYPE_VIDEO
import top.kikt.imagescanner.core.cache.CacheContainer
import top.kikt.imagescanner.core.entity.AssetEntity
import top.kikt.imagescanner.core.entity.GalleryEntity
import top.kikt.imagescanner.core.utils.IDBUtils.Companion.storeBucketKeys
import top.kikt.imagescanner.core.utils.IDBUtils.Companion.storeImageKeys
import top.kikt.imagescanner.core.utils.IDBUtils.Companion.storeVideoKeys
import top.kikt.imagescanner.core.utils.IDBUtils.Companion.typeKeys
import java.io.File
import java.io.InputStream
import java.net.URLConnection
/// create 2019-09-05 by cai
/// Call the MediaStore API and get entity for the data.
@Suppress("DEPRECATION")
object DBUtils : IDBUtils {
private const val TAG = "DBUtils"
private val imageUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI
private val videoUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI
private val cacheContainer = CacheContainer()
private fun convertTypeToUri(type: Int): Uri {
return when (type) {
1 -> imageUri
2 -> videoUri
else -> allUri
}
}
@SuppressLint("Recycle")
override fun getGalleryList(context: Context, requestType: Int, timeStamp: Long): List<GalleryEntity> {
val list = ArrayList<GalleryEntity>()
val uri = allUri
val projection = storeBucketKeys + arrayOf("count(1)")
val args = ArrayList<String>()
val typeSelection: String
when (requestType) {
1 -> {
typeSelection = "AND ${MediaStore.Files.FileColumns.MEDIA_TYPE} = ?"
args.add(MEDIA_TYPE_IMAGE.toString())
}
2 -> {
typeSelection = "AND ${MediaStore.Files.FileColumns.MEDIA_TYPE} = ?"
args.add(MEDIA_TYPE_VIDEO.toString())
}
else -> {
typeSelection = "AND ${MediaStore.Files.FileColumns.MEDIA_TYPE} in (?,?)"
args.add(MEDIA_TYPE_IMAGE.toString())
args.add(MEDIA_TYPE_VIDEO.toString())
}
}
val dateSelection = "AND ${MediaStore.Images.Media.DATE_TAKEN} <= ?"
args.add(timeStamp.toString())
val sizeWhere = AndroidQDBUtils.sizeWhere(requestType)
val selection = "${MediaStore.Images.Media.BUCKET_ID} IS NOT NULL $typeSelection $dateSelection $sizeWhere) GROUP BY (${MediaStore.Images.Media.BUCKET_ID}"
val cursor = context.contentResolver.query(uri, projection, selection, args.toTypedArray(), null)
?: return emptyList()
while (cursor.moveToNext()) {
val id = cursor.getString(0)
val name = cursor.getString(1)
val count = cursor.getInt(2)
list.add(GalleryEntity(id, name, count, 0))
}
cursor.close()
return list
}
override fun getGalleryEntity(context: Context, galleryId: String, type: Int, timeStamp: Long): GalleryEntity? {
val uri = allUri
val projection = storeBucketKeys + arrayOf("count(1)")
val args = ArrayList<String>()
val typeSelection: String
when (type) {
1 -> {
typeSelection = "AND ${MediaStore.Files.FileColumns.MEDIA_TYPE} = ?"
args.add(MEDIA_TYPE_IMAGE.toString())
}
2 -> {
typeSelection = "AND ${MediaStore.Files.FileColumns.MEDIA_TYPE} = ?"
args.add(MEDIA_TYPE_VIDEO.toString())
}
else -> {
typeSelection = "AND ${MediaStore.Files.FileColumns.MEDIA_TYPE} in (?,?)"
args.add(MEDIA_TYPE_IMAGE.toString())
args.add(MEDIA_TYPE_VIDEO.toString())
}
}
val dateSelection = "AND ${MediaStore.Images.Media.DATE_TAKEN} <= ?"
args.add(timeStamp.toString())
val idSelection: String
if (galleryId == "") {
idSelection = ""
} else {
idSelection = "AND ${MediaStore.Images.Media.BUCKET_ID} = ?"
args.add(galleryId)
}
val sizeWhere = AndroidQDBUtils.sizeWhere(null)
val selection = "${MediaStore.Images.Media.BUCKET_ID} IS NOT NULL $typeSelection $dateSelection $idSelection $sizeWhere) GROUP BY (${MediaStore.Images.Media.BUCKET_ID}"
val cursor = context.contentResolver.query(uri, projection, selection, args.toTypedArray(), null) ?: return null
return if (cursor.moveToNext()) {
val id = cursor.getString(0)
val name = cursor.getString(1)
val count = cursor.getInt(2)
cursor.close()
GalleryEntity(id, name, count, 0)
} else {
cursor.close()
null
}
}
override fun getThumb(context: Context, id: String, width: Int, height: Int, type: Int?): Bitmap? {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
@SuppressLint("Recycle")
override fun getAssetFromGalleryId(context: Context, galleryId: String, page: Int, pageSize: Int, requestType: Int, timeStamp: Long, cacheContainer: CacheContainer?): List<AssetEntity> {
val cache = cacheContainer ?: this.cacheContainer
val isAll = galleryId.isEmpty()
val list = ArrayList<AssetEntity>()
val uri = allUri
val args = ArrayList<String>()
if (!isAll) {
args.add(galleryId)
}
val typeSelection: String
when (requestType) {
1 -> {
typeSelection = "AND ${MediaStore.Files.FileColumns.MEDIA_TYPE} = ?"
args.add(MEDIA_TYPE_IMAGE.toString())
}
2 -> {
typeSelection = "AND ${MediaStore.Files.FileColumns.MEDIA_TYPE} = ?"
args.add(MEDIA_TYPE_VIDEO.toString())
}
else -> {
typeSelection = "AND ${MediaStore.Files.FileColumns.MEDIA_TYPE} in (?,?)"
args.add(MEDIA_TYPE_IMAGE.toString())
args.add(MEDIA_TYPE_VIDEO.toString())
}
}
val dateSelection = "AND ${MediaStore.Images.Media.DATE_TAKEN} <= ?"
args.add(timeStamp.toString())
val sizeWhere = AndroidQDBUtils.sizeWhere(requestType)
val keys = (storeImageKeys + storeVideoKeys + typeKeys).distinct().toTypedArray()
val selection = if (isAll) {
"${MediaStore.Images.ImageColumns.BUCKET_ID} IS NOT NULL $typeSelection $dateSelection $sizeWhere"
} else {
"${MediaStore.Images.ImageColumns.BUCKET_ID} = ? $typeSelection $dateSelection $sizeWhere"
}
val sortOrder = "${MediaStore.Images.Media.DATE_TAKEN} DESC LIMIT $pageSize OFFSET ${page * pageSize}"
val cursor = context.contentResolver.query(uri, keys, selection, args.toTypedArray(), sortOrder)
?: return emptyList()
while (cursor.moveToNext()) {
val id = cursor.getString(MediaStore.MediaColumns._ID)
val path = cursor.getString(MediaStore.MediaColumns.DATA)
val date = cursor.getLong(MediaStore.Images.Media.DATE_TAKEN)
val modifiedDate = cursor.getLong(MediaStore.MediaColumns.DATE_MODIFIED)
val type = cursor.getInt(MediaStore.Files.FileColumns.MEDIA_TYPE)
val duration = if (requestType == 1) 0 else cursor.getLong(MediaStore.Video.VideoColumns.DURATION)
val width = cursor.getInt(MediaStore.MediaColumns.WIDTH)
val height = cursor.getInt(MediaStore.MediaColumns.HEIGHT)
val displayName = File(path).name
val asset = AssetEntity(id, path, duration, date, width, height, getMediaType(type), displayName, modifiedDate)
list.add(asset)
cache.putAsset(asset)
}
cursor.close()
return list
}
override fun getAssetFromGalleryIdRange(context: Context, gId: String, start: Int, end: Int, requestType: Int, timestamp: Long): List<AssetEntity> {
val cache = cacheContainer
val isAll = gId.isEmpty()
val list = ArrayList<AssetEntity>()
val uri = allUri
val args = ArrayList<String>()
if (!isAll) {
args.add(gId)
}
val typeSelection: String
when (requestType) {
1 -> {
typeSelection = "AND ${MediaStore.Files.FileColumns.MEDIA_TYPE} = ?"
args.add(MEDIA_TYPE_IMAGE.toString())
}
2 -> {
typeSelection = "AND ${MediaStore.Files.FileColumns.MEDIA_TYPE} = ?"
args.add(MEDIA_TYPE_VIDEO.toString())
}
else -> {
typeSelection = "AND ${MediaStore.Files.FileColumns.MEDIA_TYPE} in (?,?)"
args.add(MEDIA_TYPE_IMAGE.toString())
args.add(MEDIA_TYPE_VIDEO.toString())
}
}
val dateSelection = "AND ${MediaStore.Images.Media.DATE_TAKEN} <= ?"
args.add(timestamp.toString())
val sizeWhere = AndroidQDBUtils.sizeWhere(requestType)
val keys = (storeImageKeys + storeVideoKeys + typeKeys).distinct().toTypedArray()
val selection = if (isAll) {
"${MediaStore.Images.ImageColumns.BUCKET_ID} IS NOT NULL $typeSelection $dateSelection $sizeWhere"
} else {
"${MediaStore.Images.ImageColumns.BUCKET_ID} = ? $typeSelection $dateSelection $sizeWhere"
}
val pageSize = end - start
val sortOrder = "${MediaStore.Images.Media.DATE_TAKEN} DESC LIMIT $pageSize OFFSET $start"
val cursor = context.contentResolver.query(uri, keys, selection, args.toTypedArray(), sortOrder)
?: return emptyList()
while (cursor.moveToNext()) {
val id = cursor.getString(MediaStore.MediaColumns._ID)
val path = cursor.getString(MediaStore.MediaColumns.DATA)
val date = cursor.getLong(MediaStore.Images.Media.DATE_TAKEN)
val type = cursor.getInt(MediaStore.Files.FileColumns.MEDIA_TYPE)
val duration = if (requestType == 1) 0 else cursor.getLong(MediaStore.Video.VideoColumns.DURATION)
val width = cursor.getInt(MediaStore.MediaColumns.WIDTH)
val height = cursor.getInt(MediaStore.MediaColumns.HEIGHT)
val displayName = File(path).name
val modifiedDate = cursor.getLong(MediaStore.MediaColumns.DATE_MODIFIED)
val asset = AssetEntity(id, path, duration, date, width, height, getMediaType(type), displayName, modifiedDate)
list.add(asset)
cache.putAsset(asset)
}
cursor.close()
return list
}
@SuppressLint("Recycle")
override fun getAssetEntity(context: Context, id: String): AssetEntity? {
val asset = cacheContainer.getAsset(id)
if (asset != null) {
return asset
}
val keys = (storeImageKeys + storeVideoKeys).distinct().toTypedArray()
val selection = "${MediaStore.Files.FileColumns._ID} = ?"
val args = arrayOf(id)
val cursor = context.contentResolver.query(allUri, keys, selection, args, null)
?: return null
if (cursor.moveToNext()) {
val databaseId = cursor.getString(MediaStore.MediaColumns._ID)
val path = cursor.getString(MediaStore.MediaColumns.DATA)
val date = cursor.getLong(MediaStore.Images.Media.DATE_TAKEN)
val type = cursor.getInt(MediaStore.Files.FileColumns.MEDIA_TYPE)
val duration = if (type == MEDIA_TYPE_IMAGE) 0 else cursor.getLong(MediaStore.Video.VideoColumns.DURATION)
val width = cursor.getInt(MediaStore.MediaColumns.WIDTH)
val height = cursor.getInt(MediaStore.MediaColumns.HEIGHT)
val displayName = File(path).name
val modifiedDate = cursor.getLong(MediaStore.MediaColumns.DATE_MODIFIED)
val dbAsset = AssetEntity(databaseId, path, duration, date, width, height, getMediaType(type), displayName, modifiedDate)
cacheContainer.putAsset(dbAsset)
cursor.close()
return dbAsset
} else {
cursor.close()
return null
}
}
override fun getFilePath(context: Context, id: String): String? {
val assetEntity = getAssetEntity(context, id) ?: return null
return assetEntity.path
}
override fun clearCache() {
cacheContainer.clearCache()
}
override fun saveImage(context: Context, image: ByteArray, title: String, desc: String): AssetEntity? {
val bmp = BitmapFactory.decodeByteArray(image, 0, image.count())
val insertImage = MediaStore.Images.Media.insertImage(context.contentResolver, bmp, title, desc)
val id = ContentUris.parseId(Uri.parse(insertImage))
return getAssetEntity(context, id.toString())
}
override fun saveVideo(context: Context, inputStream: InputStream, title: String, desc: String): AssetEntity? {
val cr = context.contentResolver
val timestamp = System.currentTimeMillis() / 1000
val typeFromStream = URLConnection.guessContentTypeFromStream(inputStream)
val uri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI
val values = ContentValues().apply {
put(MediaStore.MediaColumns.DISPLAY_NAME, title)
put(MediaStore.Video.VideoColumns.MIME_TYPE, typeFromStream)
put(MediaStore.Video.VideoColumns.TITLE, title)
put(MediaStore.Video.VideoColumns.DESCRIPTION, desc)
put(MediaStore.Video.VideoColumns.DATE_ADDED, timestamp)
put(MediaStore.Video.VideoColumns.DATE_MODIFIED, timestamp)
}
val contentUri = cr.insert(uri, values) ?: return null
val outputStream = cr.openOutputStream(contentUri)
outputStream?.use {
inputStream.use {
inputStream.copyTo(outputStream)
}
}
val id = ContentUris.parseId(contentUri)
cr.notifyChange(contentUri, null)
return getAssetEntity(context, id.toString())
}
} | 1 | null | 1 | 1 | ddd400493a6a9bdbb7ef9e7e3db7b89e48b15429 | 14,602 | flutter_photo_manager | Apache License 2.0 |
domain/src/main/java/com/worldsnas/domain/repo/home/HomeAPI.kt | worldsnas | 178,716,293 | false | {"Kotlin": 397002, "Java": 240871} | package com.worldsnas.domain.repo.home
import com.worldsnas.domain.model.servermodels.MovieServerModel
import com.worldsnas.domain.model.servermodels.ResultsServerModel
import io.reactivex.Single
import kotlinx.coroutines.flow.Flow
import retrofit2.Response
import retrofit2.http.GET
import retrofit2.http.Query
interface HomeAPI {
@GET("/3/discover/movie?include_video=false&include_adult=false&sort_by=release_date.desc")
suspend fun getLatestMovie(
@Query("release_date.lte")
finalDate : String,
@Query("page")
page: Int
): Response<ResultsServerModel<MovieServerModel>>
@GET("/3/trending/movie/day")
fun getTerndingMovie():
Single<Response<ResultsServerModel<MovieServerModel>>>
} | 1 | Kotlin | 8 | 57 | c7d084d2cf2c4f9486337fe347d5d6b8b5806e0a | 752 | AIO | Apache License 2.0 |
plugins/kotlin/base/code-insight/src/org/jetbrains/kotlin/idea/base/codeInsight/KotlinCallProcessor.kt | JetBrains | 2,489,216 | false | {"Text": 9788, "INI": 517, "YAML": 423, "Ant Build System": 11, "Batchfile": 34, "Dockerfile": 10, "Shell": 633, "Markdown": 750, "Ignore List": 141, "Git Revision List": 1, "Git Attributes": 11, "EditorConfig": 260, "XML": 7904, "SVG": 4537, "Kotlin": 60205, "Java": 84268, "HTML": 3803, "Java Properties": 217, "Gradle": 462, "Maven POM": 95, "JavaScript": 232, "CSS": 79, "JSON": 1436, "JFlex": 33, "Makefile": 5, "Diff": 137, "XSLT": 113, "Gradle Kotlin DSL": 735, "Groovy": 3102, "desktop": 1, "JAR Manifest": 17, "PHP": 47, "Microsoft Visual Studio Solution": 2, "C#": 33, "Smalltalk": 17, "Erlang": 1, "Perl": 9, "Jupyter Notebook": 13, "Rich Text Format": 2, "AspectJ": 2, "HLSL": 2, "Objective-C": 15, "CoffeeScript": 2, "HTTP": 2, "JSON with Comments": 73, "GraphQL": 127, "Nginx": 1, "HAProxy": 1, "OpenStep Property List": 47, "Python": 17095, "C": 110, "C++": 42, "Protocol Buffer": 3, "fish": 2, "PowerShell": 3, "Go": 36, "Prolog": 2, "ColdFusion": 2, "Turtle": 2, "TeX": 11, "HCL": 4, "F#": 1, "GLSL": 1, "Elixir": 2, "Ruby": 4, "XML Property List": 85, "E-mail": 18, "Roff": 289, "Roff Manpage": 40, "Swift": 3, "TOML": 196, "Checksums": 49, "Java Server Pages": 11, "Vue": 1, "Dotenv": 1, "reStructuredText": 67, "SQL": 1, "Vim Snippet": 8, "AMPL": 4, "Linux Kernel Module": 1, "CMake": 15, "Handlebars": 1, "Rust": 20, "Go Checksums": 1, "Go Module": 1, "NSIS": 8, "PlantUML": 6, "SCSS": 2, "Thrift": 3, "Cython": 13, "Regular Expression": 3, "JSON5": 4, "OASv3-json": 3, "OASv3-yaml": 1} | // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.kotlin.idea.base.codeInsight
import com.intellij.openapi.progress.ProgressManager
import com.intellij.psi.PsiComment
import com.intellij.psi.PsiElement
import com.intellij.psi.impl.source.tree.LeafPsiElement
import com.intellij.psi.util.PsiTreeUtil
import org.jetbrains.kotlin.analysis.api.KaSession
import org.jetbrains.kotlin.analysis.api.analyze
import org.jetbrains.kotlin.analysis.api.resolution.*
import org.jetbrains.kotlin.analysis.api.signatures.KtCallableSignature
import org.jetbrains.kotlin.analysis.api.signatures.KtFunctionLikeSignature
import org.jetbrains.kotlin.analysis.api.signatures.KtVariableLikeSignature
import org.jetbrains.kotlin.analysis.api.symbols.*
import org.jetbrains.kotlin.idea.references.mainReference
import org.jetbrains.kotlin.kdoc.psi.api.KDoc
import org.jetbrains.kotlin.lexer.KtTokens
import org.jetbrains.kotlin.psi.*
sealed interface CallTarget {
val caller: KtElement
val call: KaCall
val partiallyAppliedSymbol: KaPartiallyAppliedSymbol<KaCallableSymbol, KtCallableSignature<KaCallableSymbol>>
val symbol: KaCallableSymbol
val anchor: PsiElement
get() = when (val element = caller) {
is KtUnaryExpression -> element.operationReference
is KtBinaryExpression -> element.operationReference
else -> element
}
val anchorLeaf: PsiElement
get() = when (val element = anchor) {
is LeafPsiElement -> element
else -> generateSequence(element) { it.firstChild }.last()
}
}
sealed interface TypedCallTarget<out S : KaCallableSymbol, out C : KtCallableSignature<S>> : CallTarget {
override val partiallyAppliedSymbol: KaPartiallyAppliedSymbol<S, C>
override val symbol: S
}
class VariableCallTarget(
override val caller: KtElement,
override val call: KaCall,
override val partiallyAppliedSymbol: KaPartiallyAppliedVariableSymbol<KtVariableLikeSymbol>
) : TypedCallTarget<KtVariableLikeSymbol, KtVariableLikeSignature<KtVariableLikeSymbol>> {
override val symbol: KtVariableLikeSymbol
get() = partiallyAppliedSymbol.symbol
}
class FunctionCallTarget(
override val caller: KtElement,
override val call: KaCall,
override val partiallyAppliedSymbol: KaPartiallyAppliedFunctionSymbol<KaFunctionLikeSymbol>
) : TypedCallTarget<KaFunctionLikeSymbol, KtFunctionLikeSignature<KaFunctionLikeSymbol>> {
override val symbol: KaFunctionLikeSymbol
get() = partiallyAppliedSymbol.symbol
}
interface KotlinCallTargetProcessor {
/**
* Processes a successfully resolved [CallTarget].
* If false is returned from this function, no further elements will be processed.
*/
fun KaSession.processCallTarget(target: CallTarget): Boolean
/**
* Processes a call that resolved as an error.
* If false is returned from this function, no further elements will be processed.
*/
fun KaSession.processUnresolvedCall(element: KtElement, callInfo: KaCallInfo?): Boolean
}
private fun (KaSession.(CallTarget) -> Unit).toCallTargetProcessor(): KotlinCallTargetProcessor {
val processor = this
return object : KotlinCallTargetProcessor {
override fun KaSession.processCallTarget(target: CallTarget): Boolean {
processor(target)
return true
}
override fun KaSession.processUnresolvedCall(element: KtElement, callInfo: KaCallInfo?): Boolean {
return true
}
}
}
object KotlinCallProcessor {
private val NAME_REFERENCE_IGNORED_PARENTS = arrayOf(
KtUserType::class.java,
KtImportDirective::class.java,
KtPackageDirective::class.java,
KtValueArgumentName::class.java,
PsiComment::class.java,
KDoc::class.java
)
fun process(element: PsiElement, processor: KaSession.(CallTarget) -> Unit) {
process(element, processor.toCallTargetProcessor())
}
fun process(element: PsiElement, processor: KotlinCallTargetProcessor): Boolean {
return when (element) {
is KtArrayAccessExpression -> handle(element, processor)
is KtCallExpression -> handle(element, processor)
is KtUnaryExpression -> handle(element, processor)
is KtBinaryExpression -> handle(element, processor)
is KtForExpression -> handle(element, processor)
is KtDestructuringDeclaration -> handle(element, processor)
is KtDestructuringDeclarationEntry -> handle(element, processor)
is KtNameReferenceExpression -> {
if (shouldHandleNameReference(element)) {
handle(element, processor)
} else {
true
}
}
else -> true
}
}
private fun shouldHandleNameReference(element: KtNameReferenceExpression): Boolean {
val qualified = qualifyNameExpression(element) ?: return false
val isDuplicatingCall = when (val parent = qualified.parent) {
is KtCallableReferenceExpression -> qualified == parent.callableReference
is KtCallExpression -> qualified == parent.calleeExpression
is KtUnaryExpression -> qualified == parent.baseExpression
is KtBinaryExpression -> parent.operationToken in KtTokens.ALL_ASSIGNMENTS && qualified == parent.left
else -> false
}
return !isDuplicatingCall && PsiTreeUtil.getParentOfType(qualified, *NAME_REFERENCE_IGNORED_PARENTS) == null
}
private fun qualifyNameExpression(element: KtNameReferenceExpression): KtExpression? {
var current: KtExpression = element
while (true) {
val parent = current.parent
if (parent !is KtQualifiedExpression || parent.selectorExpression != current) {
break
}
current = KtPsiUtil.deparenthesize(parent) ?: return null
}
return current
}
private fun handle(element: KtElement, processor: KotlinCallTargetProcessor): Boolean {
analyze(element) {
fun handleSpecial(element: KtElement, filter: (KtSymbol) -> Boolean): Boolean {
val symbols = element.mainReference?.resolveToSymbols() ?: return true
for (symbol in symbols) {
if (!filter(symbol)) {
continue
}
val shouldContinue = with(processor) {
when (symbol) {
is KaFunctionLikeSymbol -> {
val signature = symbol.asSignature()
val partiallyAppliedSymbol = KaPartiallyAppliedFunctionSymbol(signature, null, null)
val call = KaSimpleFunctionCall(partiallyAppliedSymbol, linkedMapOf(), mapOf(), isImplicitInvoke = false)
processCallTarget(FunctionCallTarget(element, call, partiallyAppliedSymbol))
}
is KtVariableLikeSymbol -> {
val signature = symbol.asSignature()
val partiallyAppliedSymbol = KaPartiallyAppliedVariableSymbol(signature, null, null)
val call = KaSimpleVariableAccessCall(partiallyAppliedSymbol, linkedMapOf(), KaSimpleVariableAccess.Read)
processCallTarget(VariableCallTarget(element, call, partiallyAppliedSymbol))
}
else -> true
}
}
if (!shouldContinue) {
return false
}
}
return true
}
if (element is KtForExpression) {
return handleSpecial(element) { it is KaFunctionLikeSymbol }
}
if (element is KtDestructuringDeclarationEntry) {
return handleSpecial(element) { !(it is KaLocalVariableSymbol && it.psi == element) }
}
val callInfo = element.resolveCallOld()
val call = callInfo?.successfulCallOrNull<KaCall>()
return with(processor) {
if (call != null) {
when (call) {
is KaDelegatedConstructorCall -> processCallTarget(FunctionCallTarget(element, call, call.partiallyAppliedSymbol))
is KaSimpleFunctionCall -> processCallTarget(FunctionCallTarget(element, call, call.partiallyAppliedSymbol))
is KaCompoundVariableAccessCall -> {
processCallTarget(VariableCallTarget(element, call, call.partiallyAppliedSymbol))
processCallTarget(FunctionCallTarget(element, call, call.compoundAccess.operationPartiallyAppliedSymbol))
}
is KaSimpleVariableAccessCall -> {
processCallTarget(VariableCallTarget(element, call, call.partiallyAppliedSymbol))
}
is KaCompoundArrayAccessCall -> {
processCallTarget(FunctionCallTarget(element, call, call.getPartiallyAppliedSymbol))
processCallTarget(FunctionCallTarget(element, call, call.setPartiallyAppliedSymbol))
}
else -> true
}
} else {
processUnresolvedCall(element, callInfo)
}
}
}
}
}
fun KotlinCallProcessor.process(elements: Collection<PsiElement>, processor: KaSession.(CallTarget) -> Unit) {
process(elements, processor.toCallTargetProcessor())
}
fun KotlinCallProcessor.process(elements: Collection<PsiElement>, processor: KotlinCallTargetProcessor) {
process(elements.asSequence(), processor)
}
fun KotlinCallProcessor.process(elements: Sequence<PsiElement>, processor: KotlinCallTargetProcessor) {
for (element in elements) {
ProgressManager.checkCanceled()
if (!process(element, processor)) {
return
}
}
}
| 1 | null | 1 | 1 | 0d546ea6a419c7cb168bc3633937a826d4a91b7c | 10,358 | intellij-community | Apache License 2.0 |
feature_autofill_impl/src/main/kotlin/com/eakurnikov/autoque/autofill/impl/internal/domain/screen/ScreenInfoBuilder.kt | eakurnikov | 208,430,680 | false | null | package com.eakurnikov.autoque.autofill.impl.internal.domain.screen
import android.annotation.TargetApi
import android.app.assist.AssistStructure
import android.os.Build
import android.view.View
import com.eakurnikov.autoque.autofill.impl.internal.data.model.AuthFormInfo
import com.eakurnikov.autoque.autofill.impl.internal.data.model.ScreenInfo
import com.eakurnikov.autoque.autofill.impl.internal.data.model.ViewInfo
import com.eakurnikov.autoque.autofill.impl.internal.domain.viewnode.ViewInfoBuilder
import javax.inject.Inject
/**
* Created by eakurnikov on 2020-01-09
*
* Builds [ScreenInfo].
*/
@TargetApi(Build.VERSION_CODES.O)
class ScreenInfoBuilder @Inject constructor(
private val viewInfoBuilder: ViewInfoBuilder
) {
private var login: ViewInfo? = null
private var password: ViewInfo? = null
@JvmName("buildFromAssistStructures")
fun build(assistStructures: List<AssistStructure>): ScreenInfo? =
build(assistStructures::forEachViewNode)
@JvmName("buildFromViewNodes")
fun build(viewNodes: List<AssistStructure.ViewNode>): ScreenInfo? =
build(viewNodes::forEach)
private inline fun build(
crossinline forEachViewNode: ((AssistStructure.ViewNode) -> Unit) -> Unit
): ScreenInfo? {
login = null
password = null
forEachViewNode { viewNode: AssistStructure.ViewNode ->
viewInfoBuilder.build(viewNode)?.let { viewInfo: ViewInfo ->
when (viewInfo.autofillHint) {
View.AUTOFILL_HINT_USERNAME -> onUsername(viewInfo)
View.AUTOFILL_HINT_PASSWORD -> onPassword(viewInfo)
View.AUTOFILL_HINT_EMAIL_ADDRESS -> onEmail(viewInfo)
View.AUTOFILL_HINT_PHONE -> onPhone(viewInfo)
}
}
}
login ?: password ?: return null
return ScreenInfo(AuthFormInfo(login, password))
}
private fun onUsername(viewInfo: ViewInfo) {
login = viewInfo
}
private fun onPassword(viewInfo: ViewInfo) {
password = viewInfo
}
private fun onEmail(viewInfo: ViewInfo) {
if (login == null) {
login = viewInfo
}
}
private fun onPhone(viewInfo: ViewInfo) {
if (login == null) {
login = viewInfo
}
}
} | 0 | Kotlin | 0 | 1 | 4465eef7368e2c0633b4a47a5d0ec3c0076130ba | 2,332 | AutoQue | Apache License 2.0 |
BlueMS/src/main/java/com/st/BlueMS/demos/HighSpeedDataLog/tagging/HSDTaggingFragment.kt | yanxiaoyan2020 | 401,233,673 | true | {"Java": 1439637, "Kotlin": 161206, "HTML": 3030, "Shell": 1478, "GLSL": 1461} | package com.st.BlueMS.demos.HighSpeedDataLog.tagging
import android.graphics.Color
import android.graphics.PorterDuff
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Button
import android.widget.EditText
import androidx.appcompat.app.AlertDialog
import androidx.core.content.res.ResourcesCompat
import androidx.fragment.app.Fragment
import androidx.fragment.app.viewModels
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.ItemTouchHelper
import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.snackbar.Snackbar
import com.st.BlueMS.R
import com.st.BlueSTSDK.Manager
import com.st.BlueSTSDK.Node
import com.st.BlueMS.demos.HighSpeedDataLog.tagging.HSDAnnotationListAdapter.*
/**
*
*/
class HSDTaggingFragment : Fragment() {
private val viewModel by viewModels<HSDTaggingViewModel> ()
private lateinit var mAnnotationListView: RecyclerView
private lateinit var mAcquisitionName:EditText
private lateinit var mAcquisitionDesc:EditText
private lateinit var mStartStopButton:Button
private lateinit var mAddTagButton:Button
private val mAdapter: HSDAnnotationListAdapter = HSDAnnotationListAdapter(object : AnnotationInteractionCallback {
override fun requestLabelEditing(annotation: AnnotationViewData) {
buildNewLabelDialog(annotation)
}
override fun onAnnotationSelected(selected: AnnotationViewData) {
viewModel.selectAnnotation(selected)
}
override fun onAnnotationDeselected(deselected: AnnotationViewData) {
viewModel.deSelectAnnotation(deselected)
}
})
private fun buildNewLabelDialog(annotation: AnnotationViewData) {
val context = requireContext()
val view = LayoutInflater.from(context).inflate(R.layout.dialog_change_label,null,false)
val textView = view.findViewById<EditText>(R.id.tagLog_changeLabel_value)
textView.setText(annotation.label)
val dialog = AlertDialog.Builder(requireContext())
.setTitle(R.string.tagLog_changeLabel_title)
.setView(view)
.setPositiveButton(R.string.tagLog_changeLabel_ok){ dialog, _ ->
viewModel.changeTagLabel(annotation,textView.text.toString())
dialog.dismiss()
}
.setNegativeButton(R.string.tagLog_changeLabel_cancel){ dialog,_ ->
dialog.dismiss()
}
.create()
dialog.show()
}
private val mSwapToDelete = ItemTouchHelper(
object : ItemTouchHelper.SimpleCallback(0,
ItemTouchHelper.LEFT or ItemTouchHelper.RIGHT) {
override fun onMove(recyclerView: RecyclerView,
viewHolder: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean {
return true // true if moved, false otherwise
}
override fun onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int) {
val position = viewHolder.adapterPosition
val selectedAnnotation = mAdapter.currentList[position]
viewModel.removeAnnotation(selectedAnnotation)
}
})
override fun onResume() {
super.onResume()
val node = arguments?.getString(NODE_TAG_EXTRA)?.let {
Manager.getSharedInstance().getNodeWithTag(it)
}
if(node!=null){
viewModel.enableNotification(node)
}
}
override fun onPause() {
super.onPause()
val node = arguments?.getString(NODE_TAG_EXTRA)?.let {
Manager.getSharedInstance().getNodeWithTag(it)
}
if(node!=null){
viewModel.disableNotification(node)
}
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
val view = inflater.inflate(R.layout.fragment_log_annotation, container, false)
mAnnotationListView = view.findViewById(R.id.tagLog_annotation_list)
mSwapToDelete.attachToRecyclerView(mAnnotationListView)
mAnnotationListView.adapter = mAdapter
mAcquisitionName = view.findViewById(R.id.tagLog_acquisitionName_value)
mAcquisitionDesc = view.findViewById(R.id.tagLog_acquisitionDescription_value)
mAddTagButton = view.findViewById(R.id.tagLog_annotation_addLabelButton)
mStartStopButton = view.findViewById(R.id.tagLog_annotation_startButton)
mStartStopButton.setOnClickListener {
viewModel.onStartStopLogPressed(mAcquisitionName.text.toString(),mAcquisitionDesc.text.toString())
}
mAddTagButton.setOnClickListener {
viewModel.addNewTag()
}
return view
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
viewModel.annotations.observe(viewLifecycleOwner, Observer {
mAdapter.submitList(it)
})
viewModel.isSDCardInserted.observe(viewLifecycleOwner, Observer {isSDCardInserted ->
mStartStopButton.isEnabled = isSDCardInserted != false
})
viewModel.isLogging.observe(viewLifecycleOwner, Observer {isLogging ->
enableEditing(!isLogging)
setupStartStopButtonView(isLogging)
})
}
private fun setupStartStopButtonView(logging: Boolean) {
//todo add the icon
if(logging){
mStartStopButton.setText(R.string.tagLog_stopLog)
}else{
mStartStopButton.setText(R.string.tagLog_startLog)
}
}
private fun enableEditing(enable: Boolean) {
mAcquisitionName.isEnabled = enable
mAcquisitionDesc.isEnabled = enable
mAddTagButton.isEnabled = enable
}
companion object {
val NODE_TAG_EXTRA = HSDTaggingFragment::class.java.name + ".NodeTag"
fun newInstance(node: Node): Fragment {
return HSDTaggingFragment().apply {
arguments = Bundle().apply {
putString(NODE_TAG_EXTRA,node.tag)
}
}
}
}
} | 0 | Java | 0 | 0 | bc7226519aa3f5b86f1fd976629837a8bc804896 | 6,343 | STBlueMS_Android | The Unlicense |
app/src/main/java/app/labs14/roamly/notifications/ShowNotificationIntentService.kt | labs14-travel-website | 196,242,217 | false | null | package app.labs14.roamly.notifications
import android.R
import android.app.IntentService
import android.app.Notification
import android.app.NotificationManager
import android.app.PendingIntent
import android.content.Intent
import android.content.Context
import androidx.core.app.NotificationCompat
import app.labs14.roamly.views.LoginGoogleActivity
class ShowNotificationIntentService : IntentService("ShowNotificationIntentService") {
override fun onHandleIntent(intent: Intent?) {
if (intent != null) {
val action = intent.action
if (ACTION_SHOW_NOTIFICATION == action) {
handleActionShow()
} else if (ACTION_HIDE_NOTIFICATION == action) {
handleActionHide()
}
}
}
private fun handleActionShow() {
showStatusBarIcon(this@ShowNotificationIntentService)
}
private fun handleActionHide() {
// hideStatusBarIcon(this@ShowNotificationIntentService)
}
companion object {
private val ACTION_SHOW_NOTIFICATION = "my.app.service.action.show"
private val ACTION_HIDE_NOTIFICATION = "my.app.service.action.hide"
fun startActionShow(context: Context) {
val intent = Intent(context, ShowNotificationIntentService::class.java)
intent.action = ACTION_SHOW_NOTIFICATION
context.startService(intent)
}
fun startActionHide(context: Context) {
val intent = Intent(context, ShowNotificationIntentService::class.java)
intent.action = ACTION_HIDE_NOTIFICATION
context.startService(intent)
}
fun showStatusBarIcon(ctx: Context) {
val builder = NotificationCompat.Builder(ctx)
.setContentTitle("notification")
.setSmallIcon(R.drawable.ic_dialog_alert)
.setOngoing(true)
val intent = Intent(ctx, LoginGoogleActivity::class.java)
val pIntent = PendingIntent.getActivity(ctx, 100, intent, 0)
builder.setContentIntent(pIntent)
val mNotificationManager = ctx.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
val notif = builder.build()
notif.flags = notif.flags or Notification.FLAG_ONGOING_EVENT
mNotificationManager.notify(100, notif)
}
}
} | 2 | Kotlin | 0 | 0 | 9c14b0a6b825fe8549570b6473f24a11b55509e7 | 2,370 | android | MIT License |
compiler/testData/codegen/defaultArguments/reflection/classInObject.kt | JakeWharton | 99,388,807 | true | null | object o {
class Foo(val a: Int = 1) {}
}
// CLASS: o$Foo
// HAS_DEFAULT_CONSTRUCTOR: true
| 179 | Kotlin | 5640 | 83 | 4383335168338df9bbbe2a63cb213a68d0858104 | 96 | kotlin | Apache License 2.0 |
src/main/kotlin/leetcode/Problem2073.kt | fredyw | 28,460,187 | false | {"Java": 1280840, "Rust": 363472, "Kotlin": 148898, "Shell": 604} | package leetcode
/**
* https://leetcode.com/problems/time-needed-to-buy-tickets/
*/
class Problem2073 {
fun timeRequiredToBuy(tickets: IntArray, k: Int): Int {
var answer = 0
while (tickets[k] > 0) {
for (i in tickets.indices) {
if (tickets[i] == 0) {
continue
}
tickets[i]--
answer++
if (i == k && tickets[i] == 0) {
break
}
}
}
return answer
}
}
| 1 | Java | 1 | 4 | a59d77c4fd00674426a5f4f7b9b009d9b8321d6d | 551 | leetcode | MIT License |
feature/account/server/certificate/src/debug/kotlin/app/k9mail/feature/account/server/certificate/ui/ServerCertificateErrorContentPreview.kt | thunderbird | 1,326,671 | false | null | package app.k9mail.feature.account.server.certificate.ui
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.rememberScrollState
import androidx.compose.runtime.Composable
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import app.k9mail.core.ui.compose.common.koin.koinPreview
import app.k9mail.core.ui.compose.designsystem.PreviewWithTheme
import app.k9mail.feature.account.server.certificate.domain.entity.FormattedServerCertificateError
import app.k9mail.feature.account.server.certificate.domain.entity.ServerCertificateProperties
import okio.ByteString.Companion.decodeHex
@Composable
@Preview(showBackground = true)
internal fun ServerCertificateErrorContentPreview() {
val state = ServerCertificateErrorContract.State(
isShowServerCertificate = true,
certificateError = FormattedServerCertificateError(
hostname = "mail.domain.example",
serverCertificateProperties = ServerCertificateProperties(
subjectAlternativeNames = listOf("*.domain.example", "domain.example"),
notValidBefore = "January 1, 2023, 12:00 AM",
notValidAfter = "December 31, 2023, 11:59 PM",
subject = "CN=*.domain.example",
issuer = "CN=test, O=MZLA",
fingerprintSha1 = "33ab5639bfd8e7b95eb1d8d0b87781d4ffea4d5d".decodeHex(),
fingerprintSha256 = "1894a19c85ba153acbf743ac4e43fc004c891604b26f8c69e1e83ea2afc7c48f".decodeHex(),
fingerprintSha512 = (
"81381f1dacd4824a6c503fd07057763099c12b8309d0abcec4000c9060cbbfa6" +
"7988b2ada669ab4837fcd3d4ea6e2b8db2b9da9197d5112fb369fd006da545de"
).decodeHex(),
),
),
)
koinPreview {
factory<ServerNameFormatter> { DefaultServerNameFormatter() }
factory<FingerprintFormatter> { DefaultFingerprintFormatter() }
} WithContent {
PreviewWithTheme {
ServerCertificateErrorContent(
innerPadding = PaddingValues(all = 0.dp),
state = state,
scrollState = rememberScrollState(),
)
}
}
}
| 846 | null | 2467 | 9,969 | 8b3932098cfa53372d8a8ae364bd8623822bd74c | 2,249 | thunderbird-android | Apache License 2.0 |
fintechplatform-ui/src/main/java/com/fintechplatform/ui/sct/ui/SctContract.kt | DWAplatform | 128,736,783 | false | {"Gradle": 4, "Java Properties": 2, "Shell": 1, "Text": 3, "Ignore List": 3, "Batchfile": 1, "Markdown": 1, "Proguard": 2, "XML": 70, "Kotlin": 284, "Java": 75} | package com.fintechplatform.ui.sct.ui
interface SctContract {
interface View {
fun setExecutionDateText(executionDate: String)
fun getExecutionDateText(): String
fun enableForwardButton(isEnable: Boolean)
fun getAmountText(): String
fun isUrgentSCTChecked(): Boolean
fun isInstantSCTChecked(): Boolean
fun setBalanceAmountText(amount: String)
fun setPersonFullName(fullname: String)
fun setPositiveBalanceColorText()
fun setNegativeBalanceColorText()
fun setFeeAmountText(fee: String)
fun getMessageText(): String
fun showCommunicationWait()
fun hideCommunicationWait()
fun showCommunicationInternalError()
fun showTokenExpiredWarning()
fun showIdempotencyError()
fun playSound()
fun showSuccessDialog()
fun goBack()
fun showKeyboardAmount()
fun hideKeyboard()
}
interface Presenter {
fun initializate(name: String, iban: String)
fun onPickExecutionDate(year: Int, monthOfYear: Int, dayOfMonth: Int)
fun onEditingChanged()
fun onConfirm()
fun onAbort()
fun refresh()
}
} | 1 | null | 1 | 1 | 498bfbdfd00724ae24d7efc01e9af0b2a8cb58b0 | 1,214 | fintech-platform-sdk-android | MIT License |
agp-7.1.0-alpha01/tools/base/build-system/integration-test/application/src/test/java/com/android/build/gradle/integration/testing/testFixtures/TestFixturesTest.kt | jomof | 502,039,754 | false | {"Java": 35519326, "Kotlin": 22849138, "C++": 2171001, "HTML": 1377915, "Starlark": 915536, "C": 141955, "Shell": 110207, "RenderScript": 58853, "Python": 25635, "CMake": 18109, "Batchfile": 12180, "Perl": 9310, "Dockerfile": 5690, "Makefile": 4535, "CSS": 4148, "JavaScript": 3488, "PureBasic": 2359, "GLSL": 1628, "AIDL": 1117, "Prolog": 277} | /*
* Copyright (C) 2021 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.build.gradle.integration.testing.testFixtures
import com.android.build.gradle.integration.common.fixture.GradleTestProject
import com.android.build.gradle.integration.common.utils.TestFileUtils
import com.android.testutils.truth.PathSubject.assertThat
import org.junit.Rule
import org.junit.Test
class TestFixturesTest {
@get:Rule
val project: GradleTestProject =
GradleTestProject.builder().fromTestProject("testFixturesApp").create()
private fun setUpProject(publishJavaLib: Boolean, publishAndroidLib: Boolean) {
if (publishJavaLib) {
TestFileUtils.searchAndReplace(
project.getSubproject(":app").buildFile,
"project(\":javaLib\")",
"'com.example.javaLib:javaLib:1.0'"
)
}
if (publishAndroidLib) {
TestFileUtils.searchAndReplace(
project.getSubproject(":app").buildFile,
"project(\":lib\")",
"'com.example.lib:lib:1.0'"
)
TestFileUtils.searchAndReplace(
project.getSubproject(":lib2").buildFile,
"project(\":lib\")",
"'com.example.lib:lib:1.0'"
)
}
if (publishJavaLib) {
TestFileUtils.appendToFile(project.getSubproject(":javaLib").buildFile,
"""
publishing {
repositories {
maven {
url = uri("../testrepo")
}
}
publications {
release(MavenPublication) {
from components.java
groupId = 'com.example.javaLib'
artifactId = 'javaLib'
version = '1.0'
}
}
}
// required for testFixtures publishing
group = 'com.example.javaLib'
""".trimIndent()
)
}
if (publishAndroidLib) {
TestFileUtils.appendToFile(project.getSubproject(":lib").buildFile,
"""
afterEvaluate {
publishing {
repositories {
maven {
url = uri("../testrepo")
}
}
publications {
release(MavenPublication) {
from components.release
groupId = 'com.example.lib'
artifactId = 'lib'
version = '1.0'
}
}
}
}
// required for testFixtures publishing
group = 'com.example.lib'
""".trimIndent()
)
}
if (publishJavaLib) {
project.executor()
.run(":javaLib:publish")
}
if (publishAndroidLib) {
project.executor()
.run(":lib:publish")
}
}
@Test
fun `library consumes local test fixtures`() {
project.executor()
.run(":lib:testDebugUnitTest")
}
@Test
fun `verify library test fixtures resources dependency on main resources`() {
project.executor()
.run(":lib:verifyReleaseTestFixturesResources")
}
@Test
fun `verify library resources dependency on test fixtures resources from local project`() {
setUpProject(
publishJavaLib = false,
publishAndroidLib = false
)
project.executor()
.run(":lib2:verifyReleaseResources")
}
@Test
fun `verify library resources dependency on test fixtures resources from published lib`() {
setUpProject(
publishJavaLib = false,
publishAndroidLib = true
)
project.executor()
.run(":lib2:verifyReleaseResources")
}
@Test
fun `verify library test dependency on test fixtures resources from local project`() {
setUpProject(
publishJavaLib = false,
publishAndroidLib = false
)
project.executor()
.run(":lib2:testDebugUnitTest")
}
@Test
fun `verify library test dependency on test fixtures resources from published lib`() {
setUpProject(
publishJavaLib = false,
publishAndroidLib = true
)
project.executor()
.run(":lib2:testDebugUnitTest")
}
@Test
fun `app consumes local, java and android library test fixtures`() {
setUpProject(
publishJavaLib = false,
publishAndroidLib = false
)
project.executor()
.run(":app:testDebugUnitTest")
}
@Test
fun `app consumes local, published java and android library test fixtures`() {
setUpProject(
publishJavaLib = true,
publishAndroidLib = true
)
project.executor()
.run(":app:testDebugUnitTest")
}
@Test
fun `app consumes android library test fixtures published using new publishing dsl`() {
addNewPublishingDslForAndroidLibrary()
setUpProject(
publishJavaLib = false,
publishAndroidLib = true
)
project.executor()
.run(":app:testDebugUnitTest")
}
@Test
fun `publish android library main variant without its test fixtures`() {
TestFileUtils.appendToFile(
project.getSubproject(":lib").buildFile,
"""
afterEvaluate {
components.release.withVariantsFromConfiguration(
configurations.releaseTestFixturesVariantReleaseApiPublication) { skip() }
components.release.withVariantsFromConfiguration(
configurations.releaseTestFixturesVariantReleaseRuntimePublication) { skip() }
}
""".trimIndent()
)
setUpProject(
publishAndroidLib = true,
publishJavaLib = true
)
val testFixtureAar = "testrepo/com/example/lib/lib/1.0/lib-1.0-test-fixtures.aar"
val mainVariantAar = "testrepo/com/example/lib/lib/1.0/lib-1.0.aar"
assertThat(project.projectDir.resolve(testFixtureAar)).doesNotExist()
assertThat(project.projectDir.resolve(mainVariantAar)).exists()
}
private fun addNewPublishingDslForAndroidLibrary() {
TestFileUtils.appendToFile(
project.getSubproject(":lib").buildFile,
"""
android{
publishing{
singleVariant("release")
}
}
""".trimIndent()
)
}
}
| 1 | Java | 1 | 0 | 9e3475f6d94cb3239f27ed8f8ee81b0abde4ef51 | 7,649 | CppBuildCacheWorkInProgress | Apache License 2.0 |
2019/src/main/kotlin/com/github/jrhenderson1988/adventofcode2019/day1/FuelCounterUpper.kt | jrhenderson1988 | 289,786,400 | false | {"Kotlin": 214385, "Go": 158613, "Java": 134228, "Rust": 124111, "Scala": 113820, "Elixir": 112109, "Python": 91752, "Shell": 37} | package com.github.jrhenderson1988.adventofcode2019.day1
class FuelCounterUpper(private val modules: List<Module>) {
fun calculateFuelRequirement() = modules.map { it.calculateFuel() }.sum()
fun calculateFinalFuelRequirement() = modules.map { it.calculateFinalFuel() }.sum()
} | 0 | Kotlin | 0 | 0 | 79d6451864509ab798a17985a1b117cdfa81a8c5 | 286 | advent-of-code | Apache License 2.0 |
backend/src/main/kotlin/org/conservationco/asanahire/domain/OriginalApplicant.kt | OliverAbdulrahim | 571,845,791 | false | null | package org.conservationco.asanahire.domain
import com.asana.models.Attachment
import org.conservationco.asana.serialization.AsanaSerializable
import org.conservationco.asana.serialization.customfield.AsanaCustomField
data class OriginalApplicant(
override var id: String = "",
override var name: String = "",
override var documents: Collection<Attachment> = emptyList(),
@AsanaCustomField("Preferred name") override var preferredName: String = "",
@AsanaCustomField("Pronouns") override var pronouns: String = "",
@AsanaCustomField("Pronouns (other)") override var pronounsOther: String = "",
@AsanaCustomField("Email") override var email: String = "",
@AsanaCustomField("Phone number") override var phoneNumber: String = "",
@AsanaCustomField("References") override var references: String = "",
@AsanaCustomField("How did you learn about us?") var learnedAboutUs: Array<String> = emptyArray(),
@AsanaCustomField("How did you learn about us? (other)") var learnedAboutUsOther: String = "",
@AsanaCustomField("Race / Ethnicity") var race: Array<String> = emptyArray(),
@AsanaCustomField("Race / Ethnicity (other)") var raceOther: String = "",
@AsanaCustomField("Receipt sent?") var receiptStage: String = "",
@AsanaCustomField("Rejection sent?") var rejectionStage: String = "",
) : Applicant, AsanaSerializable<OriginalApplicant> {
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false
other as OriginalApplicant
return name == other.name
&& email != other.email
&& phoneNumber == other.phoneNumber
}
override fun hashCode(): Int {
var result = name.hashCode()
result = 31 * result + email.hashCode()
result = 31 * result + phoneNumber.hashCode()
return result
}
}
| 0 | Kotlin | 0 | 2 | e35abb763a40ad36e642a7e7acbc4104807ba328 | 2,138 | asana-hire | MIT License |
features/watch/src/main/kotlin/io/plastique/watch/WatcherListActivity.kt | technoir42 | 251,129,452 | true | {"Kotlin": 1006812, "Shell": 4132, "FreeMarker": 3362} | package io.plastique.watch
import android.content.Context
import android.os.Bundle
import android.view.View
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
import com.github.technoir42.android.extensions.disableChangeAnimations
import com.github.technoir42.android.extensions.setActionBar
import com.github.technoir42.android.extensions.setSubtitleOnClickListener
import com.github.technoir42.android.extensions.setTitleOnClickListener
import com.github.technoir42.glide.preloader.ListPreloader
import com.github.technoir42.kotlin.extensions.plus
import com.github.technoir42.rxjava2.extensions.pairwiseWithPrevious
import io.plastique.core.BaseActivity
import io.plastique.core.content.ContentStateController
import io.plastique.core.content.EmptyView
import io.plastique.core.image.ImageLoader
import io.plastique.core.image.TransformType
import io.plastique.core.lists.EndlessScrollListener
import io.plastique.core.lists.ListItem
import io.plastique.core.lists.ListUpdateData
import io.plastique.core.lists.calculateDiff
import io.plastique.core.mvvm.viewModel
import io.plastique.core.navigation.Route
import io.plastique.core.navigation.activityRoute
import io.plastique.core.navigation.navigationContext
import io.plastique.core.snackbar.SnackbarController
import io.plastique.inject.getComponent
import io.plastique.watch.WatcherListEvent.RefreshEvent
import io.plastique.watch.WatcherListEvent.RetryClickEvent
import io.plastique.watch.WatcherListEvent.SnackbarShownEvent
import io.reactivex.android.schedulers.AndroidSchedulers
class WatcherListActivity : BaseActivity(R.layout.activity_watcher_list) {
private val viewModel: WatcherListViewModel by viewModel()
private val navigator: WatchNavigator get() = viewModel.navigator
private lateinit var watchersView: RecyclerView
private lateinit var refreshLayout: SwipeRefreshLayout
private lateinit var emptyView: EmptyView
private lateinit var contentStateController: ContentStateController
private lateinit var snackbarController: SnackbarController
private lateinit var adapter: WatcherListAdapter
private lateinit var onScrollListener: EndlessScrollListener
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
navigator.attach(navigationContext)
val username = intent.getStringExtra(EXTRA_USERNAME)
initToolbar(username)
val imageLoader = ImageLoader.from(this)
adapter = WatcherListAdapter(
imageLoader = imageLoader,
onUserClick = { user -> navigator.openUserProfile(user) })
watchersView = findViewById(R.id.watchers)
watchersView.adapter = adapter
watchersView.layoutManager = LinearLayoutManager(this)
watchersView.disableChangeAnimations()
createPreloader(imageLoader, adapter).attach(watchersView)
onScrollListener = EndlessScrollListener(LOAD_MORE_THRESHOLD) { viewModel.dispatch(WatcherListEvent.LoadMoreEvent) }
watchersView.addOnScrollListener(onScrollListener)
refreshLayout = findViewById(R.id.refresh)
refreshLayout.setOnRefreshListener { viewModel.dispatch(RefreshEvent) }
emptyView = findViewById(android.R.id.empty)
emptyView.onButtonClick = { viewModel.dispatch(RetryClickEvent) }
contentStateController = ContentStateController(this, R.id.refresh, android.R.id.progress, android.R.id.empty)
snackbarController = SnackbarController(refreshLayout)
snackbarController.onSnackbarShown = { viewModel.dispatch(SnackbarShownEvent) }
viewModel.init(username)
viewModel.state
.pairwiseWithPrevious()
.map { it + calculateDiff(it.second?.listState?.items, it.first.listState.items) }
.observeOn(AndroidSchedulers.mainThread())
.subscribe { renderState(it.first, it.third) }
.disposeOnDestroy()
}
private fun renderState(state: WatcherListViewState, listUpdateData: ListUpdateData<ListItem>) {
contentStateController.state = state.contentState
emptyView.state = state.emptyState
listUpdateData.applyTo(adapter)
onScrollListener.isEnabled = state.listState.isPagingEnabled
refreshLayout.isRefreshing = state.listState.isRefreshing
state.snackbarState?.let(snackbarController::showSnackbar)
}
private fun createPreloader(imageLoader: ImageLoader, adapter: WatcherListAdapter): ListPreloader {
val avatarSize = resources.getDimensionPixelSize(R.dimen.common_avatar_size_small)
val callback = ListPreloader.Callback { position, preloader ->
val item = adapter.items[position] as? WatcherItem ?: return@Callback
val avatarUrl = item.watcher.user.avatarUrl
if (avatarUrl != null) {
val request = imageLoader.load(avatarUrl)
.params {
transforms += TransformType.CircleCrop
cacheInMemory = false
}
.createPreloadRequest()
preloader.preload(request, avatarSize, avatarSize)
}
}
return ListPreloader(imageLoader.glide, callback, MAX_PRELOAD)
}
private fun initToolbar(username: String?) {
val toolbar = setActionBar(R.id.toolbar) {
setTitle(if (username != null) R.string.watch_watchers_title else R.string.watch_watchers_title_current_user)
subtitle = username
setDisplayHomeAsUpEnabled(true)
}
val onClickListener = View.OnClickListener { watchersView.scrollToPosition(0) }
toolbar.setTitleOnClickListener(onClickListener)
toolbar.setSubtitleOnClickListener(onClickListener)
}
override fun injectDependencies() {
getComponent<WatchActivityComponent>().inject(this)
}
companion object {
private const val EXTRA_USERNAME = "username"
private const val LOAD_MORE_THRESHOLD = 10
private const val MAX_PRELOAD = 10
fun route(context: Context, username: String?): Route = activityRoute<WatcherListActivity>(context) {
putExtra(EXTRA_USERNAME, username)
}
}
}
| 0 | null | 0 | 0 | 8497a205808c89b775c3d1fdc75f05ff010e206e | 6,341 | plastique | Apache License 2.0 |
src/main/java/com/tang/intellij/lua/refactoring/rename/LuaIntroducePBEventHandler.kt | songtm | 298,820,255 | true | {"Kotlin": 1174373, "Lua": 471416, "Java": 150090, "HTML": 26916, "Lex": 17363, "Shell": 5762, "Batchfile": 2658} | /*
* Copyright (c) 2017. tangzx([email protected])
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.tang.intellij.lua.refactoring.rename
import com.intellij.codeInsight.CodeInsightUtilCore
import com.intellij.codeInsight.template.TemplateManager
import com.intellij.codeInsight.template.impl.TextExpression
import com.intellij.openapi.actionSystem.DataContext
import com.intellij.openapi.command.WriteCommandAction
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.project.Project
import com.intellij.openapi.util.Pass
import com.intellij.psi.PsiDocumentManager
import com.intellij.psi.PsiElement
import com.intellij.psi.PsiFile
import com.intellij.psi.util.PsiTreeUtil
import com.intellij.refactoring.RefactoringActionHandler
import com.intellij.refactoring.introduce.inplace.InplaceVariableIntroducer
import com.intellij.refactoring.introduce.inplace.OccurrencesChooser
import com.tang.intellij.lua.codeInsight.intention.SCProtoHandleIntention
import com.tang.intellij.lua.psi.*
import com.tang.intellij.lua.refactoring.LuaRefactoringUtil
import java.nio.file.OpenOption
import kotlin.reflect.jvm.internal.impl.utils.SmartList
/**
*
* Created by songtm on 2018/7/3.
*/
class LuaIntroducePBEventHandler : RefactoringActionHandler {
internal inner class IntroduceOperation(val element: PsiElement, val project: Project, val editor: Editor, val file: PsiFile) {
var isReplaceAll: Boolean = false
var occurrences: List<PsiElement>? = null
var name = "var"
var newOccurrences: List<PsiElement>? = null
var newNameElement: LuaNameDef? = null
}
override fun invoke(project: Project, editor: Editor, psiFile: PsiFile, dataContext: DataContext) {
}
override fun invoke(project: Project, psiElements: Array<PsiElement>, dataContext: DataContext) {
}
operator fun invoke(project: Project, editor: Editor, expr: LuaExpr, varName: String) {
val operation = IntroduceOperation(expr, project, editor, expr.containingFile)
operation.name = varName
operation.occurrences = getOccurrences(expr)
WriteCommandAction.runWriteCommandAction(operation.project) { performReplace(operation) }
// OccurrencesChooser.simpleChooser<PsiElement>(editor).showChooser(expr, operation.occurrences!!, object : Pass<OccurrencesChooser.ReplaceChoice>() {
// override fun pass(choice: OccurrencesChooser.ReplaceChoice) {
// operation.isReplaceAll = choice == OccurrencesChooser.ReplaceChoice.ALL
// WriteCommandAction.runWriteCommandAction(operation.project) { performReplace(operation) }
//// performInplaceIntroduce(operation)
// }
// })
}
operator fun invoke(project: Project, editor: Editor, expr: LuaExpr, varName: String, getfuncName:String) {
val operation = IntroduceOperation(expr, project, editor, expr.containingFile)
operation.name = getfuncName
operation.occurrences = getOccurrences(expr)
// WriteCommandAction.runWriteCommandAction(operation.project) { performGenGetter(operation) }
var document = operation.editor.document
val element = operation.element
val context = PsiTreeUtil.findFirstParent(element, { it is LuaClassMethodDef })
val clsdef = context as? LuaClassMethodDef
if (clsdef != null) {
// document.insertString(clsdef.nextSibling.textOffset, "------")
document.insertString(clsdef.nextSibling.textOffset,
"\n\nfunction " + clsdef.classMethodName.expr.text + ":" + getfuncName + "() return "+element.text+" end")
}
document.deleteString(element.parent.textOffset, element.parent.textOffset+element.text.length)
val manager = TemplateManager.getInstance(operation.project)
val template = manager.createTemplate("", "") //key, group
template.addTextSegment(operation.element.text + " = ")
template.addVariable("initvalue", TextExpression("nil"), true)
template.addTextSegment(" ---@type ")
template.addVariable("varType", TextExpression("void"), true)
manager.startTemplate(operation.editor, template)
}
private fun performGenGetter(operation: IntroduceOperation) {
if (!operation.isReplaceAll)
operation.occurrences = listOf(operation.element)
var commonParent = PsiTreeUtil.findCommonParent(operation.occurrences!!)//class method
if (commonParent != null) {
var element = operation.element
var elementText = element.text
var eleOffset = element.textOffset
val context = PsiTreeUtil.findFirstParent(element, { it is LuaClassMethodDef })
val clsdef = context as? LuaClassMethodDef
if (clsdef != null) {
var funName = operation.name
var callbackFun = LuaElementFactory.createWith(operation.project,
"\n\nfunction " + clsdef.classMethodName.expr.text + ":" + funName + "() return "+elementText+" end")
clsdef.parent.addAfter(callbackFun.parent, clsdef)//这里的报错可以用addRangeAfter(ballbackFun.parent.first...)处理,但是有个问题是格式化代码的问题
}
var regCall = LuaElementFactory.createWith(operation.project, elementText + " = nil ---@type void\n")
regCall = element.parent.replace(regCall)
operation.editor.caretModel.moveToOffset(eleOffset + elementText.length + " = nil".length - "self.".length)
}
}
private fun getOccurrences(expr: LuaExpr): List<PsiElement> {
return LuaRefactoringUtil.getOccurrences(expr, expr.containingFile)
}
private fun findAnchor(occurrences: List<PsiElement>?): PsiElement? {
var anchor = occurrences!![0]
next@ do {
val statement = PsiTreeUtil.getParentOfType(anchor, LuaStatement::class.java)
if (statement != null) {
val parent = statement.parent
for (element in occurrences) {
if (!PsiTreeUtil.isAncestor(parent, element, true)) {
anchor = statement
continue@next
}
}
}
return statement
} while (true)
}
private fun isInline(commonParent: PsiElement, operation: IntroduceOperation): Boolean {
var parent = commonParent
if (parent === operation.element)
parent = operation.element.parent
return parent is LuaStatement && (!operation.isReplaceAll || operation.occurrences!!.size == 1)
}
private fun performReplace(operation: IntroduceOperation) {
if (!operation.isReplaceAll)
operation.occurrences = listOf(operation.element)
var commonParent = PsiTreeUtil.findCommonParent(operation.occurrences!!)//class method
if (commonParent != null) {
var element = operation.element
val newOccurrences = SmartList<PsiElement>()
val context = PsiTreeUtil.findFirstParent(element, { it is LuaClassMethodDef })
val clsdef = context as? LuaClassMethodDef
if (clsdef != null) {
val template = SCProtoHandleIntention.scFuncTemplate(clsdef, element.text, operation.project)
clsdef.parent.addAfter(template.parent, clsdef)
}
var regCall = LuaElementFactory.createWith(operation.project, "PROTOREG(" + element.text.toUpperCase() + ", self, self." + element.text.toLowerCase() + ")")
regCall = element.parent.replace(regCall)
// val nameDef = PsiTreeUtil.findChildOfType(regCall, LuaNameDef::class.java)!!
// operation.editor.caretModel.moveToOffset(nameDef.textOffset)
// if (isInline(commonParent, operation)) {
// if (element is LuaCallExpr && element.parent is LuaExprStat) element = element.parent
//
// regCall = element.replace(regCall)
// val nameDef = PsiTreeUtil.findChildOfType(regCall, LuaNameDef::class.java)!!
// operation.editor.caretModel.moveToOffset(nameDef.textOffset)
// } else {
// val anchor = findAnchor(operation.occurrences)
// commonParent = anchor!!.parent
// regCall = commonParent!!.addBefore(regCall, anchor)
// commonParent.addAfter(LuaElementFactory.newLine(operation.project), regCall)
// for (occ in operation.occurrences!!) {
// var identifier = LuaElementFactory.createName(operation.project, operation.name)
// identifier = occ.replace(identifier)
// newOccurrences.add(identifier)
// }
// }
//
// operation.newOccurrences = newOccurrences
// regCall = CodeInsightUtilCore.forcePsiPostprocessAndRestoreElement(regCall)
// val nameDef = PsiTreeUtil.findChildOfType(regCall, LuaNameDef::class.java)
// operation.newNameElement = nameDef
}
}
private fun performInplaceIntroduce(operation: IntroduceOperation) {
LuaIntroduce(operation).performInplaceRefactoring(null)
}
private inner class LuaIntroduce internal constructor(operation: IntroduceOperation)
: InplaceVariableIntroducer<PsiElement>(operation.newNameElement, operation.editor, operation.project, "Introduce Variable", operation.newOccurrences?.toTypedArray(), null) {
override fun checkLocalScope(): PsiElement? {
val currentFile = PsiDocumentManager.getInstance(this.myProject).getPsiFile(this.myEditor.document)
return currentFile ?: super.checkLocalScope()
}
}
}
| 0 | Kotlin | 0 | 0 | 7167b2b8ab991906630f3c7130f75164434aad12 | 10,280 | IntelliJ-EmmyLua | Apache License 2.0 |
mobile_app1/module346/src/main/java/module346packageKt0/Foo780.kt | uber-common | 294,831,672 | false | null | package module346packageKt0;
annotation class Foo780Fancy
@Foo780Fancy
class Foo780 {
fun foo0(){
module346packageKt0.Foo779().foo5()
}
fun foo1(){
foo0()
}
fun foo2(){
foo1()
}
fun foo3(){
foo2()
}
fun foo4(){
foo3()
}
fun foo5(){
foo4()
}
} | 6 | null | 6 | 72 | 9cc83148c1ca37d0f2b2fcb08c71ac04b3749e5e | 297 | android-build-eval | Apache License 2.0 |
Compose-Flight-Search-App/core/testing/src/main/kotlin/com/example/flightsearchapp/core/testing/fake/datasource/FavoritesFakeDataSource.kt | Jaehwa-Noh | 754,078,368 | false | {"Kotlin": 122112} | package com.example.flightsearchapp.core.testing.fake.datasource
import com.example.flightsearchapp.core.data.datasource.FavoritesDataSource
import com.example.flightsearchapp.core.database.model.FavoriteEntity
import com.example.flightsearchapp.core.database.model.FavoriteWithAirports
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.asSharedFlow
import kotlinx.coroutines.flow.combine
class FavoritesFakeDataSource(private val airportsFakeDataSource: AirportsFakeDataSource) :
FavoritesDataSource {
private val _favoriteEntitiesStream: MutableStateFlow<List<FavoriteEntity>> =
MutableStateFlow(
emptyList(),
)
val favoriteEntitiesStream: Flow<List<FavoriteEntity>> = _favoriteEntitiesStream.asSharedFlow()
private val favorites = mutableListOf<FavoriteEntity>()
override fun getFavoritesStream(): Flow<List<FavoriteEntity>> = favoriteEntitiesStream
override suspend fun insertFavorite(favorite: FavoriteEntity) {
favorites.add(favorite)
_favoriteEntitiesStream.tryEmit(favorites)
}
override suspend fun deleteFavorite(departureCode: String, arriveCode: String) {
val favoritesRemoveList = favorites.filter {
it.departureCode == departureCode && it.destinationCode == arriveCode
}
favorites.removeAll(favoritesRemoveList)
_favoriteEntitiesStream.tryEmit(favorites)
}
override fun getFavoriteWithAirports(): Flow<List<FavoriteWithAirports>> {
return favoriteEntitiesStream.combine(
airportsFakeDataSource.airportEntityStream,
) { favorites, airports ->
if (favorites.isEmpty()) return@combine emptyList()
if (airports.isEmpty()) return@combine emptyList()
favorites.map { favorite ->
val departureAirport = airports.filter { airport ->
favorite.departureCode == airport.iataCode
}
val arriveAirport = airports.filter { airport ->
favorite.destinationCode == airport.iataCode
}
if (departureAirport.isEmpty() ||
arriveAirport.isEmpty()
) {
return@combine emptyList()
}
FavoriteWithAirports(
favoriteEntity = favorite,
departureAirport = departureAirport.first(),
arriveAirport = arriveAirport.first(),
)
}
}
}
}
| 9 | Kotlin | 0 | 0 | d3c431fa42c6b1919e8df914e57793cc40a3656e | 2,591 | Project-Flight-Search-App | Apache License 2.0 |
uni-core/src/main/kotlin/com/github/cf/discord/uni/Lib.kt | CFTheMaster | 180,089,535 | false | null | /*
* Copyright (C) 2017-2021 computerfreaker
*
* 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.cf.discord.uni
import com.github.cf.discord.uni.Lib.LINE_SEPARATOR
import java.util.regex.Pattern
object Lib {
@JvmStatic
val QUOTE_PATTERN: Pattern = Pattern.compile(""""([^"]*)"""")
@JvmStatic
val CODE_BLOCK_PATTERN: Pattern = Pattern.compile("""```\R*kotlin\R((?:.*\R*)*)```""")
@JvmStatic
val LINE_SEPARATOR: String = System.getProperty("line.separator") ?: "\n"
}
object Reactions {
@JvmStatic
val NUMBERS = arrayOf(
"0⃣", // 0
"1⃣", // 1
"2⃣", // 2
"3⃣", // 3
"4⃣", // 4
"5⃣", // 5
"6⃣", // 6
"7⃣", // 7
"8⃣", // 8
"9⃣" // 9
)
@JvmStatic
val EMOJI_TO_INT: Map<String, Int> = mapOf(
"0⃣" to 0, // 0
"1⃣" to 1, // 1
"2⃣" to 2, // 2
"3⃣" to 3, // 3
"4⃣" to 4, // 4
"5⃣" to 5, // 5
"6⃣" to 6, // 6
"7⃣" to 7, // 7
"8⃣" to 8, // 8
"9⃣" to 9 // 9
)
const val REGIONAL_CROSSMARK = "\uD83C\uDDFD"
const val REGIONAL_CHECKMARK = "☑️"
const val CHECKMARK = "✅"
const val CROSSMARK = "❌"
const val LEFT_ARROW = "⬅"
const val RIGHT_ARROW = "➡"
}
fun String.getFromQuotes(): String {
val matcher = Lib.QUOTE_PATTERN.matcher(this)
return if (matcher.find()) {
matcher.group(1)
} else {
this
}
}
fun String.getFromCodeBlock(): String {
val matcher = Lib.CODE_BLOCK_PATTERN.matcher(this)
return if (matcher.find()) {
matcher.group(1)
} else {
this
}
}
fun String.italicize(): String = "*$this*"
fun String.bold(): String = "**$this**"
fun String.markdownUrl(url: String): String = "[$this]($url)"
fun String.strikethrough(): String = "~~$this~~"
fun String.code(): String = "`$this`"
fun String.codeblock(language: String = ""): String = "```$language$LINE_SEPARATOR$this$LINE_SEPARATOR```"
fun String.splitByLines(): List<String> = this.split(Lib.LINE_SEPARATOR)
inline fun <T, R : Comparable<R>> Iterable<T>.maxByList(selector: (T) -> R, greaterThan: () -> R): List<T> {
val iterator = iterator()
if (!iterator.hasNext()) return emptyList()
val list: MutableList<T> = mutableListOf()
var maxElem = iterator.next()
var maxValue = selector(maxElem)
if (maxValue > greaterThan()) list.add(maxElem)
while (iterator.hasNext()) {
val e = iterator.next()
val v = selector(e)
when {
v > maxValue && v > greaterThan() -> {
maxElem = e
maxValue = v
list.clear()
list.add(maxElem)
}
v == maxValue && v > greaterThan() -> {
maxElem = e
list.add(maxElem)
}
}
}
return list
}
fun fastCeil(numerator: Int, denominator: Int): Int {
return if (numerator > 1) 1 + ((numerator - 1) / denominator) else 1
}
| 0 | Kotlin | 0 | 6 | 2991c26ffe416aa48ffd978153c866849c6462a7 | 3,636 | Unibot | Apache License 2.0 |
One-To-Many-Relation/app/src/main/java/com/room/example1/db/entity/Customer.kt | sergio83 | 160,898,601 | false | null | package com.room.example1.db.entity
import androidx.room.*
import java.util.*
@Entity(tableName = "customers")
data class Customer (@PrimaryKey(autoGenerate = true) var id: Long = 0){
var name: String? = null
@Embedded(prefix = "address_")
var address: Address? = null
var createDate: Date = Date()
@Ignore
var orders: List<Order>? = null
}
| 0 | Kotlin | 0 | 0 | fe1827beb840f85e02ca0946e9cec2ceefa85795 | 373 | RoomSamples | Apache License 2.0 |
src/commonMain/kotlin/baaahs/controller/SacnTransportConfig.kt | baaahs | 174,897,412 | false | null | package baaahs.controller
import baaahs.fixtures.TransportConfig
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
@SerialName("SACN")
data class SacnTransportConfig(
val startChannel: Int,
val endChannel: Int,
val componentsStartAtUniverseBoundaries: Boolean = true
) : TransportConfig | 83 | Kotlin | 5 | 21 | 465dd4781c90dd99d12e18ec3f651bb42a05347a | 346 | sparklemotion | MIT License |
src/main/kotlin/com/github/gradle/node/task/NodeSetupTask.kt | node-gradle | 160,181,282 | false | {"Groovy": 190187, "Kotlin": 117827, "JavaScript": 1272, "Nix": 1072} | package com.github.gradle.node.task
import com.github.gradle.node.NodeExtension
import com.github.gradle.node.NodePlugin
import com.github.gradle.node.util.DefaultProjectApiHelper
import com.github.gradle.node.variant.computeNodeExec
import com.github.gradle.node.variant.computeNpmScriptFile
import org.gradle.api.file.Directory
import org.gradle.api.file.DirectoryProperty
import org.gradle.api.model.ObjectFactory
import org.gradle.api.provider.Provider
import org.gradle.api.provider.ProviderFactory
import org.gradle.api.tasks.*
import java.io.File
import java.nio.file.Files
import java.nio.file.Path
import java.nio.file.Paths
import javax.inject.Inject
abstract class NodeSetupTask : BaseTask() {
@get:Inject
abstract val objects: ObjectFactory
@get:Inject
abstract val providers: ProviderFactory
private val nodeExtension = NodeExtension[project]
@get:Input
val download = nodeExtension.download
@get:InputFile
val nodeArchiveFile = objects.fileProperty()
@get:OutputDirectory
abstract val nodeDir: DirectoryProperty
@get:Internal
val projectHelper = project.objects.newInstance(DefaultProjectApiHelper::class.java)
init {
group = NodePlugin.NODE_GROUP
description = "Download and install a local node/npm version."
onlyIf {
nodeExtension.download.get()
}
}
@TaskAction
fun exec() {
deleteExistingNode()
unpackNodeArchive()
setExecutableFlag()
}
private fun deleteExistingNode() {
projectHelper.delete {
delete(nodeDir.get().dir("../"))
}
}
private fun unpackNodeArchive() {
val archiveFile = nodeArchiveFile.get().asFile
val nodeDirProvider = nodeExtension.resolvedNodeDir
val nodeBinDirProvider = variantComputer.computeNodeBinDir(nodeDirProvider, nodeExtension.resolvedPlatform)
val archivePath = nodeDirProvider.map { it.dir("../") }
if (archiveFile.name.endsWith("zip")) {
projectHelper.copy {
from(projectHelper.zipTree(archiveFile))
into(archivePath)
}
} else {
projectHelper.copy {
from(projectHelper.tarTree(archiveFile))
into(archivePath)
}
// Fix broken symlink
val nodeBinDirPath = nodeBinDirProvider.get().asFile.toPath()
fixBrokenSymlink("npm", nodeBinDirPath, nodeDirProvider)
fixBrokenSymlink("npx", nodeBinDirPath, nodeDirProvider)
}
}
private fun fixBrokenSymlink(name: String, nodeBinDirPath: Path, nodeDirProvider: Provider<Directory>) {
val script = nodeBinDirPath.resolve(name)
val scriptFile = computeNpmScriptFile(nodeDirProvider, name, nodeExtension.resolvedPlatform.get().isWindows())
if (Files.deleteIfExists(script)) {
Files.createSymbolicLink(script, nodeBinDirPath.relativize(Paths.get(scriptFile.get())))
}
}
private fun setExecutableFlag() {
if (!nodeExtension.resolvedPlatform.get().isWindows()) {
val nodeBinDirProvider = variantComputer.computeNodeBinDir(
nodeExtension.resolvedNodeDir,
nodeExtension.resolvedPlatform
)
val nodeExecProvider = computeNodeExec(nodeExtension, nodeBinDirProvider)
File(nodeExecProvider.get()).setExecutable(true)
}
}
companion object {
const val NAME = "nodeSetup"
}
}
| 73 | Groovy | 144 | 564 | c07b5ea719b757eabb4e3076741a2d069cc50a2d | 3,531 | gradle-node-plugin | Apache License 2.0 |
src/main/kotlin/net/dilius/untitled/domain/users/oauth2/ReactiveOAuth2UserServiceImpl.kt | diliuskh | 233,789,947 | false | {"Kotlin": 18022, "Smarty": 1792, "Dockerfile": 170} | package net.dilius.untitled.domain.users.oauth2
import net.dilius.untitled.domain.users.UserDetailsImpl
import org.springframework.security.oauth2.client.userinfo.OAuth2UserRequest
import org.springframework.security.oauth2.client.userinfo.ReactiveOAuth2UserService
import reactor.core.publisher.Mono
class ReactiveOAuth2UserServiceImpl : ReactiveOAuth2UserService<OAuth2UserRequest, UserDetailsImpl> {
override fun loadUser(userRequest: OAuth2UserRequest): Mono<UserDetailsImpl> {
TODO("Not yet implemented")
}
}
| 0 | Kotlin | 0 | 0 | 4594cac075383a622f95a3db468bf9c91c695aa2 | 532 | untitledProject | Apache License 2.0 |
src/test/kotlin/com/kevin/BackendInterview/BackendInterview/BackendInterviewApplicationTests.kt | kevinmainairungu | 366,629,641 | false | null | package com.kevin.BackendInterview.BackendInterview
import org.junit.jupiter.api.Test
import org.springframework.boot.test.context.SpringBootTest
@SpringBootTest
class BackendInterviewApplicationTests {
@Test
fun contextLoads() {
}
}
| 0 | Kotlin | 0 | 0 | 87403abb36fc46b200491824fd2c39ce83d983cc | 241 | BackendInterview | MIT License |
buildSrc/src/main/java/TerminalCommand.kt | hbb20 | 209,688,939 | false | {"Kotlin": 275638, "Java": 733} | import java.io.File
import java.util.concurrent.TimeUnit
fun getCurrentGitBranchName(): String {
return "git rev-parse --abbrev-ref HEAD".runCommand().readText()
}
fun isBitrise(): Boolean {
return (System.getenv("BITRISE_IO") ?: "false").toBoolean()
}
fun String.runCommand(printOutput: Boolean = true): File {
val outputFile = createTempFile(suffix = ".txt")
val parts = this.split("\\s".toRegex())
val proc = ProcessBuilder(*parts.toTypedArray())
.redirectOutput(ProcessBuilder.Redirect.PIPE)
.redirectError(ProcessBuilder.Redirect.PIPE)
.redirectErrorStream(true)
.start()
proc.waitFor(60, TimeUnit.SECONDS)
proc.inputStream.copyTo(outputFile.outputStream())
if (printOutput) {
println("\n\nExecuted Command `$this` => ")
outputFile.readLines().forEach { println(it) }
}
return outputFile
} | 8 | Kotlin | 26 | 94 | afd480af71677a0a38ba3d15f8d5e3fa45fc3f20 | 887 | AndroidCountryPicker | MIT License |
dsl/src/main/kotlin/io/cloudshiftdev/awscdkdsl/services/guardduty/CfnDetectorCFNDataSourceConfigurationsPropertyDsl.kt | cloudshiftinc | 667,063,030 | false | {"Kotlin": 70198112} | @file:Suppress(
"RedundantVisibilityModifier",
"RedundantUnitReturnType",
"RemoveRedundantQualifierName",
"unused",
"UnusedImport",
"ClassName",
"REDUNDANT_PROJECTION",
"DEPRECATION"
)
package cloudshift.awscdk.dsl.services.guardduty
import cloudshift.awscdk.common.CdkDslMarker
import software.amazon.awscdk.IResolvable
import software.amazon.awscdk.services.guardduty.CfnDetector
/**
* Describes whether S3 data event logs, Kubernetes audit logs, or Malware Protection will be
* enabled as a data source when the detector is created.
*
* 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.guardduty.*;
* CFNDataSourceConfigurationsProperty cFNDataSourceConfigurationsProperty =
* CFNDataSourceConfigurationsProperty.builder()
* .kubernetes(CFNKubernetesConfigurationProperty.builder()
* .auditLogs(CFNKubernetesAuditLogsConfigurationProperty.builder()
* .enable(false)
* .build())
* .build())
* .malwareProtection(CFNMalwareProtectionConfigurationProperty.builder()
* .scanEc2InstanceWithFindings(CFNScanEc2InstanceWithFindingsConfigurationProperty.builder()
* .ebsVolumes(false)
* .build())
* .build())
* .s3Logs(CFNS3LogsConfigurationProperty.builder()
* .enable(false)
* .build())
* .build();
* ```
*
* [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-guardduty-detector-cfndatasourceconfigurations.html)
*/
@CdkDslMarker
public class CfnDetectorCFNDataSourceConfigurationsPropertyDsl {
private val cdkBuilder: CfnDetector.CFNDataSourceConfigurationsProperty.Builder =
CfnDetector.CFNDataSourceConfigurationsProperty.builder()
/** @param kubernetes Describes which Kubernetes data sources are enabled for a detector. */
public fun kubernetes(kubernetes: IResolvable) {
cdkBuilder.kubernetes(kubernetes)
}
/** @param kubernetes Describes which Kubernetes data sources are enabled for a detector. */
public fun kubernetes(kubernetes: CfnDetector.CFNKubernetesConfigurationProperty) {
cdkBuilder.kubernetes(kubernetes)
}
/**
* @param malwareProtection Describes whether Malware Protection will be enabled as a data
* source.
*/
public fun malwareProtection(malwareProtection: IResolvable) {
cdkBuilder.malwareProtection(malwareProtection)
}
/**
* @param malwareProtection Describes whether Malware Protection will be enabled as a data
* source.
*/
public fun malwareProtection(
malwareProtection: CfnDetector.CFNMalwareProtectionConfigurationProperty
) {
cdkBuilder.malwareProtection(malwareProtection)
}
/** @param s3Logs Describes whether S3 data event logs are enabled as a data source. */
public fun s3Logs(s3Logs: IResolvable) {
cdkBuilder.s3Logs(s3Logs)
}
/** @param s3Logs Describes whether S3 data event logs are enabled as a data source. */
public fun s3Logs(s3Logs: CfnDetector.CFNS3LogsConfigurationProperty) {
cdkBuilder.s3Logs(s3Logs)
}
public fun build(): CfnDetector.CFNDataSourceConfigurationsProperty = cdkBuilder.build()
}
| 4 | Kotlin | 0 | 3 | 256ad92aebe2bcf9a4160089a02c76809dbbedba | 3,266 | awscdk-dsl-kotlin | Apache License 2.0 |
covid19/src/main/java/com/pshetye/covid19/ui/countries/fragments/SortOptionFragment.kt | techeretic | 249,215,978 | false | null | package com.pshetye.covid19.ui.countries.fragments
import android.content.Context
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.activityViewModels
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import com.google.android.material.button.MaterialButton
import com.pshetye.covid19.R
import com.pshetye.covid19.ui.countries.viewmodels.*
class SortOptionFragment : BottomSheetDialogFragment() {
private val sharedViewModel: SharedViewModel by activityViewModels()
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_sort_option_list_dialog, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
val sortOptions = getSortOptions(view.context)
val list = view.findViewById<RecyclerView>(R.id.list)
list.layoutManager = LinearLayoutManager(context)
list.adapter = SortOptionsAdapter(sortOptions)
list.adapter
}
private inner class ViewHolder constructor(
inflater: LayoutInflater,
parent: ViewGroup
) : RecyclerView.ViewHolder(
inflater.inflate(
R.layout.fragment_sort_option_list_dialog_item,
parent,
false
)
) {
val sortOption: MaterialButton = itemView as MaterialButton
}
private fun getSortOptions(context: Context): List<SortOption> =
with(context) {
listOf(
SortOption(getString(R.string.sort_by_cases), SORT_OPTION_CASES),
SortOption(getString(R.string.sort_by_recovered), SORT_OPTION_RECOVERIES),
SortOption(getString(R.string.sort_by_critical), SORT_OPTION_CRITICAL),
SortOption(getString(R.string.sort_by_deaths), SORT_OPTION_DEATHS),
SortOption(getString(R.string.sort_by_alphabets), SORT_OPTION_ALPHABETICAL)
)
}
private inner class SortOptionsAdapter internal constructor(val sortOptions: List<SortOption>) :
RecyclerView.Adapter<ViewHolder>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
return ViewHolder(LayoutInflater.from(parent.context), parent)
}
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
holder.sortOption.text = sortOptions[position].sortOptionText
holder.sortOption.setOnClickListener {
sharedViewModel.sortOptionLiveData.postValue(sortOptions[position].actualSortOption)
dismiss()
}
}
override fun getItemCount(): Int {
return sortOptions.size
}
}
private data class SortOption(
val sortOptionText: String,
@SortedBy val actualSortOption: String
)
} | 5 | Kotlin | 0 | 1 | b41539a896e2562890081117a03950ccf53b1e8b | 3,094 | ApiModeler | MIT License |
src/main/kotlin/io/github/hotlava03/baclavalite/functions/globalFunctions.kt | tierrif | 471,522,248 | false | {"Kotlin": 41643} | @file:JvmName("GlobalFunctions")
package io.github.hotlava03.baclavalite.functions
import io.github.hotlava03.baclavalite.BaclavaLite
import org.slf4j.Logger
import org.slf4j.LoggerFactory
fun getLogger(): Logger {
return LoggerFactory.getLogger(BaclavaLite::class.java)
}
fun currentClassLoader() : ClassLoader {
return Thread.currentThread().contextClassLoader
}
| 0 | Kotlin | 0 | 0 | c6e2026e9e22bb2a102fbafb5251cad314935af4 | 376 | baclava-lite | Apache License 2.0 |
app/src/main/java/com/o/covid19volunteerapp/adapter/VolunteerRecyclerViewAdapter.kt | vansha10 | 250,349,397 | false | {"Kotlin": 61439} | package com.o.covid19volunteerapp.adapter
import android.view.LayoutInflater
import android.view.ViewGroup
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.o.covid19volunteerapp.R
import com.o.covid19volunteerapp.model.Request
import com.o.covid19volunteerapp.model.UserRequest
class VolunteerRecyclerViewAdapter(private var list: MutableList<Request>, val clickListener: (Request) -> Unit)
: RecyclerView.Adapter<VolunteerViewHolder>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VolunteerViewHolder {
val inflater = LayoutInflater.from(parent.context)
return VolunteerViewHolder(inflater, parent)
}
override fun onBindViewHolder(holder: VolunteerViewHolder, position: Int) {
val request : Request = list[position]
holder.bind(request)
holder.itemView.setOnClickListener {
clickListener(list[position])
}
}
override fun getItemCount(): Int = list.size
fun updateList(newList : MutableList<Request>) {
list.clear()
list.addAll(newList)
this.notifyDataSetChanged()
}
}
class VolunteerViewHolder(inflater: LayoutInflater, parent: ViewGroup) :
RecyclerView.ViewHolder(inflater.inflate(R.layout.volunteer_list_item, parent, false)) {
private var nameCodeTextView : TextView? = null
private var requestTextView : TextView? = null
init {
nameCodeTextView = itemView.findViewById(R.id.request_name)
requestTextView = itemView.findViewById(R.id.request_text)
}
fun bind(request: Request) {
nameCodeTextView?.text = request.name
requestTextView?.text = request.requestText
}
} | 2 | Kotlin | 0 | 0 | 249ccf647bbbd4cce26d9dd1668c8a104bfc7a9b | 1,721 | CoVolunteer | MIT License |
embrace-android-core/src/test/java/io/embrace/android/embracesdk/internal/config/behavior/SdkEndpointBehaviorImplTest.kt | embrace-io | 704,537,857 | false | {"Kotlin": 2803731, "C": 189341, "Java": 174782, "C++": 13140, "CMake": 4261} | package io.embrace.android.embracesdk.internal.config.behavior
import io.embrace.android.embracesdk.fakes.createSdkEndpointBehavior
import io.embrace.android.embracesdk.internal.config.local.BaseUrlLocalConfig
import org.junit.Assert.assertEquals
import org.junit.Test
internal class SdkEndpointBehaviorImplTest {
private val local = BaseUrlLocalConfig(
"https://config.example.com",
"https://data.example.com",
"https://images.example.com"
)
@Test
fun testDefaults() {
with(createSdkEndpointBehavior()) {
assertEquals("https://a-12345.config.emb-api.com", getConfig("12345"))
assertEquals("https://a-12345.data.emb-api.com", getData("12345"))
}
}
@Test
fun testLocalOnly() {
with(createSdkEndpointBehavior(localCfg = { local })) {
assertEquals("https://config.example.com", getConfig("12345"))
assertEquals("https://data.example.com", getData("12345"))
}
}
}
| 22 | Kotlin | 8 | 132 | eb604dd8df8cb4762a5f282695f069dd00270d86 | 1,001 | embrace-android-sdk | Apache License 2.0 |
app/src/main/java/org/softeg/slartus/forpdaplus/fragments/UserInfoMenuFragment.kt | slartus | 21,554,455 | false | null | package org.softeg.slartus.forpdaplus.fragments
import android.content.Intent
import android.net.Uri
import android.os.Bundle
import android.view.Menu
import android.view.MenuInflater
import android.view.MenuItem
import androidx.fragment.app.Fragment
import androidx.fragment.app.viewModels
import androidx.lifecycle.*
import dagger.hilt.android.AndroidEntryPoint
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.CoroutineExceptionHandler
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.launch
import org.softeg.slartus.forpdaplus.*
import org.softeg.slartus.forpdaplus.R
import org.softeg.slartus.forpdaplus.common.AppLog
import org.softeg.slartus.forpdaplus.core.entities.UserInfo
import org.softeg.slartus.forpdaplus.core.repositories.UserInfoRepository
import org.softeg.slartus.forpdaplus.fragments.profile.ProfileFragment
import org.softeg.slartus.forpdaplus.listfragments.mentions.MentionsListFragment.Companion.newFragment
import org.softeg.slartus.forpdaplus.listfragments.next.UserReputationFragment.Companion.showActivity
import org.softeg.slartus.forpdaplus.listtemplates.QmsContactsBrickInfo
import javax.inject.Inject
@AndroidEntryPoint
class UserInfoMenuFragment : Fragment() {
private val viewModel: UserInfoMenuViewModel by viewModels()
private var userInfo: UserInfo? = null
private var guestMenuItem: MenuItem? = null
private var userMenuItem: MenuItem? = null
private var qmsMenuItem: MenuItem? = null
private var mentionsMenuItem: MenuItem? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setHasOptionsMenu(true)
lifecycleScope.launch {
repeatOnLifecycle(Lifecycle.State.STARTED) {
launch {
viewModel.uiState.collect { uiState ->
when (uiState) {
UserInfoMenuViewModel.ViewState.Initialize -> {
}
is UserInfoMenuViewModel.ViewState.Success -> {
userInfo = uiState.userInfo
refreshUserMenu()
}
is UserInfoMenuViewModel.ViewState.Error -> {
AppLog.e(activity, uiState.exception)
}
}
}
}
}
}
}
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
super.onCreateOptionsMenu(menu, inflater)
inflater.inflate(R.menu.user, menu)
guestMenuItem = menu.findItem(R.id.guest_item)
userMenuItem = menu.findItem(R.id.user_item)
qmsMenuItem = menu.findItem(R.id.qms_item)
mentionsMenuItem = menu.findItem(R.id.mentions_item)
}
override fun onPrepareOptionsMenu(menu: Menu) {
super.onPrepareOptionsMenu(menu)
refreshUserMenu()
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
R.id.qms_item -> {
val brickInfo = QmsContactsBrickInfo()
MainActivity.addTab(brickInfo.title, brickInfo.name, brickInfo.createFragment())
return true
}
R.id.mentions_item -> {
MainActivity.addTab(
"Упоминания", "https://" + App.Host + "/forum/index.php?act=mentions",
newFragment()
)
return true
}
R.id.profile_item -> {
userInfo?.let {
ProfileFragment.showProfile(it.id, Client.getInstance().user)
}
return true
}
R.id.reputation_item -> {
userInfo?.let {
showActivity(it.id, false)
}
return true
}
R.id.logout_item -> {
LoginDialog.logout(requireActivity())
return true
}
R.id.login_item -> {
LoginDialog.showDialog(requireActivity())
return true
}
R.id.registration_item -> {
val marketIntent = Intent(
Intent.ACTION_VIEW,
Uri.parse("https://" + App.Host + "/forum/index.php?act=Reg&CODE=00")
)
startActivity(marketIntent)
return true
}
else -> return super.onOptionsItemSelected(item)
}
}
private fun refreshUserMenu() {
userInfo.let { userInfo ->
val logged = userInfo?.logined == true
guestMenuItem?.isVisible = !logged
userMenuItem?.isVisible = logged
if (userInfo?.logined == true) {
val qmsCount = userInfo.qmsCount ?: 0
userMenuItem?.title = userInfo.name
userMenuItem?.setIcon(getUserIconRes(userInfo))
val qmsTitle =
if (qmsCount > 0) "QMS ($qmsCount)" else "QMS"
qmsMenuItem?.title = qmsTitle
val mentionsCount = userInfo.mentionsCount ?: 0
mentionsMenuItem?.title =
"Упоминания " + if (mentionsCount > 0) "($mentionsCount)" else ""
}
}
}
private fun getUserIconRes(userInfo: UserInfo): Int {
val logged = Client.getInstance().logined
return if (logged) {
if (userInfo.qmsCount ?: 0 > 0 || userInfo.mentionsCount ?: 0 > 0)
R.drawable.message_text
else
R.drawable.account
} else {
R.drawable.account_outline
}
}
override fun onDestroy() {
guestMenuItem = null
userMenuItem = null
qmsMenuItem = null
mentionsMenuItem = null
super.onDestroy()
}
companion object {
const val TAG = "UserInfoMenuFragment"
}
}
@HiltViewModel
class UserInfoMenuViewModel @Inject constructor(
private val userInfoRepository: UserInfoRepository
) : ViewModel() {
private val _uiState = MutableStateFlow<ViewState>(ViewState.Initialize)
val uiState: StateFlow<ViewState> = _uiState
private val errorHandler = CoroutineExceptionHandler { _, ex ->
_uiState.value = ViewState.Error(ex)
}
init {
viewModelScope.launch(Dispatchers.IO + errorHandler) {
launch {
userInfoRepository.userInfo
.distinctUntilChanged()
.collect {
_uiState.value = ViewState.Success(it)
}
}
}
}
sealed class ViewState {
object Initialize : ViewState()
data class Success(val userInfo: UserInfo) : ViewState()
data class Error(val exception: Throwable) : ViewState()
}
}
| 6 | null | 17 | 86 | 03dfdb68c1ade272cf84ff1c89dc182f7fe69c39 | 7,162 | 4pdaClient-plus | Apache License 2.0 |
RSS/app/src/main/java/br/ufpe/cin/if710/rss/SettingsActivity.kt | viniciusmlira | 151,014,324 | true | {"Kotlin": 28176, "Java": 2232} | package br.ufpe.cin.if710.rss
import android.os.Bundle
import android.preference.*
import android.support.v7.app.AppCompatActivity
class SettingsActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
if (fragmentManager.findFragmentById(android.R.id.content) == null) {
fragmentManager.beginTransaction()
.add(android.R.id.content, SettingsFragment()).commit()
}
}
class SettingsFragment : PreferenceFragment() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
addPreferencesFromResource(R.xml.preferencias)
bindPreferenceSummaryToValue(findPreference("rssfeed"))
}
}
companion object {
/**
* A preference value change listener that updates the preference's summary
* to reflect its new value.
*/
private val sBindPreferenceSummaryToValueListener = Preference.OnPreferenceChangeListener { preference, value ->
val stringValue = value.toString()
preference.summary = stringValue
true
}
private fun bindPreferenceSummaryToValue(preference: Preference) {
// Set the listener to watch for value changes.
preference.onPreferenceChangeListener = sBindPreferenceSummaryToValueListener
// Trigger the listener immediately with the preference's
// current value.
sBindPreferenceSummaryToValueListener.onPreferenceChange(preference,
PreferenceManager
.getDefaultSharedPreferences(preference.context)
.getString(preference.key, ""))
}
}
} | 0 | Kotlin | 0 | 0 | 6363fb8646af3a99173d90c03bda8f126f0e09a2 | 1,818 | exercicio-rss-2 | MIT License |
app/src/main/java/com/simply/schedule/network/ScheduleApiService.kt | dadlex | 217,711,648 | false | {"Gradle": 3, "Java Properties": 2, "Text": 1, "Markdown": 1, "Proguard": 1, "Kotlin": 48, "XML": 88, "Java": 10} | package com.simply.schedule.network
import android.content.Context
import com.squareup.moshi.Moshi
import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
import okhttp3.Credentials
import okhttp3.OkHttpClient
import org.joda.time.LocalDate
import retrofit2.Call
import retrofit2.Retrofit
import retrofit2.converter.moshi.MoshiConverterFactory
import retrofit2.http.*
private const val BASE_URL = "http://172.16.17.32"
private val client = OkHttpClient().newBuilder().addInterceptor { chain ->
val request = chain.request().newBuilder()
.header("Authorization", ScheduleApi.credentials)
.build()
chain.proceed(request)
}.build()
private val moshi = Moshi.Builder()
.add(KotlinJsonAdapterFactory())
.build()
private val retrofit = Retrofit.Builder()
.baseUrl(BASE_URL)
.addConverterFactory(MoshiConverterFactory.create(moshi))
.client(client)
.build()
interface ScheduleApiService {
@GET("subjects/")
fun getSubjects(): Call<List<Subject>>
@POST("subjects/")
fun createSubject(@Body subject: Subject): Call<Subject>
@GET("class-types/")
fun getClassTypes(): Call<List<ClassType>>
@POST("class-types/")
fun createClassType(@Body classType: ClassType): Call<ClassType>
@GET("teachers/")
fun getTeachers(): Call<List<Teacher>>
@GET("teachers/{id}/")
fun getTeacher(@Path("id") id: Long): Call<Teacher>
@POST("teachers/")
fun createTeacher(@Body teacher: Teacher): Call<Teacher>
@PUT("teachers/{id}/")
fun updateTeacher(@Path("id") id: Long, @Body teacher: Teacher): Call<Teacher>
@DELETE("teachers/{id}/")
fun deleteTeacher(@Path("id") id: Long): Call<Teacher>
@GET("classes/{date}/")
fun getClasses(@Path("date") date: LocalDate): Call<ScheduleClass>
@POST("classes/")
fun createClass(@Body class_: Class): Call<Class>
@PUT("classes/{id}/")
fun updateClass(@Path("id") id: Long, @Body class_: Class): Call<Class>
@DELETE("classes/{id}/")
fun deleteClass(@Path("id") id: Long): Call<Class>
@POST("times/")
fun createTime(@Body time: Time): Call<Time>
@GET("schedule/{date}/")
fun getSchedule(@Path("date") date: LocalDate): Call<List<ScheduleClass>>
@GET("tasks/")
fun getTasks(): Call<List<Task>>
@GET("tasks/{id}/")
fun getTask(@Path("id") id: Long): Call<Task>
@POST("tasks/")
fun createTask(@Body task: Task): Call<Task>
@PUT("tasks/{id}/")
fun updateTask(@Path("id") id: Long, @Body task: Task): Call<Task>
@DELETE("tasks/{id}/")
fun deleteTask(@Path("id") id: Long): Call<Task>
@POST("users/")
fun createUser(@Body user: User): Call<User>
}
object ScheduleApi {
val retrofitService: ScheduleApiService by lazy { retrofit.create(ScheduleApiService::class.java) }
var credentials: String = ""
}
| 0 | Kotlin | 0 | 0 | 3b387ba13ad48ec533786ca32de6132f2500c3f2 | 2,856 | uniScheduleApp | MIT License |
src/test/kotlin/com/sfl/kotlin/services/user/impl/UserServiceImplUnitTest.kt | dilanyanruben | 122,188,778 | false | null | package com.sfl.kotlin.services.user.impl
import com.sfl.kotlin.domain.user.dto.CreateUserDto
import com.sfl.kotlin.domain.user.dto.UserDto
import com.sfl.kotlin.domain.user.model.User
import com.sfl.kotlin.persistence.repositories.user.UserRepository
import com.sfl.kotlin.services.common.AbstractUnitTest
import com.sfl.kotlin.services.common.Randomizer
import com.sfl.kotlin.services.user.UserService
import com.sfl.kotlin.services.user.exception.UserNotFoundForIdException
import org.assertj.core.api.Assertions.assertThat
import org.assertj.core.api.Assertions.catchThrowable
import org.assertj.core.api.Condition
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.DisplayName
import org.junit.jupiter.api.Test
import org.mockito.Mock
import org.mockito.Mockito.*
import java.util.*
/**
* User: <NAME>
* Company: SFL LLC
* Date: 2/21/18
* Time: 11:46 AM
*/
class UserServiceImplUnitTest : AbstractUnitTest() {
//region Test subject and mocks
private lateinit var userService: UserService
@Mock
private lateinit var userRepository: UserRepository
//endregion
//region Lifecycle methods
@BeforeEach
fun before() {
userService = UserServiceImpl(userRepository)
}
//endregion
//region Test methods
//region Create method
@Test
@DisplayName("Test creation of the user for the provided DTO")
fun testCreate() {
// Test data
val createUserDto = getCreateUserDto()
// Reset
resetAll()
// Expectations
`when`(userRepository.save(isA(User::class.java))).thenAnswer { it.getArgument(0) }
// Run test scenario
val result = userService.create(createUserDto).apply {
assertThat(this.firstName).isEqualTo(createUserDto.userDto.firstName)
assertThat(this.lastName).isEqualTo(createUserDto.userDto.lastName)
}
// Verify
verify(userRepository).save(result)
}
//endregion
//region Get by id method
@Test
@DisplayName("Test retrieval of the user for the provided id when it does not exist")
fun testGetByIdWithNotExistingId() {
// Test data
val id = Randomizer.generateRandomLong()
// Reset
resetAll()
// Expectations
`when`(userRepository.findById(eq(id))).thenReturn(Optional.empty())
// Run test scenario
assertThat(catchThrowable { userService.getById(id) }).isInstanceOf(UserNotFoundForIdException::class.java).`is`(object : Condition<Throwable>() {
override fun matches(value: Throwable?): Boolean {
assertUserNotFoundForIdException(value as UserNotFoundForIdException, id)
return true
}
})
// Verify
verify(userRepository).findById(id)
}
@Test
@DisplayName("Test retrieval of the user for the provided id")
fun testGetById() {
// Test data
val id = Randomizer.generateRandomLong()
val user = getUser().apply { this.id = id }
// Reset
resetAll()
// Expectations
`when`(userRepository.findById(eq(id))).thenReturn(Optional.of(user))
// Run test scenario
userService.getById(id).apply { assertThat(this).isEqualTo(user) }
// Verify
verify(userRepository).findById(id)
}
//endregion
//region Get all method
@Test
@DisplayName("Test retrieval of all users")
fun testGetAll() {
// Test data
val users = listOf(getUser(), getUser(), getUser())
// Reset
resetAll()
// Expectations
`when`(userRepository.findAll()).thenReturn(users)
// Run test scenario
userService.getAll().apply { assertThat(this).isEqualTo(users) }
// Verify
verify(userRepository).findAll()
}
//endregion
//endregion
//region Private utility methods
private fun resetAll() {
reset(userRepository)
}
private fun getUser() = User(Randomizer.generateRandomString(), Randomizer.generateRandomString())
private fun assertUserNotFoundForIdException(exception: UserNotFoundForIdException, id: Long) {
assertThat(exception.id).isEqualTo(id)
}
private fun getCreateUserDto() = CreateUserDto(UserDto(Randomizer.generateRandomString(), Randomizer.generateRandomString()))
//endregion
} | 1 | Kotlin | 1 | 3 | c006abb1ebc3c1c859c1c376a79bf853c776614c | 4,383 | template-kotlin-springboot | Apache License 2.0 |
app/src/main/java/com/example/beetlestance/benji/di/modules/ActivityBindingModule.kt | akshay253101 | 173,268,629 | false | {"Gradle": 4, "Java Properties": 2, "Shell": 1, "Text": 1, "Ignore List": 2, "Batchfile": 1, "Proguard": 1, "Kotlin": 41, "XML": 45, "Java": 2} | package com.example.beetlestance.benji.di.modules
import com.example.beetlestance.benji.MainActivity
import com.example.beetlestance.benji.di.AppComponent
import com.example.beetlestance.benji.di.scope.ActivityScoped
import com.example.beetlestance.benji.ui.about.AboutFragmentModule
import com.example.beetlestance.benji.ui.bottomNavigationDrawer.BottomNavigationFragmentModule
import com.example.beetlestance.benji.ui.bottomNavigationDrawer.BottomSettingFragmentModule
import com.example.beetlestance.benji.ui.login.LoginActivity
import com.example.beetlestance.benji.ui.todo.TodoFragmentModule
import dagger.Module
import dagger.android.AndroidInjector
import dagger.android.ContributesAndroidInjector
/**
* We want Dagger.Android to create a SubComponent which has a parent Component of whichever module
* ActivityBindingModule is on, in our case that will be [AppComponent]. You never
* need to tell [AppComponent] that it is going to have all these SubComponents
* nor do you need to tell these SubComponents that [AppComponent] exists.
* We are also telling Dagger.Android that this generated SubComponent needs to include the
* specified modules and be aware of a scope annotation [ActivityScoped].
* When Dagger.Android annotation processor runs it will create 2 SubComponents for us.
*/
@Module
abstract class ActivityBindingModule {
/**
* Generates an [AndroidInjector] for the [MainActivity].
* With [ActivityScoped]
*/
@ActivityScoped
@ContributesAndroidInjector(
modules = [TodoFragmentModule::class, BottomSettingFragmentModule::class, BottomNavigationFragmentModule::class,
AboutFragmentModule::class]
)
abstract fun bindMainActivity(): MainActivity
/**
* Generates an [AndroidInjector] for the [LoginActivity].
* With [ActivityScoped]
*/
@ActivityScoped
@ContributesAndroidInjector
abstract fun bindLoginActivity(): LoginActivity
} | 1 | null | 1 | 1 | 06b37e63399c0d50039f851c80a84b3ffa8d174b | 1,947 | Benji | Apache License 2.0 |
line-awesome/src/commonMain/kotlin/compose/icons/lineawesomeicons/QuestionSolid.kt | DevSrSouza | 311,134,756 | false | {"Kotlin": 36756847} | package compose.icons.lineawesomeicons
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.PathFillType.NonZero
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.graphics.StrokeCap.Butt
import androidx.compose.ui.graphics.StrokeJoin.Miter
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp
import compose.icons.LineAwesomeIcons
public val LineAwesomeIcons.QuestionSolid: ImageVector
get() {
if (_questionSolid != null) {
return _questionSolid!!
}
_questionSolid = Builder(name = "QuestionSolid", defaultWidth = 32.0.dp, defaultHeight =
32.0.dp, viewportWidth = 32.0f, viewportHeight = 32.0f).apply {
path(fill = SolidColor(Color(0xFF000000)), stroke = null, strokeLineWidth = 0.0f,
strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = 4.0f,
pathFillType = NonZero) {
moveTo(16.0f, 4.0f)
curveTo(11.6719f, 4.0f, 8.0f, 7.0547f, 8.0f, 11.0f)
lineTo(8.0f, 14.0f)
lineTo(14.0f, 14.0f)
lineTo(14.0f, 11.0f)
curveTo(14.0f, 10.8516f, 14.0898f, 10.6367f, 14.4375f, 10.4063f)
curveTo(14.7852f, 10.1758f, 15.3516f, 10.0f, 16.0f, 10.0f)
curveTo(16.6523f, 10.0f, 17.2188f, 10.1758f, 17.5625f, 10.4063f)
curveTo(17.9063f, 10.6367f, 18.0f, 10.8359f, 18.0f, 11.0f)
curveTo(18.0f, 11.5781f, 17.8125f, 11.9805f, 17.4375f, 12.4375f)
curveTo(17.0625f, 12.8945f, 16.4805f, 13.3672f, 15.8438f, 13.9063f)
curveTo(14.5664f, 14.9883f, 13.0f, 16.4961f, 13.0f, 19.0f)
lineTo(13.0f, 20.0f)
lineTo(19.0f, 20.0f)
lineTo(19.0f, 19.0f)
curveTo(19.0f, 18.6602f, 19.125f, 18.4219f, 19.5f, 18.0313f)
curveTo(19.875f, 17.6406f, 20.4961f, 17.1797f, 21.1563f, 16.625f)
curveTo(22.4766f, 15.5156f, 24.0f, 13.8164f, 24.0f, 11.0f)
curveTo(24.0f, 7.0898f, 20.3359f, 4.0f, 16.0f, 4.0f)
close()
moveTo(16.0f, 6.0f)
curveTo(19.3945f, 6.0f, 22.0f, 8.3672f, 22.0f, 11.0f)
curveTo(22.0f, 13.1445f, 21.0234f, 14.1016f, 19.8438f, 15.0938f)
curveTo(19.2539f, 15.5898f, 18.625f, 16.0742f, 18.0625f, 16.6563f)
curveTo(17.7148f, 17.0156f, 17.4453f, 17.4844f, 17.25f, 18.0f)
lineTo(15.3125f, 18.0f)
curveTo(15.625f, 16.9883f, 16.2344f, 16.2188f, 17.1563f, 15.4375f)
curveTo(17.7695f, 14.9219f, 18.4375f, 14.3828f, 19.0f, 13.6875f)
curveTo(19.5625f, 12.9922f, 20.0f, 12.082f, 20.0f, 11.0f)
curveTo(20.0f, 10.0391f, 19.4297f, 9.2422f, 18.6875f, 8.75f)
curveTo(17.9453f, 8.2578f, 17.0039f, 8.0f, 16.0f, 8.0f)
curveTo(14.9922f, 8.0f, 14.0508f, 8.2578f, 13.3125f, 8.75f)
curveTo(12.5742f, 9.2422f, 12.0f, 10.043f, 12.0f, 11.0f)
lineTo(12.0f, 12.0f)
lineTo(10.0f, 12.0f)
lineTo(10.0f, 11.0f)
curveTo(10.0f, 8.3164f, 12.5977f, 6.0f, 16.0f, 6.0f)
close()
moveTo(13.0f, 22.0f)
lineTo(13.0f, 28.0f)
lineTo(19.0f, 28.0f)
lineTo(19.0f, 22.0f)
close()
moveTo(15.0f, 24.0f)
lineTo(17.0f, 24.0f)
lineTo(17.0f, 26.0f)
lineTo(15.0f, 26.0f)
close()
}
}
.build()
return _questionSolid!!
}
private var _questionSolid: ImageVector? = null
| 15 | Kotlin | 20 | 460 | 651badc4ace0137c5541f859f61ffa91e5242b83 | 3,893 | compose-icons | MIT License |
backend/src/main/kotlin/com/project/smonkey/domain/feed/exception/FeedTypeNotExistException.kt | hackersground-kr | 656,532,644 | false | null | package com.project.smonkey.domain.feed.exception
import com.project.smonkey.domain.feed.exception.error.FeedErrorCode
import com.project.smonkey.global.exception.GlobalException
object FeedTypeNotExistException : GlobalException(FeedErrorCode.FEED_TYPE_NOT_EXIST) {
val EXCEPTION = FeedTypeNotExistException
}
| 0 | Kotlin | 3 | 3 | 6782fb89e747b4b3f7cd8170d480597bb1b99c30 | 317 | smonkey | MIT License |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.