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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
src/main/kotlin/no/nav/sosialhjelp/avtaler/store/StoreException.kt
|
navikt
| 538,959,615
| false
|
{"Kotlin": 144177, "Dockerfile": 184}
|
package no.nav.sosialhjelp.avtaler.store
class StoreException(message: String, cause: Throwable? = null) : RuntimeException(message, cause)
| 6
|
Kotlin
|
1
| 1
|
065f7fee7414ffe860eea699d62cd7e0be603c7a
| 141
|
sosialhjelp-avtaler-api
|
MIT License
|
databinding/src/main/java/com/aidanvii/toolbox/databinding/ObservableViewModel.kt
|
Aidanvii7
| 86,928,271
| false
| null |
package com.aidanvii.toolbox.databinding
import android.arch.lifecycle.ViewModel
import com.aidanvii.toolbox.databinding.notifiable.BaseNotifiableObservable
import com.aidanvii.toolbox.databinding.notifiable.NotifiableObservable
/**
* A convenience [ViewModel] class that implements [NotifiableObservable].
*/
open class ObservableViewModel(notifiableObservableDelegate: NotifiableObservable = BaseNotifiableObservable())
: ViewModel(), NotifiableObservable by notifiableObservableDelegate {
init {
initDelegator(this)
}
}
| 0
|
Kotlin
|
0
| 0
|
9d5e8a0c7575418cc9d1f1be67b68d1925701722
| 547
|
Toolbox-old
|
Apache License 2.0
|
SingleModuleApp/app/src/main/java/com/github/yamamotoj/singlemoduleapp/package55/Foo05500.kt
|
yamamotoj
| 163,851,411
| false
|
{"Text": 1, "Ignore List": 30, "Markdown": 1, "Gradle": 34, "Java Properties": 11, "Shell": 6, "Batchfile": 6, "Proguard": 22, "Kotlin": 36021, "XML": 93, "INI": 1, "Java": 32, "Python": 2}
|
package com.github.yamamotoj.singlemoduleapp.package55
import com.github.yamamotoj.singlemoduleapp.package54.Foo05499
class Foo05500 {
fun method0() {
Foo05499().method5()
}
fun method1() {
method0()
}
fun method2() {
method1()
}
fun method3() {
method2()
}
fun method4() {
method3()
}
fun method5() {
method4()
}
}
| 0
|
Kotlin
|
0
| 9
|
2a771697dfebca9201f6df5ef8441578b5102641
| 419
|
android_multi_module_experiment
|
Apache License 2.0
|
src/main/kotlin/com/leetcode/P575.kt
|
antop-dev
| 229,558,170
| false
|
{"Kotlin": 747271, "Java": 222712, "Python": 12763}
|
package com.leetcode
// https://leetcode.com/problems/distribute-candies/
class P575 {
fun distributeCandies(candyType: IntArray): Int {
val n = candyType.size
val types = candyType.toSet()
return minOf(n / 2, types.size)
}
}
| 1
|
Kotlin
|
0
| 0
|
a9dd7cfa4f6cfc5186a86f6e2c8aefc489f5c028
| 259
|
algorithm
|
MIT License
|
demo/src/main/java/com/lsxiao/apollo/demo/base/BaseActivity.kt
|
qingmulang
| 278,559,524
| true
|
{"Gradle": 8, "YAML": 1, "Shell": 1, "Text": 1, "Ignore List": 6, "Batchfile": 1, "Markdown": 2, "Java": 3, "Kotlin": 39, "Proguard": 3, "XML": 20, "Java Properties": 1}
|
package com.lsxiao.apollo.demo.base
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import com.lsxiao.apollo.core.Apollo.Companion.bind
import com.lsxiao.apollo.core.contract.ApolloBinder
abstract class BaseActivity<T> : AppCompatActivity() {
private var mBinder: ApolloBinder? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(layoutId)
mBinder = bind(this)
afterCreate(savedInstanceState)
}
override fun onDestroy() {
super.onDestroy()
mBinder!!.unbind()
}
protected abstract val layoutId: Int
protected abstract fun afterCreate(savedInstanceState: Bundle?)
}
| 0
|
Kotlin
|
0
| 0
|
5633afdb5c4f1d4522c377f9472ee262a9e9f01c
| 726
|
Apollo
|
Apache License 2.0
|
src/test/kotlin/com/cimbul/faqueldb/ProjectConfig.kt
|
cimbul
| 398,552,580
| false
| null |
package com.cimbul.faqueldb
import io.kotest.core.config.AbstractProjectConfig
import io.kotest.core.spec.IsolationMode
object ProjectConfig : AbstractProjectConfig() {
override val isolationMode = IsolationMode.InstancePerLeaf
}
| 0
|
Kotlin
|
0
| 3
|
7b187f1e0f3df10f1f98beb16c702ebcf981d5ef
| 236
|
FaqueLDB
|
Apache License 2.0
|
Laplacian.Framework/src/main/kotlin/charlie/laplacian/decoder/Decoder.kt
|
cqjjjzr
| 84,650,266
| false
| null |
package charlie.laplacian.decoder
import charlie.laplacian.output.OutputSettings
import charlie.laplacian.stream.TrackStream
interface DecoderSession {
fun read(buf: ByteArray?): ByteArray?
fun seek(positionMillis: Long)
fun positionMillis(): Long
fun durationMillis(): Long
fun close()
}
interface Decoder {
fun getSession(outputSettings: OutputSettings, stream: TrackStream): DecoderSession
fun getMetadata(): DecoderMetadata
}
interface DecoderMetadata {
fun getName(): String
fun getVersion(): String
fun getVersionID(): Int
}
| 1
| null |
1
| 6
|
13496f06fb6f76117d67ea34c83b95708063ff4f
| 576
|
Laplacian
|
Apache License 2.0
|
app/src/main/java/com/example/noteapp/db/NoteDao.kt
|
viktornikolov069
| 546,632,327
| false
| null |
package com.example.noteapp.db
import androidx.room.*
import com.example.noteapp.utils.Constants.NOTE_TABLE
@Dao //Data Access Object
interface NoteDao {
@Insert(onConflict = OnConflictStrategy.REPLACE)
fun insertNote(noteEntity: NoteEntity)
@Update
fun updateNote(noteEntity: NoteEntity)
@Delete
fun deleteNote(noteEntity: NoteEntity)
@Query("SELECT * FROM $NOTE_TABLE ORDER BY noteId DESC")
fun getAllNotes() : MutableList<NoteEntity>
@Query("SELECT * FROM $NOTE_TABLE WHERE noteId LIKE :id")
fun getNote(id : Int) : NoteEntity
}
| 0
|
Kotlin
|
0
| 0
|
aba7f1970afa819161c2546c2a46aa44ebca399d
| 578
|
NoteApp
|
Apache License 2.0
|
korge-sandbox/src/samples/MainZIndex.kt
|
korlibs
| 80,095,683
| false
|
{"Kotlin": 4210038, "C": 105670, "C++": 20878, "HTML": 3853, "Swift": 1371, "JavaScript": 1068, "Shell": 439, "CMake": 202, "Batchfile": 41, "CSS": 33}
|
package samples
import korlibs.event.*
import korlibs.image.color.*
import korlibs.korge.input.*
import korlibs.korge.scene.*
import korlibs.korge.view.*
class MainZIndex : Scene() {
override suspend fun SContainer.sceneMain() {
val rect1 = solidRect(100, 100, Colors.RED).also { it.y = 50.0 }.also { it.zIndex = it.y }
val rect2 = solidRect(100, 100, Colors.BLUE).also { it.y = 100.0 }.also { it.zIndex = it.y }
rect1.keys {
down(Key.RETURN) { rect1.zIndex = -rect1.zIndex }
downFrame(Key.UP) { rect1.y--; rect1.zIndex = rect1.y }
downFrame(Key.DOWN) { rect1.y++; rect1.zIndex = rect1.y }
}
}
}
| 464
|
Kotlin
|
123
| 2,497
|
1a565007ab748e00a4d602fcd78f7d4032afaf0b
| 674
|
korge
|
Apache License 2.0
|
app/src/main/java/com/tmvlg/smsreceiver/data/network/freenumbersapi/onlinesimfree/models/MessagesResponse.kt
|
aifsbei
| 376,591,680
| false
| null |
package com.tmvlg.smsreceiver.data.network.freenumbersapi.onlinesimfree.models
data class MessagesResponse(
val messages: MessagesModel,
val response: Int // 1
)
| 0
|
Kotlin
|
1
| 2
|
ce9a182c23ab33494201dd096966a6690fda8b40
| 171
|
SMS-Receiver
|
MIT License
|
Android/app/src/main/java/com/example/pro_diction/presentation/onboarding/OnBoarding1Activity.kt
|
GDSC-SWU
| 738,141,316
| false
|
{"Kotlin": 373175, "Java": 92597, "Python": 59149, "Jupyter Notebook": 47255, "Dockerfile": 342}
|
package com.example.pro_diction.presentation.onboarding
import android.content.Intent
import android.graphics.Color
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.text.Editable
import android.text.TextWatcher
import android.util.Log
import android.widget.Button
import android.widget.EditText
import android.widget.TextView
import android.widget.Toast
import androidx.activity.OnBackPressedCallback
import com.example.pro_diction.MainActivity
import com.example.pro_diction.R
import com.example.pro_diction.data.ApiPool
import retrofit2.Call
import retrofit2.Response
class OnBoarding1Activity : AppCompatActivity() {
lateinit var editAge : EditText
lateinit var btnNext: Button
lateinit var btnSkip: TextView
private val patchAgeService = ApiPool.patchAge
private val getMyPage = ApiPool.getMyPage
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_on_boarding1)
editAge = findViewById(R.id.edit_onboarding_1)
btnNext = findViewById<Button>(R.id.btn_onboarding_1)
btnSkip = findViewById(R.id.tv_skip)
btnNext.setBackgroundResource(R.drawable.bg_background_round)
btnNext.setTextColor(Color.parseColor("#B9B9B9"))
btnNext.isClickable = false
//getMyPage.getMypage().enqueue()
addOnBackPressedCallback()
editAge.addTextChangedListener(object: TextWatcher {
override fun beforeTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {
// 텍스트 변경 전에 수행할 작업
}
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
// 텍스트 변경 중에 수행할 작업
}
override fun afterTextChanged(s: Editable?) {
// 텍스트 변경 후에 수행할 작업
updateButtonState(s.toString(), btnNext)
}
})
btnNext.setOnClickListener {
Log.e("btnNext", "click")
if (editAge.text.toString().toInt() > 0 && editAge.text.toString().toInt() <= 110) {
patchAgeService.patchAge(editAge.text.toString().toInt()).enqueue(object : retrofit2.Callback<Int> {
override fun onResponse(call: Call<Int>, response: Response<Int>) {
if (response.isSuccessful) {
response.body()?.let {
Log.e("data", response.body().toString())
val intent = Intent(this@OnBoarding1Activity, OnBoarding2Activity::class.java)
startActivity(intent)
}
}
}
override fun onFailure(call: Call<Int>, t: Throwable) {
Toast.makeText(this@OnBoarding1Activity , "나이를 저장하지 못했습니다.", Toast.LENGTH_SHORT).show()
}
})
}
else {
Toast.makeText(this , "올바른 나이를 입력하세요.", Toast.LENGTH_SHORT).show()
Log.e("btnNext", "올바른 나이를 입력하세요.")
}
}
btnSkip.setOnClickListener {
val intent = Intent(this, MainActivity::class.java)
startActivity(intent)
}
}
private fun updateButtonState(text: String, button: Button) {
if (text.isNotEmpty()) {
// EditText에 값이 있을 때 버튼의 색상과 텍스트 변경
button.setBackgroundResource(R.drawable.bg_background_round_on)
button.setTextColor(Color.parseColor("#E8ECEF"))
button.isEnabled = true
} else {
// EditText에 값이 없을 때 버튼을 초기 상태로 변경
button.setBackgroundResource(R.drawable.bg_background_round)
button.setTextColor(Color.parseColor("#B9B9B9"))
button.isClickable = false
}
}
private fun addOnBackPressedCallback() {
val callback = object : OnBackPressedCallback(true) {
override fun handleOnBackPressed() {
// 뒤로 가기 버튼이 눌렸을 때 처리 동작
}
}
this.onBackPressedDispatcher.addCallback(this, callback)
}
private fun patchAgeApi() {
}
}
| 0
|
Kotlin
|
0
| 1
|
51ced1607b5336ce33becce66f408d53c7e3358e
| 4,235
|
2024-ProDiction-SolutionChallenge
|
MIT License
|
litfass-server/src/main/kotlin/lit/fass/server/script/ScriptEngine.kt
|
aemaem
| 158,592,240
| false
| null |
package lit.fass.server.script
/**
* @author Michael Mair
*/
interface ScriptEngine {
fun isApplicable(language: ScriptLanguage): Boolean
fun invoke(script: String, data: Collection<Map<String, Any?>>): Collection<Map<String, Any?>>
}
| 4
|
Kotlin
|
0
| 2
|
da65a02b080174e749e78e8cce178b29f14f3545
| 245
|
litfass
|
MIT License
|
app/src/main/java/com/example/tambolaGame/models/UserDevice.kt
|
pranmar93
| 266,756,980
| false
| null |
package com.example.tambolaGame.models
import com.example.tambolaGame.utils.RoleEnums
data class UserDevice (
var userId: Int,
var userName: String?,
var endpointID: String?,
var phone: String?,
var walletMoney: Int = 0,
var userRole: Enum<RoleEnums>
)
| 0
|
Kotlin
|
0
| 1
|
ee93c61b85b896a3745fc2acd9d9e058eaef4224
| 278
|
TambolaGame
|
MIT License
|
data/slack-jackson-dto-test-extensions/src/main/kotlin/io/hndrs/slack/api/contract/jackson/group/chat/ChatDeleteExtensions.kt
|
hndrs
| 168,710,332
| false
| null |
package io.hndrs.slack.api.contract.jackson.group.chat
import io.hndrs.slack.api.contract.jackson.common.InstantSample
fun ChatDeleteRequest.Companion.sample(): ChatDeleteRequest {
return ChatDeleteRequest("", InstantSample.sample(), false)
}
fun SuccessfulChatDeleteResponse.Companion.sample(): SuccessfulChatDeleteResponse {
return SuccessfulChatDeleteResponse(true, "", InstantSample.sample())
}
fun ErrorChatDeleteResponse.Companion.sample(): ErrorChatDeleteResponse {
return ErrorChatDeleteResponse(false, "")
}
| 57
| null |
13
| 16
|
89c5a6ddd0cbac522dd9cd4324901bf2907369a8
| 533
|
slack-spring-boot-starter
|
MIT License
|
composeApp/src/commonMain/kotlin/wear/WearSyncService.kt
|
thaapasa
| 702,418,399
| false
|
{"Kotlin": 476702, "Swift": 661, "Shell": 262}
|
package fi.tuska.beerclock.wear
import fi.tuska.beerclock.bac.BacStatus
import fi.tuska.beerclock.drinks.DrinkRecordInfo
import fi.tuska.beerclock.drinks.DrinkService
import fi.tuska.beerclock.drinks.DrinkTimeService
import fi.tuska.beerclock.logging.getLogger
import fi.tuska.beerclock.settings.GlobalUserPreferences
import kotlinx.datetime.Clock
import org.koin.core.component.KoinComponent
import org.koin.core.component.get
private val logger = getLogger("WearSync")
class WearSyncService(private val drinkService: DrinkService) : KoinComponent {
private val times = DrinkTimeService()
private val prefs: GlobalUserPreferences = get()
suspend fun getCurrentBacStatus(preloadedDrinks: List<DrinkRecordInfo>?): CurrentBacStatus {
val today = times.currentDrinkDay()
val dayStart = times.dayStartTime(today)
val drinks = preloadedDrinks ?: drinkService.getDrinksForHomeScreen(today)
val bacStatus = BacStatus(drinks, today)
val dailyUnits = drinks.filter { it.time >= dayStart }.sumOf { it.units() }
val now = Clock.System.now()
return CurrentBacStatus(
locale = prefs.prefs.locale?.locale,
time = now,
dailyUnits = dailyUnits,
dayEndTime = times.dayEndTime(today),
maxDailyUnits = prefs.prefs.maxDailyUnits,
alcoholGrams = bacStatus.atTime(now).alcoholGrams,
volumeOfDistribution = prefs.prefs.volumeOfDistribution,
maxBac = prefs.prefs.maxBac
)
}
suspend fun sendStatusToWatch(preloadedDrinks: List<DrinkRecordInfo>? = null) {
if (!isWatchSupported()) {
logger.debug("Watch not supported, skipping status sync")
return
}
val status = getCurrentBacStatus(preloadedDrinks)
sendCurrentBacStatusToWatch(status)
}
}
| 1
|
Kotlin
|
0
| 2
|
ed954c500564d21d482609d62ff9b4178f4d6f64
| 1,859
|
beerclock
|
Apache License 2.0
|
app/src/main/kotlin/com/rebbit/app/store/stores.kt
|
jrobinson3k1
| 134,347,957
| false
|
{"Kotlin": 77892}
|
package com.rebbit.app.store
import android.content.SharedPreferences
import java.util.*
private const val KEY_UUID = "uuid"
private const val KEY_ACCESS_TOKEN = "access_token"
private const val KEY_EXPIRES_IN = "expires_in"
private const val KEY_EXPIRE_TIME = "expire_time"
class TokenStore(private val sharedPrefs: SharedPreferences) {
var uuid: String
private set(value) = sharedPrefs.saveString(KEY_UUID, value)
get() = sharedPrefs.getString(KEY_UUID) ?: UUID.randomUUID().toString().also { uuid = it }
var accessToken: String?
private set(value) = sharedPrefs.saveString(KEY_ACCESS_TOKEN, value)
get() = sharedPrefs.getString(KEY_ACCESS_TOKEN)
var expiresIn: Long
private set(value) = sharedPrefs.saveLong(KEY_EXPIRES_IN, value)
get() = sharedPrefs.getLong(KEY_EXPIRES_IN)
var expiresTime: Long
private set(value) = sharedPrefs.saveLong(KEY_EXPIRE_TIME, value)
get() = sharedPrefs.getLong(KEY_EXPIRE_TIME)
fun putAccessToken(accessToken: String, expiresIn: Long) {
this.accessToken = accessToken
this.expiresIn = expiresIn
this.expiresTime = System.currentTimeMillis() + expiresIn
}
fun isExpired() = System.currentTimeMillis() >= expiresTime
}
class UserStore(private val sharedPrefs: SharedPreferences) {
}
private fun SharedPreferences.saveString(key: String, value: String?) = edit().putString(key, value).apply()
@Suppress("EXTENSION_SHADOWED_BY_MEMBER")
private fun SharedPreferences.getString(key: String, defValue: String? = null): String? = getString(key, defValue)
private fun SharedPreferences.saveLong(key: String, value: Long) = edit().putLong(key, value).apply()
@Suppress("EXTENSION_SHADOWED_BY_MEMBER")
private fun SharedPreferences.getLong(key: String, defValue: Long = 0): Long = getLong(key, defValue)
| 0
|
Kotlin
|
0
| 0
|
e9bd1d69e83a5a07bb6194f4792e046fa7e51a2c
| 1,856
|
ribbit
|
Apache License 2.0
|
feature/profile/src/main/java/com/summit/profile/di/ProfileComponent.kt
|
cesarwillymc
| 326,488,032
| false
| null |
package com.summit.profile.di
import com.summit.core.di.CoreComponent
import com.summit.core.di.scope.FeatureScope
import com.summit.profile.ProfileFragment
import dagger.Component
@FeatureScope
@Component(
modules = [ProfileModule::class],
dependencies = [CoreComponent::class]
)
interface ProfileComponent {
fun inject(fragment:ProfileFragment)
}
| 0
|
Kotlin
|
0
| 2
|
9583792cfc3832bdc5b76584ff90a741f4b87458
| 362
|
AddFast
|
Apache License 2.0
|
app/src/main/java/com/gorkem/whatzzup/domain/use_case/user_use_case/is_user_logged_in/IsUserLoggedInUseCase.kt
|
Gorkzcan
| 659,447,834
| false
| null |
package com.gorkem.whatzzup.domain.use_case.user_use_case.is_user_logged_in
import com.google.firebase.auth.FirebaseUser
import com.gorkem.whatzzup.domain.repository.FirebaseRepository
import javax.inject.Inject
class IsUserLoggedInUseCase @Inject constructor(private val repository: FirebaseRepository) {
operator fun invoke() : FirebaseUser? = repository.getCurrentUser()
}
| 0
|
Kotlin
|
0
| 0
|
6c4818b741bea6c50217092afbc49c5c176856e0
| 382
|
WhatzzUp
|
Apache License 2.0
|
cloud-functions/src/testFixtures/kotlin/io/ashdavies/cloud/TestHttpClient.kt
|
ashdavies
| 36,688,248
| false
| null |
package io.ashdavies.cloud
import io.ktor.client.HttpClient
import io.ktor.client.HttpClientConfig
import io.ktor.client.plugins.contentnegotiation.ContentNegotiation
import io.ktor.client.plugins.defaultRequest
import io.ktor.client.plugins.logging.LogLevel
import io.ktor.client.plugins.logging.Logger
import io.ktor.client.plugins.logging.Logging
import io.ktor.serialization.kotlinx.json.json
private object SystemOutLogger : Logger {
override fun log(message: String) = println(message)
}
public fun TestHttpClient(url: String, block: HttpClientConfig<*>.() -> Unit = { }): HttpClient {
return TestHttpClient {
defaultRequest { url(url) }
block()
}
}
public fun TestHttpClient(block: HttpClientConfig<*>.() -> Unit = { }): HttpClient {
return HttpClient {
install(ContentNegotiation) { json() }
install(Logging) {
logger = SystemOutLogger
level = LogLevel.HEADERS
}
block()
}
}
| 1
|
Kotlin
|
33
| 110
|
4a7106fd847db2d3fec8962ea1c038695ddc3b1f
| 981
|
playground.ashdavies.dev
|
Apache License 2.0
|
app/src/main/java/com/cyberfanta/desafiobetterfly/models/character/character.kt
|
cyberfanta
| 372,712,453
| false
| null |
package com.cyberfanta.desafiobetterfly.models.character
import com.google.gson.annotations.SerializedName
//data class Origin1(
//
// @field:SerializedName("name")
// val name: String? = null,
//
// @field:SerializedName("url")
// val url: String? = null
//)
data class Character(
@field:SerializedName("results")
val results: List<CharacterDetail?>? = null,
@field:SerializedName("info")
val info: Info1? = null
)
//data class ResultsItem1(
//
// @field:SerializedName("image")
// val image: String? = null,
//
// @field:SerializedName("gender")
// val gender: String? = null,
//
// @field:SerializedName("species")
// val species: String? = null,
//
// @field:SerializedName("created")
// val created: String? = null,
//
// @field:SerializedName("origin")
// val origin: Origin1? = null,
//
// @field:SerializedName("name")
// val name: String? = null,
//
// @field:SerializedName("location")
// val location: Location1? = null,
//
// @field:SerializedName("episode")
// val episode: List<String?>? = null,
//
// @field:SerializedName("id")
// val id: Int? = null,
//
// @field:SerializedName("type")
// val type: String? = null,
//
// @field:SerializedName("url")
// val url: String? = null,
//
// @field:SerializedName("status")
// val status: String? = null
//)
//
//data class Location1(
//
// @field:SerializedName("name")
// val name: String? = null,
//
// @field:SerializedName("url")
// val url: String? = null
//)
data class Info1(
@field:SerializedName("next")
val next: String? = null,
@field:SerializedName("pages")
val pages: Int? = null,
@field:SerializedName("prev")
val prev: String? = null,
@field:SerializedName("count")
val count: Int? = null
)
| 0
|
Kotlin
|
0
| 0
|
c66a3ab3582037c36ee5b2d7a83f3f704e52b597
| 1,690
|
DesafioBetterfly
|
Apache License 2.0
|
generalAdapter/src/main/java/com/haizo/generaladapter/listitems/MockListItem.kt
|
haizo-code
| 274,850,005
| false
| null |
package com.haizo.generaladapter.listitems
import com.haizo.generaladapter.MainViewHolderContracts
import com.haizo.generaladapter.model.ListItem
import com.haizo.generaladapter.model.ViewHolderContract
class MockListItem constructor(val id: String) : ListItem {
override fun itemUniqueIdentifier() = id
override fun areContentsTheSame(newItem: ListItem) = true
override val viewHolderContract: ViewHolderContract = MainViewHolderContracts.NONE
}
| 0
|
Kotlin
|
4
| 24
|
301dfd8b6bda7a2408cfd319439ebbf41baf534f
| 460
|
blender
|
Apache License 2.0
|
core-db/src/main/java/io/novafoundation/nova/core_db/dao/GovernanceDAppsDao.kt
|
novasamatech
| 415,834,480
| false
|
{"Kotlin": 8137060, "Java": 14723, "JavaScript": 425}
|
package io.novafoundation.nova.core_db.dao
import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import androidx.room.Transaction
import androidx.room.Update
import io.novafoundation.nova.common.utils.CollectionDiffer
import io.novafoundation.nova.core_db.model.GovernanceDAppLocal
import kotlinx.coroutines.flow.Flow
@Dao
abstract class GovernanceDAppsDao {
@Transaction
open suspend fun update(newDapps: List<GovernanceDAppLocal>) {
val oldDapps = getAll()
val dappDiffs = CollectionDiffer.findDiff(newDapps, oldDapps, false)
deleteDapps(dappDiffs.removed)
updateDapps(dappDiffs.updated)
insertDapps(dappDiffs.added)
}
@Query("SELECT * FROM governance_dapps")
abstract fun getAll(): List<GovernanceDAppLocal>
@Query("SELECT * FROM governance_dapps WHERE chainId = :chainId")
abstract fun observeChainDapps(chainId: String): Flow<List<GovernanceDAppLocal>>
@Delete
abstract suspend fun deleteDapps(dapps: List<GovernanceDAppLocal>)
@Insert(onConflict = OnConflictStrategy.ABORT)
abstract suspend fun insertDapps(dapps: List<GovernanceDAppLocal>)
@Update
abstract suspend fun updateDapps(dapps: List<GovernanceDAppLocal>)
}
| 12
|
Kotlin
|
6
| 9
|
618357859a4b7af95391fc0991339b78aff1be82
| 1,319
|
nova-wallet-android
|
Apache License 2.0
|
internal/src/main/java/com/affise/attribution/internal/callback/AffiseResult.kt
|
affise
| 496,592,599
| false
|
{"Kotlin": 859274, "JavaScript": 39328, "HTML": 33916}
|
package com.affise.attribution.internal.callback
interface AffiseResult {
fun success(data: Any?)
fun error(error: String)
fun notImplemented()
}
| 0
|
Kotlin
|
0
| 5
|
ab7d393c6583208e33cef9e10e01ba9dd752bbcb
| 158
|
sdk-android
|
MIT License
|
app/src/main/java/com/example/locationalarm/Alarm.kt
|
442-location-alarm
| 179,593,215
| false
| null |
package com.example.locationalarm
import android.os.Parcel
import android.os.Parcelable
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.Ignore
import androidx.room.PrimaryKey
import java.util.*
@Entity(tableName = "alarms")
class Alarm(name: String, location: String, radius: Double, alert: String, latitude: Double, longitude: Double) : Parcelable {
@PrimaryKey
var uid: String = UUID.randomUUID().toString()
var name: String = name
var location: String = location
var latitude: Double = latitude
var longitude: Double = longitude
var radius: Double = radius
var alert: String = alert
var active: Boolean = true
@ColumnInfo(name = "creation_date")
var creationDate: Long = System.currentTimeMillis()
companion object CREATOR: Parcelable.Creator<Alarm> {
override fun newArray(size: Int): Array<Alarm?> {
return arrayOfNulls(size)
}
override fun createFromParcel(source: Parcel): Alarm {
return Alarm(source)
}
}
override fun equals(other: Any?): Boolean {
if (other == null) {
return false
}
if (javaClass != other.javaClass) {
return false
}
val otherAlarm = other as Alarm
return uid == otherAlarm.uid
&& name == otherAlarm.name
&& location == otherAlarm.location
&& radius == otherAlarm.radius
&& alert == otherAlarm.alert
&& active == otherAlarm.active
&& creationDate == otherAlarm.creationDate
&& latitude == otherAlarm.latitude
&& longitude == otherAlarm.longitude
}
override fun hashCode(): Int {
return Objects.hash(uid, name, location, radius, alert, active, creationDate, latitude, longitude)
}
fun enable() {
// TODO: Joy add stuff here
active = true
}
fun disable() {
// TODO: Joy add stuff here
active = false
}
override fun writeToParcel(dest: Parcel, flags: Int) {
dest.writeString(uid)
dest.writeString(name)
dest.writeString(location)
dest.writeDouble(latitude)
dest.writeDouble(longitude)
dest.writeDouble(radius)
dest.writeString(alert)
dest.writeInt(if (active) 1 else 0)
dest.writeLong(creationDate)
}
override fun describeContents(): Int {
return 0
}
private constructor(uid: String, name: String, location: String , latitude: Double, longitude: Double,
radius: Double, alert: String, active: Boolean, creationDate: Long) :
this(name, location, radius, alert, latitude, longitude) {
this.uid = uid
this.active = active
this.creationDate = creationDate
}
private constructor(source: Parcel) : this(source.readString()!!, source.readString()!!, source.readString()!!,
source.readDouble(), source.readDouble(), source.readDouble(), source.readString()!!,
source.readInt() != 0, source.readLong())
}
| 0
|
Kotlin
|
2
| 0
|
6b2798fae06e27b9250509e1d425a4d597d9b7e2
| 3,155
|
location-alarm
|
MIT License
|
simplecolorpicker/src/main/java/com/zzz1zzz/simplecolorpicker/data/ColorsDataSource.kt
|
zaferertas
| 610,427,002
| false
| null |
package com.zzz1zzz.simplecolorpicker.data
import android.content.Context
import org.json.JSONObject
internal class ColorsDataSource(private val context: Context?) {
private lateinit var mColorMap: Map<String, MutableList<String>>
fun getColors(tone: String): List<String> {
if (!::mColorMap.isInitialized) {
mColorMap = getColorsFromAsset(context)
}
return mColorMap[tone] ?: emptyList()
}
private fun getColorsFromAsset(context: Context?): HashMap<String, MutableList<String>> {
val colorsMap = HashMap<String, MutableList<String>>()
val file = readAssetFile(context)
file?.let {
val jsonObject = JSONObject(it)
for (key in jsonObject.keys()) {
val jsonArray = jsonObject.getJSONArray(key)
val colorsList = mutableListOf<String>()
for (i in 0 until jsonArray.length()) {
val color = jsonArray.getString(i)
colorsList.add(color)
}
colorsMap[key] = colorsList
}
}
return colorsMap
}
private fun readAssetFile(context: Context?): String? {
return context?.assets?.open("material-colors.json")
?.bufferedReader().use { reader->
reader?.readText()
}
}
}
| 0
|
Kotlin
|
0
| 1
|
1ca3506ab9c072c8d30004d9e602c3be408200f0
| 1,366
|
simplecolorpicker
|
Apache License 2.0
|
idea/testData/refactoring/changeSignature/GetConventionRemoveParameterAfter.kt
|
JakeWharton
| 99,388,807
| false
| null |
class A {
operator fun get(i: Int) {}
}
fun usage(a: A) {
a[42]
A()[42]
a.get(42)
}
| 0
| null |
28
| 83
|
4383335168338df9bbbe2a63cb213a68d0858104
| 100
|
kotlin
|
Apache License 2.0
|
features/shopping_lists/src/main/kotlin/gq/kirmanak/mealient/shopping_lists/ui/list/ShoppingListsScreen.kt
|
kirmanak
| 431,195,533
| false
|
{"Kotlin": 476781}
|
package gq.kirmanak.mealient.shopping_lists.ui.list
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.items
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ShoppingCart
import androidx.compose.material3.Card
import androidx.compose.material3.Icon
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.navigation.NavController
import com.ramcosta.composedestinations.annotation.Destination
import com.ramcosta.composedestinations.navigation.navigate
import gq.kirmanak.mealient.datasource.models.GetShoppingListsSummaryResponse
import gq.kirmanak.mealient.shopping_list.R
import gq.kirmanak.mealient.shopping_lists.ui.composables.getErrorMessage
import gq.kirmanak.mealient.shopping_lists.ui.destinations.ShoppingListScreenDestination
import gq.kirmanak.mealient.ui.AppTheme
import gq.kirmanak.mealient.ui.Dimens
import gq.kirmanak.mealient.ui.components.BaseScreenState
import gq.kirmanak.mealient.ui.components.BaseScreenWithNavigation
import gq.kirmanak.mealient.ui.components.LazyColumnWithLoadingState
import gq.kirmanak.mealient.ui.preview.ColorSchemePreview
import gq.kirmanak.mealient.ui.util.error
@Destination
@Composable
fun ShoppingListsScreen(
navController: NavController,
baseScreenState: BaseScreenState,
shoppingListsViewModel: ShoppingListsViewModel = hiltViewModel(),
) {
val loadingState by shoppingListsViewModel.loadingState.collectAsState()
val errorToShowInSnackbar = shoppingListsViewModel.errorToShowInSnackBar
BaseScreenWithNavigation(
baseScreenState = baseScreenState,
) { modifier ->
LazyColumnWithLoadingState(
modifier = modifier,
loadingState = loadingState,
emptyListError = loadingState.error?.let { getErrorMessage(it) }
?: stringResource(R.string.shopping_lists_screen_empty),
retryButtonText = stringResource(id = R.string.shopping_lists_screen_empty_button_refresh),
snackbarText = errorToShowInSnackbar?.let { getErrorMessage(error = it) },
onSnackbarShown = shoppingListsViewModel::onSnackbarShown,
onRefresh = shoppingListsViewModel::refresh
) { items ->
items(items) { shoppingList ->
ShoppingListCard(
shoppingList = shoppingList,
onItemClick = { clickedEntity ->
val shoppingListId = clickedEntity.id
navController.navigate(ShoppingListScreenDestination(shoppingListId))
}
)
}
}
}
}
@Composable
@ColorSchemePreview
private fun PreviewShoppingListCard() {
AppTheme {
ShoppingListCard(
shoppingList = GetShoppingListsSummaryResponse("1", "Weekend shopping"),
)
}
}
@Composable
private fun ShoppingListCard(
shoppingList: GetShoppingListsSummaryResponse?,
modifier: Modifier = Modifier,
onItemClick: (GetShoppingListsSummaryResponse) -> Unit = {},
) {
Card(
modifier = modifier
.padding(horizontal = Dimens.Medium, vertical = Dimens.Small)
.fillMaxWidth()
.clickable { shoppingList?.let { onItemClick(it) } },
) {
Row(
modifier = Modifier.padding(Dimens.Medium),
verticalAlignment = Alignment.CenterVertically,
) {
Icon(
imageVector = Icons.Default.ShoppingCart,
contentDescription = stringResource(id = R.string.shopping_lists_screen_cart_icon),
modifier = Modifier.height(Dimens.Large),
)
Text(
text = shoppingList?.name.orEmpty(),
modifier = Modifier.padding(start = Dimens.Medium),
)
}
}
}
| 16
|
Kotlin
|
2
| 99
|
85d03124208f0b94341cd6ce45ba98cb6b58ddab
| 4,332
|
Mealient
|
MIT License
|
service_notification/src/main/kotlin/com/angus/service_notification/domain/usecases/IRegisterTokenUseCase.kt
|
SantiagoFlynnUTN
| 770,562,894
| false
|
{"Kotlin": 2180342, "Swift": 3954, "HTML": 3900, "Ruby": 2543, "Dockerfile": 1994, "Shell": 912}
|
package com.angus.service_notification.domain.usecases
import org.koin.core.annotation.Single
import com.angus.service_notification.domain.entity.InternalServerErrorException
import com.angus.service_notification.domain.gateway.IDatabaseGateway
import com.angus.service_notification.endpoints.TOKEN_NOT_REGISTERED
interface IRegisterTokenUseCase {
suspend fun saveToken(userId: String, token: String): Boolean
suspend fun getUserTokens(id: String): List<String>
suspend fun getAllUsersTokens(ids: List<String>): List<String>
}
@Single
class RegisterTokenUseCase(
private val databaseGateway: IDatabaseGateway
) : IRegisterTokenUseCase {
override suspend fun saveToken(userId: String, token: String): Boolean {
val result = databaseGateway.registerToken(userId, token)
return if (!result) {
throw InternalServerErrorException(TOKEN_NOT_REGISTERED)
} else {
true
}
}
override suspend fun getUserTokens(id: String): List<String> {
return databaseGateway.getUserTokens(id)
}
override suspend fun getAllUsersTokens(ids: List<String>): List<String> {
return databaseGateway.getUsersTokens(ids)
}
}
| 0
|
Kotlin
|
0
| 0
|
ff70c0c2ed16084f0867be5e391ee3749aa053b7
| 1,213
|
AngusBrotherKMP
|
Apache License 2.0
|
merriamwebster_thesaurus/src/main/java/space/narrate/waylan/merriamwebster_thesaurus/ui/MerriamWebsterThesaurusModel.kt
|
narrate-co
| 171,908,990
| false
| null |
package space.narrate.waylan.merriamwebster_thesaurus.ui
import space.narrate.waylan.core.data.firestore.users.User
import space.narrate.waylan.core.data.firestore.users.UserAddOn
import space.narrate.waylan.core.data.firestore.users.remainingDays
import space.narrate.waylan.core.data.firestore.users.state
import space.narrate.waylan.core.details.DetailItemModel
import space.narrate.waylan.core.details.DetailItemType
import space.narrate.waylan.merriamwebster_thesaurus.data.local.ThesaurusEntry
/**
* Merriam-Webster Thesaurus' [DetailItemModel] which is used to construct a DetailItemViewHolder
* that is able to be displayed by the details screen.
*/
class MerriamWebsterThesaurusModel(
val entries: List<ThesaurusEntry>,
val userAddOn: UserAddOn?
) : DetailItemModel() {
override val itemType: DetailItemType = DetailItemType.MERRIAM_WEBSTER_THESAURUS
override fun isSameAs(newOther: DetailItemModel): Boolean {
if (newOther !is MerriamWebsterThesaurusModel) return false
return entries == newOther.entries && userAddOn == newOther.userAddOn
}
override fun isContentSameAs(newOther: DetailItemModel): Boolean {
if (newOther !is MerriamWebsterThesaurusModel) return false
return entries.toTypedArray().contentDeepEquals(newOther.entries.toTypedArray())
&& userAddOn?.state == newOther.userAddOn?.state
&& userAddOn?.remainingDays == newOther.userAddOn?.remainingDays
}
}
| 25
| null |
1
| 14
|
c5640fb3bab994fd2c78cabd83fa962fbff75911
| 1,470
|
waylan_android
|
Apache License 2.0
|
calendar/src/commonMain/kotlin/in/procyk/compose/calendar/day/DayState.kt
|
avan1235
| 705,304,457
| false
|
{"Kotlin": 127307}
|
/**
* Based on ComposeCalendar by <NAME> from [Github](https://github.com/boguszpawlowski/ComposeCalendar)
*
* 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 `in`.procyk.compose.calendar.day
import androidx.compose.runtime.Stable
import `in`.procyk.compose.calendar.selection.EmptySelectionState
import `in`.procyk.compose.calendar.selection.SelectionState
typealias NonSelectableDayState = DayState<EmptySelectionState>
/**
* Contains information about current selection as well as date of rendered day
*/
@Stable
data class DayState<T : SelectionState>(
private val day: Day,
val selectionState: T,
) : Day by day
| 2
|
Kotlin
|
2
| 5
|
2fc68477b04df7a563193b6eab3e67af9eb042ec
| 1,148
|
compose-extensions
|
MIT License
|
sdk-kotlin/src/main/kotlin/org/sinou/pydia/sdk/utils/PathUtils.kt
|
bsinou
| 434,248,316
| false
|
{"Kotlin": 2133584, "Java": 10237}
|
package org.sinou.pydia.sdk.utils
//object PathUtils {
// Rather use extension functions on the StateID Object
// fun getWorkspace(path: String?): String? {
// return if (path == null || "" == path || "/" == path) {
// null
// } else path.substring(1).split("/".toRegex()).dropLastWhile { it.isEmpty() }
// .toTypedArray()[0]
// }
//
// fun getFile(path: String?): String? {
// if (path == null || "" == path) { // || "/".equals(path)) {
// return null
// }
// val prefix = "/" + getWorkspace(path)
// if (path.length > prefix.length) {
// return path.substring(prefix.length)
// } else if (path.length == prefix.length) {
// // we only have the workspace, so we consider we are at root of the workspace
// return "/"
// }
// return null
// }
//
// fun getPath(ws: String, file: String?): String? {
// var path: String? = "/$ws"
// if (Str.notEmpty(file)) {
// path += file
// }
// return path
// }
//}
| 0
|
Kotlin
|
0
| 1
|
51a128c49a24eedef1baf2d4f295f14aa799b5d3
| 1,090
|
pydia
|
Apache License 2.0
|
data/src/main/java/com/dominate/caravan/medule/addads/AddCommercialAdsModel.kt
|
NoorAlnajjar1993
| 720,250,705
| false
|
{"Gradle": 5, "Java Properties": 7, "Shell": 1, "Text": 20, "Batchfile": 1, "Markdown": 1, "Proguard": 2, "Kotlin": 155, "XML": 709, "JSON": 154, "Java": 501, "Motorola 68K Assembly": 12, "SQL": 6, "INI": 4, "Ignore List": 1}
|
package com.dominate.caravan.medule.addads
import android.os.Parcelable
import kotlinx.android.parcel.Parcelize
import kotlinx.android.parcel.RawValue
import okhttp3.MultipartBody
@Parcelize
data class AddCommercialAdsModel(
val type_id: String,
val typeOfAds: String,
var title: String?=null,
var description: String?=null,
var property_ownership: String?=null,
var installment_payment: Boolean?=null,
var price: String?=null,
var region: String?=null,
var phone_number: String?=null,
var whatsapp: String?=null,
var lat: String?=null,
var long: String?=null,
var is_the_location_approximate: Boolean?=null,
var media:@RawValue List<MultipartBody.Part>?=null,
var street: String?=null,
): Parcelable
| 0
|
Java
|
0
| 0
|
909f22dbfea3d01cbd10529248763f0fceddf7f0
| 764
|
caravan
|
MIT License
|
plugins/kotlin/idea/tests/testData/refactoring/inline/namedFunction/namedArguments.kt
|
JetBrains
| 2,489,216
| false
|
{"Text": 9788, "INI": 517, "YAML": 423, "Ant Build System": 11, "Batchfile": 34, "Dockerfile": 10, "Shell": 633, "Markdown": 750, "Ignore List": 141, "Git Revision List": 1, "Git Attributes": 11, "EditorConfig": 260, "XML": 7904, "SVG": 4537, "Kotlin": 60205, "Java": 84268, "HTML": 3803, "Java Properties": 217, "Gradle": 462, "Maven POM": 95, "JavaScript": 232, "CSS": 79, "JSON": 1436, "JFlex": 33, "Makefile": 5, "Diff": 137, "XSLT": 113, "Gradle Kotlin DSL": 735, "Groovy": 3102, "desktop": 1, "JAR Manifest": 17, "PHP": 47, "Microsoft Visual Studio Solution": 2, "C#": 33, "Smalltalk": 17, "Erlang": 1, "Perl": 9, "Jupyter Notebook": 13, "Rich Text Format": 2, "AspectJ": 2, "HLSL": 2, "Objective-C": 15, "CoffeeScript": 2, "HTTP": 2, "JSON with Comments": 73, "GraphQL": 127, "Nginx": 1, "HAProxy": 1, "OpenStep Property List": 47, "Python": 17095, "C": 110, "C++": 42, "Protocol Buffer": 3, "fish": 2, "PowerShell": 3, "Go": 36, "Prolog": 2, "ColdFusion": 2, "Turtle": 2, "TeX": 11, "HCL": 4, "F#": 1, "GLSL": 1, "Elixir": 2, "Ruby": 4, "XML Property List": 85, "E-mail": 18, "Roff": 289, "Roff Manpage": 40, "Swift": 3, "TOML": 196, "Checksums": 49, "Java Server Pages": 11, "Vue": 1, "Dotenv": 1, "reStructuredText": 67, "SQL": 1, "Vim Snippet": 8, "AMPL": 4, "Linux Kernel Module": 1, "CMake": 15, "Handlebars": 1, "Rust": 20, "Go Checksums": 1, "Go Module": 1, "NSIS": 8, "PlantUML": 6, "SCSS": 2, "Thrift": 3, "Cython": 13, "Regular Expression": 3, "JSON5": 4, "OASv3-json": 3, "OASv3-yaml": 1}
|
interface I {
fun oldFun(option1: String = "", option2: Int = 0, option3: Int = -1) {
newFun(option1, option2, option3, null)
}
fun newFun(option1: String = "", option2: Int = 0, option3: Int = -1, option4: String? = "x")
}
fun foo(i: I) {
i.oldF<caret>un(option2 = 1)
}
| 1
| null |
1
| 1
|
0d546ea6a419c7cb168bc3633937a826d4a91b7c
| 296
|
intellij-community
|
Apache License 2.0
|
project/jimmer-sql-kotlin/src/test/kotlin/org/babyfish/jimmer/sql/kt/model/Author.kt
|
ZhuMubo
| 576,843,756
| true
|
{"Markdown": 24, "Text": 1, "Ignore List": 6, "JSON": 2, "Gradle": 8, "Shell": 10, "Batchfile": 8, "Java": 807, "Kotlin": 333, "SQL": 10, "YAML": 11, "INI": 11, "JavaScript": 4, "JSON with Comments": 1, "MDX": 73, "TSX": 3, "CSS": 3, "Gradle Kotlin DSL": 16, "HTML": 2, "GraphQL": 2}
|
package org.babyfish.jimmer.sql.kt.model
import org.babyfish.jimmer.sql.*
import javax.validation.constraints.NotBlank
@Entity
interface Author {
@Id
val id: Long
@Key
val firstName: @NotBlank String
@Key
val lastName: @NotBlank String
val fullName: String
get() = "$firstName $lastName"
val gender: Gender
@ManyToMany(mappedBy = "authors")
val books: List<Book>
@Transient
val organization: Organization
fun unusedFun() {}
}
| 0
|
Java
|
0
| 0
|
22c34d4192c170e84674fcaf57501784ec54f930
| 495
|
jimmer
|
MIT License
|
Android/app/src/main/java/com/watsalacanoa/secretv2/adapters/ContentAdapter.kt
|
FridaADM
| 147,753,041
| true
|
{"Kotlin": 6553, "F#": 3758, "Rust": 3065, "Java": 1154, "CSS": 143, "Batchfile": 39, "Shell": 39}
|
package com.watsalacanoa.secretv2.adapters
import android.content.Context
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ArrayAdapter
import android.widget.TextView
import com.watsalacanoa.secretv2.R
class Content(mContext: Context, listElements: ArrayList<String>)
: ArrayAdapter<String>(mContext,0, listElements){
private val inflater = mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater
override fun getView(position: Int, convertView: View?, parent: ViewGroup?): View {
val element = getItem(position)
var listItem = convertView
if(listItem == null)
listItem = inflater.inflate(R.layout.post, parent, false)
val contentText = listItem!!.findViewById<TextView>(R.id.content)
contentText.text = element
return listItem
}
}
| 1
|
Kotlin
|
0
| 0
|
80c02c23185c124082d0156fdd80cab61478ed68
| 923
|
secret2
|
MIT License
|
android-applications/truchat-exams-starter/app/src/main/java/io/shortcourse/truchat/view/UsersActivity.kt
|
kevin2-cyber
| 437,880,493
| false
|
{"Kotlin": 765037, "CSS": 301626, "SCSS": 287609, "HTML": 208821, "JavaScript": 16612, "Java": 2758, "TypeScript": 366}
|
package io.shortcourse.truchat.view
import android.os.Bundle
import io.codelabs.sdk.util.debugLog
import io.shortcourse.truchat.R
import io.shortcourse.truchat.core.view.RootActivity
import io.shortcourse.truchat.model.Room
class UsersActivity : RootActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_users)
if (intent.hasExtra(EXTRA_ROOM)) {
debugLog(intent.getParcelableExtra<Room>(EXTRA_ROOM))
}
}
companion object {
const val EXTRA_ROOM = "EXTRA_ROOM"
}
}
| 0
|
Kotlin
|
0
| 1
|
32e38fd6bfe6074f23f6cd630c20d8a53f91156d
| 616
|
ug-short-course
|
MIT License
|
compiler/testData/diagnostics/testsSpec/s-16.30_when-expression/p-3/pos/2.5.kt
|
petukhovv
| 105,522,774
| true
|
{"Kotlin": 28221473, "Java": 7536538, "JavaScript": 153376, "HTML": 64401, "Lex": 18248, "ANTLR": 9797, "IDL": 8755, "Shell": 6769, "CSS": 4679, "Batchfile": 4437, "Groovy": 4358}
|
/*
KOTLIN SPEC TEST (POSITIVE)
SECTION 16.30: When expression
PARAGRAPH: 3
SENTENCE 2: Each entry consists of a boolean condition (or a special else condition), each of which is checked and evaluated in order of appearance.
NUMBER: 5
DESCRIPTION: 'When' without bound value and only one 'else' branch.
*/
// CASE DESCRIPTION: 'When' with only one 'else' branch ('when' used as expression).
fun case_1(): String = when {
else -> ""
}
// CASE DESCRIPTION: 'When' with only one 'else' branch ('when' used as statement).
fun case_2(): String {
when {
else -> {return ""}
}
}
| 1
|
Kotlin
|
1
| 0
|
45c8f0c24b6655580acbdc4e967bbe0cd5763ac0
| 600
|
kotlin
|
Apache License 2.0
|
app/src/main/java/com/amazing/eye/network/RestCreator.kt
|
amazingokc
| 225,336,483
| false
| null |
package com.amazing.eye.network
import com.amazing.eye.BuildConfig
import com.amazing.eye.network.interceptors.Level
import com.amazing.eye.network.interceptors.LoggingInterceptor
import okhttp3.OkHttpClient
import okhttp3.internal.platform.Platform
import retrofit2.Retrofit
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory
import retrofit2.converter.gson.GsonConverterFactory
import java.util.concurrent.TimeUnit
class RestCreator {
private var okHttpClient: OkHttpClient = OkHttpClient.Builder()
.retryOnConnectionFailure(false)
.connectTimeout(15, TimeUnit.SECONDS)
.readTimeout(15, TimeUnit.SECONDS)
.writeTimeout(15, TimeUnit.SECONDS)
.addInterceptor(
LoggingInterceptor.Builder()//构建者模式
.loggable(BuildConfig.DEBUG) //是否开启日志打印
.setLevel(Level.BASIC) //打印的等级
.log(Platform.INFO) // 打印类型
.request("Request") // request的Tag
.response("Response")// Response的Tag
.build()
)
.build()
private var retrofit: Retrofit = Retrofit.Builder()
.baseUrl(RestService.BASE_URL)
.client(okHttpClient)
.addConverterFactory(GsonConverterFactory.create())
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.build()
companion object {
@Volatile
private var instance: RestCreator? = null
fun getInstance(): RestCreator {
if (instance == null) {
synchronized(RestCreator::class) {
if (instance == null) {
instance = RestCreator()
}
}
}
return instance!!
}
}
fun getRestService(): RestService {
return retrofit.create(RestService::class.java)
}
}
| 0
|
Kotlin
|
1
| 4
|
feac6870a45ac08aba85fab8ebd4e438b737d460
| 1,854
|
Eye-kotlin
|
Apache License 2.0
|
kinzhal-annotations/src/commonMain/kotlin/com/daugeldauge/kinzhal/annotations/Annotations.kt
|
daugeldauge
| 405,349,326
| false
|
{"Kotlin": 54444}
|
@file:Suppress("KDocUnresolvedReference")
package com.daugeldauge.kinzhal.annotations
import kotlin.reflect.KClass
/**
* Annotates an interface for which dependency-injected implementation
* is to be generated from a set of [modules]. The generated class will
* have the name of the type annotated with [Component] prepended with
* Kinzhal. For example, `@Component interface AppComponent` will
* produce an implementation named KinzhalAppComponent. All [dependencies]
* will be primary constructor parameters of generated class.
*/
@Retention(AnnotationRetention.SOURCE)
@Target(AnnotationTarget.CLASS)
annotation class Component(val modules: Array<KClass<*>> = [], val dependencies: Array<KClass<*>> = [])
/**
* Equivalent of [javax.inject.Inject]. Only a constructor injection is supported for now
*/
@Retention(AnnotationRetention.SOURCE)
@Target(AnnotationTarget.CONSTRUCTOR)
annotation class Inject
/**
* Equivalent of [javax.inject.Scope]
*/
@Retention(AnnotationRetention.SOURCE)
@Target(AnnotationTarget.ANNOTATION_CLASS)
annotation class Scope
/**
* Equivalent of [javax.inject.Qualifier]
*/
@Retention(AnnotationRetention.SOURCE)
@Target(AnnotationTarget.ANNOTATION_CLASS)
annotation class Qualifier
/**
* Annotates the constructor of a type that will be created via assisted injection.
*
* Note that an assisted injection type cannot be scoped. In addition, assisted injection
* requires the use of a factory annotated with [AssistedFactory].
*/
@Retention(AnnotationRetention.SOURCE)
@Target(AnnotationTarget.CONSTRUCTOR)
annotation class AssistedInject
/**
* Annotates a parameter within an [AssistedInject]-annotated constructor.
*/
@Retention(AnnotationRetention.SOURCE)
@Target(AnnotationTarget.VALUE_PARAMETER)
annotation class Assisted
/**
* Annotates an abstract class or interface used to create an instance of a type via an [AssistedInject] constructor.
*
* An [AssistedFactory]-annotated type must obey the following constraints:
* * The type must be an abstract class or interface,
* * The type must contain exactly one abstract, non-default method whose
* * return type must exactly match the type of an assisted injection type, and
* * parameters must match the exact list of [Assisted] parameters in the assisted
* injection type's constructor (and in the same order)
*/
@Retention(AnnotationRetention.SOURCE)
@Target(AnnotationTarget.CLASS)
annotation class AssistedFactory
| 6
|
Kotlin
|
6
| 69
|
b9bc9c028b19bfbc10c45ec640476d15a09bd677
| 2,455
|
kinzhal
|
Apache License 2.0
|
app/src/main/java/com/nutrition/balanceme/work/RecipesWorker.kt
|
DatTrannn
| 521,896,551
| false
| null |
package com.nutrition.balanceme.work
import android.content.Context
import androidx.hilt.work.HiltWorker
import androidx.work.CoroutineWorker
import androidx.work.WorkerParameters
import androidx.work.workDataOf
import com.nutrition.balanceme.data.local.RecipesDao
import com.nutrition.balanceme.data.local.UserDao
import com.nutrition.balanceme.data.remote.RecipesService
import dagger.assisted.Assisted
import dagger.assisted.AssistedInject
import kotlinx.coroutines.flow.first
@HiltWorker
class RecipesWorker @AssistedInject constructor(
private val userDao: UserDao,
private val recipesDao: RecipesDao,
@Assisted appContext: Context,
@Assisted params: WorkerParameters,
private val recipesService: RecipesService,
) : CoroutineWorker(appContext, params) {
override suspend fun doWork(): Result {
return try {
val id = userDao.getProfile().first().id
val recipes = recipesService.getUserRecipes(id)
recipesDao.addRecipe(*recipes.map { it.type = "PERSONAL"; it }.toTypedArray())
Result.success(workDataOf("status" to "success"))
} catch (e: Throwable) { Result.failure(workDataOf("error" to e.message)) }
}
}
| 0
|
Kotlin
|
0
| 0
|
f51d0276b1d34e00b27b44689aedf80e1580c542
| 1,205
|
BalanceMeApp
|
MIT License
|
app/src/main/java/com/tolodev/artic_gallery/ui/components/screens/home/HomeArtworkList.kt
|
cristh18
| 776,086,718
| false
|
{"Kotlin": 113755}
|
package com.tolodev.artic_gallery.ui.components.screens.home
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.wrapContentHeight
import androidx.compose.foundation.lazy.staggeredgrid.LazyVerticalStaggeredGrid
import androidx.compose.foundation.lazy.staggeredgrid.StaggeredGridCells
import androidx.compose.foundation.lazy.staggeredgrid.items
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.dimensionResource
import com.tolodev.artic_gallery.R
import com.tolodev.artic_gallery.ui.models.UIArtwork
@Composable
fun HomeArtworkList(
paddingValues: PaddingValues,
artworks: List<UIArtwork>,
showArtworkDetail: (Long) -> Unit = {}
) {
LazyVerticalStaggeredGrid(
verticalItemSpacing = dimensionResource(id = R.dimen.spacing_xxsmall),
horizontalArrangement = Arrangement.spacedBy(dimensionResource(id = R.dimen.spacing_xxsmall)),
modifier = Modifier
.fillMaxWidth()
.wrapContentHeight()
.padding(
top = dimensionResource(id = R.dimen.spacing_huge),
bottom = dimensionResource(id = R.dimen.spacing_large),
start = dimensionResource(id = R.dimen.spacing_large),
end = dimensionResource(id = R.dimen.spacing_large)
),
columns = StaggeredGridCells.Fixed(2),
contentPadding = paddingValues
) {
items(artworks) { artwork ->
HomeArtworkItem(uiArtwork = artwork, showArtworkDetail = { showArtworkDetail(it) })
}
}
}
| 0
|
Kotlin
|
0
| 0
|
c8c89e99eacf75f73ad17e4840e8a6a36daa1456
| 1,774
|
ArticGallery
|
MIT License
|
0287-find-the-duplicate-number/0287-find-the-duplicate-number.kt
|
javadev
| 601,623,109
| false
|
{"Kotlin": 549966, "Java": 511}
|
class Solution {
fun findDuplicate(nums: IntArray): Int {
val arr = IntArray(nums.size + 1)
for (num in nums) {
arr[num] += 1
if (arr[num] == 2) {
return num
}
}
return 0
}
}
| 0
|
Kotlin
|
0
| 0
|
55c7493692d92e83ef541dcf6ae2e8db8d906409
| 267
|
leethub
|
MIT License
|
sources/cli/resources/templates/kmp-lib/src@android/Lib.kt
|
JetBrains
| 709,379,874
| false
|
{"Kotlin": 1917051, "Java": 288926, "Shell": 107894, "Batchfile": 66223, "Lex": 16216, "Swift": 14457, "Ruby": 4736, "Dockerfile": 1327}
|
actual class Lib {
actual fun get(): String {
return "Linux World"
}
}
| 0
|
Kotlin
|
30
| 988
|
6a2c7f0b86b36c85e9034f3de9bfe416516b323b
| 87
|
amper
|
Apache License 2.0
|
typescript-kotlin/src/main/kotlin/typescript/ClassifiedSpan2020.kt
|
turansky
| 393,199,102
| false
| null |
// Automatically generated - do not modify!
package typescript
external interface ClassifiedSpan2020 {
/*
textSpan: TextSpan;
classificationType: number;
*/
}
| 0
|
Kotlin
|
1
| 10
|
bcf03704c0e7670fd14ec4ab01dff8d7cca46bf0
| 177
|
react-types-kotlin
|
Apache License 2.0
|
uicomponent/src/main/java/moadgara/uicomponent/custom_view/ToggleableRadioButton.kt
|
YKakdas
| 692,527,114
| false
|
{"Kotlin": 325788}
|
package moadgara.uicomponent.custom_view
import android.content.Context
import android.util.AttributeSet
import androidx.appcompat.widget.AppCompatRadioButton
/**
* This custom radio button class makes radio button to be toggleable, i.e. it can be unchecked if
* it is already checked.
*/
class ToggleableRadioButton constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) :
AppCompatRadioButton(context, attrs, defStyleAttr) {
constructor(context: Context) : this(context, null)
constructor(context: Context, attrs: AttributeSet?) : this(context, attrs, 0)
override fun toggle() {
isChecked = !isChecked
}
}
| 10
|
Kotlin
|
1
| 0
|
e44329db0849502d2e6ae7803c71931c2a426752
| 655
|
NexusNook
|
Apache License 2.0
|
src/main/kotlin/io/github/janbarari/gradle/analytics/domain/model/report/Report.kt
|
janbarari
| 476,835,309
| false
|
{"Kotlin": 1070442, "JavaScript": 403100, "HTML": 64196, "CSS": 6996, "Shell": 1396}
|
/**
* MIT License
* Copyright (c) 2022 Mehdi Janbarari (@janbarari)
*
* 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
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package io.github.janbarari.gradle.analytics.domain.model.report
import com.squareup.moshi.Json
import com.squareup.moshi.JsonAdapter
import com.squareup.moshi.JsonClass
import com.squareup.moshi.Moshi
@JsonClass(generateAdapter = true)
data class Report(
@Json(name = "branch")
val branch: String,
@Json(name = "requested_tasks")
val requestedTasks: String,
@Json(name = "initialization_process_report")
var initializationProcessReport: InitializationProcessReport? = null,
@Json(name = "configuration_process_report")
var configurationProcessReport: ConfigurationProcessReport? = null,
@Json(name = "execution_process_report")
var executionProcessReport: ExecutionProcessReport? = null,
@Json(name = "overall_build_process_report")
var overallBuildProcessReport: OverallBuildProcessReport? = null,
@Json(name = "modules_source_count_report")
var modulesSourceCountReport: ModulesSourceCountReport? = null,
@Json(name = "modules_method_count_report")
var modulesMethodCountReport: ModulesMethodCountReport? = null,
@Json(name = "cache_hit_report")
var cacheHitReport: CacheHitReport? = null,
@Json(name = "success_build_rate_report")
var successBuildRateReport: SuccessBuildRateReport? = null,
@Json(name = "dependency_resolve_process_report")
var dependencyResolveProcessReport: DependencyResolveProcessReport? = null,
@Json(name = "parallel_execution_rate_report")
var parallelExecutionRateReport: ParallelExecutionRateReport? = null,
@Json(name = "modules_execution_process_report")
var modulesExecutionProcessReport: ModulesExecutionProcessReport? = null,
@Json(name = "modules_dependency_graph_report")
var modulesDependencyGraphReport: ModulesDependencyGraphReport? = null,
@Json(name = "redundant_dependency_graph_report")
var redundantDependencyGraphReport: RedundantDependencyGraphReport? = null,
@Json(name = "modules_timeline_report")
var modulesTimelineReport: ModulesTimelineReport? = null,
@Json(name = "build_status_report")
var buildStatusReport: BuildStatusReport? = null,
@Json(name = "modules_build_heatmap_report")
var modulesBuildHeatmapReport: ModulesBuildHeatmapReport? = null,
@Json(name = "non_cacheable_tasks_report")
var nonCacheableTasksReport: NonCacheableTasksReport? = null,
@Json(name = "modules_source_size_report")
var modulesSourceSizeReport: ModulesSourceSizeReport? = null,
@Json(name = "modules_crash_count_report")
var modulesCrashCountReport: ModulesCrashCountReport? = null,
) : java.io.Serializable {
fun toJson(): String {
val moshi: Moshi = Moshi.Builder().build()
val jsonAdapter: JsonAdapter<Report> = ReportJsonAdapter(moshi)
return jsonAdapter.toJson(this)
}
}
| 7
|
Kotlin
|
4
| 143
|
6dfdffd1c3f1fabcb79d6c5a9b6c79739d9de951
| 3,987
|
gradle-analytics-plugin
|
MIT License
|
app/src/main/java/com/dart/campushelper/api/SimplifiedCourseDao.kt
|
founchoo
| 694,453,265
| false
|
{"Kotlin": 325812}
|
package com.dart.campushelper.api
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.Query
import com.dart.campushelper.model.SimplifiedCourse
@Dao
interface SimplifiedCourseDao {
@Query("SELECT * FROM simplified_course_table")
fun getAll(): List<SimplifiedCourse>
@Query("SELECT * FROM simplified_course_table WHERE bigNode = :bigNode")
fun findSimplifiedCourseByBigNode(bigNode: Int): SimplifiedCourse?
@Insert
fun insertAll(vararg simplifiedCourses: SimplifiedCourse)
@Query("DELETE FROM simplified_course_table")
fun deleteAll()
}
| 2
|
Kotlin
|
1
| 7
|
3a2072824b48765e87f3ad9d16b8dd79eef4a4f4
| 595
|
GongYun-for-Android
|
Apache License 2.0
|
vo-project-pattern/src/main/kotlin/br/com/joviniano/restwithspringboot/data/vo/v1/PersonVO.kt
|
Guilherme-Joviniano
| 625,325,525
| false
| null |
package br.com.joviniano.restwithspringboot.data.vo.v1
data class PersonVO (
var id: Long = 0,
var firstName: String = "",
var lastName: String = "",
var address: String = "",
var gender: String = "",
)
| 0
|
Kotlin
|
0
| 1
|
c67c3daa4a8e029375a893732f2336e294beafac
| 223
|
rest-with-spring-boot
|
Apache License 2.0
|
app/src/main/java/com/johnlennonlobo/appilunne/data/AuthDataSource.kt
|
john-lobo
| 382,523,866
| false
| null |
package com.johnlennonlobo.appilunne.data
import com.google.firebase.auth.FirebaseAuth
import com.google.firebase.auth.FirebaseAuthInvalidCredentialsException
import com.google.firebase.auth.FirebaseAuthUserCollisionException
import com.google.firebase.auth.FirebaseAuthWeakPasswordException
import com.google.firebase.database.DataSnapshot
import com.google.firebase.database.DatabaseError
import com.google.firebase.database.ValueEventListener
import com.johnlennonlobo.appilunne.model.Usuario
import com.johnlennonlobo.appilunne.network.ConfigFirebase
import com.johnlennonlobo.appilunne.ui.activity.login.AuthResponse
import com.johnlennonlobo.appilunne.utils.Constants.Companion.CHILD_ID_UNICO
import com.johnlennonlobo.appilunne.utils.Constants.Companion.CHILD_NOME
import com.johnlennonlobo.appilunne.utils.Constants.Companion.CHILD_USUARIOS
import com.johnlennonlobo.appilunne.utils.Constants.Companion.TIPO_USUARIO
class AuthDataSource {
companion object {
private val auth: FirebaseAuth=ConfigFirebase.getFirebaseAuthentication()
fun loginUser(usuario: Usuario, callBack: AuthResponse) {
auth.signInWithEmailAndPassword(usuario.email, usuario.senha)
.addOnCompleteListener { task ->
if (task.isSuccessful) {
val getUsuario = ConfigFirebase.getDatabase()
.child(CHILD_USUARIOS)
.child(CHILD_ID_UNICO)
.child(CHILD_NOME)
getUsuario.addValueEventListener(object : ValueEventListener{
override fun onDataChange(snapshot: DataSnapshot) {
val nomeUsuario = snapshot.value.toString()
if(nomeUsuario == "null"){
callBack.onSuccess("Bem vindo")
}else{
callBack.onSuccess("Bem vindo $nomeUsuario")
}
}
override fun onCancelled(error: DatabaseError) {
TODO("Not yet implemented")
}
})
} else {
try {
throw task.exception!!
} catch (error: Exception) {
callBack.onFailure("Erro ao logar conta ${error.message}")
}
}
}
}
fun registerUser(usuario: Usuario, callBack: AuthResponse) {
auth.createUserWithEmailAndPassword(usuario.email, usuario.senha)
.addOnCompleteListener { task ->
if (task.isSuccessful) {
val idUsuario = task.result?.user?.uid
usuario.id = idUsuario!!
usuario.tipo = TIPO_USUARIO
usuario.salvar()
callBack.onSuccess("Usuario cadastrado com sucesso")
} else {
try {
throw task.exception!!
} catch (error: FirebaseAuthWeakPasswordException) {
callBack.onFailure("Digite uma senha mais forte")
} catch (error: FirebaseAuthInvalidCredentialsException) {
callBack.onFailure("Digite um email valido")
} catch (error: FirebaseAuthUserCollisionException) {
callBack.onFailure("Esta conta ja esta cadastrada")
} catch (error: Exception) {
callBack.onFailure("Erro ao cadastrar conta ${error.message}")
}
}
}
}
}
}
| 0
|
Kotlin
|
0
| 2
|
62b08c90c425eb53f033c60a47bbe697781f35d9
| 3,925
|
AppIlunne
|
MIT License
|
src/main/kotlin/com/ecwid/apiclient/v3/dto/webhook/Webhook.kt
|
Ecwid
| 160,232,759
| false
|
{"Kotlin": 1019261}
|
package com.ecwid.apiclient.v3.dto.webhook
import com.ecwid.apiclient.v3.dto.common.ApiResultDTO
import com.google.gson.annotations.SerializedName
@Suppress("unused")
data class Webhook(
val eventId: String = "",
val eventCreated: Long = 0L,
val storeId: Long = 0L,
val entityId: Long = 0L,
val eventType: EventType = EventType.APPLICATION_INSTALLED,
val data: Map<String, String> = emptyMap(),
) : ApiResultDTO {
enum class EventType {
@SerializedName("application.installed")
APPLICATION_INSTALLED,
@SerializedName("application.uninstalled")
APPLICATION_UNINSTALLED,
@SerializedName("application.subscription_status_changed")
APPLICATION_SUBSCRIPTION_STATUS_CHANGED,
@SerializedName("application.storage_changed")
APPLICATION_STORAGE_CHANGED,
@SerializedName("category.created")
CATEGORY_CREATED,
@SerializedName("category.deleted")
CATEGORY_DELETED,
@SerializedName("category.updated")
CATEGORY_UPDATED,
@SerializedName("customer.created")
CUSTOMER_CREATED,
@SerializedName("customer.deleted")
CUSTOMER_DELETED,
@SerializedName("customer.updated")
CUSTOMER_UPDATED,
@SerializedName("customer.personal_data_removal_request")
CUSTOMER_PERSONAL_DATA_REMOVAL_REQUEST,
@SerializedName("customer.personal_data_export_request")
CUSTOMER_PERSONAL_DATA_EXPORT_REQUEST,
@SerializedName("order.created")
ORDER_CREATED,
@SerializedName("order.deleted")
ORDER_DELETED,
@SerializedName("order.updated")
ORDER_UPDATED,
@SerializedName("product.created")
PRODUCT_CREATED,
@SerializedName("product.deleted")
PRODUCT_DELETED,
@SerializedName("product.updated")
PRODUCT_UPDATED,
@SerializedName("product_class.created")
PRODUCT_CLASS_CREATED,
@SerializedName("product_class.deleted")
PRODUCT_CLASS_DELETED,
@SerializedName("product_class.updated")
PRODUCT_CLASS_UPDATED,
@SerializedName("review.created")
REVIEW_CREATED,
@SerializedName("review.deleted")
REVIEW_DELETED,
@SerializedName("review.updated")
REVIEW_UPDATED,
@SerializedName("profile.updated")
PROFILE_UPDATED,
@SerializedName("profile.subscription_status_changed")
PROFILE_SUBSCRIPTION_STATUS_CHANGED,
@SerializedName("profile.personal_data_removal_request")
PROFILE_PERSONAL_DATA_REMOVAL_REQUEST,
@SerializedName("profile.personal_data_export_request")
PROFILE_PERSONAL_DATA_EXPORT_REQUEST,
@SerializedName("unfinished_order.created")
UNFINISHED_ORDER_CREATED,
@SerializedName("unfinished_order.deleted")
UNFINISHED_ORDER_DELETED,
@SerializedName("unfinished_order.updated")
UNFINISHED_ORDER_UPDATED,
@SerializedName("discount_coupon.created")
DISCOUNT_COUPON_CREATED,
@SerializedName("discount_coupon.deleted")
DISCOUNT_COUPON_DELETED,
@SerializedName("discount_coupon.updated")
DISCOUNT_COUPON_UPDATED,
@SerializedName("invoice.created")
INVOICE_CREATED,
@SerializedName("invoice.deleted")
INVOICE_DELETED,
@SerializedName("promotion.created")
PROMOTION_CREATED,
@SerializedName("promotion.deleted")
PROMOTION_DELETED,
@SerializedName("promotion.updated")
PROMOTION_UPDATED,
}
}
| 12
|
Kotlin
|
13
| 17
|
2f94bfea3ad2073b89b8ea2b38dacdaa5f443a47
| 3,135
|
ecwid-java-api-client
|
Apache License 2.0
|
app/src/main/java/com/struklearn/app/modules/operasipadatree/data/model/OperasiPadaTreeModel.kt
|
nurkholiswakhid
| 737,292,232
| false
|
{"Kotlin": 74607}
|
package com.struklearn.app.modules.operasipadatree.`data`.model
import com.struklearn.app.R
import com.struklearn.app.appcomponents.di.MyApp
import kotlin.String
data class OperasiPadaTreeModel(
/**
* TODO Replace with dynamic value
*/
var txtSTRUKTURDATAT: String? =
MyApp.getInstance().resources.getString(R.string.msg_struktur_data_t)
,
/**
* TODO Replace with dynamic value
*/
var txtOperasiPenamb: String? =
MyApp.getInstance().resources.getString(R.string.msg_operasi_penamb)
,
/**
* TODO Replace with dynamic value
*/
var txtPenambahanNode: String? =
MyApp.getInstance().resources.getString(R.string.msg_penambahan_node2)
,
/**
* TODO Replace with dynamic value
*/
var txtPenambahanNodeOne: String? =
MyApp.getInstance().resources.getString(R.string.msg_penambahan_node3)
,
/**
* TODO Replace with dynamic value
*/
var txtDescription: String? =
MyApp.getInstance().resources.getString(R.string.msg_untuk_menambahk)
,
/**
* TODO Replace with dynamic value
*/
var txtJikatreemasih: String? =
MyApp.getInstance().resources.getString(R.string.msg_jika_tree_masih)
,
/**
* TODO Replace with dynamic value
*/
var txtDescriptionOne: String? =
MyApp.getInstance().resources.getString(R.string.msg_jika_tidak_kit)
,
/**
* TODO Replace with dynamic value
*/
var txtContohPenambah: String? =
MyApp.getInstance().resources.getString(R.string.msg_contoh_penambah)
,
/**
* TODO Replace with dynamic value
*/
var txtMisalkankitai: String? =
MyApp.getInstance().resources.getString(R.string.msg_misalkan_kita_i)
,
/**
* TODO Replace with dynamic value
*/
var txtDescriptionTwo: String? =
MyApp.getInstance().resources.getString(R.string.msg_kita_bandingkan)
,
/**
* TODO Replace with dynamic value
*/
var txtPenghapusanNod: String? =
MyApp.getInstance().resources.getString(R.string.msg_penghapusan_nod3)
,
/**
* TODO Replace with dynamic value
*/
var txtPenghapusanNodOne: String? =
MyApp.getInstance().resources.getString(R.string.msg_penghapusan_nod4)
,
/**
* TODO Replace with dynamic value
*/
var txtPenghapusannodTwo: String? =
MyApp.getInstance().resources.getString(R.string.msg_penghapusan_nod5)
,
/**
* TODO Replace with dynamic value
*/
var txtNodeDaunNode: String? =
MyApp.getInstance().resources.getString(R.string.msg_node_daun_node)
,
/**
* TODO Replace with dynamic value
*/
var txtNodedenganSat: String? =
MyApp.getInstance().resources.getString(R.string.msg_node_dengan_sat)
,
/**
* TODO Replace with dynamic value
*/
var txtDescriptionThree: String? =
MyApp.getInstance().resources.getString(R.string.msg_node_dengan_dua)
,
/**
* TODO Replace with dynamic value
*/
var txtContohPenghapu: String? =
MyApp.getInstance().resources.getString(R.string.msg_contoh_penghapu)
,
/**
* TODO Replace with dynamic value
*/
var txtMisalkankitaiOne: String? =
MyApp.getInstance().resources.getString(R.string.msg_misalkan_kita_i2)
,
/**
* TODO Replace with dynamic value
*/
var txtDescriptionFour: String? =
MyApp.getInstance().resources.getString(R.string.msg_node_dengan_nil)
,
/**
* TODO Replace with dynamic value
*/
var txtNilainode10d: String? =
MyApp.getInstance().resources.getString(R.string.msg_nilai_node_10_d)
,
/**
* TODO Replace with dynamic value
*/
var txtNodedengannil: String? =
MyApp.getInstance().resources.getString(R.string.msg_node_dengan_nil2)
,
/**
* TODO Replace with dynamic value
*/
var txtPencarianNode: String? =
MyApp.getInstance().resources.getString(R.string.msg_pencarian_node2)
,
/**
* TODO Replace with dynamic value
*/
var txtPrinsipPencari: String? =
MyApp.getInstance().resources.getString(R.string.msg_prinsip_pencari)
,
/**
* TODO Replace with dynamic value
*/
var txtPencariandilak: String? =
MyApp.getInstance().resources.getString(R.string.msg_pencarian_dilak)
,
/**
* TODO Replace with dynamic value
*/
var txtDescriptionFive: String? =
MyApp.getInstance().resources.getString(R.string.msg_jika_nilai_yang)
,
/**
* TODO Replace with dynamic value
*/
var txtJikanilainode: String? =
MyApp.getInstance().resources.getString(R.string.msg_jika_nilai_node)
,
/**
* TODO Replace with dynamic value
*/
var txtContohPencaria: String? =
MyApp.getInstance().resources.getString(R.string.msg_contoh_pencaria)
,
/**
* TODO Replace with dynamic value
*/
var txtMisalkankitaiTwo: String? =
MyApp.getInstance().resources.getString(R.string.msg_misalkan_kita_i3)
,
/**
* TODO Replace with dynamic value
*/
var txtNilai6dibandi: String? =
MyApp.getInstance().resources.getString(R.string.msg_nilai_6_dibandi)
,
/**
* TODO Replace with dynamic value
*/
var txtKarena6lebih: String? =
MyApp.getInstance().resources.getString(R.string.msg_karena_6_lebih)
,
/**
* TODO Replace with dynamic value
*/
var txtNilai6dibandiOne: String? =
MyApp.getInstance().resources.getString(R.string.msg_nilai_6_dibandi2)
,
/**
* TODO Replace with dynamic value
*/
var txtKarena6lebihOne: String? =
MyApp.getInstance().resources.getString(R.string.msg_karena_6_lebih2)
,
/**
* TODO Replace with dynamic value
*/
var txtNilai6ditemuk: String? =
MyApp.getInstance().resources.getString(R.string.msg_nilai_6_ditemuk)
)
| 0
|
Kotlin
|
0
| 0
|
1ee73edb464af83e8c45e7eb41071090847dbf2c
| 5,614
|
StrukLearn
|
MIT License
|
ir/src/main/kotlin/app/softwork/kobol/ir/CodeGenerator.kt
|
hfhbd
| 494,537,230
| false
|
{"Kotlin": 515008, "Lex": 13748}
|
package app.softwork.kobol.ir
import java.io.File
public fun interface CodeGenerator : AutoCloseable {
public fun generate(ir: Iterable<KobolIRTree>)
override fun close() {}
}
public fun interface CodeGeneratorFactory {
public operator fun invoke(outputFolder: File, args: Map<String, String>): CodeGenerator
}
| 50
|
Kotlin
|
0
| 1
|
ac0c4f5068416dcc320054d8f140fdad64e7776e
| 327
|
kobol
|
Apache License 2.0
|
app/src/main/java/com/example/budgettracker/data/dao/ExpenseEntryDao.kt
|
safeer-ahmed
| 868,168,369
| false
|
{"Kotlin": 34074}
|
package com.example.budgettracker.data.dao
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.example.budgettracker.data.DatabaseConstants
import com.example.budgettracker.data.entity.ExpenseEntry
import kotlinx.coroutines.flow.Flow
@Dao
interface ExpenseEntryDao {
@Query("SELECT * FROM ${DatabaseConstants.EXPENSE_ENTRY_TABLE_NAME}")
fun getAllEntries(): Flow<List<ExpenseEntry>>
@Insert(onConflict = OnConflictStrategy.REPLACE)
fun insertEntry(entry: ExpenseEntry)
}
| 0
|
Kotlin
|
0
| 0
|
8ab9f4ab7f83878708f69dedc91533fdf3df4303
| 569
|
android-budget-tracker
|
MIT License
|
app/src/main/java/com/example/budgettracker/data/dao/ExpenseEntryDao.kt
|
safeer-ahmed
| 868,168,369
| false
|
{"Kotlin": 34074}
|
package com.example.budgettracker.data.dao
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.example.budgettracker.data.DatabaseConstants
import com.example.budgettracker.data.entity.ExpenseEntry
import kotlinx.coroutines.flow.Flow
@Dao
interface ExpenseEntryDao {
@Query("SELECT * FROM ${DatabaseConstants.EXPENSE_ENTRY_TABLE_NAME}")
fun getAllEntries(): Flow<List<ExpenseEntry>>
@Insert(onConflict = OnConflictStrategy.REPLACE)
fun insertEntry(entry: ExpenseEntry)
}
| 0
|
Kotlin
|
0
| 0
|
8ab9f4ab7f83878708f69dedc91533fdf3df4303
| 569
|
android-budget-tracker
|
MIT License
|
feature/booking/src/main/java/ru/nesterov/booking/BookingNavigator.kt
|
anaesthez
| 689,421,041
| false
|
{"Kotlin": 93079}
|
package ru.nesterov.booking
interface BookingNavigator {
fun launchPayed()
}
| 0
|
Kotlin
|
0
| 0
|
c5fc99aa24b2c672edeb059e8135f96c38e13fea
| 82
|
test
|
MIT License
|
lib/web3/src/main/kotlin/com/example/web3/JsonRpcModels.kt
|
sabercon
| 609,417,032
| false
| null |
package com.example.web3
data class JsonRpcRequest(
val method: String,
val params: List<Any>,
val id: String = "",
val jsonrpc: String = "2.0",
)
data class JsonRpcResponse<out T : Any>(
val result: T?,
val error: Error?,
val id: String,
val jsonrpc: String,
) {
data class Error(val code: Int, val message: String)
}
| 0
|
Kotlin
|
0
| 0
|
7cac98655913f04b2c396387f801a539b321ecb5
| 357
|
gksr-monorepo
|
MIT License
|
app/src/main/java/org/sirekanyan/outline/db/ServerDao.kt
|
sirekanian
| 680,634,623
| false
|
{"Kotlin": 88413}
|
package org.sirekanyan.outline.db
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.platform.LocalContext
import app.cash.sqldelight.Query
import app.cash.sqldelight.coroutines.asFlow
import kotlinx.coroutines.flow.Flow
import org.sirekanyan.outline.app
import org.sirekanyan.outline.db.model.ServerEntity
@Composable
fun rememberServerDao(): ServerDao {
val database = LocalContext.current.app().database
return remember { ServerDao(database) }
}
class ServerDao(private val database: OutlineDatabase) {
private val queries = database.serverEntityQueries
private val keyQueries = database.keyEntityQueries
fun selectAll(): List<ServerEntity> =
queries.selectAll().executeAsList()
fun observeAll(): Flow<Query<ServerEntity>> =
queries.selectAll().asFlow()
fun insert(server: ServerEntity) {
queries.insert(server)
}
fun insertAll(servers: List<ServerEntity>) {
queries.transaction {
servers.forEach {
queries.insert(it)
}
}
}
fun deleteUrl(id: String) {
database.transaction {
keyQueries.deleteKeys(id)
queries.delete(id)
}
}
}
| 4
|
Kotlin
|
0
| 26
|
3b8d0d622c2722a0b8a710b5567b9aaee9a8d1d5
| 1,266
|
outline
|
Apache License 2.0
|
networking/src/main/java/io/dotanuki/networking/di/networkingModule.kt
|
ubiratansoares
| 154,198,067
| false
| null |
package io.dotanuki.networking.di
import okhttp3.OkHttpClient
import okhttp3.logging.HttpLoggingInterceptor
import org.kodein.di.Kodein
import org.kodein.di.generic.bind
import org.kodein.di.generic.singleton
val networkingModule = Kodein.Module("networking") {
val logger = HttpLoggingInterceptor().apply {
level = HttpLoggingInterceptor.Level.BODY
}
bind() from singleton {
OkHttpClient.Builder()
.addInterceptor(logger)
.build()
}
}
| 1
|
Kotlin
|
5
| 69
|
c0c5e2e4c3d4e68226615da0d9efb13c01955e36
| 496
|
blockked
|
MIT License
|
telnyx_rtc/src/main/java/com/telnyx/webrtc/sdk/model/AudioDevice.kt
|
team-telnyx
| 343,455,010
| false
| null |
/*
* Copyright © 2021 Telnyx LLC. All rights reserved.
*/
package com.telnyx.webrtc.sdk.model
/**
*
* Enum class to represent the different AudioDevices that can be used by the SDK
* with a given [code]
*
* @param code is the numerical representation of the AudioDevice which coincides AudioDeviceInfo class, eg. 7 -> BLUETOOTH
*
* @property BLUETOOTH a connected bluetooth device
* @property PHONE_EARPIECE the device's default earpiece
* @property LOUDSPEAKER the loudspeakers on the device
*/
enum class AudioDevice(var code: Int) {
BLUETOOTH(7),
PHONE_EARPIECE(0),
LOUDSPEAKER(99),
}
| 8
| null |
0
| 9
|
17d913c35100f95a29c54302d08e932a88600622
| 613
|
telnyx-webrtc-android
|
MIT License
|
app/src/main/java/aelsi2/natkschedule/data/network/ConnectivityManagerNetworkMonitor.kt
|
aelsi2
| 588,422,030
| false
| null |
package aelsi2.natkschedule.data.network
import android.net.ConnectivityManager
import android.net.Network
import android.net.NetworkCapabilities
import kotlinx.coroutines.MainScope
import kotlinx.coroutines.channels.awaitClose
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.callbackFlow
import kotlinx.coroutines.flow.stateIn
class ConnectivityManagerNetworkMonitor constructor(
private val connectivityManager: ConnectivityManager
) : NetworkMonitor {
override val isOnline: StateFlow<Boolean> = callbackFlow {
val callback = object : ConnectivityManager.NetworkCallback() {
override fun onAvailable(network: Network) {
channel.trySend(network.hasInternet)
}
override fun onLost(network: Network) {
channel.trySend(false)
}
override fun onCapabilitiesChanged(
network: Network,
networkCapabilities: NetworkCapabilities,
) {
channel.trySend(networkCapabilities.hasInternet)
}
}
connectivityManager.registerDefaultNetworkCallback(callback)
channel.trySend(connectivityManager.hasInternet)
awaitClose {
connectivityManager.unregisterNetworkCallback(callback)
}
}.stateIn(MainScope(), SharingStarted.WhileSubscribed(5000), true)
private val ConnectivityManager?.hasInternet: Boolean
get() = this?.activeNetwork?.hasInternet ?: false
private val Network?.hasInternet: Boolean
get() = this?.let(connectivityManager::getNetworkCapabilities)?.hasInternet ?: false
private val NetworkCapabilities?.hasInternet: Boolean
get() = (this?.hasCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET) ?: false)
&& (this?.hasCapability(NetworkCapabilities.NET_CAPABILITY_VALIDATED) ?: false)
}
| 0
|
Kotlin
|
0
| 1
|
6494abd7cd80fd0c68c1cd5dbba5a3a7a546c654
| 1,944
|
NatkSchedule
|
Apache License 2.0
|
app/src/main/java/com/vitorpamplona/amethyst/ui/qrcode/QrCodeScanner.kt
|
vitorpamplona
| 587,850,619
| false
| null |
package com.vitorpamplona.amethyst.ui.qrcode
import android.Manifest
import android.content.Context
import android.content.pm.PackageManager
import android.graphics.ImageFormat
import android.util.Size
import androidx.activity.compose.rememberLauncherForActivityResult
import androidx.activity.result.contract.ActivityResultContracts
import androidx.camera.core.CameraSelector
import androidx.camera.core.ImageAnalysis
import androidx.camera.core.ImageProxy
import androidx.camera.core.Preview
import androidx.camera.lifecycle.ProcessCameraProvider
import androidx.camera.view.PreviewView
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material.Text
import androidx.compose.runtime.*
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalLifecycleOwner
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.compose.ui.viewinterop.AndroidView
import androidx.core.content.ContextCompat
import androidx.lifecycle.LifecycleOwner
import com.google.common.util.concurrent.ListenableFuture
import com.google.mlkit.vision.barcode.BarcodeScannerOptions
import com.google.mlkit.vision.barcode.BarcodeScanning
import com.google.mlkit.vision.barcode.common.Barcode
import com.google.mlkit.vision.common.InputImage
import com.vitorpamplona.amethyst.service.Nip19
import java.util.concurrent.ExecutorService
import java.util.concurrent.Executors
@Composable
fun QrCodeScanner(onScan: (String) -> Unit) {
val context = LocalContext.current
val lifecycleOwner = LocalLifecycleOwner.current
val cameraProviderFuture = remember { ProcessCameraProvider.getInstance(context) }
val cameraExecutor= Executors.newSingleThreadExecutor()
var hasCameraPermission by remember {
mutableStateOf(
ContextCompat.checkSelfPermission(
context,
Manifest.permission.CAMERA
) == PackageManager.PERMISSION_GRANTED
)
}
val launcher = rememberLauncherForActivityResult(
contract = ActivityResultContracts.RequestPermission(),
onResult = { granted ->
hasCameraPermission = granted
}
)
val analyzer = QRCodeAnalyzer { result ->
result?.let {
try {
val nip19 = Nip19().uriToRoute(it)
val startingPage = when (nip19?.type) {
Nip19.Type.USER -> "User/${nip19.hex}"
Nip19.Type.NOTE -> "Note/${nip19.hex}"
else -> null
}
if (startingPage != null) {
onScan(startingPage)
}
} catch (e: Throwable) {
// QR can be anythign. do not throw errors.
}
}
}
DisposableEffect(key1 = true) {
launcher.launch(Manifest.permission.CAMERA)
onDispose() {
cameraProviderFuture.get().unbindAll()
cameraExecutor.shutdown()
}
}
Column() {
if (hasCameraPermission) {
AndroidView(
factory = { context ->
val previewView = PreviewView(context)
cameraProviderFuture.addListener({
val cameraProvider = cameraProviderFuture.get()
bindPreview(analyzer, previewView, cameraExecutor, cameraProvider, lifecycleOwner)
}, ContextCompat.getMainExecutor(context))
return@AndroidView previewView
},
modifier = Modifier.weight(1f)
)
}
}
}
fun bindPreview(
analyzer: ImageAnalysis.Analyzer,
previewView: PreviewView,
cameraExecutor: ExecutorService,
cameraProvider: ProcessCameraProvider,
lifecycleOwner: LifecycleOwner
) {
val preview = Preview.Builder().build()
val selector = CameraSelector.Builder()
.requireLensFacing(CameraSelector.LENS_FACING_BACK)
.build()
preview.setSurfaceProvider(previewView.surfaceProvider)
val imageAnalysis = ImageAnalysis.Builder()
.setBackpressureStrategy(ImageAnalysis.STRATEGY_KEEP_ONLY_LATEST)
.build()
imageAnalysis.setAnalyzer(
cameraExecutor,
analyzer
)
cameraProvider.bindToLifecycle(
lifecycleOwner,
selector,
imageAnalysis,
preview
)
}
class QRCodeAnalyzer(
private val onQrCodeScanned: (result: String?) -> Unit
) : ImageAnalysis.Analyzer {
private val scanningOptions = BarcodeScannerOptions.Builder().setBarcodeFormats(Barcode.FORMAT_QR_CODE).build()
fun scanBarcodes(inputImage: InputImage) {
BarcodeScanning.getClient(scanningOptions).process(inputImage)
.addOnSuccessListener { barcodes ->
if (barcodes.isNotEmpty()) {
onQrCodeScanned(barcodes[0].displayValue)
}
}
.addOnFailureListener {
it.printStackTrace()
}
}
@androidx.annotation.OptIn(androidx.camera.core.ExperimentalGetImage::class)
override fun analyze(imageProxy: ImageProxy) {
imageProxy.image?.let { image ->
val inputImage = InputImage.fromMediaImage(image, imageProxy.imageInfo.rotationDegrees)
scanBarcodes(inputImage)
}
imageProxy.close()
}
}
| 63
| null |
70
| 604
|
a2d04c99081daa00cbd8ef6ef002c4e97bf94478
| 5,619
|
amethyst
|
MIT License
|
src/main/kotlin/insyncwithfoo/ryecharm/others/dependencygroups/DependencyGroupNameInspection.kt
|
InSyncWithFoo
| 849,672,176
| false
|
{"Kotlin": 328384, "Python": 7749, "HTML": 1337}
|
package insyncwithfoo.ryecharm.others.dependencygroups
import com.intellij.codeInspection.LocalInspectionTool
import com.intellij.codeInspection.ProblemHighlightType
import com.intellij.codeInspection.ProblemsHolder
import com.intellij.openapi.project.DumbAware
import com.intellij.psi.PsiElement
import com.intellij.psi.PsiElementVisitor
import insyncwithfoo.ryecharm.isPyprojectToml
import insyncwithfoo.ryecharm.isString
import insyncwithfoo.ryecharm.keyValuePair
import insyncwithfoo.ryecharm.message
import insyncwithfoo.ryecharm.stringContent
import insyncwithfoo.ryecharm.table
import org.toml.lang.psi.TomlArray
import org.toml.lang.psi.TomlInlineTable
import org.toml.lang.psi.TomlLiteral
import org.toml.lang.psi.TomlTable
import org.toml.lang.psi.TomlVisitor
import org.toml.lang.psi.ext.name
private class DependencyGroupNameVisitor(private val holder: ProblemsHolder) : TomlVisitor() {
override fun visitLiteral(element: TomlLiteral) {
if (element.containingFile.virtualFile?.isPyprojectToml != true) {
return
}
val string = element.takeIf { it.isString } ?: return
val propertyPair = string.keyValuePair?.takeIf { it.isIncludeGroup } ?: return
val inlineTable = propertyPair.parent as? TomlInlineTable ?: return
val array = inlineTable.parent as? TomlArray ?: return
val arrayKey = array.keyValuePair?.key ?: return
val dependencyGroupsTable = arrayKey.table?.takeIf { it.isDependencyGroupsTable }
val registeredGroupNames = dependencyGroupsTable?.groupNames ?: emptyList()
val groupName = string.stringContent ?: return
val normalizedGroupName = groupName.normalize()
when {
!groupName.isValid -> reportInvalidGroupName(string, groupName)
normalizedGroupName !in registeredGroupNames -> reportUnknownGroup(string, groupName, normalizedGroupName)
normalizedGroupName == arrayKey.groupName -> reportCircularGroup(string, groupName, normalizedGroupName)
}
}
private fun reportInvalidGroupName(element: PsiElement, groupName: String) {
val message = message("inspections.dependencyGroupNames.message.invalid", groupName)
val problemHighlightType = ProblemHighlightType.WARNING
holder.registerProblem(element, message, problemHighlightType)
}
private fun reportUnknownGroup(element: PsiElement, originalName: String, normalizedName: String) {
val message = message("inspections.dependencyGroupNames.message.unknown", originalName, normalizedName)
val problemHighlightType = ProblemHighlightType.LIKE_UNKNOWN_SYMBOL
holder.registerProblem(element, message, problemHighlightType)
}
private fun reportCircularGroup(element: PsiElement, originalName: String, normalizedName: String) {
val message = message("inspections.dependencyGroupNames.message.circular", originalName, normalizedName)
val problemHighlightType = ProblemHighlightType.GENERIC_ERROR
holder.registerProblem(element, message, problemHighlightType)
}
override fun visitTable(element: TomlTable) {
val dependencyGroupsTable = element.takeIf { it.isDependencyGroupsTable } ?: return
val entriesByNormalizedName = dependencyGroupsTable.entries.groupBy { it.key.groupName }
entriesByNormalizedName.forEach { (normalizedName, entries) ->
if (normalizedName != null && entries.size > 1) {
entries.forEach { reportDuplicateGroup(it.key, it.key.name!!, normalizedName) }
}
}
}
private fun reportDuplicateGroup(element: PsiElement, originalName: String, normalizedName: String) {
val message = message("inspections.dependencyGroupNames.message.duplicate", originalName, normalizedName)
val problemHighlightType = ProblemHighlightType.GENERIC_ERROR
holder.registerProblem(element, message, problemHighlightType)
}
}
internal class DependencyGroupNameInspection : LocalInspectionTool(), DumbAware {
override fun getShortName() = SHORT_NAME
override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean): PsiElementVisitor =
DependencyGroupNameVisitor(holder)
companion object {
const val SHORT_NAME = "insyncwithfoo.ryecharm.others.dependencygroups.DependencyGroupNameInspection"
}
}
| 2
|
Kotlin
|
1
| 51
|
b857626181d4ca5aaab0f3fd7417be782d1ee7d0
| 4,494
|
ryecharm
|
MIT License
|
straight/src/commonMain/kotlin/me/localx/icons/straight/outline/SquareCode.kt
|
localhostov
| 808,861,591
| false
|
{"Kotlin": 79430321, "HTML": 331, "CSS": 102}
|
package me.localx.icons.straight.outline
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.graphics.StrokeCap.Companion.Butt
import androidx.compose.ui.graphics.StrokeJoin.Companion.Miter
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp
import me.localx.icons.straight.Icons
public val Icons.Outline.SquareCode: ImageVector
get() {
if (_squareCode != null) {
return _squareCode!!
}
_squareCode = Builder(name = "SquareCode", defaultWidth = 512.0.dp, defaultHeight =
512.0.dp, viewportWidth = 24.0f, viewportHeight = 24.0f).apply {
path(fill = SolidColor(Color(0xFF000000)), stroke = null, strokeLineWidth = 0.0f,
strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = 4.0f,
pathFillType = NonZero) {
moveTo(15.119f, 16.705f)
lineToRelative(-1.414f, -1.414f)
lineToRelative(3.299f, -3.299f)
lineToRelative(-3.299f, -3.283f)
lineToRelative(1.414f, -1.414f)
lineToRelative(3.299f, 3.298f)
curveToRelative(0.376f, 0.375f, 0.583f, 0.875f, 0.583f, 1.406f)
reflectiveCurveToRelative(-0.207f, 1.031f, -0.583f, 1.407f)
lineToRelative(-3.299f, 3.298f)
close()
moveTo(10.295f, 15.291f)
lineToRelative(-3.299f, -3.283f)
lineToRelative(3.299f, -3.298f)
lineToRelative(-1.414f, -1.414f)
lineToRelative(-3.299f, 3.298f)
curveToRelative(-0.376f, 0.375f, -0.583f, 0.875f, -0.583f, 1.407f)
reflectiveCurveToRelative(0.207f, 1.031f, 0.583f, 1.406f)
lineToRelative(3.299f, 3.299f)
lineToRelative(1.414f, -1.414f)
close()
moveTo(24.0f, 3.0f)
curveToRelative(0.0f, -1.654f, -1.346f, -3.0f, -3.0f, -3.0f)
lineTo(3.0f, 0.0f)
curveTo(1.346f, 0.0f, 0.0f, 1.346f, 0.0f, 3.0f)
lineTo(0.0f, 24.0f)
lineTo(24.0f, 24.0f)
lineTo(24.0f, 3.0f)
close()
moveTo(2.0f, 3.0f)
curveToRelative(0.0f, -0.551f, 0.448f, -1.0f, 1.0f, -1.0f)
lineTo(21.0f, 2.0f)
curveToRelative(0.552f, 0.0f, 1.0f, 0.449f, 1.0f, 1.0f)
lineTo(22.0f, 22.0f)
lineTo(2.0f, 22.0f)
lineTo(2.0f, 3.0f)
close()
}
}
.build()
return _squareCode!!
}
private var _squareCode: ImageVector? = null
| 1
|
Kotlin
|
0
| 5
|
cbd8b510fca0e5e40e95498834f23ec73cc8f245
| 2,942
|
icons
|
MIT License
|
backend-challenge/src/main/kotlin/mobi/waterdog/rest/template/tests/core/persistance/sql/RepairTypeRepositoryImpl.kt
|
henrique-drai
| 595,338,151
| false
| null |
package mobi.waterdog.rest.template.tests.core.persistance.sql
import mobi.waterdog.rest.template.database.createSorts
import mobi.waterdog.rest.template.database.fromFilters
import mobi.waterdog.rest.template.pagination.PageRequest
import mobi.waterdog.rest.template.tests.core.model.RepairType
import mobi.waterdog.rest.template.tests.core.model.RepairTypeSaveCommand
import mobi.waterdog.rest.template.tests.core.persistance.RepairTypeRepository
import org.jetbrains.exposed.sql.ResultRow
import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
import org.jetbrains.exposed.sql.deleteWhere
import org.jetbrains.exposed.sql.insert
import org.jetbrains.exposed.sql.select
import java.util.UUID
class RepairTypeRepositoryImpl : RepairTypeRepository {
override fun exists(id: UUID): Boolean {
return RepairTypeMappingsTable.select() { RepairTypeMappingsTable.id eq id }.count() == 1L
}
override fun getById(id: UUID): RepairType? {
val rst = RepairTypeMappingsTable.select { RepairTypeMappingsTable.id eq id }.singleOrNull()
return if (rst != null) {
resultToModel(rst)
} else {
null
}
}
override fun save(repairType: RepairTypeSaveCommand): RepairType {
val newRepairTypeId = RepairTypeMappingsTable.insert {
it[name] = repairType.name
it[description] = repairType.description
} get RepairTypeMappingsTable.id
return RepairType(newRepairTypeId.value, repairType.name, repairType.description)
}
override fun count(pageRequest: PageRequest): Int {
return RepairTypeMappingsTable.fromFilters(pageRequest.filter).count().toInt()
}
override fun delete(id: UUID) {
RepairTypeMappingsTable.deleteWhere { RepairTypeMappingsTable.id eq id }
}
override fun list(pageRequest: PageRequest): List<RepairType> {
return RepairTypeMappingsTable
.fromFilters(pageRequest.filter)
.limit(pageRequest.limit, pageRequest.offset.toLong())
.orderBy(*RepairTypeMappingsTable.createSorts(pageRequest.sort).toTypedArray())
.map { resultToModel(it) }
}
private fun resultToModel(rstRow: ResultRow): RepairType {
return RepairType(
rstRow[RepairTypeMappingsTable.id].value,
rstRow[RepairTypeMappingsTable.name],
rstRow[RepairTypeMappingsTable.description]
)
}
}
| 0
|
Kotlin
|
0
| 0
|
4da40b48777dd6cd7b34904efb3fa7cf60be1543
| 2,437
|
keita
|
MIT License
|
app/src/main/java/pw/wpam/polityper/MainActivity.kt
|
kubasikora
| 310,674,873
| false
| null |
package pw.wpam.polityper
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import pw.wpam.polityper.services.*
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
// initialize services
val context = this
AuthService.setContext(context)
LeagueService.setContext(context)
BetService.setContext(context)
LeaderboardService.setContext(context)
NewsService.setContext(context)
}
}
| 8
|
Kotlin
|
0
| 1
|
cc5ff40b7fbb92f0281a7cde591f4d4b5cc828aa
| 601
|
WPAM-Projekt-Aplikacja
|
MIT License
|
app/src/main/java/com/lagradost/cloudstream3/extractors/Streamhub.kt
|
LagradOst
| 363,210,353
| false
| null |
package com.lagradost.cloudstream3.extractors
import com.lagradost.cloudstream3.network.get
import com.lagradost.cloudstream3.network.text
import com.lagradost.cloudstream3.utils.ExtractorApi
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.JsUnpacker
import com.lagradost.cloudstream3.utils.Qualities
import java.net.URI
class Streamhub : ExtractorApi() {
override val mainUrl: String
get() = "https://streamhub.to"
override val name: String
get() = "Streamhub"
override val requiresReferer: Boolean
get() = false
override fun getExtractorUrl(id: String): String {
return "$mainUrl/e/$id"
}
override fun getUrl(url: String, referer: String?): List<ExtractorLink>? {
val response = get(url).text
Regex("eval((.|\\n)*?)</script>").find(response)?.groupValues?.get(1)?.let { jsEval ->
JsUnpacker("eval$jsEval" ).unpack()?.let { unPacked ->
Regex("sources:\\[\\{src:\"(.*?)\"").find(unPacked)?.groupValues?.get(1)?.let { link ->
return listOf(
ExtractorLink(
this.name,
this.name,
link,
referer ?: "",
Qualities.Unknown.value,
URI(link).path.endsWith(".m3u8")
)
)
}
}
}
return null
}
}
| 64
|
Kotlin
|
60
| 378
|
d2e192cd6f7d767a7f2cbf9729cd655ad1028a91
| 1,535
|
CloudStream-3
|
MIT License
|
src/main/kotlin/me/jakejmattson/wiretap/listeners/Preconditions.kt
|
JakeJMattson
| 159,771,025
| false
| null |
package me.jakejmattson.wiretap.listeners
import kotlinx.coroutines.flow.*
import me.jakejmattson.wiretap.services.Configuration
import me.jakejmattson.discordkt.api.dsl.precondition
fun rolePrecondition(config: Configuration) = precondition {
val guild = guild ?: return@precondition fail()
val requiredRole = guild.roles.firstOrNull { it.name.equals(config.requiredRoleName, true) }
?: return@precondition fail("Required role (${config.requiredRoleName}) in config not found in guild!")
val memberRoles = author.asMember(guild.id).roles.toList()
if (requiredRole !in memberRoles)
fail("You do not have the required role: ${requiredRole.name}")
}
| 0
|
Kotlin
|
0
| 4
|
51948b75f8dfce90229bd3ec8dd3b3b950a220a8
| 683
|
Wiretap
|
MIT License
|
BeFaster/app/src/main/java/com/kjnco/befaster/anagram/AnagramActivity.kt
|
Kali-ki
| 614,250,644
| false
| null |
package com.kjnco.befaster.anagram
import android.content.Intent
import android.os.Bundle
import android.widget.Button
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import com.kjnco.befaster.R
import com.kjnco.befaster.main_menu.TrainingActivity
class AnagramActivity : AppCompatActivity() {
companion object {
var numberOfAnagrams = 3
}
private lateinit var rules_1: TextView
private lateinit var rules_2: TextView
private lateinit var rules_3: TextView
private lateinit var beginButton: Button
private lateinit var cancelButton: Button
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_anagram)
// Init text views
rules_1 = findViewById(R.id.rules_1)
rules_2 = findViewById(R.id.rules_2)
rules_3 = findViewById(R.id.rules_3)
// Set texts
rules_1.text = getString(R.string.anagram_rules_1_fr) +" "+ numberOfAnagrams
rules_2.setText(R.string.anagram_rules_2_fr)
rules_3.setText(R.string.anagram_rules_3_fr)
// Init buttons
beginButton = findViewById(R.id.begin)
cancelButton = findViewById(R.id.cancel)
// Set the action of the buttons
beginButtonEvent()
cancelButtonEvent()
}
/**
* Method to add an event to the begin button
*/
private fun beginButtonEvent() {
beginButton.setOnClickListener {
val intent = Intent(this, QuizActivity::class.java)
startActivity(intent)
}
}
/**
* Method to add an event to the cancel button
*/
private fun cancelButtonEvent() {
cancelButton.setOnClickListener {
val intent = Intent(this, TrainingActivity::class.java)
startActivity(intent)
}
}
}
| 0
|
Kotlin
|
0
| 1
|
a3e24302cb0439bd32e3b2cee5420fa83785c477
| 1,888
|
BeFaster
|
MIT License
|
app/src/main/kotlin/com/trevorhalvorson/ping/injection/ApplicationComponent.kt
|
trevorhalvorson
| 102,184,034
| false
| null |
package com.trevorhalvorson.ping.injection
import android.app.Application
import com.trevorhalvorson.ping.PingApplication
import com.trevorhalvorson.ping.injection.module.ActivityBindingModule
import com.trevorhalvorson.ping.injection.module.ApplicationModule
import com.trevorhalvorson.ping.injection.module.NetworkModule
import com.trevorhalvorson.ping.injection.scope.PerApplication
import dagger.BindsInstance
import dagger.Component
import dagger.android.AndroidInjector
import dagger.android.DaggerApplication
import dagger.android.support.AndroidSupportInjectionModule
@PerApplication
@Component(modules = arrayOf(ApplicationModule::class,
ActivityBindingModule::class,
AndroidSupportInjectionModule::class,
NetworkModule::class))
interface ApplicationComponent : AndroidInjector<DaggerApplication> {
fun inject(application: PingApplication)
override fun inject(instance: DaggerApplication?)
@Component.Builder
interface Builder {
@BindsInstance
fun application(application: Application): ApplicationComponent.Builder
fun build(): ApplicationComponent
}
}
| 2
|
Kotlin
|
0
| 0
|
fea2a9c23f50121efdfc15146956293c64cfd43f
| 1,137
|
ping-android
|
MIT License
|
src/test/kotlin/io/pixeloutlaw/minecraft/spigot/YamlConfigurations.kt
|
MythicDrops
| 10,021,467
| false
|
{"Kotlin": 1285438}
|
package io.pixeloutlaw.minecraft.spigot
import org.bukkit.configuration.file.YamlConfiguration
fun YamlConfiguration.loadFromResource(path: String): YamlConfiguration {
val rawText = YamlConfiguration::class.java.classLoader.getResource(path)?.readText() ?: ""
loadFromString(rawText)
return this
}
| 59
|
Kotlin
|
43
| 38
|
ba9dcc23ec2dd8f972f9c37ca15d9195f7cfe107
| 313
|
MythicDrops
|
MIT License
|
rounded/src/commonMain/kotlin/me/localx/icons/rounded/bold/SolarPanelSun.kt
|
localhostov
| 808,861,591
| false
|
{"Kotlin": 79430321, "HTML": 331, "CSS": 102}
|
package me.localx.icons.rounded.bold
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.graphics.StrokeCap.Companion.Butt
import androidx.compose.ui.graphics.StrokeJoin.Companion.Miter
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp
import me.localx.icons.rounded.Icons
public val Icons.Bold.SolarPanelSun: ImageVector
get() {
if (_solarPanelSun != null) {
return _solarPanelSun!!
}
_solarPanelSun = Builder(name = "SolarPanelSun", defaultWidth = 24.0.dp, defaultHeight =
24.0.dp, viewportWidth = 24.0f, viewportHeight = 24.0f).apply {
path(fill = SolidColor(Color(0xFF000000)), stroke = null, strokeLineWidth = 0.0f,
strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = 4.0f,
pathFillType = NonZero) {
moveToRelative(23.853f, 14.501f)
lineToRelative(-0.596f, -2.001f)
curveToRelative(-0.439f, -1.472f, -1.818f, -2.5f, -3.354f, -2.5f)
lineTo(4.0f, 10.0f)
curveToRelative(-1.537f, 0.0f, -2.916f, 1.028f, -3.354f, 2.5f)
lineTo(0.05f, 14.5f)
curveToRelative(-0.319f, 1.069f, -0.119f, 2.196f, 0.548f, 3.092f)
curveToRelative(0.667f, 0.895f, 1.69f, 1.408f, 2.806f, 1.408f)
horizontalLineToRelative(7.096f)
verticalLineToRelative(2.0f)
horizontalLineToRelative(-3.0f)
curveToRelative(-0.829f, 0.0f, -1.5f, 0.672f, -1.5f, 1.5f)
reflectiveCurveToRelative(0.671f, 1.5f, 1.5f, 1.5f)
horizontalLineToRelative(9.0f)
curveToRelative(0.828f, 0.0f, 1.5f, -0.672f, 1.5f, -1.5f)
reflectiveCurveToRelative(-0.672f, -1.5f, -1.5f, -1.5f)
horizontalLineToRelative(-3.0f)
verticalLineToRelative(-2.0f)
horizontalLineToRelative(6.999f)
curveToRelative(1.116f, 0.0f, 2.14f, -0.514f, 2.807f, -1.409f)
curveToRelative(0.667f, -0.895f, 0.866f, -2.021f, 0.547f, -3.09f)
close()
moveTo(9.631f, 16.0f)
lineToRelative(0.25f, -3.0f)
horizontalLineToRelative(4.239f)
lineToRelative(0.25f, 3.0f)
horizontalLineToRelative(-4.739f)
close()
moveTo(3.004f, 15.799f)
curveToRelative(-0.056f, -0.075f, -0.141f, -0.232f, -0.078f, -0.441f)
lineToRelative(0.596f, -2.001f)
curveToRelative(0.063f, -0.213f, 0.256f, -0.356f, 0.479f, -0.356f)
horizontalLineToRelative(2.87f)
lineToRelative(-0.25f, 3.0f)
horizontalLineToRelative(-3.216f)
curveToRelative(-0.218f, 0.0f, -0.345f, -0.126f, -0.401f, -0.201f)
close()
moveTo(20.9f, 15.799f)
curveToRelative(-0.056f, 0.075f, -0.183f, 0.201f, -0.4f, 0.201f)
horizontalLineToRelative(-3.118f)
lineToRelative(-0.25f, -3.0f)
horizontalLineToRelative(2.772f)
curveToRelative(0.223f, 0.0f, 0.416f, 0.144f, 0.479f, 0.356f)
lineToRelative(0.596f, 2.001f)
curveToRelative(0.062f, 0.209f, -0.022f, 0.366f, -0.078f, 0.441f)
close()
moveTo(5.0f, 6.5f)
curveToRelative(0.0f, -0.828f, 0.671f, -1.5f, 1.5f, -1.5f)
horizontalLineToRelative(0.73f)
curveToRelative(0.179f, -0.567f, 0.464f, -1.084f, 0.819f, -1.544f)
lineToRelative(-0.773f, -1.088f)
curveToRelative(-0.479f, -0.675f, -0.321f, -1.611f, 0.355f, -2.091f)
curveToRelative(0.675f, -0.48f, 1.612f, -0.321f, 2.091f, 0.354f)
lineToRelative(0.784f, 1.104f)
curveToRelative(0.473f, -0.148f, 0.972f, -0.236f, 1.493f, -0.236f)
reflectiveCurveToRelative(1.021f, 0.087f, 1.493f, 0.236f)
lineToRelative(0.783f, -1.104f)
curveToRelative(0.48f, -0.677f, 1.417f, -0.833f, 2.092f, -0.355f)
curveToRelative(0.676f, 0.479f, 0.835f, 1.416f, 0.355f, 2.092f)
lineToRelative(-0.773f, 1.089f)
curveToRelative(0.355f, 0.46f, 0.641f, 0.977f, 0.819f, 1.543f)
horizontalLineToRelative(0.729f)
curveToRelative(0.828f, 0.0f, 1.5f, 0.672f, 1.5f, 1.5f)
reflectiveCurveToRelative(-0.672f, 1.5f, -1.5f, 1.5f)
horizontalLineToRelative(-2.0f)
curveToRelative(-0.828f, 0.0f, -1.5f, -0.672f, -1.5f, -1.5f)
curveToRelative(0.0f, -1.103f, -0.897f, -2.0f, -2.0f, -2.0f)
reflectiveCurveToRelative(-2.0f, 0.897f, -2.0f, 2.0f)
curveToRelative(0.0f, 0.828f, -0.671f, 1.5f, -1.5f, 1.5f)
horizontalLineToRelative(-2.0f)
curveToRelative(-0.829f, 0.0f, -1.5f, -0.672f, -1.5f, -1.5f)
close()
}
}
.build()
return _solarPanelSun!!
}
private var _solarPanelSun: ImageVector? = null
| 1
|
Kotlin
|
0
| 5
|
cbd8b510fca0e5e40e95498834f23ec73cc8f245
| 5,472
|
icons
|
MIT License
|
rounded/src/commonMain/kotlin/me/localx/icons/rounded/bold/SolarPanelSun.kt
|
localhostov
| 808,861,591
| false
|
{"Kotlin": 79430321, "HTML": 331, "CSS": 102}
|
package me.localx.icons.rounded.bold
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.graphics.StrokeCap.Companion.Butt
import androidx.compose.ui.graphics.StrokeJoin.Companion.Miter
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp
import me.localx.icons.rounded.Icons
public val Icons.Bold.SolarPanelSun: ImageVector
get() {
if (_solarPanelSun != null) {
return _solarPanelSun!!
}
_solarPanelSun = Builder(name = "SolarPanelSun", defaultWidth = 24.0.dp, defaultHeight =
24.0.dp, viewportWidth = 24.0f, viewportHeight = 24.0f).apply {
path(fill = SolidColor(Color(0xFF000000)), stroke = null, strokeLineWidth = 0.0f,
strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = 4.0f,
pathFillType = NonZero) {
moveToRelative(23.853f, 14.501f)
lineToRelative(-0.596f, -2.001f)
curveToRelative(-0.439f, -1.472f, -1.818f, -2.5f, -3.354f, -2.5f)
lineTo(4.0f, 10.0f)
curveToRelative(-1.537f, 0.0f, -2.916f, 1.028f, -3.354f, 2.5f)
lineTo(0.05f, 14.5f)
curveToRelative(-0.319f, 1.069f, -0.119f, 2.196f, 0.548f, 3.092f)
curveToRelative(0.667f, 0.895f, 1.69f, 1.408f, 2.806f, 1.408f)
horizontalLineToRelative(7.096f)
verticalLineToRelative(2.0f)
horizontalLineToRelative(-3.0f)
curveToRelative(-0.829f, 0.0f, -1.5f, 0.672f, -1.5f, 1.5f)
reflectiveCurveToRelative(0.671f, 1.5f, 1.5f, 1.5f)
horizontalLineToRelative(9.0f)
curveToRelative(0.828f, 0.0f, 1.5f, -0.672f, 1.5f, -1.5f)
reflectiveCurveToRelative(-0.672f, -1.5f, -1.5f, -1.5f)
horizontalLineToRelative(-3.0f)
verticalLineToRelative(-2.0f)
horizontalLineToRelative(6.999f)
curveToRelative(1.116f, 0.0f, 2.14f, -0.514f, 2.807f, -1.409f)
curveToRelative(0.667f, -0.895f, 0.866f, -2.021f, 0.547f, -3.09f)
close()
moveTo(9.631f, 16.0f)
lineToRelative(0.25f, -3.0f)
horizontalLineToRelative(4.239f)
lineToRelative(0.25f, 3.0f)
horizontalLineToRelative(-4.739f)
close()
moveTo(3.004f, 15.799f)
curveToRelative(-0.056f, -0.075f, -0.141f, -0.232f, -0.078f, -0.441f)
lineToRelative(0.596f, -2.001f)
curveToRelative(0.063f, -0.213f, 0.256f, -0.356f, 0.479f, -0.356f)
horizontalLineToRelative(2.87f)
lineToRelative(-0.25f, 3.0f)
horizontalLineToRelative(-3.216f)
curveToRelative(-0.218f, 0.0f, -0.345f, -0.126f, -0.401f, -0.201f)
close()
moveTo(20.9f, 15.799f)
curveToRelative(-0.056f, 0.075f, -0.183f, 0.201f, -0.4f, 0.201f)
horizontalLineToRelative(-3.118f)
lineToRelative(-0.25f, -3.0f)
horizontalLineToRelative(2.772f)
curveToRelative(0.223f, 0.0f, 0.416f, 0.144f, 0.479f, 0.356f)
lineToRelative(0.596f, 2.001f)
curveToRelative(0.062f, 0.209f, -0.022f, 0.366f, -0.078f, 0.441f)
close()
moveTo(5.0f, 6.5f)
curveToRelative(0.0f, -0.828f, 0.671f, -1.5f, 1.5f, -1.5f)
horizontalLineToRelative(0.73f)
curveToRelative(0.179f, -0.567f, 0.464f, -1.084f, 0.819f, -1.544f)
lineToRelative(-0.773f, -1.088f)
curveToRelative(-0.479f, -0.675f, -0.321f, -1.611f, 0.355f, -2.091f)
curveToRelative(0.675f, -0.48f, 1.612f, -0.321f, 2.091f, 0.354f)
lineToRelative(0.784f, 1.104f)
curveToRelative(0.473f, -0.148f, 0.972f, -0.236f, 1.493f, -0.236f)
reflectiveCurveToRelative(1.021f, 0.087f, 1.493f, 0.236f)
lineToRelative(0.783f, -1.104f)
curveToRelative(0.48f, -0.677f, 1.417f, -0.833f, 2.092f, -0.355f)
curveToRelative(0.676f, 0.479f, 0.835f, 1.416f, 0.355f, 2.092f)
lineToRelative(-0.773f, 1.089f)
curveToRelative(0.355f, 0.46f, 0.641f, 0.977f, 0.819f, 1.543f)
horizontalLineToRelative(0.729f)
curveToRelative(0.828f, 0.0f, 1.5f, 0.672f, 1.5f, 1.5f)
reflectiveCurveToRelative(-0.672f, 1.5f, -1.5f, 1.5f)
horizontalLineToRelative(-2.0f)
curveToRelative(-0.828f, 0.0f, -1.5f, -0.672f, -1.5f, -1.5f)
curveToRelative(0.0f, -1.103f, -0.897f, -2.0f, -2.0f, -2.0f)
reflectiveCurveToRelative(-2.0f, 0.897f, -2.0f, 2.0f)
curveToRelative(0.0f, 0.828f, -0.671f, 1.5f, -1.5f, 1.5f)
horizontalLineToRelative(-2.0f)
curveToRelative(-0.829f, 0.0f, -1.5f, -0.672f, -1.5f, -1.5f)
close()
}
}
.build()
return _solarPanelSun!!
}
private var _solarPanelSun: ImageVector? = null
| 1
|
Kotlin
|
0
| 5
|
cbd8b510fca0e5e40e95498834f23ec73cc8f245
| 5,472
|
icons
|
MIT License
|
app/src/main/java/com/aredruss/mangatana/utils/AppCenterEvents.kt
|
Aredruss
| 344,616,186
| false
| null |
package com.aredruss.mangatana.utils
const val SHARED_TITLE = "Shared title"
const val OPENED_BROWSER = "Opened in browser"
const val ENABLE_LIGHT_THEME = "Enabled Light Theme"
const val CLEARED_ALL_DATA = "Cleared all data"
const val OPENED_ISSUES = "Opened Issues"
| 0
|
Kotlin
|
2
| 17
|
834e540aebde85e31b409d21dc22f8a75527a37f
| 268
|
Mangatana
|
Apache License 2.0
|
app/src/main/java/com/aredruss/mangatana/utils/AppCenterEvents.kt
|
Aredruss
| 344,616,186
| false
| null |
package com.aredruss.mangatana.utils
const val SHARED_TITLE = "Shared title"
const val OPENED_BROWSER = "Opened in browser"
const val ENABLE_LIGHT_THEME = "Enabled Light Theme"
const val CLEARED_ALL_DATA = "Cleared all data"
const val OPENED_ISSUES = "Opened Issues"
| 0
|
Kotlin
|
2
| 17
|
834e540aebde85e31b409d21dc22f8a75527a37f
| 268
|
Mangatana
|
Apache License 2.0
|
src/test/kotlin/com/forgerock/sapi/gateway/ob/uk/tests/functional/account/beneficiaries/junit/v3_1_8/GetAccountBeneficiariesTest.kt
|
SecureApiGateway
| 330,627,234
| false
|
{"Kotlin": 1237436, "Java": 2078, "Dockerfile": 464, "Makefile": 236}
|
package com.forgerock.sapi.gateway.ob.uk.tests.functional.account.beneficiaries.junit.v3_1_8
import com.forgerock.sapi.gateway.framework.extensions.junit.CreateTppCallback
import com.forgerock.sapi.gateway.framework.extensions.junit.EnabledIfVersion
import com.forgerock.sapi.gateway.uk.common.shared.api.meta.obie.OBVersion
import com.forgerock.sapi.gateway.ob.uk.tests.functional.account.beneficiaries.api.v3_1_8.GetAccountBeneficiaries
import org.junit.jupiter.api.Test
class GetAccountBeneficiariesTest(val tppResource: CreateTppCallback.TppResource) {
@EnabledIfVersion(
type = "accounts",
apiVersion = "v3.1.8",
operations = ["CreateAccountAccessConsent", "GetAccounts", "GetAccountBeneficiaries"],
apis = ["beneficiaries"],
compatibleVersions = ["v.3.1.7", "v.3.1.6", "v.3.1.5"]
)
@Test
fun shouldGetAccountBeneficiaries_v3_1_8() {
GetAccountBeneficiaries(OBVersion.v3_1_8, tppResource).shouldGetAccountBeneficiariesTest()
}
}
| 9
|
Kotlin
|
0
| 5
|
0b6f4ad53cbc77be3a9236d25ac034c458366182
| 1,004
|
secure-api-gateway-ob-uk-functional-tests
|
Apache License 2.0
|
GroceryApp/app/src/main/java/com/example/grocerryapp/GroceryRVAdapter.kt
|
smartinternz02
| 516,935,037
| false
| null |
package com.example.grocerryapp
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
class GroceryRVAdapter(
var list: List<GroceryItems>,
val groceryItemClickInterface: GroceryItemClickInterface
) : RecyclerView.Adapter<GroceryRVAdapter.GroceryViewHolder>() {
// Inner class for viewHolder
inner class GroceryViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
val nameTV = itemView.findViewById<TextView>(R.id.idTVItemName)
val quantityTV = itemView.findViewById<TextView>(R.id.idTVQuantity)
val rateTV = itemView.findViewById<TextView>(R.id.idTVRate)
val amountTV = itemView.findViewById<TextView>(R.id.idTotalAmt)
val deleteIV = itemView.findViewById<ImageView>(R.id.idTVDelete)
}
interface GroceryItemClickInterface {
fun onItemClick(groceryItems: GroceryItems)
}
// In this function we will add our groceryadapter.xml to kotlin class
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): GroceryViewHolder {
val view =
LayoutInflater.from(parent.context).inflate(R.layout.grocery_rv_item, parent, false)
return GroceryViewHolder(view)
}
// This function is used to return total number of size of list.
override fun getItemCount(): Int {
return list.size
}
// In onBindViewHolder we will bind our itemViews with adapter
override fun onBindViewHolder(holder: GroceryViewHolder, position: Int) {
holder.nameTV.text = list.get(position).itemName
holder.quantityTV.text = list.get(position).itemQuantity.toString()
holder.rateTV.text = "Rs. " + list.get(position).itemPrice.toString()
val itemTotal: Int = list.get(position).itemPrice * list.get(position).itemQuantity
holder.amountTV.text = "Rs. " + itemTotal.toString()
holder.deleteIV.setOnClickListener {
groceryItemClickInterface.onItemClick(list.get(position))
}
}
}
| 0
|
Kotlin
|
0
| 0
|
0598a55d2f1df9385127a458f9cbf655de8d319b
| 2,126
|
SPSGP-94862-Virtual-Internship---Android-Application-Development-Using-Kotlin
|
Apache License 2.0
|
Android/App_qixiashan/App/src/main/java/com/zktony/android/data/dao/NewCalibrationDao.kt
|
OriginalLight
| 556,213,614
| false
|
{"Kotlin": 6123849, "C#": 376657, "Vue": 164353, "Rust": 101266, "C++": 63250, "TypeScript": 62359, "Python": 28781, "CMake": 18271, "C": 16214, "Less": 2885, "Dockerfile": 1898, "HTML": 648, "JavaScript": 450}
|
package com.zktony.android.data.dao
import androidx.paging.PagingSource
import androidx.room.*
import com.zktony.android.data.entities.Motor
import com.zktony.android.data.entities.NewCalibration
import com.zktony.android.data.entities.Setting
import kotlinx.coroutines.flow.Flow
/**
* @author: 刘贺贺
* @date: 2022-10-13 11:49
*/
@Dao
abstract class NewCalibrationDao : BaseDao<NewCalibration> {
@Query(
"""
SELECT * FROM new_calibration
"""
)
abstract fun getAll(): Flow<List<NewCalibration>>
@Query(
"""
SELECT * FROM new_calibration
ORDER BY id DESC
"""
)
abstract fun getByPage(): PagingSource<Int, NewCalibration>
@Query(
"""
SELECT * FROM new_calibration
WHERE id = :id
"""
)
abstract fun getById(id: Long): Flow<NewCalibration?>
@Query(
"""
DELETE FROM new_calibration
WHERE id = :id
"""
)
abstract suspend fun deleteById(id: Long)
}
| 0
|
Kotlin
|
0
| 1
|
bcf0671b9e4ad199e579764f29683c1c575369d2
| 1,015
|
ZkTony
|
Apache License 2.0
|
2021/src/test/kotlin/Day24Test.kt
|
eduellery
| 433,983,584
| false
|
{"Kotlin": 97092}
|
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.DisplayName
import org.junit.jupiter.api.Nested
import org.junit.jupiter.api.Test
@DisplayName("Day 23")
class Day24Test {
// Arrange
private val input = Resources.resourceAsListOfString("day24.in")
@Nested
@DisplayName("Part 1")
inner class Part1 {
@Test
fun `Matches actual answer`() {
// Act
val answer = Day24(input).solve1()
// Assert
assertThat(answer).isEqualTo(99_298_993_199_873)
}
}
@Nested
@DisplayName("Part 2")
inner class Part2 {
@Test
fun `Matches actual answer`() {
// Act
val answer = Day24(input).solve2()
// Assert
assertThat(answer).isEqualTo(73_181_221_197_111)
}
}
}
| 0
|
Kotlin
|
0
| 1
|
3e279dd04bbcaa9fd4b3c226d39700ef70b031fc
| 856
|
adventofcode-2021-2025
|
MIT License
|
common/src/androidMain/kotlin/com/artemchep/keyguard/android/AutofillCompose.kt
|
AChep
| 669,697,660
| false
|
{"Kotlin": 5516822, "HTML": 45876}
|
package com.artemchep.keyguard.android
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxScope
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.WindowInsetsSides
import androidx.compose.foundation.layout.displayCutout
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.navigationBars
import androidx.compose.foundation.layout.only
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.statusBars
import androidx.compose.foundation.layout.systemBars
import androidx.compose.foundation.layout.union
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.layout.windowInsetsPadding
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.CornerSize
import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import com.artemchep.keyguard.common.io.attempt
import com.artemchep.keyguard.common.io.bind
import com.artemchep.keyguard.common.model.LinkInfoAndroid
import com.artemchep.keyguard.common.model.LinkInfoPlatform
import com.artemchep.keyguard.common.model.Loadable
import com.artemchep.keyguard.common.service.extract.LinkInfoExtractor
import com.artemchep.keyguard.feature.favicon.FaviconImage
import com.artemchep.keyguard.feature.favicon.FaviconUrl
import com.artemchep.keyguard.feature.keyguard.AppRoute
import com.artemchep.keyguard.feature.navigation.NavigationNode
import com.artemchep.keyguard.ui.ExpandedIfNotEmptyForRow
import com.artemchep.keyguard.ui.MediumEmphasisAlpha
import com.artemchep.keyguard.ui.composable
import com.artemchep.keyguard.ui.theme.combineAlpha
import org.kodein.di.allInstances
import org.kodein.di.compose.rememberDI
@Composable
fun AutofillScaffold(
topBar: @Composable () -> Unit,
) {
ExtensionScaffold(
header = {
topBar()
},
) {
NavigationNode(
id = "App:Autofill",
route = AppRoute,
)
}
}
@Composable
fun PasskeyScaffold(
topBar: @Composable () -> Unit,
) {
ExtensionScaffold(
header = {
topBar()
},
) {
NavigationNode(
id = "App:Passkey",
route = AppRoute,
)
}
}
@Composable
fun ExtensionScaffold(
header: @Composable BoxScope.() -> Unit,
content: @Composable BoxScope.() -> Unit,
) {
val topInsets = WindowInsets.systemBars
.only(WindowInsetsSides.Top)
Column(
modifier = Modifier
.background(MaterialTheme.colorScheme.surfaceVariant)
.windowInsetsPadding(topInsets),
) {
val horizontalInsets = WindowInsets.statusBars
.union(WindowInsets.navigationBars)
.union(WindowInsets.displayCutout)
.only(WindowInsetsSides.Horizontal)
Box(
modifier = Modifier
.windowInsetsPadding(horizontalInsets),
) {
header()
}
val shape = MaterialTheme.shapes.extraLarge
.copy(
bottomStart = CornerSize(0.dp),
bottomEnd = CornerSize(0.dp),
)
Box(
modifier = Modifier
.clip(shape)
.background(MaterialTheme.colorScheme.background)
.fillMaxSize(),
) {
content()
}
}
}
@Composable
fun AppInfo(
packageName: String?,
webDomain: String?,
webScheme: String?,
) {
when {
webDomain != null && webScheme != null -> {
AppInfoWeb(
webDomain = webDomain,
webScheme = webScheme,
)
}
packageName != null -> {
AppInfoAndroid(
packageName = packageName,
)
}
else -> {
Text(
text = "Autofill with Keyguard",
style = MaterialTheme.typography.titleMedium,
overflow = TextOverflow.Ellipsis,
maxLines = 1,
)
}
}
}
@Composable
private fun AppInfoWeb(
webDomain: String,
webScheme: String,
) {
var state by remember(webDomain) {
mutableStateOf<Loadable<AppInfoData>>(Loadable.Loading)
}
LaunchedEffect(webDomain) {
val data = AppInfoData(
label = webDomain,
icon = {
FaviconImage(
modifier = Modifier
.clip(CircleShape),
imageModel = {
FaviconUrl(
url = "$webScheme://$webDomain",
)
},
)
},
)
state = Loadable.Ok(data)
}
AppInfo(
state = state,
)
}
@Composable
private fun AppInfoAndroid(
packageName: String,
) {
val linkInfoExtractors: List<LinkInfoExtractor<LinkInfoPlatform.Android, LinkInfoAndroid>> by rememberDI {
allInstances()
}
var state by remember(packageName) {
mutableStateOf<Loadable<AppInfoData>>(Loadable.Loading)
}
LaunchedEffect(packageName) {
val linkInfo = LinkInfoPlatform.Android(packageName)
val linkInfoData = linkInfoExtractors
.filter { it.from == LinkInfoPlatform.Android::class && it.handles(linkInfo) }
.firstNotNullOfOrNull { extractor ->
val model = extractor
.extractInfo(linkInfo)
.attempt()
.bind()
.getOrNull()
when (model) {
is LinkInfoAndroid.Installed ->
AppInfoData(
label = model.label,
icon = {
Image(
modifier = Modifier
.clip(CircleShape),
painter = model.icon,
contentDescription = null,
)
},
)
else -> null
}
}
?: AppInfoData(label = packageName)
state = Loadable.Ok(linkInfoData)
}
AppInfo(
state = state,
)
}
@Composable
private fun AppInfo(
state: Loadable<AppInfoData>,
) {
Row(
verticalAlignment = Alignment.CenterVertically,
) {
val icon = remember(state) {
when (state) {
is Loadable.Loading ->
composable {
CircularProgressIndicator(
color = LocalContentColor.current,
)
}
is Loadable.Ok -> if (state.value.icon != null) {
composable {
state.value.icon.invoke()
}
} else {
// do not show an icon
null
}
}
}
ExpandedIfNotEmptyForRow(valueOrNull = icon) { content ->
Row {
Box(
modifier = Modifier
.size(24.dp),
) {
content()
}
Spacer(
modifier = Modifier
.width(16.dp),
)
}
}
Column {
Text(
text = "Autofill for",
style = MaterialTheme.typography.labelSmall,
color = LocalContentColor.current
.combineAlpha(MediumEmphasisAlpha),
overflow = TextOverflow.Ellipsis,
maxLines = 1,
)
if (state is Loadable.Ok) {
Text(
text = state.value.label,
style = MaterialTheme.typography.titleMedium,
overflow = TextOverflow.Ellipsis,
maxLines = 1,
)
}
}
}
}
private class AppInfoData(
val label: String,
val icon: (@Composable () -> Unit)? = null,
)
| 66
|
Kotlin
|
31
| 995
|
557bf42372ebb19007e3a8871e3f7cb8a7e50739
| 9,128
|
keyguard-app
|
Linux Kernel Variant of OpenIB.org license
|
app/src/main/kotlin/org/dark0ghost/android_screen_recorder/base/AbstractBaseRecordable.kt
|
dark0ghost
| 419,300,128
| false
| null |
package org.dark0ghost.android_screen_recorder.base
import android.Manifest
import android.app.Activity
import android.content.Context
import android.content.Intent
import android.media.projection.MediaProjectionManager
import android.os.Build
import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater
import android.view.ViewGroup
import android.widget.ImageButton
import android.widget.RelativeLayout
import android.widget.Toast
import androidx.activity.result.contract.ActivityResultContracts
import androidx.appcompat.app.AppCompatActivity
import androidx.core.app.ActivityCompat
import androidx.lifecycle.lifecycleScope
import com.hbisoft.hbrecorder.HBRecorderListener
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.delay
import kotlinx.coroutines.isActive
import kotlinx.coroutines.launch
import org.dark0ghost.android_screen_recorder.R
import org.dark0ghost.android_screen_recorder.controllers.RecordController
import org.dark0ghost.android_screen_recorder.controllers.SpeechController
import org.dark0ghost.android_screen_recorder.interfaces.Recordable
import org.dark0ghost.android_screen_recorder.utils.*
import org.dark0ghost.android_screen_recorder.states.ClickState
import org.dark0ghost.android_screen_recorder.ui.activity.MainActivity
abstract class AbstractBaseRecordable: AppCompatActivity() {
private val permissionsLauncher = registerForActivityResult(
ActivityResultContracts.RequestMultiplePermissions()
) { result ->
if (isPermissionsGranted(result)) {
recordScreenLauncher.launch(getScreenCaptureIntent(this@AbstractBaseRecordable))
} else {
var arrayPermission = arrayOf(
Manifest.permission.RECORD_AUDIO,
)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
arrayPermission = arrayOf(
Manifest.permission.RECORD_AUDIO,
Manifest.permission.FOREGROUND_SERVICE
)
}
ActivityCompat.requestPermissions(
this,
arrayPermission,
Settings.AudioRecordSettings.PERMISSIONS_REQUEST_RECORD_AUDIO
)
}
}
private val recordScreenLauncher = registerForActivityResult(
ActivityResultContracts.StartActivityForResult()
) { activityResult ->
if (activityResult.resultCode == RESULT_OK) {
val mediaProjectionMain =
projectionManager.getMediaProjection(
activityResult.resultCode,
activityResult.data ?: Intent()
)
serviceController.setupMediaProjection(mediaProjectionMain)
serviceController.setRecorder(this as Context, object : HBRecorderListener {
override fun HBRecorderOnStart() = Unit
override fun HBRecorderOnComplete() = Unit
override fun HBRecorderOnError(errorCode: Int, reason: String?) = Unit
})
serviceController.setActivity(this)
try {
tryStartRecording(activityResult.data?: Intent(), activityResult.resultCode)
} catch (e : IllegalStateException) {
Log.e("recoder", "no record", e)
}
} else {
Toast.makeText(
this,
"Screen Cast Permission Denied", Toast.LENGTH_SHORT
).show()
}
}
private lateinit var inlineButton: ImageButton
protected lateinit var projectionManager: MediaProjectionManager
protected lateinit var serviceController: RecordController
protected lateinit var speechController: SpeechController
protected lateinit var listRecordable: List<Recordable>
protected var isStartRecord: ClickState = ClickState.NotClicked
private fun tryStartRecording(data: Intent, resultCode: Int) {
lifecycleScope.launch {
while (isActive && !serviceController.connected) {
Log.d("tryStartRecording", "start service")
serviceController.startService()
}
if (!isActive) return@launch
val permissions =
Settings.PermissionsSettings.RECORD_AUDIO_PERMISSIONS
val permissionsGranted = isPermissionsGranted(this@AbstractBaseRecordable, permissions)
Log.d(
"tryStartRecording",
"isMediaProjectionConfigured:${serviceController.isMediaProjectionConfigured}"
)
if (permissionsGranted && serviceController.isMediaProjectionConfigured) {
Log.d("tryStartRecording", "start record")
startRecording(data, resultCode, this@AbstractBaseRecordable)
} else if (!permissionsGranted) {
Log.d("tryStartRecording", "get permissions")
permissionsLauncher.launch(permissions)
} else if (!serviceController.isMediaProjectionConfigured) {
Log.d("tryStartRecording", "launch")
recordScreenLauncher.launch(getScreenCaptureIntent(this@AbstractBaseRecordable))
}
}
}
protected open fun startRecording(data: Intent, resultCode: Int, activity: Activity) {
inlineButton.setImageResource(R.drawable.pause)
listRecordable.forEach {
startRecordable(it, data, resultCode, activity)
}
}
protected open fun stopRecording() {
inlineButton.setImageResource(R.drawable.recording_64)
listRecordable.forEach {
stopRecordable(it)
}
}
protected fun clickButton(): ClickState {
Log.d("clickButton", "start")
when (isStartRecord) {
ClickState.NotClicked -> {
Log.d("clickButton", "start record")
isStartRecord = ClickState.IsClicked
recordScreenLauncher.launch(getScreenCaptureIntent(this@AbstractBaseRecordable))
return ClickState.IsClicked
}
ClickState.IsClicked -> {
Log.e("clickButton", "stop record")
stopRecording()
isStartRecord = ClickState.NotClicked
return ClickState.NotClicked
}
else -> Log.e("clickButton", "isStartRecord have state:$isStartRecord, this is ok?")
}
return ClickState.NotUsed
}
protected fun initService() {
Log.d("initService", "init")
serviceController = RecordController(this)
speechController = SpeechController(this)
listRecordable = listOf<Recordable>(speechController, serviceController)
lifecycleScope.launch {
Log.d("initService", "start service")
if (!serviceController.connected) {
serviceController.startService()
}
if (!speechController.connected) {
speechController.startService()
}
}
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val nullParent: ViewGroup? = null
val topView = LayoutInflater.from(this).inflate(R.layout.revolt, nullParent) as RelativeLayout
inlineButton = topView.findViewById(R.id.grub)
}
}
| 0
|
Kotlin
|
0
| 0
|
0e9d863512a724c69ec26e510ffdb703849f2dd6
| 7,295
|
android-screen-recorder
|
The Unlicense
|
app/src/main/java/xyz/palaocorona/util/TYPE.kt
|
SaadAAkash
| 251,509,106
| false
| null |
package xyz.palaocorona.util
enum class TYPE(val value: String) {
NORMAL("normal"),
CHIP("chip"),
BUTTON("button")
}
| 0
|
Kotlin
|
7
| 57
|
80f69ecfd5941962d7e5bd5f02d5cf36064e6fc5
| 120
|
COVID-19-Bangladesh-Android
|
MIT License
|
app/src/main/java/dk/martin/invasiongame/invasiongame/world/World.kt
|
martinloesethjensen
| 181,976,806
| false
|
{"Kotlin": 38980}
|
package dk.martin.invasiongame.invasiongame.world
import android.util.Log
import dk.martin.invasiongame.gameengine.engine.core.GameEngine
import dk.martin.invasiongame.invasiongame.CollisionListener
import dk.martin.invasiongame.invasiongame.model.Bullet
import dk.martin.invasiongame.invasiongame.model.Enemy
import dk.martin.invasiongame.invasiongame.model.Eye
import kotlin.random.Random
class World(
var gameEngine: GameEngine,
var collisionListener: CollisionListener
) {
companion object {
const val MIN_X = 0
const val MAX_X = 320
const val MIN_Y = 0
const val MAX_Y = 480
}
var level = 1
var hits = 0
var points = 0
var lostLife = false
var lives = 3
var enemies = arrayListOf<Enemy>()
var maxEnemies = 5
var gameOver = false
var canon = Eye()
var isShot = false
var bullets = arrayListOf<Bullet>()
var maxShots = 4
var enemyMaxSpeed = 4
fun update(deltaTime: Float, accelerometerX: Float) {
Log.d("World", "Level: $level")
Log.d("World", "Hits: $hits")
Log.d("World", "Points: $points")
Log.d("World", "Lives: $lives")
updateCanon(deltaTime = deltaTime, accelerometerX = accelerometerX)
updateBullets(deltaTime = deltaTime)
updateEnemies(deltaTime = deltaTime)
checkCollisionBulletAndEnemy()
}
private fun updateCanon(deltaTime: Float, accelerometerX: Float) {
canon.acceleratorX = accelerometerX * deltaTime
canon.rotate = canon.acceleratorX * 25
}
private fun updateBullets(deltaTime: Float) {
bullets.forEach { bullet ->
// recycle the bullet if it goes off the boundaries
if (bullet.y < 0 - Bullet.HEIGHT || bullet.x > 320 + Bullet.WIDTH || bullet.x < 0 - Bullet.WIDTH || bullet.shotExhausted) {
bullet.x = (160 + Bullet.WIDTH / 2).toFloat()
bullet.y = Bullet.START_Y
bullet.speed = 5
bullet.shotExhausted = false
}
// updates the speed and the y coordinate of the bullet
bullet.speed += (bullet.speed * deltaTime).toInt()
bullet.y -= (bullet.speed * deltaTime * 25).toInt()
// updates the x coordinate according to the degrees of the bullet
if (-bullet.degrees > 0) {
bullet.x += (Math.sin(90 + (-bullet.degrees.toDouble())) * deltaTime + ((-bullet.degrees)) / 10).toFloat()
} else if (-bullet.degrees < 0) {
bullet.x += (Math.sin(90 - (-bullet.degrees.toDouble())) * deltaTime - ((bullet.degrees)) / 10).toFloat()
}
}
}
private fun updateEnemies(deltaTime: Float) {
enemies.forEach { enemy ->
if (enemy.isDead) {
enemy.x = Random.nextInt(Enemy.WIDTH, 320 - Enemy.WIDTH)
enemy.y = 0f - Enemy.HEIGHT
enemy.isDead = false
enemy.hit = 1
}
if (enemy.y > MAX_Y - 100) {
lives--
lostLife = true
if (lives == 0) {
gameOver = true
return@forEach
}
enemy.isDead = true
}
enemy.y += (enemy.speed * deltaTime) * enemyMaxSpeed
}
}
private fun checkCollisionBulletAndEnemy() {
enemies.forEach { enemy ->
bullets.forEach { bullet ->
if (collideEnemy(
bullet.x,
bullet.y,
Bullet.WIDTH,
Bullet.HEIGHT,
enemy.x,
enemy.y,
Enemy.WIDTH,
Enemy.HEIGHT
)
) {
bullet.shotExhausted = true
if (enemy.hit < 4) enemy.hit++
else {
points += 10
hits++
if (hits == maxEnemies) {
level++
enemyMaxSpeed += level / 10
maxEnemies += level
Log.d("maxenemies", "maxenemies: $maxEnemies")
}
enemy.isDead = true
}
}
}
}
}
private fun collideEnemy(
x: Float,
y: Int,
width: Int,
height: Int,
x2: Int,
y2: Float,
width2: Int,
height2: Int
): Boolean {
return (x < (x2 + width2) && (x + width) > x2 && y < (y2 + height2) && (y + height) > y2)
}
fun addShotToList() {
if (isShot) bullets.add(Bullet())
isShot = false
}
fun addEnemyToList() {
enemies.add(Enemy(speed = Random.nextInt(2, this.enemyMaxSpeed)))
}
}
| 0
|
Kotlin
|
0
| 0
|
0868763b30d816db1a67f78cddd3cf70d6487985
| 4,956
|
invasiongame
|
MIT License
|
minek-core/src/main/kotlin/minek/core/extension/string.kt
|
mine-k-projects
| 235,042,294
| false
| null |
package minek.core.extension
import java.util.*
fun String.uuid(): UUID? = try {
UUID.fromString(this)
} catch (e: IllegalArgumentException) {
null
}
fun String.truncate(length: Int, truncateString: String = Typography.ellipsis.toString()): String =
if (this.length <= length) {
this
} else {
this.substring(0, length) + truncateString
}
fun String.base64Encoded(): String = Base64.getEncoder().encodeToString(toByteArray())
fun String.base64Decoded(): String? = try {
String(Base64.getDecoder().decode(toByteArray()))
} catch (e: IllegalArgumentException) {
null
}
fun String.isNumeric(): Boolean = this.matches("-?\\d+(\\.\\d+)?".toRegex())
fun String.isDigit(): Boolean = this.matches("^[0-9]*\$".toRegex())
fun String.dropLast(s: String): String {
val lastIndexOf = this.lastIndexOf(s)
if (lastIndexOf == -1) return this
return this.substring(0, lastIndexOf)
}
| 0
|
Kotlin
|
0
| 0
|
31ad54eadbcafbe5983c60541ad714338b1b11d4
| 927
|
mine-k-web
|
MIT License
|
app/src/main/kotlin/com/hujiayucc/rpointer/utils/Data.kt
|
hujiayucc
| 728,559,575
| false
|
{"Kotlin": 18146}
|
package com.hujiayucc.rpointer.utils
import android.annotation.SuppressLint
import android.content.Context
import android.os.Parcelable
import com.highcapable.yukihookapi.hook.xposed.prefs.data.PrefsData
import com.hujiayucc.rpointer.R
import com.hujiayucc.rpointer.ui.adapter.Type
import java.util.*
object Data {
var recyclerState: Parcelable? = null
val themePref = PrefsData("themeItem", 0)
val languages = PrefsData("language", 0)
val hookType = PrefsData("hookType", Type.App.name)
val hookIcon = PrefsData<Any>("hookIcon", R.drawable.pointer_arrow)
val themeList = intArrayOf(
R.style.Theme_RPointer_Default,
R.style.Theme_RPointer_Pink,
R.style.Theme_RPointer_Blue,
R.style.Theme_RPointer_Yellow,
R.style.Theme_RPointer_Green,
R.style.Theme_RPointer_Red,
R.style.Theme_RPointer_Orange
)
var recyclerItem = hashMapOf<String, Int>()
val Context.themeItems get() = arrayOf(
getString(R.string.theme_default),
getString(R.string.pink),
getString(R.string.blue),
getString(R.string.yellow),
getString(R.string.green),
getString(R.string.red),
getString(R.string.orange)
)
@SuppressLint("ConstantLocale")
val localeList = arrayOf(
Locale.getDefault(),
Locale.ENGLISH,
Locale.CHINESE
)
val Context.languageItem get() = arrayOf(
getString(R.string.language_auto),
getString(R.string.language_english),
getString(R.string.language_chinese)
)
}
| 0
|
Kotlin
|
0
| 2
|
499607cfe8beb2b5a14dc93c2c016f924f8dae33
| 1,564
|
R-Pointer
|
Apache License 2.0
|
socialcats-google/store/admin/src/main/kotlin/InsertUser.kt
|
Couchsurfing
| 194,353,465
| false
| null |
package com.nicolasmilliard.socialcats.store
data class InsertUser(
val uid: String,
val name: String? = null,
val phoneNumber: String? = null,
val email: String? = null,
val emailVerified: Boolean? = null,
val photoUrl: String? = null
)
| 4
|
Kotlin
|
1
| 3
|
ebc38cc10a392d0a5ff0247c15230edc420e3be9
| 263
|
social-cats-playground
|
Apache License 2.0
|
capabilities/src/main/kotlin/com/apoorvgupta/capabilities/presentation/navigation/ui/BottomNavItem.kt
|
apoorvgupta25
| 797,378,079
| false
|
{"Kotlin": 192498}
|
package com.apoorvgupta.capabilities.presentation.navigation.ui
data class BottomNavItem(
val displayBadge: Boolean,
val navigationRoute: Any,
val position: Int,
val title: String,
val visible: Boolean,
var badgeCount: Int,
val icon: Int,
val filledIcon: Int,
)
| 1
|
Kotlin
|
0
| 0
|
9855046d046c2251763b4b311366c104d7746208
| 295
|
news-shots-android-app
|
The Unlicense
|
speechhelper/src/main/java/com/pineapplepie/speechhelper/texttospeech/Sentence.kt
|
PineapplePie
| 737,869,043
| false
|
{"Kotlin": 11789}
|
package com.pineapplepie.speechhelper.texttospeech
import java.util.UUID
internal data class Sentence(val text: String, val utteranceId: String = UUID.randomUUID().toString())
| 0
|
Kotlin
|
0
| 2
|
b8e29828eef764a1274082e00425216305b92aed
| 178
|
SpeechHelper
|
Apache License 2.0
|
src/main/kotlin/be/yellowduck/gpx/DistanceSerializer.kt
|
pieterclaerhout
| 368,597,988
| false
| null |
package be.yellowduck.gpx
import com.fasterxml.jackson.core.JsonGenerator
import com.fasterxml.jackson.core.JsonProcessingException
import com.fasterxml.jackson.databind.ser.std.StdSerializer
import com.fasterxml.jackson.databind.SerializerProvider
import kotlinx.serialization.KSerializer
import kotlinx.serialization.descriptors.PrimitiveKind
import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor
import kotlinx.serialization.descriptors.SerialDescriptor
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder
import java.io.IOException
class DistanceSerializer @JvmOverloads constructor(t: Class<Distance>? = null) : KSerializer<Distance>, StdSerializer<Distance>(t) {
@Throws(IOException::class, JsonProcessingException::class)
override fun serialize(
value: Distance?, jgen: JsonGenerator, provider: SerializerProvider?
) {
if (value == null) {
jgen.writeNull()
} else {
jgen.writeNumber(value.meters)
}
}
override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("Distance", PrimitiveKind.STRING)
override fun serialize(encoder: Encoder, value: Distance) {
encoder.encodeDouble(value.meters)
}
override fun deserialize(decoder: Decoder): Distance {
return Distance(decoder.decodeDouble())
}
}
| 0
|
Kotlin
|
0
| 1
|
72b9c4b733a4caf76f691723545c40e837a8c9dd
| 1,378
|
kotlin-yellowduck-gpx
|
MIT License
|
app-flux/src/main/kotlin/com/trickring/app_flux/flux/Store.kt
|
matsushitak
| 226,314,711
| false
| null |
package com.trickring.app_flux.flux
import androidx.lifecycle.AndroidViewModel
import androidx.lifecycle.viewModelScope
import com.trickring.app_flux.App
import kotlinx.coroutines.CoroutineScope
/**
* Store
*
* @param app Application Class
*/
abstract class Store(app: App) : AndroidViewModel(app) {
/**
* Application Class
*/
val application: App get() = getApplication()
/**
* Store Scope
*/
val scope: CoroutineScope get() = viewModelScope
}
| 0
|
Kotlin
|
0
| 0
|
0f702e7b95d91bb63a61fa104da0195689c34d7a
| 489
|
Awesome-Android
|
Apache License 2.0
|
frfragmentlistener/src/main/java/org/fog_rock/frfragmentlistener/fragment/FRFragmentListener.kt
|
sallyluenoa
| 371,963,151
| false
|
{"Kotlin": 68339}
|
/*
* Copyright (c) 2021 SallyLueNoa
*
* 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 org.fog_rock.frfragmentlistener.fragment
/**
* A listener interface for fragment events.
* @see org.fog_rock.frfragmentlistener.activity.FRAppCompatActivity.registerForFragmentListener
* @see org.fog_rock.frfragmentlistener.fragment.restoreFragmentEventListener
* @sample org.fog_rock.frfragmentlistenersample.sample.SampleFragment.Listener
* @sample org.fog_rock.frfragmentlistenersample.sample.SampleActivity.fragmentListenerKey
* @sample org.fog_rock.frfragmentlistenersample.sample.SampleFragment.newInstance
* @sample org.fog_rock.frfragmentlistenersample.sample.SampleFragment.listener
*/
interface FRFragmentListener {
companion object {
/**
* A key of the pair for registering a fragment listener key to arguments of fragment.
* @sample org.fog_rock.frfragmentlistenersample.sample.SampleFragment.newInstance
*/
const val ARGS_LISTENER_KEY = "listener_key"
}
}
| 2
|
Kotlin
|
0
| 0
|
fae0ba27b2372193cc570cc32d443734ee795cc2
| 1,537
|
FRFragmentListener
|
Apache License 2.0
|
rounded/src/commonMain/kotlin/me/localx/icons/rounded/outline/TachometerSlow.kt
|
localhostov
| 808,861,591
| false
|
{"Kotlin": 79430321, "HTML": 331, "CSS": 102}
|
package me.localx.icons.rounded.outline
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.graphics.StrokeCap.Companion.Butt
import androidx.compose.ui.graphics.StrokeJoin.Companion.Miter
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp
import me.localx.icons.rounded.Icons
public val Icons.Outline.TachometerSlow: ImageVector
get() {
if (_tachometerSlow != null) {
return _tachometerSlow!!
}
_tachometerSlow = Builder(name = "TachometerSlow", defaultWidth = 512.0.dp, defaultHeight =
512.0.dp, viewportWidth = 24.0f, viewportHeight = 24.0f).apply {
path(fill = SolidColor(Color(0xFF000000)), stroke = null, strokeLineWidth = 0.0f,
strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = 4.0f,
pathFillType = NonZero) {
moveTo(20.445f, 21.516f)
arcToRelative(3.014f, 3.014f, 0.0f, false, true, -4.073f, 0.128f)
lineToRelative(-1.026f, -0.887f)
arcToRelative(1.0f, 1.0f, 0.0f, false, true, 1.308f, -1.514f)
lineToRelative(1.027f, 0.888f)
arcToRelative(1.0f, 1.0f, 0.0f, false, false, 1.356f, -0.036f)
arcToRelative(10.0f, 10.0f, 0.0f, true, false, -14.113f, -0.039f)
arcToRelative(1.016f, 1.016f, 0.0f, false, false, 1.395f, 0.076f)
lineToRelative(1.027f, -0.889f)
arcToRelative(1.0f, 1.0f, 0.0f, true, true, 1.308f, 1.514f)
lineToRelative(-1.026f, 0.888f)
arcToRelative(3.04f, 3.04f, 0.0f, false, true, -4.12f, -0.175f)
arcTo(12.0f, 12.0f, 0.0f, false, true, 13.383f, 1.077f)
arcToRelative(11.994f, 11.994f, 0.0f, false, true, 7.062f, 20.439f)
close()
moveTo(12.0f, 11.0f)
arcToRelative(2.01f, 2.01f, 0.0f, false, false, -0.518f, 0.068f)
lineTo(7.707f, 7.293f)
arcTo(1.0f, 1.0f, 0.0f, false, false, 6.293f, 8.707f)
lineToRelative(3.775f, 3.775f)
arcTo(2.0f, 2.0f, 0.0f, true, false, 12.0f, 11.0f)
close()
}
}
.build()
return _tachometerSlow!!
}
private var _tachometerSlow: ImageVector? = null
| 1
|
Kotlin
|
0
| 5
|
cbd8b510fca0e5e40e95498834f23ec73cc8f245
| 2,589
|
icons
|
MIT License
|
app/src/main/java/com/example/runworkshop/data/model/database/entities/ConsultoraDatabase.kt
|
MrPartner
| 624,642,559
| false
|
{"Kotlin": 59388}
|
package com.example.runworkshop.data.model.database.entities
import androidx.room.Database
import androidx.room.RoomDatabase
import com.example.runworkshop.data.model.database.entities.dao.ConsultoraDao
@Database(entities = [ConsultoraEntity::class], version = 1)
abstract class ConsultoraDatabase : RoomDatabase() {
abstract fun getConsultoraDao(): ConsultoraDao
}
| 0
|
Kotlin
|
0
| 0
|
0f89e03dac29ab4b0054c26f8494958c69f2ebb2
| 373
|
RunWorkshop
|
Apache License 2.0
|
app/src/main/java/com/example/nike/services/ImageLoadingService.kt
|
SamTech0101
| 734,533,979
| false
|
{"Kotlin": 92515, "Java": 22121}
|
package com.example.nike.services
import com.example.nike.view.NikeImageView
interface ImageLoadingService {
fun load(imageView: NikeImageView, imageUrl:String)
}
| 0
|
Kotlin
|
0
| 0
|
b9bc7173d7ee92fa898f77a65dd2b2e3d2db545c
| 168
|
NikeSample
|
Apache License 2.0
|
src/main/kotlin/org/jdc/template/util/WebServiceUtil.kt
|
lethalskillzz
| 115,807,551
| true
|
{"Kotlin": 114049, "Java": 3829}
|
package org.jdc.template.util
import okhttp3.ResponseBody
import retrofit2.Response
import timber.log.Timber
import java.io.File
import javax.inject.Inject
import javax.inject.Singleton
@Singleton
class WebServiceUtil
@Inject
constructor() {
fun saveResponseToFile(response: Response<ResponseBody>, outputFile: File): Boolean {
Timber.d("Saving response [${response.raw().request().url().url()}] to file [${outputFile.absolutePath}]...")
response.body()?.let {
outputFile.copyInputStreamToFile(it.byteStream())
}
return outputFile.exists()
}
}
| 0
|
Kotlin
|
0
| 1
|
fb19980f455eefb957ae12d40b53baadc3729f38
| 598
|
android-template
|
Apache License 2.0
|
app/src/main/java/com/microsoft/device/samples/dualscreenexperience/presentation/devmode/DevModeViewModel.kt
|
microsoft
| 333,507,793
| false
| null |
/*
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*
*/
package com.microsoft.device.samples.dualscreenexperience.presentation.devmode
import androidx.annotation.StringRes
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import com.microsoft.device.samples.dualscreenexperience.R
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject
@HiltViewModel
class DevModeViewModel @Inject constructor(
private val navigator: DevModeNavigator
) : ViewModel() {
val webViewUrl = MutableLiveData(DESIGN_PATTERN_BASE_URL)
var designPattern = DesignPattern.EXTENDED_CANVAS
var sdkComponent = SdkComponent.BOTTOM_NAVIGATION_VIEW
var appScreen = AppScreen.STORES_MAP
var acceptedHosts = listOf("docs.microsoft.com")
fun navigateToContent() {
navigator.navigateToContent()
}
fun isNavigationAtContent() = navigator.isNavigationAtContent()
fun navigateUp() {
navigator.navigateUp()
}
fun loadDesignPatternPage() {
webViewUrl.value = designPattern.buildUrl()
}
fun loadSdkComponentPage() {
webViewUrl.value = sdkComponent.buildUrl()
}
fun loadAppScreenPage() {
webViewUrl.value = appScreen.buildUrl()
}
enum class DesignPattern(var path: String, @StringRes var stringResId: Int) {
EXTENDED_CANVAS("extended-canvas", R.string.dev_mode_extended_canvas),
LIST_DETAIL("list-detail", R.string.dev_mode_list_detail),
DUAL_VIEW("dual-view", R.string.dev_mode_dual_view),
TWO_PAGE("two-page", R.string.dev_mode_two_page),
COMPANION_PANE("companion-pane", R.string.dev_mode_companion_pane),
NONE("introduction#dual-screen-app-patterns", 0);
fun buildUrl() = "$DESIGN_PATTERN_BASE_URL/$path"
companion object {
fun get(path: String?) = values().first { it.path == path }
}
}
enum class SdkComponent(var path: String) {
BOTTOM_NAVIGATION_VIEW("bottomnavigation/surfaceduo-bottomnavigationview"),
NAVIGATION("navigation-component/"),
RECYCLER_VIEW("recyclerview/");
fun buildUrl() = "$SDK_BASE_URL/$path$LANGUAGE_TAB"
companion object {
fun get(path: String?) = values().first { it.path == path }
}
}
enum class AppScreen(var path: String) {
STORES_MAP("store/map/StoreMapFragment.kt"),
STORES_LIST("store/list/StoreListFragment.kt"),
STORES_DETAILS("store/details/StoreDetailsFragment.kt"),
CATALOG("catalog/CatalogListFragment.kt"),
PRODUCTS_LIST_DETAILS("product/details/ProductDetailsFragment.kt"),
PRODUCTS_CUSTOMIZE("product/customize/ProductCustomizeFragment.kt"),
ORDER("order/OrderFragment.kt"),
HISTORY_LIST_DETAILS("history/HistoryListFragment.kt");
fun buildUrl() = "$APP_BASE_URL/$path"
companion object {
fun get(path: String?) = values().first { it.path == path }
}
}
companion object {
const val DESIGN_PATTERN_BASE_URL = "https://docs.microsoft.com/dual-screen/design"
const val SDK_BASE_URL = "https://docs.microsoft.com/dual-screen/android/api-reference/dualscreen-library"
const val LANGUAGE_TAB = "?tabs=kotlin"
const val APP_BASE_URL = "https://github.com/microsoft/surface-duo-dual-screen-experience-example/blob/main/app/src/main/java/com/microsoft/device/samples/dualscreenexperience/presentation/"
}
}
| 1
| null |
6
| 29
|
76577bf9cb72fc5cadd0170652936cd7fc30e3f5
| 3,540
|
surface-duo-dual-screen-experience-example
|
MIT License
|
bindings/gtk/gdk4/src/nativeMain/kotlin/org/gtkkn/bindings/gdk/ProximityEvent.kt
|
gtk-kn
| 609,191,895
| false
|
{"Kotlin": 10448515, "Shell": 2740}
|
// This is a generated file. Do not modify.
package org.gtkkn.bindings.gdk
import kotlinx.cinterop.CPointer
import kotlinx.cinterop.reinterpret
import org.gtkkn.extensions.gobject.GeneratedClassKGType
import org.gtkkn.extensions.gobject.KGTyped
import org.gtkkn.extensions.gobject.TypeCompanion
import org.gtkkn.native.gdk.GdkProximityEvent
import org.gtkkn.native.gdk.gdk_proximity_event_get_type
/**
* An event related to the proximity of a tool to a device.
*/
public open class ProximityEvent(
pointer: CPointer<GdkProximityEvent>,
) : Event(pointer.reinterpret()), KGTyped {
public val gdkProximityEventPointer: CPointer<GdkProximityEvent>
get() = gPointer.reinterpret()
public companion object : TypeCompanion<ProximityEvent> {
override val type: GeneratedClassKGType<ProximityEvent> =
GeneratedClassKGType(gdk_proximity_event_get_type()) {
ProximityEvent(it.reinterpret())
}
init {
GdkTypeProvider.register()
}
}
}
| 0
|
Kotlin
|
0
| 13
|
c033c245f1501134c5b9b46212cd153c61f7efea
| 1,028
|
gtk-kn
|
Creative Commons Attribution 4.0 International
|
Dorstip-App-main/app/src/main/java/com/example/dorstip_app/dashboard/MainActivity.kt
|
AlexChulo
| 807,077,254
| false
|
{"Kotlin": 27119}
|
package com.example.dorstip_app.dashboard
import android.os.Bundle
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import androidx.viewpager2.widget.CompositePageTransformer
import androidx.viewpager2.widget.MarginPageTransformer
import com.example.dorstip_app.dashboard.BannerSlider.SliderAdapter
import com.example.dorstip_app.dashboard.BannerSlider.SliderModel
import com.example.dorstip_app.dashboard.Categories.CategoryAdapter
import com.example.dorstip_app.dashboard.Products.ItemModel
import com.example.dorstip_app.dashboard.Products.ProductAdapter
import com.example.dorstip_app.databinding.ActivityMainBinding
class MainActivity : AppCompatActivity() {
private val viewModel = MainViewModel() // Create an instance of MainViewModel
private lateinit var binding: ActivityMainBinding // Initialize ActivityMainBinding
private lateinit var adapter: ProductAdapter // Assuming you have a RecyclerView adapter for products
private lateinit var products: List<ItemModel> // Assuming you have a list of products
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root)
initBanner() // Initialize the banner
initCategory() // Initialize the category
initProduct() // Initialize the product items
}
// Function to initialize the banner
private fun initBanner() {
viewModel.banners.observe(this, Observer { items ->
banners(items)
})
viewModel.loadBanners()
}
// Function to set up the banner with images
private fun banners(images: List<SliderModel>) {
// Set up ViewPager2 for the banner
binding.vpBanner.adapter = SliderAdapter(images, binding.vpBanner)
binding.vpBanner.clipToPadding = false
binding.vpBanner.clipChildren = false
binding.vpBanner.offscreenPageLimit = 3
binding.vpBanner.getChildAt(0).overScrollMode = RecyclerView.OVER_SCROLL_NEVER
// Apply a composite page transformer with margin to the ViewPager2
val compositePageTransformer = CompositePageTransformer().apply {
addTransformer(MarginPageTransformer(40))
}
binding.vpBanner.setPageTransformer(compositePageTransformer)
// If there are more than one image, show the indicator
if (images.size > 1) {
binding.diBanner.visibility = View.VISIBLE
binding.diBanner.attachTo(binding.vpBanner)
}
}
// Function to initialize the category
private fun initCategory() {
viewModel.categories.observe(this, Observer {
// Set up RecyclerView for the category
binding.rvCategory.layoutManager = LinearLayoutManager(this@MainActivity, LinearLayoutManager.HORIZONTAL, false)
binding.rvCategory.adapter = CategoryAdapter(it)
})
viewModel.loadCategory() // Load categories from ViewModel
}
// Function to initialize the product items
private fun initProduct() {
viewModel.products.observe(this, Observer {
// Set up RecyclerView for recommended items
binding.rvDrinks.layoutManager = GridLayoutManager(this@MainActivity, 2)
binding.rvDrinks.adapter = ProductAdapter(it)
})
viewModel.loadRecommended() // Load recommended items from ViewModel
}
}
| 3
|
Kotlin
|
0
| 0
|
6376898f23b871bdcaff4806dfa58609da398f55
| 3,657
|
Dorstip-App2
|
MIT License
|
solve-lpaas/src/main/kotlin/it/unibo/tuprolog/solve/lpaas/client/trasparent/TrasparentClient.kt
|
pikalab-unibo-students
| 593,963,677
| false
|
{"Kotlin": 3974165, "Java": 19220, "ANTLR": 10366, "CSS": 3070, "Prolog": 818, "Dockerfile": 369}
|
package it.unibo.tuprolog.solve.lpaas.client.trasparent
import it.unibo.tuprolog.core.Struct
import it.unibo.tuprolog.core.operators.OperatorSet
import it.unibo.tuprolog.solve.Solution
import it.unibo.tuprolog.solve.SolveOptions
import it.unibo.tuprolog.solve.Solver
import it.unibo.tuprolog.solve.channel.InputChannel
import it.unibo.tuprolog.solve.channel.InputStore
import it.unibo.tuprolog.solve.channel.OutputChannel
import it.unibo.tuprolog.solve.channel.OutputStore
import it.unibo.tuprolog.solve.flags.FlagStore
import it.unibo.tuprolog.solve.library.Runtime
import it.unibo.tuprolog.solve.lpaas.client.ClientSolver
import it.unibo.tuprolog.solve.lpaas.util.convertStringToKnownLibrary
import it.unibo.tuprolog.solve.lpaas.util.toMap
import it.unibo.tuprolog.theory.Theory
import it.unibo.tuprolog.unify.Unificator
abstract class TrasparentClient: Solver {
protected abstract val solver: ClientSolver
override fun solve(goal: Struct, options: SolveOptions): Sequence<Solution> {
return solver.solve(goal, options).asSequence()
}
override val unificator: Unificator
get() = solver.getUnificator()
override val libraries: Runtime
get() = Runtime.of(solver.getLibraries().map { convertStringToKnownLibrary(it) })
override val flags: FlagStore
get() = solver.getFlags()
override val staticKb: Theory
get() = solver.getStaticKB()
override val dynamicKb: Theory
get() = solver.getDynamicKB()
override val operators: OperatorSet
get() = solver.getOperators()
override val inputChannels: InputStore
get() = InputStore.of(solver.getInputChannels().map {
Pair(it.key, InputChannel.of(it.value.joinToString { string -> string })) }.toMap())
override val outputChannels: OutputStore
get() = OutputStore.of(solver.getOutputChannels().map { pair ->
Pair(pair.key, OutputChannel.of<String> {
pair.value.joinToString { string -> string } }) }.toMap())
val solverId: String get() = solver.getId()
}
| 19
|
Kotlin
|
1
| 0
|
924d5337f685749eb7948ef25bdcbd890b068f2e
| 2,054
|
ds-project-osimani-ay2021
|
Apache License 2.0
|
src/test/kotlin/guru/nidi/print3d/geotiff/GeotiffTest.kt
|
nidi3
| 100,887,249
| false
| null |
package guru.nidi.print3d.geotiff
import io.kotlintest.matchers.shouldBe
import io.kotlintest.specs.StringSpec
import java.io.File
import java.util.zip.ZipFile
class GeotiffTest : StringSpec() {
init {
"load" {
val zip = ZipFile(File("src/test/resources/ASTGTM2_S78E050.zip"))
val data = zip.entries().asSequence().find {
it.name.endsWith("ASTGTM2_S78E050_dem.tif")
}!!
val tiff = GeoTiffReader.read(zip.getInputStream(data), data.size.toInt())
tiff.width shouldBe 3601
tiff.height shouldBe 3601
tiff[0, 0] shouldBe 3520
tiff.doWithLine(0) { x, p ->
println("$x $p")
}
}
}
}
| 0
|
Kotlin
|
1
| 1
|
76221ce8f9ef595b999f19bdceaef7f7d97f1569
| 741
|
print3d
|
Apache License 2.0
|
src/main/kotlin/io/datawire/loom/terraform/Backend.kt
|
datawire
| 92,783,521
| false
| null |
package io.datawire.loom.terraform
import com.fasterxml.jackson.annotation.JsonAnyGetter
import com.fasterxml.jackson.annotation.JsonView
import java.nio.file.Path
data class Backend(
@JsonView(InternalView::class)
val name: String,
@get:JsonAnyGetter
@JsonView(TemplateView::class)
val properties: Map<String, String>
)
fun createS3Backend(region: String, bucket: String, key: String, encrypt: Boolean = true) = Backend(
name = "s3",
properties = mapOf(
"encrypt" to encrypt.toString(),
"region" to region,
"bucket" to bucket,
"key" to key
)
)
fun createLocalBackend(path: Path? = null) = Backend(
name = "local",
properties = path?.let { mapOf("path" to it.toString()) } ?: emptyMap()
)
| 0
|
Kotlin
|
0
| 0
|
b7208a9bbb673d4fa87b436c125227a55d9f2049
| 773
|
loomctl
|
Apache License 2.0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.