path
stringlengths 4
280
| owner
stringlengths 2
39
| repo_id
int64 21.1k
879M
| is_fork
bool 2
classes | languages_distribution
stringlengths 13
1.95k
⌀ | content
stringlengths 7
482k
| issues
int64 0
13.9k
| main_language
stringclasses 121
values | forks
stringlengths 1
5
| stars
int64 0
111k
| commit_sha
stringlengths 40
40
| size
int64 7
482k
| name
stringlengths 1
100
| license
stringclasses 93
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
app/src/main/java/com/steliosf/konsist/samples/presentation/viewmodel/LoginViewModel.kt
|
steliosfran
| 806,777,229
| false
|
{"Kotlin": 15086}
|
package com.steliosf.konsist.samples.presentation.viewmodel
class LoginViewModel {
// ...
}
| 0
|
Kotlin
|
0
| 1
|
b31a35acc2c56111a54370dd86f558e59537b6a5
| 97
|
konsist-lint-rules-samples
|
Apache License 2.0
|
app/src/main/java/com/he/fastandroid/ui/fragment/LoginSignUpFragment.kt
|
tianhe-github
| 304,500,680
| false
| null |
package com.he.fastandroid.ui.fragment
import androidx.core.widget.doAfterTextChanged
import androidx.lifecycle.lifecycleScope
import androidx.navigation.fragment.findNavController
import com.he.common.base.BaseFragment
import com.he.common.extension.isInternetOn
import com.he.common.extension.showShortToast
import com.he.common.extension.singleClick
import com.he.fastandroid.R
import com.he.fastandroid.room.AppDatabase
import com.he.fastandroid.room.User
import com.he.fastandroid.ui.activity.LoginActivity
import kotlinx.android.synthetic.main.fragment_login_mobile_number.btnVerify
import kotlinx.android.synthetic.main.fragment_login_password.etPassword
import kotlinx.android.synthetic.main.fragment_login_password.etUsername
import kotlinx.android.synthetic.main.fragment_sign_up.*
import kotlinx.android.synthetic.main.layout_toolbar.*
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
/**
* Created by Liam.Zheng on 2020/10/20
*
* Des:
*/
class LoginSignUpFragment : BaseFragment<LoginActivity>() {
override fun getlayoutId(): Int {
return R.layout.fragment_sign_up
}
override fun initView() {
tvTitle.text = getString(R.string.sign_up)
ivBack.singleClick {
findNavController().navigateUp()
}
btnVerify.singleClick {
if (!requireActivity().isInternetOn()) {
showShortToast(getString(R.string.the_network_not_connected))
return@singleClick
}
val username = etUsername.text.toString().trim()
val password = etPassword.text.toString().trim()
val passwordAgain = etPasswordAgain.text.toString().trim()
if (username.isEmpty()) {
showShortToast(getString(R.string.username_cannot_be_empty))
return@singleClick
}
if (password.length < 6) {
showShortToast(getString(R.string.the_length_of_the_password_is_at_least_6))
return@singleClick
}
if (password != passwordAgain) {
showShortToast(getString(R.string.inconsistent_passwords))
return@singleClick
}
lifecycleScope.launch {
withContext(Dispatchers.IO) {
AppDatabase.getInstance(requireContext()).userDao().also {
val user = User(userName = username, userPassword = <PASSWORD>)
it.insertAll(user)
}
}
delay(1500)
findNavController().navigateUp()
}
}
etUsername.doAfterTextChanged {
cheackButtonState()
}
etPassword.doAfterTextChanged {
cheackButtonState()
}
etPasswordAgain.doAfterTextChanged {
cheackButtonState()
}
}
override fun initData() {
}
private fun cheackButtonState() {
btnVerify.isEnabled =
etUsername.text.isNotEmpty() && etPassword.text.isNotEmpty() && etPasswordAgain.text.isNotEmpty()
}
companion object {
@JvmStatic
fun newInstance() = LoginSignUpFragment()
}
}
| 0
|
Kotlin
|
0
| 0
|
482c1a80468b07a4b947b64138cf8d8c16292a81
| 3,299
|
FastAndroid
|
Apache License 2.0
|
imagepicker/src/main/kotlin/com/github/dhaval2404/imagepicker/util/IntentUtils.kt
|
BinaryTiger
| 243,116,156
| true
|
{"Kotlin": 72927}
|
package com.github.dhaval2404.imagepicker.util
import android.content.Context
import android.content.Intent
import android.content.pm.PackageManager
import android.net.Uri
import android.os.Build
import android.provider.MediaStore
import androidx.core.content.FileProvider
import com.github.dhaval2404.imagepicker.R
import com.github.dhaval2404.imagepicker.constant.MediaProvider
import java.io.File
/**
* Get Gallery/Camera Intent
*
* @author <NAME>
* @version 1.0
* @since 04 January 2018
*/
object IntentUtils {
/**
* @return Intent Gallery Intent
*/
fun getGalleryIntent(context: Context, provider: MediaProvider): Intent {
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
var intent = getGalleryDocumentIntent(provider)
if (intent.resolveActivity(context.packageManager) == null) {
// No Activity found that can handle this intent.
intent = getGalleryPickIntent(provider)
}
intent
} else {
getGalleryPickIntent(provider)
}
}
/**
* @return Intent Gallery Document Intent
*/
private fun getGalleryDocumentIntent(provider: MediaProvider): Intent {
// Show Document Intent
val intent = Intent(Intent.ACTION_OPEN_DOCUMENT)
intent.addCategory(Intent.CATEGORY_OPENABLE)
// Apply filter to show image only in intent
intent.type = when (provider) {
MediaProvider.GALLERY_VIDEO -> {
"video/*"
}
MediaProvider.GALLERY_IMAGE -> {
"image/*"
}
else -> {
"*/*"
}
}
return intent
}
/**
* @return Intent Gallery Pick Intent
*/
private fun getGalleryPickIntent(provider: MediaProvider): Intent {
// Show Gallery Intent, Will open google photos
val intent = Intent(Intent.ACTION_PICK)
// Apply filter to show image only in intent
intent.type = when (provider) {
MediaProvider.GALLERY_VIDEO -> {
"video/*"
}
MediaProvider.GALLERY_IMAGE -> {
"image/*"
}
else -> {
"*/*"
}
}
return intent
}
/**
* @return Intent ImageCamera Intent
*/
fun getImageCameraIntent(context: Context, file: File): Intent? {
val intent = Intent(MediaStore.ACTION_IMAGE_CAPTURE)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
// authority = com.github.dhaval2404.imagepicker.provider
val authority =
context.packageName + context.getString(R.string.image_picker_provider_authority_suffix)
val photoURI = FileProvider.getUriForFile(context, authority, file)
intent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI)
} else {
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file))
}
return intent
}
/**
* @return Intent VideoCamera Intent
*/
fun getVideoCameraIntent(context: Context, file: File): Intent? {
val intent = Intent(MediaStore.ACTION_VIDEO_CAPTURE)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
// authority = com.github.dhaval2404.imagepicker.provider
val authority =
context.packageName + context.getString(R.string.image_picker_provider_authority_suffix)
val videoURI = FileProvider.getUriForFile(context, authority, file)
intent.putExtra(MediaStore.EXTRA_OUTPUT, videoURI)
} else {
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file))
}
return intent
}
fun isCameraHardwareAvailable(context: Context): Boolean {
return context.packageManager.hasSystemFeature(PackageManager.FEATURE_CAMERA_ANY)
}
}
| 0
|
Kotlin
|
0
| 0
|
cb281c069d3be9aba8e0d77e192b216c55ef3a26
| 3,949
|
ImagePicker
|
Apache License 2.0
|
app/src/main/java/dev/arkbuilders/navigator/presentation/screen/gallery/GalleryView.kt
|
ARK-Builders
| 394,855,699
| false
| null |
package dev.arkbuilders.navigator.presentation.screen.gallery
import dev.arkbuilders.navigator.presentation.common.CommonMvpView
import moxy.viewstate.strategy.AddToEndSingleStrategy
import moxy.viewstate.strategy.SkipStrategy
import moxy.viewstate.strategy.StateStrategyType
import space.taran.arklib.ResourceId
import space.taran.arklib.domain.index.Resource
import space.taran.arklib.domain.meta.Metadata
import space.taran.arklib.domain.score.Score
import space.taran.arklib.domain.tags.Tags
import java.nio.file.Path
@StateStrategyType(AddToEndSingleStrategy::class)
interface GalleryView : CommonMvpView {
fun init()
fun updatePagerAdapter()
fun updatePagerAdapterWithDiff()
fun setControlsVisibility(visible: Boolean)
fun exitFullscreen()
fun setPreviewsScrollingEnabled(enabled: Boolean)
fun setupPreview(pos: Int, meta: Metadata)
fun displayPreviewTags(resource: ResourceId, tags: Tags)
fun setProgressVisibility(isVisible: Boolean, withText: String = "")
fun displayScore(score: Score)
fun displaySelected(
selected: Boolean,
showAnim: Boolean,
selectedCount: Int,
itemCount: Int
)
fun setScoringControlsVisibility(isVisible: Boolean)
@StateStrategyType(SkipStrategy::class)
fun openLink(link: String)
@StateStrategyType(SkipStrategy::class)
fun shareLink(link: String)
@StateStrategyType(SkipStrategy::class)
fun showInfoAlert(path: Path, resource: Resource, metadata: Metadata)
@StateStrategyType(SkipStrategy::class)
fun viewInExternalApp(resourcePath: Path)
@StateStrategyType(SkipStrategy::class)
fun editResource(resourcePath: Path)
@StateStrategyType(SkipStrategy::class)
fun shareResource(resourcePath: Path)
@StateStrategyType(SkipStrategy::class)
fun showEditTagsDialog(resource: ResourceId)
@StateStrategyType(SkipStrategy::class)
fun deleteResource(pos: Int)
@StateStrategyType(SkipStrategy::class)
fun toggleSelecting(enabled: Boolean)
@StateStrategyType(SkipStrategy::class)
fun notifyResourcesChanged()
@StateStrategyType(SkipStrategy::class)
fun notifyTagsChanged()
@StateStrategyType(SkipStrategy::class)
fun notifyCurrentItemChanged()
@StateStrategyType(SkipStrategy::class)
fun notifyResourceScoresChanged()
@StateStrategyType(SkipStrategy::class)
fun notifySelectedChanged(selected: List<ResourceId>)
@StateStrategyType(SkipStrategy::class)
fun displayStorageException(label: String, msg: String)
}
| 105
|
Kotlin
|
14
| 12
|
732fa222ab52915e139addd9a6a9beaa87e18be9
| 2,551
|
ARK-Navigator
|
MIT License
|
Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/files/FileSharing.kt
|
corona-warn-app
| 268,027,139
| false
| null |
package de.rki.coronawarnapp.util.files
import android.app.Activity
import android.content.Context
import android.content.Intent
import android.net.Uri
import androidx.core.app.ShareCompat
import androidx.core.content.FileProvider
import dagger.Reusable
import de.rki.coronawarnapp.BuildConfig
import de.rki.coronawarnapp.util.di.AppContext
import timber.log.Timber
import java.io.File
import javax.inject.Inject
@Reusable
class FileSharing @Inject constructor(
@AppContext private val context: Context
) {
private fun getFileUri(path: File): Uri = FileProvider.getUriForFile(
context,
AUTHORITY,
path
)
fun getFileIntentProvider(
path: File,
title: String,
createChooserIntent: Boolean = false
): FileIntentProvider = object : FileIntentProvider {
override fun intent(activity: Activity): Intent {
val builder = ShareCompat.IntentBuilder.from(activity).apply {
setType(path.determineMimeType())
setStream(getFileUri(path))
setSubject(title)
}
val intent = if (createChooserIntent) {
builder.createChooserIntent()
} else {
builder.intent
}
return intent.apply {
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
Timber.tag(TAG).d("Intent created %s", this)
}
}
override val file: File = path
}
interface FileIntentProvider {
fun intent(activity: Activity): Intent
val file: File
}
interface ShareIntentProvider {
fun get(activity: Activity): Intent
}
companion object {
private const val AUTHORITY = "${BuildConfig.APPLICATION_ID}.fileProvider"
private const val TAG = "FileSharing"
}
}
| 6
|
Kotlin
|
514
| 2,495
|
d3833a212bd4c84e38a1fad23b282836d70ab8d5
| 1,850
|
cwa-app-android
|
Apache License 2.0
|
src/test/no/nav/pto/veilarbfilter/IntegrationTestsInternal.kt
|
navikt
| 207,477,352
| false
| null |
package no.nav.pto.veilarbfilter
import io.ktor.server.engine.*
import org.apache.http.client.methods.HttpGet
import org.apache.http.client.methods.HttpUriRequest
import org.apache.http.impl.client.BasicResponseHandler
import org.apache.http.impl.client.HttpClientBuilder
import org.junit.jupiter.api.AfterAll
import org.junit.jupiter.api.Assertions.*
import org.junit.jupiter.api.BeforeAll
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.TestInstance
import org.testcontainers.containers.PostgreSQLContainer
import java.sql.Connection
import java.sql.DriverManager
import java.sql.ResultSet
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
class IntegrationTestsInternal {
lateinit var postgresqlContainer: PostgreSQLContainer<Nothing>;
lateinit var applicationEngine: ApplicationEngine;
@BeforeAll
internal fun setUp() {
postgresqlContainer = PostgreSQLContainer<Nothing>("postgres:12-alpine").apply {
withDatabaseName("veilarbfilter")
withUsername("user")
withPassword("<PASSWORD>")
}
postgresqlContainer.start()
applicationEngine =
mainTest(postgresqlContainer.jdbcUrl, postgresqlContainer.username, postgresqlContainer.password)
}
@AfterAll
fun tearDown() {
postgresqlContainer.stop()
applicationEngine.stop(0, 0)
}
@Test
fun testDatabaseConnection() {
val conn: Connection = DriverManager
.getConnection(postgresqlContainer.jdbcUrl, postgresqlContainer.username, postgresqlContainer.password)
val resultSet: ResultSet = conn.createStatement().executeQuery("SELECT 1")
resultSet.next()
val result = resultSet.getInt(1)
assertEquals(1, result)
}
@Test
fun testIsAlive() {
val request: HttpUriRequest = HttpGet("http://0.0.0.0:8080/veilarbfilter/internal/isAlive")
val httpResponse = HttpClientBuilder.create().build().execute(request)
val responseString = BasicResponseHandler().handleResponse(httpResponse)
assertTrue(httpResponse.statusLine.statusCode == 200)
assertTrue(responseString.equals("Alive"))
}
@Test
fun testIsReady() {
val request: HttpUriRequest = HttpGet("http://0.0.0.0:8080/veilarbfilter/internal/isReady")
val httpResponse = HttpClientBuilder.create().build().execute(request)
val responseString = BasicResponseHandler().handleResponse(httpResponse)
assertTrue(httpResponse.statusLine.statusCode == 200)
assertTrue(responseString.equals("Ready"))
}
@Test
fun testMetrics() {
val request: HttpUriRequest = HttpGet("http://0.0.0.0:8080/veilarbfilter/internal/metrics")
val httpResponse = HttpClientBuilder.create().build().execute(request)
val responseString = BasicResponseHandler().handleResponse(httpResponse)
assertTrue(httpResponse.statusLine.statusCode == 200)
assertFalse(responseString.isEmpty())
}
}
| 5
|
Kotlin
|
0
| 0
|
cbf314f0ca9f1ec97d430084a988a7ee582dab72
| 3,007
|
veilarbfilter
|
MIT License
|
src/test/kotlin/com/github/varenytsiamykhailo/knml/systemsolvingmethods/ThomasMethodTest.kt
|
VarenytsiaMykhailo
| 490,834,301
| false
|
{"Kotlin": 315543, "Java": 58256}
|
package com.github.varenytsiamykhailo.knml.systemsolvingmethods
import com.github.varenytsiamykhailo.knml.util.Matrix
import com.github.varenytsiamykhailo.knml.util.Vector
import com.github.varenytsiamykhailo.knml.util.results.VectorResultWithStatus
import org.junit.jupiter.api.Assertions.*
import org.junit.jupiter.api.Test
internal class ThomasMethodTest {
@Test
fun test1SolveSystemByThomasMethod() {
val A: Array<Array<Double>> = arrayOf(
arrayOf(4.0, 1.0, 0.0, 0.0),
arrayOf(1.0, 4.0, 1.0, 0.0),
arrayOf(0.0, 1.0, 4.0, 1.0),
arrayOf(0.0, 0.0, 1.0, 4.0)
)
val B: Array<Double> = arrayOf(5.0, 6.0, 6.0, 5.0)
val result: VectorResultWithStatus = ThomasMethod().solveSystemByThomasMethod(
A,
B,
formSolution = true
)
assert(result.arrayResult != null)
assert(result.arrayResult!!.size == 4)
assert(result.arrayResult!![0].toString().startsWith("1.0"))
assert(result.arrayResult!![1].toString().startsWith("1.0"))
assert(result.arrayResult!![2].toString().startsWith("1.0"))
assert(result.arrayResult!![3].toString().startsWith("1.0"))
assert(result.vectorResult != null)
assert(result.vectorResult!!.getN() == 4)
assert(result.vectorResult!!.getElem(0).toString().startsWith("1.0"))
assert(result.vectorResult!!.getElem(1).toString().startsWith("1.0"))
assert(result.vectorResult!!.getElem(2).toString().startsWith("1.0"))
assert(result.vectorResult!!.getElem(3).toString().startsWith("1.0"))
assert(result.isSuccessful)
assert(result.errorException == null)
assert(result.solutionObject != null)
assert(result.solutionObject!!.solutionString.length >= 10)
val result2: Vector = Matrix(A).multiply(result.vectorResult!!)
assertArrayEquals(
B,
result2.getElems()
)
}
// Test that the method does not modify the input data
@Test
fun test2SolveSystemByThomasMethod() {
val A: Matrix = Matrix(
arrayOf(
arrayOf(4.0, 1.0, 0.0, 0.0),
arrayOf(1.0, 4.0, 1.0, 0.0),
arrayOf(0.0, 1.0, 4.0, 1.0),
arrayOf(0.0, 0.0, 1.0, 4.0)
)
)
val B: Vector = Vector(arrayOf(5.0, 6.0, 6.0, 5.0))
val result: VectorResultWithStatus = JacobiMethod().solveSystemByJacobiMethod(
A.getElems(),
B.getElems()
)
assert(result.arrayResult != null)
assert(result.arrayResult!!.size == 4)
assert(result.arrayResult!![0].toString() == "1.0")
assert(result.arrayResult!![1] == 1.0)
assert(result.arrayResult!![2] == 1.0)
assert(result.arrayResult!![3] == 1.0)
assert(result.vectorResult != null)
assert(result.vectorResult!!.getN() == 4)
assert(result.vectorResult!!.getElem(0) == 1.0)
assert(result.vectorResult!!.getElem(1) == 1.0)
assert(result.vectorResult!!.getElem(2) == 1.0)
assert(result.vectorResult!!.getElem(3) == 1.0)
assert(result.isSuccessful)
assert(result.errorException == null)
assert(result.solutionObject == null)
assertArrayEquals(
A.getElems(),
arrayOf(
arrayOf(4.0, 1.0, 0.0, 0.0),
arrayOf(1.0, 4.0, 1.0, 0.0),
arrayOf(0.0, 1.0, 4.0, 1.0),
arrayOf(0.0, 0.0, 1.0, 4.0)
)
)
assertArrayEquals(
B.getElems(),
arrayOf(5.0, 6.0, 6.0, 5.0)
)
}
@Test
fun test3SolveSystemByThomasMethod() {
val A: Matrix = Matrix(
arrayOf(
arrayOf(2.0, -1.0, 0.0),
arrayOf(5.0, 4.0, 2.0),
arrayOf(0.0, 1.0, -3.0)
)
)
val B: Vector = Vector(arrayOf(3.0, 6.0, 2.0))
val result: VectorResultWithStatus = ThomasMethod().solveSystemByThomasMethod(
A,
B
)
assert(result.arrayResult != null)
assert(result.arrayResult!!.size == 3)
assert(result.arrayResult!![0].toString().startsWith("1.488"))
assert(result.arrayResult!![1].toString().startsWith("-0.0232"))
assert(result.arrayResult!![2].toString().startsWith("-0.674"))
assert(result.vectorResult != null)
assert(result.vectorResult!!.getN() == 3)
assert(result.vectorResult!!.getElem(0).toString().startsWith("1.488"))
assert(result.vectorResult!!.getElem(1).toString().startsWith("-0.0232"))
assert(result.vectorResult!!.getElem(2).toString().startsWith("-0.674"))
assert(result.isSuccessful)
assert(result.errorException == null)
assert(result.solutionObject == null)
val result2: Vector = A.multiply(result.vectorResult!!)
assertArrayEquals(
B.getElems(),
result2.getElems()
)
}
/**
* Exception test: matrix A must be square.
*/
@Test
fun test4SolveSystemByThomasMethod() {
val A: Matrix = Matrix(
arrayOf(
arrayOf(4.0, 1.0, 0.0, 0.0),
arrayOf(1.0, 4.0, 1.0, 0.0),
arrayOf(0.0, 1.0, 4.0, 1.0)
)
)
val B: Vector = Vector(arrayOf(5.0, 6.0, 6.0, 5.0))
val result: VectorResultWithStatus = ThomasMethod().solveSystemByThomasMethod(
A,
B,
formSolution = true
)
assert(result.arrayResult == null)
assert(result.vectorResult == null)
assert(!result.isSuccessful)
assert(result.errorException != null)
assert(result.solutionObject == null)
}
/**
* Exception test: dimension of matrix A bigger than matrix B.
*/
@Test
fun test5SolveSystemByThomasMethod() {
val A: Matrix = Matrix(
arrayOf(
arrayOf(4.0, 1.0, 0.0, 0.0),
arrayOf(1.0, 4.0, 1.0, 0.0),
arrayOf(0.0, 1.0, 4.0, 1.0),
arrayOf(0.0, 0.0, 1.0, 4.0)
)
)
val B: Vector = Vector(arrayOf(5.0, 6.0, 6.0))
val result: VectorResultWithStatus = ThomasMethod().solveSystemByThomasMethod(
A,
B,
formSolution = true
)
assert(result.arrayResult == null)
assert(result.vectorResult == null)
assert(!result.isSuccessful)
assert(result.errorException != null)
assert(result.solutionObject == null)
}
/**
* Exception test: dimension of matrix A smaller than matrix B.
*/
@Test
fun test6SolveSystemByThomasMethod() {
val A: Matrix = Matrix(
arrayOf(
arrayOf(4.0, 1.0, 0.0, 0.0),
arrayOf(1.0, 4.0, 1.0, 0.0),
arrayOf(0.0, 1.0, 4.0, 1.0),
arrayOf(0.0, 0.0, 1.0, 4.0)
)
)
val B: Vector = Vector(arrayOf(5.0, 6.0, 6.0, 5.0, 123.1239999999))
val result: VectorResultWithStatus = ThomasMethod().solveSystemByThomasMethod(
A,
B,
formSolution = true
)
assert(result.arrayResult == null)
assert(result.vectorResult == null)
assert(!result.isSuccessful)
assert(result.errorException != null)
assert(result.solutionObject == null)
}
/**
* Exception test: the sufficient condition for the convergence of the Thomas method is not satisfied:
* the matrix inputA must be tridiagonal.
*/
@Test
fun test7SolveSystemByThomasMethod() {
val A: Matrix = Matrix(
arrayOf(
arrayOf(4.0, 1.0, 0.0, 0.0),
arrayOf(1.0, 4.0, 1.0, 0.0),
arrayOf(0.0, 1.0, 4.0, 1.0),
arrayOf(9999999999999.0, 0.0, 1.0, 4.0)
)
)
val B: Vector = Vector(arrayOf(5.0, 6.0, 6.0, 5.0))
val result: VectorResultWithStatus = ThomasMethod().solveSystemByThomasMethod(
A,
B,
formSolution = true,
increasePerformanceByIgnoringInputDataChecking = false
)
assert(result.arrayResult == null)
assert(result.vectorResult == null)
assert(!result.isSuccessful)
assert(result.errorException != null)
assert(result.solutionObject == null)
}
}
| 0
|
Kotlin
|
2
| 6
|
a556245de1f4d2529e259a3eee595d735005dcc8
| 8,513
|
KNML-Kotlin-Numerical-Methods-Library
|
MIT License
|
Chapter01/CarAndTruck.kt
|
TrainingByPackt
| 168,300,143
| false
| null |
class Car
class Truck
| 0
|
Kotlin
|
2
| 2
|
cd4303736bcffb52309defbf3c32c0853ed67b56
| 22
|
Complete-Guide-to-Kotlin
|
MIT License
|
src/main/kotlin/no/nav/tiltakspenger/ufore/auth/OAuth2AccessTokenResponse.kt
|
navikt
| 573,031,705
| false
| null |
package no.nav.tiltakspenger.ufore.auth
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
import com.fasterxml.jackson.annotation.JsonProperty
@JsonIgnoreProperties(ignoreUnknown = true)
data class OAuth2AccessTokenResponse(
@JsonProperty("token_type")
val tokenType: String,
@JsonProperty("access_token")
var accessToken: String,
@JsonProperty("ext_expires_in")
val extExpiresIn: Int,
@JsonProperty("expires_in")
val expiresIn: Int,
)
| 2
| null |
0
| 2
|
c321c086d09ab29c7d3c1d8ec31b358e4a5e1958
| 481
|
tiltakspenger-vedtak
|
MIT License
|
app/src/test/java/com/example/scoreapp/domain/usecase/GetViewSeasonsUseCaseTest.kt
|
diegoleonds
| 297,791,494
| false
| null |
package com.example.scoreapp.domain.usecase
import com.example.scoreapp.data.model.Game
import com.example.scoreapp.data.repository.GameRepositoryImpl
import com.example.scoreapp.data.repository.SeasonRepositoryImpl
import io.mockk.coEvery
import io.mockk.mockk
import junit.framework.TestCase.assertEquals
import kotlinx.coroutines.runBlocking
import org.junit.Test
import com.example.scoreapp.data.model.Season as ModelSeason
import com.example.scoreapp.ui.model.Season as ViewSeason
class GetViewSeasonsUseCaseTest {
val seasonRepository = mockk<SeasonRepositoryImpl>()
val gameRepository = mockk<GameRepositoryImpl>()
val useCase = GetViewSeasonsUseCase(
seasonRepository = seasonRepository,
gameRepository = gameRepository
)
@Test
fun shouldReturnViewSeasonWithMaxAndMinRecords() = runBlocking {
val modelSeasons = listOf(ModelSeason(1), ModelSeason(2))
coEvery { seasonRepository.getAll() } returns modelSeasons
val seasonOneMaxGame = Game(
id = 1,
fkSeason = 1,
points = 10
)
val seasonOneMinGame = Game(
id = 2,
fkSeason = 1,
points = 2
)
val seasonTwoMaxGame = Game(
id = 3,
fkSeason = 2,
points = 10
)
val seasonTwoMinGame = Game(
id = 4,
fkSeason = 1,
points = 1
)
coEvery { gameRepository.getSeasonGameWithMorePoints(1) } returns seasonOneMaxGame
coEvery { gameRepository.getSeasonGameWithLessPoints(1) } returns seasonOneMinGame
coEvery { gameRepository.getSeasonGameWithMorePoints(2) } returns seasonTwoMaxGame
coEvery { gameRepository.getSeasonGameWithLessPoints(2) } returns seasonTwoMinGame
val expectedViewSeasonOne = ViewSeason(
id = 1,
maxScore = seasonOneMaxGame.points,
minScore = seasonOneMinGame.points
)
val expectedViewSeasonTwo = ViewSeason(
id = 2,
maxScore = seasonTwoMaxGame.points,
minScore = seasonTwoMinGame.points
)
val expectedViewSeasons = listOf(expectedViewSeasonOne, expectedViewSeasonTwo)
assertEquals(expectedViewSeasons, useCase.getViewSeasons())
}
}
| 0
|
Kotlin
|
0
| 2
|
e4a561a0d45b0fdb9a921a8ca3ff9c987b2df77d
| 2,322
|
ScoreApp
|
MIT License
|
backend/todolist/src/main/kotlin/com/steiner/workbench/todolist/request/UpdateTagRequest.kt
|
nesteiner
| 693,014,583
| false
|
{"Kotlin": 366481, "Dart": 247737, "C++": 24228, "CMake": 19460, "HTML": 1843, "C": 1425}
|
package com.steiner.workbench.todolist.request
import com.steiner.workbench.common.TAG_NAME_LENGTH
import jakarta.validation.constraints.NotEmpty
import org.hibernate.validator.constraints.Length
class UpdateTagRequest(
val id: Int,
@NotEmpty(message = "tag name cannot be empty")
@Length(max = TAG_NAME_LENGTH, message = "length of tag name must less than $TAG_NAME_LENGTH")
val name: String
)
| 1
|
Kotlin
|
0
| 0
|
e0fe7a0f9aca965bc74736f1364153a695597bfe
| 430
|
Workbench
|
MIT License
|
libnavigation-core/src/main/java/com/mapbox/navigation/core/fasterroute/FasterRouteObserver.kt
|
joshkw
| 366,568,071
| true
|
{"Gradle": 37, "JSON": 30, "Markdown": 14, "Java Properties": 2, "Shell": 5, "Ignore List": 23, "Batchfile": 2, "EditorConfig": 1, "Makefile": 1, "YAML": 3, "XML": 324, "JavaScript": 1, "INI": 33, "Proguard": 16, "Text": 34, "Kotlin": 635, "Java": 6, "CSS": 1, "Python": 4}
|
package com.mapbox.navigation.core.fasterroute
import com.mapbox.api.directions.v5.models.DirectionsRoute
import java.util.concurrent.TimeUnit
/**
* Interface definition for an observer that is notified whenever the Navigation SDK checks for a faster route to the destination.
*/
interface FasterRouteObserver {
/**
* Overridable value to change when the next faster route will be checked.
*/
fun restartAfterMillis(): Long = DEFAULT_INTERVAL_MILLIS
/**
* Invoked whenever a faster route was inspected.
*
* @param currentRoute the current route.
* @param alternatives the routes where alternatives[0] may be faster
* @param isAlternativeFaster true if the alternatives[0] is faster, false otherwise
*/
fun onFasterRoute(currentRoute: DirectionsRoute, alternatives: List<DirectionsRoute>, isAlternativeFaster: Boolean)
companion object {
/**
* The default and recommended interval for checking for faster routes.
*/
val DEFAULT_INTERVAL_MILLIS = TimeUnit.MINUTES.toMillis(5)
}
}
| 0
|
Kotlin
|
0
| 0
|
9acc5b209355cbe8a3f4ce10a6e4e71533a9ddee
| 1,083
|
mapbox-navigation-android
|
MIT License
|
app/src/main/java/com/jshvarts/notespaging/presentation/addnote/AddNoteViewModel.kt
|
jshvarts
| 149,038,970
| false
| null |
package com.jshvarts.notespaging.presentation.addnote
import android.arch.lifecycle.LiveData
import android.arch.lifecycle.MutableLiveData
import com.jshvarts.notespaging.domain.AddNoteUseCase
import com.jshvarts.notespaging.domain.Note
import com.jshvarts.notespaging.presentation.BaseViewModel
import io.reactivex.rxkotlin.plusAssign
import io.reactivex.rxkotlin.subscribeBy
import io.reactivex.schedulers.Schedulers
import timber.log.Timber
import javax.inject.Inject
class AddNoteViewModel @Inject constructor(
private val addNoteUseCase: AddNoteUseCase
) : BaseViewModel() {
private val status = MutableLiveData<Boolean>()
val observableStatus: LiveData<Boolean>
get() = status
fun addNote(noteText: String) {
disposables += addNoteUseCase.addNote(Note(text = noteText))
.subscribeOn(Schedulers.io())
.subscribeBy(onComplete = {
status.postValue(true)
}, onError = {
Timber.e(it)
status.postValue(false)
})
}
}
| 3
|
Kotlin
|
20
| 144
|
d89f0fed222f6673db078fb48d83e8402c4df48e
| 1,083
|
PagingRoom
|
Apache License 2.0
|
src/main/kotlin/io/lsdconsulting/lsd/distributed/mongo/repository/InterceptedInteractionCollectionBuilder.kt
|
lsd-consulting
| 412,871,461
| false
|
{"Kotlin": 44362, "Shell": 1724}
|
package io.lsdconsulting.lsd.distributed.mongo.repository
import com.mongodb.ConnectionString
import com.mongodb.MongoClientSettings
import com.mongodb.client.MongoClient
import com.mongodb.client.MongoCollection
import com.mongodb.client.model.CreateCollectionOptions
import com.mongodb.client.model.Indexes
import com.mongodb.connection.ClusterSettings
import com.mongodb.connection.SocketSettings
import com.mongodb.connection.SslSettings
import io.lsdconsulting.lsd.distributed.access.model.InterceptedInteraction
import io.lsdconsulting.lsd.distributed.mongo.repository.codec.InteractionTypeCodec
import io.lsdconsulting.lsd.distributed.mongo.repository.codec.ZonedDateTimeCodec
import org.apache.http.ssl.SSLContextBuilder
import org.bson.codecs.configuration.CodecRegistries
import org.bson.codecs.configuration.CodecRegistry
import org.bson.codecs.pojo.PojoCodecProvider
import org.litote.kmongo.KMongo
import org.litote.kmongo.getCollection
import org.springframework.core.io.ClassPathResource
import java.security.KeyStore
import java.util.concurrent.TimeUnit.MILLISECONDS
const val DATABASE_NAME = "lsd"
const val COLLECTION_NAME = "interceptedInteraction"
const val DEFAULT_TIMEOUT_MILLIS = 500
const val DEFAULT_COLLECTION_SIZE_LIMIT_MBS = 1000 * 10L // 10Gb
class InterceptedInteractionCollectionBuilder(
private val dbConnectionString: String, private val trustStoreLocation: String?,
private val trustStorePassword: String?, private val connectionTimeout: Int,
private val collectionSizeLimit: Long
) {
val pojoCodecRegistry: CodecRegistry = CodecRegistries.fromRegistries(
CodecRegistries.fromCodecs(ZonedDateTimeCodec(), InteractionTypeCodec()),
MongoClientSettings.getDefaultCodecRegistry(),
CodecRegistries.fromProviders(PojoCodecProvider.builder().automatic(true).build()),
)
fun prepareMongoClient(): MongoClient {
val builder = MongoClientSettings.builder()
.applyToSocketSettings { b: SocketSettings.Builder ->
b.connectTimeout(connectionTimeout, MILLISECONDS)
b.readTimeout(connectionTimeout, MILLISECONDS)
}
.applyToClusterSettings { b: ClusterSettings.Builder ->
b.serverSelectionTimeout(connectionTimeout.toLong(), MILLISECONDS)
}
.applyConnectionString(ConnectionString(dbConnectionString))
if (!trustStoreLocation.isNullOrBlank() && !trustStorePassword.isNullOrBlank()) {
builder.applyToSslSettings { sslSettingsBuilder: SslSettings.Builder ->
loadCustomTrustStore(sslSettingsBuilder, trustStoreLocation, trustStorePassword)
}
}
// TODO We should also support other AuthenticationMechanisms
// String user = "xxxx"; // the user name
// String database = "admin"; // the name of the database in which the user is defined
// char[] password = "xxxx".toCharArray(); // the password as a character array
// MongoCredential credential = MongoCredential.createCredential(user, database, password);
return KMongo.createClient(builder.retryWrites(true).build())
}
inline fun <reified T> get(): MongoCollection<T> {
val mongoClient = prepareMongoClient()
createCappedCollectionIdMissing(mongoClient)
val interceptedInteractions = mongoClient
.getDatabase(DATABASE_NAME)
.getCollection(COLLECTION_NAME, T::class.java)
.withCodecRegistry(pojoCodecRegistry)
interceptedInteractions.createIndex(Indexes.ascending("traceId"))
interceptedInteractions.createIndex(Indexes.ascending("createdAt"))
interceptedInteractions.createIndex(Indexes.descending("createdAt"))
return interceptedInteractions
}
fun getInterceptedInteractionCollection(): MongoCollection<InterceptedInteraction> {
val mongoClient = prepareMongoClient()
createCappedCollectionIdMissing(mongoClient)
val interceptedInteractions = mongoClient
.getDatabase(DATABASE_NAME)
.getCollection<InterceptedInteraction>(COLLECTION_NAME)
interceptedInteractions.createIndex(Indexes.ascending("traceId"))
interceptedInteractions.createIndex(Indexes.ascending("createdAt"))
return interceptedInteractions
}
fun createCappedCollectionIdMissing(mongoClient: MongoClient) {
if (!collectionExists(mongoClient)) {
val options = CreateCollectionOptions()
options.capped(true).sizeInBytes(1024 * 1000 * collectionSizeLimit)
mongoClient.getDatabase(DATABASE_NAME).createCollection(COLLECTION_NAME, options)
}
}
private fun collectionExists(mongoClient: MongoClient): Boolean =
mongoClient.getDatabase(DATABASE_NAME).listCollectionNames()
.into(ArrayList()).contains(COLLECTION_NAME)
private fun loadCustomTrustStore(
builder: SslSettings.Builder,
trustStoreLocation: String,
trustStorePassword: String
) {
ClassPathResource(trustStoreLocation).inputStream.use { inputStream ->
val trustStore = KeyStore.getInstance(KeyStore.getDefaultType())
trustStore.load(inputStream, trustStorePassword.toCharArray())
builder.context(SSLContextBuilder().loadTrustMaterial(trustStore, null).build())
}
}
constructor(
dbConnectionString: String, connectionTimeout: Int,
collectionSizeLimit: Long
) : this(dbConnectionString, null, null, connectionTimeout, collectionSizeLimit)
}
| 2
|
Kotlin
|
0
| 0
|
f2865186c8f46857af013ca697ed857b35597b92
| 5,578
|
lsd-distributed-mongodb-connector
|
Apache License 2.0
|
features/task/impl/src/main/java/wottrich/github/io/smartchecklist/domain/model/SortItemType.kt
|
Wottrich
| 295,605,540
| false
|
{"Kotlin": 360367}
|
package wottrich.github.io.smartchecklist.domain.model
enum class SortItemType {
UNSELECTED_SORT, COMPLETED_TASKS, UNCOMPLETED_TASKS;
}
| 10
|
Kotlin
|
0
| 8
|
67aad31c791a0dcd19138e93126efc46c85b5036
| 140
|
android-smart-checklist
|
MIT License
|
src/main/java/miyucomics/hexical/items/ConjuredStaffItem.kt
|
miyucomics
| 757,094,041
| false
|
{"Kotlin": 324683, "Java": 27372, "GLSL": 1075, "Shell": 44}
|
package miyucomics.hexical.items
import at.petrak.hexcasting.api.spell.casting.CastingContext
import at.petrak.hexcasting.api.spell.casting.CastingHarness
import at.petrak.hexcasting.api.spell.iota.Iota
import at.petrak.hexcasting.common.items.magic.ItemPackagedHex
import miyucomics.hexical.enums.SpecializedSource
import miyucomics.hexical.interfaces.CastingContextMinterface
import miyucomics.hexical.registry.HexicalItems
import net.minecraft.entity.Entity
import net.minecraft.entity.player.PlayerEntity
import net.minecraft.item.ItemStack
import net.minecraft.server.network.ServerPlayerEntity
import net.minecraft.server.world.ServerWorld
import net.minecraft.util.Hand
import net.minecraft.util.TypedActionResult
import net.minecraft.world.World
class ConjuredStaffItem : ItemPackagedHex(Settings().maxCount(1)) {
override fun use(world: World, player: PlayerEntity, usedHand: Hand): TypedActionResult<ItemStack> = TypedActionResult.success(player.getStackInHand(usedHand))
override fun canDrawMediaFromInventory(stack: ItemStack?) = false
override fun canRecharge(stack: ItemStack?) = false
override fun breakAfterDepletion() = true
override fun inventoryTick(stack: ItemStack, world: World, entity: Entity, slot: Int, selected: Boolean) {
if (!hasHex(stack) || getMedia(stack) == 0)
stack.decrement(1)
}
fun cast(user: ServerPlayerEntity, hand: Hand, stack: ItemStack, castStack: MutableList<Iota>) {
val context = CastingContext(user, hand, CastingContext.CastSource.PACKAGED_HEX)
(context as CastingContextMinterface).setSpecializedSource(SpecializedSource.CONJURED_STAFF)
val harness = CastingHarness(context)
harness.stack = castStack
harness.executeIotas(getHex(stack, user.getWorld())!!, user.getWorld())
}
}
fun getConjuredStaff(player: PlayerEntity): Hand? {
if (player.getStackInHand(Hand.OFF_HAND).isOf(HexicalItems.CONJURED_STAFF_ITEM))
return Hand.OFF_HAND
if (player.getStackInHand(Hand.MAIN_HAND).isOf(HexicalItems.CONJURED_STAFF_ITEM))
return Hand.MAIN_HAND
return null
}
| 1
|
Kotlin
|
4
| 1
|
82cc52643713c35b801ce1fe73fa128ed62c8785
| 2,031
|
hexical
|
MIT License
|
app/shared/state-machine/ui/public/src/commonMain/kotlin/build/wallet/statemachine/moneyhome/full/MoneyHomeViewingBalanceUiStateMachineImpl.kt
|
proto-at-block
| 761,306,853
| false
| null |
package build.wallet.statemachine.moneyhome.full
import androidx.compose.runtime.*
import build.wallet.analytics.events.EventTracker
import build.wallet.analytics.v1.Action
import build.wallet.availability.AppFunctionalityStatus
import build.wallet.availability.AppFunctionalityStatusProvider
import build.wallet.availability.FunctionalityFeatureStates.FeatureState.Available
import build.wallet.bitkey.relationships.Invitation
import build.wallet.coachmark.CoachmarkIdentifier
import build.wallet.coachmark.CoachmarkService
import build.wallet.compose.coroutines.rememberStableCoroutineScope
import build.wallet.fwup.FirmwareData
import build.wallet.fwup.FirmwareDataService
import build.wallet.home.GettingStartedTask
import build.wallet.home.GettingStartedTaskDao
import build.wallet.inappsecurity.MoneyHomeHiddenStatus
import build.wallet.inappsecurity.MoneyHomeHiddenStatusProvider
import build.wallet.money.currency.FiatCurrency
import build.wallet.money.display.FiatCurrencyPreferenceRepository
import build.wallet.money.formatter.MoneyDisplayFormatter
import build.wallet.partnerships.PartnerRedirectionMethod
import build.wallet.partnerships.PartnershipTransaction
import build.wallet.platform.haptics.Haptics
import build.wallet.platform.haptics.HapticsEffect
import build.wallet.platform.links.DeepLinkHandler
import build.wallet.platform.links.OpenDeeplinkResult
import build.wallet.platform.links.OpenDeeplinkResult.AppRestrictionResult.*
import build.wallet.recovery.sweep.SweepPromptRequirementCheck
import build.wallet.statemachine.core.ScreenModel
import build.wallet.statemachine.core.SheetModel
import build.wallet.statemachine.core.list.ListModel
import build.wallet.statemachine.limit.MobilePayOnboardingScreenModel
import build.wallet.statemachine.money.amount.MoneyAmountModel
import build.wallet.statemachine.moneyhome.MoneyHomeBodyModel
import build.wallet.statemachine.moneyhome.MoneyHomeButtonsModel
import build.wallet.statemachine.moneyhome.card.MoneyHomeCardsModel
import build.wallet.statemachine.moneyhome.card.MoneyHomeCardsProps
import build.wallet.statemachine.moneyhome.card.MoneyHomeCardsUiStateMachine
import build.wallet.statemachine.moneyhome.card.backup.CloudBackupHealthCardUiProps
import build.wallet.statemachine.moneyhome.card.bitcoinprice.BitcoinPriceCardUiProps
import build.wallet.statemachine.moneyhome.card.fwup.DeviceUpdateCardUiProps
import build.wallet.statemachine.moneyhome.card.gettingstarted.GettingStartedCardUiProps
import build.wallet.statemachine.moneyhome.card.replacehardware.SetupHardwareCardUiProps
import build.wallet.statemachine.moneyhome.card.sweep.StartSweepCardUiProps
import build.wallet.statemachine.moneyhome.full.MoneyHomeUiState.*
import build.wallet.statemachine.moneyhome.full.MoneyHomeUiState.ViewingBalanceUiState.BottomSheetDisplayState.*
import build.wallet.statemachine.moneyhome.full.MoneyHomeUiState.ViewingTransactionUiState.EntryPoint.BALANCE
import build.wallet.statemachine.partnerships.AddBitcoinUiProps
import build.wallet.statemachine.partnerships.AddBitcoinUiStateMachine
import build.wallet.statemachine.recovery.hardware.HardwareRecoveryStatusCardUiProps
import build.wallet.statemachine.recovery.losthardware.initiate.InstructionsStyle
import build.wallet.statemachine.recovery.socrec.RecoveryContactCardsUiProps
import build.wallet.statemachine.recovery.socrec.view.ViewingInvitationProps
import build.wallet.statemachine.recovery.socrec.view.ViewingInvitationUiStateMachine
import build.wallet.statemachine.recovery.socrec.view.ViewingRecoveryContactProps
import build.wallet.statemachine.recovery.socrec.view.ViewingRecoveryContactUiStateMachine
import build.wallet.statemachine.send.SendEntryPoint
import build.wallet.statemachine.settings.full.device.fingerprints.AddAdditionalFingerprintGettingStartedModel
import build.wallet.statemachine.settings.full.device.fingerprints.PromptingForFingerprintFwUpSheetModel
import build.wallet.statemachine.status.AppFunctionalityStatusAlertModel
import build.wallet.statemachine.transactions.TransactionListUiProps
import build.wallet.statemachine.transactions.TransactionListUiStateMachine
import build.wallet.ui.model.StandardClick
import build.wallet.ui.model.alert.ButtonAlertModel
import build.wallet.ui.model.button.ButtonModel
import build.wallet.ui.model.coachmark.CoachmarkModel
import com.github.michaelbull.result.onSuccess
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.mapLatest
import kotlinx.coroutines.flow.stateIn
import kotlinx.coroutines.launch
class MoneyHomeViewingBalanceUiStateMachineImpl(
private val addBitcoinUiStateMachine: AddBitcoinUiStateMachine,
private val appFunctionalityStatusProvider: AppFunctionalityStatusProvider,
private val deepLinkHandler: DeepLinkHandler,
private val eventTracker: EventTracker,
private val moneyDisplayFormatter: MoneyDisplayFormatter,
private val gettingStartedTaskDao: GettingStartedTaskDao,
private val moneyHomeCardsUiStateMachine: MoneyHomeCardsUiStateMachine,
private val transactionListUiStateMachine: TransactionListUiStateMachine,
private val viewingInvitationUiStateMachine: ViewingInvitationUiStateMachine,
private val viewingRecoveryContactUiStateMachine: ViewingRecoveryContactUiStateMachine,
private val fiatCurrencyPreferenceRepository: FiatCurrencyPreferenceRepository,
private val moneyHomeHiddenStatusProvider: MoneyHomeHiddenStatusProvider,
private val coachmarkService: CoachmarkService,
private val sweepPromptRequirementCheck: SweepPromptRequirementCheck,
private val haptics: Haptics,
private val firmwareDataService: FirmwareDataService,
) : MoneyHomeViewingBalanceUiStateMachine {
@Composable
override fun model(props: MoneyHomeViewingBalanceUiProps): ScreenModel {
val scope = rememberStableCoroutineScope()
if (props.state.isRefreshing) {
LaunchedEffect("refresh-transactions") {
props.accountData.transactionsData.syncTransactions()
props.accountData.transactionsData.syncFiatBalance()
sweepPromptRequirementCheck.checkForSweeps(props.accountData.account.keybox)
props.setState(props.state.copy(isRefreshing = false))
}
}
val numberOfVisibleTransactions = 5
val fiatCurrency by fiatCurrencyPreferenceRepository.fiatCurrencyPreference.collectAsState()
val appFunctionalityStatus =
remember {
appFunctionalityStatusProvider.appFunctionalityStatus(
props.accountData.account.config.f8eEnvironment
)
}.collectAsState(AppFunctionalityStatus.FullFunctionality).value
val hideBalance by remember {
moneyHomeHiddenStatusProvider.hiddenStatus.mapLatest {
status ->
status == MoneyHomeHiddenStatus.HIDDEN
}.stateIn(scope = scope, SharingStarted.Eagerly, moneyHomeHiddenStatusProvider.hiddenStatus.value == MoneyHomeHiddenStatus.HIDDEN)
}.collectAsState()
var coachmarksToDisplay by remember { mutableStateOf(listOf<CoachmarkIdentifier>()) }
var coachmarkDisplayed by remember { mutableStateOf(false) }
LaunchedEffect("coachmarks", coachmarkDisplayed) {
coachmarkService
.coachmarksToDisplay(
setOf(CoachmarkIdentifier.MultipleFingerprintsCoachmark, CoachmarkIdentifier.BiometricUnlockCoachmark, CoachmarkIdentifier.HiddenBalanceCoachmark)
).onSuccess {
coachmarksToDisplay = it
}
}
var alertModel: ButtonAlertModel? by remember { mutableStateOf(null) }
val viewingBalanceModel =
ScreenModel(
alertModel = alertModel,
body =
MoneyHomeBodyModel(
hideBalance = hideBalance,
onHideBalance = {
scope.launch {
moneyHomeHiddenStatusProvider.toggleStatus()
haptics.vibrate(HapticsEffect.MediumClick)
coachmarkService.markCoachmarkAsDisplayed(
coachmarkId = CoachmarkIdentifier.HiddenBalanceCoachmark
)
coachmarkDisplayed = true
}
},
onSettings = props.onSettings,
balanceModel =
// if fiat balance is null because currency conversion hasn't happened yet, we will show
// the sats value as the primary until the fiat balance isn't null
MoneyAmountModel(
primaryAmount = when (val balance = props.accountData.transactionsData.fiatBalance) {
null ->
moneyDisplayFormatter
.format(props.accountData.transactionsData.balance.total)
else -> moneyDisplayFormatter.format(balance)
},
secondaryAmount = if (props.accountData.transactionsData.fiatBalance != null) {
moneyDisplayFormatter
.format(props.accountData.transactionsData.balance.total)
} else {
""
}
),
cardsModel =
MoneyHomeCardsModel(
props = props,
appFunctionalityStatus = appFunctionalityStatus,
onShowAlert = { alertModel = it },
onDismissAlert = { alertModel = null }
),
buttonsModel =
MoneyHomeButtonsModel(
props = props,
appFunctionalityStatus = appFunctionalityStatus,
onShowAlert = { alertModel = it },
onDismissAlert = { alertModel = null }
),
transactionsModel = MoneyHomeTransactionsModel(
props,
fiatCurrency,
numberOfVisibleTransactions
),
seeAllButtonModel =
if (props.accountData.transactionsData.transactions.size <= numberOfVisibleTransactions) {
null
} else {
ButtonModel(
text = "See All",
treatment = ButtonModel.Treatment.Secondary,
size = ButtonModel.Size.Footer,
onClick =
StandardClick {
props.setState(ViewingAllTransactionActivityUiState)
}
)
},
coachmark = if (coachmarksToDisplay.contains(CoachmarkIdentifier.HiddenBalanceCoachmark)) {
CoachmarkModel(
identifier = CoachmarkIdentifier.HiddenBalanceCoachmark,
title = "Tap to hide balance",
description = "Now you can easily conceal your balance by tapping to hide.",
arrowPosition = CoachmarkModel.ArrowPosition(
vertical = CoachmarkModel.ArrowPosition.Vertical.Top,
horizontal = CoachmarkModel.ArrowPosition.Horizontal.Centered
),
button = null,
image = null,
dismiss = {
scope.launch {
coachmarkService.markCoachmarkAsDisplayed(coachmarkId = CoachmarkIdentifier.HiddenBalanceCoachmark)
coachmarkDisplayed = true
}
}
)
} else {
null
},
refresh = props.accountData.transactionsData.syncTransactions,
onRefresh = {
props.setState(props.state.copy(isRefreshing = true))
},
isRefreshing = props.state.isRefreshing,
badgedSettingsIcon =
coachmarksToDisplay.contains(CoachmarkIdentifier.BiometricUnlockCoachmark) ||
coachmarksToDisplay.contains(
CoachmarkIdentifier.MultipleFingerprintsCoachmark
),
onOpenPriceDetails = {
props.setState(ShowingPriceChartUiState())
}
),
bottomSheetModel =
MoneyHomeBottomSheetModel(
props = props,
onShowAlert = { alertModel = it },
onDismissAlert = { alertModel = null }
),
statusBannerModel = props.homeStatusBannerModel
)
return when (val contact = props.state.selectedContact) {
null -> viewingBalanceModel
is Invitation ->
viewingInvitationUiStateMachine.model(
ViewingInvitationProps(
hostScreen = viewingBalanceModel,
fullAccount = props.accountData.account,
invitation = contact,
onRemoveInvitation = props.socRecActions::removeTrustedContact,
onExit = {
props.setState(props.state.copy(selectedContact = null))
},
onRefreshInvitation = props.socRecActions::refreshInvitation
)
)
else -> viewingRecoveryContactUiStateMachine.model(
ViewingRecoveryContactProps(
screenBody = viewingBalanceModel.body,
recoveryContact = contact,
account = props.accountData.account,
onRemoveContact = props.socRecActions::removeTrustedContact,
afterContactRemoved = {
props.setState(props.state.copy(selectedContact = null))
},
onExit = {
props.setState(props.state.copy(selectedContact = null))
}
)
)
}
}
@Composable
private fun MoneyHomeCardsModel(
props: MoneyHomeViewingBalanceUiProps,
appFunctionalityStatus: AppFunctionalityStatus,
onShowAlert: (ButtonAlertModel) -> Unit,
onDismissAlert: () -> Unit,
): MoneyHomeCardsModel {
return moneyHomeCardsUiStateMachine.model(
props =
MoneyHomeCardsProps(
cloudBackupHealthCardUiProps = CloudBackupHealthCardUiProps(
appFunctionalityStatus = appFunctionalityStatus,
onActionClick = { status ->
props.setState(FixingCloudBackupState(status))
}
),
deviceUpdateCardUiProps =
DeviceUpdateCardUiProps(
onUpdateDevice = { firmwareData ->
props.setState(FwupFlowUiState(firmwareData = firmwareData))
}
),
gettingStartedCardUiProps =
GettingStartedCardUiProps(
accountData = props.accountData,
appFunctionalityStatus = appFunctionalityStatus,
trustedContacts =
props.socRecRelationships.endorsedTrustedContacts +
props.socRecRelationships.invitations,
onAddBitcoin = {
props.setState(ViewingBalanceUiState(bottomSheetDisplayState = Partners()))
},
onEnableSpendingLimit = {
props.setState(
ViewingBalanceUiState(bottomSheetDisplayState = MobilePay(skipped = false))
)
},
onInviteTrustedContact = {
props.setState(
ViewingBalanceUiState(bottomSheetDisplayState = TrustedContact(skipped = false))
)
},
onAddAdditionalFingerprint = {
props.setState(
ViewingBalanceUiState(
bottomSheetDisplayState = AddingAdditionalFingerprint(
skipped = false
)
)
)
},
onShowAlert = onShowAlert,
onDismissAlert = onDismissAlert
),
hardwareRecoveryStatusCardUiProps =
HardwareRecoveryStatusCardUiProps(
lostHardwareRecoveryData = props.accountData.lostHardwareRecoveryData,
onClick = {
props.setState(
ViewHardwareRecoveryStatusUiState(InstructionsStyle.Independent)
)
}
),
recoveryContactCardsUiProps =
RecoveryContactCardsUiProps(
relationships = props.socRecRelationships,
onClick = { props.setState(props.state.copy(selectedContact = it)) }
),
setupHardwareCardUiProps =
SetupHardwareCardUiProps(
onReplaceDevice = {
props.setState(
ViewHardwareRecoveryStatusUiState(InstructionsStyle.ResumedRecoveryAttempt)
)
}
),
startSweepCardUiProps = StartSweepCardUiProps(
keybox = props.accountData.account.keybox,
onStartSweepClicked = props.onStartSweepFlow
),
bitcoinPriceCardUiProps = BitcoinPriceCardUiProps(
onOpenPriceChart = { props.setState(ShowingPriceChartUiState()) }
)
)
)
}
@Composable
private fun MoneyHomeButtonsModel(
props: MoneyHomeViewingBalanceUiProps,
appFunctionalityStatus: AppFunctionalityStatus,
onShowAlert: (ButtonAlertModel) -> Unit,
onDismissAlert: () -> Unit,
): MoneyHomeButtonsModel {
fun showAlertForLimitedStatus() {
when (appFunctionalityStatus) {
is AppFunctionalityStatus.FullFunctionality -> Unit // Nothing to do
is AppFunctionalityStatus.LimitedFunctionality ->
onShowAlert(
AppFunctionalityStatusAlertModel(
status = appFunctionalityStatus,
onDismiss = onDismissAlert
)
)
}
}
return MoneyHomeButtonsModel.MoneyMovementButtonsModel(
sendButton =
MoneyHomeButtonsModel.MoneyMovementButtonsModel.Button(
enabled = appFunctionalityStatus.featureStates.send == Available,
onClick = {
if (appFunctionalityStatus.featureStates.send == Available) {
props.setState(SendFlowUiState(entryPoint = SendEntryPoint.SendButton))
} else {
showAlertForLimitedStatus()
}
}
),
receiveButton =
MoneyHomeButtonsModel.MoneyMovementButtonsModel.Button(
enabled = appFunctionalityStatus.featureStates.receive == Available,
onClick = {
if (appFunctionalityStatus.featureStates.receive == Available) {
props.setState(ReceiveFlowUiState)
} else {
showAlertForLimitedStatus()
}
}
),
addButton =
MoneyHomeButtonsModel.MoneyMovementButtonsModel.Button(
enabled = appFunctionalityStatus.featureStates.deposit == Available,
onClick = {
if (appFunctionalityStatus.featureStates.deposit == Available) {
props.setState(ViewingBalanceUiState(bottomSheetDisplayState = Partners()))
} else {
showAlertForLimitedStatus()
}
}
)
)
}
@Composable
private fun MoneyHomeTransactionsModel(
props: MoneyHomeViewingBalanceUiProps,
fiatCurrency: FiatCurrency,
numberOfVisibleTransactions: Int,
): ListModel? {
return transactionListUiStateMachine.model(
props = TransactionListUiProps(
transactionVisibility = TransactionListUiProps.TransactionVisibility.Some(
numberOfVisibleTransactions
),
transactions = props.accountData.transactionsData.transactions,
fiatCurrency = fiatCurrency,
onTransactionClicked = { transaction ->
props.setState(
ViewingTransactionUiState(
transaction = transaction,
entryPoint = BALANCE
)
)
}
)
)?.let { transactionGroups ->
ListModel(
headerText = "Recent activity",
sections = transactionGroups
)
}
}
@Composable
private fun MoneyHomeBottomSheetModel(
props: MoneyHomeViewingBalanceUiProps,
onShowAlert: (ButtonAlertModel) -> Unit,
onDismissAlert: () -> Unit,
): SheetModel? {
return when (val globalBottomSheet = props.homeBottomSheetModel) {
null -> {
when (val currentState = props.state.bottomSheetDisplayState) {
is Partners ->
addBitcoinUiStateMachine.model(
props =
AddBitcoinUiProps(
account = props.accountData.account,
keybox = props.accountData.account.keybox,
purchaseAmount = currentState.purchaseAmount,
onAnotherWalletOrExchange = { props.setState(ReceiveFlowUiState) },
onPartnerRedirected = { redirectMethod, transaction ->
handlePartnerRedirected(
method = redirectMethod,
transaction = transaction,
props = props,
onShowAlert = onShowAlert,
onDismissAlert = onDismissAlert
)
},
onExit = {
props.setState(props.state.copy(bottomSheetDisplayState = null))
},
onSelectCustomAmount = { minAmount, maxAmount ->
props.setState(SelectCustomPartnerPurchaseAmountState(minAmount, maxAmount))
}
)
)
is MobilePay -> {
if (currentState.skipped) {
LaunchedEffect("skipping-saving-spending-limit") {
gettingStartedTaskDao.updateTask(
id = GettingStartedTask.TaskId.EnableSpendingLimit,
state = GettingStartedTask.TaskState.Complete
).onSuccess { eventTracker.track(Action.ACTION_APP_MOBILE_TRANSACTION_SKIP) }
props.setState(props.state.copy(bottomSheetDisplayState = null))
}
}
val onClosed = { props.setState(props.state.copy(bottomSheetDisplayState = null)) }
MobilePayOnboardingScreenModel(
onContinue = { props.setState(SetSpendingLimitFlowUiState) },
onSetUpLater = {
props.setState(
props.state.copy(
bottomSheetDisplayState = MobilePay(skipped = true)
)
)
},
onClosed = onClosed
).asSheetModalScreen(onClosed)
}
is TrustedContact -> {
// This has been done here instead of InviteTrustedContactFlowUiStateMachineImpl
// It's because when done inside there, due to race condition where
// returning ScreenModel shows up first instead of MoneyHomeViewingBalance screen
// Maybe due to how long the "gettingStartedTaskDao.updateTask" operation takes
if (currentState.skipped) {
LaunchedEffect("skipping-invite-task") {
gettingStartedTaskDao.updateTask(
id = GettingStartedTask.TaskId.InviteTrustedContact,
state = GettingStartedTask.TaskState.Complete
)
props.setState(props.state.copy(bottomSheetDisplayState = null))
}
}
val onClosed = { props.setState(props.state.copy(bottomSheetDisplayState = null)) }
ViewingAddTrustedContactFormBodyModel(
onAddTrustedContact = { props.setState(InviteTrustedContactFlow) },
onSkip = {
props.setState(
props.state.copy(
bottomSheetDisplayState = TrustedContact(
skipped = true
)
)
)
},
onClosed = onClosed
).asSheetModalScreen(onClosed)
}
is AddingAdditionalFingerprint -> {
if (currentState.skipped) {
LaunchedEffect("skipping-add-additional-fingerprint") {
gettingStartedTaskDao.updateTask(
id = GettingStartedTask.TaskId.AddAdditionalFingerprint,
state = GettingStartedTask.TaskState.Complete
).onSuccess {
eventTracker.track(Action.ACTION_APP_ADD_ADDITIONAL_FINGERPRINT_SKIP)
}
props.setState(props.state.copy(bottomSheetDisplayState = null))
}
}
val onClosed = { props.setState(props.state.copy(bottomSheetDisplayState = null)) }
AddAdditionalFingerprintGettingStartedModel(
onContinue = { props.setState(AddAdditionalFingerprintUiState) },
onSetUpLater = {
props.setState(
props.state.copy(
bottomSheetDisplayState = AddingAdditionalFingerprint(skipped = true)
)
)
},
onClosed = onClosed
).asSheetModalScreen(onClosed)
}
PromptingForFwUpUiState -> {
val onClosed = { props.setState(props.state.copy(bottomSheetDisplayState = null)) }
val fwupState = remember { firmwareDataService.firmwareData() }
.collectAsState()
.value.firmwareUpdateState
PromptingForFingerprintFwUpSheetModel(
onCancel = onClosed,
onUpdate = {
when (fwupState) {
is FirmwareData.FirmwareUpdateState.PendingUpdate -> props.setState(
FwupFlowUiState(fwupState)
)
FirmwareData.FirmwareUpdateState.UpToDate -> props.setState(
props.state.copy(
bottomSheetDisplayState = null
)
)
}
}
)
}
null -> null
}
}
else -> globalBottomSheet
}
}
private fun handlePartnerRedirected(
method: PartnerRedirectionMethod,
transaction: PartnershipTransaction,
props: MoneyHomeViewingBalanceUiProps,
onShowAlert: (ButtonAlertModel) -> Unit,
onDismissAlert: () -> Unit,
) {
when (method) {
is PartnerRedirectionMethod.Deeplink -> {
val result =
deepLinkHandler.openDeeplink(
url = method.urlString,
appRestrictions = method.appRestrictions
)
val alertModel: ButtonAlertModel? =
when (result) {
OpenDeeplinkResult.Failed ->
ButtonAlertModel(
title = "Failed to open ${method.partnerName}.",
subline = null,
onDismiss = onDismissAlert,
primaryButtonText = "OK",
onPrimaryButtonClick = onDismissAlert
)
is OpenDeeplinkResult.Opened ->
when (result.appRestrictionResult) {
is Failed ->
ButtonAlertModel(
title = "The version of ${method.partnerName} may be out of date. Please update your app.",
subline = null,
onDismiss = onDismissAlert,
primaryButtonText = "OK",
onPrimaryButtonClick = onDismissAlert
)
None, Success -> null
}
}
// Dismiss partners
props.setState(props.state.copy(bottomSheetDisplayState = null))
// Show alert if there is one
alertModel?.let { onShowAlert(alertModel) }
}
is PartnerRedirectionMethod.Web -> {
props.setState(
MoneyHomeUiState.ShowingInAppBrowserUiState(
urlString = method.urlString,
onClose = {
props.onPartnershipsWebFlowCompleted(method.partnerInfo, transaction)
}
)
)
}
}
}
}
| 3
| null |
6
| 98
|
1f9f2298919dac77e6791aa3f1dbfd67efe7f83c
| 27,528
|
bitkey
|
MIT License
|
app/src/main/java/com/prush/justanotherplayer/ui/artistslibrary/ArtistRowView.kt
|
iamporus
| 203,219,989
| false
| null |
package com.prush.justanotherplayer.ui.artistslibrary
import com.prush.justanotherplayer.base.ItemRowView
interface ArtistRowView : ItemRowView {
}
| 0
|
Kotlin
|
2
| 8
|
1d83a0cd55fa1d92c5bc1a6b0a95c34056809a14
| 149
|
Yamp
|
Apache License 2.0
|
simple/src/test/java/com/sovegetables/util/ExampleUnitTest.kt
|
sovegetables
| 217,002,321
| false
|
{"Java": 282474, "Kotlin": 116065}
|
package com.sovegetables.util
import org.junit.Test
import java.util.concurrent.ExecutorService
import java.util.concurrent.Executors
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
val executor: ExecutorService = Executors.newCachedThreadPool()
executor.submit(Runnable {
})
executor.shutdown()
}
}
| 1
|
Java
|
1
| 7
|
38ecff18409fe08ef43136d3f8c96b2e12fc1573
| 517
|
shineandroid
|
Apache License 2.0
|
core/database/src/commonMain/kotlin/com/google/samples/apps/nowinandroid/core/database/dao/NewsResourceDao.kt
|
khalid64927
| 813,915,854
| false
|
{"Kotlin": 1284599, "Shell": 14536, "HTML": 2098, "JavaScript": 1122, "Swift": 594, "CSS": 342}
|
/*
* Copyright 2022 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.samples.apps.nowinandroid.core.database.dao
import app.cash.sqldelight.coroutines.asFlow
import app.cash.sqldelight.coroutines.mapToList
import com.google.samples.apps.nowinandroid.core.database.NiaDatabase
import com.google.samples.apps.nowinandroid.core.database.model.NewsResourceEntity
import com.google.samples.apps.nowinandroid.core.database.model.NewsResourceTopicCrossRef
import com.google.samples.apps.nowinandroid.core.database.model.PopulatedNewsResource
import com.google.samples.apps.nowinandroid.core.model.data.NewsResource
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.flow.Flow
import kotlinx.datetime.Instant
/**
* DAO for [NewsResource] and [NewsResourceEntity] access
*/
class NewsResourceDao(db: NiaDatabase, private val dispatcher: CoroutineDispatcher) : NewsResourceDaoInterface {
private val query = db.newsResourceQueries
/**
* Fetches news resources that match the query parameters
*/
override fun getNewsResources(
useFilterTopicIds: Boolean,
filterTopicIds: Set<String>,
useFilterNewsIds: Boolean,
filterNewsIds: Set<String>,
): Flow<List<PopulatedNewsResource>> {
return query.getNewsResources(
useFilterTopicIds = useFilterTopicIds,
filterTopicIds = filterTopicIds,
useFilterNewsIds = useFilterNewsIds,
filterNewsIds = filterNewsIds,
) { id, title, content, url, headerImageUrl, publishDate, type ->
PopulatedNewsResource(
entity = NewsResourceEntity(
id = id,
title = title,
content = content,
url = url,
headerImageUrl = headerImageUrl,
publishDate = Instant.fromEpochMilliseconds(publishDate),
type = type,
),
// TODO Dealing with NewsResources <-> Topics relationship
topics = emptyList(),
)
}
.asFlow()
.mapToList(dispatcher)
}
/**
* Fetches ids of news resources that match the query parameters
*/
override fun getNewsResourceIds(
useFilterTopicIds: Boolean,
filterTopicIds: Set<String>,
useFilterNewsIds: Boolean,
filterNewsIds: Set<String>,
): Flow<List<String>> {
return query.getNewsResourceIds(
useFilterTopicIds = useFilterTopicIds,
filterTopicIds = filterTopicIds,
useFilterNewsIds = useFilterNewsIds,
filterNewsIds = filterNewsIds,
)
.asFlow()
.mapToList(dispatcher)
}
/**
* Inserts [entities] into the db if they don't exist, and ignores those that do
*/
override suspend fun insertOrIgnoreNewsResources(entities: List<NewsResourceEntity>): List<Long> {
entities.forEach {
query.insertOrIgnoreNewsResource(
id = it.id,
title = it.title,
content = it.content,
url = it.url,
header_image_url = it.headerImageUrl,
publish_date = it.publishDate.toEpochMilliseconds(),
type = it.type,
)
}
// TODO Return the inserted ids
return entities.mapNotNull {
it.id.toLongOrNull()
}
}
/**
* Inserts or updates [newsResourceEntities] in the db under the specified primary keys
*/
override suspend fun upsertNewsResources(newsResourceEntities: List<NewsResourceEntity>) {
newsResourceEntities.forEach {
query.upsertNewsResource(
id = it.id,
title = it.title,
content = it.content,
url = it.url,
header_image_url = it.headerImageUrl,
publish_date = it.publishDate.toEpochMilliseconds(),
type = it.type,
)
}
}
override suspend fun insertOrIgnoreTopicCrossRefEntities(
newsResourceTopicCrossReferences: List<NewsResourceTopicCrossRef>,
) {
newsResourceTopicCrossReferences.forEach {
query.insertOrIgnoreTopicCrossRefEntitiy(
news_resource_id = it.newsResourceId,
topic_id = it.topicId,
)
}
}
/**
* Deletes rows in the db matching the specified [ids]
*/
override suspend fun deleteNewsResources(ids: List<String>) {
query.deleteNewsResources(ids)
}
}
| 10
|
Kotlin
|
0
| 0
|
620ad9acbec33b5cdb316aafbb8376bd0718e875
| 5,185
|
nowinkmp-copy
|
Apache License 2.0
|
libraries/csm.cloud.common.web/src/main/kotlin/com/bosch/pt/csm/cloud/common/config/ExceptionMessageHideFilter.kt
|
boschglobal
| 805,348,245
| false
|
{"Kotlin": 13156190, "HTML": 274761, "Go": 184388, "HCL": 158560, "Shell": 117666, "Java": 52634, "Python": 51306, "Dockerfile": 10348, "Vim Snippet": 3969, "CSS": 344}
|
/*
* ************************************************************************
*
* Copyright: <NAME> Power Tools GmbH, 2018 - 2021
*
* ************************************************************************
*/
package com.bosch.pt.csm.cloud.common.config
import com.bosch.pt.csm.cloud.common.exceptions.BlockOperationsException
import com.bosch.pt.csm.cloud.common.exceptions.MdcConstants.RESPONSE_HTTP_STATUS_CODE
import datadog.trace.api.GlobalTracer
import jakarta.servlet.FilterChain
import jakarta.servlet.http.HttpServletRequest
import jakarta.servlet.http.HttpServletResponse
import java.util.Locale
import org.slf4j.LoggerFactory
import org.slf4j.MDC
import org.springframework.context.MessageSource
import org.springframework.context.i18n.LocaleContextHolder
import org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR
import org.springframework.http.HttpStatus.SERVICE_UNAVAILABLE
import org.springframework.http.MediaType.APPLICATION_JSON_VALUE
import org.springframework.lang.NonNull
import org.springframework.web.filter.OncePerRequestFilter
class ExceptionMessageHideFilter(private val messageSource: MessageSource) :
OncePerRequestFilter() {
public override fun doFilterInternal(
@NonNull request: HttpServletRequest,
@NonNull response: HttpServletResponse,
@NonNull filterChain: FilterChain
) {
try {
filterChain.doFilter(request, response)
} catch (ex: BlockOperationsException) {
MDC.put(RESPONSE_HTTP_STATUS_CODE, SERVICE_UNAVAILABLE.toString())
val logMessage = messageSource.getMessage(ex.messageKey, arrayOf(), Locale.ENGLISH)
LOGGER.info(logMessage, ex)
MDC.remove(RESPONSE_HTTP_STATUS_CODE)
response.status = SERVICE_UNAVAILABLE.value()
response.contentType = APPLICATION_JSON_VALUE
messageSource.getMessage(ex.messageKey, arrayOf(), LocaleContextHolder.getLocale()).let {
response.writer.write(
"{\"message\":\" $it \",\"traceId\":\"${GlobalTracer.get().traceId}\"}")
}
} catch (@Suppress("TooGenericExceptionCaught") ex: RuntimeException) {
MDC.put(RESPONSE_HTTP_STATUS_CODE, INTERNAL_SERVER_ERROR.toString())
LOGGER.warn(ex.message, ex)
MDC.remove(RESPONSE_HTTP_STATUS_CODE)
response.status = INTERNAL_SERVER_ERROR.value()
response.contentType = APPLICATION_JSON_VALUE
response.writer.write(
"{\"message\":\"Internal error occurred.\",\"traceId\":\"${GlobalTracer.get().traceId}\"}")
}
}
companion object {
private val LOGGER = LoggerFactory.getLogger(ExceptionMessageHideFilter::class.java)
}
}
| 0
|
Kotlin
|
3
| 9
|
9f3e7c4b53821bdfc876531727e21961d2a4513d
| 2,617
|
bosch-pt-refinemysite-backend
|
Apache License 2.0
|
platform/backend/core/src/integrationTest/kotlin/io/hamal/core/req/handler/flow/UpdateFlowHandlerTest.kt
|
hamal-io
| 622,870,037
| false
|
{"Kotlin": 2114763, "C": 1398432, "TypeScript": 279976, "Lua": 100966, "C++": 40651, "Makefile": 11728, "Java": 7564, "JavaScript": 3406, "CMake": 2810, "CSS": 1626, "HTML": 1239, "Shell": 977}
|
package io.hamal.core.req.handler.flow
import io.hamal.core.req.handler.BaseReqHandlerTest
import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.Test
internal class UpdateFlowHandlerTest : BaseReqHandlerTest() {
@Test
@Disabled
fun `Updates flow`() {
TODO()
}
}
| 26
|
Kotlin
|
0
| 0
|
64288303fd12b334787c7bbb15afbaa99f716125
| 300
|
hamal
|
Creative Commons Zero v1.0 Universal
|
app/src/main/kotlin/io/github/feelfreelinux/wykopmobilny/ui/modules/mikroblog/feed/tag/TagActivity.kt
|
saletrak
| 102,412,247
| true
|
{"Kotlin": 211185}
|
package io.github.feelfreelinux.wykopmobilny.ui.modules.mikroblog.feed.tag
import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.view.Menu
import android.view.MenuItem
import io.github.feelfreelinux.wykopmobilny.R
import io.github.feelfreelinux.wykopmobilny.WykopApp
import io.github.feelfreelinux.wykopmobilny.base.BaseActivity
import io.github.feelfreelinux.wykopmobilny.models.dataclass.Entry
import io.github.feelfreelinux.wykopmobilny.models.fragments.DataFragment
import io.github.feelfreelinux.wykopmobilny.models.fragments.PagedDataModel
import io.github.feelfreelinux.wykopmobilny.models.fragments.getDataFragmentInstance
import io.github.feelfreelinux.wykopmobilny.models.fragments.removeDataFragment
import io.github.feelfreelinux.wykopmobilny.models.pojo.apiv2.models.TagMetaResponse
import io.github.feelfreelinux.wykopmobilny.models.pojo.apiv2.models.TagStateResponse
import io.github.feelfreelinux.wykopmobilny.ui.modules.NavigatorApi
import io.github.feelfreelinux.wykopmobilny.ui.modules.mikroblog.feed.tag.entries.TagEntriesFragment
import io.github.feelfreelinux.wykopmobilny.utils.printout
import io.github.feelfreelinux.wykopmobilny.utils.usermanager.UserManagerApi
import io.github.feelfreelinux.wykopmobilny.utils.wykop_link_handler.linkparser.TagLinkParser
import kotlinx.android.synthetic.main.activity_tag.*
import kotlinx.android.synthetic.main.toolbar.*
import javax.inject.Inject
class TagActivity : BaseActivity() {
private lateinit var entryTag : String
@Inject lateinit var navigator : NavigatorApi
companion object {
val EXTRA_TAG = "EXTRA_TAG"
fun createIntent(context : Context, tag : String): Intent {
val intent = Intent(context, TagActivity::class.java)
intent.putExtra(TagActivity.EXTRA_TAG, tag)
return intent
}
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_tag)
setSupportActionBar(toolbar)
WykopApp.uiInjector.inject(this)
entryTag = intent.getStringExtra(EXTRA_TAG)?: TagLinkParser.getTag(intent.data.toString())
fab.setOnClickListener {
navigator.openAddEntryActivity(this)
}
supportActionBar?.apply {
setDisplayHomeAsUpEnabled(true)
title = "#" + entryTag
}
supportFragmentManager.beginTransaction().replace(R.id.contentView,
TagEntriesFragment.newInstance(entryTag)).commit()
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
if (item.itemId == android.R.id.home) finish()
return true
}
}
| 0
|
Kotlin
|
0
| 0
|
0f2b65a46888e193134e8b94dacf5653ce5bb0ea
| 2,722
|
WykopMobilny
|
MIT License
|
app/src/main/java/com/kire/audio/device/audio/functional/MediaCommands.kt
|
KiREHwYE
| 674,992,893
| false
|
{"Kotlin": 258878}
|
package com.kire.audio.device.audio.functional
import kotlinx.coroutines.flow.MutableStateFlow
object MediaCommands {
val isPlayRequired = MutableStateFlow(true)
val isNextTrackRequired = MutableStateFlow(false)
val isPreviousTrackRequired = MutableStateFlow(false)
val isRepeatRequired = MutableStateFlow(false)
val isTrackRepeated = MutableStateFlow(false)
}
| 0
|
Kotlin
|
0
| 0
|
4a0cc2a6e0a3abc7c4bd8996cbbf059ecc9d801a
| 382
|
Meowdio
|
Apache License 2.0
|
plugins/world/player/settings/toggle.kts
|
luna-rs
| 41,239,479
| false
|
{"Gradle Kotlin DSL": 2, "Java Properties": 1, "Markdown": 5, "Shell": 1, "Ignore List": 1, "Batchfile": 1, "Text": 8, "YAML": 2, "Kotlin": 209, "INI": 1, "Java": 342, "CSS": 1, "XML": 1, "JSON": 9, "SQL": 3}
|
package world.player.settings
import api.predef.*
import io.luna.game.model.mob.PlayerSettings.*
/**
* Running settings.
*/
button(152) { plr.isRunning = false }
button(153) { plr.isRunning = true }
/**
* Auto-retaliate settings.
*/
button(150) { plr.settings.isAutoRetaliate = true }
button(151) { plr.settings.isAutoRetaliate = false }
/**
* Screen brightness settings.
*/
button(906) { plr.settings.brightnessLevel = BrightnessLevel.DARK }
button(908) { plr.settings.brightnessLevel = BrightnessLevel.NORMAL }
button(910) { plr.settings.brightnessLevel = BrightnessLevel.BRIGHT }
button(912) { plr.settings.brightnessLevel = BrightnessLevel.V_BRIGHT }
/**
* Mouse button settings.
*/
button(914) { plr.settings.mouseType = MouseType.ONE_BUTTON }
button(913) { plr.settings.mouseType = MouseType.TWO_BUTTONS }
/**
* world.player.privateChat.Chat effect settings.
*/
button(915) { plr.settings.isChatEffects = true }
button(916) { plr.settings.isChatEffects = false }
/**
* Split private chat settings.
*/
button(957) { plr.settings.isSplitPrivateChat = true }
button(958) { plr.settings.isSplitPrivateChat = false }
/**
* Accept aid settings.
*/
button(12464) { plr.settings.isAcceptAid = true }
button(12465) { plr.settings.isAcceptAid = false }
/**
* Music volume settings.
*/
button(930) { plr.settings.musicVolume = VolumeLevel.OFF }
button(931) { plr.settings.musicVolume = VolumeLevel.ONE }
button(932) { plr.settings.musicVolume = VolumeLevel.TWO }
button(933) { plr.settings.musicVolume = VolumeLevel.THREE }
button(934) { plr.settings.musicVolume = VolumeLevel.FOUR }
/**
* Effect volume settings.
*/
button(941) { plr.settings.effectsVolume = VolumeLevel.OFF }
button(942) { plr.settings.effectsVolume = VolumeLevel.ONE }
button(943) { plr.settings.effectsVolume = VolumeLevel.TWO }
button(944) { plr.settings.effectsVolume = VolumeLevel.THREE }
button(945) { plr.settings.effectsVolume = VolumeLevel.FOUR }
| 52
|
Java
|
42
| 152
|
876bbe43345953a4f700c670eb999b761cc2a624
| 1,973
|
luna
|
MIT License
|
query/src/main/kotlin/me/rasztabiga/thesis/query/infrastructure/db/SpringDataOrderDeliveryRepository.kt
|
BartlomiejRasztabiga
| 604,846,079
| false
|
{"Kotlin": 368953, "TypeScript": 109077, "Python": 10389, "Dockerfile": 1695, "Shell": 662, "JavaScript": 639, "CSS": 59}
|
package me.rasztabiga.thesis.query.infrastructure.db
import me.rasztabiga.thesis.query.domain.query.entity.DeliveryStatus
import me.rasztabiga.thesis.query.domain.query.entity.OrderDeliveryEntity
import org.springframework.data.mongodb.repository.ReactiveMongoRepository
import org.springframework.stereotype.Repository
import reactor.core.publisher.Flux
import reactor.core.publisher.Mono
import java.util.*
@Repository
interface SpringDataOrderDeliveryRepository : ReactiveMongoRepository<OrderDeliveryEntity, UUID> {
fun findAllByStatus(status: DeliveryStatus): Flux<OrderDeliveryEntity>
fun findAllByStatusIn(statuses: Set<DeliveryStatus>): Flux<OrderDeliveryEntity>
fun findByCourierId(courierId: String): Flux<OrderDeliveryEntity>
fun findFirstByCourierIdAndStatusIn(courierId: String, statuses: Set<DeliveryStatus>): Mono<OrderDeliveryEntity>
}
| 4
|
Kotlin
|
0
| 2
|
dbb3b329f06f951b9531b03cc41d1e1e52bf7422
| 873
|
thesis
|
MIT License
|
app/src/main/java/my/dictionary/free/data/di/modules/MainActivityModule.kt
|
viacheslavtitov
| 605,498,191
| false
|
{"Kotlin": 171766}
|
package my.dictionary.free.data.di.modules
import android.content.Context
import com.google.firebase.database.ktx.database
import com.google.firebase.ktx.Firebase
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.android.components.ActivityRetainedComponent
import dagger.hilt.android.qualifiers.ApplicationContext
import dagger.hilt.components.SingletonComponent
import my.dictionary.free.BuildConfig
import my.dictionary.free.data.repositories.DatabaseRepository
import my.dictionary.free.domain.usecases.dictionary.GetCreateDictionaryUseCase
import my.dictionary.free.domain.usecases.languages.GetDictionaryLanguagesUseCase
import my.dictionary.free.domain.usecases.users.GetUpdateUsersUseCase
import my.dictionary.free.domain.usecases.words.WordsUseCase
import my.dictionary.free.domain.utils.PreferenceUtils
import javax.inject.Singleton
@Module
@InstallIn(SingletonComponent::class)
object MainActivityModule {
@Provides
fun provideDatabaseRepository(): DatabaseRepository {
return DatabaseRepository(Firebase.database(BuildConfig.FIREBASE_DATABASE_URL))
}
@Provides
fun provideGetUpdateUsersUseCase(
databaseRepository: DatabaseRepository,
preferenceUtils: PreferenceUtils
): GetUpdateUsersUseCase {
return GetUpdateUsersUseCase(databaseRepository, preferenceUtils)
}
@Provides
fun provideGetDictionaryLanguagesUseCase(): GetDictionaryLanguagesUseCase {
return GetDictionaryLanguagesUseCase()
}
@Provides
fun provideWordsUseCase(
databaseRepository: DatabaseRepository,
preferenceUtils: PreferenceUtils
): WordsUseCase {
return WordsUseCase(databaseRepository, preferenceUtils)
}
@Provides
fun provideGetCreateDictionaryUseCase(
databaseRepository: DatabaseRepository,
preferenceUtils: PreferenceUtils,
getDictionaryLanguagesUseCase: GetDictionaryLanguagesUseCase
): GetCreateDictionaryUseCase {
return GetCreateDictionaryUseCase(
databaseRepository,
preferenceUtils,
getDictionaryLanguagesUseCase
)
}
@Singleton
@Provides
fun providePreferenceUtils(@ApplicationContext context: Context): PreferenceUtils {
return PreferenceUtils(context)
}
}
| 0
|
Kotlin
|
0
| 0
|
a77bd30985f2f3005ae6a693a4a1a59c84573520
| 2,336
|
Easy-Dictionary-Android
|
MIT License
|
util/src/main/kotlin/voodoo/util/Timing.kt
|
DaemonicLabs
| 119,208,408
| false
| null |
package voodoo.util
import kotlin.contracts.ExperimentalContracts
import kotlin.contracts.InvocationKind
import kotlin.contracts.contract
/**
* Executes the given [block] and returns elapsed time in milliseconds.
*/
@UseExperimental(ExperimentalContracts::class)
public inline fun measureTimeMillis(block: () -> Unit): Long {
contract {
callsInPlace(block, InvocationKind.EXACTLY_ONCE)
}
val start = System.currentTimeMillis()
block()
return System.currentTimeMillis() - start
}
| 4
| null |
7
| 28
|
23614ea3102875e5fe68bb1be09873f896ebc507
| 510
|
Voodoo
|
MIT License
|
kandy-echarts/src/main/kotlin/org/jetbrains/kotlinx/kandy/echarts/layers/context/CandlestickContext.kt
|
Kotlin
| 502,039,936
| false
| null |
/*
* Copyright 2020-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
package org.jetbrains.kotlinx.ggdsl.echarts.layers
import org.jetbrains.kotlinx.ggdsl.dsl.internal.LayerCollectorContextImmutable
import org.jetbrains.kotlinx.ggdsl.dsl.internal.PlotDslMarker
import org.jetbrains.kotlinx.ggdsl.echarts.features.animation.AnimationBoxplotCandlestick
import org.jetbrains.kotlinx.ggdsl.echarts.features.animation.AnimationEasing
@PlotDslMarker
public class CandlestickContextImmutable(parent: LayerCollectorContextImmutable) : EchartsLayerContextImmutable(parent) {
/**
* Animation options settings for [candlestick][candlestick].
* If a property isn't set or set to null, a default value will be used.
*
* * [duration][AnimationBoxplotCandlestick.duration] - duration of the first animation.
* By default `1000`.
* * [easing][AnimationBoxplotCandlestick.easing] -
* [easing effect][AnimationEasing] used for the first animation.
* By default `cubicOut`.
* * [delay][AnimationBoxplotCandlestick.delay] - delay before updating the first animation.
* By default `0`.
*
* ```kotlin
* plot {
* candlestick {
* animation {
* duration = 1000
* easing = AnimationEasing.CUBIC_OUT
* delay = 0
* }
* }
* }
* ```
*
* @see AnimationEasing
*/
public val animation: AnimationBoxplotCandlestick = AnimationBoxplotCandlestick()
}
| 79
| null |
2
| 98
|
fd613edc4dd37aac0d0ecdb4245a770e09617fc7
| 1,529
|
kandy
|
Apache License 2.0
|
app/src/main/java/com/flamingo/matlogx/data/log/Log.kt
|
Flamingo-OS
| 498,781,881
| false
|
{"Kotlin": 110267}
|
/*
* Copyright (C) 2022 FlamingoOS 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.flamingo.matlogx.data.log
import android.os.SystemClock
sealed interface Log {
val parseTime: Long
val message: String
data class Divider(
override val parseTime: Long = SystemClock.elapsedRealtime(),
override val message: String
) : Log {
override fun toString(): String {
return message
}
}
data class Data(
val pid: Short?,
val time: String?,
val tag: String?,
val logLevel: LogLevel?,
override val parseTime: Long = SystemClock.elapsedRealtime(),
override val message: String
) : Log {
override fun toString(): String {
return "$time ${logLevel?.name?.first()}/$tag($pid): $message"
}
}
}
object LogFactory {
private val timeRegex = Regex("^\\d{2}-\\d{2}\\s\\d{2}:\\d{2}:\\d{2}")
private val pidRegex = Regex("\\(\\s*\\d+\\)")
fun fromString(logLine: String): Log {
// Filter buffer separators
if (logLine.startsWith("-")) {
return Log.Divider(message = logLine)
}
// Log format:
// DD-MM HH:MM:SS D/TAG( PID): message
val metadata = logLine.substringBefore("/")
val pid = pidRegex.find(logLine)?.value
?.substringAfter("(")
?.substringBefore(")")
?.trim()
?.toShortOrNull()
val logLevel = metadata.lastOrNull()
return Log.Data(
pid = pid,
time = timeRegex.find(metadata)?.value,
// Assuming that no one insane used ( in their tag
tag = logLine.substringAfter("/").substringBefore("("),
logLevel = LogLevel.values().find { it.name.first() == logLevel },
message = logLine.substringAfter("):").trim(),
)
}
}
| 0
|
Kotlin
|
2
| 0
|
2e000a4c309a137a7cb351ac18ceb8aa597d05fe
| 2,416
|
packages_apps_MatlogX
|
Apache License 2.0
|
app/src/main/java/com/xcheko51x/crud_room_compose_kotlin/room/UsuariosDatabaseDao.kt
|
german654
| 851,339,674
| false
|
{"Kotlin": 26298}
|
package com.xcheko51x.crud_room_compose_kotlin.room
import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.Query
import androidx.room.Update
import com.xcheko51x.crud_room_compose_kotlin.models.Usuarios
import kotlinx.coroutines.flow.Flow
@Dao
interface UsuariosDatabaseDao {
@Query("SELECT * FROM usuarios")
fun obtenerUsuarios(): Flow<List<Usuarios>>
@Query("SELECT * FROM usuarios WHERE id = :id")
fun obtenerUsuario(id: Int): Flow<Usuarios>
@Insert
suspend fun agregarUsuario(usuario: Usuarios)
@Update
suspend fun actualizarUsuario(usuario: Usuarios)
@Delete
suspend fun borrarUsuario(usuario: Usuarios)
}
| 0
|
Kotlin
|
0
| 0
|
42cb481b7290ee089f93da33e4f2dbd81432e1fb
| 705
|
Proyecto-bolsa-Laboral
|
MIT License
|
app/src/main/java/com/muratcangzm/valorantstore/model/remote/EventsModel.kt
|
NecroEye
| 719,144,732
| false
|
{"Kotlin": 17524}
|
package com.muratcangzm.valorantstore.model
import com.google.gson.annotations.Expose
import com.google.gson.annotations.SerializedName
import java.util.Date
data class EventsModel(
@SerializedName("status")
@Expose
val status : Int?,
@SerializedName("data")
@Expose
val eventData: List<EventData>?
) {
data class EventData(
@SerializedName("displayName")
@Expose
val displayName: String?,
@SerializedName("shortDisplayName")
@Expose
val shortDisplayName: String?,
@SerializedName("startTime")
@Expose
val startTime : Date?,
@SerializedName("endTime")
@Expose
val endTime: Date?,
@SerializedName("assetPath")
@Expose
val assetPath: String?
){}
}
| 0
|
Kotlin
|
0
| 0
|
4409822d79d8dbfdcad8f128f666cddac886c0bf
| 802
|
Valorant_Store
|
Apache License 2.0
|
app/src/main/kotlin/me/echeung/moemoekyun/viewmodel/UserViewModel.kt
|
LISTEN-moe
| 86,269,685
| false
| null |
package me.echeung.moemoekyun.viewmodel
import androidx.databinding.Bindable
import androidx.databinding.library.baseAdapters.BR
import me.echeung.moemoekyun.client.api.model.User
class UserViewModel : BaseViewModel() {
@get:Bindable
var user: User? = null
set(user) {
field = user
notifyPropertyChanged(BR.user)
}
@get:Bindable
var avatarUrl: String? = null
set(avatarUrl) {
field = avatarUrl
notifyPropertyChanged(BR.avatarUrl)
}
@get:Bindable
var bannerUrl: String? = null
set(bannerUrl) {
field = bannerUrl
notifyPropertyChanged(BR.bannerUrl)
}
@get:Bindable
var hasFavorites: Boolean = false
set(hasFavorites) {
field = hasFavorites
notifyPropertyChanged(BR.hasFavorites)
}
fun reset() {
user = null
avatarUrl = null
bannerUrl = null
hasFavorites = false
}
}
| 8
|
Kotlin
|
25
| 210
|
13eee483d8b3edb1065a4c089d99f2950a211f2b
| 1,004
|
android-app
|
MIT License
|
vector/src/main/java/im/vector/riotx/features/home/room/detail/composer/rainbow/RainbowGenerator.kt
|
ginnyTheCat
| 295,460,879
| false
|
{"Gradle": 8, "Markdown": 16, "Java Properties": 2, "Shell": 19, "Text": 43, "Ignore List": 7, "Batchfile": 1, "EditorConfig": 1, "YAML": 2, "INI": 2, "Proguard": 5, "XML": 768, "Kotlin": 2184, "Java": 12, "JavaScript": 4, "JSON": 5, "HTML": 2, "Python": 2, "FreeMarker": 2, "Fluent": 7}
|
/*
* Copyright 2020 New Vector Ltd
*
* 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 im.vector.riotx.features.home.room.detail.composer.rainbow
import im.vector.riotx.core.utils.splitEmoji
import javax.inject.Inject
import kotlin.math.abs
import kotlin.math.roundToInt
/**
* Inspired from React-Sdk
* Ref: https://github.com/matrix-org/matrix-react-sdk/blob/develop/src/utils/colour.js
*/
class RainbowGenerator @Inject constructor() {
fun generate(text: String): String {
val split = text.splitEmoji()
val frequency = 360f / split.size
return split
.mapIndexed { idx, letter ->
// Do better than React-Sdk: Avoid adding font color for spaces
if (letter == " ") {
"$letter"
} else {
val dashColor = hueToRGB(idx * frequency, 1.0f, 0.5f).toDashColor()
"<font color=\"$dashColor\">$letter</font>"
}
}
.joinToString(separator = "")
}
private fun hueToRGB(h: Float, s: Float, l: Float): RgbColor {
val c = s * (1 - abs(2 * l - 1))
val x = c * (1 - abs((h / 60) % 2 - 1))
val m = l - c / 2
var r = 0f
var g = 0f
var b = 0f
when {
h < 60f -> {
r = c
g = x
}
h < 120f -> {
r = x
g = c
}
h < 180f -> {
g = c
b = x
}
h < 240f -> {
g = x
b = c
}
h < 300f -> {
r = x
b = c
}
else -> {
r = c
b = x
}
}
return RgbColor(
((r + m) * 255).roundToInt(),
((g + m) * 255).roundToInt(),
((b + m) * 255).roundToInt()
)
}
}
| 1
| null |
1
| 1
|
ee1d5faf0d59f9cc1c058d45fae3e811d97740fd
| 2,544
|
element-android
|
Apache License 2.0
|
app/src/main/java/com/taylorsloan/jobseer/dagger/module/view/AppModule.kt
|
taylorsloan
| 108,706,949
| false
| null |
package com.taylorsloan.jobseer.dagger.module.view
import android.app.Application
import dagger.Module
import dagger.Provides
import javax.inject.Singleton
/**
* Created by taylorsloan on 10/28/17.
*/
@Module
class AppModule(val application: Application) {
@Provides
@Singleton
fun provideApplication() : Application{
return application
}
}
| 0
|
Kotlin
|
0
| 1
|
d22fa1fdd85c828be6295d5db2af4ecdbc7b1307
| 370
|
Job-Seer
|
MIT License
|
src/test/java/com/mvv/gui/task/TaskManagerTest.kt
|
odisseylm
| 679,732,600
| false
|
{"Kotlin": 974620, "CSS": 25523, "Java": 6651}
|
package com.mvv.gui.task
import com.mvv.gui.test.useAssertJSoftAssertions
import org.junit.jupiter.api.Test
import java.util.Collections.synchronizedList
import java.util.concurrent.atomic.AtomicInteger
class TaskManagerTest {
@Test
fun addTask() { useAssertJSoftAssertions {
val v = AtomicInteger()
TaskManager {}.use { tm ->
tm.addTask("task 1") { v.incrementAndGet() }
tm.addTask(task("task 2") { v.incrementAndGet() })
tm.shutdownAndAwaitTasksCompletion()
}
assertThat(v.get()).isEqualTo(2)
} }
@Test
fun handler() { useAssertJSoftAssertions {
val v = AtomicInteger()
val notifiedTasks: MutableList<String> = synchronizedList(mutableListOf())
TaskManager(immediateRunner).use { tm ->
val handler: (TaskEvent)->Unit = { notifiedTasks.add("${it.task.name} ${it.eventType.name} ${it.error?.message ?: ""}") }
tm.addEventHandler(handler)
tm.addTask("task 1") { v.incrementAndGet() }
tm.addTask("task 2") { throw IllegalStateException("test error") }
tm.addTask("task 3") { v.incrementAndGet() }
tm.removeEventHandler(handler)
tm.addTask("task 4") { v.incrementAndGet() }
tm.shutdownAndAwaitTasksCompletion()
}
assertThat(v.get()).isEqualTo(3)
assertThat(notifiedTasks).containsExactlyInAnyOrder(
"task 1 TASK_ADDED ",
"task 2 TASK_ADDED ",
"task 3 TASK_ADDED ",
"task 4 TASK_ADDED ",
"task 1 TASK_STARTED ",
"task 1 TASK_COMPLETED ",
"task 1 TASK_REMOVED ",
"task 2 TASK_STARTED ",
"task 2 TASK_FAILED test error",
"task 2 TASK_REMOVED ",
"task 3 TASK_STARTED ",
"task 3 TASK_COMPLETED ",
"task 3 TASK_REMOVED ",
"task 4 TASK_STARTED ",
"task 4 TASK_COMPLETED ",
"task 4 TASK_REMOVED ",
)
} }
}
| 0
|
Kotlin
|
0
| 0
|
c3f9d40a9c69d9075f46e31ce70298e17320f7da
| 2,051
|
learn-words
|
Creative Commons Attribution 3.0 Unported
|
idea/idea-completion/testData/basic/common/lambdaSignature/ParameterType3.kt
|
JakeWharton
| 99,388,807
| false
| null |
fun bar() {
val handler = { i: List<<caret>> }
}
// EXIST: Int
// EXIST: String
// ABSENT: bar
// ABSENT: handler
| 1
| null |
30
| 83
|
4383335168338df9bbbe2a63cb213a68d0858104
| 118
|
kotlin
|
Apache License 2.0
|
platform/lang-impl/src/com/intellij/codeInsight/actions/ReaderModeConfigurable.kt
|
JetBrains
| 2,489,216
| false
| null |
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.codeInsight.actions
import com.intellij.application.options.colors.ReaderModeStatsCollector
import com.intellij.application.options.editor.CheckboxDescriptor
import com.intellij.application.options.editor.checkBox
import com.intellij.ide.DataManager
import com.intellij.lang.LangBundle
import com.intellij.openapi.editor.colors.EditorColorsManager
import com.intellij.openapi.editor.ex.EditorSettingsExternalizable
import com.intellij.openapi.options.BoundSearchableConfigurable
import com.intellij.openapi.options.ex.Settings
import com.intellij.openapi.project.Project
import com.intellij.openapi.ui.DialogPanel
import com.intellij.ui.components.JBCheckBox
import com.intellij.ui.dsl.builder.Cell
import com.intellij.ui.dsl.builder.panel
import com.intellij.ui.dsl.builder.selected
import com.intellij.util.PlatformUtils
internal class ReaderModeConfigurable(private val project: Project) : BoundSearchableConfigurable(
LangBundle.message("configurable.reader.mode"), "READER_MODE_HELP") {
private val settings get() = ReaderModeSettings.getInstance(project)
private val cdInlays get() = CheckboxDescriptor(LangBundle.message("checkbox.inlays"), settings::showInlaysHints)
private val cdRenderedDocs get() = CheckboxDescriptor(LangBundle.message("checkbox.rendered.docs"), settings::showRenderedDocs)
private val cdLigatures get() = CheckboxDescriptor(LangBundle.message("checkbox.ligatures"), settings::showLigatures)
private val cdLineSpacing get() = CheckboxDescriptor(LangBundle.message("checkbox.line.spacing"), settings::increaseLineSpacing)
private val cdWarnings get() = CheckboxDescriptor(LangBundle.message("checkbox.hide.warnings"), settings::showWarnings)
private val cdEnabled get() = CheckboxDescriptor(LangBundle.message("checkbox.reader.mode.toggle"), settings::enabled)
override fun createPanel(): DialogPanel {
return panel {
lateinit var enabled: Cell<JBCheckBox>
row {
enabled = checkBox(cdEnabled).comment("")
.comment(LangBundle.message("checkbox.reader.mode.toggle.comment"))
}
indent {
buttonsGroup(LangBundle.message("titled.border.reader.mode.settings")) {
row {
val renderedDocs = EditorSettingsExternalizable.getInstance().isDocCommentRenderingEnabled
checkBox(cdRenderedDocs).enabled(!renderedDocs)
if (renderedDocs) {
comment(LangBundle.message("checkbox.reader.mode.go.to.global.settings")) {
goToGlobalSettings("editor.preferences.appearance")
}
}
}
row {
checkBox(cdWarnings)
}
row {
val useLigatures = EditorColorsManager.getInstance().globalScheme.fontPreferences.useLigatures()
checkBox(cdLigatures).enabled(!useLigatures)
if (useLigatures) {
comment(LangBundle.message("checkbox.reader.mode.go.to.global.settings")) {
goToGlobalSettings("editor.preferences.fonts.default")
}
}
}
row {
checkBox(cdLineSpacing)
comment(LangBundle.message("checkbox.reader.mode.line.height.comment"))
}.enabledIf(enabled.selected)
row {
checkBox(cdInlays).visible(PlatformUtils.isIntelliJ())
}
}
}.enabledIf(enabled.selected)
}
}
override fun apply() {
super.apply()
project.messageBus.syncPublisher(ReaderModeSettingsListener.TOPIC).modeChanged(project)
}
fun goToGlobalSettings(configurableID: String) {
DataManager.getInstance().dataContextFromFocusAsync.onSuccess { context ->
context?.let { dataContext ->
Settings.KEY.getData(dataContext)?.let { settings ->
settings.select(settings.find(configurableID))
ReaderModeStatsCollector.logSeeAlsoNavigation()
}
}
}
}
}
| 191
| null |
4372
| 13,319
|
4d19d247824d8005662f7bd0c03f88ae81d5364b
| 4,033
|
intellij-community
|
Apache License 2.0
|
idea/testData/inspectionsLocal/scopeFunctions/letToRun/nestedLambda.kt
|
JakeWharton
| 99,388,807
| true
| null |
// WITH_RUNTIME
val x = hashSetOf("abc").<caret>let {
it.forEach {
println(it)
}
}
| 0
|
Kotlin
|
28
| 83
|
4383335168338df9bbbe2a63cb213a68d0858104
| 100
|
kotlin
|
Apache License 2.0
|
jpa2.0-rxjava2/src/main/kotlin/net/eraga/jpa/async/RxPersistence.kt
|
eraga
| 132,671,655
| false
| null |
package net.eraga.jpa.async
import io.reactivex.Single
import javax.persistence.EntityManagerFactory
import javax.persistence.Persistence
import javax.persistence.PersistenceException
import javax.persistence.PersistenceUtil
/**
* RxJava2 wrapper for [Persistence] class
*/
object RxPersistence {
/**
* Create and return an EntityManagerFactory for the named persistence unit.
*
* @param persistenceUnitName The name of the persistence unit
*
* @return The factory that creates EntityManagers configured according to the specified persistence unit
*/
fun createEntityManagerFactory(persistenceUnitName: String): Single<EntityManagerFactory> {
return createEntityManagerFactory(persistenceUnitName, null)
}
/**
* Create and return an EntityManagerFactory for the named persistence unit using the given properties.
*
* @param persistenceUnitName The name of the persistence unit
* @param properties Additional properties to use when creating the factory. The values of these properties override
* any values that may have been configured elsewhere
*
* @return The factory that creates EntityManagers configured according to the specified persistence unit
*/
fun createEntityManagerFactory(persistenceUnitName: String, properties: Map<*, *>?): Single<EntityManagerFactory> = blockingSingle {
Persistence.createEntityManagerFactory(persistenceUnitName, properties)
}
/**
* @return Returns a `PersistenceUtil` instance.
*/
fun getPersistenceUtil(): PersistenceUtil = Persistence.getPersistenceUtil()
}
| 0
|
Kotlin
|
1
| 3
|
a515723d7023393d3438006bd44ac83b4296de00
| 1,632
|
async-jpa
|
Apache License 2.0
|
src/test/kotlin/com/korektur/scheduler/lock/H2BasedTaskExecutionLockTest.kt
|
korektur
| 134,327,082
| false
|
{"Kotlin": 29594, "Java": 804}
|
package com.korektur.scheduler.lock
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
class H2BasedTaskExecutionLockTestL : H2BasedTest() {
private lateinit var lock: H2BasedTaskExecutionLock
@BeforeEach
fun setUp() {
createServer()
lock = H2BasedTaskExecutionLock(2, dataSource, "public")
}
@Test
fun initializationQuery() {
lock.initialize()
}
}
| 0
|
Kotlin
|
0
| 0
|
def5b3adce0df5b939615c19eff00b61c2ab192a
| 429
|
distributed-scheduler
|
Apache License 2.0
|
plugins/completion-ml-ranking/src/com/intellij/completion/ml/sorting/ElementFeatures.kt
|
ingokegel
| 72,937,917
| false
| null |
package com.intellij.completion.ml.sorting
data class ElementFeatures(val relevance: MutableMap<String, Any>, val additional: MutableMap<String, Any>)
| 1
| null |
1
| 2
|
b07eabd319ad5b591373d63c8f502761c2b2dfe8
| 151
|
intellij-community
|
Apache License 2.0
|
gradle-plugin/src/main/java/com/anatawa12/modPatching/resourcesDev/ResourcesContainer.kt
|
fixrtm
| 343,694,407
| false
| null |
package com.anatawa12.modPatching.resourcesDev
import com.anatawa12.modPatching.common.DownloadingMod
import groovy.lang.Closure
import org.gradle.api.Action
import org.gradle.api.NamedDomainObjectContainer
import org.gradle.util.ConfigureUtil
interface ResourcesContainer : NamedDomainObjectContainer<ResourcesConfig> {
// the adapter class names.
// please choose from
val forgeFmlCoreModClassName: String
val cpwFmlCoreModClassName: String
fun ofMod(mod: DownloadingMod, block: Action<ResourcesConfig>): ResourcesConfig
fun ofMod(mod: DownloadingMod, block: Closure<*>): ResourcesConfig = ofMod(mod, ConfigureUtil.configureUsing(block))
fun ofMod(mod: DownloadingMod): ResourcesConfig = ofMod(mod) {}
}
| 24
| null |
1
| 2
|
b2d76448b47a543238700c1834a913b4ba6977af
| 737
|
mod-patching
|
Apache License 2.0
|
compiler/testData/codegen/box/inlineClasses/callableReferences/boundInlineClassPrimaryVal.kt
|
JetBrains
| 3,432,266
| false
|
{"Kotlin": 79571273, "Java": 6776465, "Swift": 4063829, "C": 2609744, "C++": 1957654, "Objective-C++": 175279, "JavaScript": 130754, "Python": 59855, "Shell": 34920, "Objective-C": 21463, "Lex": 21452, "Batchfile": 11382, "CSS": 11368, "Ruby": 10470, "Dockerfile": 9907, "Groovy": 7092, "EJS": 5241, "CMake": 4473, "HTML": 2699, "Puppet": 1698, "FreeMarker": 1393, "Roff": 725, "Scala": 80}
|
// !LANGUAGE: +InlineClasses
// WITH_RUNTIME
inline class Z(val x: Int) {
val xx get() = x
}
inline class L(val x: Long) {
val xx get() = x
}
inline class S(val x: String) {
val xx get() = x
}
fun box(): String {
if (Z(42)::xx.get() != 42) throw AssertionError()
if (L(1234L)::xx.get() != 1234L) throw AssertionError()
if (S("abcdef")::xx.get() != "abcdef") throw AssertionError()
return "OK"
}
| 181
|
Kotlin
|
5748
| 49,172
|
33eb9cef3d146062c103f9853d772f0a1da0450e
| 427
|
kotlin
|
Apache License 2.0
|
bbfgradle/tmp/results/diffCompile/lmvbtmt.kt
|
DaniilStepanov
| 346,008,310
| false
|
{"Markdown": 122, "Gradle": 762, "Gradle Kotlin DSL": 649, "Java Properties": 23, "Shell": 49, "Ignore List": 20, "Batchfile": 26, "Git Attributes": 8, "Kotlin": 82508, "Protocol Buffer": 12, "Java": 6674, "Proguard": 12, "XML": 1698, "Text": 13298, "INI": 221, "JavaScript": 294, "JAR Manifest": 2, "Roff": 217, "Roff Manpage": 38, "JSON": 199, "HTML": 2429, "AsciiDoc": 1, "YAML": 21, "EditorConfig": 1, "OpenStep Property List": 19, "C": 79, "Objective-C": 68, "C++": 169, "Swift": 68, "Pascal": 1, "Python": 4, "CMake": 2, "Objective-C++": 12, "Groovy": 45, "Dockerfile": 3, "Diff": 1, "EJS": 1, "CSS": 6, "Ruby": 6, "SVG": 50, "JFlex": 3, "Maven POM": 107, "JSON with Comments": 9, "Ant Build System": 53, "Graphviz (DOT)": 78, "Scala": 1}
|
// Different compile happens on:JVM ,JVM -Xnew-inference
class B
fun B.magic():Unit = TODO()
fun boom(a: Any) {
when (a) {
is B ->
(a
::magic)
}
}
| 1
| null |
1
| 1
|
e772ef1f8f951873ebe7d8f6d73cf19aead480fa
| 164
|
kotlinWithFuzzer
|
Apache License 2.0
|
issue-repro/src/main/kotlin/com/airbnb/lottie/issues/IssueReproViewModel.kt
|
pitmobboss101
| 716,419,861
| false
|
{"INI": 4, "Shell": 5, "Markdown": 9, "XML": 193, "Gradle": 10, "Java Properties": 1, "EditorConfig": 1, "Git Attributes": 1, "Batchfile": 1, "Text": 3, "JavaScript": 1, "Ignore List": 1, "JSON": 404, "Kotlin": 163, "YAML": 3, "SVG": 5, "Java": 220, "TOML": 1, "Proguard": 1}
|
package com.airbnb.lottie.issues
import android.content.Context
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.airbnb.lottie.LottieCompositionFactory
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
class IssueReproViewModel: ViewModel() {
private val cacheKey = "cache_key"
private val _resultFromSync = MutableLiveData("Click Sync Load")
val resultFromSync: LiveData<String> = _resultFromSync
private val _resultFromAsync = MutableLiveData("Click Async Load")
val resultFromAsync: LiveData<String> = _resultFromAsync
fun getAndCompareLottieSync(context: Context) {
_resultFromSync.postValue("Loading...")
viewModelScope.launch(Dispatchers.IO) {
clearLottieCache(context)
val firstLottie = LottieCompositionFactory.fromRawResSync(context, R.raw.heart, cacheKey)
val shouldBeFromCache = LottieCompositionFactory.fromRawResSync(context, R.raw.heart, cacheKey)
_resultFromSync.postValue("Lottie fromRawResSync is same ref: ${firstLottie === shouldBeFromCache}")
}
}
fun getAndCompareLottieAsync(context: Context) {
_resultFromAsync.postValue("Loading...")
clearLottieCache(context)
LottieCompositionFactory.fromRawRes(context, R.raw.heart, cacheKey).addListener {firstLottie ->
LottieCompositionFactory.fromRawRes(context, R.raw.heart, cacheKey).addListener { shouldBeFromCache ->
_resultFromAsync.postValue("Lottie fromRawRes is same ref: ${firstLottie === shouldBeFromCache}")
}
}
}
private fun clearLottieCache(context: Context) {
LottieCompositionFactory.clearCache(context)
}
}
| 1
| null |
1
| 1
|
49b38b93bba7ef47526c114b1411cc6efc2783a6
| 1,824
|
lottie-android
|
Apache License 2.0
|
educational-core/src/com/jetbrains/edu/learning/courseGeneration/ProjectOpenerImpl.kt
|
JetBrains
| 43,696,115
| false
| null |
package com.jetbrains.edu.learning.courseGeneration
import com.intellij.openapi.project.Project
import com.jetbrains.edu.learning.courseFormat.Course
import com.jetbrains.edu.learning.newproject.ui.JoinCourseDialog
import com.jetbrains.edu.learning.newproject.ui.coursePanel.CourseDisplaySettings
import com.jetbrains.edu.learning.stepik.builtInServer.EduBuiltInServerUtils
class ProjectOpenerImpl : ProjectOpener() {
override fun newProject(course: Course): Boolean {
return JoinCourseDialog(course, CourseDisplaySettings(showTagsPanel = false, showInstructorField = false)).showAndGet()
}
override fun focusOpenProject(coursePredicate: (Course) -> Boolean): Pair<Project, Course>? =
EduBuiltInServerUtils.focusOpenProject(coursePredicate)
}
| 6
|
Kotlin
|
45
| 99
|
cfc24fe13318de446b8adf6e05d1a7c15d9511b5
| 760
|
educational-plugin
|
Apache License 2.0
|
src/main/java/com/coinpaprika/apiclient/entity/CoinEntity.kt
|
ligi
| 160,554,207
| false
| null |
package com.coinpaprika.apiclient.entity
import com.google.gson.annotations.SerializedName
data class CoinEntity(val id: String,
val name: String,
val symbol: String,
val rank: Int,
@SerializedName("is_new") val isNew: Boolean,
@SerializedName("is_active") val isActive: Boolean)
| 1
| null |
1
| 1
|
582c7a687613a8a125d90d8b09aee40241c26043
| 391
|
coinpaprika-api-kotlin-client
|
MIT License
|
src/main/kotlin/io/hirasawa/server/logger/ConsoleLogger.kt
|
cg0
| 256,633,551
| false
|
{"Kotlin": 337713, "Java": 6661}
|
package io.hirasawa.server.logger
class ConsoleLogger: Logger() {
override fun log(message: Any) {
println("$timestamp $message")
}
}
| 37
|
Kotlin
|
0
| 6
|
ce416d649095bbaee105fcbaa88e9a3c7cf745ac
| 150
|
Hirasawa-Project
|
MIT License
|
permissionsmanager/src/main/java/com/skumar/manager/viewModel/PermissionViewModel.kt
|
ksughosh
| 98,284,956
| false
|
{"Gradle": 4, "Java Properties": 2, "Shell": 1, "Text": 1, "Ignore List": 3, "Batchfile": 1, "Markdown": 1, "Proguard": 2, "XML": 12, "Kotlin": 18, "Java": 1}
|
/*
* @author Sughosh on 04/03/2020.
*
* Copyright (C) 04/03/2020 <NAME>
* 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 NON-INFRINGEMENT. IN NO EVENT SHALL THE SUGHOSH KRISHNA KUMAR 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.skumar.manager.manager.data
import com.skumar.manager.data.Permission
internal sealed class PermissionRequest {
internal abstract val permission: Permission
internal class AskPermission(override val permission: Permission) : PermissionRequest()
internal class AlreadyGranted(override val permission: Permission) : PermissionRequest()
internal class DeniedForever(override val permission: Permission) : PermissionRequest()
internal class InvalidPermission(override val permission: Permission) : PermissionRequest()
}
| 1
| null |
1
| 1
|
81e6c3afdfa3281afe20779df643f73cce601515
| 1,685
|
PermissionsManager
|
MIT License
|
app/src/main/kotlin/kr/ac/snu/hcil/omnitrack/core/analytics/OTUsageLoggingManager.kt
|
yghokim
| 62,933,149
| false
| null |
package kr.ac.snu.hcil.omnitrack.core.analytics
import android.content.Context
import android.os.Looper
import androidx.work.ExistingWorkPolicy
import androidx.work.OneTimeWorkRequest
import androidx.work.WorkManager
import com.github.salomonbrys.kotson.*
import com.google.gson.JsonObject
import dagger.internal.Factory
import io.realm.Realm
import kr.ac.snu.hcil.android.common.ConcurrentUniqueLongGenerator
import kr.ac.snu.hcil.android.common.versionCode
import kr.ac.snu.hcil.omnitrack.BuildConfig
import kr.ac.snu.hcil.omnitrack.OTAndroidApp
import kr.ac.snu.hcil.omnitrack.OTApp
import kr.ac.snu.hcil.omnitrack.core.ItemLoggingSource
import kr.ac.snu.hcil.omnitrack.core.analytics.IEventLogger.Companion.NAME_CHANGE_ATTRIBUTE
import kr.ac.snu.hcil.omnitrack.core.analytics.IEventLogger.Companion.NAME_CHANGE_ITEM
import kr.ac.snu.hcil.omnitrack.core.analytics.IEventLogger.Companion.NAME_CHANGE_SERVICE
import kr.ac.snu.hcil.omnitrack.core.analytics.IEventLogger.Companion.NAME_CHANGE_TRACKER
import kr.ac.snu.hcil.omnitrack.core.analytics.IEventLogger.Companion.NAME_CHANGE_TRIGGER
import kr.ac.snu.hcil.omnitrack.core.analytics.IEventLogger.Companion.NAME_DEVICE_STATUS_CHANGE
import kr.ac.snu.hcil.omnitrack.core.analytics.IEventLogger.Companion.NAME_EXCEPTION
import kr.ac.snu.hcil.omnitrack.core.analytics.IEventLogger.Companion.NAME_SESSION
import kr.ac.snu.hcil.omnitrack.core.analytics.IEventLogger.Companion.NAME_TRACKER_DATA_EXPORT
import kr.ac.snu.hcil.omnitrack.core.analytics.IEventLogger.Companion.NAME_TRACKER_REORDER
import kr.ac.snu.hcil.omnitrack.core.analytics.IEventLogger.Companion.SUB_ADD
import kr.ac.snu.hcil.omnitrack.core.analytics.IEventLogger.Companion.SUB_EDIT
import kr.ac.snu.hcil.omnitrack.core.analytics.IEventLogger.Companion.SUB_REMOVE
import kr.ac.snu.hcil.omnitrack.core.analytics.IEventLogger.Companion.TRIGGER_FIRED
import kr.ac.snu.hcil.omnitrack.core.database.models.OTTriggerDAO
import kr.ac.snu.hcil.omnitrack.core.database.models.helpermodels.UsageLog
import kr.ac.snu.hcil.omnitrack.core.di.global.UsageLogger
import kr.ac.snu.hcil.omnitrack.core.workers.OTUsageLogUploadWorker
import org.jetbrains.anko.getStackTraceString
import javax.inject.Inject
import javax.inject.Provider
/**
* Created by younghokim on 2017. 11. 28..
*/
class OTUsageLoggingManager(val app: OTAndroidApp, val context: Context) : IEventLogger {
@field:[Inject UsageLogger]
lateinit var realmFactory: Factory<Realm>
@field:[Inject UsageLogger]
lateinit var uploadRequestProvider: Provider<OneTimeWorkRequest>
init {
app.applicationComponent.inject(this)
}
private var logIdGenerator = ConcurrentUniqueLongGenerator()
override fun logEvent(name: String, sub: String?, content: JsonObject?, timestamp: Long) {
println("New usage log event: $name, $sub, $content, at $timestamp")
val realm = realmFactory.get()
val transaction = { realm: Realm ->
val newLog = realm.createObject(UsageLog::class.java, logIdGenerator.getNewUniqueLong())
newLog.name = name
newLog.sub = sub
newLog.deviceId = app.applicationComponent.application().deviceId
newLog.userId = app.applicationComponent.getAuthManager().userId
newLog.timestamp = timestamp
newLog.contentJson = content?.toString() ?: "null"
}
if (Looper.myLooper() == Looper.getMainLooper()) {
realm.executeTransactionAsync(transaction, {
WorkManager.getInstance(context).enqueueUniqueWork(OTUsageLogUploadWorker.TAG, ExistingWorkPolicy.REPLACE, uploadRequestProvider.get())
realm.close()
}, { ex ->
println("UsageLog save transaction was failed:")
ex.printStackTrace()
OTApp.logger.writeSystemLog(ex.getStackTraceString(), "UsageLogger")
})
} else {
realm.executeTransaction(transaction)
WorkManager.getInstance(context).enqueueUniqueWork(OTUsageLogUploadWorker.TAG, ExistingWorkPolicy.REPLACE, uploadRequestProvider.get())
realm.close()
}
}
override fun logTriggerFireEvent(triggerId: String, triggerFiredTime: Long, trigger: OTTriggerDAO, inject: ((JsonObject) -> Unit)?) {
val content = jsonObject(
"triggerId" to triggerId,
"conditionType" to trigger.conditionType,
"actionType" to trigger.actionType
)
trigger.condition?.writeEventLogContent(content)
trigger.action?.writeEventLogContent(trigger, content)
inject?.invoke(content)
logEvent(TRIGGER_FIRED, null, content, triggerFiredTime)
}
override fun logAttributeChangeEvent(sub: String?, fieldLocalId: String, trackerId: String?, inject: ((JsonObject) -> Unit)?) {
val content = jsonObject(
"localId" to fieldLocalId,
"tracker" to (trackerId ?: "unmanaged")
)
inject?.invoke(content)
logEvent(NAME_CHANGE_ATTRIBUTE, sub, content)
}
override fun logTrackerChangeEvent(sub: String?, trackerId: String?, inject: ((JsonObject) -> Unit)?) {
val content = jsonObject(
"tracker" to (trackerId ?: "unmanaged")
)
inject?.invoke(content)
logEvent(NAME_CHANGE_TRACKER, sub, content)
}
override fun logTrackerOnShortcutChangeEvent(trackerId: String?, isOnShortcut: Boolean) {
val content = jsonObject(
"tracker" to (trackerId ?: "unmanaged"),
"switch" to isOnShortcut
)
logEvent(NAME_CHANGE_TRACKER, "changeBookmarked", content)
}
override fun logTriggerChangeEvent(sub: String?, triggerId: String?, inject: ((JsonObject) -> Unit)?) {
val content = jsonObject(
"trigger" to (triggerId ?: "unmanaged")
)
inject?.invoke(content)
logEvent(NAME_CHANGE_TRIGGER, sub, content)
}
override fun logSession(sessionName: String, sessionType: String, elapsed: Long, finishedAt: Long, from: String?, inject: ((JsonObject) -> Unit)?) {
val content = jsonObject(
"session" to sessionName,
"elapsed" to elapsed,
"finishedAt" to finishedAt
)
if (from != null) {
content["from"] = from
}
inject?.invoke(content)
logEvent(NAME_SESSION, sessionType, content)
}
override fun logExport(trackerId: String?) {
logEvent(NAME_TRACKER_DATA_EXPORT, trackerId, null)
}
override fun logTrackerReorderEvent() {
logEvent(NAME_TRACKER_REORDER, null, null)
}
override fun logItemEditEvent(itemId: String, inject: ((JsonObject) -> Unit)?) {
val content = jsonObject(
"item" to itemId
)
inject?.invoke(content)
logEvent(NAME_CHANGE_ITEM, SUB_EDIT, content)
}
override fun logItemAddedEvent(itemId: String, source: ItemLoggingSource, inject: ((JsonObject) -> Unit)?) {
val content = jsonObject(
"item" to itemId,
"source" to source.name
)
inject?.invoke(content)
logEvent(NAME_CHANGE_ITEM, SUB_ADD, content)
}
override fun logItemRemovedEvent(itemId: String, removedFrom: String, inject: ((JsonObject) -> Unit)?) {
val content = jsonObject(
"item" to itemId,
"removedFrom" to removedFrom
)
inject?.invoke(content)
logEvent(NAME_CHANGE_ITEM, SUB_REMOVE, content)
}
override fun logServiceActivationChangeEvent(serviceCode: String, isActivated: Boolean, inject: ((JsonObject) -> Unit)?) {
val content = jsonObject(
"serviceCode" to serviceCode,
"isActivated" to isActivated
)
inject?.invoke(content)
logEvent(NAME_CHANGE_SERVICE, "ACTIVATION", content)
}
override fun logDeviceStatusChangeEvent(sub: String, batteryPercentage: Float, inject: ((JsonObject) -> Unit)?) {
val content = jsonObject(
IEventLogger.CONTENT_KEY_BATTERY_PERCENTAGE to batteryPercentage
)
inject?.invoke(content)
logEvent(NAME_DEVICE_STATUS_CHANGE, sub, content)
}
override fun logExceptionEvent(sub: String, throwable: Throwable, thread: Thread?, inject: ((JsonObject) -> Unit)?) {
val stackTraceStringBuilder = StringBuilder(throwable.getStackTraceString())
var cause: Throwable = throwable
while (cause.cause != null) {
cause = cause.cause!!
stackTraceStringBuilder.append("\ncausedBy:\n")
stackTraceStringBuilder.append(cause.getStackTraceString())
}
val content: JsonObject = jsonObject(
"versionCode" to context.applicationContext.versionCode(),
"experiment" to BuildConfig.DEFAULT_EXPERIMENT_ID,
"packageName" to app.getPackageName(),
"message" to throwable.message,
"thread" to thread?.name,
"stacktrace" to stackTraceStringBuilder.toString()
)
inject?.invoke(content)
logEvent(NAME_EXCEPTION, sub, content)
}
}
| 9
|
Kotlin
|
4
| 8
|
f13e5c157d5646c3f9493c4fdc25ed3b1fc2e296
| 9,275
|
omnitrack_android
|
MIT License
|
app/src/main/java/com/guoyi/listeninglove/event/StatusChangedEvent.kt
|
GuoyiZhang
| 242,757,044
| false
|
{"Java": 822064, "Kotlin": 793171, "AIDL": 925}
|
package com.guoyi.listeninglove.event
/**
* Created by D22434 on 2018/1/10.
*/
class StatusChangedEvent(var isPrepared: Boolean, var isPlaying: Boolean, var percent: Long = 0)
| 1
|
Java
|
1
| 5
|
6d9442bad15910fe6d813bdf556fe1562d950947
| 180
|
077-Android-ListeningLove
|
Apache License 2.0
|
plugins/github/src/org/jetbrains/plugins/github/ui/component/GHAccountSelectorComponentFactory.kt
|
JetBrains
| 2,489,216
| false
| null |
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.plugins.github.ui.component
import com.intellij.ide.ui.laf.darcula.DarculaUIUtil
import com.intellij.openapi.progress.EmptyProgressIndicator
import com.intellij.openapi.progress.ProgressManager
import com.intellij.openapi.project.Project
import com.intellij.openapi.ui.popup.JBPopupListener
import com.intellij.openapi.ui.popup.LightweightWindowEvent
import com.intellij.ui.popup.list.ComboBoxPopup
import com.intellij.ui.scale.JBUIScale
import com.intellij.util.ui.JBUI
import com.intellij.util.ui.UIUtil
import com.intellij.util.ui.cloneDialog.AccountMenuItem
import com.intellij.util.ui.cloneDialog.AccountMenuItemRenderer
import com.intellij.util.ui.cloneDialog.VcsCloneDialogUiSpec
import com.intellij.util.ui.codereview.avatar.CachingAvatarIconsProvider
import org.jetbrains.plugins.github.GithubIcons
import org.jetbrains.plugins.github.api.GithubApiRequestExecutorManager
import org.jetbrains.plugins.github.authentication.accounts.GithubAccount
import org.jetbrains.plugins.github.authentication.accounts.GithubAccountInformationProvider
import org.jetbrains.plugins.github.i18n.GithubBundle
import org.jetbrains.plugins.github.ui.util.GHUIUtil
import org.jetbrains.plugins.github.ui.util.getName
import org.jetbrains.plugins.github.util.CachingGHUserAvatarLoader
import org.jetbrains.plugins.github.util.submitIOTask
import java.awt.*
import java.awt.event.KeyEvent
import java.awt.event.MouseAdapter
import java.awt.event.MouseEvent
import java.util.concurrent.CompletableFuture
import javax.swing.*
import javax.swing.border.Border
import javax.swing.event.ListDataEvent
import javax.swing.event.ListDataListener
class GHAccountSelectorComponentFactory {
fun create(model: ComboBoxWithActionsModel<GithubAccount>): JComponent {
val label = JLabel().apply {
isOpaque = false
cursor = Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)
isFocusable = true
border = FocusBorder()
}
Controller(model, label)
return label
}
class FocusBorder : Border {
override fun paintBorder(c: Component?, g: Graphics?, x: Int, y: Int, width: Int, height: Int) {
if (c?.hasFocus() == true && g is Graphics2D) {
DarculaUIUtil.paintFocusBorder(g, width, height, 0f, true)
}
}
override fun getBorderInsets(c: Component): Insets {
val g2d = c.graphics as? Graphics2D ?: return JBUI.emptyInsets()
val bw = if (UIUtil.isUnderDefaultMacTheme()) JBUIScale.scale(3).toFloat() else DarculaUIUtil.BW.float
val f = if (UIUtil.isRetina(g2d)) 0.5f else 1.0f
val lw = if (UIUtil.isUnderDefaultMacTheme()) JBUIScale.scale(f) else DarculaUIUtil.LW.float
val insets = (bw + lw).toInt()
return Insets(insets, insets, insets, insets)
}
override fun isBorderOpaque() = false
}
class Controller(private val accountsModel: ComboBoxWithActionsModel<GithubAccount>, private val label: JLabel)
: ComboBoxPopup.Context<ComboBoxWithActionsModel.Item<GithubAccount>> {
private val avatarsProvider = AccountAvatarIconsProvider()
private var popup: ComboBoxPopup<*>? = null
init {
accountsModel.addListDataListener(object : ListDataListener {
override fun contentsChanged(e: ListDataEvent) = updateLabel()
override fun intervalAdded(e: ListDataEvent?) = updateLabel()
override fun intervalRemoved(e: ListDataEvent?) = updateLabel()
})
label.addMouseListener(object : MouseAdapter() {
override fun mouseClicked(e: MouseEvent?) = showPopup()
})
label.registerPopupOnKeyboardShortcut(KeyEvent.VK_ENTER)
label.registerPopupOnKeyboardShortcut(KeyEvent.VK_SPACE)
updateLabel()
}
private fun updateLabel() {
val selectedAccount = accountsModel.selectedItem?.wrappee
with(label) {
isVisible = accountsModel.items.isNotEmpty()
icon = avatarsProvider.getIcon(selectedAccount, GHUIUtil.AVATAR_SIZE)
toolTipText = selectedAccount?.name ?: GithubBundle.message("account.choose.link")
}
}
private fun showPopup() {
popup = object : ComboBoxPopup<ComboBoxWithActionsModel.Item<GithubAccount>>(this, accountsModel.selectedItem, {
accountsModel.setSelectedItem(it)
}) {
//otherwise component borders are overridden
override fun getListElementRenderer() = renderer
}.apply {
//TODO: remove speedsearch
addListener(object : JBPopupListener {
override fun onClosed(event: LightweightWindowEvent) {
popup = null
}
})
showUnderneathOf(label)
}
}
private fun JComponent.registerPopupOnKeyboardShortcut(keyCode: Int) {
registerKeyboardAction({ showPopup() }, KeyStroke.getKeyStroke(keyCode, 0), JComponent.WHEN_FOCUSED)
}
override fun getProject(): Project? = null
override fun getModel(): ListModel<ComboBoxWithActionsModel.Item<GithubAccount>> = accountsModel
override fun getRenderer(): ListCellRenderer<ComboBoxWithActionsModel.Item<GithubAccount>> = PopupItemRenderer(avatarsProvider)
}
private class PopupItemRenderer(private val avatarsProvider: AccountAvatarIconsProvider)
: ListCellRenderer<ComboBoxWithActionsModel.Item<GithubAccount>> {
private val delegateRenderer = AccountMenuItemRenderer()
override fun getListCellRendererComponent(list: JList<out ComboBoxWithActionsModel.Item<GithubAccount>>?,
value: ComboBoxWithActionsModel.Item<GithubAccount>,
index: Int,
selected: Boolean,
focused: Boolean): Component {
val item = when (value) {
is ComboBoxWithActionsModel.Item.Wrapper<GithubAccount> ->
value.wrappee.let { account ->
val icon = avatarsProvider.getIcon(account, VcsCloneDialogUiSpec.Components.popupMenuAvatarSize)
val serverAddress = account.server.toString()
AccountMenuItem.Account(account.name, serverAddress, icon)
}
is ComboBoxWithActionsModel.Item.Action<GithubAccount> ->
value.action.let {
AccountMenuItem.Action(it.getName(), {}, showSeparatorAbove = value.needSeparatorAbove)
}
}
return delegateRenderer.getListCellRendererComponent(null, item, index, selected, focused)
}
}
private class AccountAvatarIconsProvider : CachingAvatarIconsProvider<GithubAccount>(
GithubIcons.DefaultAvatar) {
private val requestExecutorManager = GithubApiRequestExecutorManager.getInstance()
private val accountInformationProvider = GithubAccountInformationProvider.getInstance()
private val avatarLoader = CachingGHUserAvatarLoader.getInstance()
override fun loadImage(key: GithubAccount): Image? {
val executor = requestExecutorManager.getExecutor(key)
return ProgressManager.getInstance().submitIOTask(EmptyProgressIndicator()) {
accountInformationProvider.getInformation(executor, it, key)
}.thenCompose {
val url = it.avatarUrl ?: return@thenCompose CompletableFuture.completedFuture(null)
avatarLoader.requestAvatar(executor, url)
}.get()
}
}
}
| 191
| null |
4372
| 13,319
|
4d19d247824d8005662f7bd0c03f88ae81d5364b
| 7,406
|
intellij-community
|
Apache License 2.0
|
features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/retrysendmenu/RetrySendMenuState.kt
|
element-hq
| 546,522,002
| false
|
{"Kotlin": 7982937, "Shell": 39223, "Python": 37400, "JavaScript": 20268, "Java": 9607, "HTML": 9416, "CSS": 2519, "Ruby": 44}
|
/*
* Copyright (c) 2023 New Vector Ltd
*
* 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 io.element.android.features.messages.impl.timeline.components.retrysendmenu
import androidx.compose.runtime.Immutable
import io.element.android.features.messages.impl.timeline.model.TimelineItem
@Immutable
data class RetrySendMenuState(
val selectedEvent: TimelineItem.Event?,
val eventSink: (RetrySendMenuEvents) -> Unit,
)
| 236
|
Kotlin
|
109
| 828
|
4867354fd4ff78ff0b223b84636d7a8b6cff0d38
| 946
|
element-x-android
|
Apache License 2.0
|
domain/model/src/main/kotlin/com/louisfn/somovie/domain/model/Account.kt
|
LouisFn
| 571,351,948
| false
|
{"Kotlin": 500276, "Shell": 779}
|
package com.louisfn.somovie.domain.model
data class Account(
val id: Long,
val name: String,
val username: String,
)
| 3
|
Kotlin
|
6
| 23
|
772c90cf46e0056d826344b1f95c559b8101de2d
| 130
|
SoMovie
|
MIT License
|
codegen/src/test/java/net/codefeet/lemmyandroidclient/Util.kt
|
Flex4Reddit
| 648,927,752
| false
| null |
package net.codefeet.lemmyandroidclient
import com.squareup.kotlinpoet.ClassName
import com.squareup.kotlinpoet.FileSpec
import com.squareup.kotlinpoet.ParameterizedTypeName.Companion.parameterizedBy
import com.squareup.kotlinpoet.TypeName
import com.squareup.kotlinpoet.asClassName
import java.io.File
import java.nio.file.Files
import java.nio.file.Path
import kotlin.io.path.absolutePathString
val pkgName = "net.codefeet.lemmyandroidclient"
val hotfixPkgName = "$pkgName.hotfix"
val codegenPkg = "$pkgName.gen"
val httpPkg = "$codegenPkg.http"
val typesPkg = "$codegenPkg.types"
val stats = mutableMapOf<String, MutableList<String>>()
fun newTypesFileSpec(pkg: String, name: String) = FileSpec.builder(pkg, name)
fun parseTsType(typeString: String): TypeName {
var remaining = typeString.trim()
var genericsStartIndex = remaining.indexOf('<')
if (genericsStartIndex == -1) {
// No generics, return the type name
return remaining.toKtClassName()
}
val typeName = remaining.substring(0, genericsStartIndex).trim()
remaining = remaining.substring(genericsStartIndex + 1, remaining.length - 1)
val generics = mutableListOf<TypeName>()
var depth = 0
var startIndex = 0
for (i in 0 until remaining.length) {
val char = remaining[i]
if (char == '<') {
depth++
} else if (char == '>') {
depth--
} else if (char == ',' && depth == 0) {
val genericString = remaining.substring(startIndex, i).trim()
generics.add(parseTsType(genericString))
startIndex = i + 1
}
}
val lastGenericString = remaining.substring(startIndex).trim()
generics.add(parseTsType(lastGenericString))
return typeName.toKtClassName().parameterizedBy(generics)
}
fun String.toKtClassName(): ClassName {
return when (this) {
"number" -> Long::class.asClassName()
"boolean" -> Boolean::class.asClassName()
"string" -> String::class.asClassName()
"Array" -> List::class.asClassName()
"Map" -> Map::class.asClassName()
"null" -> Nothing::class.asClassName()
else -> ClassName(typesPkg, this)
}
}
fun String.snakeToCamel(): String {
val builder = StringBuilder()
var capitalizeNext = false
for (char in this) {
if (char == '_') {
capitalizeNext = true
} else {
builder.append(if (capitalizeNext) char.uppercaseChar() else char)
capitalizeNext = false
}
}
return builder.toString()
}
fun String.camelToSnake(): String {
val builder = StringBuilder()
var prevCharWasLowerCase = false
for (char in this) {
if (char.isUpperCase()) {
if (prevCharWasLowerCase) {
builder.append('_')
}
builder.append(char.lowercaseChar())
prevCharWasLowerCase = false
} else {
builder.append(char)
prevCharWasLowerCase = true
}
}
return builder.toString()
}
fun initDir(path: Path) {
path.toFile().mkdirs()
Files.walk(path).use { walk ->
walk.sorted(Comparator.reverseOrder())
.filter { it.absolutePathString() != path.absolutePathString() }
.map { obj: Path -> obj.toFile() }
// .peek { x: File? -> println(x) }
.forEach { obj: File -> obj.delete() }
}
}
fun addStat(key: String, name: String) {
stats[key] = (stats[key] ?: mutableListOf()).apply { add(name) }
}
data class PoetContext(
val name: String,
val prop: String,
)
| 0
|
Kotlin
|
0
| 0
|
8028bbf4fc50d7c945d20c7034d6da2de4b7c0ac
| 3,374
|
lemmy-android-client
|
MIT License
|
verik-importer/src/main/kotlin/io/verik/importer/ast/element/declaration/ETypeParameter.kt
|
frwang96
| 269,980,078
| false
| null |
/*
* SPDX-License-Identifier: Apache-2.0
*/
package io.verik.importer.ast.element.declaration
import io.verik.importer.ast.element.descriptor.EDescriptor
import io.verik.importer.common.Visitor
import io.verik.importer.message.SourceLocation
/**
* Element that represents a type parameter.
*/
class ETypeParameter(
override val location: SourceLocation,
override val name: String,
val descriptor: EDescriptor?,
val isCardinal: Boolean
) : EDeclaration() {
override var signature: String? = null
init {
descriptor?.parent = this
}
override fun accept(visitor: Visitor) {
visitor.visitTypeParameter(this)
}
override fun acceptChildren(visitor: Visitor) {
descriptor?.accept(visitor)
}
}
| 0
|
Kotlin
|
1
| 33
|
ee22969235460fd144294bcbcbab0338c638eb92
| 764
|
verik
|
Apache License 2.0
|
shared/src/commonMain/kotlin/com/multiplatform/kmmcc/domain/model/ExchangeRate.kt
|
shahrozekhan
| 735,403,154
| false
| null |
package com.multiplatform.kmmcc.domain.model
import com.multiplatform.kmmcc.common.Constants.ExchangeRateConstants.DEFAULT_CURRENCY
import com.multiplatform.kmmcc.common.Constants.ExchangeRateConstants.DEFAULT_CURRENCY_NAME
import com.multiplatform.kmmcc.common.Constants.ExchangeRateConstants.DEFAULT_CURRENCY_RATE
import com.multiplatform.kmmcc.data.dto.ExchangeRateDto
import database.ExchangeRateEntity
data class ExchangeRate(val currency: String, val currencyName: String, val rate: Double) {
companion object
}
fun ExchangeRate.toExchangeRateEntity(): ExchangeRateEntity {
return ExchangeRateEntity(
currency,
currencyName,
rate,
false
)
}
fun ExchangeRateDto.toExchangeRateEntity(): ExchangeRateEntity {
return ExchangeRateEntity(
currency,
currencyName,
rate,
selected
)
}
fun ExchangeRateEntity.toExchangeRate(): ExchangeRate {
return ExchangeRate(
currency,
currencyName ?: "",
rate
)
}
fun ExchangeRateDto.toExchangeRate(): ExchangeRate {
return ExchangeRate(
currency,
currencyName ?: "",
rate
)
}
val ExchangeRate.Companion.appDefaultExchangeRate: ExchangeRate
get() {
return ExchangeRate(
DEFAULT_CURRENCY,
DEFAULT_CURRENCY_NAME,
DEFAULT_CURRENCY_RATE
)
}
| 0
| null |
1
| 7
|
5825a9d713df3501d7757632682b90b7ab283763
| 1,387
|
KMPCurrencyConvertor
|
MIT License
|
android/app/src/main/java/dk/jens/webpage_saver/openid/OpenIDTokenHandler.kt
|
jensstein
| 594,808,419
| false
| null |
package dk.jens.webpage_saver.openid
import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import dk.jens.webpage_saver.AUTHORIZATION_BROADCAST_FLAG
import dk.jens.webpage_saver.AUTHORIZATION_BROADCAST_RESULT
import dk.jens.webpage_saver.LOGGING_TAG
import dk.jens.webpage_saver.MainActivity
import dk.jens.webpage_saver.R
import dk.jens.webpage_saver.databinding.ActivityOpenidTokenHandlerBinding
class OpenIDTokenHandler : AppCompatActivity() {
private lateinit var binding: ActivityOpenidTokenHandlerBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityOpenidTokenHandlerBinding.inflate(layoutInflater)
setContentView(binding.root)
val uri = intent.data
if(uri == null) {
Log.e(LOGGING_TAG, "Data from intent was null: $intent")
binding.openidTokenHandlerTextview.text = getText(R.string.openid_token_handler_token_extract_error)
}
val accessToken = uri?.getQueryParameter("access_token")
val refreshToken = uri?.getQueryParameter("refresh_token")
val resultIntent = Intent(AUTHORIZATION_BROADCAST_FLAG)
if(accessToken != null && refreshToken != null) {
storeTokens(this, accessToken, refreshToken)
resultIntent.putExtra(AUTHORIZATION_BROADCAST_RESULT, true)
sendBroadcast(resultIntent)
startActivity(Intent(this, MainActivity::class.java))
} else {
resultIntent.putExtra(AUTHORIZATION_BROADCAST_RESULT, false)
sendBroadcast(resultIntent)
binding.openidTokenHandlerTextview.text = getText(R.string.openid_token_handler_token_extract_error)
}
}
}
| 0
|
Rust
|
0
| 0
|
ad85fdf213f6d07105e135f087d838052d64e38b
| 1,803
|
webpage-saver
|
MIT License
|
presentation/src/main/java/arcus/presentation/pairing/device/post/zwaveheal/ZWaveRebuildContract.kt
|
arcus-smart-home
| 168,191,380
| false
| null |
/*
* Copyright 2019 Arcus 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 arcus.presentation.pairing.device.post.zwaveheal
import arcus.cornea.presenter.BasePresenterContract
interface ZWaveRebuildView {
/**
* Called when the status of the rebuild process updates
*/
fun onProgressUpdated(percent: Int)
/**
* Called when rebuild fails spectacularly
*/
fun onUnhandledError()
}
interface ZWaveRebuildPresenter : BasePresenterContract<ZWaveRebuildView> {
/**
* Starts the rebuild, if one is not already in progress
* Emits the status to the view
*/
fun startRebuild()
/**
* Gets the status of the currently-running rebuild status
*/
fun getCurrentStatus()
/**
* Cancels the currently-running rebuild process
*/
fun cancelRebuild()
}
| 6
| null |
27
| 27
|
845b23b6ee913c58e009914e920242e29d0b137a
| 1,373
|
arcusandroid
|
Apache License 2.0
|
src/main/kotlin/io/github/aecsocket/klam/VecD.kt
|
aecsocket
| 616,665,512
| false
| null |
@file:Suppress("NOTHING_TO_INLINE", "MemberVisibilityCanBePrivate", "unused", "SpellCheckingInspection")
package io.github.aecsocket.klam
private const val TO_STRING_FORMAT = "%f"
private inline fun typeArrayOf(vararg elements: Double) = doubleArrayOf(*elements)
data class DVec2(@JvmField var x: Double, @JvmField var y: Double) {
constructor(v: DVec2) : this(v.x, v.y)
constructor(s: Double) : this(s, s)
constructor(v: IVec2) : this(v.x.toDouble(), v.y.toDouble())
constructor(v: FVec2) : this(v.x.toDouble(), v.y.toDouble())
fun from(x: Double, y: Double) { this.x = x; this.y = y }
fun from(v: DVec2) = from(v.x, v.y)
operator fun get(idx: Index) = when (idx) {
0 -> x
1 -> y
else -> throw IndexOutOfBoundsException(idx)
}
operator fun set(idx: Index, s: Double) = when (idx) {
0 -> x = s
1 -> y = s
else -> throw IndexOutOfBoundsException(idx)
}
fun compareTo(v: DVec2) = IVec2(x.compareTo(v.x), y.compareTo(v.y))
fun equalTo(v: DVec2) = x.compareTo(v.x) == 0 && y.compareTo(v.y) == 0
fun toArray() = typeArrayOf(x, y)
fun asString(fmt: String) = "($fmt, $fmt)".format(x, y)
override fun toString() = asString(TO_STRING_FORMAT)
}
inline fun DVec2.map(block: (Double) -> Double) = DVec2(block(x), block(y))
inline operator fun DVec2.unaryMinus() = DVec2(-x, -y)
inline operator fun DVec2.inc() = DVec2(x + 1, y + 1)
inline operator fun DVec2.dec() = DVec2(x - 1, y - 1)
inline operator fun DVec2.plus(s: Double) = DVec2(x + s, y + s)
inline operator fun DVec2.minus(s: Double) = DVec2(x - s, y - s)
inline operator fun DVec2.times(s: Double) = DVec2(x * s, y * s)
inline operator fun DVec2.div(s: Double) = DVec2(x / s, y / s)
inline operator fun Double.plus(v: DVec2) = DVec2(this + v.x, this + v.y)
inline operator fun Double.minus(v: DVec2) = DVec2(this - v.x, this - v.y)
inline operator fun Double.times(v: DVec2) = DVec2(this * v.x, this * v.y)
inline operator fun Double.div(v: DVec2) = DVec2(this / v.x, this / v.y)
inline operator fun DVec2.plusAssign(s: Double) { x += s; y += s }
inline operator fun DVec2.minusAssign(s: Double) { x -= s; y -= s }
inline operator fun DVec2.timesAssign(s: Double) { x *= s; y *= s }
inline operator fun DVec2.divAssign(s: Double) { x /= s; y /= s }
inline operator fun DVec2.plus(v: DVec2) = DVec2(x + v.x, y + v.y)
inline operator fun DVec2.minus(v: DVec2) = DVec2(x - v.x, y - v.y)
inline operator fun DVec2.times(v: DVec2) = DVec2(x * v.x, y * v.y)
inline operator fun DVec2.div(v: DVec2) = DVec2(x / v.x, y / v.y)
inline operator fun DVec2.plusAssign(v: DVec2) { x += v.x; y += v.y }
inline operator fun DVec2.minusAssign(v: DVec2) { x -= v.x; y -= v.y }
inline operator fun DVec2.timesAssign(v: DVec2) { x *= v.x; y *= v.y }
inline operator fun DVec2.divAssign(v: DVec2) { x /= v.x; y /= v.y }
inline infix fun DVec2.eq(v: DVec2) = BVec2(x.compareTo(v.x) == 0, y.compareTo(v.y) == 0)
inline infix fun DVec2.ne(v: DVec2) = BVec2(x.compareTo(v.x) != 0, y.compareTo(v.y) != 0)
inline infix fun DVec2.lt(v: DVec2) = BVec2(x < v.x, y < v.y)
inline infix fun DVec2.le(v: DVec2) = BVec2(x <= v.x, y <= v.y)
inline infix fun DVec2.gt(v: DVec2) = BVec2(x > v.x, y > v.y)
inline infix fun DVec2.ge(v: DVec2) = BVec2(x >= v.x, y >= v.y)
data class DVec3(@JvmField var x: Double, @JvmField var y: Double, @JvmField var z: Double) {
constructor(v: DVec3) : this(v.x, v.y, v.z)
constructor(v: DVec2, z: Double) : this(v.x, v.y, z)
constructor(s: Double) : this(s, s, s)
constructor(v: IVec3) : this(v.x.toDouble(), v.y.toDouble(), v.z.toDouble())
constructor(v: FVec3) : this(v.x.toDouble(), v.y.toDouble(), v.z.toDouble())
fun from(x: Double, y: Double, z: Double) { this.x = x; this.y = y; this.z = z }
fun from(v: DVec3) = from(v.x, v.y, v.z)
operator fun get(idx: Index) = when (idx) {
0 -> x
1 -> y
2 -> z
else -> throw IndexOutOfBoundsException(idx)
}
operator fun set(idx: Index, s: Double) = when (idx) {
0 -> x = s
1 -> y = s
2 -> z = s
else -> throw IndexOutOfBoundsException(idx)
}
fun compareTo(v: DVec3) = IVec3(x.compareTo(v.x), y.compareTo(v.y), z.compareTo(v.z))
fun equalTo(v: DVec3) = x.compareTo(v.x) == 0 && y.compareTo(v.y) == 0 && z.compareTo(v.z) == 0
fun toArray() = typeArrayOf(x, y, z)
fun asString(fmt: String) = "($fmt, $fmt, $fmt)".format(x, y, z)
override fun toString() = asString(TO_STRING_FORMAT)
}
inline fun DVec3.map(block: (Double) -> Double) = DVec3(block(x), block(y), block(z))
inline operator fun DVec3.unaryMinus() = DVec3(-x, -y, -z)
inline operator fun DVec3.inc() = DVec3(x + 1, y + 1, z + 1)
inline operator fun DVec3.dec() = DVec3(x - 1, y - 1, z - 1)
inline operator fun DVec3.plus(s: Double) = DVec3(x + s, y + s, z + s)
inline operator fun DVec3.minus(s: Double) = DVec3(x - s, y - s, z - s)
inline operator fun DVec3.times(s: Double) = DVec3(x * s, y * s, z * s)
inline operator fun DVec3.div(s: Double) = DVec3(x / s, y / s, z / s)
inline operator fun Double.plus(v: DVec3) = DVec3(this + v.x, this + v.y, this + v.z)
inline operator fun Double.minus(v: DVec3) = DVec3(this - v.x, this - v.y, this - v.z)
inline operator fun Double.times(v: DVec3) = DVec3(this * v.x, this * v.y, this * v.z)
inline operator fun Double.div(v: DVec3) = DVec3(this / v.x, this / v.y, this / v.z)
inline operator fun DVec3.plusAssign(s: Double) { x += s; y += s; z += s }
inline operator fun DVec3.minusAssign(s: Double) { x -= s; y -= s; z -= s }
inline operator fun DVec3.timesAssign(s: Double) { x *= s; y *= s; z *= s }
inline operator fun DVec3.divAssign(s: Double) { x /= s; y /= s; z /= s }
inline operator fun DVec3.plus(v: DVec3) = DVec3(x + v.x, y + v.y, z + v.z)
inline operator fun DVec3.minus(v: DVec3) = DVec3(x - v.x, y - v.y, z - v.z)
inline operator fun DVec3.times(v: DVec3) = DVec3(x * v.x, y * v.y, z * v.z)
inline operator fun DVec3.div(v: DVec3) = DVec3(x / v.x, y / v.y, z / v.z)
inline operator fun DVec3.plusAssign(v: DVec3) { x += v.x; y += v.y; z += v.z }
inline operator fun DVec3.minusAssign(v: DVec3) { x -= v.x; y -= v.y; z -= v.z }
inline operator fun DVec3.timesAssign(v: DVec3) { x *= v.x; y *= v.y; z *= v.z }
inline operator fun DVec3.divAssign(v: DVec3) { x /= v.x; y /= v.y; z /= v.z }
inline infix fun DVec3.eq(v: DVec3) = BVec3(x.compareTo(v.x) == 0, y.compareTo(v.y) == 0, z.compareTo(v.z) == 0)
inline infix fun DVec3.ne(v: DVec3) = BVec3(x.compareTo(v.x) != 0, y.compareTo(v.y) != 0, z.compareTo(v.z) != 0)
inline infix fun DVec3.lt(v: DVec3) = BVec3(x < v.x, y < v.y, z < v.z)
inline infix fun DVec3.le(v: DVec3) = BVec3(x <= v.x, y <= v.y, z <= v.z)
inline infix fun DVec3.gt(v: DVec3) = BVec3(x > v.x, y > v.y, z > v.z)
inline infix fun DVec3.ge(v: DVec3) = BVec3(x >= v.x, y >= v.y, z >= v.z)
data class DVec4(@JvmField var x: Double, @JvmField var y: Double, @JvmField var z: Double, @JvmField var w: Double) {
constructor(v: DVec4) : this(v.x, v.y, v.z, v.w)
constructor(v: DVec3, w: Double) : this(v.x, v.y, v.z, w)
constructor(v: DVec2, z: Double, w: Double) : this(v.x, v.y, z, w)
constructor(s: Double) : this(s, s, s, s)
constructor(v: IVec4) : this(v.x.toDouble(), v.y.toDouble(), v.z.toDouble(), v.w.toDouble())
constructor(v: FVec4) : this(v.x.toDouble(), v.y.toDouble(), v.z.toDouble(), v.w.toDouble())
fun from(x: Double, y: Double, z: Double, w: Double) { this.x = x; this.y = y; this.z = z; this.w = w }
fun from(v: DVec4) = from(v.x, v.y, v.z, v.w)
operator fun get(idx: Index) = when (idx) {
0 -> x
1 -> y
2 -> z
3 -> w
else -> throw IndexOutOfBoundsException(idx)
}
operator fun set(idx: Index, s: Double) = when (idx) {
0 -> x = s
1 -> y = s
2 -> z = s
3 -> w = s
else -> throw IndexOutOfBoundsException(idx)
}
fun compareTo(v: DVec4) = IVec4(x.compareTo(v.x), y.compareTo(v.y), z.compareTo(v.z), w.compareTo(v.w))
fun equalTo(v: DVec4) = x.compareTo(v.x) == 0 && y.compareTo(v.y) == 0 && z.compareTo(v.z) == 0 && w.compareTo(v.w) == 0
fun toArray() = typeArrayOf(x, y, z, w)
fun asString(fmt: String) = "($fmt, $fmt, $fmt, $fmt)".format(x, y, z, w)
override fun toString() = asString(TO_STRING_FORMAT)
}
inline fun DVec4.map(block: (Double) -> Double) = DVec4(block(x), block(y), block(z), block(w))
inline operator fun DVec4.unaryMinus() = DVec4(-x, -y, -z, -w)
inline operator fun DVec4.inc() = DVec4(x + 1, y + 1, z + 1, w + 1)
inline operator fun DVec4.dec() = DVec4(x - 1, y - 1, z - 1, w - 1)
inline operator fun DVec4.plus(s: Double) = DVec4(x + s, y + s, z + s, w + s)
inline operator fun DVec4.minus(s: Double) = DVec4(x - s, y - s, z - s, w - s)
inline operator fun DVec4.times(s: Double) = DVec4(x * s, y * s, z * s, w * s)
inline operator fun DVec4.div(s: Double) = DVec4(x / s, y / s, z / s, w / s)
inline operator fun Double.plus(v: DVec4) = DVec4(this + v.x, this + v.y, this + v.z, this + v.w)
inline operator fun Double.minus(v: DVec4) = DVec4(this - v.x, this - v.y, this - v.z, this - v.w)
inline operator fun Double.times(v: DVec4) = DVec4(this * v.x, this * v.y, this * v.z, this * v.w)
inline operator fun Double.div(v: DVec4) = DVec4(this / v.x, this / v.y, this / v.z, this / v.w)
inline operator fun DVec4.plusAssign(s: Double) { x += s; y += s; z += s; w += s }
inline operator fun DVec4.minusAssign(s: Double) { x -= s; y -= s; z -= s; w -= s }
inline operator fun DVec4.timesAssign(s: Double) { x *= s; y *= s; z *= s; w *= s }
inline operator fun DVec4.divAssign(s: Double) { x /= s; y /= s; z /= s; w /= s }
inline operator fun DVec4.plus(v: DVec4) = DVec4(x + v.x, y + v.y, z + v.z, w + v.w)
inline operator fun DVec4.minus(v: DVec4) = DVec4(x - v.x, y - v.y, z - v.z, w - v.w)
inline operator fun DVec4.times(v: DVec4) = DVec4(x * v.x, y * v.y, z * v.z, w * v.w)
inline operator fun DVec4.div(v: DVec4) = DVec4(x / v.x, y / v.y, z / v.z, w / v.w)
inline operator fun DVec4.plusAssign(v: DVec4) { x += v.x; y += v.y; z += v.z; w += v.w }
inline operator fun DVec4.minusAssign(v: DVec4) { x -= v.x; y -= v.y; z -= v.z; w -= v.w }
inline operator fun DVec4.timesAssign(v: DVec4) { x *= v.x; y *= v.y; z *= v.z; w *= v.w }
inline operator fun DVec4.divAssign(v: DVec4) { x /= v.x; y /= v.y; z /= v.z; w /= v.w }
inline infix fun DVec4.eq(v: DVec4) = BVec4(x.compareTo(v.x) == 0, y.compareTo(v.y) == 0, z.compareTo(v.z) == 0, w.compareTo(v.w) == 0)
inline infix fun DVec4.ne(v: DVec4) = BVec4(x.compareTo(v.x) != 0, y.compareTo(v.y) != 0, z.compareTo(v.z) != 0, w.compareTo(v.w) != 0)
inline infix fun DVec4.lt(v: DVec4) = BVec4(x < v.x, y < v.y, z < v.z, w < v.w)
inline infix fun DVec4.le(v: DVec4) = BVec4(x <= v.x, y <= v.y, z <= v.z, w <= v.w)
inline infix fun DVec4.gt(v: DVec4) = BVec4(x > v.x, y > v.y, z > v.z, w > v.w)
inline infix fun DVec4.ge(v: DVec4) = BVec4(x >= v.x, y >= v.y, z >= v.z, w >= v.w)
//region Alternate accessors
inline var DVec2.r get() = x; set(value) { x = value }
inline var DVec2.g get() = y; set(value) { y = value }
inline var DVec2.s get() = x; set(value) { x = value }
inline var DVec2.t get() = y; set(value) { y = value}
inline var DVec3.r get() = x; set(value) { x = value }
inline var DVec3.g get() = y; set(value) { y = value }
inline var DVec3.b get() = z; set(value) { z = value }
inline var DVec3.s get() = x; set(value) { x = value}
inline var DVec3.t get() = y; set(value) { y = value }
inline var DVec3.p get() = z; set(value) { z = value }
inline var DVec4.r get() = x; set(value) { x = value }
inline var DVec4.g get() = y; set(value) { y = value }
inline var DVec4.b get() = z; set(value) { z = value }
inline var DVec4.a get() = w; set(value) { w = value }
inline var DVec4.s get() = x; set(value) { x = value }
inline var DVec4.t get() = y; set(value) { y = value }
inline var DVec4.p get() = z; set(value) { z = value }
inline var DVec4.q get() = w; set(value) { w = value }
//endregion
//region Swizzling Vec2
inline val DVec2.xx get() = DVec2(x, x)
inline val DVec2.xy get() = DVec2(x, y)
inline val DVec2.yx get() = DVec2(y, x)
inline val DVec2.yy get() = DVec2(y, y)
inline val DVec2.rr get() = DVec2(r, r)
inline val DVec2.rg get() = DVec2(r, g)
inline val DVec2.gr get() = DVec2(g, r)
inline val DVec2.gg get() = DVec2(g, g)
inline val DVec2.ss get() = DVec2(s, s)
inline val DVec2.st get() = DVec2(s, t)
inline val DVec2.ts get() = DVec2(t, s)
inline val DVec2.tt get() = DVec2(t, t)
inline val DVec2.xxx get() = DVec3(x, x, x)
inline val DVec2.xxy get() = DVec3(x, x, y)
inline val DVec2.xyx get() = DVec3(x, y, x)
inline val DVec2.xyy get() = DVec3(x, y, y)
inline val DVec2.yxx get() = DVec3(y, x, x)
inline val DVec2.yxy get() = DVec3(y, x, y)
inline val DVec2.yyx get() = DVec3(y, y, x)
inline val DVec2.yyy get() = DVec3(y, y, y)
inline val DVec2.rrr get() = DVec3(r, r, r)
inline val DVec2.rrg get() = DVec3(r, r, g)
inline val DVec2.rgr get() = DVec3(r, g, r)
inline val DVec2.rgg get() = DVec3(r, g, g)
inline val DVec2.grr get() = DVec3(g, r, r)
inline val DVec2.grg get() = DVec3(g, r, g)
inline val DVec2.ggr get() = DVec3(g, g, r)
inline val DVec2.ggg get() = DVec3(g, g, g)
inline val DVec2.sss get() = DVec3(s, s, s)
inline val DVec2.sst get() = DVec3(s, s, t)
inline val DVec2.sts get() = DVec3(s, t, s)
inline val DVec2.stt get() = DVec3(s, t, t)
inline val DVec2.tss get() = DVec3(t, s, s)
inline val DVec2.tst get() = DVec3(t, s, t)
inline val DVec2.tts get() = DVec3(t, t, s)
inline val DVec2.ttt get() = DVec3(t, t, t)
inline val DVec2.xxxx get() = DVec4(x, x, x, x)
inline val DVec2.xxxy get() = DVec4(x, x, x, y)
inline val DVec2.xxyx get() = DVec4(x, x, y, x)
inline val DVec2.xxyy get() = DVec4(x, x, y, y)
inline val DVec2.xyxx get() = DVec4(x, y, x, x)
inline val DVec2.xyxy get() = DVec4(x, y, x, y)
inline val DVec2.xyyx get() = DVec4(x, y, y, x)
inline val DVec2.xyyy get() = DVec4(x, y, y, y)
inline val DVec2.yxxx get() = DVec4(y, x, x, x)
inline val DVec2.yxxy get() = DVec4(y, x, x, y)
inline val DVec2.yxyx get() = DVec4(y, x, y, x)
inline val DVec2.yxyy get() = DVec4(y, x, y, y)
inline val DVec2.yyxx get() = DVec4(y, y, x, x)
inline val DVec2.yyxy get() = DVec4(y, y, x, y)
inline val DVec2.yyyx get() = DVec4(y, y, y, x)
inline val DVec2.yyyy get() = DVec4(y, y, y, y)
inline val DVec2.rrrr get() = DVec4(r, r, r, r)
inline val DVec2.rrrg get() = DVec4(r, r, r, g)
inline val DVec2.rrgr get() = DVec4(r, r, g, r)
inline val DVec2.rrgg get() = DVec4(r, r, g, g)
inline val DVec2.rgrr get() = DVec4(r, g, r, r)
inline val DVec2.rgrg get() = DVec4(r, g, r, g)
inline val DVec2.rggr get() = DVec4(r, g, g, r)
inline val DVec2.rggg get() = DVec4(r, g, g, g)
inline val DVec2.grrr get() = DVec4(g, r, r, r)
inline val DVec2.grrg get() = DVec4(g, r, r, g)
inline val DVec2.grgr get() = DVec4(g, r, g, r)
inline val DVec2.grgg get() = DVec4(g, r, g, g)
inline val DVec2.ggrr get() = DVec4(g, g, r, r)
inline val DVec2.ggrg get() = DVec4(g, g, r, g)
inline val DVec2.gggr get() = DVec4(g, g, g, r)
inline val DVec2.gggg get() = DVec4(g, g, g, g)
inline val DVec2.ssss get() = DVec4(s, s, s, s)
inline val DVec2.ssst get() = DVec4(s, s, s, t)
inline val DVec2.ssts get() = DVec4(s, s, t, s)
inline val DVec2.sstt get() = DVec4(s, s, t, t)
inline val DVec2.stss get() = DVec4(s, t, s, s)
inline val DVec2.stst get() = DVec4(s, t, s, t)
inline val DVec2.stts get() = DVec4(s, t, t, s)
inline val DVec2.sttt get() = DVec4(s, t, t, t)
inline val DVec2.tsss get() = DVec4(t, s, s, s)
inline val DVec2.tsst get() = DVec4(t, s, s, t)
inline val DVec2.tsts get() = DVec4(t, s, t, s)
inline val DVec2.tstt get() = DVec4(t, s, t, t)
inline val DVec2.ttss get() = DVec4(t, t, s, s)
inline val DVec2.ttst get() = DVec4(t, t, s, t)
inline val DVec2.ttts get() = DVec4(t, t, t, s)
inline val DVec2.tttt get() = DVec4(t, t, t, t)
//endregion
//region Swizzling Vec3
inline val DVec3.xx get() = DVec2(x, x)
inline val DVec3.xy get() = DVec2(x, y)
inline val DVec3.xz get() = DVec2(x, z)
inline val DVec3.yx get() = DVec2(y, x)
inline val DVec3.yy get() = DVec2(y, y)
inline val DVec3.yz get() = DVec2(y, z)
inline val DVec3.zx get() = DVec2(z, x)
inline val DVec3.zy get() = DVec2(z, y)
inline val DVec3.zz get() = DVec2(z, z)
inline val DVec3.rr get() = DVec2(r, r)
inline val DVec3.rg get() = DVec2(r, g)
inline val DVec3.rb get() = DVec2(r, b)
inline val DVec3.gr get() = DVec2(g, r)
inline val DVec3.gg get() = DVec2(g, g)
inline val DVec3.gb get() = DVec2(g, b)
inline val DVec3.br get() = DVec2(b, r)
inline val DVec3.bg get() = DVec2(b, g)
inline val DVec3.bb get() = DVec2(b, b)
inline val DVec3.ss get() = DVec2(s, s)
inline val DVec3.st get() = DVec2(s, t)
inline val DVec3.sp get() = DVec2(s, p)
inline val DVec3.ts get() = DVec2(t, s)
inline val DVec3.tt get() = DVec2(t, t)
inline val DVec3.tp get() = DVec2(t, p)
inline val DVec3.ps get() = DVec2(p, s)
inline val DVec3.pt get() = DVec2(p, t)
inline val DVec3.pp get() = DVec2(p, p)
inline val DVec3.xxx get() = DVec3(x, x, x)
inline val DVec3.xxy get() = DVec3(x, x, y)
inline val DVec3.xxz get() = DVec3(x, x, z)
inline val DVec3.xyx get() = DVec3(x, y, x)
inline val DVec3.xyy get() = DVec3(x, y, y)
inline val DVec3.xyz get() = DVec3(x, y, z)
inline val DVec3.xzx get() = DVec3(x, z, x)
inline val DVec3.xzy get() = DVec3(x, z, y)
inline val DVec3.xzz get() = DVec3(x, z, z)
inline val DVec3.yxx get() = DVec3(y, x, x)
inline val DVec3.yxy get() = DVec3(y, x, y)
inline val DVec3.yxz get() = DVec3(y, x, z)
inline val DVec3.yyx get() = DVec3(y, y, x)
inline val DVec3.yyy get() = DVec3(y, y, y)
inline val DVec3.yyz get() = DVec3(y, y, z)
inline val DVec3.yzx get() = DVec3(y, z, x)
inline val DVec3.yzy get() = DVec3(y, z, y)
inline val DVec3.yzz get() = DVec3(y, z, z)
inline val DVec3.zxx get() = DVec3(z, x, x)
inline val DVec3.zxy get() = DVec3(z, x, y)
inline val DVec3.zxz get() = DVec3(z, x, z)
inline val DVec3.zyx get() = DVec3(z, y, x)
inline val DVec3.zyy get() = DVec3(z, y, y)
inline val DVec3.zyz get() = DVec3(z, y, z)
inline val DVec3.zzx get() = DVec3(z, z, x)
inline val DVec3.zzy get() = DVec3(z, z, y)
inline val DVec3.zzz get() = DVec3(z, z, z)
inline val DVec3.rrr get() = DVec3(r, r, r)
inline val DVec3.rrg get() = DVec3(r, r, g)
inline val DVec3.rrb get() = DVec3(r, r, b)
inline val DVec3.rgr get() = DVec3(r, g, r)
inline val DVec3.rgg get() = DVec3(r, g, g)
inline val DVec3.rgb get() = DVec3(r, g, b)
inline val DVec3.rbr get() = DVec3(r, b, r)
inline val DVec3.rbg get() = DVec3(r, b, g)
inline val DVec3.rbb get() = DVec3(r, b, b)
inline val DVec3.grr get() = DVec3(g, r, r)
inline val DVec3.grg get() = DVec3(g, r, g)
inline val DVec3.grb get() = DVec3(g, r, b)
inline val DVec3.ggr get() = DVec3(g, g, r)
inline val DVec3.ggg get() = DVec3(g, g, g)
inline val DVec3.ggb get() = DVec3(g, g, b)
inline val DVec3.gbr get() = DVec3(g, b, r)
inline val DVec3.gbg get() = DVec3(g, b, g)
inline val DVec3.gbb get() = DVec3(g, b, b)
inline val DVec3.brr get() = DVec3(b, r, r)
inline val DVec3.brg get() = DVec3(b, r, g)
inline val DVec3.brb get() = DVec3(b, r, b)
inline val DVec3.bgr get() = DVec3(b, g, r)
inline val DVec3.bgg get() = DVec3(b, g, g)
inline val DVec3.bgb get() = DVec3(b, g, b)
inline val DVec3.bbr get() = DVec3(b, b, r)
inline val DVec3.bbg get() = DVec3(b, b, g)
inline val DVec3.bbb get() = DVec3(b, b, b)
inline val DVec3.sss get() = DVec3(s, s, s)
inline val DVec3.sst get() = DVec3(s, s, t)
inline val DVec3.ssp get() = DVec3(s, s, p)
inline val DVec3.sts get() = DVec3(s, t, s)
inline val DVec3.stt get() = DVec3(s, t, t)
inline val DVec3.stp get() = DVec3(s, t, p)
inline val DVec3.sps get() = DVec3(s, p, s)
inline val DVec3.spt get() = DVec3(s, p, t)
inline val DVec3.spp get() = DVec3(s, p, p)
inline val DVec3.tss get() = DVec3(t, s, s)
inline val DVec3.tst get() = DVec3(t, s, t)
inline val DVec3.tsp get() = DVec3(t, s, p)
inline val DVec3.tts get() = DVec3(t, t, s)
inline val DVec3.ttt get() = DVec3(t, t, t)
inline val DVec3.ttp get() = DVec3(t, t, p)
inline val DVec3.tps get() = DVec3(t, p, s)
inline val DVec3.tpt get() = DVec3(t, p, t)
inline val DVec3.tpp get() = DVec3(t, p, p)
inline val DVec3.pss get() = DVec3(p, s, s)
inline val DVec3.pst get() = DVec3(p, s, t)
inline val DVec3.psp get() = DVec3(p, s, p)
inline val DVec3.pts get() = DVec3(p, t, s)
inline val DVec3.ptt get() = DVec3(p, t, t)
inline val DVec3.ptp get() = DVec3(p, t, p)
inline val DVec3.pps get() = DVec3(p, p, s)
inline val DVec3.ppt get() = DVec3(p, p, t)
inline val DVec3.ppp get() = DVec3(p, p, p)
inline val DVec3.xxxx get() = DVec4(x, x, x, x)
inline val DVec3.xxxy get() = DVec4(x, x, x, y)
inline val DVec3.xxxz get() = DVec4(x, x, x, z)
inline val DVec3.xxyx get() = DVec4(x, x, y, x)
inline val DVec3.xxyy get() = DVec4(x, x, y, y)
inline val DVec3.xxyz get() = DVec4(x, x, y, z)
inline val DVec3.xxzx get() = DVec4(x, x, z, x)
inline val DVec3.xxzy get() = DVec4(x, x, z, y)
inline val DVec3.xxzz get() = DVec4(x, x, z, z)
inline val DVec3.xyxx get() = DVec4(x, y, x, x)
inline val DVec3.xyxy get() = DVec4(x, y, x, y)
inline val DVec3.xyxz get() = DVec4(x, y, x, z)
inline val DVec3.xyyx get() = DVec4(x, y, y, x)
inline val DVec3.xyyy get() = DVec4(x, y, y, y)
inline val DVec3.xyyz get() = DVec4(x, y, y, z)
inline val DVec3.xyzx get() = DVec4(x, y, z, x)
inline val DVec3.xyzy get() = DVec4(x, y, z, y)
inline val DVec3.xyzz get() = DVec4(x, y, z, z)
inline val DVec3.xzxx get() = DVec4(x, z, x, x)
inline val DVec3.xzxy get() = DVec4(x, z, x, y)
inline val DVec3.xzxz get() = DVec4(x, z, x, z)
inline val DVec3.xzyx get() = DVec4(x, z, y, x)
inline val DVec3.xzyy get() = DVec4(x, z, y, y)
inline val DVec3.xzyz get() = DVec4(x, z, y, z)
inline val DVec3.xzzx get() = DVec4(x, z, z, x)
inline val DVec3.xzzy get() = DVec4(x, z, z, y)
inline val DVec3.xzzz get() = DVec4(x, z, z, z)
inline val DVec3.yxxx get() = DVec4(y, x, x, x)
inline val DVec3.yxxy get() = DVec4(y, x, x, y)
inline val DVec3.yxxz get() = DVec4(y, x, x, z)
inline val DVec3.yxyx get() = DVec4(y, x, y, x)
inline val DVec3.yxyy get() = DVec4(y, x, y, y)
inline val DVec3.yxyz get() = DVec4(y, x, y, z)
inline val DVec3.yxzx get() = DVec4(y, x, z, x)
inline val DVec3.yxzy get() = DVec4(y, x, z, y)
inline val DVec3.yxzz get() = DVec4(y, x, z, z)
inline val DVec3.yyxx get() = DVec4(y, y, x, x)
inline val DVec3.yyxy get() = DVec4(y, y, x, y)
inline val DVec3.yyxz get() = DVec4(y, y, x, z)
inline val DVec3.yyyx get() = DVec4(y, y, y, x)
inline val DVec3.yyyy get() = DVec4(y, y, y, y)
inline val DVec3.yyyz get() = DVec4(y, y, y, z)
inline val DVec3.yyzx get() = DVec4(y, y, z, x)
inline val DVec3.yyzy get() = DVec4(y, y, z, y)
inline val DVec3.yyzz get() = DVec4(y, y, z, z)
inline val DVec3.yzxx get() = DVec4(y, z, x, x)
inline val DVec3.yzxy get() = DVec4(y, z, x, y)
inline val DVec3.yzxz get() = DVec4(y, z, x, z)
inline val DVec3.yzyx get() = DVec4(y, z, y, x)
inline val DVec3.yzyy get() = DVec4(y, z, y, y)
inline val DVec3.yzyz get() = DVec4(y, z, y, z)
inline val DVec3.yzzx get() = DVec4(y, z, z, x)
inline val DVec3.yzzy get() = DVec4(y, z, z, y)
inline val DVec3.yzzz get() = DVec4(y, z, z, z)
inline val DVec3.zxxx get() = DVec4(z, x, x, x)
inline val DVec3.zxxy get() = DVec4(z, x, x, y)
inline val DVec3.zxxz get() = DVec4(z, x, x, z)
inline val DVec3.zxyx get() = DVec4(z, x, y, x)
inline val DVec3.zxyy get() = DVec4(z, x, y, y)
inline val DVec3.zxyz get() = DVec4(z, x, y, z)
inline val DVec3.zxzx get() = DVec4(z, x, z, x)
inline val DVec3.zxzy get() = DVec4(z, x, z, y)
inline val DVec3.zxzz get() = DVec4(z, x, z, z)
inline val DVec3.zyxx get() = DVec4(z, y, x, x)
inline val DVec3.zyxy get() = DVec4(z, y, x, y)
inline val DVec3.zyxz get() = DVec4(z, y, x, z)
inline val DVec3.zyyx get() = DVec4(z, y, y, x)
inline val DVec3.zyyy get() = DVec4(z, y, y, y)
inline val DVec3.zyyz get() = DVec4(z, y, y, z)
inline val DVec3.zyzx get() = DVec4(z, y, z, x)
inline val DVec3.zyzy get() = DVec4(z, y, z, y)
inline val DVec3.zyzz get() = DVec4(z, y, z, z)
inline val DVec3.zzxx get() = DVec4(z, z, x, x)
inline val DVec3.zzxy get() = DVec4(z, z, x, y)
inline val DVec3.zzxz get() = DVec4(z, z, x, z)
inline val DVec3.zzyx get() = DVec4(z, z, y, x)
inline val DVec3.zzyy get() = DVec4(z, z, y, y)
inline val DVec3.zzyz get() = DVec4(z, z, y, z)
inline val DVec3.zzzx get() = DVec4(z, z, z, x)
inline val DVec3.zzzy get() = DVec4(z, z, z, y)
inline val DVec3.zzzz get() = DVec4(z, z, z, z)
inline val DVec3.rrrr get() = DVec4(r, r, r, r)
inline val DVec3.rrrg get() = DVec4(r, r, r, g)
inline val DVec3.rrrb get() = DVec4(r, r, r, b)
inline val DVec3.rrgr get() = DVec4(r, r, g, r)
inline val DVec3.rrgg get() = DVec4(r, r, g, g)
inline val DVec3.rrgb get() = DVec4(r, r, g, b)
inline val DVec3.rrbr get() = DVec4(r, r, b, r)
inline val DVec3.rrbg get() = DVec4(r, r, b, g)
inline val DVec3.rrbb get() = DVec4(r, r, b, b)
inline val DVec3.rgrr get() = DVec4(r, g, r, r)
inline val DVec3.rgrg get() = DVec4(r, g, r, g)
inline val DVec3.rgrb get() = DVec4(r, g, r, b)
inline val DVec3.rggr get() = DVec4(r, g, g, r)
inline val DVec3.rggg get() = DVec4(r, g, g, g)
inline val DVec3.rggb get() = DVec4(r, g, g, b)
inline val DVec3.rgbr get() = DVec4(r, g, b, r)
inline val DVec3.rgbg get() = DVec4(r, g, b, g)
inline val DVec3.rgbb get() = DVec4(r, g, b, b)
inline val DVec3.rbrr get() = DVec4(r, b, r, r)
inline val DVec3.rbrg get() = DVec4(r, b, r, g)
inline val DVec3.rbrb get() = DVec4(r, b, r, b)
inline val DVec3.rbgr get() = DVec4(r, b, g, r)
inline val DVec3.rbgg get() = DVec4(r, b, g, g)
inline val DVec3.rbgb get() = DVec4(r, b, g, b)
inline val DVec3.rbbr get() = DVec4(r, b, b, r)
inline val DVec3.rbbg get() = DVec4(r, b, b, g)
inline val DVec3.rbbb get() = DVec4(r, b, b, b)
inline val DVec3.grrr get() = DVec4(g, r, r, r)
inline val DVec3.grrg get() = DVec4(g, r, r, g)
inline val DVec3.grrb get() = DVec4(g, r, r, b)
inline val DVec3.grgr get() = DVec4(g, r, g, r)
inline val DVec3.grgg get() = DVec4(g, r, g, g)
inline val DVec3.grgb get() = DVec4(g, r, g, b)
inline val DVec3.grbr get() = DVec4(g, r, b, r)
inline val DVec3.grbg get() = DVec4(g, r, b, g)
inline val DVec3.grbb get() = DVec4(g, r, b, b)
inline val DVec3.ggrr get() = DVec4(g, g, r, r)
inline val DVec3.ggrg get() = DVec4(g, g, r, g)
inline val DVec3.ggrb get() = DVec4(g, g, r, b)
inline val DVec3.gggr get() = DVec4(g, g, g, r)
inline val DVec3.gggg get() = DVec4(g, g, g, g)
inline val DVec3.gggb get() = DVec4(g, g, g, b)
inline val DVec3.ggbr get() = DVec4(g, g, b, r)
inline val DVec3.ggbg get() = DVec4(g, g, b, g)
inline val DVec3.ggbb get() = DVec4(g, g, b, b)
inline val DVec3.gbrr get() = DVec4(g, b, r, r)
inline val DVec3.gbrg get() = DVec4(g, b, r, g)
inline val DVec3.gbrb get() = DVec4(g, b, r, b)
inline val DVec3.gbgr get() = DVec4(g, b, g, r)
inline val DVec3.gbgg get() = DVec4(g, b, g, g)
inline val DVec3.gbgb get() = DVec4(g, b, g, b)
inline val DVec3.gbbr get() = DVec4(g, b, b, r)
inline val DVec3.gbbg get() = DVec4(g, b, b, g)
inline val DVec3.gbbb get() = DVec4(g, b, b, b)
inline val DVec3.brrr get() = DVec4(b, r, r, r)
inline val DVec3.brrg get() = DVec4(b, r, r, g)
inline val DVec3.brrb get() = DVec4(b, r, r, b)
inline val DVec3.brgr get() = DVec4(b, r, g, r)
inline val DVec3.brgg get() = DVec4(b, r, g, g)
inline val DVec3.brgb get() = DVec4(b, r, g, b)
inline val DVec3.brbr get() = DVec4(b, r, b, r)
inline val DVec3.brbg get() = DVec4(b, r, b, g)
inline val DVec3.brbb get() = DVec4(b, r, b, b)
inline val DVec3.bgrr get() = DVec4(b, g, r, r)
inline val DVec3.bgrg get() = DVec4(b, g, r, g)
inline val DVec3.bgrb get() = DVec4(b, g, r, b)
inline val DVec3.bggr get() = DVec4(b, g, g, r)
inline val DVec3.bggg get() = DVec4(b, g, g, g)
inline val DVec3.bggb get() = DVec4(b, g, g, b)
inline val DVec3.bgbr get() = DVec4(b, g, b, r)
inline val DVec3.bgbg get() = DVec4(b, g, b, g)
inline val DVec3.bgbb get() = DVec4(b, g, b, b)
inline val DVec3.bbrr get() = DVec4(b, b, r, r)
inline val DVec3.bbrg get() = DVec4(b, b, r, g)
inline val DVec3.bbrb get() = DVec4(b, b, r, b)
inline val DVec3.bbgr get() = DVec4(b, b, g, r)
inline val DVec3.bbgg get() = DVec4(b, b, g, g)
inline val DVec3.bbgb get() = DVec4(b, b, g, b)
inline val DVec3.bbbr get() = DVec4(b, b, b, r)
inline val DVec3.bbbg get() = DVec4(b, b, b, g)
inline val DVec3.bbbb get() = DVec4(b, b, b, b)
inline val DVec3.ssss get() = DVec4(s, s, s, s)
inline val DVec3.ssst get() = DVec4(s, s, s, t)
inline val DVec3.sssp get() = DVec4(s, s, s, p)
inline val DVec3.ssts get() = DVec4(s, s, t, s)
inline val DVec3.sstt get() = DVec4(s, s, t, t)
inline val DVec3.sstp get() = DVec4(s, s, t, p)
inline val DVec3.ssps get() = DVec4(s, s, p, s)
inline val DVec3.sspt get() = DVec4(s, s, p, t)
inline val DVec3.sspp get() = DVec4(s, s, p, p)
inline val DVec3.stss get() = DVec4(s, t, s, s)
inline val DVec3.stst get() = DVec4(s, t, s, t)
inline val DVec3.stsp get() = DVec4(s, t, s, p)
inline val DVec3.stts get() = DVec4(s, t, t, s)
inline val DVec3.sttt get() = DVec4(s, t, t, t)
inline val DVec3.sttp get() = DVec4(s, t, t, p)
inline val DVec3.stps get() = DVec4(s, t, p, s)
inline val DVec3.stpt get() = DVec4(s, t, p, t)
inline val DVec3.stpp get() = DVec4(s, t, p, p)
inline val DVec3.spss get() = DVec4(s, p, s, s)
inline val DVec3.spst get() = DVec4(s, p, s, t)
inline val DVec3.spsp get() = DVec4(s, p, s, p)
inline val DVec3.spts get() = DVec4(s, p, t, s)
inline val DVec3.sptt get() = DVec4(s, p, t, t)
inline val DVec3.sptp get() = DVec4(s, p, t, p)
inline val DVec3.spps get() = DVec4(s, p, p, s)
inline val DVec3.sppt get() = DVec4(s, p, p, t)
inline val DVec3.sppp get() = DVec4(s, p, p, p)
inline val DVec3.tsss get() = DVec4(t, s, s, s)
inline val DVec3.tsst get() = DVec4(t, s, s, t)
inline val DVec3.tssp get() = DVec4(t, s, s, p)
inline val DVec3.tsts get() = DVec4(t, s, t, s)
inline val DVec3.tstt get() = DVec4(t, s, t, t)
inline val DVec3.tstp get() = DVec4(t, s, t, p)
inline val DVec3.tsps get() = DVec4(t, s, p, s)
inline val DVec3.tspt get() = DVec4(t, s, p, t)
inline val DVec3.tspp get() = DVec4(t, s, p, p)
inline val DVec3.ttss get() = DVec4(t, t, s, s)
inline val DVec3.ttst get() = DVec4(t, t, s, t)
inline val DVec3.ttsp get() = DVec4(t, t, s, p)
inline val DVec3.ttts get() = DVec4(t, t, t, s)
inline val DVec3.tttt get() = DVec4(t, t, t, t)
inline val DVec3.tttp get() = DVec4(t, t, t, p)
inline val DVec3.ttps get() = DVec4(t, t, p, s)
inline val DVec3.ttpt get() = DVec4(t, t, p, t)
inline val DVec3.ttpp get() = DVec4(t, t, p, p)
inline val DVec3.tpss get() = DVec4(t, p, s, s)
inline val DVec3.tpst get() = DVec4(t, p, s, t)
inline val DVec3.tpsp get() = DVec4(t, p, s, p)
inline val DVec3.tpts get() = DVec4(t, p, t, s)
inline val DVec3.tptt get() = DVec4(t, p, t, t)
inline val DVec3.tptp get() = DVec4(t, p, t, p)
inline val DVec3.tpps get() = DVec4(t, p, p, s)
inline val DVec3.tppt get() = DVec4(t, p, p, t)
inline val DVec3.tppp get() = DVec4(t, p, p, p)
inline val DVec3.psss get() = DVec4(p, s, s, s)
inline val DVec3.psst get() = DVec4(p, s, s, t)
inline val DVec3.pssp get() = DVec4(p, s, s, p)
inline val DVec3.psts get() = DVec4(p, s, t, s)
inline val DVec3.pstt get() = DVec4(p, s, t, t)
inline val DVec3.pstp get() = DVec4(p, s, t, p)
inline val DVec3.psps get() = DVec4(p, s, p, s)
inline val DVec3.pspt get() = DVec4(p, s, p, t)
inline val DVec3.pspp get() = DVec4(p, s, p, p)
inline val DVec3.ptss get() = DVec4(p, t, s, s)
inline val DVec3.ptst get() = DVec4(p, t, s, t)
inline val DVec3.ptsp get() = DVec4(p, t, s, p)
inline val DVec3.ptts get() = DVec4(p, t, t, s)
inline val DVec3.pttt get() = DVec4(p, t, t, t)
inline val DVec3.pttp get() = DVec4(p, t, t, p)
inline val DVec3.ptps get() = DVec4(p, t, p, s)
inline val DVec3.ptpt get() = DVec4(p, t, p, t)
inline val DVec3.ptpp get() = DVec4(p, t, p, p)
inline val DVec3.ppss get() = DVec4(p, p, s, s)
inline val DVec3.ppst get() = DVec4(p, p, s, t)
inline val DVec3.ppsp get() = DVec4(p, p, s, p)
inline val DVec3.ppts get() = DVec4(p, p, t, s)
inline val DVec3.pptt get() = DVec4(p, p, t, t)
inline val DVec3.pptp get() = DVec4(p, p, t, p)
inline val DVec3.ppps get() = DVec4(p, p, p, s)
inline val DVec3.pppt get() = DVec4(p, p, p, t)
inline val DVec3.pppp get() = DVec4(p, p, p, p)
//endregion
//region Swizzling Vec4
inline val DVec4.xx get() = DVec2(x, x)
inline val DVec4.xy get() = DVec2(x, y)
inline val DVec4.xz get() = DVec2(x, z)
inline val DVec4.xw get() = DVec2(x, w)
inline val DVec4.yx get() = DVec2(y, x)
inline val DVec4.yy get() = DVec2(y, y)
inline val DVec4.yz get() = DVec2(y, z)
inline val DVec4.yw get() = DVec2(y, w)
inline val DVec4.zx get() = DVec2(z, x)
inline val DVec4.zy get() = DVec2(z, y)
inline val DVec4.zz get() = DVec2(z, z)
inline val DVec4.zw get() = DVec2(z, w)
inline val DVec4.wx get() = DVec2(w, x)
inline val DVec4.wy get() = DVec2(w, y)
inline val DVec4.wz get() = DVec2(w, z)
inline val DVec4.ww get() = DVec2(w, w)
inline val DVec4.rr get() = DVec2(r, r)
inline val DVec4.rg get() = DVec2(r, g)
inline val DVec4.rb get() = DVec2(r, b)
inline val DVec4.ra get() = DVec2(r, a)
inline val DVec4.gr get() = DVec2(g, r)
inline val DVec4.gg get() = DVec2(g, g)
inline val DVec4.gb get() = DVec2(g, b)
inline val DVec4.ga get() = DVec2(g, a)
inline val DVec4.br get() = DVec2(b, r)
inline val DVec4.bg get() = DVec2(b, g)
inline val DVec4.bb get() = DVec2(b, b)
inline val DVec4.ba get() = DVec2(b, a)
inline val DVec4.ar get() = DVec2(a, r)
inline val DVec4.ag get() = DVec2(a, g)
inline val DVec4.ab get() = DVec2(a, b)
inline val DVec4.aa get() = DVec2(a, a)
inline val DVec4.ss get() = DVec2(s, s)
inline val DVec4.st get() = DVec2(s, t)
inline val DVec4.sp get() = DVec2(s, p)
inline val DVec4.sq get() = DVec2(s, q)
inline val DVec4.ts get() = DVec2(t, s)
inline val DVec4.tt get() = DVec2(t, t)
inline val DVec4.tp get() = DVec2(t, p)
inline val DVec4.tq get() = DVec2(t, q)
inline val DVec4.ps get() = DVec2(p, s)
inline val DVec4.pt get() = DVec2(p, t)
inline val DVec4.pp get() = DVec2(p, p)
inline val DVec4.pq get() = DVec2(p, q)
inline val DVec4.qs get() = DVec2(q, s)
inline val DVec4.qt get() = DVec2(q, t)
inline val DVec4.qp get() = DVec2(q, p)
inline val DVec4.qq get() = DVec2(q, q)
inline val DVec4.xxx get() = DVec3(x, x, x)
inline val DVec4.xxy get() = DVec3(x, x, y)
inline val DVec4.xxz get() = DVec3(x, x, z)
inline val DVec4.xxw get() = DVec3(x, x, w)
inline val DVec4.xyx get() = DVec3(x, y, x)
inline val DVec4.xyy get() = DVec3(x, y, y)
inline val DVec4.xyz get() = DVec3(x, y, z)
inline val DVec4.xyw get() = DVec3(x, y, w)
inline val DVec4.xzx get() = DVec3(x, z, x)
inline val DVec4.xzy get() = DVec3(x, z, y)
inline val DVec4.xzz get() = DVec3(x, z, z)
inline val DVec4.xzw get() = DVec3(x, z, w)
inline val DVec4.xwx get() = DVec3(x, w, x)
inline val DVec4.xwy get() = DVec3(x, w, y)
inline val DVec4.xwz get() = DVec3(x, w, z)
inline val DVec4.xww get() = DVec3(x, w, w)
inline val DVec4.yxx get() = DVec3(y, x, x)
inline val DVec4.yxy get() = DVec3(y, x, y)
inline val DVec4.yxz get() = DVec3(y, x, z)
inline val DVec4.yxw get() = DVec3(y, x, w)
inline val DVec4.yyx get() = DVec3(y, y, x)
inline val DVec4.yyy get() = DVec3(y, y, y)
inline val DVec4.yyz get() = DVec3(y, y, z)
inline val DVec4.yyw get() = DVec3(y, y, w)
inline val DVec4.yzx get() = DVec3(y, z, x)
inline val DVec4.yzy get() = DVec3(y, z, y)
inline val DVec4.yzz get() = DVec3(y, z, z)
inline val DVec4.yzw get() = DVec3(y, z, w)
inline val DVec4.ywx get() = DVec3(y, w, x)
inline val DVec4.ywy get() = DVec3(y, w, y)
inline val DVec4.ywz get() = DVec3(y, w, z)
inline val DVec4.yww get() = DVec3(y, w, w)
inline val DVec4.zxx get() = DVec3(z, x, x)
inline val DVec4.zxy get() = DVec3(z, x, y)
inline val DVec4.zxz get() = DVec3(z, x, z)
inline val DVec4.zxw get() = DVec3(z, x, w)
inline val DVec4.zyx get() = DVec3(z, y, x)
inline val DVec4.zyy get() = DVec3(z, y, y)
inline val DVec4.zyz get() = DVec3(z, y, z)
inline val DVec4.zyw get() = DVec3(z, y, w)
inline val DVec4.zzx get() = DVec3(z, z, x)
inline val DVec4.zzy get() = DVec3(z, z, y)
inline val DVec4.zzz get() = DVec3(z, z, z)
inline val DVec4.zzw get() = DVec3(z, z, w)
inline val DVec4.zwx get() = DVec3(z, w, x)
inline val DVec4.zwy get() = DVec3(z, w, y)
inline val DVec4.zwz get() = DVec3(z, w, z)
inline val DVec4.zww get() = DVec3(z, w, w)
inline val DVec4.wxx get() = DVec3(w, x, x)
inline val DVec4.wxy get() = DVec3(w, x, y)
inline val DVec4.wxz get() = DVec3(w, x, z)
inline val DVec4.wxw get() = DVec3(w, x, w)
inline val DVec4.wyx get() = DVec3(w, y, x)
inline val DVec4.wyy get() = DVec3(w, y, y)
inline val DVec4.wyz get() = DVec3(w, y, z)
inline val DVec4.wyw get() = DVec3(w, y, w)
inline val DVec4.wzx get() = DVec3(w, z, x)
inline val DVec4.wzy get() = DVec3(w, z, y)
inline val DVec4.wzz get() = DVec3(w, z, z)
inline val DVec4.wzw get() = DVec3(w, z, w)
inline val DVec4.wwx get() = DVec3(w, w, x)
inline val DVec4.wwy get() = DVec3(w, w, y)
inline val DVec4.wwz get() = DVec3(w, w, z)
inline val DVec4.www get() = DVec3(w, w, w)
inline val DVec4.rrr get() = DVec3(r, r, r)
inline val DVec4.rrg get() = DVec3(r, r, g)
inline val DVec4.rrb get() = DVec3(r, r, b)
inline val DVec4.rra get() = DVec3(r, r, a)
inline val DVec4.rgr get() = DVec3(r, g, r)
inline val DVec4.rgg get() = DVec3(r, g, g)
inline val DVec4.rgb get() = DVec3(r, g, b)
inline val DVec4.rga get() = DVec3(r, g, a)
inline val DVec4.rbr get() = DVec3(r, b, r)
inline val DVec4.rbg get() = DVec3(r, b, g)
inline val DVec4.rbb get() = DVec3(r, b, b)
inline val DVec4.rba get() = DVec3(r, b, a)
inline val DVec4.rar get() = DVec3(r, a, r)
inline val DVec4.rag get() = DVec3(r, a, g)
inline val DVec4.rab get() = DVec3(r, a, b)
inline val DVec4.raa get() = DVec3(r, a, a)
inline val DVec4.grr get() = DVec3(g, r, r)
inline val DVec4.grg get() = DVec3(g, r, g)
inline val DVec4.grb get() = DVec3(g, r, b)
inline val DVec4.gra get() = DVec3(g, r, a)
inline val DVec4.ggr get() = DVec3(g, g, r)
inline val DVec4.ggg get() = DVec3(g, g, g)
inline val DVec4.ggb get() = DVec3(g, g, b)
inline val DVec4.gga get() = DVec3(g, g, a)
inline val DVec4.gbr get() = DVec3(g, b, r)
inline val DVec4.gbg get() = DVec3(g, b, g)
inline val DVec4.gbb get() = DVec3(g, b, b)
inline val DVec4.gba get() = DVec3(g, b, a)
inline val DVec4.gar get() = DVec3(g, a, r)
inline val DVec4.gag get() = DVec3(g, a, g)
inline val DVec4.gab get() = DVec3(g, a, b)
inline val DVec4.gaa get() = DVec3(g, a, a)
inline val DVec4.brr get() = DVec3(b, r, r)
inline val DVec4.brg get() = DVec3(b, r, g)
inline val DVec4.brb get() = DVec3(b, r, b)
inline val DVec4.bra get() = DVec3(b, r, a)
inline val DVec4.bgr get() = DVec3(b, g, r)
inline val DVec4.bgg get() = DVec3(b, g, g)
inline val DVec4.bgb get() = DVec3(b, g, b)
inline val DVec4.bga get() = DVec3(b, g, a)
inline val DVec4.bbr get() = DVec3(b, b, r)
inline val DVec4.bbg get() = DVec3(b, b, g)
inline val DVec4.bbb get() = DVec3(b, b, b)
inline val DVec4.bba get() = DVec3(b, b, a)
inline val DVec4.bar get() = DVec3(b, a, r)
inline val DVec4.bag get() = DVec3(b, a, g)
inline val DVec4.bab get() = DVec3(b, a, b)
inline val DVec4.baa get() = DVec3(b, a, a)
inline val DVec4.arr get() = DVec3(a, r, r)
inline val DVec4.arg get() = DVec3(a, r, g)
inline val DVec4.arb get() = DVec3(a, r, b)
inline val DVec4.ara get() = DVec3(a, r, a)
inline val DVec4.agr get() = DVec3(a, g, r)
inline val DVec4.agg get() = DVec3(a, g, g)
inline val DVec4.agb get() = DVec3(a, g, b)
inline val DVec4.aga get() = DVec3(a, g, a)
inline val DVec4.abr get() = DVec3(a, b, r)
inline val DVec4.abg get() = DVec3(a, b, g)
inline val DVec4.abb get() = DVec3(a, b, b)
inline val DVec4.aba get() = DVec3(a, b, a)
inline val DVec4.aar get() = DVec3(a, a, r)
inline val DVec4.aag get() = DVec3(a, a, g)
inline val DVec4.aab get() = DVec3(a, a, b)
inline val DVec4.aaa get() = DVec3(a, a, a)
inline val DVec4.sss get() = DVec3(s, s, s)
inline val DVec4.sst get() = DVec3(s, s, t)
inline val DVec4.ssp get() = DVec3(s, s, p)
inline val DVec4.ssq get() = DVec3(s, s, q)
inline val DVec4.sts get() = DVec3(s, t, s)
inline val DVec4.stt get() = DVec3(s, t, t)
inline val DVec4.stp get() = DVec3(s, t, p)
inline val DVec4.stq get() = DVec3(s, t, q)
inline val DVec4.sps get() = DVec3(s, p, s)
inline val DVec4.spt get() = DVec3(s, p, t)
inline val DVec4.spp get() = DVec3(s, p, p)
inline val DVec4.spq get() = DVec3(s, p, q)
inline val DVec4.sqs get() = DVec3(s, q, s)
inline val DVec4.sqt get() = DVec3(s, q, t)
inline val DVec4.sqp get() = DVec3(s, q, p)
inline val DVec4.sqq get() = DVec3(s, q, q)
inline val DVec4.tss get() = DVec3(t, s, s)
inline val DVec4.tst get() = DVec3(t, s, t)
inline val DVec4.tsp get() = DVec3(t, s, p)
inline val DVec4.tsq get() = DVec3(t, s, q)
inline val DVec4.tts get() = DVec3(t, t, s)
inline val DVec4.ttt get() = DVec3(t, t, t)
inline val DVec4.ttp get() = DVec3(t, t, p)
inline val DVec4.ttq get() = DVec3(t, t, q)
inline val DVec4.tps get() = DVec3(t, p, s)
inline val DVec4.tpt get() = DVec3(t, p, t)
inline val DVec4.tpp get() = DVec3(t, p, p)
inline val DVec4.tpq get() = DVec3(t, p, q)
inline val DVec4.tqs get() = DVec3(t, q, s)
inline val DVec4.tqt get() = DVec3(t, q, t)
inline val DVec4.tqp get() = DVec3(t, q, p)
inline val DVec4.tqq get() = DVec3(t, q, q)
inline val DVec4.pss get() = DVec3(p, s, s)
inline val DVec4.pst get() = DVec3(p, s, t)
inline val DVec4.psp get() = DVec3(p, s, p)
inline val DVec4.psq get() = DVec3(p, s, q)
inline val DVec4.pts get() = DVec3(p, t, s)
inline val DVec4.ptt get() = DVec3(p, t, t)
inline val DVec4.ptp get() = DVec3(p, t, p)
inline val DVec4.ptq get() = DVec3(p, t, q)
inline val DVec4.pps get() = DVec3(p, p, s)
inline val DVec4.ppt get() = DVec3(p, p, t)
inline val DVec4.ppp get() = DVec3(p, p, p)
inline val DVec4.ppq get() = DVec3(p, p, q)
inline val DVec4.pqs get() = DVec3(p, q, s)
inline val DVec4.pqt get() = DVec3(p, q, t)
inline val DVec4.pqp get() = DVec3(p, q, p)
inline val DVec4.pqq get() = DVec3(p, q, q)
inline val DVec4.qss get() = DVec3(q, s, s)
inline val DVec4.qst get() = DVec3(q, s, t)
inline val DVec4.qsp get() = DVec3(q, s, p)
inline val DVec4.qsq get() = DVec3(q, s, q)
inline val DVec4.qts get() = DVec3(q, t, s)
inline val DVec4.qtt get() = DVec3(q, t, t)
inline val DVec4.qtp get() = DVec3(q, t, p)
inline val DVec4.qtq get() = DVec3(q, t, q)
inline val DVec4.qps get() = DVec3(q, p, s)
inline val DVec4.qpt get() = DVec3(q, p, t)
inline val DVec4.qpp get() = DVec3(q, p, p)
inline val DVec4.qpq get() = DVec3(q, p, q)
inline val DVec4.qqs get() = DVec3(q, q, s)
inline val DVec4.qqt get() = DVec3(q, q, t)
inline val DVec4.qqp get() = DVec3(q, q, p)
inline val DVec4.qqq get() = DVec3(q, q, q)
inline val DVec4.xxxx get() = DVec4(x, x, x, x)
inline val DVec4.xxxy get() = DVec4(x, x, x, y)
inline val DVec4.xxxz get() = DVec4(x, x, x, z)
inline val DVec4.xxxw get() = DVec4(x, x, x, w)
inline val DVec4.xxyx get() = DVec4(x, x, y, x)
inline val DVec4.xxyy get() = DVec4(x, x, y, y)
inline val DVec4.xxyz get() = DVec4(x, x, y, z)
inline val DVec4.xxyw get() = DVec4(x, x, y, w)
inline val DVec4.xxzx get() = DVec4(x, x, z, x)
inline val DVec4.xxzy get() = DVec4(x, x, z, y)
inline val DVec4.xxzz get() = DVec4(x, x, z, z)
inline val DVec4.xxzw get() = DVec4(x, x, z, w)
inline val DVec4.xxwx get() = DVec4(x, x, w, x)
inline val DVec4.xxwy get() = DVec4(x, x, w, y)
inline val DVec4.xxwz get() = DVec4(x, x, w, z)
inline val DVec4.xxww get() = DVec4(x, x, w, w)
inline val DVec4.xyxx get() = DVec4(x, y, x, x)
inline val DVec4.xyxy get() = DVec4(x, y, x, y)
inline val DVec4.xyxz get() = DVec4(x, y, x, z)
inline val DVec4.xyxw get() = DVec4(x, y, x, w)
inline val DVec4.xyyx get() = DVec4(x, y, y, x)
inline val DVec4.xyyy get() = DVec4(x, y, y, y)
inline val DVec4.xyyz get() = DVec4(x, y, y, z)
inline val DVec4.xyyw get() = DVec4(x, y, y, w)
inline val DVec4.xyzx get() = DVec4(x, y, z, x)
inline val DVec4.xyzy get() = DVec4(x, y, z, y)
inline val DVec4.xyzz get() = DVec4(x, y, z, z)
inline val DVec4.xyzw get() = DVec4(x, y, z, w)
inline val DVec4.xywx get() = DVec4(x, y, w, x)
inline val DVec4.xywy get() = DVec4(x, y, w, y)
inline val DVec4.xywz get() = DVec4(x, y, w, z)
inline val DVec4.xyww get() = DVec4(x, y, w, w)
inline val DVec4.xzxx get() = DVec4(x, z, x, x)
inline val DVec4.xzxy get() = DVec4(x, z, x, y)
inline val DVec4.xzxz get() = DVec4(x, z, x, z)
inline val DVec4.xzxw get() = DVec4(x, z, x, w)
inline val DVec4.xzyx get() = DVec4(x, z, y, x)
inline val DVec4.xzyy get() = DVec4(x, z, y, y)
inline val DVec4.xzyz get() = DVec4(x, z, y, z)
inline val DVec4.xzyw get() = DVec4(x, z, y, w)
inline val DVec4.xzzx get() = DVec4(x, z, z, x)
inline val DVec4.xzzy get() = DVec4(x, z, z, y)
inline val DVec4.xzzz get() = DVec4(x, z, z, z)
inline val DVec4.xzzw get() = DVec4(x, z, z, w)
inline val DVec4.xzwx get() = DVec4(x, z, w, x)
inline val DVec4.xzwy get() = DVec4(x, z, w, y)
inline val DVec4.xzwz get() = DVec4(x, z, w, z)
inline val DVec4.xzww get() = DVec4(x, z, w, w)
inline val DVec4.xwxx get() = DVec4(x, w, x, x)
inline val DVec4.xwxy get() = DVec4(x, w, x, y)
inline val DVec4.xwxz get() = DVec4(x, w, x, z)
inline val DVec4.xwxw get() = DVec4(x, w, x, w)
inline val DVec4.xwyx get() = DVec4(x, w, y, x)
inline val DVec4.xwyy get() = DVec4(x, w, y, y)
inline val DVec4.xwyz get() = DVec4(x, w, y, z)
inline val DVec4.xwyw get() = DVec4(x, w, y, w)
inline val DVec4.xwzx get() = DVec4(x, w, z, x)
inline val DVec4.xwzy get() = DVec4(x, w, z, y)
inline val DVec4.xwzz get() = DVec4(x, w, z, z)
inline val DVec4.xwzw get() = DVec4(x, w, z, w)
inline val DVec4.xwwx get() = DVec4(x, w, w, x)
inline val DVec4.xwwy get() = DVec4(x, w, w, y)
inline val DVec4.xwwz get() = DVec4(x, w, w, z)
inline val DVec4.xwww get() = DVec4(x, w, w, w)
inline val DVec4.yxxx get() = DVec4(y, x, x, x)
inline val DVec4.yxxy get() = DVec4(y, x, x, y)
inline val DVec4.yxxz get() = DVec4(y, x, x, z)
inline val DVec4.yxxw get() = DVec4(y, x, x, w)
inline val DVec4.yxyx get() = DVec4(y, x, y, x)
inline val DVec4.yxyy get() = DVec4(y, x, y, y)
inline val DVec4.yxyz get() = DVec4(y, x, y, z)
inline val DVec4.yxyw get() = DVec4(y, x, y, w)
inline val DVec4.yxzx get() = DVec4(y, x, z, x)
inline val DVec4.yxzy get() = DVec4(y, x, z, y)
inline val DVec4.yxzz get() = DVec4(y, x, z, z)
inline val DVec4.yxzw get() = DVec4(y, x, z, w)
inline val DVec4.yxwx get() = DVec4(y, x, w, x)
inline val DVec4.yxwy get() = DVec4(y, x, w, y)
inline val DVec4.yxwz get() = DVec4(y, x, w, z)
inline val DVec4.yxww get() = DVec4(y, x, w, w)
inline val DVec4.yyxx get() = DVec4(y, y, x, x)
inline val DVec4.yyxy get() = DVec4(y, y, x, y)
inline val DVec4.yyxz get() = DVec4(y, y, x, z)
inline val DVec4.yyxw get() = DVec4(y, y, x, w)
inline val DVec4.yyyx get() = DVec4(y, y, y, x)
inline val DVec4.yyyy get() = DVec4(y, y, y, y)
inline val DVec4.yyyz get() = DVec4(y, y, y, z)
inline val DVec4.yyyw get() = DVec4(y, y, y, w)
inline val DVec4.yyzx get() = DVec4(y, y, z, x)
inline val DVec4.yyzy get() = DVec4(y, y, z, y)
inline val DVec4.yyzz get() = DVec4(y, y, z, z)
inline val DVec4.yyzw get() = DVec4(y, y, z, w)
inline val DVec4.yywx get() = DVec4(y, y, w, x)
inline val DVec4.yywy get() = DVec4(y, y, w, y)
inline val DVec4.yywz get() = DVec4(y, y, w, z)
inline val DVec4.yyww get() = DVec4(y, y, w, w)
inline val DVec4.yzxx get() = DVec4(y, z, x, x)
inline val DVec4.yzxy get() = DVec4(y, z, x, y)
inline val DVec4.yzxz get() = DVec4(y, z, x, z)
inline val DVec4.yzxw get() = DVec4(y, z, x, w)
inline val DVec4.yzyx get() = DVec4(y, z, y, x)
inline val DVec4.yzyy get() = DVec4(y, z, y, y)
inline val DVec4.yzyz get() = DVec4(y, z, y, z)
inline val DVec4.yzyw get() = DVec4(y, z, y, w)
inline val DVec4.yzzx get() = DVec4(y, z, z, x)
inline val DVec4.yzzy get() = DVec4(y, z, z, y)
inline val DVec4.yzzz get() = DVec4(y, z, z, z)
inline val DVec4.yzzw get() = DVec4(y, z, z, w)
inline val DVec4.yzwx get() = DVec4(y, z, w, x)
inline val DVec4.yzwy get() = DVec4(y, z, w, y)
inline val DVec4.yzwz get() = DVec4(y, z, w, z)
inline val DVec4.yzww get() = DVec4(y, z, w, w)
inline val DVec4.ywxx get() = DVec4(y, w, x, x)
inline val DVec4.ywxy get() = DVec4(y, w, x, y)
inline val DVec4.ywxz get() = DVec4(y, w, x, z)
inline val DVec4.ywxw get() = DVec4(y, w, x, w)
inline val DVec4.ywyx get() = DVec4(y, w, y, x)
inline val DVec4.ywyy get() = DVec4(y, w, y, y)
inline val DVec4.ywyz get() = DVec4(y, w, y, z)
inline val DVec4.ywyw get() = DVec4(y, w, y, w)
inline val DVec4.ywzx get() = DVec4(y, w, z, x)
inline val DVec4.ywzy get() = DVec4(y, w, z, y)
inline val DVec4.ywzz get() = DVec4(y, w, z, z)
inline val DVec4.ywzw get() = DVec4(y, w, z, w)
inline val DVec4.ywwx get() = DVec4(y, w, w, x)
inline val DVec4.ywwy get() = DVec4(y, w, w, y)
inline val DVec4.ywwz get() = DVec4(y, w, w, z)
inline val DVec4.ywww get() = DVec4(y, w, w, w)
inline val DVec4.zxxx get() = DVec4(z, x, x, x)
inline val DVec4.zxxy get() = DVec4(z, x, x, y)
inline val DVec4.zxxz get() = DVec4(z, x, x, z)
inline val DVec4.zxxw get() = DVec4(z, x, x, w)
inline val DVec4.zxyx get() = DVec4(z, x, y, x)
inline val DVec4.zxyy get() = DVec4(z, x, y, y)
inline val DVec4.zxyz get() = DVec4(z, x, y, z)
inline val DVec4.zxyw get() = DVec4(z, x, y, w)
inline val DVec4.zxzx get() = DVec4(z, x, z, x)
inline val DVec4.zxzy get() = DVec4(z, x, z, y)
inline val DVec4.zxzz get() = DVec4(z, x, z, z)
inline val DVec4.zxzw get() = DVec4(z, x, z, w)
inline val DVec4.zxwx get() = DVec4(z, x, w, x)
inline val DVec4.zxwy get() = DVec4(z, x, w, y)
inline val DVec4.zxwz get() = DVec4(z, x, w, z)
inline val DVec4.zxww get() = DVec4(z, x, w, w)
inline val DVec4.zyxx get() = DVec4(z, y, x, x)
inline val DVec4.zyxy get() = DVec4(z, y, x, y)
inline val DVec4.zyxz get() = DVec4(z, y, x, z)
inline val DVec4.zyxw get() = DVec4(z, y, x, w)
inline val DVec4.zyyx get() = DVec4(z, y, y, x)
inline val DVec4.zyyy get() = DVec4(z, y, y, y)
inline val DVec4.zyyz get() = DVec4(z, y, y, z)
inline val DVec4.zyyw get() = DVec4(z, y, y, w)
inline val DVec4.zyzx get() = DVec4(z, y, z, x)
inline val DVec4.zyzy get() = DVec4(z, y, z, y)
inline val DVec4.zyzz get() = DVec4(z, y, z, z)
inline val DVec4.zyzw get() = DVec4(z, y, z, w)
inline val DVec4.zywx get() = DVec4(z, y, w, x)
inline val DVec4.zywy get() = DVec4(z, y, w, y)
inline val DVec4.zywz get() = DVec4(z, y, w, z)
inline val DVec4.zyww get() = DVec4(z, y, w, w)
inline val DVec4.zzxx get() = DVec4(z, z, x, x)
inline val DVec4.zzxy get() = DVec4(z, z, x, y)
inline val DVec4.zzxz get() = DVec4(z, z, x, z)
inline val DVec4.zzxw get() = DVec4(z, z, x, w)
inline val DVec4.zzyx get() = DVec4(z, z, y, x)
inline val DVec4.zzyy get() = DVec4(z, z, y, y)
inline val DVec4.zzyz get() = DVec4(z, z, y, z)
inline val DVec4.zzyw get() = DVec4(z, z, y, w)
inline val DVec4.zzzx get() = DVec4(z, z, z, x)
inline val DVec4.zzzy get() = DVec4(z, z, z, y)
inline val DVec4.zzzz get() = DVec4(z, z, z, z)
inline val DVec4.zzzw get() = DVec4(z, z, z, w)
inline val DVec4.zzwx get() = DVec4(z, z, w, x)
inline val DVec4.zzwy get() = DVec4(z, z, w, y)
inline val DVec4.zzwz get() = DVec4(z, z, w, z)
inline val DVec4.zzww get() = DVec4(z, z, w, w)
inline val DVec4.zwxx get() = DVec4(z, w, x, x)
inline val DVec4.zwxy get() = DVec4(z, w, x, y)
inline val DVec4.zwxz get() = DVec4(z, w, x, z)
inline val DVec4.zwxw get() = DVec4(z, w, x, w)
inline val DVec4.zwyx get() = DVec4(z, w, y, x)
inline val DVec4.zwyy get() = DVec4(z, w, y, y)
inline val DVec4.zwyz get() = DVec4(z, w, y, z)
inline val DVec4.zwyw get() = DVec4(z, w, y, w)
inline val DVec4.zwzx get() = DVec4(z, w, z, x)
inline val DVec4.zwzy get() = DVec4(z, w, z, y)
inline val DVec4.zwzz get() = DVec4(z, w, z, z)
inline val DVec4.zwzw get() = DVec4(z, w, z, w)
inline val DVec4.zwwx get() = DVec4(z, w, w, x)
inline val DVec4.zwwy get() = DVec4(z, w, w, y)
inline val DVec4.zwwz get() = DVec4(z, w, w, z)
inline val DVec4.zwww get() = DVec4(z, w, w, w)
inline val DVec4.wxxx get() = DVec4(w, x, x, x)
inline val DVec4.wxxy get() = DVec4(w, x, x, y)
inline val DVec4.wxxz get() = DVec4(w, x, x, z)
inline val DVec4.wxxw get() = DVec4(w, x, x, w)
inline val DVec4.wxyx get() = DVec4(w, x, y, x)
inline val DVec4.wxyy get() = DVec4(w, x, y, y)
inline val DVec4.wxyz get() = DVec4(w, x, y, z)
inline val DVec4.wxyw get() = DVec4(w, x, y, w)
inline val DVec4.wxzx get() = DVec4(w, x, z, x)
inline val DVec4.wxzy get() = DVec4(w, x, z, y)
inline val DVec4.wxzz get() = DVec4(w, x, z, z)
inline val DVec4.wxzw get() = DVec4(w, x, z, w)
inline val DVec4.wxwx get() = DVec4(w, x, w, x)
inline val DVec4.wxwy get() = DVec4(w, x, w, y)
inline val DVec4.wxwz get() = DVec4(w, x, w, z)
inline val DVec4.wxww get() = DVec4(w, x, w, w)
inline val DVec4.wyxx get() = DVec4(w, y, x, x)
inline val DVec4.wyxy get() = DVec4(w, y, x, y)
inline val DVec4.wyxz get() = DVec4(w, y, x, z)
inline val DVec4.wyxw get() = DVec4(w, y, x, w)
inline val DVec4.wyyx get() = DVec4(w, y, y, x)
inline val DVec4.wyyy get() = DVec4(w, y, y, y)
inline val DVec4.wyyz get() = DVec4(w, y, y, z)
inline val DVec4.wyyw get() = DVec4(w, y, y, w)
inline val DVec4.wyzx get() = DVec4(w, y, z, x)
inline val DVec4.wyzy get() = DVec4(w, y, z, y)
inline val DVec4.wyzz get() = DVec4(w, y, z, z)
inline val DVec4.wyzw get() = DVec4(w, y, z, w)
inline val DVec4.wywx get() = DVec4(w, y, w, x)
inline val DVec4.wywy get() = DVec4(w, y, w, y)
inline val DVec4.wywz get() = DVec4(w, y, w, z)
inline val DVec4.wyww get() = DVec4(w, y, w, w)
inline val DVec4.wzxx get() = DVec4(w, z, x, x)
inline val DVec4.wzxy get() = DVec4(w, z, x, y)
inline val DVec4.wzxz get() = DVec4(w, z, x, z)
inline val DVec4.wzxw get() = DVec4(w, z, x, w)
inline val DVec4.wzyx get() = DVec4(w, z, y, x)
inline val DVec4.wzyy get() = DVec4(w, z, y, y)
inline val DVec4.wzyz get() = DVec4(w, z, y, z)
inline val DVec4.wzyw get() = DVec4(w, z, y, w)
inline val DVec4.wzzx get() = DVec4(w, z, z, x)
inline val DVec4.wzzy get() = DVec4(w, z, z, y)
inline val DVec4.wzzz get() = DVec4(w, z, z, z)
inline val DVec4.wzzw get() = DVec4(w, z, z, w)
inline val DVec4.wzwx get() = DVec4(w, z, w, x)
inline val DVec4.wzwy get() = DVec4(w, z, w, y)
inline val DVec4.wzwz get() = DVec4(w, z, w, z)
inline val DVec4.wzww get() = DVec4(w, z, w, w)
inline val DVec4.wwxx get() = DVec4(w, w, x, x)
inline val DVec4.wwxy get() = DVec4(w, w, x, y)
inline val DVec4.wwxz get() = DVec4(w, w, x, z)
inline val DVec4.wwxw get() = DVec4(w, w, x, w)
inline val DVec4.wwyx get() = DVec4(w, w, y, x)
inline val DVec4.wwyy get() = DVec4(w, w, y, y)
inline val DVec4.wwyz get() = DVec4(w, w, y, z)
inline val DVec4.wwyw get() = DVec4(w, w, y, w)
inline val DVec4.wwzx get() = DVec4(w, w, z, x)
inline val DVec4.wwzy get() = DVec4(w, w, z, y)
inline val DVec4.wwzz get() = DVec4(w, w, z, z)
inline val DVec4.wwzw get() = DVec4(w, w, z, w)
inline val DVec4.wwwx get() = DVec4(w, w, w, x)
inline val DVec4.wwwy get() = DVec4(w, w, w, y)
inline val DVec4.wwwz get() = DVec4(w, w, w, z)
inline val DVec4.wwww get() = DVec4(w, w, w, w)
inline val DVec4.rrrr get() = DVec4(r, r, r, r)
inline val DVec4.rrrg get() = DVec4(r, r, r, g)
inline val DVec4.rrrb get() = DVec4(r, r, r, b)
inline val DVec4.rrra get() = DVec4(r, r, r, a)
inline val DVec4.rrgr get() = DVec4(r, r, g, r)
inline val DVec4.rrgg get() = DVec4(r, r, g, g)
inline val DVec4.rrgb get() = DVec4(r, r, g, b)
inline val DVec4.rrga get() = DVec4(r, r, g, a)
inline val DVec4.rrbr get() = DVec4(r, r, b, r)
inline val DVec4.rrbg get() = DVec4(r, r, b, g)
inline val DVec4.rrbb get() = DVec4(r, r, b, b)
inline val DVec4.rrba get() = DVec4(r, r, b, a)
inline val DVec4.rrar get() = DVec4(r, r, a, r)
inline val DVec4.rrag get() = DVec4(r, r, a, g)
inline val DVec4.rrab get() = DVec4(r, r, a, b)
inline val DVec4.rraa get() = DVec4(r, r, a, a)
inline val DVec4.rgrr get() = DVec4(r, g, r, r)
inline val DVec4.rgrg get() = DVec4(r, g, r, g)
inline val DVec4.rgrb get() = DVec4(r, g, r, b)
inline val DVec4.rgra get() = DVec4(r, g, r, a)
inline val DVec4.rggr get() = DVec4(r, g, g, r)
inline val DVec4.rggg get() = DVec4(r, g, g, g)
inline val DVec4.rggb get() = DVec4(r, g, g, b)
inline val DVec4.rgga get() = DVec4(r, g, g, a)
inline val DVec4.rgbr get() = DVec4(r, g, b, r)
inline val DVec4.rgbg get() = DVec4(r, g, b, g)
inline val DVec4.rgbb get() = DVec4(r, g, b, b)
inline val DVec4.rgba get() = DVec4(r, g, b, a)
inline val DVec4.rgar get() = DVec4(r, g, a, r)
inline val DVec4.rgag get() = DVec4(r, g, a, g)
inline val DVec4.rgab get() = DVec4(r, g, a, b)
inline val DVec4.rgaa get() = DVec4(r, g, a, a)
inline val DVec4.rbrr get() = DVec4(r, b, r, r)
inline val DVec4.rbrg get() = DVec4(r, b, r, g)
inline val DVec4.rbrb get() = DVec4(r, b, r, b)
inline val DVec4.rbra get() = DVec4(r, b, r, a)
inline val DVec4.rbgr get() = DVec4(r, b, g, r)
inline val DVec4.rbgg get() = DVec4(r, b, g, g)
inline val DVec4.rbgb get() = DVec4(r, b, g, b)
inline val DVec4.rbga get() = DVec4(r, b, g, a)
inline val DVec4.rbbr get() = DVec4(r, b, b, r)
inline val DVec4.rbbg get() = DVec4(r, b, b, g)
inline val DVec4.rbbb get() = DVec4(r, b, b, b)
inline val DVec4.rbba get() = DVec4(r, b, b, a)
inline val DVec4.rbar get() = DVec4(r, b, a, r)
inline val DVec4.rbag get() = DVec4(r, b, a, g)
inline val DVec4.rbab get() = DVec4(r, b, a, b)
inline val DVec4.rbaa get() = DVec4(r, b, a, a)
inline val DVec4.rarr get() = DVec4(r, a, r, r)
inline val DVec4.rarg get() = DVec4(r, a, r, g)
inline val DVec4.rarb get() = DVec4(r, a, r, b)
inline val DVec4.rara get() = DVec4(r, a, r, a)
inline val DVec4.ragr get() = DVec4(r, a, g, r)
inline val DVec4.ragg get() = DVec4(r, a, g, g)
inline val DVec4.ragb get() = DVec4(r, a, g, b)
inline val DVec4.raga get() = DVec4(r, a, g, a)
inline val DVec4.rabr get() = DVec4(r, a, b, r)
inline val DVec4.rabg get() = DVec4(r, a, b, g)
inline val DVec4.rabb get() = DVec4(r, a, b, b)
inline val DVec4.raba get() = DVec4(r, a, b, a)
inline val DVec4.raar get() = DVec4(r, a, a, r)
inline val DVec4.raag get() = DVec4(r, a, a, g)
inline val DVec4.raab get() = DVec4(r, a, a, b)
inline val DVec4.raaa get() = DVec4(r, a, a, a)
inline val DVec4.grrr get() = DVec4(g, r, r, r)
inline val DVec4.grrg get() = DVec4(g, r, r, g)
inline val DVec4.grrb get() = DVec4(g, r, r, b)
inline val DVec4.grra get() = DVec4(g, r, r, a)
inline val DVec4.grgr get() = DVec4(g, r, g, r)
inline val DVec4.grgg get() = DVec4(g, r, g, g)
inline val DVec4.grgb get() = DVec4(g, r, g, b)
inline val DVec4.grga get() = DVec4(g, r, g, a)
inline val DVec4.grbr get() = DVec4(g, r, b, r)
inline val DVec4.grbg get() = DVec4(g, r, b, g)
inline val DVec4.grbb get() = DVec4(g, r, b, b)
inline val DVec4.grba get() = DVec4(g, r, b, a)
inline val DVec4.grar get() = DVec4(g, r, a, r)
inline val DVec4.grag get() = DVec4(g, r, a, g)
inline val DVec4.grab get() = DVec4(g, r, a, b)
inline val DVec4.graa get() = DVec4(g, r, a, a)
inline val DVec4.ggrr get() = DVec4(g, g, r, r)
inline val DVec4.ggrg get() = DVec4(g, g, r, g)
inline val DVec4.ggrb get() = DVec4(g, g, r, b)
inline val DVec4.ggra get() = DVec4(g, g, r, a)
inline val DVec4.gggr get() = DVec4(g, g, g, r)
inline val DVec4.gggg get() = DVec4(g, g, g, g)
inline val DVec4.gggb get() = DVec4(g, g, g, b)
inline val DVec4.ggga get() = DVec4(g, g, g, a)
inline val DVec4.ggbr get() = DVec4(g, g, b, r)
inline val DVec4.ggbg get() = DVec4(g, g, b, g)
inline val DVec4.ggbb get() = DVec4(g, g, b, b)
inline val DVec4.ggba get() = DVec4(g, g, b, a)
inline val DVec4.ggar get() = DVec4(g, g, a, r)
inline val DVec4.ggag get() = DVec4(g, g, a, g)
inline val DVec4.ggab get() = DVec4(g, g, a, b)
inline val DVec4.ggaa get() = DVec4(g, g, a, a)
inline val DVec4.gbrr get() = DVec4(g, b, r, r)
inline val DVec4.gbrg get() = DVec4(g, b, r, g)
inline val DVec4.gbrb get() = DVec4(g, b, r, b)
inline val DVec4.gbra get() = DVec4(g, b, r, a)
inline val DVec4.gbgr get() = DVec4(g, b, g, r)
inline val DVec4.gbgg get() = DVec4(g, b, g, g)
inline val DVec4.gbgb get() = DVec4(g, b, g, b)
inline val DVec4.gbga get() = DVec4(g, b, g, a)
inline val DVec4.gbbr get() = DVec4(g, b, b, r)
inline val DVec4.gbbg get() = DVec4(g, b, b, g)
inline val DVec4.gbbb get() = DVec4(g, b, b, b)
inline val DVec4.gbba get() = DVec4(g, b, b, a)
inline val DVec4.gbar get() = DVec4(g, b, a, r)
inline val DVec4.gbag get() = DVec4(g, b, a, g)
inline val DVec4.gbab get() = DVec4(g, b, a, b)
inline val DVec4.gbaa get() = DVec4(g, b, a, a)
inline val DVec4.garr get() = DVec4(g, a, r, r)
inline val DVec4.garg get() = DVec4(g, a, r, g)
inline val DVec4.garb get() = DVec4(g, a, r, b)
inline val DVec4.gara get() = DVec4(g, a, r, a)
inline val DVec4.gagr get() = DVec4(g, a, g, r)
inline val DVec4.gagg get() = DVec4(g, a, g, g)
inline val DVec4.gagb get() = DVec4(g, a, g, b)
inline val DVec4.gaga get() = DVec4(g, a, g, a)
inline val DVec4.gabr get() = DVec4(g, a, b, r)
inline val DVec4.gabg get() = DVec4(g, a, b, g)
inline val DVec4.gabb get() = DVec4(g, a, b, b)
inline val DVec4.gaba get() = DVec4(g, a, b, a)
inline val DVec4.gaar get() = DVec4(g, a, a, r)
inline val DVec4.gaag get() = DVec4(g, a, a, g)
inline val DVec4.gaab get() = DVec4(g, a, a, b)
inline val DVec4.gaaa get() = DVec4(g, a, a, a)
inline val DVec4.brrr get() = DVec4(b, r, r, r)
inline val DVec4.brrg get() = DVec4(b, r, r, g)
inline val DVec4.brrb get() = DVec4(b, r, r, b)
inline val DVec4.brra get() = DVec4(b, r, r, a)
inline val DVec4.brgr get() = DVec4(b, r, g, r)
inline val DVec4.brgg get() = DVec4(b, r, g, g)
inline val DVec4.brgb get() = DVec4(b, r, g, b)
inline val DVec4.brga get() = DVec4(b, r, g, a)
inline val DVec4.brbr get() = DVec4(b, r, b, r)
inline val DVec4.brbg get() = DVec4(b, r, b, g)
inline val DVec4.brbb get() = DVec4(b, r, b, b)
inline val DVec4.brba get() = DVec4(b, r, b, a)
inline val DVec4.brar get() = DVec4(b, r, a, r)
inline val DVec4.brag get() = DVec4(b, r, a, g)
inline val DVec4.brab get() = DVec4(b, r, a, b)
inline val DVec4.braa get() = DVec4(b, r, a, a)
inline val DVec4.bgrr get() = DVec4(b, g, r, r)
inline val DVec4.bgrg get() = DVec4(b, g, r, g)
inline val DVec4.bgrb get() = DVec4(b, g, r, b)
inline val DVec4.bgra get() = DVec4(b, g, r, a)
inline val DVec4.bggr get() = DVec4(b, g, g, r)
inline val DVec4.bggg get() = DVec4(b, g, g, g)
inline val DVec4.bggb get() = DVec4(b, g, g, b)
inline val DVec4.bgga get() = DVec4(b, g, g, a)
inline val DVec4.bgbr get() = DVec4(b, g, b, r)
inline val DVec4.bgbg get() = DVec4(b, g, b, g)
inline val DVec4.bgbb get() = DVec4(b, g, b, b)
inline val DVec4.bgba get() = DVec4(b, g, b, a)
inline val DVec4.bgar get() = DVec4(b, g, a, r)
inline val DVec4.bgag get() = DVec4(b, g, a, g)
inline val DVec4.bgab get() = DVec4(b, g, a, b)
inline val DVec4.bgaa get() = DVec4(b, g, a, a)
inline val DVec4.bbrr get() = DVec4(b, b, r, r)
inline val DVec4.bbrg get() = DVec4(b, b, r, g)
inline val DVec4.bbrb get() = DVec4(b, b, r, b)
inline val DVec4.bbra get() = DVec4(b, b, r, a)
inline val DVec4.bbgr get() = DVec4(b, b, g, r)
inline val DVec4.bbgg get() = DVec4(b, b, g, g)
inline val DVec4.bbgb get() = DVec4(b, b, g, b)
inline val DVec4.bbga get() = DVec4(b, b, g, a)
inline val DVec4.bbbr get() = DVec4(b, b, b, r)
inline val DVec4.bbbg get() = DVec4(b, b, b, g)
inline val DVec4.bbbb get() = DVec4(b, b, b, b)
inline val DVec4.bbba get() = DVec4(b, b, b, a)
inline val DVec4.bbar get() = DVec4(b, b, a, r)
inline val DVec4.bbag get() = DVec4(b, b, a, g)
inline val DVec4.bbab get() = DVec4(b, b, a, b)
inline val DVec4.bbaa get() = DVec4(b, b, a, a)
inline val DVec4.barr get() = DVec4(b, a, r, r)
inline val DVec4.barg get() = DVec4(b, a, r, g)
inline val DVec4.barb get() = DVec4(b, a, r, b)
inline val DVec4.bara get() = DVec4(b, a, r, a)
inline val DVec4.bagr get() = DVec4(b, a, g, r)
inline val DVec4.bagg get() = DVec4(b, a, g, g)
inline val DVec4.bagb get() = DVec4(b, a, g, b)
inline val DVec4.baga get() = DVec4(b, a, g, a)
inline val DVec4.babr get() = DVec4(b, a, b, r)
inline val DVec4.babg get() = DVec4(b, a, b, g)
inline val DVec4.babb get() = DVec4(b, a, b, b)
inline val DVec4.baba get() = DVec4(b, a, b, a)
inline val DVec4.baar get() = DVec4(b, a, a, r)
inline val DVec4.baag get() = DVec4(b, a, a, g)
inline val DVec4.baab get() = DVec4(b, a, a, b)
inline val DVec4.baaa get() = DVec4(b, a, a, a)
inline val DVec4.arrr get() = DVec4(a, r, r, r)
inline val DVec4.arrg get() = DVec4(a, r, r, g)
inline val DVec4.arrb get() = DVec4(a, r, r, b)
inline val DVec4.arra get() = DVec4(a, r, r, a)
inline val DVec4.argr get() = DVec4(a, r, g, r)
inline val DVec4.argg get() = DVec4(a, r, g, g)
inline val DVec4.argb get() = DVec4(a, r, g, b)
inline val DVec4.arga get() = DVec4(a, r, g, a)
inline val DVec4.arbr get() = DVec4(a, r, b, r)
inline val DVec4.arbg get() = DVec4(a, r, b, g)
inline val DVec4.arbb get() = DVec4(a, r, b, b)
inline val DVec4.arba get() = DVec4(a, r, b, a)
inline val DVec4.arar get() = DVec4(a, r, a, r)
inline val DVec4.arag get() = DVec4(a, r, a, g)
inline val DVec4.arab get() = DVec4(a, r, a, b)
inline val DVec4.araa get() = DVec4(a, r, a, a)
inline val DVec4.agrr get() = DVec4(a, g, r, r)
inline val DVec4.agrg get() = DVec4(a, g, r, g)
inline val DVec4.agrb get() = DVec4(a, g, r, b)
inline val DVec4.agra get() = DVec4(a, g, r, a)
inline val DVec4.aggr get() = DVec4(a, g, g, r)
inline val DVec4.aggg get() = DVec4(a, g, g, g)
inline val DVec4.aggb get() = DVec4(a, g, g, b)
inline val DVec4.agga get() = DVec4(a, g, g, a)
inline val DVec4.agbr get() = DVec4(a, g, b, r)
inline val DVec4.agbg get() = DVec4(a, g, b, g)
inline val DVec4.agbb get() = DVec4(a, g, b, b)
inline val DVec4.agba get() = DVec4(a, g, b, a)
inline val DVec4.agar get() = DVec4(a, g, a, r)
inline val DVec4.agag get() = DVec4(a, g, a, g)
inline val DVec4.agab get() = DVec4(a, g, a, b)
inline val DVec4.agaa get() = DVec4(a, g, a, a)
inline val DVec4.abrr get() = DVec4(a, b, r, r)
inline val DVec4.abrg get() = DVec4(a, b, r, g)
inline val DVec4.abrb get() = DVec4(a, b, r, b)
inline val DVec4.abra get() = DVec4(a, b, r, a)
inline val DVec4.abgr get() = DVec4(a, b, g, r)
inline val DVec4.abgg get() = DVec4(a, b, g, g)
inline val DVec4.abgb get() = DVec4(a, b, g, b)
inline val DVec4.abga get() = DVec4(a, b, g, a)
inline val DVec4.abbr get() = DVec4(a, b, b, r)
inline val DVec4.abbg get() = DVec4(a, b, b, g)
inline val DVec4.abbb get() = DVec4(a, b, b, b)
inline val DVec4.abba get() = DVec4(a, b, b, a)
inline val DVec4.abar get() = DVec4(a, b, a, r)
inline val DVec4.abag get() = DVec4(a, b, a, g)
inline val DVec4.abab get() = DVec4(a, b, a, b)
inline val DVec4.abaa get() = DVec4(a, b, a, a)
inline val DVec4.aarr get() = DVec4(a, a, r, r)
inline val DVec4.aarg get() = DVec4(a, a, r, g)
inline val DVec4.aarb get() = DVec4(a, a, r, b)
inline val DVec4.aara get() = DVec4(a, a, r, a)
inline val DVec4.aagr get() = DVec4(a, a, g, r)
inline val DVec4.aagg get() = DVec4(a, a, g, g)
inline val DVec4.aagb get() = DVec4(a, a, g, b)
inline val DVec4.aaga get() = DVec4(a, a, g, a)
inline val DVec4.aabr get() = DVec4(a, a, b, r)
inline val DVec4.aabg get() = DVec4(a, a, b, g)
inline val DVec4.aabb get() = DVec4(a, a, b, b)
inline val DVec4.aaba get() = DVec4(a, a, b, a)
inline val DVec4.aaar get() = DVec4(a, a, a, r)
inline val DVec4.aaag get() = DVec4(a, a, a, g)
inline val DVec4.aaab get() = DVec4(a, a, a, b)
inline val DVec4.aaaa get() = DVec4(a, a, a, a)
inline val DVec4.ssss get() = DVec4(s, s, s, s)
inline val DVec4.ssst get() = DVec4(s, s, s, t)
inline val DVec4.sssp get() = DVec4(s, s, s, p)
inline val DVec4.sssq get() = DVec4(s, s, s, q)
inline val DVec4.ssts get() = DVec4(s, s, t, s)
inline val DVec4.sstt get() = DVec4(s, s, t, t)
inline val DVec4.sstp get() = DVec4(s, s, t, p)
inline val DVec4.sstq get() = DVec4(s, s, t, q)
inline val DVec4.ssps get() = DVec4(s, s, p, s)
inline val DVec4.sspt get() = DVec4(s, s, p, t)
inline val DVec4.sspp get() = DVec4(s, s, p, p)
inline val DVec4.sspq get() = DVec4(s, s, p, q)
inline val DVec4.ssqs get() = DVec4(s, s, q, s)
inline val DVec4.ssqt get() = DVec4(s, s, q, t)
inline val DVec4.ssqp get() = DVec4(s, s, q, p)
inline val DVec4.ssqq get() = DVec4(s, s, q, q)
inline val DVec4.stss get() = DVec4(s, t, s, s)
inline val DVec4.stst get() = DVec4(s, t, s, t)
inline val DVec4.stsp get() = DVec4(s, t, s, p)
inline val DVec4.stsq get() = DVec4(s, t, s, q)
inline val DVec4.stts get() = DVec4(s, t, t, s)
inline val DVec4.sttt get() = DVec4(s, t, t, t)
inline val DVec4.sttp get() = DVec4(s, t, t, p)
inline val DVec4.sttq get() = DVec4(s, t, t, q)
inline val DVec4.stps get() = DVec4(s, t, p, s)
inline val DVec4.stpt get() = DVec4(s, t, p, t)
inline val DVec4.stpp get() = DVec4(s, t, p, p)
inline val DVec4.stpq get() = DVec4(s, t, p, q)
inline val DVec4.stqs get() = DVec4(s, t, q, s)
inline val DVec4.stqt get() = DVec4(s, t, q, t)
inline val DVec4.stqp get() = DVec4(s, t, q, p)
inline val DVec4.stqq get() = DVec4(s, t, q, q)
inline val DVec4.spss get() = DVec4(s, p, s, s)
inline val DVec4.spst get() = DVec4(s, p, s, t)
inline val DVec4.spsp get() = DVec4(s, p, s, p)
inline val DVec4.spsq get() = DVec4(s, p, s, q)
inline val DVec4.spts get() = DVec4(s, p, t, s)
inline val DVec4.sptt get() = DVec4(s, p, t, t)
inline val DVec4.sptp get() = DVec4(s, p, t, p)
inline val DVec4.sptq get() = DVec4(s, p, t, q)
inline val DVec4.spps get() = DVec4(s, p, p, s)
inline val DVec4.sppt get() = DVec4(s, p, p, t)
inline val DVec4.sppp get() = DVec4(s, p, p, p)
inline val DVec4.sppq get() = DVec4(s, p, p, q)
inline val DVec4.spqs get() = DVec4(s, p, q, s)
inline val DVec4.spqt get() = DVec4(s, p, q, t)
inline val DVec4.spqp get() = DVec4(s, p, q, p)
inline val DVec4.spqq get() = DVec4(s, p, q, q)
inline val DVec4.sqss get() = DVec4(s, q, s, s)
inline val DVec4.sqst get() = DVec4(s, q, s, t)
inline val DVec4.sqsp get() = DVec4(s, q, s, p)
inline val DVec4.sqsq get() = DVec4(s, q, s, q)
inline val DVec4.sqts get() = DVec4(s, q, t, s)
inline val DVec4.sqtt get() = DVec4(s, q, t, t)
inline val DVec4.sqtp get() = DVec4(s, q, t, p)
inline val DVec4.sqtq get() = DVec4(s, q, t, q)
inline val DVec4.sqps get() = DVec4(s, q, p, s)
inline val DVec4.sqpt get() = DVec4(s, q, p, t)
inline val DVec4.sqpp get() = DVec4(s, q, p, p)
inline val DVec4.sqpq get() = DVec4(s, q, p, q)
inline val DVec4.sqqs get() = DVec4(s, q, q, s)
inline val DVec4.sqqt get() = DVec4(s, q, q, t)
inline val DVec4.sqqp get() = DVec4(s, q, q, p)
inline val DVec4.sqqq get() = DVec4(s, q, q, q)
inline val DVec4.tsss get() = DVec4(t, s, s, s)
inline val DVec4.tsst get() = DVec4(t, s, s, t)
inline val DVec4.tssp get() = DVec4(t, s, s, p)
inline val DVec4.tssq get() = DVec4(t, s, s, q)
inline val DVec4.tsts get() = DVec4(t, s, t, s)
inline val DVec4.tstt get() = DVec4(t, s, t, t)
inline val DVec4.tstp get() = DVec4(t, s, t, p)
inline val DVec4.tstq get() = DVec4(t, s, t, q)
inline val DVec4.tsps get() = DVec4(t, s, p, s)
inline val DVec4.tspt get() = DVec4(t, s, p, t)
inline val DVec4.tspp get() = DVec4(t, s, p, p)
inline val DVec4.tspq get() = DVec4(t, s, p, q)
inline val DVec4.tsqs get() = DVec4(t, s, q, s)
inline val DVec4.tsqt get() = DVec4(t, s, q, t)
inline val DVec4.tsqp get() = DVec4(t, s, q, p)
inline val DVec4.tsqq get() = DVec4(t, s, q, q)
inline val DVec4.ttss get() = DVec4(t, t, s, s)
inline val DVec4.ttst get() = DVec4(t, t, s, t)
inline val DVec4.ttsp get() = DVec4(t, t, s, p)
inline val DVec4.ttsq get() = DVec4(t, t, s, q)
inline val DVec4.ttts get() = DVec4(t, t, t, s)
inline val DVec4.tttt get() = DVec4(t, t, t, t)
inline val DVec4.tttp get() = DVec4(t, t, t, p)
inline val DVec4.tttq get() = DVec4(t, t, t, q)
inline val DVec4.ttps get() = DVec4(t, t, p, s)
inline val DVec4.ttpt get() = DVec4(t, t, p, t)
inline val DVec4.ttpp get() = DVec4(t, t, p, p)
inline val DVec4.ttpq get() = DVec4(t, t, p, q)
inline val DVec4.ttqs get() = DVec4(t, t, q, s)
inline val DVec4.ttqt get() = DVec4(t, t, q, t)
inline val DVec4.ttqp get() = DVec4(t, t, q, p)
inline val DVec4.ttqq get() = DVec4(t, t, q, q)
inline val DVec4.tpss get() = DVec4(t, p, s, s)
inline val DVec4.tpst get() = DVec4(t, p, s, t)
inline val DVec4.tpsp get() = DVec4(t, p, s, p)
inline val DVec4.tpsq get() = DVec4(t, p, s, q)
inline val DVec4.tpts get() = DVec4(t, p, t, s)
inline val DVec4.tptt get() = DVec4(t, p, t, t)
inline val DVec4.tptp get() = DVec4(t, p, t, p)
inline val DVec4.tptq get() = DVec4(t, p, t, q)
inline val DVec4.tpps get() = DVec4(t, p, p, s)
inline val DVec4.tppt get() = DVec4(t, p, p, t)
inline val DVec4.tppp get() = DVec4(t, p, p, p)
inline val DVec4.tppq get() = DVec4(t, p, p, q)
inline val DVec4.tpqs get() = DVec4(t, p, q, s)
inline val DVec4.tpqt get() = DVec4(t, p, q, t)
inline val DVec4.tpqp get() = DVec4(t, p, q, p)
inline val DVec4.tpqq get() = DVec4(t, p, q, q)
inline val DVec4.tqss get() = DVec4(t, q, s, s)
inline val DVec4.tqst get() = DVec4(t, q, s, t)
inline val DVec4.tqsp get() = DVec4(t, q, s, p)
inline val DVec4.tqsq get() = DVec4(t, q, s, q)
inline val DVec4.tqts get() = DVec4(t, q, t, s)
inline val DVec4.tqtt get() = DVec4(t, q, t, t)
inline val DVec4.tqtp get() = DVec4(t, q, t, p)
inline val DVec4.tqtq get() = DVec4(t, q, t, q)
inline val DVec4.tqps get() = DVec4(t, q, p, s)
inline val DVec4.tqpt get() = DVec4(t, q, p, t)
inline val DVec4.tqpp get() = DVec4(t, q, p, p)
inline val DVec4.tqpq get() = DVec4(t, q, p, q)
inline val DVec4.tqqs get() = DVec4(t, q, q, s)
inline val DVec4.tqqt get() = DVec4(t, q, q, t)
inline val DVec4.tqqp get() = DVec4(t, q, q, p)
inline val DVec4.tqqq get() = DVec4(t, q, q, q)
inline val DVec4.psss get() = DVec4(p, s, s, s)
inline val DVec4.psst get() = DVec4(p, s, s, t)
inline val DVec4.pssp get() = DVec4(p, s, s, p)
inline val DVec4.pssq get() = DVec4(p, s, s, q)
inline val DVec4.psts get() = DVec4(p, s, t, s)
inline val DVec4.pstt get() = DVec4(p, s, t, t)
inline val DVec4.pstp get() = DVec4(p, s, t, p)
inline val DVec4.pstq get() = DVec4(p, s, t, q)
inline val DVec4.psps get() = DVec4(p, s, p, s)
inline val DVec4.pspt get() = DVec4(p, s, p, t)
inline val DVec4.pspp get() = DVec4(p, s, p, p)
inline val DVec4.pspq get() = DVec4(p, s, p, q)
inline val DVec4.psqs get() = DVec4(p, s, q, s)
inline val DVec4.psqt get() = DVec4(p, s, q, t)
inline val DVec4.psqp get() = DVec4(p, s, q, p)
inline val DVec4.psqq get() = DVec4(p, s, q, q)
inline val DVec4.ptss get() = DVec4(p, t, s, s)
inline val DVec4.ptst get() = DVec4(p, t, s, t)
inline val DVec4.ptsp get() = DVec4(p, t, s, p)
inline val DVec4.ptsq get() = DVec4(p, t, s, q)
inline val DVec4.ptts get() = DVec4(p, t, t, s)
inline val DVec4.pttt get() = DVec4(p, t, t, t)
inline val DVec4.pttp get() = DVec4(p, t, t, p)
inline val DVec4.pttq get() = DVec4(p, t, t, q)
inline val DVec4.ptps get() = DVec4(p, t, p, s)
inline val DVec4.ptpt get() = DVec4(p, t, p, t)
inline val DVec4.ptpp get() = DVec4(p, t, p, p)
inline val DVec4.ptpq get() = DVec4(p, t, p, q)
inline val DVec4.ptqs get() = DVec4(p, t, q, s)
inline val DVec4.ptqt get() = DVec4(p, t, q, t)
inline val DVec4.ptqp get() = DVec4(p, t, q, p)
inline val DVec4.ptqq get() = DVec4(p, t, q, q)
inline val DVec4.ppss get() = DVec4(p, p, s, s)
inline val DVec4.ppst get() = DVec4(p, p, s, t)
inline val DVec4.ppsp get() = DVec4(p, p, s, p)
inline val DVec4.ppsq get() = DVec4(p, p, s, q)
inline val DVec4.ppts get() = DVec4(p, p, t, s)
inline val DVec4.pptt get() = DVec4(p, p, t, t)
inline val DVec4.pptp get() = DVec4(p, p, t, p)
inline val DVec4.pptq get() = DVec4(p, p, t, q)
inline val DVec4.ppps get() = DVec4(p, p, p, s)
inline val DVec4.pppt get() = DVec4(p, p, p, t)
inline val DVec4.pppp get() = DVec4(p, p, p, p)
inline val DVec4.pppq get() = DVec4(p, p, p, q)
inline val DVec4.ppqs get() = DVec4(p, p, q, s)
inline val DVec4.ppqt get() = DVec4(p, p, q, t)
inline val DVec4.ppqp get() = DVec4(p, p, q, p)
inline val DVec4.ppqq get() = DVec4(p, p, q, q)
inline val DVec4.pqss get() = DVec4(p, q, s, s)
inline val DVec4.pqst get() = DVec4(p, q, s, t)
inline val DVec4.pqsp get() = DVec4(p, q, s, p)
inline val DVec4.pqsq get() = DVec4(p, q, s, q)
inline val DVec4.pqts get() = DVec4(p, q, t, s)
inline val DVec4.pqtt get() = DVec4(p, q, t, t)
inline val DVec4.pqtp get() = DVec4(p, q, t, p)
inline val DVec4.pqtq get() = DVec4(p, q, t, q)
inline val DVec4.pqps get() = DVec4(p, q, p, s)
inline val DVec4.pqpt get() = DVec4(p, q, p, t)
inline val DVec4.pqpp get() = DVec4(p, q, p, p)
inline val DVec4.pqpq get() = DVec4(p, q, p, q)
inline val DVec4.pqqs get() = DVec4(p, q, q, s)
inline val DVec4.pqqt get() = DVec4(p, q, q, t)
inline val DVec4.pqqp get() = DVec4(p, q, q, p)
inline val DVec4.pqqq get() = DVec4(p, q, q, q)
inline val DVec4.qsss get() = DVec4(q, s, s, s)
inline val DVec4.qsst get() = DVec4(q, s, s, t)
inline val DVec4.qssp get() = DVec4(q, s, s, p)
inline val DVec4.qssq get() = DVec4(q, s, s, q)
inline val DVec4.qsts get() = DVec4(q, s, t, s)
inline val DVec4.qstt get() = DVec4(q, s, t, t)
inline val DVec4.qstp get() = DVec4(q, s, t, p)
inline val DVec4.qstq get() = DVec4(q, s, t, q)
inline val DVec4.qsps get() = DVec4(q, s, p, s)
inline val DVec4.qspt get() = DVec4(q, s, p, t)
inline val DVec4.qspp get() = DVec4(q, s, p, p)
inline val DVec4.qspq get() = DVec4(q, s, p, q)
inline val DVec4.qsqs get() = DVec4(q, s, q, s)
inline val DVec4.qsqt get() = DVec4(q, s, q, t)
inline val DVec4.qsqp get() = DVec4(q, s, q, p)
inline val DVec4.qsqq get() = DVec4(q, s, q, q)
inline val DVec4.qtss get() = DVec4(q, t, s, s)
inline val DVec4.qtst get() = DVec4(q, t, s, t)
inline val DVec4.qtsp get() = DVec4(q, t, s, p)
inline val DVec4.qtsq get() = DVec4(q, t, s, q)
inline val DVec4.qtts get() = DVec4(q, t, t, s)
inline val DVec4.qttt get() = DVec4(q, t, t, t)
inline val DVec4.qttp get() = DVec4(q, t, t, p)
inline val DVec4.qttq get() = DVec4(q, t, t, q)
inline val DVec4.qtps get() = DVec4(q, t, p, s)
inline val DVec4.qtpt get() = DVec4(q, t, p, t)
inline val DVec4.qtpp get() = DVec4(q, t, p, p)
inline val DVec4.qtpq get() = DVec4(q, t, p, q)
inline val DVec4.qtqs get() = DVec4(q, t, q, s)
inline val DVec4.qtqt get() = DVec4(q, t, q, t)
inline val DVec4.qtqp get() = DVec4(q, t, q, p)
inline val DVec4.qtqq get() = DVec4(q, t, q, q)
inline val DVec4.qpss get() = DVec4(q, p, s, s)
inline val DVec4.qpst get() = DVec4(q, p, s, t)
inline val DVec4.qpsp get() = DVec4(q, p, s, p)
inline val DVec4.qpsq get() = DVec4(q, p, s, q)
inline val DVec4.qpts get() = DVec4(q, p, t, s)
inline val DVec4.qptt get() = DVec4(q, p, t, t)
inline val DVec4.qptp get() = DVec4(q, p, t, p)
inline val DVec4.qptq get() = DVec4(q, p, t, q)
inline val DVec4.qpps get() = DVec4(q, p, p, s)
inline val DVec4.qppt get() = DVec4(q, p, p, t)
inline val DVec4.qppp get() = DVec4(q, p, p, p)
inline val DVec4.qppq get() = DVec4(q, p, p, q)
inline val DVec4.qpqs get() = DVec4(q, p, q, s)
inline val DVec4.qpqt get() = DVec4(q, p, q, t)
inline val DVec4.qpqp get() = DVec4(q, p, q, p)
inline val DVec4.qpqq get() = DVec4(q, p, q, q)
inline val DVec4.qqss get() = DVec4(q, q, s, s)
inline val DVec4.qqst get() = DVec4(q, q, s, t)
inline val DVec4.qqsp get() = DVec4(q, q, s, p)
inline val DVec4.qqsq get() = DVec4(q, q, s, q)
inline val DVec4.qqts get() = DVec4(q, q, t, s)
inline val DVec4.qqtt get() = DVec4(q, q, t, t)
inline val DVec4.qqtp get() = DVec4(q, q, t, p)
inline val DVec4.qqtq get() = DVec4(q, q, t, q)
inline val DVec4.qqps get() = DVec4(q, q, p, s)
inline val DVec4.qqpt get() = DVec4(q, q, p, t)
inline val DVec4.qqpp get() = DVec4(q, q, p, p)
inline val DVec4.qqpq get() = DVec4(q, q, p, q)
inline val DVec4.qqqs get() = DVec4(q, q, q, s)
inline val DVec4.qqqt get() = DVec4(q, q, q, t)
inline val DVec4.qqqp get() = DVec4(q, q, q, p)
inline val DVec4.qqqq get() = DVec4(q, q, q, q)
//endregion
| 0
|
Kotlin
|
0
| 0
|
b6ec9a5a5794f1b3f36af9d29138221e191c8f44
| 79,664
|
klam
|
MIT License
|
game/src/main/kotlin/gg/rsmod/game/plugin/impl/StandardPlugin.kt
|
OldschoolPKTeam
| 358,415,643
| false
| null |
package gg.rsmod.game.plugin.impl
import gg.rsmod.game.Server
import gg.rsmod.game.model.World
import gg.rsmod.game.plugin.KotlinPlugin
import gg.rsmod.game.plugin.KotlinPluginConfiguration
import gg.rsmod.game.plugin.PluginRepository
import kotlin.script.experimental.annotations.KotlinScript
/**
* Represents a KotlinScript plugin.
*
* @author Tom <<EMAIL>>
*/
@KotlinScript(
displayName = "Kotlin Plugin",
fileExtension = "eco.kts",
compilationConfiguration = KotlinPluginConfiguration::class
)
abstract class EcoPlugin(r: PluginRepository, world: World, server: Server) : KotlinPlugin(r, world, server)
| 0
|
Kotlin
|
0
| 0
|
761929bf559098cbc87008486fcf07032cbcd548
| 636
|
OldschoolPK
|
Apache License 2.0
|
app/src/main/java/com/dreamsoftware/tvnexa/ui/di/UiModule.kt
|
sergio11
| 328,373,511
| false
|
{"Kotlin": 586066}
|
package com.dreamsoftware.tvnexa.ui.di
import android.content.Context
import com.dreamsoftware.tvnexa.ui.core.FormErrorMapperImpl
import com.dreamsoftware.tvnexa.ui.features.signin.error.SignInScreenSimpleErrorMapper
import com.dreamsoftware.tvnexa.ui.core.IFormErrorMapper
import com.dreamsoftware.tvnexa.ui.features.profiles.save.error.SaveProfileScreenSimpleErrorMapper
import com.dreamsoftware.tvnexa.ui.features.signup.error.SignUpScreenSimpleErrorMapper
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.android.components.ViewModelComponent
import dagger.hilt.android.qualifiers.ApplicationContext
import dagger.hilt.android.scopes.ViewModelScoped
@Module
@InstallIn(ViewModelComponent::class)
class UiModule {
@Provides
@ViewModelScoped
fun provideSignInScreenErrorMapper(@ApplicationContext context: Context) = SignInScreenSimpleErrorMapper(context)
@Provides
@ViewModelScoped
fun provideSignUpScreenErrorMapper(@ApplicationContext context: Context) = SignUpScreenSimpleErrorMapper(context)
@Provides
@ViewModelScoped
fun provideSaveProfileScreenSimpleErrorMapper(@ApplicationContext context: Context) = SaveProfileScreenSimpleErrorMapper(context)
@Provides
@ViewModelScoped
fun provideFormErrorMapper(@ApplicationContext context: Context): IFormErrorMapper = FormErrorMapperImpl(context)
}
| 0
|
Kotlin
|
0
| 1
|
30fb84765276b1afcadc27b0ce8ffc15155decc4
| 1,395
|
tvnexa_androidtv
|
Apache License 2.0
|
Gachi/app/src/main/kotlin/com/pickth/gachi/view/main/MainActivity.kt
|
yh-kim
| 96,616,577
| false
| null |
package com.pickth.gachi.view.main
import android.content.Context
import android.os.Bundle
import android.os.Handler
import android.support.design.widget.BottomNavigationView
import android.support.v4.view.ViewPager
import android.view.Menu
import android.view.MenuItem
import com.pickth.commons.extensions.hideKeyboard
import com.pickth.gachi.R
import com.pickth.gachi.adapter.pager.MainPagerAdapter
import com.pickth.gachi.base.BaseActivity
import com.pickth.gachi.view.custom.MyBottomNavigationView
import kotlinx.android.synthetic.main.activity_main.*
/**
* Created by yonghoon on 2017-07-09.
* Mail : <EMAIL>
*/
class MainActivity : BaseActivity(), MainContract.View, ViewPager.OnPageChangeListener {
private lateinit var mMainPresenter: MainPresenter
private var mMainPagerAdapter: MainPagerAdapter? = null
private var mViewPager: ViewPager? = null
private lateinit var mNavigation: MyBottomNavigationView
private lateinit var mMenuItem: MenuItem
private lateinit var prevBottomNavigation: MenuItem
private var isUser = false
private val mOnNavigationItemSelectedListener = BottomNavigationView.OnNavigationItemSelectedListener { item ->
when (item.itemId) {
R.id.navigation_festival -> {
if(mViewPager?.currentItem == 0) {
mMainPagerAdapter?.getItem(0)?.clickAgain()
} else {
mViewPager?.currentItem = 0
}
return@OnNavigationItemSelectedListener true
}
R.id.navigation_chat -> {
if(mViewPager?.currentItem == 1) {
mMainPagerAdapter?.getItem(1)?.clickAgain()
} else {
mViewPager?.currentItem = 1
}
return@OnNavigationItemSelectedListener true
}
R.id.navigation_alarm -> {
if(mViewPager?.currentItem == 2) {
mMainPagerAdapter?.getItem(2)?.clickAgain()
} else {
mViewPager?.currentItem = 2
}
return@OnNavigationItemSelectedListener true
}
R.id.navigation_myinfo -> {
mViewPager!!.currentItem = 3
return@OnNavigationItemSelectedListener true
}
}
false
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
// actionbar
setSupportActionBar(main_toolbar)
supportActionBar?.setHomeAsUpIndicator(R.drawable.ic_back)
supportActionBar?.setDisplayShowTitleEnabled(true)
supportActionBar?.setDisplayHomeAsUpEnabled(false)
title = "GACHI"
// presenter
mMainPresenter = MainPresenter()
mMainPresenter.attachView(this)
isUser = mMainPresenter.getUser() != null
// navigation
mNavigation = navigation
mNavigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener)
mMainPagerAdapter = MainPagerAdapter(supportFragmentManager).apply {
setListItem(0)
setListItem(1)
setListItem(2)
setListItem(3)
notifyDataSetChanged()
}
mViewPager = view_pager.apply {
adapter = mMainPagerAdapter
currentItem = 0
offscreenPageLimit = 4
addOnPageChangeListener(this@MainActivity)
}
prevBottomNavigation = mNavigation.menu.getItem(0)
}
override fun getContext(): Context = applicationContext
override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {
}
override fun onPageScrollStateChanged(state: Int) {
}
override fun changeFestivalAndSearch() {
mMainPagerAdapter?.changeBetweenFragment()
isSearch().let {
// mMenuItem.isVisible = !it
supportActionBar?.setDisplayShowTitleEnabled(!it)
supportActionBar?.setDisplayHomeAsUpEnabled(it)
}
}
override fun isSearch(): Boolean = mMainPagerAdapter!!.isSwitch
override fun onPageSelected(position: Int) {
prevBottomNavigation.isChecked = false
prevBottomNavigation = mNavigation.menu.getItem(position)
prevBottomNavigation.isChecked = true
mMenuItem.isVisible = (position == 3 && isUser)
supportActionBar?.setDisplayShowTitleEnabled(!(position == 0 && isSearch()))
supportActionBar?.setDisplayHomeAsUpEnabled(position == 0 && isSearch())
}
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
menuInflater.inflate(R.menu.menu, menu)
mMenuItem = menu?.findItem(R.id.menu_modify)!!
mMenuItem.isVisible = false
return super.onCreateOptionsMenu(menu)
}
override fun onOptionsItemSelected(item: MenuItem?): Boolean {
when(item?.itemId) {
R.id.menu_modify -> {
}
android.R.id.home -> {
hideKeyboard()
Handler().postDelayed({changeFestivalAndSearch()}, 100)
}
}
return super.onOptionsItemSelected(item)
}
override fun onBackPressed() {
if(mViewPager?.currentItem == 0 && mMainPagerAdapter!!.isSwitch) {
changeFestivalAndSearch()
} else {
super.onBackPressed()
}
}
}
| 0
|
Kotlin
|
0
| 0
|
98db967d30780656041527c982ead5ecaa80971c
| 5,471
|
gachi-android
|
Apache License 2.0
|
feature/utilcode/pkg/src/main/java/com/blankj/utilcode/pkg/feature/keyboard/KeyboardActivity.kt
|
Blankj
| 64,558,143
| false
| null |
package com.blankj.utilcode.pkg.feature.keyboard
import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.view.View
import com.blankj.common.activity.CommonActivity
import com.blankj.common.item.CommonItem
import com.blankj.common.item.CommonItemClick
import com.blankj.common.item.CommonItemTitle
import com.blankj.utilcode.pkg.R
import com.blankj.utilcode.pkg.helper.DialogHelper
import com.blankj.utilcode.util.CollectionUtils
import com.blankj.utilcode.util.KeyboardUtils
import kotlinx.android.synthetic.main.keyboard_activity.*
/**
* ```
* author: Blankj
* blog : http://blankj.com
* time : 2016/09/27
* desc : demo about KeyboardUtils
* ```
*/
class KeyboardActivity : CommonActivity() {
companion object {
fun start(context: Context) {
val starter = Intent(context, KeyboardActivity::class.java)
context.startActivity(starter)
}
}
private var titleItem: CommonItemTitle = CommonItemTitle("", true)
override fun bindTitleRes(): Int {
return R.string.demo_keyboard
}
override fun bindLayout(): Int {
return R.layout.keyboard_activity
}
override fun initView(savedInstanceState: Bundle?, contentView: View?) {
super.initView(savedInstanceState, contentView)
KeyboardUtils.fixAndroidBug5497(this)
setCommonItems(findViewById(R.id.commonItemRv), getItems())
KeyboardUtils.registerSoftInputChangedListener(this) { height ->
titleItem.title = "isSoftInputVisible: " + KeyboardUtils.isSoftInputVisible(this@KeyboardActivity) + "\nkeyboardHeight: $height"
if (height > 0) {
keyboardEt.requestFocus()
}
}
}
private fun getItems(): MutableList<CommonItem<*>> {
return CollectionUtils.newArrayList(
titleItem,
CommonItemClick(R.string.keyboard_hide_soft_input) {
KeyboardUtils.hideSoftInput(this)
},
CommonItemClick(R.string.keyboard_show_soft_input) {
KeyboardUtils.showSoftInput(this)
},
CommonItemClick(R.string.keyboard_toggle_soft_input) {
KeyboardUtils.toggleSoftInput()
},
CommonItemClick(R.string.keyboard_show_dialog) {
keyboardEt.clearFocus()
DialogHelper.showKeyboardDialog()
}
)
}
}
| 308
| null |
3
| 33,181
|
7b4caf9e5440046b3fefb63b6b6e2ead7ebaf809
| 2,505
|
AndroidUtilCode
|
Apache License 2.0
|
detail/src/main/java/com/rviannaoliveira/detail/presentation/DetailActivity.kt
|
rviannaoliveira
| 296,884,981
| false
| null |
package com.rviannaoliveira.detail.presentation
import android.content.Context
import android.content.Intent
import android.net.Uri
import android.os.Bundle
import android.view.MenuItem
import androidx.databinding.DataBindingUtil
import com.google.android.material.tabs.TabLayoutMediator
import com.rviannaoliveira.base.BaseActivity
import com.rviannaoliveira.detail.R
import com.rviannaoliveira.detail.databinding.ActivityDetailBinding
import com.rviannaoliveira.shared.SafeObserver
class DetailActivity : BaseActivity() {
private val vm by appViewModel<DetailViewModel>()
private lateinit var binding: ActivityDetailBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = DataBindingUtil.setContentView(this, R.layout.activity_detail)
binding.lifecycleOwner = this
binding.vm = vm
binding.toolbar.title = getString(R.string.app_name)
setSupportActionBar(binding.toolbar)
supportActionBar?.setDisplayHomeAsUpEnabled(true)
supportActionBar?.setDisplayShowHomeEnabled(true)
setupObservers()
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
android.R.id.home -> {
onBackPressed()
}
}
return true
}
private fun setupObservers() {
vm.urlsLiveData.observe(this, SafeObserver {
binding.pager.adapter = ImageAdapter(this, it)
TabLayoutMediator(binding.tabLayout, binding.pager) { _, _ ->
}.attach()
})
vm.openMapsLiveData.observe(this, SafeObserver {
val gmmIntentUri = Uri.parse("geo:${it.lat},${it.lon}")
val mapIntent = Intent(Intent.ACTION_VIEW, gmmIntentUri)
mapIntent.setPackage("com.google.android.apps.maps")
startActivity(mapIntent)
})
}
companion object {
internal const val ID = "ID"
fun newInstance(context: Context, id: String): Intent =
Intent(context, DetailActivity::class.java).apply {
putExtra(ID, id)
}
}
}
| 0
|
Kotlin
|
0
| 1
|
97f5a2f0d166dd09893a03921d317baa57b81428
| 2,161
|
PlayGroundMVVM
|
Apache License 2.0
|
shared/src/commonMain/kotlin/io.github.krisbitney.yuli/state/follows/store/YuliFollowsStoreProvider.kt
|
krisbitney
| 652,384,671
| false
|
{"Kotlin": 107231, "Swift": 708, "Shell": 228}
|
package io.github.krisbitney.yuli.state.follows.store
import com.arkivanov.mvikotlin.core.store.Reducer
import com.arkivanov.mvikotlin.core.store.SimpleBootstrapper
import com.arkivanov.mvikotlin.core.store.Store
import com.arkivanov.mvikotlin.core.store.StoreFactory
import com.arkivanov.mvikotlin.extensions.coroutines.CoroutineExecutor
import io.github.krisbitney.yuli.models.FollowType
import io.github.krisbitney.yuli.models.Profile
import io.github.krisbitney.yuli.state.follows.store.YuliFollowsStore.Intent
import io.github.krisbitney.yuli.state.follows.store.YuliFollowsStore.State
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.IO
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
internal class YuliFollowsStoreProvider(
private val storeFactory: StoreFactory,
private val database: Database,
private val type: FollowType
) {
fun provide(): YuliFollowsStore =
object : YuliFollowsStore, Store<Intent, State, Nothing> by storeFactory.create(
name = "YuliFollowsStore",
initialState = State(),
bootstrapper = SimpleBootstrapper(Unit),
executorFactory = ::ExecutorImpl,
reducer = ReducerImpl
) {}
private sealed class Msg {
data class SetFollows(
val profiles: List<Profile>,
val sortedBy: Profile.SortBy
) : Msg()
}
private inner class ExecutorImpl : CoroutineExecutor<Intent, Unit, State, Msg, Nothing>() {
override fun executeAction(action: Unit, getState: () -> State) {
scope.launch {
// TODO: observe follows?
val follows = withContext(Dispatchers.IO) { database.selectProfiles(type) }
val state = getState()
val sorted = follows.sortedBy {
when (state.sortedBy) {
Profile.SortBy.USERNAME -> it.username
Profile.SortBy.NAME -> it.name
}
}
dispatch(Msg.SetFollows(sorted, state.sortedBy))
}
}
override fun executeIntent(intent: Intent, getState: () -> State): Unit =
when (intent) {
is Intent.Sort -> {
val sorted = getState().follows.sortedBy {
when (intent.sortBy) {
Profile.SortBy.USERNAME -> it.username
Profile.SortBy.NAME -> it.name
}
}
dispatch(Msg.SetFollows(sorted, intent.sortBy))
}
}
}
private object ReducerImpl : Reducer<State, Msg> {
override fun State.reduce(msg: Msg): State =
when (msg) {
is Msg.SetFollows -> copy(follows = msg.profiles, sortedBy = msg.sortedBy)
}
}
interface Database {
fun selectProfiles(type: FollowType): List<Profile>
}
}
| 0
|
Kotlin
|
0
| 0
|
d15c33721fffa5f251a61f07bab0ddf6ff1f8334
| 2,993
|
yuli
|
Apache License 2.0
|
app/src/main/java/com/example/ecommerce/repository/FavoriteListRepository.kt
|
DucHienIT
| 637,472,006
| false
| null |
package com.example.ecommerce.repository
import com.example.ecommerce.model.FavoriteList
import io.reactivex.rxjava3.core.Single
interface FavoriteListRepository {
fun listFavorite(access_token:String):Single<List<FavoriteList>>
}
| 0
|
Kotlin
|
0
| 0
|
75bbd3bfa59da57b4f7b3a6658c53feb997b8b9c
| 236
|
Project-Ecommerce-With-Kotlin---SHOP-CODE
|
MIT License
|
app/src/main/java/com/example/educai/data/viewmodel/UserViewModel.kt
|
educ-ai-org
| 847,523,094
| false
|
{"Kotlin": 178135}
|
package com.example.educai.data.viewmodel
import android.util.Log
import androidx.compose.runtime.mutableStateOf
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.example.educai.data.model.Classroom
import com.example.educai.data.model.ErrorResponse
import com.example.educai.data.model.Participant
import com.example.educai.data.network.RetrofitInstance
import com.example.educai.utils.getErrorMessageFromJson
import kotlinx.coroutines.launch
import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response
class UserViewModel : ViewModel() {
var classrooms = mutableStateOf<List<Classroom>>(emptyList())
private set
var participants = mutableStateOf<List<Participant>>(emptyList())
private set
val userPictureUrl: MutableLiveData<String?> = MutableLiveData()
val errorMessage = MutableLiveData<ErrorResponse>()
val isLoading = MutableLiveData<Boolean>()
fun getUserClassrooms() {
isLoading.value = true
val call = RetrofitInstance.userService.getUserClassrooms()
call.enqueue(object : Callback<List<Classroom>> {
override fun onResponse(call: Call<List<Classroom>>, response: Response<List<Classroom>>) {
if (response.isSuccessful) {
classrooms.value = response.body() ?: emptyList()
} else {
errorMessage.postValue(response.errorBody()?.string()?.getErrorMessageFromJson())
}
isLoading.value = false
}
override fun onFailure(call: Call<List<Classroom>>, t: Throwable) {
errorMessage.postValue(t.message.toString().getErrorMessageFromJson())
isLoading.value = false
}
})
}
fun getParticipantsByClassId ( classroomId: String ) {
isLoading.value = true
val call = RetrofitInstance.userService.getParticipantsByClassId(classroomId)
call.enqueue(object : Callback<List<Participant>> {
override fun onResponse(call: Call<List<Participant>>, response: Response<List<Participant>>) {
if (response.isSuccessful) {
participants.value = response.body() ?: emptyList()
} else {
errorMessage.postValue(response.errorBody()?.string()?.getErrorMessageFromJson())
}
isLoading.value = false
}
override fun onFailure(call: Call<List<Participant>>, t: Throwable) {
errorMessage.postValue(t.message.toString().getErrorMessageFromJson())
isLoading.value = false
}
})
}
fun getUserPictureUrl() {
viewModelScope.launch {
try {
val response = RetrofitInstance.userServiceScalars.getUserPictureUrl()
if (response.isSuccessful) {
userPictureUrl.value = response.body()
} else {
userPictureUrl.value = null
}
} catch (e: Exception) {
Log.e("UserViewModel", e.toString())
userPictureUrl.value = null
}
}
}
}
| 0
|
Kotlin
|
0
| 0
|
08800e079c41435be5907c6c84c67db03884ef9f
| 3,267
|
educai-app
|
MIT License
|
shared/src/androidMain/kotlin/core/Resource.kt
|
prashant17d97
| 707,855,780
| false
|
{"Kotlin": 110043, "Swift": 592, "Shell": 228}
|
package core
import androidx.compose.runtime.Composable
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.text.font.Font
import androidx.compose.ui.text.font.FontStyle
import androidx.compose.ui.text.font.FontWeight
/*
@Composable
actual fun GetFont(
id: FontResource,
fontWeight: FontWeight,
fontStyle: FontStyle
): Font? {
Font
return Font(resId = id.fontResourceId, weight = fontWeight, style = fontStyle)
}
actual class String(private val context: Context) {
actual fun get(id: StringResource, args: List<Any>): kotlin.String {
return if (args.isEmpty()) {
StringDesc.Resource(id).toString(context = context)
} else {
id.format(*args.toTypedArray()).toString(context = context)
}
}
}*/
/*
actual class Drawable(private val context: Context) {
actual fun getDrawable(id: ImageResource): Drawable? {
return id.getDrawable(context = context)
}
}*/
@Composable
actual fun font(name: String, res: String, weight: FontWeight, style: FontStyle): Font {
val context = LocalContext.current
val id = context.resources.getIdentifier(res, "resources/font", context.packageName)
return Font(id, weight, style)
}
| 0
|
Kotlin
|
0
| 0
|
d3e74dd07f63c34eae0141f57b20236283a9587f
| 1,240
|
Blog
|
Apache License 2.0
|
src/test/kotlin/no/nav/syfo/testutil/mock/AktorregisterMock.kt
|
navikt
| 206,008,107
| false
| null |
package no.nav.syfo.testutil.mock
import com.fasterxml.jackson.databind.SerializationFeature
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule
import com.fasterxml.jackson.module.kotlin.registerKotlinModule
import io.ktor.serialization.jackson.*
import io.ktor.server.application.*
import io.ktor.server.application.*
import io.ktor.server.routing.*
import io.ktor.server.engine.*
import io.ktor.server.netty.*
import io.ktor.server.plugins.contentnegotiation.*
import io.ktor.server.response.*
import no.nav.syfo.client.aktor.IdentType
import no.nav.syfo.domain.AktorId
import no.nav.syfo.testutil.UserConstants.ARBEIDSTAKER_2_AKTORID
import no.nav.syfo.testutil.UserConstants.ARBEIDSTAKER_2_FNR
import no.nav.syfo.testutil.UserConstants.ARBEIDSTAKER_AKTORID
import no.nav.syfo.testutil.UserConstants.ARBEIDSTAKER_FNR
import no.nav.syfo.testutil.getRandomPort
import no.nav.syfo.util.NAV_PERSONIDENTER
class AktorregisterMock {
private val port = getRandomPort()
val url = "http://localhost:$port"
val server = mockAktorregisterServer(port)
val aktorIdMissingFnr = AktorId(ARBEIDSTAKER_AKTORID.aktor.replace("0", "9"))
private fun mockAktorregisterServer(
port: Int
): NettyApplicationEngine {
return embeddedServer(
factory = Netty,
port = port
) {
install(ContentNegotiation) {
jackson {
registerKotlinModule()
registerModule(JavaTimeModule())
configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false)
}
}
routing {
get("/identer") {
when (call.request.headers[NAV_PERSONIDENTER]) {
ARBEIDSTAKER_FNR.value -> {
call.respond(
mapOf(
ARBEIDSTAKER_FNR.value to RSAktor(
listOf(
RSIdent(
ident = ARBEIDSTAKER_FNR.value,
identgruppe = IdentType.NorskIdent.name,
gjeldende = true
),
RSIdent(
ident = ARBEIDSTAKER_AKTORID.aktor,
identgruppe = IdentType.AktoerId.name,
gjeldende = true
)
),
feilmelding = null
)
)
)
}
ARBEIDSTAKER_AKTORID.aktor -> {
call.respond(
mapOf(
ARBEIDSTAKER_AKTORID.aktor to RSAktor(
listOf(
RSIdent(
ident = ARBEIDSTAKER_FNR.value,
identgruppe = IdentType.NorskIdent.name,
gjeldende = true
),
RSIdent(
ident = ARBEIDSTAKER_AKTORID.aktor,
identgruppe = IdentType.AktoerId.name,
gjeldende = true
)
),
feilmelding = null
)
)
)
}
ARBEIDSTAKER_2_AKTORID.aktor -> {
call.respond(
mapOf(
ARBEIDSTAKER_2_AKTORID.aktor to RSAktor(
listOf(
RSIdent(
ident = ARBEIDSTAKER_2_FNR.value,
identgruppe = IdentType.NorskIdent.name,
gjeldende = true
),
RSIdent(
ident = ARBEIDSTAKER_2_AKTORID.aktor,
identgruppe = IdentType.AktoerId.name,
gjeldende = true
)
),
feilmelding = null
)
)
)
}
aktorIdMissingFnr.aktor -> {
call.respond(
mapOf(
aktorIdMissingFnr.aktor to RSAktor(
identer = null,
feilmelding = "Not found"
)
)
)
}
else -> error("Something went wrong")
}
}
}
}
}
}
data class RSIdent(
val ident: String,
val identgruppe: String,
val gjeldende: Boolean
)
data class RSAktor(
val identer: List<RSIdent>? = null,
val feilmelding: String? = null
)
| 0
|
Kotlin
|
0
| 0
|
b103750661526e06e2a6a531ef63e1004f137e06
| 6,011
|
syfooversikthendelsetilfelle
|
MIT License
|
app/src/main/java/com/redridgeapps/remoteforqbittorrent/ui/MainActivity.kt
|
SaurabhSandav
| 123,869,187
| false
| null |
package com.redridgeapps.remoteforqbittorrent.ui
import android.os.Bundle
import android.view.MenuItem
import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.GravityCompat
import androidx.databinding.DataBindingUtil
import androidx.drawerlayout.widget.DrawerLayout
import androidx.fragment.app.FragmentFactory
import androidx.navigation.NavController
import androidx.navigation.findNavController
import androidx.navigation.ui.AppBarConfiguration
import androidx.navigation.ui.navigateUp
import androidx.navigation.ui.onNavDestinationSelected
import androidx.navigation.ui.setupActionBarWithNavController
import com.google.android.material.navigation.NavigationView
import com.redridgeapps.remoteforqbittorrent.R
import com.redridgeapps.remoteforqbittorrent.api.QBittorrentService.Filter
import com.redridgeapps.remoteforqbittorrent.databinding.ActivityMainBinding
import dagger.android.AndroidInjection
import javax.inject.Inject
class MainActivity : AppCompatActivity(),
NavigationView.OnNavigationItemSelectedListener {
@Inject
lateinit var fragmentFactory: FragmentFactory
private lateinit var binding: ActivityMainBinding
private lateinit var navController: NavController
private lateinit var appBarConfiguration: AppBarConfiguration
private val viewModel by viewModels<MainViewModel>()
override fun onCreate(savedInstanceState: Bundle?) {
AndroidInjection.inject(this)
supportFragmentManager.fragmentFactory = fragmentFactory
super.onCreate(savedInstanceState)
binding = DataBindingUtil.setContentView(this@MainActivity, R.layout.activity_main)
setSupportActionBar(binding.toolbar)
setupNavigation()
binding.navView.setNavigationItemSelectedListener(this@MainActivity)
}
override fun onBackPressed() {
if (binding.drawerLayout.isDrawerOpen(GravityCompat.START)) {
binding.drawerLayout.closeDrawer(GravityCompat.START)
} else super.onBackPressed()
}
override fun onSupportNavigateUp() = navController.navigateUp(appBarConfiguration)
override fun onNavigationItemSelected(item: MenuItem): Boolean {
binding.drawerLayout.closeDrawer(GravityCompat.START)
val filter: String = when (item.itemId) {
R.id.item_filter_all -> Filter.ALL
R.id.item_filter_downloading -> Filter.DOWNLOADING
R.id.item_filter_completed -> Filter.COMPLETED
R.id.item_filter_paused -> Filter.PAUSED
R.id.item_filter_active -> Filter.ACTIVE
R.id.item_filter_inactive -> Filter.INACTIVE
else -> return item.onNavDestinationSelected(navController)
}
viewModel.setFilter(filter)
return true
}
private fun setupNavigation() {
navController = findNavController(R.id.nav_host_fragment)
// Declare Top level destinations
appBarConfiguration = AppBarConfiguration(
setOf(R.id.torrentListFragment, R.id.configFragment),
binding.drawerLayout
)
// Disable Up button for Top level destinations
setupActionBarWithNavController(navController, appBarConfiguration)
// Lock Drawer outside TorrentList screen
navController.addOnDestinationChangedListener { _, destination, _ ->
val lockMode =
if (destination.id == R.id.torrentListFragment) DrawerLayout.LOCK_MODE_UNLOCKED
else DrawerLayout.LOCK_MODE_LOCKED_CLOSED
binding.drawerLayout.setDrawerLockMode(lockMode)
}
}
}
| 0
|
Kotlin
|
0
| 1
|
1d3d81dfd9add116333e5892de1c7dda96a58dcb
| 3,643
|
qBittorrentRemote
|
MIT License
|
app/src/main/java/com/example/heartrate_monitor/ui/DeviceConnectionViewModel.kt
|
jaakaappi
| 624,999,492
| false
| null |
package com.example.heartrate_monitor.ui
import androidx.lifecycle.LiveData
import androidx.lifecycle.ViewModel
import com.example.heartrate_monitor.ble.BluetoothHandler
import com.welie.blessed.BluetoothPeripheral
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.emptyFlow
import javax.inject.Inject
@HiltViewModel
class DeviceConnectionViewModel @Inject constructor(private val bluetoothHandler: BluetoothHandler) :
ViewModel() {
val scannedDevices: LiveData<Set<BluetoothPeripheral>> = bluetoothHandler.scannedDevices
val connectedDevice: LiveData<BluetoothPeripheral?> = bluetoothHandler.connectedDevice
val scanning: LiveData<Boolean> = bluetoothHandler.scanning
val connected: LiveData<Boolean> = bluetoothHandler.connected
val latestHeartrateReading: LiveData<Int> = bluetoothHandler.latestHeartRateReading
fun startScanning() = bluetoothHandler.startScanning()
fun connectBondAndListen(peripheral: BluetoothPeripheral) =
bluetoothHandler.connectBondAndListen(peripheral)
}
| 0
|
Kotlin
|
0
| 0
|
0e8a1b018a41943cc0c61899ebe78b735c0ec44e
| 1,092
|
heartrate-app
|
MIT License
|
app/src/main/java/com/mezhendosina/sgo/data/requests/sgo/diary/entities/DiaryInitResponseEntity.kt
|
mezhendosina
| 448,087,094
| false
| null |
/*
* Copyright 2023 <NAME>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.mezhendosina.sgo.data.requests.sgo.diary.entities
import com.google.gson.annotations.SerializedName
data class DiaryInitResponseEntity(
@SerializedName("currentStudentId")
val currentStudentId: Int,
@SerializedName("externalUrl")
val externalUrl: String,
@SerializedName("maxMark")
val maxMark: Int,
@SerializedName("newDiskToken")
val newDiskToken: String,
@SerializedName("newDiskWasRequest")
val newDiskWasRequest: Boolean,
@SerializedName("students")
val students: List<Student>,
@SerializedName("ttsuRl")
val ttsuRl: String,
@SerializedName("weekStart")
val weekStart: String,
@SerializedName("weight")
val weight: Boolean,
@SerializedName("withLaAssigns")
val withLaAssigns: Boolean,
@SerializedName("yaClass")
val yaClass: Boolean,
@SerializedName("yaClassAuthUrl")
val yaClassAuthUrl: Any
)
data class Student(
@SerializedName("classId")
val classId: Int,
@SerializedName("className")
val className: Any,
@SerializedName("iupGrade")
val iupGrade: Int,
@SerializedName("nickName")
val nickName: String,
@SerializedName("studentId")
val studentId: Int
)
| 0
| null |
0
| 9
|
95b1f6ea6f7ccdeaf86f81e423c62a310230f77e
| 1,802
|
sgo-app
|
Apache License 2.0
|
filepicker/src/main/java/me/rosuh/filepicker/adapter/RecyclerViewListener.kt
|
Xiaohy61
| 251,479,748
| false
|
{"Gradle": 4, "Markdown": 2, "YAML": 1, "Java Properties": 2, "Shell": 1, "Text": 1, "Ignore List": 3, "Batchfile": 1, "Proguard": 2, "Java": 9, "XML": 60, "Kotlin": 34}
|
package me.rosuh.filepicker.adapter
import android.app.Activity
import android.view.GestureDetector
import android.view.MotionEvent
import android.view.View
import androidx.core.view.GestureDetectorCompat
import me.rosuh.filepicker.R
import me.rosuh.filepicker.utils.ScreenUtils
/**
*
* @author rosu
* @date 2018/11/29
* 列表点击监听器,监听列表的点击并分辨出为单击、长按和子项被点击
* OnItemTouchListener 无法轻易实现对子控件点击事件的监听
*
*/
class RecyclerViewListener(val activity: Activity, val recyclerView: androidx.recyclerview.widget.RecyclerView, val itemClickListener: OnItemClickListener) :
androidx.recyclerview.widget.RecyclerView.OnItemTouchListener{
interface OnItemClickListener {
fun onItemClick(adapter: androidx.recyclerview.widget.RecyclerView.Adapter<androidx.recyclerview.widget.RecyclerView.ViewHolder>, view: View, position: Int)
fun onItemLongClick(adapter: androidx.recyclerview.widget.RecyclerView.Adapter<androidx.recyclerview.widget.RecyclerView.ViewHolder>, view: View, position: Int)
fun onItemChildClick(adapter: androidx.recyclerview.widget.RecyclerView.Adapter<androidx.recyclerview.widget.RecyclerView.ViewHolder>, view: View, position: Int)
}
private var gestureDetectorCompat:GestureDetectorCompat =
GestureDetectorCompat(recyclerView.context, ItemTouchHelperGestureListener())
override fun onTouchEvent(rv: androidx.recyclerview.widget.RecyclerView, e: MotionEvent) {
gestureDetectorCompat.onTouchEvent(e)
}
override fun onInterceptTouchEvent(rv: androidx.recyclerview.widget.RecyclerView, e: MotionEvent): Boolean {
return gestureDetectorCompat.onTouchEvent(e)
}
override fun onRequestDisallowInterceptTouchEvent(p0: Boolean) {}
private val screenWidth = ScreenUtils.getScreenWidthInPixel(activity)
private val iconRight = screenWidth * 0.1370
private val checkBoxLeft = screenWidth * (1 - 0.1370)
inner class ItemTouchHelperGestureListener:GestureDetector.SimpleOnGestureListener() {
override fun onSingleTapUp(e: MotionEvent?): Boolean {
val childView = recyclerView.findChildViewUnder(e!!.x, e.y)
childView?:return false
when(childView.id){
R.id.item_list_file_picker -> {
// 点击在 icon 上或者点击在 checkbox 上
if (e.x <= iconRight || e.x >= checkBoxLeft){
itemClickListener.onItemChildClick(recyclerView.adapter!!, childView, recyclerView.getChildLayoutPosition(childView))
return true
}
itemClickListener.onItemClick(recyclerView.adapter!!, childView, recyclerView.getChildLayoutPosition(childView))
}
R.id.item_nav_file_picker -> {
itemClickListener.onItemClick(recyclerView.adapter!!, childView, recyclerView.getChildLayoutPosition(childView))
}
}
return true
}
override fun onLongPress(e: MotionEvent?) {
val childView = recyclerView.findChildViewUnder(e!!.x, e.y)
childView?:return
when(childView.id){
R.id.item_list_file_picker -> {
itemClickListener.onItemLongClick(recyclerView.adapter!!, childView, recyclerView.getChildLayoutPosition(childView))
}
}
}
}
}
| 0
|
Kotlin
|
0
| 0
|
d1e09b2d155a32bf65ef64eb30f3c310f458169d
| 3,384
|
FilePicker
|
MIT License
|
plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/AbstractExpressionSelectionTest.kt
|
ingokegel
| 72,937,917
| false
| null |
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.kotlin.idea
import org.jetbrains.kotlin.idea.util.ElementKind
import org.jetbrains.kotlin.idea.refactoring.IntroduceRefactoringException
import org.jetbrains.kotlin.idea.refactoring.selectElement
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase
import org.jetbrains.kotlin.idea.test.KotlinTestUtils
import org.jetbrains.kotlin.psi.KtFile
abstract class AbstractExpressionSelectionTest : KotlinLightCodeInsightFixtureTestCase() {
fun doTestExpressionSelection(path: String) {
myFixture.configureByFile(path)
val expectedExpression = KotlinTestUtils.getLastCommentInFile(file as KtFile)
try {
selectElement(editor, file as KtFile, ElementKind.EXPRESSION) {
assertNotNull("Selected expression mustn't be null", it)
assertEquals(expectedExpression, it?.text)
}
} catch (e: IntroduceRefactoringException) {
assertEquals(expectedExpression, "")
}
}
}
| 233
| null |
4912
| 2
|
b07eabd319ad5b591373d63c8f502761c2b2dfe8
| 1,173
|
intellij-community
|
Apache License 2.0
|
core/src/main/java/page/smirnov/wallester/core/util/extension/ContextExtensions.kt
|
RankoR
| 465,888,502
| false
|
{"Kotlin": 104194}
|
package page.smirnov.wallester.core.util.extension
import android.content.Context
import android.content.pm.PackageManager
import androidx.core.content.ContextCompat
fun Context.isPermissionGranted(permission: String): Boolean {
return ContextCompat.checkSelfPermission(this, permission) == PackageManager.PERMISSION_GRANTED
}
fun Context.allPermissionsGranted(permissions: Array<String>): Boolean {
return permissions.all(::isPermissionGranted)
}
| 0
|
Kotlin
|
0
| 0
|
5720264750d5240281d45fc6c7341e09277e52db
| 459
|
WallesterTest
|
Apache License 2.0
|
app/src/main/java/com/yuhang/novel/pirate/ui/book/viewmodel/BookDetailsViewModel.kt
|
yuhanghate
| 200,383,190
| false
| null |
package com.yuhang.novel.pirate.ui.book.viewmodel
import android.annotation.SuppressLint
import android.text.TextUtils
import com.yuhang.novel.pirate.app.PirateApp
import com.yuhang.novel.pirate.base.BaseViewModel
import com.yuhang.novel.pirate.repository.database.entity.BookChapterKSEntity
import com.yuhang.novel.pirate.repository.database.entity.BookCollectionKSEntity
import com.yuhang.novel.pirate.repository.database.entity.BookDownloadEntity
import com.yuhang.novel.pirate.repository.database.entity.BookInfoKSEntity
import com.yuhang.novel.pirate.repository.network.data.kanshu.result.BookDetailsDataResult
import com.yuhang.novel.pirate.repository.network.data.pirate.result.BooksResult
class BookDetailsViewModel : BaseViewModel() {
var obj: BookDetailsDataResult? = null
var entity: BookInfoKSEntity? = null
var chapterList: ArrayList<BookChapterKSEntity> = arrayListOf()
/**
* 是否收藏书箱
*/
var isCollection = false
/**
* 作者所有作品
*/
suspend fun getAuthorBooksList(obj: BooksResult): List<BooksResult> {
return mConvertRepository.getAuthorBooksList(obj)
}
/**
* 获取详情信息
*/
suspend fun getBookDetails(obj: BooksResult): BookInfoKSEntity {
return mConvertRepository.getDetailsInfo(obj)
}
/**
* 增加收藏
*/
suspend fun insertCollection(obj: BooksResult): Boolean {
mDataRepository.insertCollection(obj)
return true
}
/**
* 收藏到服务器
*/
@SuppressLint("CheckResult")
suspend fun postCollection(obj: BooksResult) {
if (TextUtils.isEmpty(PirateApp.getInstance().getToken()) || entity == null) return
entity?.let {
mDataRepository.addCollection(bookid = it.bookid,bookName = it.bookName,
author = it.author,cover = it.cover,description = it.description,
bookStatus = it.bookStatus,classifyName = it.classifyName,resouceType = obj.getType()
)
}
}
/**
* 插入书箱信息
*/
suspend fun insertBookInfoEntity() {
val book = entity ?: return
val bookInfo = mDataRepository.queryBookInfo(book.bookid)
if (bookInfo == null) {
//书籍信息插入本地
mDataRepository.insertBookInfo(book)
} else {
//更新本地数据
book.id = bookInfo.id
mDataRepository.updateBookInfo(book)
}
}
/**
* 查询书箱
*/
suspend fun queryCollection(bookid: String): BookCollectionKSEntity? {
return mDataRepository.queryCollection(bookid)
}
/**
* 查询书籍
*/
suspend fun queryCollectionAll(): List<BookCollectionKSEntity> {
return mDataRepository.queryCollectionAll()
}
/**
* 查询下载书籍
*/
suspend fun queryDownloadAll(): List<BookDownloadEntity> {
return mDataRepository.queryDownloadBooks()
}
/**
* 查询配置文件
*/
suspend fun isVip(): Boolean {
//是否开启会员模式
mDataRepository.queryConfig()?.let {
return it.isOpenVip
}
return mDataRepository.getLastUser()?.isVip!!
}
/**
* 删除收藏
*/
suspend fun deleteCollection(bookid: String): Boolean {
mDataRepository.deleteCollection(bookid)
return true
}
/**
* 章节列表
*/
private suspend fun getChapterListV2(obj: BooksResult): List<BookChapterKSEntity> {
return mConvertRepository.getChapterList(obj)
}
/**
* 从服务器更新书籍章节到本地
*/
suspend fun updateChapterToDB(bookid: BooksResult): List<BookChapterKSEntity> {
val list = getChapterListV2(bookid)
chapterList.clear()
chapterList.addAll(list)
mDataRepository.deleteChapterList(bookid.getBookid())
mDataRepository.insertChapterList(list)
return list
}
/**
* 下载小说
*/
fun downloadBook(obj:BooksResult) {
mDataRepository.startWorker(obj)
}
}
| 1
| null |
1
| 2
|
8c72fc787a2927efb10c8c03b714195c7b1a6c76
| 3,927
|
Pirate
|
Apache License 2.0
|
build-logic/configuration/src/main/kotlin/KotlinJsConfiguration.kt
|
y9vad9
| 401,499,573
| false
| null |
import org.gradle.api.Plugin
import org.gradle.api.Project
class KotlinJsConfiguration : Plugin<Project> {
override fun apply(target: Project) {
target.plugins.apply(Deps.Plugins.Kotlin.Js)
}
}
| 1
| null |
0
| 9
|
405c75e174e55e3071f91cf575cebe6f7cb756c7
| 212
|
dove
|
MIT License
|
aspoet/src/main/kotlin/com/google/androidstudiopoet/models/AbstractModuleBlueprint.kt
|
android
| 106,021,222
| false
| null |
/*
Copyright 2017 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package com.google.androidstudiopoet.models
import com.google.androidstudiopoet.input.CodeConfig
import com.google.androidstudiopoet.utils.joinPath
abstract class AbstractModuleBlueprint(val name: String,
root: String,
val useKotlin: Boolean,
val dependencies: Set<Dependency>,
javaConfig: CodeConfig?,
kotlinConfig: CodeConfig?,
val extraLines: List<String>?,
val generateTests : Boolean) {
val moduleRoot = root.joinPath(name)
val moduleDependencies by lazy{ dependencies.filterIsInstance<ModuleDependency>()}
private val methodsToCallWithIn by lazy { moduleDependencies.map { it.methodToCall } }
val packagesBlueprint by lazy {
PackagesBlueprint(javaConfig, kotlinConfig, moduleRoot, name, methodsToCallWithIn, generateTests)
}
val methodToCallFromOutside by lazy {
packagesBlueprint.methodToCallFromOutside
}
}
| 12
|
Kotlin
|
89
| 680
|
f820e9cc0e5d7db4de9a7e31b818277143546f73
| 1,697
|
android-studio-poet
|
Apache License 2.0
|
data/src/test/java/com/parsadehghan/data/mapper/MultipleWeatherMapperKtTest.kt
|
parsadehghan2003
| 467,811,356
| false
|
{"Kotlin": 53758}
|
package com.parsadehghan.data.mapper
import com.parsadehghan.data.remote.model.*
import com.parsadehghan.domain.entity.WeatherState
import org.junit.Assert.*
import org.junit.Test
import kotlin.math.roundToInt
class MultipleWeatherMapperKtTest {
@Test
fun mapToForecast() {
val city = City(Coord(35.6944,51.4215),"IR",112931,"Tehran",0,12600)
val list = mutableListOf<ForecastResult>()
val weatherList:MutableList<Weather> = mutableListOf()
val weather = Weather("04d","broken clouds",803,"Clouds")
weatherList.add(weather)
val forecastResult = ForecastResult(Clouds(1),1646816400,"2022-03-09 09:00:00",
ForecastMain(11.21,880,33,1015,1015,12.99,-1.15,14.97,12.99),
Sys("IR",112931,1646794447,1646836559,1),weatherList, Wind(157,2.17)
)
list.add(forecastResult)
val forecastResponse = ForecastResponse(city,7,"200",list,0)
assertEquals(mapToForecast(forecastResponse).first(),com.parsadehghan.domain.entity.Weather(forecastResult.main.temp_min.roundToInt(),forecastResult.main.temp_max.roundToInt(),forecastResult.main.temp.roundToInt(),WeatherState.ClearSky,"0pm"))
}
@Test
fun mapToDailyForecast() {
}
}
| 0
|
Kotlin
|
0
| 0
|
c08fccfd7098902d53174f5953d1f54ad707df54
| 1,238
|
clean-weather
|
MIT License
|
Kotlin/src/main/kotlin/FuncosDeString.kt
|
ThiagoSR27
| 529,719,899
| false
| null |
fun main() {
val str = "Programação Kotlin"
println("O tamanho da string é ${str.length}")
println("Posição(index) 0 da string ${str[0]}")
println(str.startsWith("Pro"))
println(str.endsWith("abc"))
println(str.substring(2,4))
println(str.replace("Kotlin", "Kotlin é show"))
println(str.lowercase())
println(str.uppercase())
" meu nome é ".trim()
}
| 0
|
Kotlin
|
0
| 0
|
c7c489cfbf3a2e9516173276bb3d26301a14e3aa
| 418
|
Desenvolvimento-de-Aplicativos-Android-usando-Kotlin
|
MIT License
|
src/main/kotlin/com/intworkers/application/service/schoolsystem/GradeServiceImpl.kt
|
bw-international-school-social-worker
| 193,610,954
| true
|
{"Kotlin": 84025}
|
package com.intworkers.application.service.schoolsystem
import com.intworkers.application.exception.ResourceNotFoundException
import com.intworkers.application.model.schoolsystem.Course
import com.intworkers.application.model.schoolsystem.Grade
import com.intworkers.application.repository.schoolsystem.ClassRepository
import com.intworkers.application.repository.schoolsystem.GradeRepository
import com.intworkers.application.repository.schoolsystem.SchoolRepository
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.data.domain.Pageable
import org.springframework.data.jpa.repository.Modifying
import org.springframework.stereotype.Component
import org.springframework.stereotype.Service
import org.springframework.transaction.annotation.Transactional
@Component
@Service(value = "gradeService")
class GradeServiceImpl : GradeService {
@Autowired
private lateinit var gradeRepository: GradeRepository
@Autowired
private lateinit var schoolRepository: SchoolRepository
override fun findById(id: Long): Grade {
return gradeRepository.findById(id)
.orElseThrow { ResourceNotFoundException("Couldn't find grade with id $id") }
}
override fun findAll(pageable: Pageable): MutableList<Grade> {
val grades = mutableListOf<Grade>()
gradeRepository.findAll(pageable).iterator().forEachRemaining { grades.add(it) }
return grades
}
@Transactional
@Modifying
override fun save(grade: Grade): Grade {
val newGrade = Grade()
newGrade.gradeNumber = grade.gradeNumber
newGrade.school = grade.school
for (student in grade.students) {
newGrade.students.add(student)
student.grade = newGrade
}
return gradeRepository.save(newGrade)
}
@Transactional
@Modifying
override fun update(grade: Grade, id: Long): Grade {
val updatedGrade = gradeRepository.findById(id)
.orElseThrow { ResourceNotFoundException("Couldn't find grade with id $id ") }
if (grade.gradeNumber != null) updatedGrade.gradeNumber = grade.gradeNumber
if (grade.school != null) updatedGrade.school = grade.school
for (student in grade.students) {
updatedGrade.students.add(student)
student.grade = updatedGrade
}
return gradeRepository.save(updatedGrade)
}
@Transactional
@Modifying
override fun delete(id: Long) {
if (gradeRepository.findById(id).isPresent)
gradeRepository.deleteById(id)
else throw ResourceNotFoundException("Couldn't find grade with id $id")
}
@Transactional
override fun assignToSchool(gradeId: Long, schoolId: Long) {
if (gradeRepository.findById(gradeId).isPresent
&& schoolRepository.findById(schoolId).isPresent)
gradeRepository.assignToSchool(gradeId, schoolId)
else throw ResourceNotFoundException("Couldn't find grade or School")
}
@Transactional
override fun removeFromSchool(gradeId: Long) {
if (gradeRepository.findById(gradeId).isPresent)
gradeRepository.removeFromSchool(gradeId)
else throw ResourceNotFoundException("Couldn't find grade or School")
}
}
| 1
|
Kotlin
|
2
| 0
|
eb876f9862af3b1731788e67952f05850ce96304
| 3,295
|
international-school-socialworker-BE
|
MIT License
|
app/src/main/java/com/kennah/wecatch/local/model/Pokemon.kt
|
kaiyan910
| 101,561,893
| false
| null |
package com.kennah.wecatch.local.model
import android.os.Parcel
import android.os.Parcelable
import kotlinx.android.parcel.Parcelize
class Pokemon(
val pokemonId: Int,
val latitude: Double,
val longitude: Double,
val expireTime: Long,
val iv: Int,
val cp: Int,
val stamina: Int,
val attack: Int,
val defense: Int,
val move1: Int,
val move2: Int
) : Parcelable {
constructor(source: Parcel) : this(
source.readInt(),
source.readDouble(),
source.readDouble(),
source.readLong(),
source.readInt(),
source.readInt(),
source.readInt(),
source.readInt(),
source.readInt(),
source.readInt(),
source.readInt()
)
override fun describeContents() = 0
override fun writeToParcel(dest: Parcel, flags: Int) = with(dest) {
writeInt(pokemonId)
writeDouble(latitude)
writeDouble(longitude)
writeLong(expireTime)
writeInt(iv)
writeInt(cp)
writeInt(stamina)
writeInt(attack)
writeInt(defense)
writeInt(move1)
writeInt(move2)
}
companion object {
@JvmField
val CREATOR: Parcelable.Creator<Pokemon> = object : Parcelable.Creator<Pokemon> {
override fun createFromParcel(source: Parcel): Pokemon = Pokemon(source)
override fun newArray(size: Int): Array<Pokemon?> = arrayOfNulls(size)
}
}
}
| 0
|
Kotlin
|
27
| 66
|
d3b56f5d82af46210437ba94e031f5e8088b776c
| 1,557
|
PGO-WeCatch-Android
|
The Unlicense
|
test-output/innerclass.isc.kt
|
dvekeman
| 181,682,664
| false
|
{"Haskell": 66206, "Kotlin": 13495, "JavaScript": 415, "TypeScript": 65}
|
@file:JsQualifier("isc")
external interface Array {
}
package isc
external open class Foo {
}
external fun getKeys(`object`: Any): Array<Any> = definedExternally
external open class SomeClass {
open fun someFun(bar: (() -> Unit)): Unit = definedExternally
}
| 6
|
Haskell
|
0
| 0
|
e37e7f43ca8d34ff0665e03d0c0823f1503cd9a4
| 264
|
tsinterop
|
Apache License 2.0
|
domain/src/main/java/com/wiseassblog/domain/api/IReminderAPI.kt
|
BracketCove
| 84,023,304
| false
| null |
package com.wiseassblog.domain.api
import com.wiseassblog.common.ResultWrapper
import com.wiseassblog.domain.domainmodel.Reminder
/**
* This interface describes the responsibilities and interactions between
* Presenters and The ReminderRepository class.
* Created by Ryan on 09/03/2017.
*/
interface IReminderAPI {
suspend fun setReminder(reminder: Reminder): ResultWrapper<Exception, Unit>
suspend fun cancelReminder(reminder: Reminder): ResultWrapper<Exception, Unit>
}
| 1
|
Kotlin
|
36
| 85
|
66136bf7b3e173d964dc15729f982293189b2ee2
| 490
|
PosTrainer
|
Apache License 2.0
|
app/src/main/java/br/ifsp/moviedb/network/api/MovieApi.kt
|
pdalbem
| 844,668,803
| false
|
{"Kotlin": 109217}
|
package br.ifsp.moviedb.network.api
import br.ifsp.moviedb.model.parsers.movie.MovieResponse
import br.ifsp.moviedb.model.parsers.search.SearchResponse
import br.ifsp.moviedb.model.parsers.theatre.TheatreResponse
import br.ifsp.moviedb.model.parsers.tv.TvShowResponse
import retrofit2.http.GET
import retrofit2.http.Path
import retrofit2.http.Query
interface MovieApi {
@GET("search/multi")
suspend fun getSearchAsync(@Query("api_key") apiKey: String,
@Query("query") query: String,
@Query("page") page: Int): SearchResponse
@GET("movie/{movieId}")
suspend fun getMovieDetailsAsync(@Path("movieId") movieId: Int,
@Query("api_key") apiKey: String,
@Query("append_to_response") appendToResponse: String): MovieResponse
@GET("tv/{tvId}")
suspend fun getTvShowDetailsAsync(@Path("tvId") movieId: Int,
@Query("api_key") apiKey: String,
@Query("append_to_response") appendToResponse: String): TvShowResponse
@GET("discover/movie")
suspend fun getMovieTheatreAsync(@Query("primary_release_date.gte") startDate: String,
@Query("primary_release_date.lte") endDate: String,
@Query("api_key") apiKey: String): TheatreResponse
}
| 0
|
Kotlin
|
0
| 0
|
f30a1f3decafeaf6b4c6789db1febdef41f49289
| 1,443
|
movieDB
|
MIT License
|
src/main/kotlin/org/radarbase/push/integration/garmin/backfill/Route.kt
|
RADAR-base
| 307,485,421
| false
|
{"Kotlin": 161008, "Dockerfile": 1555}
|
package org.radarbase.push.integration.garmin.backfill
import org.radarbase.push.integration.common.user.User
import java.time.Duration
import java.time.Instant
interface Route {
/**
* The number of days to request in a single request of this route.
*/
val maxIntervalPerRequest: Duration
fun generateRequests(user: User, start: Instant, end: Instant, max: Int): Sequence<RestRequest>
/**
* This is how it would appear in the offsets
*/
override fun toString(): String
fun maxBackfillPeriod(): Duration
}
| 9
|
Kotlin
|
2
| 2
|
1745929ccb91041bb03def684f95c60db5355b60
| 555
|
RADAR-PushEndpoint
|
Apache License 2.0
|
ui/src/main/java/com/redvelvet/ui/composable/MediaRateRow.kt
|
RedVelvet-Team
| 670,763,637
| false
| null |
package com.redvelvet.ui.composable
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import com.redvelvet.ui.R
import com.redvelvet.ui.theme.FontSecondary
import com.redvelvet.ui.theme.RateStarColor
import com.redvelvet.ui.theme.Typography
import com.redvelvet.ui.theme.spacing
@Composable
fun MediaRateRow(mediaRate: String, onRateMedia: () -> Unit) {
Row(
modifier = Modifier
.padding(bottom = MaterialTheme.spacing.spacing24)
) {
Row(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.Center,
modifier = Modifier.padding(end = MaterialTheme.spacing.spacing16)
) {
Icon(
painter = painterResource(id = R.drawable.rated_star),
contentDescription = stringResource(R.string.rated_star),
tint = RateStarColor,
modifier = Modifier.padding(end = MaterialTheme.spacing.spacing4)
)
Row {
BodyMediumText("$mediaRate/")
Text(
text = "10",
style = Typography.labelSmall,
color = FontSecondary
)
BodyMediumText(" Rating")
}
}
Row(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.Center,
modifier = Modifier
.clickable { onRateMedia() }
) {
Icon(
painter = painterResource(id = R.drawable.rate_action_star),
contentDescription = stringResource(R.string.rated_star),
tint = RateStarColor,
modifier = Modifier.padding(end = MaterialTheme.spacing.spacing4)
)
BodyMediumText("Rate This")
}
}
}
| 1
|
Kotlin
|
1
| 4
|
b9b17caa25439823ae354d3262921fb5f88c73d7
| 2,338
|
IMovie
|
Apache License 2.0
|
sample-app/src/main/kotlin/net/steamcrafted/loadtoastlib/MainActivity.kt
|
mohsenoid
| 335,014,675
| true
|
{"Kotlin": 47947}
|
package net.steamcrafted.loadtoastlib
import android.graphics.Color
import android.os.Bundle
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.app.AppCompatActivity
import net.steamcrafted.loadtoast.LoadToast
// Example activity
class MainActivity : AppCompatActivity() {
public override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val text = "This is a long loading text..."
val loadToast = LoadToast(this)
.setProgressColor(Color.RED)
.setText(text)
.setTranslationY(100)
.setBorderColor(Color.LTGRAY)
.show()
findViewById<View>(R.id.show).setOnClickListener {
loadToast.show()
}
findViewById<View>(R.id.error).setOnClickListener {
loadToast.error()
}
findViewById<View>(R.id.success).setOnClickListener {
loadToast.success()
}
val v = View(this)
v.setBackgroundColor(Color.RED)
val root = findViewById<View>(android.R.id.content) as ViewGroup
findViewById<View>(R.id.refresh).setOnClickListener {
v.setBackgroundColor(Color.rgb((Math.random() * 255).toInt(), (Math.random() * 255).toInt(), (Math.random() * 255).toInt()))
root.addView(v, ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 400))
}
findViewById<View>(R.id.hide).setOnClickListener {
loadToast.hide()
}
}
}
| 0
|
Kotlin
|
0
| 1
|
099aea31df4fc57f3f160df3269acd1008b3aeff
| 1,592
|
load-toast
|
Apache License 2.0
|
app/src/main/java/com/gmail/uwriegel/superfit/provider/TracksContentProvider.kt
|
uwriegel
| 99,416,992
| false
|
{"Kotlin": 52646, "TypeScript": 7042, "CSS": 3079, "HTML": 1785}
|
package com.gmail.uwriegel.superfit.provider
import android.content.ContentProvider
import android.content.ContentUris
import android.content.ContentValues
import android.content.UriMatcher
import android.database.Cursor
import android.database.sqlite.SQLiteQueryBuilder
import android.net.Uri
import com.gmail.uwriegel.superfit.database.DBHandler
class TracksContentProvider : ContentProvider() {
override fun onCreate(): Boolean {
dbHandler = DBHandler(context)
return false
}
override fun insert(uri: Uri, values: ContentValues?): Uri? {
val uriType = uriMatcher.match(uri)
val db = dbHandler.writableDatabase
val rowId = when(uriType) {
TRACKS -> db.insert(DBHandler.TABLE_TRACKS, null, values)
TRACKPOINTS -> db.insert(DBHandler.TABLE_TRACK_POINTS, null, values)
else -> throw IllegalArgumentException("Unknown URI: $uri")
}
context.contentResolver.notifyChange(uri, null)
return ContentUris.withAppendedId(uri, rowId)
}
override fun query(uri: Uri, projection: Array<String>?, selection: String?,
selectionArgs: Array<String>?, sortOrder: String?): Cursor? {
val uriType = uriMatcher.match(uri)
val queryBuilder = SQLiteQueryBuilder()
queryBuilder.tables =
when(uriType) {
TRACKPOINTS -> DBHandler.TABLE_TRACK_POINTS
else -> DBHandler.TABLE_TRACKS
}
when(uriType) {
TRACKS -> {}
TRACKS_ID -> queryBuilder.appendWhere("${DBHandler.KEY_ID}=${uri.lastPathSegment}")
TRACKPOINTS -> {}
else -> throw IllegalArgumentException("Unknown URI: $uri")
}
val cursor = queryBuilder.query(dbHandler.readableDatabase, projection, selection, selectionArgs, null, null, sortOrder)
cursor.setNotificationUri(context.contentResolver, uri)
return cursor
}
override fun update(uri: Uri, values: ContentValues?, selection: String?,
selectionArgs: Array<String>?): Int {
val uriType = uriMatcher.match(uri)
val rowsUpdated = when(uriType) {
TRACKS -> dbHandler.writableDatabase.update(DBHandler.TABLE_TRACKS, values, selection, selectionArgs)
else -> throw IllegalArgumentException("Unknown URI: $uri")
}
context.contentResolver.notifyChange(uri, null)
return rowsUpdated
}
override fun delete(uri: Uri, selection: String?, selectionArgs: Array<String>?): Int = throw UnsupportedOperationException("Not yet implemented")
override fun getType(uri: Uri): String? {
// TODO: Implement this to handle requests for the MIME type of the data
// at the given URI.
throw UnsupportedOperationException("Not yet implemented")
}
private val TRACKS = 1
private val TRACKS_ID = 2
private val TRACKPOINTS = 3
private val uriMatcher = UriMatcher(UriMatcher.NO_MATCH)
private lateinit var dbHandler: DBHandler
init {
uriMatcher.addURI(Authority, TRACKS_TABLE, TRACKS)
uriMatcher.addURI(Authority, TRACKS_TABLE + "/#", TRACKS_ID)
uriMatcher.addURI(Authority, TRACKPOINTS_TABLE, TRACKPOINTS)
}
companion object {
val Authority = "com.gmail.uwriegel.superfit.provider.tracks"
private val TRACKS_TABLE = "tracks"
private val TRACKPOINTS_TABLE = "trackpoints"
val TRACKS_CONTENT_URI = Uri.parse("content://$Authority/$TRACKS_TABLE")
val TRACKPOINTS_CONTENT_URI = Uri.parse("content://$Authority/$TRACKPOINTS_TABLE")
fun createTrackUri(trackNumber: Long): Uri = Uri.parse("content://$Authority/$TRACKS_TABLE/$trackNumber")
}
}
| 0
|
Kotlin
|
0
| 0
|
f855f24c33b21e2be87557d6f081f1e4f00ad9fb
| 3,762
|
SuperFit-deprecated
|
MIT License
|
app/src/main/java/com/gmail/uwriegel/superfit/provider/TracksContentProvider.kt
|
uwriegel
| 99,416,992
| false
|
{"Kotlin": 52646, "TypeScript": 7042, "CSS": 3079, "HTML": 1785}
|
package com.gmail.uwriegel.superfit.provider
import android.content.ContentProvider
import android.content.ContentUris
import android.content.ContentValues
import android.content.UriMatcher
import android.database.Cursor
import android.database.sqlite.SQLiteQueryBuilder
import android.net.Uri
import com.gmail.uwriegel.superfit.database.DBHandler
class TracksContentProvider : ContentProvider() {
override fun onCreate(): Boolean {
dbHandler = DBHandler(context)
return false
}
override fun insert(uri: Uri, values: ContentValues?): Uri? {
val uriType = uriMatcher.match(uri)
val db = dbHandler.writableDatabase
val rowId = when(uriType) {
TRACKS -> db.insert(DBHandler.TABLE_TRACKS, null, values)
TRACKPOINTS -> db.insert(DBHandler.TABLE_TRACK_POINTS, null, values)
else -> throw IllegalArgumentException("Unknown URI: $uri")
}
context.contentResolver.notifyChange(uri, null)
return ContentUris.withAppendedId(uri, rowId)
}
override fun query(uri: Uri, projection: Array<String>?, selection: String?,
selectionArgs: Array<String>?, sortOrder: String?): Cursor? {
val uriType = uriMatcher.match(uri)
val queryBuilder = SQLiteQueryBuilder()
queryBuilder.tables =
when(uriType) {
TRACKPOINTS -> DBHandler.TABLE_TRACK_POINTS
else -> DBHandler.TABLE_TRACKS
}
when(uriType) {
TRACKS -> {}
TRACKS_ID -> queryBuilder.appendWhere("${DBHandler.KEY_ID}=${uri.lastPathSegment}")
TRACKPOINTS -> {}
else -> throw IllegalArgumentException("Unknown URI: $uri")
}
val cursor = queryBuilder.query(dbHandler.readableDatabase, projection, selection, selectionArgs, null, null, sortOrder)
cursor.setNotificationUri(context.contentResolver, uri)
return cursor
}
override fun update(uri: Uri, values: ContentValues?, selection: String?,
selectionArgs: Array<String>?): Int {
val uriType = uriMatcher.match(uri)
val rowsUpdated = when(uriType) {
TRACKS -> dbHandler.writableDatabase.update(DBHandler.TABLE_TRACKS, values, selection, selectionArgs)
else -> throw IllegalArgumentException("Unknown URI: $uri")
}
context.contentResolver.notifyChange(uri, null)
return rowsUpdated
}
override fun delete(uri: Uri, selection: String?, selectionArgs: Array<String>?): Int = throw UnsupportedOperationException("Not yet implemented")
override fun getType(uri: Uri): String? {
// TODO: Implement this to handle requests for the MIME type of the data
// at the given URI.
throw UnsupportedOperationException("Not yet implemented")
}
private val TRACKS = 1
private val TRACKS_ID = 2
private val TRACKPOINTS = 3
private val uriMatcher = UriMatcher(UriMatcher.NO_MATCH)
private lateinit var dbHandler: DBHandler
init {
uriMatcher.addURI(Authority, TRACKS_TABLE, TRACKS)
uriMatcher.addURI(Authority, TRACKS_TABLE + "/#", TRACKS_ID)
uriMatcher.addURI(Authority, TRACKPOINTS_TABLE, TRACKPOINTS)
}
companion object {
val Authority = "com.gmail.uwriegel.superfit.provider.tracks"
private val TRACKS_TABLE = "tracks"
private val TRACKPOINTS_TABLE = "trackpoints"
val TRACKS_CONTENT_URI = Uri.parse("content://$Authority/$TRACKS_TABLE")
val TRACKPOINTS_CONTENT_URI = Uri.parse("content://$Authority/$TRACKPOINTS_TABLE")
fun createTrackUri(trackNumber: Long): Uri = Uri.parse("content://$Authority/$TRACKS_TABLE/$trackNumber")
}
}
| 0
|
Kotlin
|
0
| 0
|
f855f24c33b21e2be87557d6f081f1e4f00ad9fb
| 3,762
|
SuperFit-deprecated
|
MIT License
|
minigames/common/src/main/kotlin/net/casual/championships/common/minigame/rules/RuleEntry.kt
|
CasualChampionships
| 334,382,250
| false
|
{"Kotlin": 271263, "Java": 4670}
|
package net.casual.championships.common.minigame.rule
import net.casual.arcade.scheduler.MinecraftTimeDuration
import net.casual.arcade.utils.TimeUtils.Seconds
import net.minecraft.network.chat.Component
class RuleEntry(
val lines: List<Component>,
val duration: MinecraftTimeDuration
) {
class Builder {
private val lines = ArrayList<Component>()
var duration: MinecraftTimeDuration = 6.Seconds
fun line(component: Component) {
this.lines.add(component)
}
fun build(): RuleEntry {
return RuleEntry(this.lines, this.duration)
}
}
}
| 0
|
Kotlin
|
1
| 3
|
810c7f2d5e2e61f7bf5b773862cc945f00cdb6b5
| 624
|
CasualChampionships
|
MIT License
|
plugin/src/main/kotlin/io/github/irgaly/gradle/rur/RemoveUnusedResourcesTask.kt
|
irgaly
| 447,291,114
| false
|
{"Kotlin": 28536}
|
package io.github.irgaly.gradle.rur
import io.github.irgaly.gradle.rur.extensions.containsInDescendants
import io.github.irgaly.gradle.rur.extensions.getAttributeText
import io.github.irgaly.gradle.rur.extensions.getElements
import io.github.irgaly.gradle.rur.xml.getAttributeValue
import org.gradle.api.DefaultTask
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.provider.ListProperty
import org.gradle.api.provider.Property
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.InputFile
import org.gradle.api.tasks.Optional
import org.gradle.api.tasks.TaskAction
import org.gradle.work.DisableCachingByDefault
import java.io.File
import java.io.StringWriter
import java.nio.file.FileSystems
import javax.xml.namespace.QName
import javax.xml.parsers.DocumentBuilderFactory
@DisableCachingByDefault(
because = "RemoveUnusedResourcesTask has File system operation."
)
abstract class RemoveUnusedResourcesTask : DefaultTask() {
@get:Optional
@get:Input
abstract val dryRun: Property<Boolean>
@get:InputFile
abstract val lintResultXml: RegularFileProperty
@get:Optional
@get:Input
abstract val excludeIds: ListProperty<String>
@get:Optional
@get:Input
abstract val excludeIdPatterns: ListProperty<String>
@get:Optional
@get:Input
abstract val excludeFilePatterns: ListProperty<String>
@Suppress("LABEL_NAME_CLASH") // for using: return@forEach
@TaskAction
fun run() {
val isDryRun = dryRun.getOrElse(false)
val dryRunMarker = if (isDryRun) "[dry run] " else ""
val lintResultFile = lintResultXml.asFile.get()
logger.info("lintResultFile = $lintResultFile")
val excludeResourceNames = (excludeIds.orNull?.toHashSet() ?: emptySet())
val excludeResourceNamePatterns =
(excludeIdPatterns.orNull?.map { it.toRegex() } ?: emptyList())
val excludeFileMatchers = FileSystems.getDefault().let { fileSystem ->
excludeFilePatterns.orNull?.map {
fileSystem.getPathMatcher("glob:$it")
} ?: emptyList()
}
val lintResultDocument = DocumentBuilderFactory.newInstance().newDocumentBuilder()
.parse(lintResultFile).documentElement
if (lintResultDocument.tagName != "issues") {
error("root tag is not \"issues\": ${lintResultDocument.tagName}")
}
var lintResultUnusedResourcesIssueCount = 0
val issueTargets: MutableList<IssueTarget> = mutableListOf()
lintResultDocument.getElements("issue")
.filter { it.getAttributeText("id") == "UnusedResources" }
.forEach { issue ->
lintResultUnusedResourcesIssueCount++
val message = issue.getAttributeText("message")
?: error("message attribute is missing: $issue")
val matchedResource =
Regex("^The resource `(R\\.([^.]+)\\.([^.]+))` appears to be unused$").matchEntire(
message
) ?: error("unknown message: $message")
val (_, resourceName, resourceType, resourceId) = matchedResource.groupValues
if (excludeResourceNames.contains(resourceName) ||
excludeResourceNamePatterns.any { it.matches(resourceName) }
) {
logger.debug("ignore because exclude resource id: $resourceName")
return@forEach
}
val location = issue.getElements("location").first()
val originalTargetFile = File(location.attributes.getNamedItem("file").nodeValue)
if (!originalTargetFile.isAbsolute) {
error("target file is relative path: $originalTargetFile")
}
if (listOf(project.rootProject).union(project.rootProject.subprojects).all {
// check rootProject first, then check subprojects
// because rootProject is most likely top of all project's directory.
// any subproject placed in outside of rootProject is rare situation.
!it.projectDir.containsInDescendants(originalTargetFile)
}) {
logger.warn("skip: target file is outside of all project's directory: $originalTargetFile")
return@forEach
}
val resourceDirectory = originalTargetFile.parentFile.parentFile
val isValuesResource =
Regex("values(-.+)?").matches(originalTargetFile.parentFile.name)
issueTargets.add(
IssueTarget(
IssueTargetGroup(isValuesResource, resourceDirectory),
resourceName,
resourceType,
resourceId,
originalTargetFile
)
)
}
if (lintResultUnusedResourcesIssueCount == 0) {
logger.lifecycle("Lint Report has no UnusedResources issues: $lintResultFile")
}
val groupedIssueTargets = issueTargets.groupBy { it.group }
groupedIssueTargets.filter { it.key.isValuesResource }.forEach { (issueGroup, issues) ->
val originalTargetFiles = issues.map { it.originalTargetFile }.distinct().toSet()
issueGroup.resourceDirectory.listFiles()?.filter {
Regex("values(-.+)?").matches(it.name)
}?.flatMap { directory ->
directory.listFiles()?.filter {
it.name.endsWith(".xml")
} ?: emptyList()
}.let { targetFiles ->
originalTargetFiles.union(targetFiles ?: emptyList()).toList()
}.filterNot { targetFile ->
// ignore exclude file
excludeFileMatchers.any {
it.matches(targetFile.relativeTo(project.rootDir).toPath())
}
}.forEach { targetFile ->
if ((targetFile in originalTargetFiles) && !targetFile.exists()) {
logger.warn("target file is not exist: $targetFile")
return@forEach
}
// remove resource element
val removed: MutableSet<IssueTarget> = mutableSetOf()
val skipped: MutableSet<IssueTarget> = mutableSetOf()
var remainResources = false
val converter = XmlConverter { startElementEvent ->
var remove = false
if (startElementEvent.level == 1) {
// only check root <resources>'s child elements
val target = startElementEvent.event.asStartElement()
val tagName = target.name.toString()
val attribute = target.getAttributeValue("name")
val resourceId = attribute?.replace(".", "_")
val issue = issues.firstOrNull { issue ->
tagName in when (issue.resourceType) {
"array" -> listOf("array", "integer-array", "string-array")
else -> listOf(issue.resourceType)
} && resourceId == issue.resourceId
}
if (issue != null) {
val overrideName = QName(
"http://schemas.android.com/tools",
"override"
)
if (target.getAttributeValue(overrideName) == "true") {
skipped.add(issue)
} else {
remove = true
removed.add(issue)
}
}
if (!remove) {
remainResources = true
}
}
XmlConverter.Operation(remove)
}
val output = StringWriter()
converter.convert(targetFile.inputStream(), output)
if (skipped.isNotEmpty() || removed.isNotEmpty()) {
logger.lifecycle("> report from: $targetFile")
}
issues.forEach { issue ->
when {
issue in skipped -> {
logger.lifecycle("skip because it has tools:override: ${issue.resourceName}")
}
issue in removed -> {
logger.lifecycle("${dryRunMarker}delete resource element: ${issue.resourceName}")
}
(issue.originalTargetFile == targetFile) -> {
logger.warn("resource not found: ${issue.resourceName}")
}
}
}
if (remainResources) {
if (!isDryRun) {
// update resource file
targetFile.writeText(output.toString())
}
} else {
// delete empty resource file
logger.lifecycle("${dryRunMarker}delete resource file because of empty: $targetFile")
if (!isDryRun) {
targetFile.delete()
}
}
}
}
groupedIssueTargets.filter { !it.key.isValuesResource }.forEach { (issueGroup, issues) ->
issues.forEach { issue ->
val targetFiles = issueGroup.resourceDirectory.listFiles()?.filter {
Regex("${issue.resourceType}(-.+)?").matches(it.name)
}?.flatMap { directory ->
directory.listFiles()?.filter {
(Regex("\\.9$").replace(
it.nameWithoutExtension,
""
) == issue.resourceId)
} ?: emptyList()
}.let { listOf(issue.originalTargetFile).union(it ?: emptyList()).toList() }
// ignore resource if any file is matched
if (targetFiles.any { targetFile ->
excludeFileMatchers.any {
it.matches(targetFile.relativeTo(project.rootDir).toPath())
}
}) {
logger.debug("ignore because exclude file matched: ${issue.resourceName}")
return@forEach
}
targetFiles.forEach { targetFile ->
if ((issue.originalTargetFile == targetFile) && !targetFile.exists()) {
logger.warn("target file is not exist: $targetFile")
return@forEach
}
// delete resource file
// target: R.animator, R.anim, R.color, R.drawable, R.mipmap,
// R.layout, R.menu, R.raw, R.xml, R.font
logger.lifecycle("${dryRunMarker}delete resource file: $targetFile")
if (!isDryRun) {
targetFile.delete()
}
}
}
}
}
private data class IssueTargetGroup(
val isValuesResource: Boolean,
val resourceDirectory: File
)
private data class IssueTarget(
val group: IssueTargetGroup,
val resourceName: String,
val resourceType: String,
val resourceId: String,
val originalTargetFile: File
)
}
| 2
|
Kotlin
|
1
| 29
|
f4c6ab86c06568a72eb0abce9f499dbe3b66e3b0
| 11,825
|
android-remove-unused-resources-plugin
|
Apache License 2.0
|
emulators/gameboy/src/commonTest/kotlin/com/kiliansteenman/kemulation/gameboy/cpu/OpcodeLdSpHlTest.kt
|
KilianSteenman
| 289,452,042
| false
|
{"Kotlin": 101270, "Ruby": 2419, "Swift": 580, "HTML": 176}
|
package com.kiliansteenman.kemulation.gameboy.cpu
import kotlin.test.Test
@ExperimentalStdlibApi
class OpcodeLdSpHlTest : OpcodeBaseTest() {
@Test
fun opcode_LD_SP_HL() {
registers.h = 0x01
registers.l = 0x01
performOpcode(byteArrayOf(0xF9.toByte()))
registers.assertRegister(257, "SP")
}
}
| 1
|
Kotlin
|
0
| 3
|
90b96fffb2d02d5beb5110e9879cfdd7c5c949cd
| 339
|
KEmulation
|
MIT License
|
Skyflow/src/main/kotlin/Skyflow/reveal/RevealRequestBody.kt
|
skyflowapi
| 396,648,989
| false
|
{"Kotlin": 688615, "Shell": 585}
|
package Skyflow.reveal
import Skyflow.Label
import org.json.JSONArray
import org.json.JSONObject
internal class RevealRequestBody {
companion object {
internal fun createRequestBody(elements: MutableList<Label>): JSONObject {
val payload = JSONArray()
for (element in elements) {
val entry = JSONObject()
entry.put("token", element.revealInput.token)
entry.put("redaction", element.revealInput.redaction)
payload.put(entry)
}
val result = JSONObject()
result.put("records", payload)
return result
}
}
}
| 11
|
Kotlin
|
2
| 7
|
c907a26c4c6e668d459020677f27907f25505f69
| 665
|
skyflow-android
|
MIT License
|
plugins/android-extensions/android-extensions-compiler/src/org/jetbrains/kotlin/android/synthetic/codegen/AndroidIrExtension.kt
|
android
| 263,405,600
| false
| null |
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.android.synthetic.codegen
import kotlinx.android.extensions.CacheImplementation
import org.jetbrains.kotlin.android.synthetic.AndroidConst
import org.jetbrains.kotlin.android.synthetic.descriptors.AndroidSyntheticPackageFragmentDescriptor
import org.jetbrains.kotlin.android.synthetic.descriptors.ContainerOptionsProxy
import org.jetbrains.kotlin.android.synthetic.res.AndroidSyntheticFunction
import org.jetbrains.kotlin.android.synthetic.res.AndroidSyntheticProperty
import org.jetbrains.kotlin.backend.common.IrElementTransformerVoidWithContext
import org.jetbrains.kotlin.backend.common.extensions.IrGenerationExtension
import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext
import org.jetbrains.kotlin.backend.common.ir.createImplicitParameterDeclarationWithWrappedDescriptor
import org.jetbrains.kotlin.backend.common.lower.DeclarationIrBuilder
import org.jetbrains.kotlin.backend.common.lower.irBlock
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.ir.IrStatement
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
import org.jetbrains.kotlin.ir.builders.*
import org.jetbrains.kotlin.ir.builders.declarations.*
import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.declarations.impl.IrExternalPackageFragmentImpl
import org.jetbrains.kotlin.ir.declarations.impl.IrFactoryImpl
import org.jetbrains.kotlin.ir.expressions.IrCall
import org.jetbrains.kotlin.ir.expressions.IrExpression
import org.jetbrains.kotlin.ir.expressions.IrTypeOperator
import org.jetbrains.kotlin.ir.expressions.impl.*
import org.jetbrains.kotlin.ir.symbols.IrClassifierSymbol
import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol
import org.jetbrains.kotlin.ir.symbols.IrSymbol
import org.jetbrains.kotlin.ir.symbols.impl.IrTypeParameterSymbolImpl
import org.jetbrains.kotlin.ir.symbols.impl.IrValueParameterSymbolImpl
import org.jetbrains.kotlin.ir.types.*
import org.jetbrains.kotlin.ir.util.*
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.FqNameUnsafe
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.resolve.descriptorUtil.propertyIfAccessor
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
@OptIn(ObsoleteDescriptorBasedAPI::class)
abstract class AndroidIrExtension : IrGenerationExtension {
abstract fun isEnabled(declaration: IrClass): Boolean
abstract fun isExperimental(declaration: IrClass): Boolean
abstract fun getGlobalCacheImpl(declaration: IrClass): CacheImplementation
override fun resolveSymbol(symbol: IrSymbol, context: TranslationPluginContext): IrDeclaration? =
if (symbol !is IrSimpleFunctionSymbol ||
(symbol.descriptor !is AndroidSyntheticFunction
&& symbol.descriptor.safeAs<PropertyGetterDescriptor>()?.correspondingProperty !is AndroidSyntheticProperty)) {
super.resolveSymbol(symbol, context)
} else {
// Replace android synthetic functions with stubs, since they are essentially intrinsics and will be replaced in the plugin
context.declareFunctionStub(symbol.descriptor).also { symbol.bind(it) }
}
override fun generate(moduleFragment: IrModuleFragment, pluginContext: IrPluginContext) {
moduleFragment.transform(AndroidIrTransformer(this, pluginContext), null)
}
}
@OptIn(ObsoleteDescriptorBasedAPI::class)
private class AndroidIrTransformer(val extension: AndroidIrExtension, val pluginContext: IrPluginContext) :
IrElementTransformerVoidWithContext() {
private val cachedPackages = mutableMapOf<FqName, IrPackageFragment>()
private val cachedClasses = mutableMapOf<FqName, IrClass>()
private val cachedMethods = mutableMapOf<FqName, IrSimpleFunction>()
private val cachedFields = mutableMapOf<FqName, IrField>()
private val irFactory: IrFactory = IrFactoryImpl
private fun createPackage(fqName: FqName) =
cachedPackages.getOrPut(fqName) {
IrExternalPackageFragmentImpl.createEmptyExternalPackageFragment(pluginContext.moduleDescriptor, fqName)
}
private fun createClass(fqName: FqName, isInterface: Boolean = false) =
cachedClasses.getOrPut(fqName) {
irFactory.buildClass {
name = fqName.shortName()
kind = if (isInterface) ClassKind.INTERFACE else ClassKind.CLASS
origin = IrDeclarationOrigin.IR_EXTERNAL_JAVA_DECLARATION_STUB
}.apply {
parent = createPackage(fqName.parent())
createImplicitParameterDeclarationWithWrappedDescriptor()
}
}
private fun createMethod(fqName: FqName, type: IrType, inInterface: Boolean = false, f: IrFunction.() -> Unit = {}) =
cachedMethods.getOrPut(fqName) {
val parent = createClass(fqName.parent(), inInterface)
parent.addFunction {
name = fqName.shortName()
origin = IrDeclarationOrigin.IR_EXTERNAL_JAVA_DECLARATION_STUB
modality = if (inInterface) Modality.ABSTRACT else Modality.FINAL
returnType = type
}.apply {
addDispatchReceiver { this.type = parent.defaultType }
f()
}
}
private fun createField(fqName: FqName, type: IrType) =
cachedFields.getOrPut(fqName) {
createClass(fqName.parent()).addField(fqName.shortName(), type, DescriptorVisibilities.PUBLIC)
}
override fun visitClassNew(declaration: IrClass): IrStatement {
if (!declaration.isClass && !declaration.isObject)
return super.visitClassNew(declaration)
val containerOptions = ContainerOptionsProxy.create(declaration.descriptor)
if ((containerOptions.cache ?: extension.getGlobalCacheImpl(declaration)) == CacheImplementation.NO_CACHE)
return super.visitClassNew(declaration)
if (containerOptions.containerType == AndroidContainerType.LAYOUT_CONTAINER && !extension.isExperimental(declaration))
return super.visitClassNew(declaration)
// TODO 1. actually generate the cache;
// 2. clear it in the function added below;
// 3. if containerOptions.containerType.isFragment and there's no onDestroy, add one that clears the cache
declaration.addFunction {
name = Name.identifier(AbstractAndroidExtensionsExpressionCodegenExtension.CLEAR_CACHE_METHOD_NAME)
modality = Modality.OPEN
returnType = pluginContext.irBuiltIns.unitType
}.apply {
addDispatchReceiver { type = declaration.defaultType }
body = IrBlockBodyImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET)
}
return super.visitClassNew(declaration)
}
override fun visitCall(expression: IrCall): IrExpression {
if (expression.symbol.descriptor is AndroidSyntheticFunction) {
// TODO actually call the appropriate CLEAR_CACHE_METHOD_NAME-named function
return IrBlockImpl(expression.startOffset, expression.endOffset, pluginContext.irBuiltIns.unitType)
}
val resource = (expression.symbol.descriptor as? PropertyGetterDescriptor)?.correspondingProperty as? AndroidSyntheticProperty
?: return super.visitFunctionAccess(expression)
val packageFragment = (resource as PropertyDescriptor).containingDeclaration as? AndroidSyntheticPackageFragmentDescriptor
?: return super.visitFunctionAccess(expression)
val receiverClass = expression.extensionReceiver?.type?.classOrNull
?: return super.visitFunctionAccess(expression)
val receiver = expression.extensionReceiver!!.transform(this, null)
val packageFqName = FqName(packageFragment.packageData.moduleData.module.applicationPackage)
val field = createField(packageFqName.child("R\$id").child(resource.name), pluginContext.irBuiltIns.intType)
val resourceId = IrGetFieldImpl(expression.startOffset, expression.endOffset, field.symbol, field.type)
val containerType = ContainerOptionsProxy.create(receiverClass.descriptor).containerType
val result = if (expression.type.classifierOrNull?.isFragment == true) {
// this.get[Support]FragmentManager().findFragmentById(R$id.<name>)
val appPackageFqName = when (containerType) {
AndroidContainerType.ACTIVITY,
AndroidContainerType.FRAGMENT -> FqName("android.app")
AndroidContainerType.SUPPORT_FRAGMENT,
AndroidContainerType.SUPPORT_FRAGMENT_ACTIVITY -> FqName("android.support.v4.app")
AndroidContainerType.ANDROIDX_SUPPORT_FRAGMENT,
AndroidContainerType.ANDROIDX_SUPPORT_FRAGMENT_ACTIVITY -> FqName("androidx.fragment.app")
else -> throw IllegalStateException("Invalid Android class type: $this") // Should never occur
}
val getFragmentManagerFqName = when (containerType) {
AndroidContainerType.SUPPORT_FRAGMENT_ACTIVITY,
AndroidContainerType.ANDROIDX_SUPPORT_FRAGMENT_ACTIVITY -> containerType.fqName.child("getSupportFragmentManager")
else -> containerType.fqName.child("getFragmentManager")
}
val fragment = appPackageFqName.child("Fragment")
val fragmentManager = appPackageFqName.child("FragmentManager")
val getFragmentManager = createMethod(getFragmentManagerFqName, createClass(fragmentManager).defaultType)
createMethod(fragmentManager.child("findFragmentById"), createClass(fragment).defaultType.makeNullable()) {
addValueParameter("id", pluginContext.irBuiltIns.intType)
}.callWithRanges(expression).apply {
dispatchReceiver = getFragmentManager.callWithRanges(expression).apply {
dispatchReceiver = receiver
}
putValueArgument(0, resourceId)
}
} else {
// this[.getView()?|.getContainerView()?].findViewById(R$id.<name>)
val viewClass = createClass(FqName(AndroidConst.VIEW_FQNAME))
val getView = when (containerType) {
AndroidContainerType.ACTIVITY, AndroidContainerType.ANDROIDX_SUPPORT_FRAGMENT_ACTIVITY, AndroidContainerType.SUPPORT_FRAGMENT_ACTIVITY, AndroidContainerType.VIEW, AndroidContainerType.DIALOG ->
null
AndroidContainerType.FRAGMENT, AndroidContainerType.ANDROIDX_SUPPORT_FRAGMENT, AndroidContainerType.SUPPORT_FRAGMENT ->
createMethod(containerType.fqName.child("getView"), viewClass.defaultType.makeNullable())
AndroidContainerType.LAYOUT_CONTAINER ->
createMethod(containerType.fqName.child("getContainerView"), viewClass.defaultType.makeNullable(), true)
else -> throw IllegalStateException("Invalid Android class type: $containerType") // Should never occur
}
val findViewByIdParent = if (getView == null) containerType.fqName else FqName(AndroidConst.VIEW_FQNAME)
val findViewById = createMethod(findViewByIdParent.child("findViewById"), viewClass.defaultType.makeNullable()) {
addValueParameter("id", pluginContext.irBuiltIns.intType)
}.callWithRanges(expression).apply {
putValueArgument(0, resourceId)
}
if (getView == null) {
findViewById.apply { dispatchReceiver = receiver }
} else {
val scope = currentScope!!.scope.scopeOwnerSymbol
DeclarationIrBuilder(IrGeneratorContextBase(pluginContext.irBuiltIns), scope).irBlock(expression) {
val variable = irTemporary(getView.callWithRanges(expression).apply {
dispatchReceiver = receiver
})
+irIfNull(findViewById.type, irGet(variable), irNull(), findViewById.apply {
dispatchReceiver = irGet(variable)
})
}
}
}
return with(expression) { IrTypeOperatorCallImpl(startOffset, endOffset, type, IrTypeOperator.CAST, type, result) }
}
}
private fun FqName.child(name: String) = child(Name.identifier(name))
@ObsoleteDescriptorBasedAPI
private fun IrSimpleFunction.callWithRanges(source: IrExpression) =
IrCallImpl.fromSymbolDescriptor(source.startOffset, source.endOffset, returnType, symbol)
private val AndroidContainerType.fqName: FqName
get() = FqName(internalClassName.replace("/", "."))
private val IrClassifierSymbol.isFragment: Boolean
get() = isClassWithFqName(FqNameUnsafe(AndroidConst.FRAGMENT_FQNAME)) ||
isClassWithFqName(FqNameUnsafe(AndroidConst.SUPPORT_FRAGMENT_FQNAME)) ||
isClassWithFqName(FqNameUnsafe(AndroidConst.ANDROIDX_SUPPORT_FRAGMENT_FQNAME))
private fun TranslationPluginContext.declareTypeParameterStub(typeParameterDescriptor: TypeParameterDescriptor): IrTypeParameter {
val symbol = IrTypeParameterSymbolImpl(typeParameterDescriptor)
return irFactory.createTypeParameter(
UNDEFINED_OFFSET, UNDEFINED_OFFSET, IrDeclarationOrigin.DEFINED, symbol, typeParameterDescriptor.name,
typeParameterDescriptor.index, typeParameterDescriptor.isReified, typeParameterDescriptor.variance
)
}
private fun TranslationPluginContext.declareParameterStub(parameterDescriptor: ParameterDescriptor): IrValueParameter {
val symbol = IrValueParameterSymbolImpl(parameterDescriptor)
val type = typeTranslator.translateType(parameterDescriptor.type)
val varargElementType = parameterDescriptor.varargElementType?.let { typeTranslator.translateType(it) }
return irFactory.createValueParameter(
UNDEFINED_OFFSET, UNDEFINED_OFFSET, IrDeclarationOrigin.DEFINED, symbol, parameterDescriptor.name,
parameterDescriptor.indexOrMinusOne, type, varargElementType, parameterDescriptor.isCrossinline, parameterDescriptor.isNoinline
)
}
private fun TranslationPluginContext.declareFunctionStub(descriptor: FunctionDescriptor): IrSimpleFunction =
irFactory.buildFun {
name = descriptor.name
visibility = descriptor.visibility
returnType = typeTranslator.translateType(descriptor.returnType!!)
modality = descriptor.modality
}.also {
it.typeParameters = descriptor.propertyIfAccessor.typeParameters.map(this::declareTypeParameterStub)
it.dispatchReceiverParameter = descriptor.dispatchReceiverParameter?.let(this::declareParameterStub)
it.extensionReceiverParameter = descriptor.extensionReceiverParameter?.let(this::declareParameterStub)
it.valueParameters = descriptor.valueParameters.map(this::declareParameterStub)
}
| 4
| null |
37
| 316
|
74126637a097f5e6b099a7b7a4263468ecfda144
| 15,093
|
kotlin
|
Apache License 2.0
|
dnq/src/test/kotlin/kotlinx/dnq/GetOldLinkTest.kt
|
JetBrains
| 72,845,430
| false
| null |
/**
* Copyright 2006 - 2024 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package kotlinx.dnq
import com.google.common.truth.Truth.assertThat
import kotlinx.dnq.util.getOldValue
import org.junit.Test
class GetOldLinkTest : DBTest() {
@Test
fun `if link is changed getOldValue should return old value`() {
val root1 = store.transactional {
RootGroup.new { name = "root group 1" }
}
val nested = store.transactional {
NestedGroup.new {
name = "nested"
owner = User.new { login = "owner"; skill = 1 }
parentGroup = root1
}
}
val root2 = store.transactional {
RootGroup.new { name = "root group 2" }
}
store.transactional {
nested.parentGroup = root2
assertThat(nested.getOldValue(NestedGroup::parentGroup)).isEqualTo(root1)
}
}
@Test
fun `getOldValue for new entity should return null`() {
store.transactional {
val nested = NestedGroup.new {
name = "nested"
owner = User.new { login = "owner"; skill = 1 }
parentGroup = RootGroup.new { name = "root group 1" }
}
assertThat(nested.getOldValue(NestedGroup::parentGroup)).isNull()
}
}
@Test
fun `if value did not change getOldValue should return the current value`() {
val root = store.transactional {
RootGroup.new { name = "root group 1" }
}
val nested = store.transactional {
NestedGroup.new {
name = "nested"
owner = User.new { login = "owner"; skill = 1 }
parentGroup = root
}
}
store.transactional {
assertThat(nested.getOldValue(NestedGroup::parentGroup)).isEqualTo(root)
}
}
}
| 7
| null |
32
| 86
|
feffc04edb59c406322ebb8e222579bfc49b836c
| 2,436
|
xodus-dnq
|
Apache License 2.0
|
app/src/main/java/com/chris/adviceapp/view/PhoneActivity.kt
|
christyansegecs
| 530,834,133
| false
| null |
package com.chris.adviceapp.view
import android.content.Intent
import android.os.Bundle
import android.telephony.PhoneNumberFormattingTextWatcher
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import com.chris.adviceapp.R
import com.chris.adviceapp.databinding.ActivityPhoneBinding
import com.google.firebase.FirebaseException
import com.google.firebase.auth.FirebaseAuth
import com.google.firebase.auth.PhoneAuthCredential
import com.google.firebase.auth.PhoneAuthOptions
import com.google.firebase.auth.PhoneAuthProvider
import java.util.Locale
import java.util.concurrent.TimeUnit
class PhoneActivity : AppCompatActivity() {
private lateinit var binding: ActivityPhoneBinding
private val auth: FirebaseAuth = FirebaseAuth.getInstance()
private lateinit var callbacks : PhoneAuthProvider.OnVerificationStateChangedCallbacks
lateinit var verificationCode : String
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
this.binding = ActivityPhoneBinding.inflate(layoutInflater)
setContentView(this.binding.root)
val country = Locale.getDefault().country
binding.tvPhone.addTextChangedListener(PhoneNumberFormattingTextWatcher(country))
setButtonClickListeners()
authenticationSettings()
}
private fun authenticationSettings() {
callbacks = object : PhoneAuthProvider.OnVerificationStateChangedCallbacks() {
override fun onVerificationCompleted(credential: PhoneAuthCredential) {
Toast.makeText(applicationContext, getString(R.string.toast_phone_verification_successful) + "\n${credential}",
Toast.LENGTH_LONG).show()
signInWithPhoneAuthCredential(credential)
}
override fun onVerificationFailed(e: FirebaseException) {
Toast.makeText(applicationContext, getString(R.string.toast_phone_verification_failed),
Toast.LENGTH_LONG).show()
}
override fun onCodeSent(verificationId: String, token: PhoneAuthProvider.ForceResendingToken) {
super.onCodeSent(verificationId, token)
Toast.makeText(applicationContext, getString(R.string.toast_phone_code_sent) + "\n${verificationId}",
Toast.LENGTH_LONG).show()
verificationCode = verificationId
}
}
}
private fun sendCodeToPhoneNumber(userPhoneNumber: String) {
val options = PhoneAuthOptions.newBuilder(auth)
.setPhoneNumber(userPhoneNumber)
.setTimeout(60L, TimeUnit.SECONDS)
.setActivity(this)
.setCallbacks(callbacks)
.build()
PhoneAuthProvider.verifyPhoneNumber(options)
auth.useAppLanguage()
}
private fun signInWithSMSCode(code: String) {
val credential = PhoneAuthProvider.getCredential(verificationCode, code)
signInWithPhoneAuthCredential(credential)
}
private fun signInWithPhoneAuthCredential(credential: PhoneAuthCredential) {
auth.signInWithCredential(credential)
.addOnCompleteListener(this) { task ->
if (task.isSuccessful) {
val intent = Intent(this, MainActivity::class.java)
startActivity(intent)
finish()
} else {
Toast.makeText(applicationContext, getString(R.string.toast_code_failed) + "\n${task.exception.toString()}",
Toast.LENGTH_SHORT).show()
}
}
}
private fun setButtonClickListeners() {
binding.btnSms.setOnClickListener {
val userPhoneNumber = binding.tvPhone.text.toString()
if (userPhoneNumber.isEmpty()) {
binding.tvPhone.error = getString(R.string.error_input_phonenumber)
binding.tvPhone.requestFocus()
} else {
sendCodeToPhoneNumber(BrazilPrefixPhoneNumber + userPhoneNumber)
}
}
binding.btnSmsVerify.setOnClickListener {
val code = binding.tvPhoneVerify.text.toString()
if (code.isEmpty()) {
binding.tvPhoneVerify.error = getString(R.string.error_input_phonenumber)
binding.tvPhoneVerify.requestFocus()
} else {
signInWithSMSCode(code)
}
}
}
companion object {
const val BrazilPrefixPhoneNumber = "+55"
}
}
| 0
|
Kotlin
|
0
| 0
|
96a1bc56b30b91b8f53d9cd138a06aefac362fb8
| 4,516
|
AdviceMeApp
|
Apache License 2.0
|
mui-icons-kotlin/src/jsMain/kotlin/mui/icons/material/SportsHockeySharp.kt
|
karakum-team
| 387,062,541
| false
|
{"Kotlin": 3037818, "TypeScript": 2249, "HTML": 724, "CSS": 86}
|
// Automatically generated - do not modify!
@file:JsModule("@mui/icons-material/SportsHockeySharp")
package mui.icons.material
@JsName("default")
external val SportsHockeySharp: SvgIconComponent
| 1
|
Kotlin
|
5
| 35
|
eb68a042133a7d025aef8450151ee0150cbc9b1b
| 198
|
mui-kotlin
|
Apache License 2.0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.