path
stringlengths
4
280
owner
stringlengths
2
39
repo_id
int64
21.1k
879M
is_fork
bool
2 classes
languages_distribution
stringlengths
13
1.95k
content
stringlengths
7
482k
issues
int64
0
13.9k
main_language
stringclasses
121 values
forks
stringlengths
1
5
stars
int64
0
111k
commit_sha
stringlengths
40
40
size
int64
7
482k
name
stringlengths
1
100
license
stringclasses
93 values
app/src/main/java/kg/edu/yjut/morseinputmethod/view/OpenSourceLicenseActivity.kt
trueWangSyutung
752,906,350
false
{"Kotlin": 41227, "Java": 7154}
package kg.edu.yjut.morseinputmethod.view import android.graphics.Color import androidx.appcompat.app.AppCompatActivity import android.os.Bundle import android.view.View import kg.edu.yjut.morseinputmethod.R class OpenSourceLicenseActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_open_source_license) window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR // 设置透明导航栏 window.navigationBarColor = Color.TRANSPARENT // 隐藏标题栏 supportActionBar?.title = "开放源代码许可" } }
0
Kotlin
0
0
e5d22b951acf4c3763632dbc1a7672d1059096c0
695
Morse-input-method-OpenSource
Apache License 2.0
sphinx/screens/onboard/onboard-connected/src/main/java/chat/sphinx/onboard_connected/navigation/ToOnBoardConnectedScreen.kt
stakwork
340,103,148
false
{"Kotlin": 4008358, "Java": 403469, "JavaScript": 4745, "HTML": 4706, "Shell": 2453}
package chat.sphinx.onboard_connected.navigation import androidx.annotation.IdRes import androidx.navigation.NavController import chat.sphinx.onboard_connected.R import io.matthewnelson.android_feature_navigation.DefaultNavOptions import io.matthewnelson.concept_navigation.NavigationRequest class ToOnBoardConnectedScreen( @IdRes private val popUpToId: Int, ): NavigationRequest<NavController>() { override fun navigate(controller: NavController) { controller.navigate( R.id.on_board_connected_nav_graph, null, DefaultNavOptions.defaultAnims .setPopUpTo(popUpToId, false) .build() ) } }
96
Kotlin
11
18
64eb5948ee1878cea6f375adc94ac173f25919fa
687
sphinx-kotlin
MIT License
2023/src/Utils.kt
Bridouille
433,940,923
false
{"Kotlin": 159441, "Go": 37047}
import java.io.File import java.math.BigInteger import java.security.MessageDigest const val GREEN = "\u001B[32m" const val BLUE = "\u001B[34m" const val RESET = "\u001B[0m" /** * Reads lines from the given input txt file. */ fun readInput( name: String, removeEmptyLines: Boolean = true ) = File("2023/inputs", "$name") .readLines() .filter { if (removeEmptyLines) { !it.isEmpty() } else { true } } /** * Executes the given [block] and prints the elapsed time in milliseconds. */ inline fun printTimeMillis(block: () -> Unit) { val start = System.currentTimeMillis() block() println(" (took $BLUE${System.currentTimeMillis() - start}ms$RESET)") } /** * Converts string to md5 hash. */ fun String.md5(): String = BigInteger(1, MessageDigest.getInstance("MD5").digest(toByteArray())).toString(16) // Least Common Multiple fun Long.LCM(other: Long): Long { val larger = if (this > other) this else other val maxLcm = this * other var lcm = larger while (lcm <= maxLcm) { if (lcm % this == 0L && lcm % other == 0L) { return lcm } lcm += larger } return maxLcm }
0
Kotlin
0
2
cdcf1f88f96438fe2168ea2658def7a4e5ef3740
1,209
advent-of-code
Apache License 2.0
src/test/kotlin/me/xtrm/unlok/innerClassTest.kt
xtrm-en
461,242,867
false
{"Kotlin": 54075, "Java": 1100}
@file:Suppress("unused") package me.xtrm.unlok import me.xtrm.unlok.dsl.field import kotlin.test.Test import kotlin.test.assertEquals class InnerClassTest { @Test fun `can access inner classes static fields`() { val privateStaticFinalField by ParentClass.InnerClass::class.field<Int>() assertEquals(69, privateStaticFinalField) } @Test fun `can access inner classes virtual fields`() { val innerClass = ParentClass.InnerClass() val privateFinalField by field<Int>( "me.xtrm.unlok.ParentClass.InnerClass", ownerInstance = innerClass ) assertEquals(42, privateFinalField) } } class ParentClass { class InnerClass { companion object { @JvmStatic private val privateStaticFinalField = 69 } private val privateFinalField = 42 } }
0
Kotlin
0
3
ebfeeba6f9a9ef3f56e849c532566679917950b1
883
unlok
ISC License
src/main/kotlin/com/wprdev/foxcms/common/BaseEntity.kt
w0wka91
223,784,077
false
null
package com.wprdev.foxcms.common import com.vladmihalcea.hibernate.type.array.IntArrayType import com.vladmihalcea.hibernate.type.array.StringArrayType import com.vladmihalcea.hibernate.type.basic.PostgreSQLEnumType import org.hibernate.annotations.TypeDef import org.hibernate.annotations.TypeDefs import org.springframework.data.annotation.CreatedDate import org.springframework.data.annotation.LastModifiedDate import org.springframework.data.jpa.domain.support.AuditingEntityListener import java.time.LocalDateTime import javax.persistence.* @TypeDefs( TypeDef( name = "string-array", typeClass = StringArrayType::class ), TypeDef( name = "int-array", typeClass = IntArrayType::class ), TypeDef(name = "pgsql_enum", typeClass = PostgreSQLEnumType::class) ) @MappedSuperclass @EntityListeners(AuditingEntityListener::class) abstract class BaseEntity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) var id: Long = 0 @CreatedDate open var createdAt: LocalDateTime = LocalDateTime.now() @LastModifiedDate open var updatedAt: LocalDateTime = LocalDateTime.now() }
0
Kotlin
0
0
ea91e3b69496a0640483ab376218a1afc71a401a
1,223
foxcms
MIT License
content-types/content-types-core-services/src/test/kotlin/org/orkg/contenttypes/domain/actions/DescriptionValidatorUnitTest.kt
TIBHannover
197,416,205
false
{"Kotlin": 5606089, "Cypher": 219418, "Python": 4881, "Shell": 2767, "Groovy": 1936, "HTML": 240}
package org.orkg.contenttypes.domain.actions import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertDoesNotThrow import org.junit.jupiter.api.assertThrows import org.orkg.graph.domain.InvalidDescription import org.orkg.graph.domain.MAX_LABEL_LENGTH class DescriptionValidatorUnitTest { private val descriptionValidator = DescriptionValidator<String?, Unit> { it } @Test fun `Given a description, when valid, it returns success`() { assertDoesNotThrow { descriptionValidator("valid", Unit) } } @Test fun `Given a description, when null, it returns success`() { assertDoesNotThrow { descriptionValidator(null, Unit) } } @Test fun `Given a description, when invalid, it throws an exception`() { assertThrows<InvalidDescription> { descriptionValidator("a".repeat(MAX_LABEL_LENGTH + 1), Unit) } } }
0
Kotlin
0
4
cf8b0262867de295a9cec4478b28406d5727b235
877
orkg-backend
MIT License
src/main/kotlin/view/core/renderers/viewRenderers/layouts/GridLayoutRenderer.kt
mzaart
160,255,325
false
null
package view.core.renderers.viewRenderers.layouts import kotlin.browser.document import view.core.views.View import view.core.views.layouts.GridLayout import org.w3c.dom.* import view.utils.elementCss.ElementCss import view.utils.elementCss.RelativePositioning import view.utils.elementCss.properties.CssUnit import view.utils.elementCss.properties.Display import view.utils.elementCss.properties.Position import view.utils.extensions.* open class GridLayoutRenderer( view: GridLayout, element: HTMLElement, reRendering: Boolean = true ): LayoutRenderer<GridLayout>(view, element, reRendering) { constructor(view: GridLayout): this(view, document.createElement("div") as HTMLElement, false) override fun buildElement() { element.applyCss { display = Display.GRID grid.rowCount = view.rowCount grid.columnCount = view.columnCount grid.rowGap.set(view.horizontalSpace to CssUnit.PX) grid.columnGap.set(view.verticalSpace to CssUnit.PX) } super.buildElement() } override fun childCreated(child: View, childElement: HTMLElement): Boolean { val childIndex = view.children().indexOf(child) val cell = view.cells[childIndex] // construct container div val cellDiv = document.createElement("div") as HTMLDivElement cellDiv.applyCss { position = Position.RELATIVE gridItem.row = cell.row + 1 gridItem.column = cell.column + 1 gridItem.rowSpan = cell.rowSpan gridItem.columnSpan = cell.columnSpan } cellDiv.setAttribute("index", "(${cell.row},${cell.column})") // edit child element val childCss = ElementCss().apply { position = Position.ABSOLUTE } when(cell.horizontalAlignment) { GridLayout.Cell.HorizontalAlignment.START -> RelativePositioning.alignToParentStart(childCss) GridLayout.Cell.HorizontalAlignment.END -> RelativePositioning.alignToParentEnd(childCss) GridLayout.Cell.HorizontalAlignment.CENTER -> RelativePositioning.centerHorizontal(childCss) } when (cell.verticalAlignment) { GridLayout.Cell.VerticalAlignment.TOP -> RelativePositioning.alignToParentTop(childCss) GridLayout.Cell.VerticalAlignment.BOTTOM -> RelativePositioning.alignToParentBottom(childCss) GridLayout.Cell.VerticalAlignment.CENTER -> RelativePositioning.centerVertical(childCss) } childCss.applyTo(childElement) cellDiv.style.setProperty("place-self", "stretch") cellDiv.appendChild(childElement) element.appendChild(cellDiv) return false } override fun beforeChildIsRemoved(childElement: HTMLElement): Boolean { val cell = childElement.parentElement!! cell.parentNode!!.removeChild(cell) return false } override fun getChildElements(): List<HTMLElement> { return element.children().map { it.children[0]!! as HTMLElement } } }
0
Kotlin
0
0
00a0988c448e4668dc95fa8b74d65ab7c4e2456f
3,065
MaterialDesignJsViewRenderer
Apache License 2.0
core/src/commonMain/kotlin/work/socialhub/kmisskey/api/response/webhooks/ShowWebhooksResponse.kt
uakihir0
756,689,268
false
{"Kotlin": 248708, "Shell": 2141, "Makefile": 316}
package work.socialhub.kmisskey.api.response.webhooks import work.socialhub.kmisskey.entity.Webhook typealias ShowWebhooksResponse = Webhook
0
Kotlin
1
6
db806204a0cba52eb99554bcee38658ba1d4f63e
144
kmisskey
MIT License
polyfill/src/main/kotlin/me/xx2bab/polyfill/ApplicationPolyfill.kt
sunO2
364,854,467
true
{"Kotlin": 138856, "Java": 12156, "Shell": 954}
package me.xx2bab.polyfill import com.android.build.api.variant.Variant import me.xx2bab.polyfill.matrix.base.ApplicationAGPTaskListener import me.xx2bab.polyfill.matrix.base.ApplicationSelfManageableProvider import org.gradle.api.Project class ApplicationPolyfill(private val project: Project) : Polyfill(project) { fun addAGPTaskListener(variant: Variant, listener: ApplicationAGPTaskListener) { listener.onVariantProperties(project, androidExtension, variant, variant.name.capitalize()) } fun <T : ApplicationSelfManageableProvider<*>> getProvider(variant: Variant, clazz: Class<T>): T { return providers.getProvider(clazz, project, androidExtension, variant) } }
0
null
0
0
7555b86a6b4338387619f66cc84f1a335c5fd7eb
751
Polyfill
Apache License 2.0
core/src/main/kotlin/io/koalaql/expr/built/BuiltAggregatable.kt
mfwgenerics
395,950,602
false
null
package io.koalaql.expr.built import io.koalaql.expr.AggregatableBuilder import io.koalaql.expr.Expr import io.koalaql.expr.Ordinal import io.koalaql.query.Distinctness import io.koalaql.unfoldBuilder class BuiltAggregatable { lateinit var expr: Expr<*> var distinct: Distinctness = Distinctness.ALL var orderBy: List<Ordinal<*>> = emptyList() companion object { fun from(builder: AggregatableBuilder): BuiltAggregatable = unfoldBuilder(builder, BuiltAggregatable()) { it.buildIntoAggregatable() } } }
2
Kotlin
3
8
19f1b35ec1c23fbc589660dd8beae8286bff056b
544
koala
MIT License
core/src/main/kotlin/io/koalaql/expr/built/BuiltAggregatable.kt
mfwgenerics
395,950,602
false
null
package io.koalaql.expr.built import io.koalaql.expr.AggregatableBuilder import io.koalaql.expr.Expr import io.koalaql.expr.Ordinal import io.koalaql.query.Distinctness import io.koalaql.unfoldBuilder class BuiltAggregatable { lateinit var expr: Expr<*> var distinct: Distinctness = Distinctness.ALL var orderBy: List<Ordinal<*>> = emptyList() companion object { fun from(builder: AggregatableBuilder): BuiltAggregatable = unfoldBuilder(builder, BuiltAggregatable()) { it.buildIntoAggregatable() } } }
2
Kotlin
3
8
19f1b35ec1c23fbc589660dd8beae8286bff056b
544
koala
MIT License
app/src/main/java/com/example/myapplication/data/remote/Routes.kt
AssasinNik
751,365,646
false
{"Kotlin": 183992, "Java": 97790}
package com.example.myapplication.data.remote object Routes { private const val address = "http://192.168.3.11:8080" const val GET_NEW_FILMS = "$address/films/new" const val GET_MOVIE_FOR_MOOD = "$address/films/movie_for_mood" const val REGISTER = "$address/auth/register" const val LOGIN = "$address/auth/login" const val AUTH = "$address/auth/authenticate" const val CHANGE_IMAGE = "$address/change/image" const val CHANGE_PWD = "$address/change/password" const val CHANGE_USN = "$address/change/username" const val GET_IMAGE = "$address/change/images" }
0
Kotlin
0
1
731cf4758f4c398b1780f4cd4625e98cd60ee8ef
598
Films_mob_app
Apache License 2.0
app/src/main/java/com/example/lefilms/MainActivity.kt
mohmahendra
347,452,341
false
null
package com.example.lefilms import android.content.Intent import androidx.appcompat.app.AppCompatActivity import android.os.Bundle import android.view.Menu import android.view.MenuItem import android.widget.Toast import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import androidx.room.Room import kotlinx.android.synthetic.main.activity_main.* class MainActivity : AppCompatActivity(), OptionsBottomSheetFragment.ItemClickListener { private lateinit var popularMovies: RecyclerView private lateinit var popularMoviesAdapter: MovieAdapter private lateinit var popularMoviesLayoutManager: LinearLayoutManager private var filterType: Int = 0 private var popularMoviesPage = 1 override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) popularMovies = findViewById(R.id.recycler_view) popularMoviesLayoutManager = LinearLayoutManager(this) popularMovies.layoutManager = popularMoviesLayoutManager popularMoviesAdapter = MovieAdapter(mutableListOf()) {movie -> showMovieDetails(movie) } popularMovies.adapter = popularMoviesAdapter getListMovies() bt_movie.setOnClickListener { supportFragmentManager.let { OptionsBottomSheetFragment.newInstance(Bundle()).apply { show(it, tag) } } } } private fun getListMovies() { when (filterType) { 0 -> MoviesRepository.getPopularMovies( 1, onSuccess = { movies -> popularMoviesAdapter.updateMovies(movies) attachPopularMoviesOnScrollListener() }, onError = { Toast.makeText( this, getString(R.string.app_name), Toast.LENGTH_SHORT ).show() } ) 1 -> MoviesRepository.getTopRatedMovies( 1, onSuccess = { movies -> popularMoviesAdapter.updateMovies(movies) attachPopularMoviesOnScrollListener() }, onError = { Toast.makeText( this, getString(R.string.app_name), Toast.LENGTH_SHORT ).show() } ) else -> { MoviesRepository.getNowPlayingMovies( 1, onSuccess = { movies -> popularMoviesAdapter.updateMovies(movies) attachPopularMoviesOnScrollListener() }, onError = { Toast.makeText( this, getString(R.string.app_name), Toast.LENGTH_SHORT ).show() } ) } } } private fun appendListMovies() { when (filterType) { 0 -> MoviesRepository.getPopularMovies( popularMoviesPage, onSuccess = { movies -> popularMoviesAdapter.appendMovies(movies) attachPopularMoviesOnScrollListener() }, onError = { Toast.makeText( this, getString(R.string.app_name), Toast.LENGTH_SHORT ).show() } ) 1 -> MoviesRepository.getTopRatedMovies( popularMoviesPage, onSuccess = { movies -> popularMoviesAdapter.appendMovies(movies) attachPopularMoviesOnScrollListener() }, onError = { Toast.makeText( this, getString(R.string.app_name), Toast.LENGTH_SHORT ).show() } ) else -> { MoviesRepository.getNowPlayingMovies( popularMoviesPage, onSuccess = { movies -> popularMoviesAdapter.appendMovies(movies) attachPopularMoviesOnScrollListener() }, onError = { Toast.makeText( this, getString(R.string.app_name), Toast.LENGTH_SHORT ).show() } ) } } } private fun attachPopularMoviesOnScrollListener() { popularMovies.addOnScrollListener(object : RecyclerView.OnScrollListener() { override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) { val totalItemCount = popularMoviesLayoutManager.itemCount val visibleItemCount = popularMoviesLayoutManager.childCount val firstVisibleItem = popularMoviesLayoutManager.findFirstVisibleItemPosition() if (firstVisibleItem + visibleItemCount >= totalItemCount / 2) { popularMovies.removeOnScrollListener(this) popularMoviesPage++ appendListMovies() } } }) } private fun showMovieDetails(movie: Movie) { val intent = Intent(this, MovieDetailsActivity::class.java) intent.putExtra(MOVIE_POSTER, movie.poster) intent.putExtra(MOVIE_TITLE, movie.title) intent.putExtra(MOVIE_RELEASE_DATE, movie.releaseDate) intent.putExtra(MOVIE_OVERVIEW, movie.description) intent.putExtra("object", movie) startActivity(intent) } override fun onCreateOptionsMenu(menu: Menu?): Boolean { menuInflater.inflate(R.menu.mymenu, menu) return super.onCreateOptionsMenu(menu) } override fun onOptionsItemSelected(item: MenuItem): Boolean { val id = item.itemId if (id == R.id.favoritePage) { val intent = Intent(this, FavoriteActivity::class.java) startActivity(intent) } return super.onOptionsItemSelected(item) } override fun onItemClick(item: String) { when (item) { "Popular" -> { filterType = 0 getListMovies() } "TopRated" -> { filterType = 1 getListMovies() } else -> { filterType = 2 getListMovies() } } } }
0
Kotlin
0
0
8c57e7027ea9e21ae83ef4f7753c8e0d6123e3d2
6,624
lefilms
Apache License 2.0
src/main/kotlin/Main.kt
ralfstuckert
738,431,425
false
{"Kotlin": 75898}
package com.github.ralfstuckert import org.intellij.markdown.ast.ASTNode import org.intellij.markdown.ast.LeafASTNode import org.intellij.markdown.ast.accept import org.intellij.markdown.ast.getTextInNode import org.intellij.markdown.flavours.MarkdownFlavourDescriptor import org.intellij.markdown.flavours.gfm.GFMFlavourDescriptor import org.intellij.markdown.html.HtmlGenerator import org.intellij.markdown.parser.MarkdownParser fun main() { val text = """ ### This is [a](http://wtf) Test Would you do with a **drunken** _sailor_? And some very long sentence and some very long sentence and some very long sentence and some very long sentence and some very long sentence and some very long sentence and some very long sentence and some very long sentence and some very long sentence and some very long sentence and some very long sentence and some very long sentence and some very long sentence and some very long sentence and some very long sentence and some very long sentence ![image search api](https://user-images.githubusercontent.com/110724391/184472398-c590b47c-e1f2-41f8-87e6-2a1f68e8850d.png =200x300) asdfsd [link test ![image search api](https://user-images.githubusercontent.com/110724391/184472398-c590b47c-e1f2-41f8-87e6-2a1f68e8850d.png)](https://www.youtube.com/watch?v=3HIr0imLgxM) | **Syntax** | Description | **Test Text** | | :--- | :----------: | ---: | | Header | Title | Here's this | | Paragraph | Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text | Text Text Text Text Text Text Text <img url="https://user-images.githubusercontent.com/110724391/184472398-c590b47c-e1f2-41f8-87e6-2a1f68e8850d.png" width="20" /> | """ val text2 = """ ![jetbrains logo](https://www.jetbrains.com/company/brand/img/logo6.svg|x=1) | simple | table | | --- | --- | | column 1 | ![jetbrains logo](https://www.jetbrains.com/company/brand/img/logo6.svg{width=200,height=100}) | """ val flavour: MarkdownFlavourDescriptor = GFMFlavourDescriptor() val parsedTree = MarkdownParser(flavour).buildMarkdownTreeFromString(text) visit(parsedTree, text) val html = HtmlGenerator(text, parsedTree, flavour, false).generateHtml() println(html) } fun visit(node:ASTNode, source:String, indent:Int = 0) { println("${indent(indent)}${node.type} ${if (node is LeafASTNode) "leaf" else ""}: '${node.getTextInNode(source)}'") if (node.children.size > 0) { // println("visiting children of ${node.type}") node.children.forEach { visit(it, source, indent+1) } // println("finished children ${node.type}") // println() } } fun indent(indent:Int): String = " ".repeat(indent)
0
Kotlin
0
0
4ee1ee3a0f9b2f81303da6085de9c700d97ecf87
2,745
openpdf-markdown
MIT License
ui-list/src/main/java/com/suleymancelik/github/ui/list/ui/epoxy/RepoListUIController.kt
suleymanccelik
315,060,941
false
null
package com.suleymancelik.github.ui.list.ui.epoxy import com.airbnb.epoxy.TypedEpoxyController import com.suleymancelik.github.data.repo.RepoListModelItem class RepoListUIController(private val callbacks: AdapterCallbacks) : TypedEpoxyController<List<RepoListModelItem>>() { interface AdapterCallbacks { fun listener(repository: RepoListModelItem) } override fun buildModels(data: List<RepoListModelItem>) { data.forEach { repo -> repoListItem { id(repo.id) repo(repo) listener { callbacks.listener(repo) } } } } }
0
Kotlin
0
0
658bb1d0a65fe4b1c60810c20c0b164fc61019dd
671
RepoList
Apache License 2.0
js/src/main/kotlin/com/codeviking/kxg/platform/JsContext.kt
dwbullok
153,008,678
true
{"Kotlin": 925045}
package com.codeviking.kxg.platform import com.codeviking.kxg.* import com.codeviking.kxg.gl.* import org.khronos.webgl.WebGLRenderingContext import org.w3c.dom.Element import org.w3c.dom.HTMLCanvasElement import org.w3c.dom.events.* import kotlin.browser.document import kotlin.browser.window /** * @author fabmax */ @Suppress("UnsafeCastFromDynamic") class JsContext internal constructor(val props: InitProps) : KxgContext() { override val glCapabilities: GlCapabilities override val assetMgr = JsAssetManager(props.assetsBaseDir) override var windowWidth = 0 private set override var windowHeight = 0 private set internal val canvas: HTMLCanvasElement internal val gl: WebGLRenderingContext private var animationMillis = 0.0 init { canvas = document.getElementById(props.canvasName) as HTMLCanvasElement // try to get a WebGL2 context first and use WebGL version 1 as fallback var webGlCtx = canvas.getContext("webgl2") if (webGlCtx == null) { webGlCtx = canvas.getContext("experimental-webgl2") } JsImpl.isWebGl2Context = webGlCtx != null // default attributes for minimal WebGL 1 context, are changed depending on available stuff val uint32Indices: Boolean val depthTextures: Boolean val maxTexUnits: Int var shaderIntAttribs = false var depthComponentIntFormat = GL_DEPTH_COMPONENT val depthFilterMethod = GL_NEAREST var anisotropicTexFilterInfo = AnisotropicTexFilterInfo.NOT_SUPPORTED var glslDialect = GlslDialect.GLSL_DIALECT_100 var glVersion = GlVersion("WebGL", 1, 0) if (webGlCtx != null) { gl = webGlCtx as WebGL2RenderingContext uint32Indices = true depthTextures = true shaderIntAttribs = true depthComponentIntFormat = GL_DEPTH_COMPONENT24 glslDialect = GlslDialect.GLSL_DIALECT_300_ES glVersion = GlVersion("WebGL", 2, 0) maxTexUnits = gl.getParameter(GL_MAX_TEXTURE_IMAGE_UNITS).asDynamic() } else { webGlCtx = canvas.getContext("webgl") if (webGlCtx == null) { webGlCtx = canvas.getContext("experimental-webgl") } if (webGlCtx == null) { js("alert(\"Unable to initialize WebGL. Your browser may not support it.\")") } gl = webGlCtx as WebGLRenderingContext uint32Indices = gl.getExtension("OES_element_index_uint") != null depthTextures = gl.getExtension("WEBGL_depth_texture") != null maxTexUnits = gl.getParameter(GL_MAX_TEXTURE_IMAGE_UNITS).asDynamic() } val extAnisotropic = gl.getExtension("EXT_texture_filter_anisotropic") ?: gl.getExtension("MOZ_EXT_texture_filter_anisotropic") ?: gl.getExtension("WEBKIT_EXT_texture_filter_anisotropic") if (extAnisotropic != null) { val max = gl.getParameter(extAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT) as Float anisotropicTexFilterInfo = AnisotropicTexFilterInfo(max, extAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT) } glCapabilities = GlCapabilities( uint32Indices, shaderIntAttribs, maxTexUnits, depthTextures, depthComponentIntFormat, depthFilterMethod, anisotropicTexFilterInfo, glslDialect, glVersion) screenDpi = JsImpl.dpi windowWidth = canvas.clientWidth windowHeight = canvas.clientHeight // suppress context menu canvas.oncontextmenu = Event::preventDefault // install mouse handlers canvas.onmousemove = { ev -> ev as MouseEvent val bounds = canvas.getBoundingClientRect() val x = (ev.clientX - bounds.left).toFloat() val y = (ev.clientY - bounds.top).toFloat() inputMgr.handleMouseMove(x, y) } canvas.onmousedown = { ev -> ev as MouseEvent inputMgr.handleMouseButtonStates(ev.buttons.toInt()) } canvas.onmouseup = { ev -> ev as MouseEvent inputMgr.handleMouseButtonStates(ev.buttons.toInt()) } canvas.onmouseleave = { inputMgr.handleMouseExit() } canvas.onwheel = { ev -> ev as WheelEvent // scroll amount is browser dependent, try to norm it to roughly 1.0 ticks per mouse // scroll wheel tick var ticks = -ev.deltaY.toFloat() / 3f if (ev.deltaMode == 0) { // scroll delta is specified in pixels... ticks /= 30f } inputMgr.handleMouseScroll(ticks) ev.preventDefault() } // install touch handlers canvas.addEventListener("touchstart", { ev -> ev.preventDefault() val changedTouches = (ev as TouchEvent).changedTouches for (i in 0 until changedTouches.length) { val touch = changedTouches.item(i) inputMgr.handleTouchStart(touch.identifier, touch.elementX, touch.elementY) } }, false) canvas.addEventListener("touchend", { ev -> ev.preventDefault() val changedTouches = (ev as TouchEvent).changedTouches for (i in 0 until changedTouches.length) { val touch = changedTouches.item(i) inputMgr.handleTouchEnd(touch.identifier) } }, false) canvas.addEventListener("touchcancel", { ev -> ev.preventDefault() val changedTouches = (ev as TouchEvent).changedTouches for (i in 0 until changedTouches.length) { val touch = changedTouches.item(i) inputMgr.handleTouchCancel(touch.identifier) } }, false) canvas.addEventListener("touchmove", { ev -> ev.preventDefault() val changedTouches = (ev as TouchEvent).changedTouches for (i in 0 until changedTouches.length) { val touch = changedTouches.item(i) inputMgr.handleTouchMove(touch.identifier, touch.elementX, touch.elementY) } }, false) document.onkeydown = { ev -> handleKeyDown(ev as KeyboardEvent) } document.onkeyup = { ev -> handleKeyUp(ev as KeyboardEvent) } // if (canvas.tabIndex <= 0) { // println("No canvas tabIndex set! Falling back to document key events, this doesn't work with multi context") // } else { // canvas.onkeydown = { ev -> handleKeyDown(ev as KeyboardEvent) } // canvas.onkeyup = { ev -> handleKeyUp(ev as KeyboardEvent) } // } } private fun handleKeyDown(ev: KeyboardEvent) { val code = translateKeyCode(ev.code) if (code != 0) { var mods = 0 if (ev.altKey) { mods = mods or InputManager.KEY_MOD_ALT } if (ev.ctrlKey) { mods = mods or InputManager.KEY_MOD_CTRL } if (ev.shiftKey) { mods = mods or InputManager.KEY_MOD_SHIFT } if (ev.metaKey) { mods = mods or InputManager.KEY_MOD_SUPER } var event = InputManager.KEY_EV_DOWN if (ev.repeat) { event = event or InputManager.KEY_EV_REPEATED } inputMgr.keyEvent(code, mods, event) } if (ev.key.length == 1) { inputMgr.charTyped(ev.key[0]) } if (!props.excludedKeyCodes.contains(ev.code)) { ev.preventDefault() } } private fun handleKeyUp(ev: KeyboardEvent) { val code = translateKeyCode(ev.code) if (code != 0) { var mods = 0 if (ev.altKey) { mods = mods or InputManager.KEY_MOD_ALT } if (ev.ctrlKey) { mods = mods or InputManager.KEY_MOD_CTRL } if (ev.shiftKey) { mods = mods or InputManager.KEY_MOD_SHIFT } if (ev.metaKey) { mods = mods or InputManager.KEY_MOD_SUPER } inputMgr.keyEvent(code, mods, InputManager.KEY_EV_UP) } if (!props.excludedKeyCodes.contains(ev.code)) { ev.preventDefault() } } private fun translateKeyCode(code: String): Int { if (code.length == 4 && code.startsWith("Key")) { return code[3].toInt() } else { return KEY_CODE_MAP[code] ?: 0 } } private fun renderFrame(time: Double) { // determine delta time val dt = (time - animationMillis) / 1000.0 animationMillis = time // update viewport size windowWidth = canvas.clientWidth windowHeight = canvas.clientHeight if (windowWidth != canvas.width || windowHeight!= canvas.height) { // resize canvas to viewport canvas.width = windowWidth canvas.height = windowHeight } // render frame render(dt) gl.finish() // request next frame window.requestAnimationFrame { t -> renderFrame(t) } } override fun openUrl(url: String) { window.open(url) } override fun run() { window.requestAnimationFrame { t -> renderFrame(t) } } override fun destroy() { // nothing to do here... } class InitProps { var canvasName = "glCanvas" val excludedKeyCodes: MutableSet<String> = mutableSetOf("F5") var assetsBaseDir = "./assets" } companion object { val KEY_CODE_MAP: Map<String, Int> = mutableMapOf( "ControlLeft" to InputManager.KEY_CTRL_LEFT, "ControlRight" to InputManager.KEY_CTRL_RIGHT, "ShiftLeft" to InputManager.KEY_SHIFT_LEFT, "ShiftRight" to InputManager.KEY_SHIFT_RIGHT, "AltLeft" to InputManager.KEY_ALT_LEFT, "AltRight" to InputManager.KEY_ALT_RIGHT, "MetaLeft" to InputManager.KEY_SUPER_LEFT, "MetaRight" to InputManager.KEY_SUPER_RIGHT, "Escape" to InputManager.KEY_ESC, "ContextMenu" to InputManager.KEY_MENU, "Enter" to InputManager.KEY_ENTER, "NumpadEnter" to InputManager.KEY_NP_ENTER, "NumpadDivide" to InputManager.KEY_NP_DIV, "NumpadMultiply" to InputManager.KEY_NP_MUL, "NumpadAdd" to InputManager.KEY_NP_PLUS, "NumpadSubtract" to InputManager.KEY_NP_MINUS, "Backspace" to InputManager.KEY_BACKSPACE, "Tab" to InputManager.KEY_TAB, "Delete" to InputManager.KEY_DEL, "Insert" to InputManager.KEY_INSERT, "Home" to InputManager.KEY_HOME, "End" to InputManager.KEY_END, "PageUp" to InputManager.KEY_PAGE_UP, "PageDown" to InputManager.KEY_PAGE_DOWN, "ArrowLeft" to InputManager.KEY_CURSOR_LEFT, "ArrowRight" to InputManager.KEY_CURSOR_RIGHT, "ArrowUp" to InputManager.KEY_CURSOR_UP, "ArrowDown" to InputManager.KEY_CURSOR_DOWN, "F1" to InputManager.KEY_F1, "F2" to InputManager.KEY_F2, "F3" to InputManager.KEY_F3, "F4" to InputManager.KEY_F4, "F5" to InputManager.KEY_F5, "F6" to InputManager.KEY_F6, "F7" to InputManager.KEY_F7, "F8" to InputManager.KEY_F8, "F9" to InputManager.KEY_F9, "F10" to InputManager.KEY_F10, "F11" to InputManager.KEY_F11, "F12" to InputManager.KEY_F12, "Space" to ' '.toInt() ) } } external class TouchEvent: UIEvent { val altKey: Boolean val changedTouches: TouchList val ctrlKey: Boolean val metaKey: Boolean val shiftKey: Boolean val targetTouches: TouchList val touches: TouchList } external class TouchList { val length: Int fun item(index: Int): Touch } external class Touch { val identifier: Int val screenX: Float val screenY: Float val clientX: Float val clientY: Float val pageX: Float val pageY: Float val target: Element val radiusX: Float val radiusY: Float val rotationAngle: Float val force: Float } val Touch.elementX: Float get() = clientX - ((target as? HTMLCanvasElement)?.clientLeft?.toFloat() ?: 0f) val Touch.elementY: Float get() = clientY - ((target as? HTMLCanvasElement)?.clientTop?.toFloat() ?: 0f)
0
Kotlin
0
0
5121acb8d80480bf60624ae9ef87a39b97428e27
12,746
kool
Apache License 2.0
qlive-uicomponnets/uikit-gift/src/main/java/com/qlive/uikitgift/SpanTrackManager.kt
qiniu
538,322,435
false
{"Kotlin": 1143492, "Java": 484578}
package com.qlive.uikitgift import com.qlive.giftservice.QGiftMsg import kotlinx.coroutines.* import java.util.* import kotlin.collections.ArrayList open class SpanTrackManager { var trackSpan = 100L private val trackViews = ArrayList<TrackView>() private val trackModeQueue = LinkedList<QGiftMsg>() /** * 礼物轨道view * 把ui上轨道view attach上来 */ fun addTrackView(trackView: TrackView) { trackViews.add(trackView) } private var job: Job? = null private fun newJob() { job = GlobalScope.launch(Dispatchers.Main, start = CoroutineStart.LAZY) { var next = true while (next) { var giftTrackMode = trackModeQueue.peek() var deal = false if (giftTrackMode != null) { trackViews.forEach { if (it.isShow()) { //如果在处理同一个礼物 if (it.showInSameTrack(giftTrackMode)) { it.onNewModel(giftTrackMode) deal = true return@forEach } } } //是否有空闲的轨道 if (!deal) { trackViews.forEach { if (!deal && !it.isShow()) { it.onNewModel(giftTrackMode) deal = true return@forEach } } } if (!deal) { delay(trackSpan) } else { trackModeQueue.pop() if (trackModeQueue.isEmpty()) { next = false job = null } else { delay(trackSpan) } } } else { next = false job = null } } } } /** * 忘轨道上添加新礼物 */ fun onNewTrackArrive(giftTrackMode: QGiftMsg) { trackModeQueue.add(giftTrackMode) if (job == null) { newJob() job?.start() } } fun resetView() { trackViews.forEach { it.clear() } trackModeQueue.clear() } }
0
Kotlin
4
5
6a13f808c2c36d62944e7a206a1524dba07a9cec
2,507
QNLiveKit_Android
MIT License
src/Day08.kt
cvb941
572,639,732
false
{"Kotlin": 24794}
fun main() { fun part1(input: List<String>): Int { val rows = input.size val columns = input.first().length val field = Array(rows) { IntArray(columns) } input.forEachIndexed() { rowIndex, row -> row.forEachIndexed() { columnIndex, column -> field[rowIndex][columnIndex] = column.digitToInt() } } var count = 0 field.forEachIndexed() { rowIndex, row -> row.forEachIndexed() { columnIndex, tree -> val leftOk = row.toList().subList(0, columnIndex).all { it < tree } val rightOk = row.toList().subList(columnIndex + 1, row.size).all { it < tree } val topOk = field.toList().subList(0, rowIndex).all { it[columnIndex] < tree } val bottomOk = field.toList().subList(rowIndex + 1, field.size).all { it[columnIndex] < tree } if (leftOk || rightOk || topOk || bottomOk) count++ } } return count } fun part2(input: List<String>): Int { val rows = input.size val columns = input.first().length val field = Array(rows) { IntArray(columns) } input.forEachIndexed() { rowIndex, row -> row.forEachIndexed() { columnIndex, column -> field[rowIndex][columnIndex] = column.digitToInt() } } var best = 0 field.forEachIndexed() { rowIndex, row -> row.forEachIndexed() { columnIndex, tree -> // Krajne nechceme lebo su za 0 a sekcia dolu s nimi pocita zle if (rowIndex == 0 || rowIndex == rows - 1 || columnIndex == 0 || columnIndex == columns - 1) return@forEachIndexed val left = row.toList().subList(0, columnIndex).drop(1).reversed().takeWhile { it < tree }.count() + 1 val right = row.toList().subList(columnIndex + 1, row.size).dropLast(1).takeWhile { it < tree }.count() + 1 val top = field.toList().subList(0, rowIndex).drop(1).reversed().takeWhile { it[columnIndex] < tree }.count() + 1 val bottom = field.toList().subList(rowIndex + 1, field.size).dropLast(1).takeWhile { it[columnIndex] < tree }.count() + 1 val score = left * right * top * bottom if (score > best) best = score } } return best } // test if implementation meets criteria from the description, like: val testInput = readInput("Day08_test") check(part1(testInput) == 21) check(part2(testInput) == 8) val input = readInput("Day08") println(part1(input)) println(part2(input)) }
0
Kotlin
0
0
fe145b3104535e8ce05d08f044cb2c54c8b17136
2,695
aoc-2022-in-kotlin
Apache License 2.0
src/main/kotlin/com/sliderzxc/gradle/defaults/SetupDefaults.kt
sliderzxc
727,815,675
false
{"Kotlin": 27612}
package com.sliderzxc.gradle.defaults import com.sliderzxc.gradle.android.config.AndroidConfig import com.sliderzxc.gradle.defaults.extra.setExtraDefaults import com.sliderzxc.gradle.defaults.extra.setExtraLocalization import com.sliderzxc.gradle.localization.core.config.LocalizationConfig import com.sliderzxc.gradle.multiplatform.config.MultiplatformConfig import com.sliderzxc.gradle.publishing.config.PublishingConfig import org.gradle.api.Project fun Project.setupDefaults( multiplatformConfig: MultiplatformConfig? = null, androidConfig: AndroidConfig? = null, publishingConfig: PublishingConfig? = null, localizationConfig: LocalizationConfig? = null ) { setExtraDefaults(listOfNotNull(androidConfig, multiplatformConfig, publishingConfig)) setExtraLocalization(localizationConfig) }
0
Kotlin
0
3
fc515284353fef377cabb990a651883d945e11a3
817
gradle-setup-plugin
Apache License 2.0
data/src/main/java/dev/mslalith/focuslauncher/data/di/modules/RoomModule.kt
mslalith
453,114,601
false
null
package dev.mslalith.focuslauncher.data.di.modules import android.content.Context import androidx.room.Room import dagger.Module import dagger.Provides import dagger.hilt.InstallIn import dagger.hilt.android.qualifiers.ApplicationContext import dagger.hilt.components.SingletonComponent import dev.mslalith.focuslauncher.data.database.AppDatabase import dev.mslalith.focuslauncher.data.database.dao.AppsDao import dev.mslalith.focuslauncher.data.database.dao.CitiesDao import dev.mslalith.focuslauncher.data.database.dao.FavoriteAppsDao import dev.mslalith.focuslauncher.data.database.dao.HiddenAppsDao import dev.mslalith.focuslauncher.data.database.dao.QuotesDao import dev.mslalith.focuslauncher.data.utils.Constants import javax.inject.Singleton @Module @InstallIn(SingletonComponent::class) object RoomModule { @Provides @Singleton fun provideRoomDatabase(@ApplicationContext context: Context): AppDatabase = Room.databaseBuilder( context, AppDatabase::class.java, Constants.Database.APP_DB_NAME ).build() @Provides @Singleton fun provideAppsDao(appDatabase: AppDatabase): AppsDao = appDatabase.appsDao() @Provides @Singleton fun provideFavoriteAppsDao(appDatabase: AppDatabase): FavoriteAppsDao = appDatabase.favoriteAppsDao() @Provides @Singleton fun provideHiddenAppsDao(appDatabase: AppDatabase): HiddenAppsDao = appDatabase.hiddenAppsDao() @Provides @Singleton fun provideQuotesDao(appDatabase: AppDatabase): QuotesDao = appDatabase.quotesDao() @Provides @Singleton fun provideCitiesDao(appDatabase: AppDatabase): CitiesDao = appDatabase.citiesDao() }
8
Kotlin
5
40
3298e2505e9f3eb6f8760b603586bd8c60d065e4
1,670
focus_launcher
Apache License 2.0
decoder/src/commonTest/kotlin/io/github/charlietap/chasm/decoder/decoder/instruction/control/BlockTypeDecoderTest.kt
CharlieTap
743,980,037
false
null
package io.github.charlietap.chasm.decoder.wasm.decoder.instruction.control import com.github.michaelbull.result.Ok import com.github.michaelbull.result.Result import io.github.charlietap.chasm.ast.instruction.ControlInstruction.BlockType import io.github.charlietap.chasm.ast.module.Index import io.github.charlietap.chasm.decoder.wasm.decoder.type.value.NUMBER_TYPE_RANGE import io.github.charlietap.chasm.decoder.wasm.decoder.type.value.REFERENCE_TYPE_RANGE import io.github.charlietap.chasm.decoder.wasm.decoder.type.value.VECTOR_TYPE_RANGE import io.github.charlietap.chasm.decoder.wasm.decoder.type.value.ValueTypeDecoder import io.github.charlietap.chasm.decoder.wasm.error.WasmDecodeError import io.github.charlietap.chasm.decoder.wasm.fixture.ioError import io.github.charlietap.chasm.decoder.wasm.reader.FakeUByteReader import io.github.charlietap.chasm.decoder.wasm.reader.FakeWasmBinaryReader import io.github.charlietap.chasm.decoder.wasm.reader.IOErrorWasmFileReader import io.github.charlietap.chasm.fixture.type.i32ValueType import kotlin.test.Test import kotlin.test.assertEquals class BinaryBlockTypeDecoderTest { @Test fun `can decode an empty block type`() { val peekReader = FakeUByteReader { Ok(BLOCK_TYPE_EMPTY) } var consumedByte = false val emptyByteReader: () -> Result<Byte, WasmDecodeError> = { consumedByte = true Ok(0x00) } val reader = FakeWasmBinaryReader(fakeByteReader = emptyByteReader, fakePeekReader = { peekReader }) val expected = Ok(BlockType.Empty) val actual = BinaryBlockTypeDecoder(reader) assertEquals(expected, actual) assertEquals(true, consumedByte) } @Test fun `can decode value type block type`() { val valueTypes = NUMBER_TYPE_RANGE.asSequence() + VECTOR_TYPE_RANGE.asSequence() + REFERENCE_TYPE_RANGE.asSequence() val iter = valueTypes.iterator() val peekReader = FakeUByteReader { Ok(iter.next().toUByte()) } val reader = FakeWasmBinaryReader(fakePeekReader = { peekReader }) val valueTypeDecoder: ValueTypeDecoder = { _ -> Ok(i32ValueType()) } val expected = Ok(BlockType.ValType(i32ValueType())) valueTypes.forEach { _ -> val actual = BinaryBlockTypeDecoder(reader, valueTypeDecoder) assertEquals(expected, actual) } } @Test fun `can decode signed type index block type`() { val expectedInt = 117u val peekReader = FakeUByteReader { Ok(0x00u) } val reader = FakeWasmBinaryReader( fakePeekReader = { peekReader }, fakeS33Reader = { Ok(expectedInt) }, ) val expected = Ok(BlockType.SignedTypeIndex(Index.TypeIndex(expectedInt))) val actual = BinaryBlockTypeDecoder(reader) assertEquals(expected, actual) } @Test fun `returns io error when read fails`() { val err = ioError() val reader = IOErrorWasmFileReader(err) val actual = BinaryBlockTypeDecoder(reader) assertEquals(err, actual) } }
5
null
3
67
dd6fa51262510ecc5ee5b03866b3fa5d1384433b
3,215
chasm
Apache License 2.0
data_wallet/src/main/java/io/igrant/data_wallet/models/GenesisData.kt
decentralised-dataexchange
344,557,240
false
{"Kotlin": 985864, "Java": 85361}
package io.igrant.data_wallet.models class GenesisData { }
4
Kotlin
0
1
6fb76f662470967d92fce2b1dbca43251b4b3cde
59
ama-android-sdk
Apache License 2.0
flank-scripts/src/main/kotlin/flank/scripts/cli/testartifacts/LinkCommand.kt
Flank
84,221,974
false
{"Kotlin": 1748173, "Java": 101254, "Swift": 41229, "Shell": 10674, "Objective-C": 10006, "Dart": 9705, "HTML": 7235, "Gherkin": 4210, "TypeScript": 2717, "Ruby": 2272, "JavaScript": 1764, "SCSS": 1365, "Batchfile": 1183, "EJS": 1061, "Go": 159}
package flank.scripts.cli.testartifacts import com.github.ajalt.clikt.core.CliktCommand import com.github.ajalt.clikt.core.requireObject import flank.scripts.ops.testartifacts.Context import flank.scripts.ops.testartifacts.linkArtifacts object LinkCommand : CliktCommand( help = "Create symbolic link to under test_runner/src/test/kotlin/ftl/fixtures/tmp to test_artifacts/{branchName}." ) { private val artifacts by requireObject<Context>() override fun run() { artifacts.linkArtifacts() } }
64
Kotlin
115
676
b40904b4e74a670cf72ee53dc666fc3a801e7a95
520
flank
Apache License 2.0
misk-core/src/main/kotlin/misk/security/ssl/TrustStoreConfig.kt
cashapp
113,107,217
false
{"Kotlin": 3843790, "TypeScript": 232251, "Java": 83564, "JavaScript": 5073, "Shell": 3462, "HTML": 1536, "CSS": 58}
package misk.security.ssl import misk.config.Redact import misk.security.ssl.SslLoader.Companion.FORMAT_JCEKS import jakarta.inject.Inject import wisp.security.ssl.TrustStoreConfig as WispTrustStoreConfig data class TrustStoreConfig @Inject constructor( val resource: String, @Redact val passphrase: String? = null, val format: String = FORMAT_JCEKS ) { fun toWispConfig() = WispTrustStoreConfig(resource, passphrase, format) }
169
Kotlin
169
400
13dcba0c4e69cc2856021270c99857e7e91af27d
440
misk
Apache License 2.0
src/main/kotlin/com/koresframework/kores/util/Identity.kt
JonathanxD
58,418,392
false
{"Gradle": 5, "YAML": 3, "TOML": 2, "Markdown": 7208, "INI": 2, "Shell": 1, "Text": 3, "Ignore List": 1, "Batchfile": 1, "Git Attributes": 1, "Java": 69, "Kotlin": 218, "SVG": 2, "HTML": 12, "JavaScript": 7, "CSS": 9, "JSON": 1}
/* * Kores - Java source and Bytecode generation framework <https://github.com/JonathanxD/Kores> * * The MIT License (MIT) * * Copyright (c) 2022 TheRealBuggy/JonathanxD (https://github.com/JonathanxD/) <<EMAIL>> * Copyright (c) contributors * * * 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. */ @file:JvmName("Identity") package com.koresframework.kores.util import com.koresframework.kores.Types import com.koresframework.kores.type.KoresType import com.koresframework.kores.type.GenericType import com.koresframework.kores.type.LoadedKoresType import com.github.jonathanxd.iutils.string.ToStringHelper import com.koresframework.kores.type.koresType import java.lang.reflect.Type import java.util.* /** * Non-strict generic equality check, only works for generic types. * * This method will not make strict bound checks, it means that `List<?>` is equal to `List`, * `List<? extends Person>` is equal to `List<Person>`, but `List<Number>` is not equal to `List<Integer>`. */ fun KoresType.nonStrictEq(other: KoresType): Boolean { if (this is GenericType) return this.nonStrictEq(other) if (other is GenericType) return other.nonStrictEq(this) return this.`is`(other) } /** * Non-strict generic bound equality check, only works for generic types. * * This method will not make strict bound checks, it means that `List<?>` is equal to `List`, * `List<? extends Person>` is equal to `List<Person>`, but `List<Number>` is not equal to `List<Integer>`. */ fun GenericType.nonStrictEq(other: KoresType): Boolean { if (other is GenericType) { return this.isWildcard == other.isWildcard && this.isType == other.isType && this.name == other.name && this.bounds.nonStrictEq(other.bounds) } else { if (this.bounds.all { it.type is GenericType && it.type.isWildcard }) return this.resolvedType.identification == other.identification return this.isType && this.bounds.isEmpty() && this.identification == other.identification } } /** * Non-strict bound comparison. */ private fun GenericType.Bound.nonStrictEq(other: GenericType.Bound): Boolean { val thisType = this.type val otherType = other.type val comparator = { it: KoresType, second: KoresType -> (it is GenericType && it.isWildcard) && (it.bounds.isEmpty() && ( second is GenericType && second.bounds.size == 1 && second.bounds.first().nonStrictEq(GenericType.GenericBound(Types.OBJECT)) || second.`is`(Types.OBJECT) ) || ( it.bounds.isNotEmpty() && it.bounds.any { it.type.`is`(second) } )) } return comparator(thisType, otherType) || comparator( otherType, thisType ) || thisType.`is`(other.type) } /** * Non-strict array bound comparison. */ private fun Array<out GenericType.Bound>.nonStrictEq(others: Array<out GenericType.Bound>): Boolean { if (this.size != others.size) return false this.forEachIndexed { index, bound -> if (!bound.nonStrictEq(others[index])) return@nonStrictEq false } return true } /** * Default equals algorithm for [GenericType] */ fun GenericType.eq(other: Any?): Boolean = this.identityEq(other) /** * Default hashCode algorithm for [GenericType] */ fun GenericType.hash(): Int { if (this.isType && this.bounds.isEmpty()) return (this as KoresType).hash() var result = Objects.hash(this.name, this.isType, this.isWildcard) result = 31 * result + Arrays.deepHashCode(this.bounds) return result } /** * Default to string conversion for [GenericType]. * * This method convert [GenericType] to a Java Source representation of the [GenericType], * see the algorithm of translation [here][toSourceString]. */ fun GenericType.toStr(): String { return this.toSourceString() } /** * * Creates string representation of components of [GenericType]. * * **This method is not recommended for object comparison.** */ fun GenericType.toComponentString(): String = ToStringHelper.defaultHelper(this::class.java.simpleName) .add("name", this.name) .add("isWildcard", this.isWildcard) .add(if (this.isType) "codeType" else "inferredType", this.resolvedType) .add("isType", this.isWildcard) .add("bounds", this.bounds.map { it.toComponentString() }) .toString() /** * Creates a string representation of components of [GenericType.Bound]. * * **This method is not recommended for object comparison.** */ fun GenericType.Bound.toComponentString(): String = ToStringHelper.defaultHelper(this::class.java.simpleName) .add("sign", this.sign) .add("type", this.type) .toString() /** * Default hash algorithm. * * @return Hash code. */ fun KoresType.identityHash(): Int = this.identification.hashCode() /** * Default equals method. * * @param obj Object to test. * @return True if this [KoresType] is equals to another [KoresType]. */ fun KoresType.identityEq(obj: Any?): Boolean = obj is KoresType && this.identification == obj.identification /** * Default hash algorithm. * * @return Hash code. */ fun KoresType.hash(): Int = this.identityHash() /** * Default equals method. * * @param obj Object to test. * @return True if this [KoresType] is equals to another [KoresType]. */ fun KoresType.eq(obj: Any?): Boolean = this.identityEq(obj) /** * Default to string conversion for [KoresType]. * * This methods generates a string with the simple name of current class and the [Type Identification][KoresType.identification]. */ fun KoresType.toStr(): String = "${this::class.java.simpleName}[${this.identification}]" /** * Default equality check for [LoadedKoresType], this method checks if the loaded types are equal. */ fun <T> LoadedKoresType<T>.eq(obj: Any?) = when (obj) { null -> false is LoadedKoresType<*> -> this.loadedType == obj.loadedType else -> (this as KoresType).eq(obj) } /** * Helper for checking equality of two types. Delegates to [KoresType.identityEq] */ operator fun Type.contains(other: Type) = this.koresType.`is`(other.koresType) /** * Helper for checking equality of two types. Delegates to [KoresType.identityEq] */ operator fun Type.contains(others: List<Type>) = others.any { it.koresType.`is`(this.koresType) }
6
Kotlin
0
4
236f7db6eeef7e6238f0ae0dab3f3b05fc531abb
7,746
CodeAPI
MIT License
flowablefetch/FlowableFetchHandler.kt
Sternbach-Software
485,101,103
true
{"Batchfile": 1, "Shell": 1, "Markdown": 1, "Java Properties": 3, "Kotlin": 145, "Proguard": 8, "Java": 42}
package flowablefetch import com.tonyodev.fetch2.* import com.tonyodev.fetch2.database.DownloadInfo import com.tonyodev.fetch2.fetch.FetchHandler import com.tonyodev.fetch2core.* import kotlinx.coroutines.flow.Flow import java.io.Closeable /** * This handlerWrapper class handles all tasks and operations of Fetch. * */ interface FlowableFetchHandler : FetchHandler { fun getDownloadsFlow(): Flow<List<Download>> }
0
Java
0
1
80288af4972317dd631ebbbd8b8e0e4ac2c44c20
423
Fetch
Apache License 2.0
app/src/main/java/deakin/gopher/guardian/view/Extensions.kt
ShreyasNair067
714,569,652
true
{"Java Properties": 2, "Gradle": 3, "Shell": 1, "Markdown": 8, "Batchfile": 1, "Text": 1, "Ignore List": 2, "XML": 129, "YAML": 1, "Proguard": 1, "JSON": 1, "Kotlin": 55, "Java": 33}
package deakin.gopher.guardian.view import android.view.View import android.widget.ProgressBar fun ProgressBar.hide() { visibility = View.GONE } fun ProgressBar.show() { visibility = View.VISIBLE }
1
Java
0
0
a381ece710e42cda48eec74929c2baea411e777e
209
Project-Guardian
MIT License
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/features/SleeveDetector.kt
XaverianTeamRobotics
356,899,269
false
{"Java Properties": 2, "PowerShell": 2, "XML": 25, "Shell": 3, "Gradle": 7, "Markdown": 6, "Batchfile": 1, "Text": 4, "Ignore List": 1, "Java": 206, "CODEOWNERS": 1, "YAML": 3, "Kotlin": 157}
package org.firstinspires.ftc.teamcode.features import com.acmerobotics.dashboard.FtcDashboard import org.firstinspires.ftc.teamcode.internals.features.Buildable import org.firstinspires.ftc.teamcode.internals.features.Feature import org.firstinspires.ftc.teamcode.internals.hardware.Devices import org.firstinspires.ftc.teamcode.internals.hardware.HardwareGetter.Companion.hardwareMap import org.firstinspires.ftc.teamcode.internals.image.MultipleCameraManager import org.firstinspires.ftc.teamcode.internals.image.powerplay.SleeveColorDetection import org.firstinspires.ftc.teamcode.internals.telemetry.logging.AdvancedLogging.Companion.logData import org.firstinspires.ftc.teamcode.internals.telemetry.logging.AdvancedLogging.Companion.update import org.openftc.easyopencv.OpenCvCamera import org.openftc.easyopencv.OpenCvCameraFactory import org.openftc.easyopencv.OpenCvCameraRotation import java.util.* class SleeveDetector : Feature, Buildable { private var detector: SleeveColorDetection? = null var spot: Int = 0 private set private val previousSpots = ArrayList<Int>() var averageSpot: Int = 0 private set var isReady: Boolean = false private set private var indexed = false private var index = 0 /** * Use this when only using one camera at a time. */ constructor() /** * Use this when two cameras are streaming concurrently. * @param index The index of the camera, either 0 or 1. */ constructor(index: Int) { indexed = true this.index = index } override fun build() { val cameraMonitorViewId = hardwareMap!!.appContext.resources.getIdentifier( "cameraMonitorViewId", "id", hardwareMap!!.appContext.packageName ) var viewportContainerIds: IntArray? = null if (indexed) { viewportContainerIds = MultipleCameraManager.get(cameraMonitorViewId) } val camera: OpenCvCamera = if (indexed) { OpenCvCameraFactory.getInstance().createWebcam(Devices.camera0, viewportContainerIds!![index]) } else { OpenCvCameraFactory.getInstance().createWebcam(Devices.camera0, cameraMonitorViewId) } detector = SleeveColorDetection() detector!!.isDebugEnabled = false camera.setPipeline(detector) FtcDashboard.getInstance().startCameraStream(camera, 0.0) camera.openCameraDeviceAsync(object : OpenCvCamera.AsyncCameraOpenListener { override fun onOpened() { isReady = true camera.startStreaming(320, 240, OpenCvCameraRotation.UPRIGHT) } override fun onError(errorCode: Int) { /* * This will be called if the camera could not be opened */ logData("Camera error", errorCode) update() } }) } override fun loop() { spot = detector!!.detection previousSpots.add(spot) // Get the average spot out of all spots, then round it averageSpot = Math.round(previousSpots.stream().mapToInt { obj: Int -> obj.toInt() }.average().orElse(0.0)).toInt() } fun setDebugEnabled(enabled: Boolean) { detector!!.isDebugEnabled = enabled } }
1
null
1
1
349cadebeacc12b05476b3f7ca557916be253cd7
3,355
FtcRobotController
BSD 3-Clause Clear License
app/src/androidTest/java/com/aboolean/movies/data/local/MoviesDataBaseTest.kt
oscarito9410
247,598,856
false
null
package com.aboolean.movies.data.local import android.content.Context import androidx.arch.core.executor.testing.InstantTaskExecutorRule import androidx.room.Room import androidx.test.core.app.ApplicationProvider import androidx.test.runner.AndroidJUnit4 import com.aboolean.movies.data.model.MovieData import org.junit.* import org.junit.runner.RunWith import java.io.IOException @RunWith(AndroidJUnit4::class) class MoviesDataBaseTest { @JvmField @Rule val instantTaskExecutorRule = InstantTaskExecutorRule() private lateinit var moviesDao: MoviesDao private lateinit var movieDatabase: MoviesDataBase private val singleMovieNotFavorite = MovieData(id = 1, title = "Guason", voteCount = 300, voteAverage = 9.2, isFavorite = false, posterPath = "poster.jpg", releaseDate = "19/03/2002", overview = "Amazing movie", page = 1) private val singleMovieFavorite = MovieData(id = 2, title = "Parasito", voteCount = 350, voteAverage = 9.2, isFavorite = true, posterPath = "poster.jpg", releaseDate = "19/03/2002", overview = "Amazing movie", page = 1) @Before fun createDb() { val context = ApplicationProvider.getApplicationContext<Context>() movieDatabase = Room.inMemoryDatabaseBuilder( context, MoviesDataBase::class.java).allowMainThreadQueries().build() moviesDao = movieDatabase.moviesDao() } @Test @Throws(Exception::class) fun query_movie_by_page_is_successful() { moviesDao.insert(singleMovieNotFavorite).subscribe() val moviesResult = moviesDao.getPopularLocalMovies(page = 1).blockingGet() Assert.assertEquals(singleMovieNotFavorite, moviesResult.first()) } @Test @Throws(Exception::class) fun query_add_favorite_movie_is_successful() { moviesDao.insert(singleMovieNotFavorite).subscribe() moviesDao.updateFavorite(id = 1, isFavorite = true).subscribe() val moviesResult = moviesDao.getPopularLocalMovies(page = 1).blockingGet() Assert.assertEquals(true, moviesResult.first().isFavorite) } @Test @Throws(Exception::class) fun query_remove_favorite_movie_is_successful() { moviesDao.insert(singleMovieFavorite).subscribe() moviesDao.updateFavorite(id = 2, isFavorite = false).subscribe() val moviesResult = moviesDao.getPopularLocalMovies(page = 1).blockingGet() Assert.assertEquals(false, moviesResult.first().isFavorite) } @Test @Throws(Exception::class) fun query_get_favorites_is_successful() { moviesDao.insert(singleMovieFavorite).subscribe() val moviesResult = moviesDao.getPopularLocalMovies(page = 1).blockingGet() Assert.assertEquals(1, moviesResult.size) } @After @Throws(IOException::class) fun closeDb() { movieDatabase.close() } }
0
Kotlin
0
1
3d4ea04b52448a060b62806aadb2e536a1a739ae
2,888
Movies
MIT License
core/src/main/java/com/angcyo/core/fragment/PermissionFragment.kt
Alvazz
316,100,224
true
{"Kotlin": 3083452}
package com.angcyo.core.fragment import android.os.Bundle import android.view.View import androidx.recyclerview.widget.GridLayoutManager import com.angcyo.core.R import com.angcyo.core.activity.PermissionBean import com.angcyo.dsladapter.renderItem import com.angcyo.library.getAppName import com.angcyo.widget.recycler.dslAdapter /** * 权限申请界面 * Email:<EMAIL> * @author angcyo * @date 2019/05/29 * Copyright (c) 2019 ShenZhen O&M Cloud Co., Ltd. All rights reserved. */ class PermissionFragment : BaseFragment() { init { fragmentLayoutId = R.layout.lib_permission_fragment } //需要的权限列表 val permissions = mutableListOf<PermissionBean>() //触发权限请求 var onPermissionRequest: (View) -> Unit = {} override fun initBaseView(savedInstanceState: Bundle?) { super.initBaseView(savedInstanceState) baseViewHolder.tv(R.id.permission_title)?.text = "\n为了更好的服务体验,\n${getAppName()} 需要以下权限" baseViewHolder.rv(R.id.recycler_view)?.apply { val count = permissions.size layoutManager = GridLayoutManager( fContext(), when { count <= 3 -> 1 else -> 2 } ) dslAdapter { for (i in 0 until count) { renderItem { itemLayoutId = R.layout.dsl_item_permission itemBindOverride = { itemHolder, itemPosition, _, _ -> itemHolder.img(R.id.lib_image_view) ?.setImageResource(permissions[itemPosition].icon) itemHolder.tv(R.id.lib_text_view)?.text = permissions[itemPosition].des } } } } } baseViewHolder.click(R.id.enable_button) { onPermissionRequest(it) } } override fun canSwipeBack(): Boolean { return false } override fun onBackPressed(): Boolean { return false } }
0
null
0
0
830ec13fac01997ab2491473308bbc854c840002
2,064
UICore
MIT License
app/src/main/java/com/sample/infinitytabs/activity/MainActivity.kt
minhnguyen31093
144,979,719
false
null
package com.sample.infinitytabs.activity import android.support.v7.app.AppCompatActivity import android.os.Bundle import com.sample.infinitytabs.R import com.sample.infinitytabs.adapter.BaseLoopTabAdapter import com.sample.infinitytabs.fragment.* import com.sample.infinitytabs.model.Tab import kotlinx.android.synthetic.main.activity_main.* class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) supportActionBar!!.elevation = 0f initTabs() } private fun initTabs() { val titles = resources.getStringArray(R.array.tab_main_activity) val tabs = ArrayList<Tab>() tabs.add(Tab(titles[0], FragmentA())) tabs.add(Tab(titles[1], FragmentB())) tabs.add(Tab(titles[2], FragmentC())) tabs.add(Tab(titles[3], FragmentD())) tabs.add(Tab(titles[4], FragmentE())) tabs.add(Tab(titles[5], FragmentF())) val adapter = BaseLoopTabAdapter(tabs, supportFragmentManager) adapter.setOnPageChangeListener(vpMain, rvMain, object : BaseLoopTabAdapter.OnPageChangeListener { override fun onPageSelected(position: Int, tab: Tab) { } }) vpMain.adapter = adapter adapter.selectedPosition = 2 } }
0
Kotlin
0
0
6ce2b3ebf163729237f440b40dbdf96da16e4938
1,366
InfinityTabs
Apache License 2.0
androidApp/src/androidMain/kotlin/com/myapplication/ExpensesApplication.kt
gastsail
676,227,205
false
{"Kotlin": 44851, "Swift": 1893, "Shell": 228, "Ruby": 101}
package com.myapplication import android.app.Application import di.commonModule import di.initKoin import org.koin.android.ext.koin.androidContext import org.koin.android.ext.koin.androidLogger class ExpensesApplication: Application() { override fun onCreate() { super.onCreate() initKoin { androidLogger() androidContext(this@ExpensesApplication) modules(commonModule) } } }
0
Kotlin
6
42
9a907ff6d1b797cb26c2990baeba24acc1b0dd37
446
expenses-KMP
Apache License 2.0
src/main/kotlin/anno/NoArgOpenDataClass.kt
Nekoer
391,019,479
false
null
package com.hcyacg.anno annotation class NoArgOpenDataClass()
2
Kotlin
5
37
6ae32ec048dc4827ebc4ac28c86e31ee360ca36b
63
mirai-plugins-pixiv
Apache License 2.0
lib/src/main/java/com/kotlin/inaction/chapter_8/8_2_2_1_InliningFunctionLimit.kt
jhwsx
167,022,805
false
null
package com.kotlin.inaction.chapter_8 import java.util.* /** * * @author wangzhichao * @since 2022/4/15 */ fun main() { val list = listOf("one", "two") println(list.asSequence().map { it.uppercase(Locale.getDefault()) }.toList()) } // 因为 lambda 参数是作为 TransformingSequence 的构造方法的参数被保存为一个属性,所以这个 lambda 没有被内联,而是 // 被编译成标准的非内联的表示法,即一个实现了函数接口的匿名类 // 编译后的 Java /* public final class _8_2_2_1_InliningFunctionLimitKt { public static final void main() { List list = CollectionsKt.listOf(new String[]{"one", "two"}); List var1 = SequencesKt.toList(SequencesKt.map(CollectionsKt.asSequence((Iterable)list), (Function1)null.INSTANCE)); boolean var2 = false; System.out.println(var1); } // $FF: synthetic method public static void main(String[] var0) { main(); } } */
1
Kotlin
1
1
1cdb279920c229fa4e00a09a8165f32e71cadd3e
816
KotlinInAction
MIT License
buildSrc/src/main/kotlin/Info.kt
prodzpod
393,706,613
true
{"Kotlin": 198247}
object Info { const val modid = "witness" const val name = "Witness Minecraft" const val description = "This a helper mod for the Witness Minecraft Series" const val version = "0.10.1" const val group = "com.xfastgames" }
0
Kotlin
1
1
72ac307406307a26d44f271f3865da3a6bd8aaec
241
fabric-witness
Apache License 2.0
app/src/main/java/com/example/hero/bgviewpager/bean/Data.kt
MorningGu
139,953,332
false
{"Kotlin": 20196}
package com.example.hero.bgviewpager.bean /** * 模拟数据类 * Created by gulei on 2018/7/9. */ class Data{ var bannerBg: String = ""; var bannerImage: Int = 0; }
0
Kotlin
0
0
21b67d9f15169c001a77a6d7a34d3eb4049c62cd
167
BGViewPager
Apache License 2.0
app-backend/src/main/kotlin/link/kotlin/legacy/RssGenerator.kt
johnsonlee
183,373,865
true
{"Kotlin": 48686, "TypeScript": 11584, "HTML": 5496, "CSS": 3745, "JavaScript": 2481, "Shell": 543, "Dockerfile": 118}
//package link.kotlin.scripts // //import com.rometools.rome.feed.synd.SyndCategoryImpl //import com.rometools.rome.feed.synd.SyndContentImpl //import com.rometools.rome.feed.synd.SyndEntry //import com.rometools.rome.feed.synd.SyndEntryImpl //import com.rometools.rome.feed.synd.SyndFeedImpl //import com.rometools.rome.feed.synd.SyndImageImpl //import com.rometools.rome.io.SyndFeedOutput //import java.io.StringWriter //import java.time.Instant //import java.util.Date // //interface RssGenerator { // fun generate(name: String, limit: Int): String //} // //class DefaultRssGenerator( // private val articles: List<Article> //) : RssGenerator { // override fun generate(name: String, limit: Int): String { // val feed = SyndFeedImpl().apply { // title = "Kotlin Programming Language" // link = "https://kotlin.link/" // uri = "https://kotlin.link/$name" // description = "News, blog posts, projects, podcasts, videos and other. All information about Kotlin." // feedType = "atom_1.0" // or RSS2? // image = SyndImageImpl().apply { // link = "https://kotlin.link/favicon.ico" // } // docs = "https://validator.w3.org/feed/docs/rss2.html" // author = "<EMAIL> (<NAME>)" // webMaster = "<EMAIL> (<NAME>)" // copyright = "CC0 1.0 Universal (CC0 1.0)" // language = "en" // categories = listOf( // SyndCategoryImpl().apply { this.name = "Kotlin" }, // SyndCategoryImpl().apply { this.name = "JVM" }, // SyndCategoryImpl().apply { this.name = "Programming" }, // SyndCategoryImpl().apply { this.name = "Android" } // ) // generator = "Kotlin 1.1.1" // publishedDate = Date.from(Instant.now()) // entries = articles.take(limit).map(::toSyndEntry) // } // // val writer = StringWriter() // val output = SyndFeedOutput() // output.output(feed, writer) // return writer.buffer.toString() // } //} // //private fun toSyndEntry(article: Article): SyndEntry { // return SyndEntryImpl().apply { // uri = article.url // link = "https://kotlin.link/articles/${article.filename}" // title = article.title // author = article.author // description = SyndContentImpl().also { content -> // content.value = article.description // } // } //}
0
Kotlin
0
0
c7a4dbfe5f27f0928a779fa231c6970b739e61f9
2,499
awesome-kotlin
Apache License 2.0
app/src/main/java/com/github/rooneyandshadows/lightbulb/easyrecyclerviewdemo/demo/fragments/PullToRefreshDemoFragment.kt
RooneyAndShadows
424,519,760
false
null
package com.github.rooneyandshadows.lightbulb.easyrecyclerviewdemo.demo.fragments import android.os.Bundle import android.view.View import com.github.rooneyandshadows.lightbulb.annotation_processors.annotations.BindView import com.github.rooneyandshadows.lightbulb.annotation_processors.annotations.FragmentConfiguration import com.github.rooneyandshadows.lightbulb.annotation_processors.annotations.FragmentScreen import com.github.rooneyandshadows.lightbulb.application.fragment.base.BaseFragment import com.github.rooneyandshadows.lightbulb.application.fragment.cofiguration.ActionBarConfiguration import com.github.rooneyandshadows.lightbulb.commons.utils.ResourceUtils import com.github.rooneyandshadows.lightbulb.easyrecyclerview.EasyRecyclerView import com.github.rooneyandshadows.lightbulb.easyrecyclerview.decorations.VerticalAndHorizontalSpaceItemDecoration import com.github.rooneyandshadows.lightbulb.easyrecyclerviewdemo.R import com.github.rooneyandshadows.lightbulb.easyrecyclerviewdemo.demo.views.adapters.SimpleAdapter import com.github.rooneyandshadows.lightbulb.easyrecyclerviewdemo.demo.generateData import com.github.rooneyandshadows.lightbulb.easyrecyclerviewdemo.demo.models.DemoModel import com.github.rooneyandshadows.lightbulb.easyrecyclerviewdemo.demo.views.SimpleRecyclerView @FragmentScreen(screenName = "PullToRefresh", screenGroup = "Demo") @FragmentConfiguration(layoutName = "fragment_demo_pull_to_refresh") class PullToRefreshDemoFragment : BaseFragment() { @BindView(name = "recycler_view") lateinit var recyclerView: SimpleRecyclerView @Override override fun configureActionBar(): ActionBarConfiguration { return ActionBarConfiguration(R.id.toolbar) .withActionButtons(true) .attachToDrawer(false) .withSubTitle(ResourceUtils.getPhrase(requireContext(), R.string.lazy_loading_demo)) .withTitle(ResourceUtils.getPhrase(requireContext(), R.string.app_name)) } @Override override fun doOnViewCreated(fragmentView: View, savedInstanceState: Bundle?) { recyclerView.apply { addItemDecoration(VerticalAndHorizontalSpaceItemDecoration(ResourceUtils.dpToPx(15))) addHeaderView(layoutInflater.inflate(R.layout.demo_header_item_pull_to_refresh_layout, null)) setRefreshCallback(object : EasyRecyclerView.RefreshCallback<DemoModel, SimpleAdapter> { override fun refresh(view: EasyRecyclerView<DemoModel, SimpleAdapter>) { postDelayed({ val newCollection = generateData(10) view.adapter.setCollection(newCollection) view.showRefreshLayout(false) }, 2000) } }) if (savedInstanceState == null) { val initialCollection = generateData(4) adapter.setCollection(initialCollection) } } } }
0
Kotlin
2
5
7675f9c3a4d077ef453bec751eecae0916c299eb
2,962
lightbulb-easyrecyclerview
Apache License 2.0
app/src/main/java/com/example/android/marsphotos/overview/OverviewViewModel.kt
YandryJoelCarvajalMarcillo
555,760,708
false
null
/* * 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.example.android.marsphotos.overview import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import com.example.android.marsphotos.network.MarsApi import kotlinx.coroutines.launch /** * El [ViewModel] que se adjunta al [OverviewFragment]. */ class OverviewViewModel : ViewModel() { // El MutableLiveData interno que almacena el estado de la solicitud más reciente private val _status = MutableLiveData<String>() // El LiveData inmutable externo para el estado de la solicitud val status: LiveData<String> = _status /** * Llame a getMarsPhotos() en init para que podamos mostrar el estado inmediatamente. */ init { getMarsPhotos() } /** * Obtiene información de fotos de Mars del servicio Mars API Retrofit y actualiza a * [MarsPhoto] [List] [LiveData]. */ private fun getMarsPhotos() { viewModelScope.launch { try { val listResult = MarsApi.retrofitService.getPhotos() _status.value = "Success: ${listResult.size} Mars photos retrieved" } catch (e: Exception){ _status.value = "Failure: ${e.message}" } } } }
0
Kotlin
0
0
cdb97cd41b070eade5ff3c1ec7abecb7f838c6e3
1,920
MarsPhotosTAREA2SEMANA5
Apache License 2.0
libs/messaging/messaging-impl/src/main/kotlin/net/corda/messaging/mediator/taskmanager/TaskManagerImpl.kt
corda
346,070,752
false
{"Kotlin": 18686067, "Java": 321931, "Smarty": 79539, "Shell": 56594, "Groovy": 28415, "TypeScript": 5826, "PowerShell": 4985, "Solidity": 2024}
package net.corda.messaging.mediator.taskmanager import net.corda.messaging.api.mediator.taskmanager.TaskManager import net.corda.messaging.api.mediator.taskmanager.TaskType import org.osgi.service.component.annotations.Activate import org.osgi.service.component.annotations.Component import java.util.UUID import java.util.concurrent.CompletableFuture import java.util.concurrent.Executors import kotlin.concurrent.thread // TODO This is used temporarily until Task Manager implementation is finished @Component(service = [TaskManager::class]) class TaskManagerImpl @Activate constructor() : TaskManager { private var executorService = Executors.newSingleThreadExecutor() override fun <T> execute(type: TaskType, command: () -> T) = when (type) { TaskType.SHORT_RUNNING -> executeShortRunning(command) TaskType.LONG_RUNNING -> executeLongRunning(command) } private fun <T> executeShortRunning(command: () -> T): CompletableFuture<T> { val result = CompletableFuture<T>() executorService.execute { result.complete(command()) } return result } private fun <T> executeLongRunning(command: () -> T): CompletableFuture<T> { val uniqueId = UUID.randomUUID() val result = CompletableFuture<T>() thread( start = true, isDaemon = true, contextClassLoader = null, name = "Task Manager - $uniqueId", priority = -1, ) { result.complete(command()) } return result } }
130
Kotlin
15
42
6ef36ce2d679a07abf7a5d95a832e98bd4d4d763
1,589
corda-runtime-os
Apache License 2.0
core-network/src/main/java/com/taipeitravel/core/network/di/NetworkModule.kt
ductam1987
806,181,722
false
{"Kotlin": 49813}
package com.taipeitravel.core.network.di import com.skydoves.sandwich.retrofit.adapters.ApiResponseCallAdapterFactory import com.squareup.moshi.Moshi import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory import com.taipeitravel.core.network.di.type.ApiOkHttpClient import com.taipeitravel.core.network.di.type.BaseRetrofit import com.taipeitravel.core.network.di.type.BaseUrl import com.taipeitravel.core.network.interceptor.HttpRequestInterceptor import com.taipeitravel.core.network.interceptor.Level import com.taipeitravel.core.network.interceptor.LoggerInterceptor import dagger.Module import dagger.Provides import dagger.hilt.InstallIn import dagger.hilt.components.SingletonComponent import okhttp3.ConnectionSpec import okhttp3.OkHttpClient import okhttp3.internal.platform.Platform import retrofit2.Retrofit import retrofit2.converter.moshi.MoshiConverterFactory import java.util.concurrent.TimeUnit import javax.inject.Singleton /** Created by <NAME> on 24/05/2024 Email: <EMAIL> **/ @Module @InstallIn(SingletonComponent::class) internal object NetworkModule { @Provides @Singleton fun providesLoggingInterceptor(): LoggerInterceptor { return LoggerInterceptor.Builder() .loggable(true) .setLevel(Level.BODY) .log(Platform.INFO) .request("TaipeiTravel_Request") .response("TaipeiTravel_Response") .build() } @BaseUrl @Provides fun providesBaseUrl(): String = "https://travel.taipei/open-api/" @ApiOkHttpClient @Provides fun provideOkHttpClient( loggingInterceptor: LoggerInterceptor, ): OkHttpClient { val clientBuilder = OkHttpClient.Builder() clientBuilder.addInterceptor(HttpRequestInterceptor()) clientBuilder.addInterceptor(loggingInterceptor) clientBuilder.apply { connectTimeout(15, TimeUnit.SECONDS) readTimeout(15, TimeUnit.SECONDS) clearText() } return clientBuilder.build() } @Provides @Singleton fun provideMoshi(): Moshi { return Moshi.Builder() .addLast(KotlinJsonAdapterFactory()) .build() } @BaseRetrofit @Provides @Singleton fun provideBaseRetrofit( @ApiOkHttpClient okHttpClient: OkHttpClient, @BaseUrl baseUrl: String, moshi: Moshi ): Retrofit { return Retrofit.Builder() .baseUrl(baseUrl) .client(okHttpClient) .addConverterFactory(MoshiConverterFactory.create(moshi).asLenient()) .addCallAdapterFactory(ApiResponseCallAdapterFactory.create()) .build() } private fun OkHttpClient.Builder.clearText(): OkHttpClient.Builder { val spec = ConnectionSpec.Builder(ConnectionSpec.COMPATIBLE_TLS).allEnabledCipherSuites().build() connectionSpecs(listOf(spec, ConnectionSpec.CLEARTEXT)) return this } }
0
Kotlin
0
0
ed7be60a94fa2c37f1da9d97a46ad5f57cd4510c
2,964
TaipeiTravel
Apache License 2.0
app/src/main/java/com/fialasfiasco/customdiceroller/saved_roller/SavedRollerRecyclerViewAdapter.kt
westonsfiala
190,253,837
false
null
package com.fialasfiasco.customdiceroller.saved_roller import android.content.Context import android.view.LayoutInflater import android.view.Menu import android.view.View import android.view.ViewGroup import android.widget.* import androidx.constraintlayout.widget.ConstraintLayout import androidx.recyclerview.widget.RecyclerView import com.fialasfiasco.customdiceroller.R import com.fialasfiasco.customdiceroller.dice.Roll import com.fialasfiasco.customdiceroller.data.PageViewModel import kotlinx.android.synthetic.main.holder_saved_roll.view.* /** * [RecyclerView.Adapter] that can display a [SavedRollViewHolder] */ class SavedRollerRecyclerViewAdapter(private val context: Context, private val rollCategoryName: String, private val pageViewModel: PageViewModel, private val listener: OnSavedRollViewInteractionListener) : RecyclerView.Adapter<SavedRollerRecyclerViewAdapter.SavedRollViewHolder>() { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): SavedRollViewHolder { val view = LayoutInflater.from(parent.context) .inflate(R.layout.holder_saved_roll, parent, false) return SavedRollViewHolder(view) } override fun onBindViewHolder(holder: SavedRollViewHolder, position: Int) { val roll = pageViewModel.getSavedRoll(rollCategoryName, position) setupDisplayText(holder, roll) setupClickableLayout(holder, roll) setupInfoButton(holder, roll) } private fun setupDisplayText(holder: SavedRollViewHolder, roll: Roll) { holder.mRollNameText.text = roll.getDisplayName() holder.mRollDetailsText.text = roll.getDetailedRollName() } private fun setupClickableLayout(holder: SavedRollViewHolder, roll: Roll) { holder.mClickableLayout.setOnClickListener { listener.onRollClicked(roll) } holder.mClickableLayout.setOnLongClickListener { popupHelper(holder, roll) true } } private fun setupInfoButton(holder: SavedRollViewHolder, roll: Roll) { holder.mInfoImage.setOnClickListener { popupHelper(holder, roll) } } private fun popupHelper(holder: SavedRollViewHolder, roll: Roll) { val popupMenu = PopupMenu(context, holder.mInfoImage) popupMenu.menu?.add(Menu.NONE, R.string.edit, Menu.NONE, context.getString(R.string.edit)) popupMenu.menu?.add(Menu.NONE, R.string.change_category, Menu.NONE, context.getString(R.string.change_category)) popupMenu.menu?.add(Menu.NONE, R.string.remove, Menu.NONE, context.getString(R.string.remove)) popupMenu.setOnMenuItemClickListener { when(it.itemId) { R.string.edit -> listener.onEditRollClicked(roll) R.string.change_category -> { val innerPopup = PopupMenu(context, holder.mInfoImage) for (category in pageViewModel.getExistingCategories()) { innerPopup.menu?.add(Menu.NONE, Menu.NONE, Menu.NONE, category) } innerPopup.setOnMenuItemClickListener {item -> if(!pageViewModel.changeSavedRollCategory(roll, item.title.toString())) { Toast.makeText(context, "Unable to change roll category, possible name collision?", Toast.LENGTH_LONG).show() } true } innerPopup.show() } R.string.remove -> listener.onRemoveRollClicked(roll) } true } popupMenu.show() } interface OnSavedRollViewInteractionListener { fun onRollClicked(roll: Roll) fun onRemoveRollClicked(roll: Roll) fun onEditRollClicked(roll: Roll) } override fun getItemCount(): Int = pageViewModel.getNumSavedRolls(rollCategoryName) inner class SavedRollViewHolder(view: View) : RecyclerView.ViewHolder(view) { val mRollNameText: TextView = view.rollNameText val mRollDetailsText: TextView = view.rollDetailsText val mClickableLayout: ConstraintLayout = view.clickableLayout val mInfoImage: ImageView = view.infoImageView } }
0
Kotlin
1
2
4b4a67414db6cdbc3caacde4bf564183e8671d61
4,382
CustomDiceRoller
MIT License
app/src/main/java/com/sbma/linkup/bluetooth/AppBluetoothManager.kt
ericaskari-metropolia
694,027,591
false
{"Kotlin": 323836, "HTML": 71958, "TypeScript": 19773, "Dockerfile": 577, "JavaScript": 256}
package com.sbma.linkup.bluetooth import android.annotation.SuppressLint import android.bluetooth.BluetoothAdapter import android.bluetooth.BluetoothServerSocket import android.bluetooth.BluetoothSocket import com.sbma.linkup.bluetooth.connect.BluetoothDataTransferService import com.sbma.linkup.bluetooth.extensions.toBluetoothDeviceDomain import com.sbma.linkup.bluetooth.models.BluetoothDeviceDomain import com.sbma.linkup.bluetooth.models.BluetoothMessage import com.sbma.linkup.bluetooth.models.ConnectionResult import com.sbma.linkup.bluetooth.models.toByteArray import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.flow.emitAll import kotlinx.coroutines.flow.flow import kotlinx.coroutines.flow.flowOn import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.onCompletion import kotlinx.coroutines.flow.update import timber.log.Timber import java.io.IOException import java.util.UUID /** * Responsible for using bluetooth adapter in application */ class AppBluetoothManager( val bluetoothAdapter: BluetoothAdapter?, ) { private var currentServerSocket: BluetoothServerSocket? = null private var currentClientSocket: BluetoothSocket? = null private var dataTransferService: BluetoothDataTransferService? = null private val _isScanning = MutableStateFlow(false) val isScanning get() = _isScanning.asStateFlow() private val _pairedDevices = MutableStateFlow<List<BluetoothDeviceDomain>>(emptyList()) val pairedDevices: StateFlow<List<BluetoothDeviceDomain>> get() = _pairedDevices.asStateFlow() @SuppressLint("MissingPermission") fun updatePairedDevices() { bluetoothAdapter?.let { Timber.d("Bounded devices: ${bluetoothAdapter.bondedDevices.count()}") bluetoothAdapter .bondedDevices ?.map { it.toBluetoothDeviceDomain() } ?.also { devices -> _pairedDevices.update { devices } } } } @SuppressLint("MissingPermission") fun scan() { Timber.d("scan") if (bluetoothAdapter == null || !bluetoothAdapter.isEnabled || _isScanning.value) { return } try { updatePairedDevices() bluetoothAdapter.startDiscovery() _isScanning.value = true } catch (e: Exception) { Timber.d("scan ERROR") Timber.d(e) Timber.d(e.message) _isScanning.value = false } } @SuppressLint("MissingPermission") fun stopScan() { Timber.d("stopScan") if (bluetoothAdapter == null || !bluetoothAdapter.isEnabled || !_isScanning.value) { return } try { bluetoothAdapter.cancelDiscovery() _isScanning.value = false } catch (e: Exception) { Timber.d(e.message) } } @SuppressLint("MissingPermission") fun startBluetoothServer(): Flow<ConnectionResult> { return flow { Timber.d("listenUsingRfcommWithServiceRecord") currentServerSocket = bluetoothAdapter?.listenUsingRfcommWithServiceRecord( "chat_service", UUID.fromString(SERVICE_UUID) ) var shouldLoop = true while (shouldLoop) { Timber.d("shouldLoop") currentClientSocket = try { currentServerSocket?.accept() } catch (e: IOException) { Timber.d("e") Timber.d(e) shouldLoop = false null } Timber.d("ConnectionEstablished") emit(ConnectionResult.ConnectionEstablished) currentClientSocket?.let { Timber.d("currentServerSocket?.close") currentServerSocket?.close() val service = BluetoothDataTransferService(it) dataTransferService = service Timber.d("emitAll") emitAll( service .listenForIncomingMessages() .map { message -> ConnectionResult.TransferSucceeded(message) } ) } } }.onCompletion { closeConnection() }.flowOn(Dispatchers.IO) } @SuppressLint("MissingPermission") suspend fun trySendMessage(message: String): BluetoothMessage? { if (dataTransferService == null) { return null } val bluetoothMessage = BluetoothMessage( message = message, senderName = bluetoothAdapter?.name ?: "Unknown name" ) dataTransferService?.sendMessage(bluetoothMessage.toByteArray()) return bluetoothMessage } @SuppressLint("MissingPermission") fun stopDiscovery() { bluetoothAdapter?.cancelDiscovery() } @SuppressLint("MissingPermission") fun connectToDevice(device: BluetoothDeviceDomain): Flow<ConnectionResult> { Timber.d("[connectToDevice]") return flow { val btDevice = bluetoothAdapter?.getRemoteDevice(device.address) Timber.d(btDevice.toString()) Timber.d("connectToDevice createRfcommSocketToServiceRecord") currentClientSocket = btDevice?.createRfcommSocketToServiceRecord(UUID.fromString(SERVICE_UUID)) stopDiscovery() currentClientSocket?.let { socket -> try { Timber.d("connectToDevice connect") socket.connect() Timber.d("connectToDevice emit") emit(ConnectionResult.ConnectionEstablished) BluetoothDataTransferService(socket).also { dataTransferService = it emitAll( it.listenForIncomingMessages() .map { message -> ConnectionResult.TransferSucceeded(message) } ) } } catch (e: IOException) { Timber.d("currentClientSocket e") Timber.d(e) socket.close() currentClientSocket = null emit(ConnectionResult.Error("Connection was interrupted")) } } }.onCompletion { Timber.d(it) closeConnection() }.flowOn(Dispatchers.IO) } fun closeConnection() { Timber.d("closeConnection") currentClientSocket?.close() currentServerSocket?.close() currentClientSocket = null currentServerSocket = null } companion object { const val SERVICE_UUID = "27b7d1da-08c7-4505-a6d1-2459987e5e2d" } }
0
Kotlin
1
1
436d8f46fc76a9d6af2ab5e997dc673d9ee1bf08
7,197
sbma
MIT License
app/src/main/java/com/myusufcil/androidbase/ui/pages/favorites/repository/FavoritesContract.kt
myusufcil
526,238,997
false
{"Kotlin": 71718}
package com.myusufcil.androidbase.ui.pages.favorites.repository import com.myusufcil.core.database.model.StationsEntity import com.myusufcil.core.networking.DataFetchResult import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.FlowCollector interface FavoritesContract { interface Local { suspend fun insertDeleteFav(isFav:Boolean,idFav: Int) suspend fun getFavList(): List<StationsEntity> } interface Repository { suspend fun insertDeleteFav(isFav:Boolean,idFav: Int) suspend fun getFavList(): Flow<DataFetchResult<List<StationsEntity>>> suspend fun <T> handleError(result: FlowCollector<DataFetchResult<T>>, error: Throwable) } }
0
Kotlin
0
0
115c98b3c60b08878e9d5cbff15a0a30f32ceb4b
704
5c096438148a4babec80626d65b15850
MIT License
kotest-framework/kotest-framework-engine/src/jvmTest/kotlin/com/sksamuel/kotest/engine/threads/WithLocksNestedSingleInstanceTest.kt
kotest
47,071,082
false
null
package com.sksamuel.kotest.engine.threads import io.kotest.assertions.throwables.shouldThrow import io.kotest.core.spec.IsolationMode import io.kotest.core.spec.style.FunSpec import io.kotest.matchers.shouldBe import kotlinx.coroutines.delay import java.util.concurrent.locks.ReentrantLock class WithLocksNestedSingleInstanceTest : FunSpec({ isolationMode = IsolationMode.SingleInstance threads = 3 val lock = ReentrantLock() context("First single thread context") { test("test should lock object") { lock.lock() delay(1000) lock.unlock() } test("lock should be unlocked") { delay(300) lock.isLocked shouldBe false } test("lock should be unlocked too") { delay(300) shouldThrow<AssertionError> { lock.isLocked shouldBe true } } context("First inner single thread context") { test("lock should be unlocked") { lock.isLocked shouldBe false } } } })
111
Kotlin
606
4,033
6c1fd432f9e96ab3581eba3aba91d05bd523e012
1,036
kotest
Apache License 2.0
app/src/main/java/com/example/todolistapp/room/Database.kt
madhawaawishka99
798,677,924
false
{"Kotlin": 22451}
package com.example.todolistapp.room import androidx.room.Database import androidx.room.RoomDatabase import com.example.todolistapp.data.entity.Task @Database(entities = [Task::class], version = 1) abstract class Database: RoomDatabase() { abstract fun getTaskDao(): TaskDao }
0
Kotlin
0
4
5c8d64bfd76db91a40076e02ac03423f6f41613a
282
ToDoList_App
MIT License
src/test/kotlin/com/github/ralfstuckert/openpdf/markdown/EmphasisProviderTest.kt
ralfstuckert
738,431,425
false
{"Kotlin": 98578}
package com.github.ralfstuckert.openpdf.markdown import com.github.ralfstuckert.com.github.ralfstuckert.openpdf.markdown.ElementProviderRegistry import com.github.ralfstuckert.com.github.ralfstuckert.openpdf.markdown.PdfRenderContextKeys import com.github.ralfstuckert.com.github.ralfstuckert.openpdf.markdown.defaultRenderContext import com.github.ralfstuckert.com.github.ralfstuckert.openpdf.markdown.derive import com.github.ralfstuckert.com.github.ralfstuckert.openpdf.markdown.document.document import com.github.ralfstuckert.com.github.ralfstuckert.openpdf.markdown.provider.EmphasisProvider.Companion.EMPHASIS_RENDER_CONTEXT_KEY import com.lowagie.text.Font import org.junit.jupiter.api.Test import java.awt.Color class EmphasisProviderTest { @Test fun emphasis() { val doc = document { markup { +" This is some text with _emphasis markup_\n" +"""markup *over | linebreaks* works. | """.trimMargin() } markup { +"""# heading with _emphasis markup_ """ } markup { elementProviderRegistry = ElementProviderRegistry(defaultRenderContext).apply { registerRenderContextFunction(EMPHASIS_RENDER_CONTEXT_KEY, true) { derive { this[PdfRenderContextKeys.COLOR] = Color.blue this[PdfRenderContextKeys.FONT_FAMILY] = Font.TIMES_ROMAN this[PdfRenderContextKeys.FONT_SIZE] = 17f } } } +"let's change the rendering of emphasis _to blue times roman with size 17_ or whatever you want" } } // File("emphasis.pdf").writeBytes(doc) doc shouldEqual "emphasis.pdf" } }
5
Kotlin
1
0
9bdc0ef394e0c37e1dac19ec7e8683f75c74f309
1,924
openpdf-markdown
MIT License
app/src/androidTest/java/com/example/wordsapp/NavigationTests.kt
de-only-wei
604,276,345
false
null
package com.example.wordsapp import androidx.fragment.app.Fragment import androidx.fragment.app.testing.FragmentScenario import androidx.fragment.app.testing.launchFragmentInContainer import androidx.navigation.NavController import androidx.navigation.Navigation import androidx.navigation.testing.TestNavHostController import androidx.recyclerview.widget.RecyclerView import androidx.test.core.app.ApplicationProvider import androidx.test.espresso.Espresso.onView import androidx.test.espresso.action.ViewActions.click import androidx.test.espresso.contrib.RecyclerViewActions import androidx.test.espresso.matcher.ViewMatchers.withId import junit.framework.TestCase.assertEquals import org.junit.Before import org.junit.Test class NavigationTests { // @Before // fun setup(){ // // // var navController: TestNavHostController = TestNavHostController( // ApplicationProvider.getApplicationContext() // ) // // var exampleFragmentScenario: FragmentScenario<Fragment> = launchFragmentInContainer(themeResId=R.style.Theme_Words) // // exampleFragmentScenario.onFragment { fragment -> // // navController.setGraph(R.navigation.nav_graph) // // Navigation.setViewNavController(fragment.requireView(), navController) // } // } @Test fun navigate_to_words_nav_component() { val navController = TestNavHostController(ApplicationProvider.getApplicationContext()) val letterListScenario = launchFragmentInContainer<LetterListFragment>(themeResId = R.style.Theme_Words) letterListScenario.onFragment { fragment -> navController.setGraph(R.navigation.nav_graph) Navigation.setViewNavController(fragment.requireView(), navController) } onView(withId(R.id.recycler_view)) .perform( RecyclerViewActions .actionOnItemAtPosition<RecyclerView.ViewHolder>(2, click())) assertEquals(navController.currentDestination?.id, R.id.wordListFragment) } }
0
Kotlin
0
0
f77184dc91fff8342513fddefb562e456698909a
2,057
BasicDictionaryApp
Apache License 2.0
src/main/kotlin/com/willoutwest/kalahari/material/shaders/EmissiveShader.kt
wbknez
217,644,047
false
null
package com.willoutwest.kalahari.material.shaders import com.willoutwest.kalahari.material.Shader import com.willoutwest.kalahari.math.Color3 import com.willoutwest.kalahari.math.intersect.Intersection import com.willoutwest.kalahari.render.Tracer import com.willoutwest.kalahari.scene.Geometric import com.willoutwest.kalahari.scene.Scene /** * Represents an implementation of [Shader] that computes emittance rather * than reflectance. */ class EmissiveShader : Shader { override fun shade(scene: Scene, tracer: Tracer, record: Intersection, store: Color3): Color3 { val mod = when(record.reversed) { false -> -1f true -> 1f } val nDotN = record.normal.x * record.ray.dir.x * mod + record.normal.y * record.ray.dir.y * mod + record.normal.z * record.ray.dir.z * mod return when(nDotN > 0f) { false -> store.set(Color3.Black) true -> { val geom = record.obj as Geometric val material = geom.material!! material.cE.getColor(record, store) .timesSelf(material.kE) } } } }
0
Kotlin
0
0
46b1b3de9474dda22291a33b93a9b40b634c29c0
1,223
kalahari
Apache License 2.0
src/main/kotlin/me/arasple/mc/trmenu/modules/action/impl/hook/cronus/ActionCronusEffect.kt
DusKAugustus
288,902,080
true
{"Kotlin": 291052}
package me.arasple.mc.trmenu.modules.action.impl.hook.cronus import ink.ptms.cronus.internal.program.effect.EffectParser import ink.ptms.cronus.uranus.program.effect.Effect import me.arasple.mc.trmenu.modules.action.base.Action import me.arasple.mc.trmenu.modules.hook.HookCronus import org.bukkit.entity.Player /** * @author Arasple * @date 2020/7/20 7:07 */ class ActionCronusEffect : Action("(cq|cronus)(-)?effect(s)?") { val effect: Effect get() { return EffectParser.parse(content) } override fun onExecute(player: Player) { if (HookCronus.isHooked()) { effect.eval( HookCronus.nonProgram(player) ) } } }
0
null
0
1
fda531aa22f985b787f67995d82450d9704ad38b
713
TrMenu
MIT License
src/main/kotlin/uk/gov/justice/digital/hmpps/sentenceplan/exceptions/NotFoundException.kt
ministryofjustice
783,789,996
false
{"Kotlin": 241254, "Makefile": 2474, "Dockerfile": 1145}
package uk.gov.justice.digital.hmpps.sentenceplan.exceptions open class NotFoundException(message: String) : RuntimeException(message)
3
Kotlin
0
1
8e792926adcf18a3c28b7dd59da14b4744af18d1
136
hmpps-sentence-plan
MIT License
common/src/main/kotlin/one/ifelse/module/base/domain/user/UserRepository.kt
ifelsedotonestd
696,103,275
false
{"Kotlin": 97783}
package one.ifelse.module.base.domain.user import org.springframework.data.repository.CrudRepository import java.util.* interface UserRepository : CrudRepository<User, Long> { fun findByPreferredUsername(preferredUsername: String): Optional<User> fun findByUsername(username: String): Optional<User> }
0
Kotlin
0
0
ddd0f1d270b7fc4996726009adb650206ea2a6d9
311
spring-template
The Unlicense
RxJavaExtensions/src/androidTest/java/it/sephiroth/android/rxjava3/extensions/FlowableTransformerAndroidTest.kt
sephiroth74
327,298,011
false
{"Kotlin": 214973, "Java": 3010}
package it.sephiroth.android.rxjava3.extensions import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import io.reactivex.rxjava3.core.BackpressureStrategy import io.reactivex.rxjava3.core.Flowable import io.reactivex.rxjava3.core.FlowableOperator import io.reactivex.rxjava3.core.FlowableSubscriber import io.reactivex.rxjava3.disposables.Disposable import io.reactivex.rxjava3.exceptions.Exceptions import io.reactivex.rxjava3.functions.Consumer import io.reactivex.rxjava3.internal.fuseable.HasUpstreamPublisher import io.reactivex.rxjava3.internal.operators.flowable.FlowableInternalHelper import io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper import io.reactivex.rxjava3.observers.LambdaConsumerIntrospection import io.reactivex.rxjava3.plugins.RxJavaPlugins import io.reactivex.rxjava3.processors.PublishProcessor import io.reactivex.rxjava3.schedulers.Schedulers import it.sephiroth.android.rxjava3.extensions.flowable.autoSubscribe import it.sephiroth.android.rxjava3.extensions.flowable.observeMain import it.sephiroth.android.rxjava3.extensions.operators.FlowableTransformers import org.junit.Assert import org.junit.BeforeClass import org.junit.Test import org.junit.runner.RunWith import org.reactivestreams.Subscriber import org.reactivestreams.Subscription import java.util.concurrent.CountDownLatch import java.util.concurrent.TimeUnit import java.util.concurrent.atomic.AtomicReference /** * RxJavaExtensions * * @author <NAME> on 01.03.21 - 10:53 */ @RunWith(AndroidJUnit4::class) @SmallTest class FlowableTransformerAndroidTest { @Test fun test01() { val now = System.currentTimeMillis() val o1 = PublishProcessor.create<Boolean>({ emitter -> Thread.sleep(550) emitter.onNext(true) emitter.onNext(false) Thread.sleep(550) emitter.onNext(true) emitter.onNext(false) Thread.sleep(550) emitter.onNext(true) emitter.onNext(false) emitter.onComplete() }, BackpressureStrategy.BUFFER).subscribeOn(Schedulers.newThread()) Flowable .create<Long>({ emitter -> emitter.onNext(1) emitter.onNext(2) Thread.sleep(500) emitter.onNext(3) Thread.sleep(500) emitter.onNext(4) emitter.onNext(5) emitter.onNext(6) Thread.sleep(500) emitter.onNext(7) emitter.onNext(8) emitter.onComplete() }, BackpressureStrategy.BUFFER) .subscribeOn(Schedulers.newThread()) .compose(FlowableTransformers.valveLast(o1, false)) .doOnNext { println("Target: [${System.currentTimeMillis() - now}] received onNext($it)") } .test() .awaitDone(5, TimeUnit.SECONDS) .assertValues(3, 6, 8) .assertValueCount(3) println("done") } @Test fun test02() { val o1 = Flowable.just(1, 2, 3, 4, 5) val o2 = PublishProcessor.create<Boolean>() o1.compose(FlowableTransformers.valveLast(o2)).test().await().assertComplete() .assertValues(1, 2, 3, 4, 5) } @Test fun test03() { var i = 0 val latch = CountDownLatch(14) val disposable = Flowable.create<Int>({ emitter -> while (i < 10) { if (emitter.isCancelled) return@create emitter.onNext(i) i++ try { Thread.sleep(100) } catch (e: InterruptedException) { if (!emitter.isCancelled) emitter.onError(e) return@create } } emitter.onComplete() }, BackpressureStrategy.BUFFER) .subscribeOn(Schedulers.single()) .observeMain() .autoSubscribe { doOnStart { println("doOnStart") latch.countDown() } doOnDispose { println("doOnDispose") latch.countDown() } doOnError { println("doOnError") } doOnFinish { println("doOnFinish") latch.countDown() } doOnComplete { println("doOnComplete") latch.countDown() } doOnNext { println("doOnNext($it)") latch.countDown() } } println("now waiting...") latch.await(5, TimeUnit.SECONDS) Thread.sleep(1000) Assert.assertTrue(disposable.isDisposed) println("done") } companion object { private lateinit var ioThread: Thread private lateinit var singleThread: Thread @JvmStatic @BeforeClass fun before() { val latch = CountDownLatch(2) Schedulers.single().scheduleDirect { singleThread = Thread.currentThread() latch.countDown() } Schedulers.io().scheduleDirect { ioThread = Thread.currentThread() latch.countDown() } latch.await() } } private fun <T : Event> subscribe(upstream: Flowable<T>, action: (T) -> Unit): Disposable { val ls = LambdaSubscriber(action, FlowableInternalHelper.RequestMax.INSTANCE) if (upstream is HasUpstreamPublisher<*>) { println("upstream.source=${upstream.source()}") } upstream.subscribe(ls) return ls } abstract class Event class Event01 : Event() class Event02 : Event() } class LambdaSubscriber<T : Any>( private val action: (T) -> Unit, private val onSubscribe: Consumer<Subscription> ) : AtomicReference<Subscription?>(), FlowableSubscriber<T>, Subscription, Disposable, LambdaConsumerIntrospection { override fun onSubscribe(s: Subscription) { println("LambdaSubscriber::onSubscribe(${s.javaClass}, ${System.identityHashCode(s)})") if (SubscriptionHelper.setOnce(this, s)) { onSubscribe.accept(this) } } override fun onNext(t: T) { println("LambdaSubscriber::onNext()") if (!isDisposed) { try { action.invoke(t) } catch (e: Throwable) { Exceptions.throwIfFatal(e) get()?.cancel() onError(e) } } } override fun onError(t: Throwable) { RxJavaPlugins.onError(t) } override fun onComplete() { println("LambdaSubscriber::onComplete()") } override fun dispose() { println("LambdaSubscriber::dispose()") cancel() } override fun isDisposed(): Boolean { return get() === SubscriptionHelper.CANCELLED } override fun request(n: Long) { get()?.request(n) } override fun cancel() { println("LambdaSubscriber::cancel()") SubscriptionHelper.cancel(this) } override fun hasCustomOnError(): Boolean { return false } override fun toString(): String { return "LambdaSubscriber(${System.identityHashCode(this)})" } } internal class CustomOperator<T : Any> : FlowableOperator<T, T> { override fun apply(upstream: Subscriber<in T>): Subscriber<in T> { return CustomSubscriber<T>(upstream) } } class CustomSubscriber<T : Any>(private val downstream: Subscriber<in T>) : FlowableSubscriber<T>, Subscription { private val tag = "CustomSubscriber[${System.identityHashCode(this)}]" private var upstream: Subscription? = null override fun onSubscribe(s: Subscription) { println("$tag: onSubscribe(upstream=$upstream, s=${s.javaClass})") println("downstream=$downstream") if (upstream != null) { s.cancel() } else { upstream = s downstream.onSubscribe(this) } } override fun onNext(item: T) { println("$tag: onNext($item)") downstream.onNext(item) // upstream!!.request(1) } override fun onError(throwable: Throwable) { println("$tag: onError()") downstream.onError(throwable) } override fun onComplete() { println("$tag: onComplete()") downstream.onComplete() } override fun request(n: Long) { upstream!!.request(n) } override fun cancel() { println("$tag: cancel()") upstream!!.cancel() } }
0
Kotlin
0
0
5efe01252fc976e0d6c19b1a7501598c2b43dc70
8,860
RxJavaExtensions
MIT License
src/test/kotlin/me/filippov/gradle/jvm/wrapper/Util.kt
mfilippov
212,058,842
false
{"Kotlin": 19385}
package me.filippov.gradle.jvm.wrapper import org.gradle.testkit.runner.GradleRunner import org.gradle.testkit.runner.TaskOutcome import org.junit.jupiter.api.Assertions.assertEquals import java.io.File import java.util.* import java.util.concurrent.TimeUnit val isWindows = System.getProperty("os.name").toLowerCase(Locale.ENGLISH).startsWith("windows") val isMac = System.getProperty("os.name").toLowerCase(Locale.ENGLISH).startsWith("mac") val isLinux = System.getProperty("os.name").toLowerCase(Locale.ENGLISH).startsWith("linux") val wrapperScriptFileName = when { isWindows -> "gradlew.bat" isLinux -> "gradlew" isMac -> "gradlew" else -> error("Unknown OS") } data class TaskResult(val exitCode: Int, val stdout: String, val stderr: String) fun gradlew(projectRoot: File, task: String): TaskResult { val workingDirectory = File(System.getProperty("user.dir")) val processBuilder = ProcessBuilder( projectRoot.resolve(wrapperScriptFileName).absolutePath, "--include-build", workingDirectory.absolutePath, "-Dkotlin.compiler.execution.strategy=in-process", "--no-daemon", ":$task") .directory(projectRoot) val process = processBuilder.start() val stdout = process.inputStream.bufferedReader().readText() val stderr = process.errorStream.bufferedReader().readText() if (!process.waitFor(5, TimeUnit.MINUTES)) error("Process timeout error") return TaskResult(process.exitValue(), stdout, stderr) } fun withBuildScript(projectRoot: File, withContent: () -> String) { projectRoot.resolve("build.gradle.kts").writeText(withContent().trimIndent()) } fun prepareWrapper(projectRoot: File) { val wrapperResult = GradleRunner.create() .withProjectDir(projectRoot) .withArguments(":wrapper") .withPluginClasspath().build() val result = wrapperResult.task(":wrapper")?.outcome if (result != TaskOutcome.SUCCESS) { println("test") } } fun <T> T.shouldBe(expectedValue: T, message: String? = null) { assertEquals(expectedValue, this, message) } fun String.shouldContain(expectedValue: String, message: String? = null) { assert(this.contains(expectedValue)){ message ?: "String '$this' not contains '$expectedValue'" } } fun String.shouldNotContain(expectedValue: String, message: String? = null) { assert(!this.contains(expectedValue)){ message ?: "String '$this' not contains '$expectedValue'" } } fun String.shouldBeEmpty(message: String? = null) { assert(this.isEmpty()) { message ?: "String '$this' is not empty" } } fun Boolean.shouldBeTrue(message: String? = null) { assert(this) { message ?: "Value should be true" } }
5
Kotlin
7
25
218f86b2338efff8484e7f4b17f96d7702a9d4a0
2,680
gradle-jvm-wrapper
Apache License 2.0
index-lib/src/main/kotlin/cz/vutbr/fit/knot/enticing/index/collection/manager/postprocess/EqlPostProcessor.kt
d-kozak
180,137,313
false
{"Kotlin": 1104829, "TypeScript": 477922, "Python": 23617, "Shell": 19609, "HTML": 8510, "ANTLR": 2005, "CSS": 1432}
package cz.vutbr.fit.knot.enticing.index.collection.manager.postprocess import cz.vutbr.fit.knot.enticing.dto.AstNode import cz.vutbr.fit.knot.enticing.dto.config.dsl.metadata.MetadataConfiguration import cz.vutbr.fit.knot.enticing.dto.interval.Interval import cz.vutbr.fit.knot.enticing.eql.compiler.ast.EqlAstNode import cz.vutbr.fit.knot.enticing.index.boundary.IndexedDocument import cz.vutbr.fit.knot.enticing.index.boundary.MatchInfo import cz.vutbr.fit.knot.enticing.index.boundary.PostProcessor /** * Performs the post processing to compute how the query matched the document */ class EqlPostProcessor : PostProcessor { override fun process(ast: AstNode, document: IndexedDocument, defaultIndex: String, resultOffset: Int, metadataConfiguration: MetadataConfiguration, enclosingInterval: Interval?): MatchInfo? { return matchDocument(ast as EqlAstNode, document, defaultIndex, resultOffset, metadataConfiguration, enclosingInterval ?: Interval.valueOf(0, document.size - 1)) } override fun process(ast: AstNode, document: IndexedDocument, defaultIndex: String, resultOffset: Int, metadataConfiguration: MetadataConfiguration, matchedIntervals: List<List<Interval>>): MatchInfo? { val flat = matchedIntervals.flatten() val min = flat.minBy { it.from }?.from ?: 0 val max = flat.maxBy { it.to }?.to ?: document.size - 1 return matchDocument(ast as EqlAstNode, document, defaultIndex, resultOffset, metadataConfiguration, Interval.valueOf(min, max)) } }
0
Kotlin
0
0
1ea9f874c6d2e4ea158e20bbf672fc45bcb4a561
1,535
enticing
MIT License
code/1758. Clean Architecture on Android 12-Clean-Architecture-on-Android/12-Clean-Architecture-on-Android/Demo2/final/mobile-ui/src/androidTest/java/com/raywenderlich/android/creatures/ui/injection/component/TestApplicationComponent.kt
iOSDevLog
186,328,282
false
null
package com.raywenderlich.android.creatures.ui.injection.component import android.app.Application import com.raywenderlich.android.creatures.domain.executor.PostExecutionThread import com.raywenderlich.android.creatures.domain.repository.CreatureRepository import com.raywenderlich.android.creatures.ui.injection.ApplicationComponent import com.raywenderlich.android.creatures.ui.injection.module.ActivityBindingModule import com.raywenderlich.android.creatures.ui.injection.module.TestApplicationModule import com.raywenderlich.android.creatures.ui.injection.scopes.PerApplication import com.raywenderlich.android.creatures.ui.test.TestApplication import dagger.BindsInstance import dagger.Component import dagger.android.support.AndroidSupportInjectionModule @Component(modules = arrayOf(TestApplicationModule::class, ActivityBindingModule::class, AndroidSupportInjectionModule::class)) @PerApplication interface TestApplicationComponent : ApplicationComponent { fun creatureRepository(): CreatureRepository fun postExecutionThread(): PostExecutionThread fun inject(application: TestApplication) @Component.Builder interface Builder { @BindsInstance fun application(application: Application): TestApplicationComponent.Builder fun build(): TestApplicationComponent } }
0
null
1
4
8b81fbeb046abfeda95f9870c3c29b4998dbb12d
1,301
raywenderlich
MIT License
src/main/kotlin/no/nav/klage/oppgave/domain/kafka/KlageStatistikkTilDVH.kt
navikt
297,650,936
false
null
package no.nav.klage.oppgave.domain.kafka import com.fasterxml.jackson.annotation.JsonFormat import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaDescription import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaFormat import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaTitle import java.time.LocalDate import java.time.LocalDateTime import java.util.* const val DATE_TIME_FORMAT_LABEL = "date-time" const val DATE_TIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSSSSS" const val DATE_FORMAT_LABEL = "date" const val DATE_FORMAT = "yyyy-MM-dd" /** * Brukes av DVH * KlageKvalitetStatistikk er en hendelse i en Sak, knyttet til en konkret behandlingstype (eks. søknad, revurdering, endring, klage). * Vi sender dette typisk ved mottak, tildeling og fullføring. */ @JsonSchemaTitle("SaksbehandlingKA") data class KlageStatistikkTilDVH( /** Kan brukes til idempotency av konsumenter */ @JsonSchemaDescription("Unik id for denne forsendelsen/eventen.") val eventId: UUID, @JsonSchemaDescription("Kode som angir hvilken enhet som er ansvarlig for behandlingen på det gjeldende tidspunktet. Dette begrepet har vi ikke helt i Kabal per nå.") val ansvarligEnhetKode: String? = null, @JsonSchemaDescription("Kode som angir hvilken type enhetskode det er snakk om, som oftest NORG.") val ansvarligEnhetType: String = "NORG", @JsonSchemaDescription("Feltet angir hvem som er avsender av dataene, (navnet på systemet).") val avsender: String = "Kabal", @JsonSchemaDescription("Nøkkel til den aktuelle behandling, som kan identifisere den i kildesystemet. Typisk førsteinstans.") val behandlingId: String?, @JsonSchemaDescription("Nøkkel til den aktuelle behandling, som kan identifisere den i Kabal.") val behandlingIdKabal: String, @JsonFormat( shape = JsonFormat.Shape.STRING, pattern = DATE_FORMAT ) @JsonSchemaFormat(DATE_FORMAT_LABEL) @JsonSchemaDescription("Når behandlingen startet i KA") val behandlingStartetKA: LocalDate?, @JsonSchemaDescription("Kode som angir den aktuelle behandlingens tilstand på gjeldende tidspunkt.") val behandlingStatus: KlagebehandlingState, @JsonSchemaDescription("Kode som beskriver behandlingen, for eksempel, klage, anke, tilbakekreving o.l.") val behandlingType: String, @JsonSchemaDescription("BrukerIDen til den ansvarlige beslutningstageren for saken. Medunderskriver.") val beslutter: String?, @JsonFormat( shape = JsonFormat.Shape.STRING, pattern = DATE_TIME_FORMAT ) @JsonSchemaFormat(DATE_TIME_FORMAT_LABEL) @JsonSchemaDescription("Tidspunktet da hendelsen faktisk ble gjennomført eller registrert i systemet. (format:$DATE_TIME_FORMAT) Dette er det tidspunkt der hendelsen faktisk er gjeldende fra. Ved for eksempel patching av data eller oppdatering tilbake i tid, skal tekniskTid være lik endringstidspunktet, mens endringstid angir tidspunktet da endringen offisielt gjelder fra.") val endringstid: LocalDateTime, @JsonSchemaDescription("Liste av hjemler.") val hjemmel: List<String>, @JsonSchemaDescription("Den som sendt inn klagen.") val klager: Part, @JsonSchemaDescription("F.eks. Foreldrepenger. Kodeverk.") val opprinneligFagsaksystem: String, @JsonFormat( shape = JsonFormat.Shape.STRING, pattern = DATE_FORMAT ) @JsonSchemaFormat(DATE_FORMAT_LABEL) @JsonSchemaDescription("Når KA mottok oversendelsen.") val overfoertKA: LocalDate, @JsonSchemaDescription("Utfall.") val resultat: String?, //Hvis EØS kommer tilbake så legg til dette. // /** // "maxLength": 100 , // "description": "Kode som beskriver behandlingens utlandstilsnitt i henhold til NAV spesialisering. I hoved sak vil denne koden beskrive om saksbehandlingsfrister er i henhold til utlandssaker eller innlandssaker, men vil for mange kildesystem være angitt med en høyere oppløsning." // */ // val utenlandstilsnitt: String, @JsonSchemaDescription("Den som har rettigheten.") val sakenGjelder: Part, @JsonSchemaDescription("Bruker IDen til saksbehandler ansvarlig for saken på gjeldende tidspunkt. Kan etterlates tom ved helautomatiske delprosesser i behandlingen. Bør bare fylles når det er manuelle skritt i saksbehandlingen som utføres.") val saksbehandler: String?, @JsonSchemaDescription("Enhet til gjeldende saksbehandler.") val saksbehandlerEnhet: String?, @JsonFormat( shape = JsonFormat.Shape.STRING, pattern = DATE_TIME_FORMAT ) @JsonSchemaFormat(DATE_TIME_FORMAT_LABEL) @JsonSchemaDescription("Tidspunktet da systemet ble klar over hendelsen. (format:$DATE_TIME_FORMAT). Dette er tidspunkt hendelsen ble endret i systemet. Sammen med funksjonellTid/endringstid, vil vi kunne holde rede på hva som er blitt rapportert tidligere og når det skjer endringer tilbake i tid.") val tekniskTid: LocalDateTime, @JsonSchemaDescription("Nøkkel til det aktuelle vedtaket da behandlingen blir tilknyttet et slikt. Vedtaket i Kabal.") val vedtakId: String, @JsonFormat( shape = JsonFormat.Shape.STRING, pattern = DATE_FORMAT ) @JsonSchemaFormat(DATE_FORMAT) @JsonSchemaDescription("Dato for vedtaket i KA.") val vedtaksdato: LocalDate?, @JsonSchemaDescription("Angir på hvilken versjon av kildekoden JSON stringen er generert på bakgrunn av.") val versjon: Int = 1, //TODO Fyll ut når kabal-api får tilgang til det @JsonSchemaDescription("Stønaden eller ytelsen saken omhandler. Hva gjelder saken? Kodeverk fra DVH. TODO.") val ytelseType: String, @JsonSchemaDescription("Kvalitetsvurdering av arbeid gjort i 1. instans.") val kvalitetsvurdering: Kvalitetsvurdering? = null ) { data class Part( val verdi: String, val type: PartIdType ) enum class PartIdType { PERSON, VIRKSOMHET } data class Kvalitetsvurdering( @JsonSchemaDescription("Er kvaliteten på oversendelsebrevet bra?") val kvalitetOversendelsesbrevBra: Boolean?, @JsonSchemaDescription("Mulige kvalitetsavvik i forsendelsesbrevet.") val kvalitetsavvikOversendelsesbrev: Set<KvalitetsavvikOversendelsesbrev>? = emptySet(), @JsonSchemaDescription("Er kvaliteten på utredning bra?") val kvalitetUtredningBra: Boolean?, @JsonSchemaDescription("Mulige kvalitetsavvik i utredningen.") val kvalitetsavvikUtredning: Set<KvalitetsavvikUtredning>? = emptySet(), @JsonSchemaDescription("Er kvaliteten på vedtaket bra?") val kvalitetVedtaketBra: Boolean?, @JsonSchemaDescription("Mulige kvalitetsavvik i vedtaket.") val kvalitetsavvikVedtak: Set<KvalitetsavvikVedtak>? = emptySet(), @JsonSchemaDescription("Har avviket stor konsekvens for bruker?") val avvikStorKonsekvens: Boolean?, ) { enum class KvalitetsavvikOversendelsesbrev( val id: Int, val beskrivelse: String ) { OVERSITTET_KLAGEFRIST_IKKE_KOMMENTERT( 1, "Oversittet klagefrist er ikke kommentert" ), HOVEDINNHOLDET_IKKE_GJENGITT( 2, "Hovedinnholdet i klagen er ikke gjengitt" ), MANGLER_BEGRUNNELSE( 3, "Mangler begrunnelse for hvorfor vedtaket opprettholdes/hvorfor klager ikke oppfyller villkår" ), KLAGERS_ANFOERSLER_IKKE_TILSTREKKELIG_KOMMENTERT( 4, "Klagers anførsler er ikke tilstrekkelig kommentert/imøtegått" ), MANGLER_KONKLUSJON(5, "Mangler konklusjon"); } enum class KvalitetsavvikUtredning( val id: Int, val beskrivelse: String ) { MANGELFULL_UTREDNING_AV_MEDISINSKE_FORHOLD( 1, "Mangelfull utredning av medisinske forhold " ), MANGELFULL_UTREDNING_AV_ARBEIDSFORHOLD( 2, "Mangelfull utredning av arbeids- og inntektsforhold" ), MANGELFULL_UTREDNING_AV_UTENLANDSPROBLEMATIKK( 3, "Mangelfull utredning av EØS/utlandsproblematikk" ), MANGELFULL_BRUK_AV_ROL( 4, "Mangelfull bruk av rådgivende lege" ), MANGELFULL_UTREDNING_ANDRE_FORHOLD( 5, "Mangelfull utredning av andre aktuelle forhold i saken" ); } enum class KvalitetsavvikVedtak( val id: Int, val beskrivelse: String ) { IKKE_BRUKT_RIKTIGE_HJEMLER( 1, "Det er ikke brukt riktig hjemmel/er" ), INNHOLDET_I_RETTSREGLENE_IKKE_TILSTREKKELIG_BESKREVET( 2, "Innholdet i rettsreglene er ikke tilstrekkelig beskrevet" ), VURDERING_AV_BEVIS_ER_MANGELFULL( 3, "Vurderingen av faktum/bevisvurderingen er mangelfull" ), BEGRUNNELSE_IKKE_TILSTREKKELIG_KONKRET_OG_INDVIDUELL( 4, "Begrunnelsen er ikke tilstrekkelig konkret og individuell" ), FORMIDLING_IKKE_TYDELIG(5, "Formidlingen er ikke tydelig"); } } } enum class KlagebehandlingState { MOTTATT, TILDELT_SAKSBEHANDLER, AVSLUTTET, UKJENT }
2
Kotlin
1
1
7255f8d9a5b0c23e4a22b5bd736d3b656790dfb7
9,548
kabal-api
MIT License
src/main/kotlin/utils/Log.kt
mvysny
627,748,465
false
{"Kotlin": 94618}
package utils import org.slf4j.Logger import org.slf4j.LoggerFactory /** * Simple logger, allows for programmatic configuration of whether debug logs are printed or not. * Logs to [logger]. */ class Log(private val logger: Logger) { constructor(name: String) : this(LoggerFactory.getLogger(name)) constructor(javaClass: Class<*>) : this(LoggerFactory.getLogger(javaClass)) fun debug(msg: String, t: Throwable? = null) { if (isDebugEnabled) { logger.debug(msg, t) } } fun info(msg: String, t: Throwable? = null) { logger.info(msg, t) } fun warn(msg: String, t: Throwable? = null) { logger.warn(msg, t) } fun error(msg: String, t: Throwable? = null) { logger.error(msg, t) } companion object { /** * If true, [debug] messages are logged as well. Defaults to false. */ var isDebugEnabled = false } } inline fun <reified C> Log(): Log = Log(C::class.java)
0
Kotlin
0
0
288a9e552591d50e3642fd1a17dcd58f2f1e4433
993
renogy-klient
MIT License
feature-account-impl/src/main/java/com/dfinn/wallet/feature_account_impl/presentation/account/details/AccountInChainUi.kt
finn-exchange
500,972,990
false
null
package com.dfinn.wallet.feature_account_impl.presentation.account.details import android.graphics.drawable.Drawable import com.dfinn.wallet.feature_account_api.presenatation.chain.ChainUi class AccountInChainUi( val chainUi: ChainUi, val addressOrHint: String, val address: String?, val accountIcon: Drawable )
0
Kotlin
0
0
6cc7a0a4abb773daf3da781b7bd1dda5dbf9b01d
330
dfinn-android-wallet
Apache License 2.0
utils/src/jsMain/kotlin/koncurrent/Promise.kt
aSoft-Ltd
521,074,922
false
{"Kotlin": 153121, "Java": 2405, "JavaScript": 464}
package koncurrent external interface Promise<out T> { fun <S> then(onFulfilled: ((T) -> S)?, onRejected: ((Throwable) -> S)? = definedExternally): Promise<S> fun catch(onRejected: (Throwable) -> @UnsafeVariance T): Promise<T> // fun finally(onFinally: () -> Unit): Promise<T> // adding this in messes up the finally extension method }
0
Kotlin
0
1
083512ca142028275e47884bd984de1a048e3f42
349
koncurrent
MIT License
app/src/main/java/at/roteskreuz/stopcorona/di/RemoteModule.kt
fraiss
312,562,485
true
{"Kotlin": 754571, "HTML": 206599, "Shell": 1977}
package at.roteskreuz.stopcorona.di import at.roteskreuz.stopcorona.constants.Constants import at.roteskreuz.stopcorona.constants.Constants.API.CERTIFICATE_CHAIN_CDN import at.roteskreuz.stopcorona.constants.Constants.API.CERTIFICATE_CHAIN_DEFAULT import at.roteskreuz.stopcorona.constants.Constants.API.CERTIFICATE_CHAIN_TAN import at.roteskreuz.stopcorona.constants.Constants.API.HOSTNAME import at.roteskreuz.stopcorona.constants.Constants.API.HOSTNAME_CDN import at.roteskreuz.stopcorona.constants.Constants.API.HOSTNAME_TAN import at.roteskreuz.stopcorona.constants.Constants.API.Header import at.roteskreuz.stopcorona.constants.isBeta import at.roteskreuz.stopcorona.constants.isDebug import at.roteskreuz.stopcorona.di.CertificatePinnerTag.cdnCertificatePinnerTag import at.roteskreuz.stopcorona.di.CertificatePinnerTag.defaultCertificatePinnerTag import at.roteskreuz.stopcorona.di.CertificatePinnerTag.tanCertificatePinnerTag import at.roteskreuz.stopcorona.model.api.* import at.roteskreuz.stopcorona.model.entities.infection.info.LocalDateNotIsoAdapter import at.roteskreuz.stopcorona.model.entities.infection.info.UUIDAdapter import at.roteskreuz.stopcorona.model.managers.BluetoothManager import at.roteskreuz.stopcorona.model.managers.BluetoothManagerImpl import at.roteskreuz.stopcorona.model.receivers.BluetoothStateReceiver import at.roteskreuz.stopcorona.skeleton.core.di.createApi import at.roteskreuz.stopcorona.skeleton.core.di.createMoshi import at.roteskreuz.stopcorona.skeleton.core.di.createOkHttpClient import at.roteskreuz.stopcorona.skeleton.core.model.api.addHeaders import okhttp3.CertificatePinner import okhttp3.logging.HttpLoggingInterceptor.Level.BODY import okhttp3.logging.HttpLoggingInterceptor.Level.NONE import org.koin.dsl.module.module object CertificatePinnerTag { const val defaultCertificatePinnerTag = "default" const val tanCertificatePinnerTag = "TAN" const val cdnCertificatePinnerTag = "CDN" } /** * Module for Rest Service. */ val remoteModule = module { single(name = defaultCertificatePinnerTag) { CertificatePinner.Builder().apply { CERTIFICATE_CHAIN_DEFAULT.forEach { pin -> add(HOSTNAME, pin) } }.build() } single(name = tanCertificatePinnerTag) { CertificatePinner.Builder().apply { CERTIFICATE_CHAIN_TAN.forEach { pin -> add(HOSTNAME_TAN, pin) } }.build() } single(name = cdnCertificatePinnerTag) { CertificatePinner.Builder().apply { CERTIFICATE_CHAIN_CDN.forEach { pin -> add(HOSTNAME_CDN, pin) } }.build() } single(name = defaultCertificatePinnerTag) { createOkHttpClient(if (isDebug || isBeta) BODY else NONE) { addHeaders( Header.AUTHORIZATION_KEY to Header.AUTHORIZATION_VALUE, Header.APP_ID_KEY to Header.APP_ID_VALUE ) certificatePinner(get(defaultCertificatePinnerTag)) } } single(name = tanCertificatePinnerTag) { createOkHttpClient(if (isDebug || isBeta) BODY else NONE) { addHeaders( Header.AUTHORIZATION_KEY to Header.AUTHORIZATION_VALUE, Header.APP_ID_KEY to Header.APP_ID_VALUE ) certificatePinner(get(tanCertificatePinnerTag)) } } single(name = cdnCertificatePinnerTag) { createOkHttpClient(if (isDebug || isBeta) BODY else NONE) { addHeaders( Header.AUTHORIZATION_KEY to Header.AUTHORIZATION_VALUE, Header.APP_ID_KEY to Header.APP_ID_VALUE ) certificatePinner(get(cdnCertificatePinnerTag)) } } single { createMoshi { add(LocalDateNotIsoAdapter) add(UUIDAdapter) } } single { createApi<ApiDescription>( baseUrl = Constants.API.BASE_URL, okHttpClient = get(defaultCertificatePinnerTag), moshi = get() ) } single { createApi<TanApiDescription>( baseUrl = Constants.API.BASE_URL_TAN, okHttpClient = get(tanCertificatePinnerTag), moshi = get() ) } single { createApi<ContentDeliveryNetworkDescription>( baseUrl = Constants.API.BASE_URL_CDN, okHttpClient = get(cdnCertificatePinnerTag), moshi = get() ) } single<ApiInteractor> { ApiInteractorImpl( appDispatchers = get(), apiDescription = get(), contentDeliveryNetworkDescription = get(), tanApiDescription = get(), dataPrivacyRepository = get(), filesRepository = get() ) } single<BluetoothManager> { BluetoothManagerImpl( contextInteractor = get(), bluetoothStateReceiver = get<BluetoothStateReceiver>() ) } }
0
Kotlin
0
0
dffcb33dac861e1095b50703ab641cff4afa5371
4,998
stopp-corona-android
Apache License 2.0
Server/src/Tools.kt
pavelaizen
104,559,996
false
null
fun log(message:String){ println("dada: $message") }
1
Kotlin
0
1
346f6d65b2e8cf5a91c146acc7662e44e21c14a1
57
SoundZones
Apache License 2.0
app/src/main/java/cn/svecri/feedive/model/Subscription.kt
Feedive
446,004,417
false
{"Kotlin": 151458}
package cn.svecri.feedive.model import java.time.LocalDateTime data class Subscription( val name: String, val url: String, val iconUrl: String = "", val protocol: String = "rss", val priority: Int = 1, val enabled: Boolean = true, val lastUse: LocalDateTime? = null, val lastUpdate: LocalDateTime? = null, )
0
Kotlin
0
2
07eb847c03905d99841400b93066ae6e6395d937
341
feedive-android
MIT License
app/src/main/java/com/safebuddyfintech23/safebuddy/start/LoginActivity.kt
SafeBuddy-Fintech23
564,193,975
false
null
package com.safebuddyfintech23.safebuddy.start import android.content.Intent import androidx.appcompat.app.AppCompatActivity import android.os.Bundle import android.util.Log import android.widget.Toast import androidx.activity.result.ActivityResultLauncher import com.firebase.ui.auth.AuthUI import com.firebase.ui.auth.FirebaseAuthUIActivityResultContract import com.firebase.ui.auth.data.model.FirebaseAuthUIAuthenticationResult import com.google.firebase.auth.ktx.auth import com.google.firebase.ktx.Firebase import com.safebuddyfintech23.safebuddy.MainActivity import com.safebuddyfintech23.safebuddy.R import com.safebuddyfintech23.safebuddy.databinding.ActivityLoginBinding class LoginActivity : AppCompatActivity() { companion object { private const val TAG = "LoginInActivity" } private lateinit var binding: ActivityLoginBinding private val logIn: ActivityResultLauncher<Intent> = registerForActivityResult(FirebaseAuthUIActivityResultContract(), this::onLoginResult) override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) binding = ActivityLoginBinding.inflate(layoutInflater) setContentView(binding.root) } public override fun onStart() { super.onStart() val providers = listOf( AuthUI.IdpConfig.GoogleBuilder().build(), //AuthUI.IdpConfig.AppleBuilder().build(), //AuthUI.IdpConfig.GitHubBuilder().build(), AuthUI.IdpConfig.EmailBuilder().build(), AuthUI.IdpConfig.PhoneBuilder().build() ) if (Firebase.auth.currentUser == null) { val loginIntent = AuthUI.getInstance() .createSignInIntentBuilder() .setLogo(R.drawable.image_for_login) .setTheme(R.style.Theme_SafeBuddy) .setAvailableProviders( providers ) .build() logIn.launch(loginIntent) } else goToMainActivity() } private fun onLoginResult(result: FirebaseAuthUIAuthenticationResult) { if (result.resultCode == RESULT_OK) { goToMainActivity() Log.d(TAG, "Sign in successful") } else { Toast.makeText(this, "There was an error signing in", Toast.LENGTH_LONG) .show() val response = result.idpResponse if (response == null) { Log.w(TAG, "Sign in cancelled") } else { Log.w(TAG, "Sign in error", response.error) } } } private fun goToMainActivity() { startActivity(Intent(this, MainActivity::class.java)) finish() } }
5
Kotlin
1
0
3e7a1439c7f193d2ca11f4892c731edc20ded693
2,726
SafeBuddy
Apache License 2.0
msal/src/test/java/com/microsoft/identity/nativeauth/NativeAuthCIAMAuthorityTest.kt
AzureAD
64,339,521
false
{"Java": 2084397, "Kotlin": 783134}
// Copyright (c) Microsoft Corporation. // All rights reserved. // // This code is licensed under the MIT License. // // 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 com.microsoft.identity.client.nativeauth import com.microsoft.identity.common.java.authorities.NativeAuthCIAMAuthority import com.microsoft.identity.common.java.exception.ClientException import com.microsoft.identity.common.java.providers.oauth2.OAuth2StrategyParameters import junit.framework.Assert.assertEquals import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith import org.robolectric.RobolectricTestRunner @RunWith(RobolectricTestRunner::class) class NativeAuthCIAMAuthorityTest { private val B2C_AUTHORITY_URL = "https://fabrikamb2c.b2clogin.com/tfp/fabrikamb2c.onmicrosoft.com/b2c_1_susi/" private val ADFS_AUTHORITY_URL = "https://somesite.contoso.com/adfs/" private val AAD_AUTHORITY_URL = "https://login.microsoftonline.com/common" private val CIAM_AUTHORITY_URL = "https://msidlabciam1.ciamlogin.com/msidlabciam1.onmicrosoft.com" private val CLIENT_ID = "1234-5678-9123" @Test fun testB2CAuthorityURLShouldThrowError() { try { NativeAuthCIAMAuthority.getAuthorityFromAuthorityUrl( authorityUrl = B2C_AUTHORITY_URL, clientId = CLIENT_ID ) } catch (e: ClientException) { assertEquals(ClientException.NATIVE_AUTH_INVALID_CIAM_AUTHORITY, e.errorCode) } } @Test fun testADFSAuthorityURLShouldThrowError() { try { NativeAuthCIAMAuthority.getAuthorityFromAuthorityUrl( authorityUrl = ADFS_AUTHORITY_URL, clientId = CLIENT_ID ) } catch (e: ClientException) { assertEquals(ClientException.NATIVE_AUTH_INVALID_CIAM_AUTHORITY, e.errorCode) } } @Test fun testInvalidAuthorityWithoutPathURLShouldThrowError() { try { NativeAuthCIAMAuthority.getAuthorityFromAuthorityUrl( authorityUrl = "https://www.microsoft.com", clientId = CLIENT_ID ) } catch (e: ClientException) { assertEquals(ClientException.NATIVE_AUTH_INVALID_CIAM_AUTHORITY, e.errorCode) } } @Test fun testAADAuthorityShouldThrowError() { try { NativeAuthCIAMAuthority.getAuthorityFromAuthorityUrl( authorityUrl = AAD_AUTHORITY_URL, clientId = CLIENT_ID ) } catch (e: ClientException) { assertEquals(ClientException.NATIVE_AUTH_INVALID_CIAM_AUTHORITY, e.errorCode) } } @Test fun testCIAMAuthorityShouldSucceed() { val authority = NativeAuthCIAMAuthority.getAuthorityFromAuthorityUrl( authorityUrl = CIAM_AUTHORITY_URL, clientId = CLIENT_ID ) Assert.assertEquals( CIAM_AUTHORITY_URL, authority.authorityUri.toString() ) Assert.assertEquals( CLIENT_ID, authority.clientId ) } @Test fun testCIAMAuthorityCreateOAuth2StrategyWithDuplicateChallengeTypes() { val authority = NativeAuthCIAMAuthority.getAuthorityFromAuthorityUrl( authorityUrl = CIAM_AUTHORITY_URL, clientId = CLIENT_ID ) val params = OAuth2StrategyParameters.builder() .challengeTypes(listOf("oob", "oob", "password")) .build() val strategy = authority.createOAuth2Strategy(params) assertEquals("oob password redirect", strategy.config.challengeType) } @Test fun testCIAMAuthorityCreateOAuth2StrategyWithSingleExistingDefaultChallengeType() { val authority = NativeAuthCIAMAuthority.getAuthorityFromAuthorityUrl( authorityUrl = CIAM_AUTHORITY_URL, clientId = CLIENT_ID ) val params = OAuth2StrategyParameters.builder() .challengeTypes(listOf("redirect")) .build() val strategy = authority.createOAuth2Strategy(params) assertEquals("redirect", strategy.config.challengeType) } @Test fun testCIAMAuthorityCreateOAuth2StrategyWithExistingDefaultChallengeTypes() { val authority = NativeAuthCIAMAuthority.getAuthorityFromAuthorityUrl( authorityUrl = CIAM_AUTHORITY_URL, clientId = CLIENT_ID ) val params = OAuth2StrategyParameters.builder() .challengeTypes(listOf("redirect", "oob", "password")) .build() val strategy = authority.createOAuth2Strategy(params) assertEquals("redirect oob password", strategy.config.challengeType) } @Test fun testCIAMAuthorityCreateOAuth2StrategyWithDuplicateDefaultChallengeTypes() { val authority = NativeAuthCIAMAuthority.getAuthorityFromAuthorityUrl( authorityUrl = CIAM_AUTHORITY_URL, clientId = CLIENT_ID ) val params = OAuth2StrategyParameters.builder() .challengeTypes(listOf("redirect", "oob", "password", "password", "oob", "redirect")) .build() val strategy = authority.createOAuth2Strategy(params) assertEquals("redirect oob password", strategy.config.challengeType) } @Test fun testCIAMAuthorityCreateOAuth2StrategyWithNoChallengeTypes() { val authority = NativeAuthCIAMAuthority.getAuthorityFromAuthorityUrl( authorityUrl = CIAM_AUTHORITY_URL, clientId = CLIENT_ID ) val params = OAuth2StrategyParameters.builder() .challengeTypes(emptyList<String>()) .build() val strategy = authority.createOAuth2Strategy(params) assertEquals("redirect", strategy.config.challengeType) } }
69
Java
124
214
d2deec34dfde6ea445309af3621f5642ea184881
6,863
microsoft-authentication-library-for-android
MIT License
mvvm/src/main/java/com/catchpig/mvvm/lifecycle/FragmentLifeCycleCallbacksImpl.kt
catchpig
421,823,225
false
{"Kotlin": 238293}
package com.catchpig.mvvm.lifecycle import android.content.Context import android.os.Bundle import android.view.View import androidx.fragment.app.Fragment import androidx.fragment.app.FragmentManager import com.catchpig.utils.ext.logd /** * fragment生命周期的监听 */ open class FragmentLifeCycleCallbacksImpl : FragmentManager.FragmentLifecycleCallbacks() { companion object { private const val TAG = "FragmentLifeCycleCallbacksImpl" } override fun onFragmentPreAttached(fm: FragmentManager, f: Fragment, context: Context) { "${f::class.java.simpleName}->onPreAttached".logd(TAG) } override fun onFragmentAttached(fm: FragmentManager, f: Fragment, context: Context) { "${f::class.java.simpleName}->onAttached".logd(TAG) } override fun onFragmentPreCreated( fm: FragmentManager, f: Fragment, savedInstanceState: Bundle? ) { "${f::class.java.simpleName}->onPreCreated".logd(TAG) } override fun onFragmentCreated(fm: FragmentManager, f: Fragment, savedInstanceState: Bundle?) { "${f::class.java.simpleName}->onCreated".logd(TAG) } override fun onFragmentActivityCreated( fm: FragmentManager, f: Fragment, savedInstanceState: Bundle? ) { "${f::class.java.simpleName}->onActivityCreated".logd(TAG) } override fun onFragmentViewCreated( fm: FragmentManager, f: Fragment, v: View, savedInstanceState: Bundle? ) { "${f::class.java.simpleName}->onViewCreated".logd(TAG) } override fun onFragmentStarted(fm: FragmentManager, f: Fragment) { "${f::class.java.simpleName}->onStarted".logd(TAG) } override fun onFragmentResumed(fm: FragmentManager, f: Fragment) { "${f::class.java.simpleName}->onResumed".logd(TAG) } override fun onFragmentPaused(fm: FragmentManager, f: Fragment) { "${f::class.java.simpleName}->onPaused".logd(TAG) } override fun onFragmentStopped(fm: FragmentManager, f: Fragment) { "${f::class.java.simpleName}->onStopped".logd(TAG) } override fun onFragmentSaveInstanceState(fm: FragmentManager, f: Fragment, outState: Bundle) { "${f::class.java.simpleName}->onSaveInstanceState".logd(TAG) } override fun onFragmentViewDestroyed(fm: FragmentManager, f: Fragment) { "${f::class.java.simpleName}->onViewDestroyed".logd(TAG) } override fun onFragmentDestroyed(fm: FragmentManager, f: Fragment) { "${f::class.java.simpleName}->onDestroyed".logd(TAG) } override fun onFragmentDetached(fm: FragmentManager, f: Fragment) { "${f::class.java.simpleName}->onDetached".logd(TAG) } }
0
Kotlin
20
99
028a57af13c35df6d203a05abc43a15860ece6dd
2,721
kmvvm
Apache License 2.0
deob-bytecode/src/main/kotlin/org/openrs2/deob/bytecode/transform/FinalMethodTransformer.kt
openrs2
315,027,372
false
null
package org.openrs2.deob.bytecode.transform import com.github.michaelbull.logging.InlineLogger import org.objectweb.asm.Opcodes import org.objectweb.asm.tree.ClassNode import org.objectweb.asm.tree.MethodNode import org.openrs2.asm.MemberRef import org.openrs2.asm.classpath.ClassPath import org.openrs2.asm.classpath.Library import org.openrs2.asm.transform.Transformer import org.openrs2.util.collect.DisjointSet import javax.inject.Singleton @Singleton public class FinalMethodTransformer : Transformer() { private lateinit var inheritedMethodSets: DisjointSet<MemberRef> private var methodsChanged = 0 override fun preTransform(classPath: ClassPath) { inheritedMethodSets = classPath.createInheritedMethodSets() methodsChanged = 0 } private fun isMethodFinal(classPath: ClassPath, clazz: ClassNode, method: MethodNode): Boolean { if ((clazz.access and Opcodes.ACC_FINAL) != 0) { return false } else if (method.name == "<init>") { return false } else if ((method.access and (Opcodes.ACC_ABSTRACT or Opcodes.ACC_PRIVATE or Opcodes.ACC_STATIC)) != 0) { return false } val thisClass = classPath[clazz.name]!! val partition = inheritedMethodSets[MemberRef(clazz, method)]!! for (methodRef in partition) { if (methodRef.owner == clazz.name) { continue } val otherClass = classPath[methodRef.owner]!! if (otherClass.methods.none { it.name == methodRef.name && it.desc == methodRef.desc }) { continue } if (thisClass.isAssignableFrom(otherClass)) { return false } } return true } override fun preTransformMethod( classPath: ClassPath, library: Library, clazz: ClassNode, method: MethodNode ): Boolean { val access = method.access if (isMethodFinal(classPath, clazz, method)) { method.access = access or Opcodes.ACC_FINAL } else { method.access = access and Opcodes.ACC_FINAL.inv() } if (method.access != access) { methodsChanged++ } return false } override fun postTransform(classPath: ClassPath) { logger.info { "Updated final modifier on $methodsChanged methods" } } private companion object { private val logger = InlineLogger() } }
0
Kotlin
2
8
12eba96055ba13e8a8e3ec0ad3be7d93b3dd5b1b
2,495
openrs2
ISC License
app/src/main/java/ru/kartsev/dmitry/cinemadetails/common/di/StorageModule.kt
Jaguarhl
190,435,175
false
null
package ru.kartsev.dmitry.cinemadetails.common.di import androidx.room.Room import org.koin.core.module.Module import org.koin.core.qualifier.named import org.koin.dsl.module import ru.kartsev.dmitry.cinemadetails.common.config.StorageConfig import ru.kartsev.dmitry.cinemadetails.mvvm.model.database.MovieDatabase import ru.kartsev.dmitry.cinemadetails.mvvm.model.database.storage.CacheStorage import ru.kartsev.dmitry.cinemadetails.mvvm.model.database.storage.ConfigurationStorage import ru.kartsev.dmitry.cinemadetails.mvvm.model.database.storage.FavouritesStorage import ru.kartsev.dmitry.cinemadetails.mvvm.model.database.storage.LanguageStorage import ru.kartsev.dmitry.cinemadetails.mvvm.model.database.storage.MovieDetailsStorage object StorageModule { /** Section: Constants. */ private const val MOVIE_DATABASE_NAME = "storage.movie_database" /** Section: Modules. */ val it: Module = module { single(named(MOVIE_DATABASE_NAME)) { Room.databaseBuilder( get(), MovieDatabase::class.java, StorageConfig.DATABASE_NAME ).fallbackToDestructiveMigration() .build() } single { ConfigurationStorage(get()) } single { LanguageStorage(get()) } single { MovieDetailsStorage(get(), get(), get()) } single { FavouritesStorage(get()) } single { CacheStorage(get()) } single { get<MovieDatabase>(named(MOVIE_DATABASE_NAME)).configurationDao() } single { get<MovieDatabase>(named(MOVIE_DATABASE_NAME)).languagesDao() } single { get<MovieDatabase>(named(MOVIE_DATABASE_NAME)).movieDetailsDao() } single { get<MovieDatabase>(named(MOVIE_DATABASE_NAME)).genresDao() } single { get<MovieDatabase>(named(MOVIE_DATABASE_NAME)).movieVideosDao() } single { get<MovieDatabase>(named(MOVIE_DATABASE_NAME)).favouritesDao() } single { get<MovieDatabase>(named(MOVIE_DATABASE_NAME)).cacheDao() } } }
0
Kotlin
0
0
d80929fcb461249c074dfff73ce7156ee91ff074
2,240
MoviesDetails
Apache License 2.0
src/main/java/ir/mmd/intellijDev/Actionable/find/advanced/lang/AdvancedSearchFile.kt
MohammadMD1383
424,846,615
false
{"Kotlin": 278978, "Java": 42405, "Lex": 3746}
package ir.mmd.intellijDev.Actionable.find.advanced.lang import com.intellij.extapi.psi.PsiFileBase import com.intellij.psi.FileViewProvider import com.intellij.psi.util.PsiTreeUtil import ir.mmd.intellijDev.Actionable.find.advanced.lang.psi.AdvancedSearchPsiStatements import ir.mmd.intellijDev.Actionable.find.advanced.lang.psi.AdvancedSearchPsiTopLevelProperties class AdvancedSearchFile(viewProvider: FileViewProvider) : PsiFileBase(viewProvider, AdvancedSearchLanguage) { override fun getFileType() = AdvancedSearchFileType override fun toString() = "Advanced Search File" val properties: AdvancedSearchPsiTopLevelProperties? get() = PsiTreeUtil.getChildOfType(this, AdvancedSearchPsiTopLevelProperties::class.java) val statements: AdvancedSearchPsiStatements? get() = PsiTreeUtil.getChildOfType(this, AdvancedSearchPsiStatements::class.java) }
34
Kotlin
3
15
50ff939e52ce517022532cdee7d008c2ed95c3a1
864
Actionable
MIT License
app/src/main/java/com/sscustombottomnavigation/ui/FavoriteFragment.kt
SimformSolutionsPvtLtd
250,172,079
false
{"Kotlin": 61542, "Java": 7992}
package com.sscustombottomnavigation.ui import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import androidx.fragment.app.Fragment import com.sscustombottomnavigation.R import com.sscustombottomnavigation.databinding.FragmentFavoriteBinding import com.sscustombottomnavigation.databinding.FragmentHomeBinding class FavoriteFragment : Fragment() { private lateinit var binding: FragmentFavoriteBinding override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? ): View { if (!::binding.isInitialized) { binding = FragmentFavoriteBinding.inflate(inflater, container, false) } return binding.root } }
12
Kotlin
44
501
a4fa93aeca06f2ee0eb30ef45771cc71fb779dbc
784
SSCustomBottomNavigation
Apache License 2.0
replicator-test-utils/src/main/kotlin/ru/splite/replicator/demo/LogStoreAssert.kt
olgio
349,186,036
false
null
package ru.splite.replicator.demo import org.assertj.core.api.Assertions import ru.splite.replicator.log.ReplicatedLogStore class LogStoreAssert(private val logStores: List<ReplicatedLogStore>) { suspend fun hasOnlyTerms(vararg values: Long): LogStoreAssert { logStores.forEach { logStore -> Assertions.assertThat(logStore.fullLogSize).isEqualTo(values.size.toLong()) values.forEachIndexed { index, value -> Assertions.assertThat(logStore.getLogEntryByIndex(index.toLong())?.term).isEqualTo(value) } } return this } suspend fun <C> hasOnlyEntries(vararg values: C): LogStoreAssert { logStores.forEach { logStore -> Assertions.assertThat(logStore.fullLogSize).isEqualTo(values.size.toLong()) values.forEachIndexed { index, value -> Assertions.assertThat(logStore.getLogEntryByIndex(index.toLong())?.command).isEqualTo(value) } } return this } fun hasCommittedEntriesSize(committedSize: Long): LogStoreAssert { logStores.forEach { logStore -> Assertions.assertThat(logStore.lastCommitIndex()?.plus(1L) ?: 0L).isEqualTo(committedSize) } return this } suspend fun isCommittedEntriesInSync(): LogStoreAssert { val lastCommitIndex: Long? = logStores.firstOrNull()?.lastCommitIndex() logStores.forEach { logStore -> Assertions.assertThat(logStore.lastCommitIndex()).isEqualTo(lastCommitIndex) } if (lastCommitIndex != null) { (0..lastCommitIndex).forEach { index -> Assertions.assertThat(logStores.map { it.getLogEntryByIndex(index) }.toSet()).hasSize(1) } } return this } private val ReplicatedLogStore.fullLogSize: Long get() = this.lastLogIndex()?.plus(1L) ?: 0L companion object { fun assertThatLogs(vararg logStores: ReplicatedLogStore): LogStoreAssert { return LogStoreAssert(logStores.toList()) } } }
0
Kotlin
0
0
dea389a4db73c5c16e69cdea9964333cecd86a49
2,115
replicator
Apache License 2.0
sample/shared/src/iosMain/kotlin/com/r0adkll/kimchi/restaurant/RestaurantUiViewController.kt
r0adkll
842,714,606
false
{"Kotlin": 143107, "Shell": 3091}
// Copyright (C) 2020 r0adkll // SPDX-License-Identifier: Apache-2.0 package com.r0adkll.kimchi.restaurant import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.ui.Modifier import androidx.compose.ui.interop.LocalUIViewController import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.platform.LocalViewConfiguration import androidx.compose.ui.platform.ViewConfiguration import androidx.compose.ui.unit.dp import androidx.compose.ui.window.ComposeUIViewController import com.r0adkll.kimchi.restaurant.common.screens.MenuScreen import com.r0adkll.kimchi.restaurant.root.RestaurantContent import com.slack.circuit.backstack.rememberSaveableBackStack import com.slack.circuit.foundation.rememberCircuitNavigator import me.tatarka.inject.annotations.Inject import platform.UIKit.UIViewController typealias RestaurantUiViewController = () -> UIViewController @Inject fun RestaurantUiViewController( restaurantContent: RestaurantContent, ): UIViewController = ComposeUIViewController { val backstack = rememberSaveableBackStack(listOf(MenuScreen)) val navigator = rememberCircuitNavigator(backstack, onRootPop = { /* no-op */ }) val uiViewController = LocalUIViewController.current // Increase the touch slop. The default value of 3.dp is a bit low imo, so we use the // Android default value of 8.dp // https://github.com/JetBrains/compose-multiplatform/issues/3397 val vc = LocalViewConfiguration.current.withTouchSlop( with(LocalDensity.current) { 8.dp.toPx() }, ) CompositionLocalProvider(LocalViewConfiguration provides vc) { restaurantContent( backstack, navigator, Modifier, ) } } private fun ViewConfiguration.withTouchSlop( touchSlop: Float, ): ViewConfiguration = object : ViewConfiguration by this { override val touchSlop: Float = touchSlop }
7
Kotlin
1
8
4c1b05096184ca4db4dac41104940ef2a70fc67a
1,860
kimchi
Apache License 2.0
app/src/main/java/com/bytepoets/sample/androidtesting/network/model/TransactionsResponse.kt
BYTEPOETS
357,600,203
false
null
package com.bytepoets.sample.androidtesting.network.model import com.squareup.moshi.JsonClass import java.time.LocalDate import java.util.* @JsonClass(generateAdapter = true) data class TransactionsResponse( val data: List<Transaction> ) @JsonClass(generateAdapter = true) data class Transaction( val _id: String, val subject: String, val currency: CurrencyCode, val amount: Double, val createdAt: LocalDate, ) enum class CurrencyCode { UNKNOWN, USD, EUR, CHF, } /* Generate sample data with https://www.json-generator.com { data: [ '{{repeat(12, 17)}}', { _id: '{{objectId()}}', name: '{{firstName()}} {{surname()}}', gender: '{{gender()}}', company: '{{company().toUpperCase()}}', email: '{{email()}}', phone: '+1 {{phone()}}', address: '{{integer(100, 999)}} {{street()}}, {{city()}}, {{state()}}, {{integer(100, 10000)}}', subject: '{{lorem(5, "words")}}', amount: '{{floating(-4000, 4000, 2)}}', currency: '{{random("EUR","USD","CHF")}}', createdAt: '{{date(new Date(2014, 0, 1), new Date(), "YYYY-MM-ddThh:mm:ssZ")}}' } ] } */
0
Kotlin
0
2
702f1d8047bded514d6aa38cfd633e00d3432e01
1,162
android-testing
MIT License
server/src/main/kotlin/br/com/devsrsouza/kotlinbukkitapi/server/extensions/Chat.kt
Stanicc
201,663,593
true
{"Kotlin": 383292}
package br.com.devsrsouza.kotlinbukkitapi.server.extensions import br.com.devsrsouza.kotlinbukkitapi.server.Server import br.com.devsrsouza.kotlinbukkitapi.server.api.chat.ChatMessageType import net.md_5.bungee.api.chat.BaseComponent import org.bukkit.entity.Player fun Player.sendTitle( title: String? = null, subtitle: String? = null, fadeIn: Int = 10, stay: Int = 70, fadeOut: Int = 20 ) = Server.Chat.title.sendTitle(this, title, subtitle, fadeIn, stay, fadeOut) fun Player.resetTitle() = Server.Chat.title.resetTitle(this) fun Player.sendActionBar( message: BaseComponent ) = Server.Chat.chat.sendActionBar(this, message) fun Player.sendMessage( type: ChatMessageType, message: BaseComponent ) = Server.Chat.chat.sendMessage(this, type, message) fun Player.msg( type: ChatMessageType, message: BaseComponent ) = sendMessage(type, message)
0
Kotlin
0
1
0c0ea64fc553cc3152376e3eaa52a24b409d1754
929
KotlinBukkitAPI
MIT License
app/src/main/java/com/adriandeleon/friends/signup/SignUpScreen.kt
adriandleon
377,688,121
false
null
package com.adriandeleon.friends.signup import androidx.annotation.StringRes import androidx.compose.animation.AnimatedVisibility import androidx.compose.animation.ExperimentalAnimationApi import androidx.compose.animation.core.FastOutLinearInEasing import androidx.compose.animation.core.LinearOutSlowInEasing import androidx.compose.animation.core.tween import androidx.compose.animation.fadeOut import androidx.compose.animation.slideInVertically import androidx.compose.foundation.layout.* import androidx.compose.material.* import androidx.compose.material.MaterialTheme.typography import androidx.compose.runtime.* import androidx.compose.runtime.livedata.observeAsState import androidx.compose.ui.Modifier import androidx.compose.ui.platform.testTag import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.input.PasswordVisualTransformation import androidx.compose.ui.text.input.VisualTransformation import androidx.compose.ui.unit.dp import com.adriandeleon.friends.R import com.adriandeleon.friends.signup.state.SignUpScreenState import com.adriandeleon.friends.signup.state.SignUpState @Composable fun SignUpScreen( signUpViewModel: SignUpViewModel, onSignedUp: () -> Unit ) { val coroutineScope = rememberCoroutineScope() val screenState by remember { mutableStateOf(SignUpScreenState(coroutineScope)) } val signUpState by signUpViewModel.signUpState.observeAsState() when (signUpState) { is SignUpState.SignedUp -> onSignedUp() is SignUpState.BadEmail -> screenState.isBadEmail = true is SignUpState.BadPassword -> screenState.isBadPassword = true is SignUpState.DuplicateAccount -> screenState.toggleInfoMessage(R.string.duplicateAccountError) is SignUpState.BackendError -> screenState.toggleInfoMessage(R.string.createAccountError) is SignUpState.Offline -> screenState.toggleInfoMessage(R.string.offlineError) } Box(modifier = Modifier.fillMaxSize()) { Column( modifier = Modifier .fillMaxSize() .padding(16.dp) ) { ScreenTitle(R.string.createAnAccount) Spacer(modifier = Modifier.height(16.dp)) EmailField( value = screenState.email, isError = screenState.showBadEmail, onValueChange = { screenState.email = it } ) PasswordField( value = screenState.password, isError = screenState.showBadPassword, onValueChange = { screenState.password = it } ) AboutField( value = screenState.about, onValueChange = { screenState.about = it } ) Spacer(modifier = Modifier.height(8.dp)) Button( modifier = Modifier.fillMaxWidth(), onClick = { screenState.resetUiState() with(screenState) { signUpViewModel.createAccount(email, password, about) } } ) { Text(text = stringResource(id = R.string.signUp)) } } InfoMessage( isVisible = screenState.isInfoMessageShowing, stringResource = screenState.currentInfoMessage ) } } @OptIn(ExperimentalAnimationApi::class) @Composable fun InfoMessage( isVisible: Boolean, @StringRes stringResource: Int, ) { AnimatedVisibility( visible = isVisible, enter = slideInVertically( initialOffsetY = { fullHeight -> -fullHeight }, animationSpec = tween(durationMillis = 150, easing = FastOutLinearInEasing) ), exit = fadeOut( targetAlpha = 0f, animationSpec = tween(durationMillis = 250, easing = LinearOutSlowInEasing) ) ) { Surface( modifier = Modifier.fillMaxWidth(), color = MaterialTheme.colors.error, elevation = 4.dp ) { Row( modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.Center ) { Text( modifier = Modifier.padding(16.dp), text = stringResource(id = stringResource), color = MaterialTheme.colors.onError ) } } } } @Composable private fun ScreenTitle(@StringRes resourceId: Int) { Row( modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.Center ) { Text( text = stringResource(id = resourceId), style = typography.h4 ) } } @Composable private fun EmailField( value: String, isError: Boolean, onValueChange: (String) -> Unit ) { OutlinedTextField( modifier = Modifier .fillMaxWidth() .testTag(stringResource(id = R.string.email)), value = value, isError = isError, label = { val resource = if (isError) R.string.badEmailError else R.string.email Text(text = stringResource(id = resource)) }, onValueChange = onValueChange ) } @Composable private fun PasswordField( value: String, isError: Boolean, onValueChange: (String) -> Unit ) { var isVisible by remember { mutableStateOf(false) } val visualTransformation = if (isVisible) { VisualTransformation.None } else { PasswordVisualTransformation() } OutlinedTextField( modifier = Modifier .fillMaxWidth() .testTag(stringResource(id = R.string.password)), value = value, isError = isError, trailingIcon = { VisibilityToggle(isVisible) { isVisible = !isVisible } }, visualTransformation = visualTransformation, label = { val resource = if (isError) R.string.badPasswordError else R.string.password Text(text = stringResource(id = resource)) }, onValueChange = onValueChange ) } @Composable private fun VisibilityToggle( isVisible: Boolean, onToggle: () -> Unit ) { val resource = if (isVisible) R.drawable.ic_invisible else R.drawable.ic_invisible IconButton(onClick = { onToggle() }) { Icon( painter = painterResource(id = resource), contentDescription = stringResource(id = R.string.toggleVisibility) ) } } @Composable fun AboutField( value: String, onValueChange: (String) -> Unit ) { OutlinedTextField( modifier = Modifier.fillMaxWidth(), value = value, label = { Text(text = stringResource(id = R.string.about)) }, onValueChange = onValueChange ) }
0
Kotlin
0
0
e688f8a7140250ec18cb5facb8280c5f69e562c8
6,937
friends
Apache License 2.0
lib/smoothcrawler/main/kotlin/org/smoothcrawler/component/data/BaseHttpResponseParser.kt
Chisanan232
518,326,758
false
null
package org.smoothcrawler.component.data /** * Content ... */ interface BaseHttpResponseParser { /** * Content ... */ fun parseContent(response: Any): Any }
0
Kotlin
0
0
2253d82eca5257801f38cd20bd053bcce085cdbb
180
SmoothCrawler-Kotlin
MIT License
server/data/src/main/kotlin/com/studystream/data/database/setup/Database.kt
ImpossibleAccuracy
834,219,225
false
{"Kotlin": 158719, "Dockerfile": 625}
package com.studystream.data.database.setup import com.studystream.domain.properties.DatabaseProperties import com.zaxxer.hikari.HikariDataSource import org.jetbrains.exposed.sql.Database fun createDatabase(properties: DatabaseProperties): Database { val config = createHikariConfig(properties) val dataSource = HikariDataSource(config) return Database.connect( datasource = dataSource, ) }
0
Kotlin
0
0
926d410c2edb95ff2d4ee5e4f36eab138fcff9f4
419
study-stream
The Unlicense
app/src/main/java/ar/com/wolox/android/cookbook/lottie/LottieRecipeActivity.kt
Wolox
151,121,373
false
null
package ar.com.wolox.android.cookbook.lottie import ar.com.wolox.android.cookbook.R import ar.com.wolox.android.cookbook.databinding.ActivityBaseBinding import ar.com.wolox.wolmo.core.activity.WolmoActivity class LottieRecipeActivity : WolmoActivity<ActivityBaseBinding>() { override fun layout(): Int = R.layout.activity_base override fun init() = replaceFragment(R.id.vActivityBaseContent, LottieRecipeFragment.newInstance()) }
3
Kotlin
8
9
10c61b24b6c8812aa039441bfea709bfac29668c
441
wolmo-cookbook-android
MIT License
timemanagement/src/main/kotlin/parkandrest/timemanagement/SystemTimeManager.kt
pokemzok
166,366,410
false
null
package parkandrest.timemanagement import java.time.LocalDateTime object SystemTimeManager { private var changedTimeValue: LocalDateTime? = null val systemDateTime: LocalDateTime get() = changedTimeValue ?: LocalDateTime.now() fun maxSystemDateTime(): LocalDateTime { return LocalDateTime.of(9999, 12, 31, 23, 59) } fun changeDateTo(dateTime: LocalDateTime): LocalDateTime { if(!dateTime.isBefore(LocalDateTime.now())){ changedTimeValue = dateTime return systemDateTime } throw TimeManagerException("Can not change time to value from the past") } fun incrementSystemDateTimeByHours(hours: Long): LocalDateTime { val incrementedDateTime = LocalDateTime.now().plusHours(hours) val maxSystemDate = maxSystemDateTime() if (incrementedDateTime.isAfter(maxSystemDate)) { throw TimeManagerException("Incremented time value ($incrementedDateTime) is bigger than maximal supported value ($maxSystemDate)") } changedTimeValue = incrementedDateTime return systemDateTime } fun restoreSystemDateTimeToCurrentMoment(): LocalDateTime { changedTimeValue = null return systemDateTime } }
0
Kotlin
0
1
f079ade5c5407ac1d41dfb3432f8ba1b10c1b274
1,261
parkandrest-kotlin
MIT License
lint/src/test/kotlin/databinding/lint/ExpressionDetectorTest.kt
annypatel
169,043,818
false
null
package databinding.lint import com.android.tools.lint.checks.infrastructure.LintDetectorTest.TestFile import com.android.tools.lint.checks.infrastructure.TestFiles.xml import com.android.tools.lint.checks.infrastructure.TestLintResult import com.android.tools.lint.checks.infrastructure.TestLintTask import org.junit.Test class ExpressionDetectorTest { private fun lint(expression: String): TestLintResult { return TestLintTask.lint() .files(withExpression(expression)) .issues(*ExpressionDetector.ISSUES.toTypedArray()) .run() } private fun withExpression(expression: String): TestFile { return xml( "res/layout/example.xml", """ |<?xml version="1.0" encoding="utf-8"?> |<TextView xmlns:android="http://schemas.android.com/apk/res/android" | android:layout_width="wrap_content" | android:layout_height="wrap_content" | android:text="@{$expression}" /> """.trimMargin() ) } @Test fun testCastOperator() { lint("(A) a") .expect( """ |res/layout/example.xml:5: Error: Cast operator in binding expression [CastOperator] | android:text="@{(A) a}" /> | ~~~~~~~~~~~~~~~~~~~~~~~ |1 errors, 0 warnings """.trimMargin() ) } @Test fun testUnaryOperator() { lint("+a") .expect( """ |res/layout/example.xml:5: Error: Unary operator in binding expression [UnaryOperator] | android:text="@{+a}" /> | ~~~~~~~~~~~~~~~~~~~~ |1 errors, 0 warnings """.trimMargin() ) } @Test fun testMathOperator() { lint("a + b") .expect( """ |res/layout/example.xml:5: Error: Mathematical operator in binding expression [MathOperator] | android:text="@{a + b}" /> | ~~~~~~~~~~~~~~~~~~~~~~~ |1 errors, 0 warnings """.trimMargin() ) } @Test fun testBitShiftOperator() { lint("a >> b") .expect( """ |res/layout/example.xml:5: Error: Bit-shift operator in binding expression [BitShiftOperator] | android:text="@{a >> b}" /> | ~~~~~~~~~~~~~~~~~~~~~~~~ |1 errors, 0 warnings """.trimMargin() ) } @Test fun testCompareOperator() { lint("a > b") .expect( """ |res/layout/example.xml:5: Error: Comparison operator in binding expression [CompareOperator] | android:text="@{a > b}" /> | ~~~~~~~~~~~~~~~~~~~~~~~ |1 errors, 0 warnings """.trimMargin() ) } @Test fun testInstanceOfOperator() { lint("a instanceof b") .expect( """ |res/layout/example.xml:5: Error: InstanceOf operator in binding expression [InstanceOfOperator] | android:text="@{a instanceof b}" /> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |1 errors, 0 warnings """.trimMargin() ) } @Test fun testBinaryOperator() { lint("a | b") .expect( """ |res/layout/example.xml:5: Error: Binary operator in binding expression [BinaryOperator] | android:text="@{a | b}" /> | ~~~~~~~~~~~~~~~~~~~~~~~ |1 errors, 0 warnings """.trimMargin() ) } @Test fun testAndOrOperator() { lint("a || b") .expect( """ |res/layout/example.xml:5: Error: AndOr operator in binding expression [AndOrOperator] | android:text="@{a || b}" /> | ~~~~~~~~~~~~~~~~~~~~~~~~ |1 errors, 0 warnings """.trimMargin() ) } @Test fun testTernaryOperator() { lint("a > b ? a : b") .expect( """ |res/layout/example.xml:5: Error: Comparison operator in binding expression [CompareOperator] | android:text="@{a > b ? a : b}" /> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |res/layout/example.xml:5: Error: Ternary operator in binding expression [TernaryOperator] | android:text="@{a > b ? a : b}" /> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |2 errors, 0 warnings """.trimMargin() ) } @Test fun testNullCoalescingOperator() { lint("a ?? b") .expect( """ |res/layout/example.xml:5: Error: Null Coalescing operator in binding expression [NullCoalescingOperator] | android:text="@{a ?? b}" /> | ~~~~~~~~~~~~~~~~~~~~~~~~ |1 errors, 0 warnings """.trimMargin() ) } @Test fun testGroupOperator() { lint("(a)") .expect( """ |res/layout/example.xml:5: Error: Group operator in binding expression [GroupOperator] | android:text="@{(a)}" /> | ~~~~~~~~~~~~~~~~~~~~~ |1 errors, 0 warnings """.trimMargin() ) } @Test fun testBracketOperator() { lint("a[b]") .expect( """ |res/layout/example.xml:5: Error: Bracket operator in binding expression [BracketOperator] | android:text="@{a[b]}" /> | ~~~~~~~~~~~~~~~~~~~~~~ |1 errors, 0 warnings """.trimMargin() ) } @Test fun testClassExtractionExpression() { lint("a.class") .expect( """ |res/layout/example.xml:5: Error: Class extraction in binding expression [ClassExtractionExpression] | android:text="@{a.class}" /> | ~~~~~~~~~~~~~~~~~~~~~~~~~ |1 errors, 0 warnings """.trimMargin() ) } @Test fun testLiteralExpression() { lint("1") .expect( """ |res/layout/example.xml:5: Error: Literal in binding expression [LiteralExpression] | android:text="@{1}" /> | ~~~~~~~~~~~~~~~~~~~ |1 errors, 0 warnings """.trimMargin() ) } @Test fun testMethodCallExpression() { lint("a.b()") .expect( """ |res/layout/example.xml:5: Error: Method call in binding expression [MethodCallExpression] | android:text="@{a.b()}" /> | ~~~~~~~~~~~~~~~~~~~~~~~ |1 errors, 0 warnings """.trimMargin() ) } @Test fun testGlobalMethodCallExpression() { lint("a()") .expect( """ |res/layout/example.xml:5: Error: Global method call in binding expression [GlobalMethodCallExpression] | android:text="@{a()}" /> | ~~~~~~~~~~~~~~~~~~~~~ |1 errors, 0 warnings """.trimMargin() ) } @Test fun testDotOperator() { lint("a.b").expectClean() lint("a.b.c").expectClean() } @Test fun testResourceExpressions() { lint("@string/a").expectClean() lint("@string/a(b)").expectClean() lint("@plurals/a(b)").expectClean() lint("@color/a").expectClean() lint("@dimen/a").expectClean() lint("@drawable/a").expectClean() lint("@layout/a").expectClean() lint("@anim/a").expectClean() lint("@id/a").expectClean() lint("@integer/a").expectClean() lint("@bool/a").expectClean() lint("@stringArray/a").expectClean() lint("@intArray/a").expectClean() lint("@typedArray/a").expectClean() lint("@animator/a").expectClean() lint("@stateListAnimator/a").expectClean() lint("@colorStateList/a").expectClean() } @Test fun testLambdaExpressions() { lint("() -> a.b()").expectClean() lint("(x) -> a.b(x)").expectClean() lint("() -> b()").expectClean() lint("(x) -> b(x)").expectClean() } @Test fun testFunctionalReferenceExpression() { lint("a::b").expectClean() } }
0
Kotlin
0
4
0f3d6135068feeed305708ad09412bde253e295b
8,932
databinding-lint
Apache License 2.0
kotlintest-extensions/kotlintest-extensions-spring/src/test/kotlin/io/kotlintest/spring/SpringAutowiredConstructorTest.kt
MichaelYan08
128,386,761
true
{"Kotlin": 415205, "Java": 1380}
package io.kotlintest.spring import io.kotlintest.samples.spring.Components import io.kotlintest.samples.spring.UserService import io.kotlintest.shouldBe import io.kotlintest.specs.WordSpec import org.springframework.test.context.ContextConfiguration @ContextConfiguration(classes = [(Components::class)]) class SpringAutowiredConstructorTest(service: UserService) : WordSpec() { init { "SpringListener" should { "have autowired the service" { service.repository.findUser().name shouldBe "system_user" } } } }
0
Kotlin
0
0
f57ac8ecdc70c242e01e79fb83a43ac994579893
543
kotlintest
Apache License 2.0
plugin-apipost/src/main/kotlin/me/leon/toolsfx/plugin/net/Request.kt
Leon406
381,644,086
false
null
package me.leon.toolsfx.plugin.net data class Request( var url: String, var method: String = "GET", val params: MutableMap<String, Any> = mutableMapOf(), val headers: MutableMap<String, Any> = mutableMapOf(), var rawBody: String = "" ) { var isJson = false var fileParamName = "" }
4
Kotlin
209
941
bfbdc980e6c0eade4612be955845ba4d8bcefde4
311
ToolsFx
ISC License
app/src/main/java/com/example/music_player/Song.kt
javierortizmi
737,418,961
false
{"Kotlin": 31232}
package com.example.music_player class Song( private var artist: String = "", private var imageUrl: String = "", private var like: Boolean = false, private var mediaId: String = "", private var songUrl: String = "", private var title: String = "" ) { // Getters and Setters fun getArtist(): String { return artist } fun setArtist(artist: String) { this.artist = artist } fun getImageUrl(): String { return imageUrl } fun setImageUrl(imageUrl: String) { this.imageUrl = imageUrl } fun getLike(): Boolean { return like } fun setLike(like: Boolean) { this.like = like } fun getMediaId(): String { return mediaId } fun setMediaId(mediaId: String) { this.mediaId = mediaId } fun getSongUrl(): String { return songUrl } fun setSongUrl(songUrl: String) { this.songUrl = songUrl } fun getTitle(): String { return title } fun setTitle(title: String) { this.title = title } // toString() override fun toString(): String { return "Song ID: ${getMediaId()}, Title: ${getTitle()}, Artist: ${getArtist()}, Favourite: ${getLike()}" } }
0
Kotlin
0
1
c1a8e8c42dcd85e7aa4cc477eeab36212e2f4ae7
1,268
audio-streaming-app
MIT License
di/src/main/java/com/skoumal/teanity/di/Teanity.kt
skoumalcz
138,592,452
false
null
package com.skoumal.teanity.di import android.content.Context import com.skoumal.teanity.di.module.genericModule import org.koin.android.ext.koin.androidContext import org.koin.core.context.startKoin import org.koin.core.module.Module object Teanity { @JvmStatic fun modules() = listOf(genericModule) @JvmStatic fun startWith(_context: Context, vararg modules: Module) { startWith(_context, modules.toList()) } @JvmStatic fun startWith(_context: Context, modules: List<Module>) { val context = _context.applicationContext startKoin { androidContext(context) modules(modules + [email protected]()) } } }
0
null
3
8
38e9ea2fe31ef7e6e52e6ad807413b4caa2322a4
699
teanity
Apache License 2.0
features/quiz/src/main/java/com/zigis/paleontologas/features/quiz/stories/progress/QuizProgressViewDelegate.kt
edgar-zigis
240,962,785
false
{"Kotlin": 184730}
package com.zigis.paleontologas.features.quiz.stories.progress interface QuizProgressViewDelegate { fun onStartQuiz() fun onBackInvoked() }
0
Kotlin
16
122
5e8d658e8898a4c55c2f11f5dc54438c876ae8a3
148
Paleontologas
Apache License 2.0
modules/taginput/src/main/kotlin/component.kt
lb1987
224,438,645
false
{"Kotlin": 60839}
package ringui.tagInput import react.RBuilder import react.RHandler import ringui.RClassnameProps import ringui.icon.Icon import kotlin.js.Promise data class Tag(var key: String, val label: String, val icon: Icon? = null) interface TagsInputProps : RClassnameProps { var tags: Array<Tag> var dataSource: Promise<Array<Tag>> var onAddTag: () -> Unit var onRemoveTag: () -> Unit //fixme // customTagComponent: (props, propName, componentName) => var maxPopupHeight: Int var minPopupWidth: Int var placeholder: String var canNotBeEmpty: Boolean var disabled: Boolean var autoOpen: Boolean var renderOptimization: Boolean var loadingMessage: String var notFoundMessage: String } fun RBuilder.tagsInput(disabled: Boolean? = null, block: RHandler<TagsInputProps> = {}) = child(TagsInput::class) { disabled?.let { attrs.disabled = disabled } block() }
0
null
0
1
651523da1df6f358553b5b21f09ac63fd5aed8e0
923
kotlin-react-ring-ui
MIT License
app/src/main/java/com/zzr/jetpacktest/entity/AndroidtoJs.kt
zrzhong
288,220,143
false
null
package com.zzr.jetpacktest.entity import android.util.Log import android.webkit.JavascriptInterface /** * @Author zzr * @Desc * @Date 2020/10/15 */ class AndroidtoJs { //定义js需要调用的方法 @JavascriptInterface public fun hello(msg: String) { Log.i("TAG", "hello==$msg") } }
1
null
1
1
7765544fd6df3d615dadbe03f7df1daaac7aa1ab
298
JetpackTest
Apache License 2.0
simple-icons/src/commonMain/kotlin/compose/icons/simpleicons/Arlo.kt
DevSrSouza
311,134,756
false
null
package compose.icons.simpleicons import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.PathFillType.Companion.NonZero import androidx.compose.ui.graphics.SolidColor import androidx.compose.ui.graphics.StrokeCap.Companion.Butt import androidx.compose.ui.graphics.StrokeJoin.Companion.Miter import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.graphics.vector.ImageVector.Builder import androidx.compose.ui.graphics.vector.path import androidx.compose.ui.unit.dp import compose.icons.SimpleIcons public val SimpleIcons.Arlo: ImageVector get() { if (_arlo != null) { return _arlo!! } _arlo = Builder(name = "Arlo", defaultWidth = 24.0.dp, defaultHeight = 24.0.dp, viewportWidth = 24.0f, viewportHeight = 24.0f).apply { path(fill = SolidColor(Color(0xFF000000)), stroke = null, strokeLineWidth = 0.0f, strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = 4.0f, pathFillType = NonZero) { moveTo(21.493f, 16.075f) curveToRelative(1.38f, 1.042f, 2.642f, 2.295f, 2.495f, 2.218f) curveToRelative(-3.829f, -2.005f, -6.533f, -1.494f, -7.6f, -0.805f) curveToRelative(-4.155f, 2.683f, -7.952f, -1.534f, -9.87f, -4.341f) curveToRelative(-0.63f, -0.918f, -6.518f, -0.87f, -6.518f, -0.87f) curveToRelative(0.47f, -0.347f, 5.526f, -0.414f, 6.593f, -1.613f) curveToRelative(2.145f, -2.409f, 4.027f, -2.14f, 5.558f, -1.4f) curveToRelative(0.21f, 0.1f, 0.567f, 0.325f, 1.02f, 0.633f) verticalLineToRelative(1.712f) curveToRelative(-0.983f, -0.623f, -1.726f, -1.08f, -1.885f, -1.147f) curveToRelative(-0.556f, -0.235f, -1.573f, -0.886f, -3.084f, 0.067f) curveToRelative(-1.652f, 1.043f, -0.024f, 2.892f, 1.28f, 4.403f) curveToRelative(1.64f, 1.905f, 4.531f, 3.538f, 7.318f, 0.571f) curveToRelative(0.559f, -0.593f, 2.888f, 0.303f, 2.888f, 0.303f) reflectiveCurveToRelative(-1.941f, -1.264f, -3.962f, -2.565f) horizontalLineToRelative(2.035f) curveToRelative(1.65f, 1.243f, 3.156f, 2.398f, 3.732f, 2.834f) moveTo(10.302f, 11.84f) arcToRelative(0.797f, 0.797f, 0.0f, false, true, -0.788f, 0.806f) arcToRelative(0.797f, 0.797f, 0.0f, false, true, -0.787f, -0.806f) curveToRelative(0.0f, -0.445f, 0.352f, -0.807f, 0.787f, -0.807f) curveToRelative(0.436f, 0.0f, 0.788f, 0.362f, 0.788f, 0.807f) moveToRelative(6.847f, -2.636f) arcToRelative(4.217f, 4.217f, 0.0f, false, true, 1.192f, 2.965f) horizontalLineToRelative(-1.08f) arcToRelative(3.099f, 3.099f, 0.0f, false, false, -0.876f, -2.182f) arcToRelative(2.953f, 2.953f, 0.0f, false, false, -2.098f, -0.9f) verticalLineTo(7.984f) arcToRelative(4.02f, 4.02f, 0.0f, false, true, 2.862f, 1.22f) moveToRelative(1.688f, -1.567f) arcToRelative(6.807f, 6.807f, 0.0f, false, true, 1.932f, 4.53f) horizontalLineToRelative(-1.202f) arcToRelative(5.537f, 5.537f, 0.0f, false, false, -1.57f, -3.67f) arcToRelative(5.286f, 5.286f, 0.0f, false, false, -3.71f, -1.613f) verticalLineToRelative(-1.23f) arcToRelative(6.486f, 6.486f, 0.0f, false, true, 4.55f, 1.982f) moveToRelative(-3.22f, 3.136f) curveToRelative(0.375f, 0.382f, 0.56f, 0.885f, 0.558f, 1.388f) horizontalLineToRelative(-1.888f) verticalLineToRelative(-1.956f) curveToRelative(0.501f, 0.005f, 0.98f, 0.21f, 1.33f, 0.57f) close() } } .build() return _arlo!! } private var _arlo: ImageVector? = null
17
null
25
571
a660e5f3033e3222e3553f5a6e888b7054aed8cd
4,060
compose-icons
MIT License
src/main/kotlin/com/github/michaelbull/advent2023/day25/Day25.kt
michaelbull
726,012,340
false
{"Kotlin": 182829}
package com.github.michaelbull.advent2023.day25 import com.github.michaelbull.advent2023.Puzzle object Day25 : Puzzle<WiringDiagram, Int>(day = 25) { override fun parse(lines: Sequence<String>): WiringDiagram { return lines.toWiringDiagram() } override fun solutions() = listOf( ::part1, ) fun part1(input: WiringDiagram): Int { val (first, second) = input.disconnectedGroups() return first.size * second.size } }
0
Kotlin
0
1
045b8fa21e45b17de76cf021d662865b010920ef
475
advent-2023
ISC License
app/src/main/java/ch/admin/foitt/pilotwallet/platform/navArgs/domain/model/CredentialOfferNavArg.kt
e-id-admin
775,912,525
false
{"Kotlin": 1521284}
package ch.admin.foitt.pilotwallet.platform.navArgs.domain.model data class CredentialOfferNavArg(val credentialId: Long)
1
Kotlin
1
4
6572b418ec5abc5d94b18510ffa87a1e433a5c82
123
eidch-pilot-android-wallet
MIT License
aoc_2023/src/main/kotlin/problems/day17/CrucibleCity.kt
Cavitedev
725,682,393
false
{"Kotlin": 228779}
package problems.day17 class CrucibleCity(lines: List<String>) { val grid: List<List<Int>> = lines.map { line -> line.map { char -> char.digitToInt() } } fun minimumHeastLoss(): Int { val search = CrucibleSearch(this) return search.minimumHeastLoss() } fun minimumHeastLossUltraCrucible(): Int { val search = UltraCrucibleSearch(this) return search.minimumHeastLoss() } }
0
Kotlin
0
1
aa7af2d5aa0eb30df4563c513956ed41f18791d5
428
advent-of-code-2023
MIT License
src/main/kotlin/ru/timakden/bank/model/dto/request/CreateClientRequest.kt
timakden
252,707,159
false
{"Kotlin": 39560, "Dockerfile": 407}
package ru.timakden.bank.model.dto.request import ru.timakden.bank.model.entity.Client import java.time.LocalDate /** * @author <NAME> (<EMAIL>) * Created on 07.04.2020. */ data class CreateClientRequest( val fullName: String, val birthDate: LocalDate, val phoneNumber: String ) { fun toEntity(): Client = Client(fullName = fullName, birthDate = birthDate, phoneNumber = phoneNumber) fun isValid(): Boolean = fullName.isNotBlank() && phoneNumber.isNotBlank() && birthDate.isBefore(LocalDate.now()) }
0
Kotlin
0
0
85a74df5c5395080a7334653493f97a875002370
526
bank-account-management
MIT License
src/main/kotlin/ua/kurinnyi/jaxrs/auto/mock/jersey/JerseyInternalResponseBodyProvider.kt
Kurinnyi
153,566,842
false
null
package ua.kurinnyi.jaxrs.auto.mock.jersey import ua.kurinnyi.jaxrs.auto.mock.extensions.ResponseBodyProvider import java.lang.reflect.Type class JerseyInternalResponseBodyProvider(private val jerseyInternalsFilter: JerseyInternalsFilter): ResponseBodyProvider { override fun <T> provideBodyObjectFromString(type: Class<T>, genericType: Type, bodyString: String) = jerseyInternalsFilter.prepareResponse(type, genericType, bodyString) override fun provideBodyString(bodyInformation: String): String = bodyInformation override fun <T> objectToString(value: T, type: Class<T>, genericType: Type): String { return jerseyInternalsFilter.toJson(value, type, genericType) } }
0
Kotlin
1
5
a100b58f2092fc2dd57a474e644706d24681c11f
709
Jax-Rs-Auto-Mock
MIT License
wcmodel/src/main/kotlin/at/triply/wcmodel/WcModel.kt
triply-at
139,441,256
false
{"Kotlin": 37612}
package at.triply.wcmodel import at.triply.wcmodel.converters.LocalDateTimeConverter import com.google.gson.FieldNamingPolicy import com.google.gson.GsonBuilder import com.google.gson.reflect.TypeToken import java.time.LocalDateTime object WcModel { fun getGson() = GsonBuilder() .setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES) .registerTypeAdapter(TypeToken.get(LocalDateTime::class.java).type, LocalDateTimeConverter()) .create() }
0
Kotlin
2
1
d7ede01957fd0eb3adf55af5e5708b3a3bf7cadd
496
wcapi
The Unlicense
Kotlin-Samples-Android/app/src/androidTest/kotlin/SharedPreferencesTest.kt
PacktPublishing
126,314,798
false
null
import android.preference.PreferenceManager import androidx.core.content.edit import androidx.test.InstrumentationRegistry import androidx.test.runner.AndroidJUnit4 import org.junit.Assert.assertSame import org.junit.Test import org.junit.runner.RunWith @RunWith(AndroidJUnit4::class) class SharedPreferencesTest { @Test fun testSharedPrefs() { // given val sharedPrefs = getDefaultSharedPreferences() val userName: String = "Gonzo" // when sharedPrefs.edit { putString("user_name", userName) } // then val DEFAULT_VALUE = "empty" val fetchedUserName = sharedPrefs.getString("user_name", DEFAULT_VALUE) assertSame(userName, fetchedUserName) } private fun getDefaultSharedPreferences() = PreferenceManager.getDefaultSharedPreferences(InstrumentationRegistry.getContext()) }
0
Kotlin
24
26
a9118396250ded6f4466c20fd0dc62ea6a598ed1
897
Kotlin-Standard-Library-Cookbook
MIT License
PineLib/src/main/java/com/blueberrysolution/pinelib19/debug/window/DebugWindowsController.kt
leaptochina
228,527,202
false
null
package com.blueberrysolution.pinelib19.debug.window import com.blueberrysolution.pinelib19.activity.A import com.blueberrysolution.pinelib19.activity.I import com.blueberrysolution.pinelib19.addone.share_preferences.Sp import com.blueberrysolution.pinelib19.permission.RequireFloatWindow class DebugWindowsController{ var isInited = false; var isLastTimeDisableDebugWindow = false; var debugWindowSmall:DebugWindowSmall? = null; init{ reInit(); } fun reInit(){ if (!A.app().isDebug) return; isInited = false; isLastTimeDisableDebugWindow = Sp.i.get("isLastTimeDisableDebugWindow", false); if (isLastTimeDisableDebugWindow) return; CloseOldWindow(); CheckFloatWindowPremission(); ShowFloatWindow(); } fun CloseOldWindow(){ if (debugWindowSmall != null){ if (debugWindowSmall!!.isShowing){ debugWindowSmall!!.hide(); } } } fun CheckFloatWindowPremission(){ if (!RequireFloatWindow.isAllow()){ I.i(DebugWindowRequirePermission::class).show(); } } fun ShowFloatWindow(){ if (RequireFloatWindow.isAllow()){ debugWindowSmall = DebugWindowSmall(); debugWindowSmall!!.show(); } } companion object { var debugWindowsController: DebugWindowsController? = null; fun i(): DebugWindowsController { if (debugWindowsController == null){ debugWindowsController = DebugWindowsController(); } return debugWindowsController!! } } }
0
Kotlin
0
0
b7ccb0b4259c3e17f71a677bdbc6388bb92d9841
1,667
celo_test
Apache License 2.0
mobile/app/src/main/java/at/sunilson/tahomaraffstorecontroller/mobile/features/authentication/AuthenticationState.kt
sunilson
524,687,319
false
null
package at.sunilson.tahomaraffstorecontroller.mobile.features.authentication import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.asStateFlow object AuthenticationState { private val _loggedIn = MutableStateFlow(true) val loggedIn: StateFlow<Boolean> = _loggedIn.asStateFlow() fun loggedOut() { _loggedIn.value = false } fun loggedIn() { _loggedIn.value = true } }
0
Kotlin
0
0
8dedb163d4ba1353508020fe7bfa148d65b02a0a
478
somfy-tahoma-raffstore-app
MIT License
kotlin-electron/src/jsMain/generated/electron/Payment.kt
JetBrains
93,250,841
false
{"Kotlin": 11411371, "JavaScript": 154302}
package electron typealias Payment = electron.core.Payment
28
Kotlin
173
1,250
9e9dda28cf74f68b42a712c27f2e97d63af17628
61
kotlin-wrappers
Apache License 2.0
compiler/testData/diagnostics/tests/deparenthesize/ParenthesizedVariable.kt
JakeWharton
99,388,807
true
null
fun test() { (d@ <!DECLARATION_IN_ILLEGAL_CONTEXT!>val <!UNUSED_VARIABLE!>bar<!> = 2<!>) }
0
Kotlin
28
83
4383335168338df9bbbe2a63cb213a68d0858104
94
kotlin
Apache License 2.0
mobile_app1/module994/src/main/java/module994packageKt0/Foo315.kt
uber-common
294,831,672
false
null
package module994packageKt0; annotation class Foo315Fancy @Foo315Fancy class Foo315 { fun foo0(){ module994packageKt0.Foo314().foo3() } fun foo1(){ foo0() } fun foo2(){ foo1() } fun foo3(){ foo2() } }
6
null
6
72
9cc83148c1ca37d0f2b2fcb08c71ac04b3749e5e
237
android-build-eval
Apache License 2.0