content
stringlengths 0
3.9M
| path
stringlengths 4
242
| contentHash
stringlengths 1
10
|
---|---|---|
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.configurationStore
import com.intellij.openapi.components.impl.stores.SaveSessionAndFile
import org.jetbrains.annotations.ApiStatus
@ApiStatus.Internal
class SaveResult {
companion object {
@JvmField
internal val EMPTY = SaveResult()
}
private var error: Throwable? = null
@JvmField
internal val readonlyFiles: MutableList<SaveSessionAndFile> = mutableListOf()
@JvmField
internal var isChanged = false
@Synchronized
internal fun addError(error: Throwable) {
val existingError = this.error
if (existingError == null) {
this.error = error
}
else {
existingError.addSuppressed(error)
}
}
@Synchronized
internal fun addReadOnlyFile(info: SaveSessionAndFile) {
readonlyFiles.add(info)
}
@Synchronized
internal fun appendTo(saveResult: SaveResult) {
if (this === EMPTY) {
return
}
synchronized(saveResult) {
if (error != null) {
if (saveResult.error == null) {
saveResult.error = error
}
else {
saveResult.error!!.addSuppressed(error)
}
}
saveResult.readonlyFiles.addAll(readonlyFiles)
if (isChanged) {
saveResult.isChanged = true
}
}
}
@Synchronized
internal fun throwIfErrored() {
error?.let {
throw it
}
}
} | platform/configuration-store-impl/src/SaveResult.kt | 3632453198 |
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.webSymbols.context
import com.intellij.openapi.project.Project
import com.intellij.openapi.util.ModificationTracker
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.psi.PsiFile
import com.intellij.psi.util.CachedValueProvider
/*
* DEPRECATION -> @JvmDefault
*/
@Suppress("DEPRECATION")
interface WebSymbolsContextProvider {
/**
* Determines whether a particular, parsed file should have a particular web symbols context (like web framework) enabled.
* Such files will for example have dedicated JS expressions injected. This API serves for a purpose of enabling the
* support in particular files, when the support should not be provided on a directory level.
* It is a responsibility of the context provider to cache value if needed.
*/
@JvmDefault
fun isEnabled(file: PsiFile): Boolean = false
/**
* Determines whether a particular file should have a particular web symbols context (like web framework) enabled.
* This method is used before creating a PsiFile, so it should not try to use PsiManager to find a PsiFile.
* This API serves for a purpose of enabling the support in particular files, when the support should not be provided
* on a directory level. It is a responsibility of the context provider to cache value if needed.
*/
@JvmDefault
fun isEnabled(file: VirtualFile, project: Project): Boolean = false
/**
* Determines whether files within a particular folder should have a particular web symbols context (like web framework)
* enabled. Amongst others, html files in such folders might be parsed with dedicated parser, so
* JS expressions will be part of PSI tress instead of being injected.
* It is a responsibility of the context provider to include all dependencies of the value.
* The result is being cached.
*
* It is important that result is stable as any change will result in full reload of code insight
* and clear of all caches.
*
* Since there might be many contexts of the same kind within the same project, the result is a proximity score of how
* far from the parent folder with detected context particular folder is. 0 means that passed
* {@code directory} is the root of the project.
*
* @return {@code null} if not enabled, otherwise a proximity score
*/
@JvmDefault
fun isEnabled(project: Project, directory: VirtualFile): CachedValueProvider.Result<Int?> =
CachedValueProvider.Result(null, ModificationTracker.NEVER_CHANGED)
/**
* You can forbid context on a particular file to allow for cooperation between different
* plugins. This method is used before creating a PsiFile, so it should not try to use PsiManager to find a PsiFile.
* The result is not cached and therefore the logic should not perform time-consuming tasks, or should cache results
* on its own.
*
* It is important that result is stable as any change will result in full reload of code insight
* and clear of all caches.
*
* You can register a context provider with only a context kind, and it's {@code isForbidden} method will always be called
* and will allow you to forbid any context of the particular kind.
*/
@JvmDefault
fun isForbidden(contextFile: VirtualFile, project: Project): Boolean = false
} | platform/webSymbols/src/com/intellij/webSymbols/context/WebSymbolsContextProvider.kt | 1387604256 |
package zielu.intellij.ui
import com.intellij.openapi.Disposable
import javax.swing.JComponent
internal interface GtFormUi : Disposable {
val content: JComponent
fun init()
fun afterStateSet()
override fun dispose() {
// do nothing
}
}
| src/main/kotlin/zielu/intellij/ui/GtFormUi.kt | 2382588004 |
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.idea.asJava
import com.intellij.psi.JavaPsiFacade
import com.intellij.psi.PsiElement
import com.intellij.psi.ResolveState
import com.intellij.psi.scope.PsiScopeProcessor
import org.jetbrains.kotlin.asJava.classes.KtLightClass
import org.jetbrains.kotlin.asJava.classes.getOutermostClassOrObject
import org.jetbrains.kotlin.asJava.elements.FakeFileForLightClass
import org.jetbrains.kotlin.idea.asJava.classes.getOrCreateFirLightClass
import org.jetbrains.kotlin.psi.KtClassOrObject
class FirFakeFileImpl(private val classOrObject: KtClassOrObject, ktClass: KtLightClass) : FakeFileForLightClass(
classOrObject.containingKtFile,
{ if (classOrObject.isTopLevel()) ktClass else getOrCreateFirLightClass(getOutermostClassOrObject(classOrObject))!! },
{ null }
) {
override fun findReferenceAt(offset: Int) = ktFile.findReferenceAt(offset)
override fun processDeclarations(
processor: PsiScopeProcessor,
state: ResolveState,
lastParent: PsiElement?,
place: PsiElement
): Boolean {
if (!super.processDeclarations(processor, state, lastParent, place)) return false
// We have to explicitly process package declarations if current file belongs to default package
// so that Java resolve can find classes located in that package
val packageName = packageName
if (packageName.isNotEmpty()) return true
val aPackage = JavaPsiFacade.getInstance(classOrObject.project).findPackage(packageName)
if (aPackage != null && !aPackage.processDeclarations(processor, state, null, place)) return false
return true
}
} | plugins/kotlin/frontend-fir/src/org/jetbrains/kotlin/idea/asJava/FirFakeFileImpl.kt | 3545729119 |
internal class C private constructor(arg1: Int, arg2: Int, arg3: Int = 0) {
constructor(arg1: Int) : this(arg1, 0, 0) {}
} | plugins/kotlin/j2k/new/tests/testData/newJ2k/constructors/privateConstructors.kt | 3289705693 |
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.configurationStore.schemeManager
import com.intellij.configurationStore.LOG
import com.intellij.openapi.diagnostic.ControlFlowException
internal inline fun <T> catchAndLog(file: () -> String, runnable: () -> T): T? {
try {
return runnable()
}
catch (e: Throwable) {
if (e is ControlFlowException) throw e
LOG.error("Cannot read scheme ${file()}", e)
}
return null
}
internal fun nameIsMissed(bytes: ByteArray): RuntimeException {
return RuntimeException("Name is missed:\n${bytes.toString(Charsets.UTF_8)}")
} | platform/configuration-store-impl/src/schemeManager/schemeManagerUtil.kt | 1044465301 |
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package git4idea.ui.branch
import com.intellij.dvcs.branch.GroupingKey
import com.intellij.dvcs.branch.isGroupingEnabled
import com.intellij.dvcs.branch.setGrouping
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.ToggleAction
import com.intellij.openapi.diagnostic.Logger
import com.intellij.openapi.progress.ProgressIndicator
import com.intellij.openapi.progress.ProgressManager
import com.intellij.openapi.progress.Task
import com.intellij.openapi.project.DumbAware
import com.intellij.openapi.project.Project
import com.intellij.openapi.util.Pair
import com.intellij.openapi.vcs.VcsException
import com.intellij.openapi.vcs.VcsNotifier
import com.intellij.util.containers.ContainerUtil
import git4idea.GitLocalBranch
import git4idea.GitNotificationIdsHolder.Companion.BRANCHES_UPDATE_SUCCESSFUL
import git4idea.GitNotificationIdsHolder.Companion.BRANCH_CHECKOUT_FAILED
import git4idea.GitNotificationIdsHolder.Companion.BRANCH_CREATION_FAILED
import git4idea.GitReference
import git4idea.GitUtil
import git4idea.GitVcs
import git4idea.branch.*
import git4idea.config.GitVcsSettings
import git4idea.fetch.GitFetchSupport
import git4idea.history.GitHistoryUtils
import git4idea.i18n.GitBundle
import git4idea.repo.GitRepository
import git4idea.update.GitUpdateExecutionProcess
import org.jetbrains.annotations.Nls
import javax.swing.Icon
@JvmOverloads
internal fun createOrCheckoutNewBranch(project: Project,
repositories: List<GitRepository>,
startPoint: String,
@Nls(capitalization = Nls.Capitalization.Title)
title: String = GitBundle.message("branches.create.new.branch.dialog.title"),
initialName: String? = null) {
val options = GitNewBranchDialog(project, repositories, title, initialName, true, true, false, true).showAndGetOptions() ?: return
GitBranchCheckoutOperation(project, repositories).perform(startPoint, options)
}
internal fun updateBranches(project: Project, repositories: List<GitRepository>, localBranchNames: List<String>) {
val repoToTrackingInfos =
repositories.associateWith { it.branchTrackInfos.filter { info -> localBranchNames.contains(info.localBranch.name) } }
if (repoToTrackingInfos.isEmpty()) return
GitVcs.runInBackground(object : Task.Backgroundable(project, GitBundle.message("branches.updating.process"), true) {
private val successfullyUpdated = arrayListOf<String>()
override fun run(indicator: ProgressIndicator) {
val fetchSupport = GitFetchSupport.fetchSupport(project)
val currentBranchesMap: MutableMap<GitRepository, GitBranchPair> = HashMap()
for ((repo, trackingInfos) in repoToTrackingInfos) {
val currentBranch = repo.currentBranch
for (trackingInfo in trackingInfos) {
val localBranch = trackingInfo.localBranch
val remoteBranch = trackingInfo.remoteBranch
if (localBranch == currentBranch) {
currentBranchesMap[repo] = GitBranchPair(currentBranch, remoteBranch)
}
else {
// Fast-forward all non-current branches in the selection
val localBranchName = localBranch.name
val remoteBranchName = remoteBranch.nameForRemoteOperations
val fetchResult = fetchSupport.fetch(repo, trackingInfo.remote, "$remoteBranchName:$localBranchName")
try {
fetchResult.throwExceptionIfFailed()
successfullyUpdated.add(localBranchName)
}
catch (ignored: VcsException) {
fetchResult.showNotificationIfFailed(GitBundle.message("branches.update.failed"))
}
}
}
}
// Update all current branches in the selection
if (currentBranchesMap.isNotEmpty()) {
GitUpdateExecutionProcess(project,
repositories,
currentBranchesMap,
GitVcsSettings.getInstance(project).updateMethod,
false).execute()
}
}
override fun onSuccess() {
if (successfullyUpdated.isNotEmpty()) {
VcsNotifier.getInstance(project).notifySuccess(BRANCHES_UPDATE_SUCCESSFUL, "",
GitBundle.message("branches.selected.branches.updated.title",
successfullyUpdated.size,
successfullyUpdated.joinToString("\n")))
}
}
})
}
internal fun isTrackingInfosExist(branchNames: List<String>, repositories: List<GitRepository>) =
repositories
.flatMap(GitRepository::getBranchTrackInfos)
.any { trackingBranchInfo -> branchNames.any { branchName -> branchName == trackingBranchInfo.localBranch.name } }
internal fun hasRemotes(project: Project): Boolean {
return GitUtil.getRepositories(project).any { repository -> !repository.remotes.isEmpty() }
}
internal fun hasTrackingConflicts(conflictingLocalBranches: Map<GitRepository, GitLocalBranch>,
remoteBranchName: String): Boolean =
conflictingLocalBranches.any { (repo, branch) ->
val trackInfo = GitBranchUtil.getTrackInfoForBranch(repo, branch)
trackInfo != null && !GitReference.BRANCH_NAME_HASHING_STRATEGY.equals(remoteBranchName, trackInfo.remoteBranch.name)
}
internal abstract class BranchGroupingAction(private val key: GroupingKey,
icon: Icon? = null) : ToggleAction(key.text, key.description, icon), DumbAware {
abstract fun setSelected(e: AnActionEvent, key: GroupingKey, state: Boolean)
override fun isSelected(e: AnActionEvent) =
e.project?.let { GitVcsSettings.getInstance(it).branchSettings.isGroupingEnabled(key) } ?: false
override fun setSelected(e: AnActionEvent, state: Boolean) {
val project = e.project ?: return
val branchSettings = GitVcsSettings.getInstance(project).branchSettings
branchSettings.setGrouping(key, state)
setSelected(e, key, state)
}
}
| plugins/git4idea/src/git4idea/ui/branch/GitBranchActionsUtil.kt | 1590645622 |
// FIX: none
fun test(x: E1, y: E2): Boolean {
return x.<caret>equals(y)
}
enum class E1
enum class E2 | plugins/kotlin/idea/tests/testData/inspectionsLocal/equalsBetweenInconvertibleTypes/enumEqEnum2.kt | 567990630 |
<warning descr="SSR">/**
* @param foo bar
*/</warning>
class Foo1
/**
*
*/
class Bar1
<warning descr="SSR">/**
* foo
* @since 1
*/</warning>
class Foo2
<warning descr="SSR">/**
* @property foo bar
*/</warning>
class Bar2
| plugins/kotlin/idea/tests/testData/structuralsearch/comment/kDocTag.kt | 3620402633 |
fun foo() {
<caret>if (a) {
bar() // do bar
}
}
| plugins/kotlin/idea/tests/testData/joinLines/removeBraces/CommentAfterStatement.kt | 966974960 |
package com.cognifide.gradle.aem.launcher
import java.util.*
class BuildScaffolder(private val launcher: Launcher) {
fun scaffold() {
saveBuildSrc()
saveProperties()
saveSettings()
saveRootBuildScript()
saveEnvBuildScript()
saveEnvSrcFiles()
}
private fun saveBuildSrc() = launcher.workFileOnce("buildSrc/build.gradle.kts") {
println("Saving Gradle build source script file '$this'")
writeText("""
repositories {
mavenLocal()
mavenCentral()
gradlePluginPortal()
}
dependencies {
implementation("com.cognifide.gradle:aem-plugin:${launcher.pluginVersion}")
implementation("com.cognifide.gradle:environment-plugin:2.0.3")
implementation("com.neva.gradle:fork-plugin:7.0.0")
}
""".trimIndent())
}
private fun saveProperties() = launcher.workFileOnce("gradle.properties") {
println("Saving Gradle properties file '$this'")
outputStream().use { output ->
Properties().apply {
putAll(defaultProps)
if (savePropsFlag) {
putAll(saveProps)
}
store(output, null)
}
}
}
private val savePropsFlag get() = launcher.args.contains(Launcher.ARG_SAVE_PROPS)
private val saveProps get() = launcher.args.filter { it.startsWith(Launcher.ARG_SAVE_PREFIX) }
.map { it.removePrefix(Launcher.ARG_SAVE_PREFIX) }
.map { it.substringBefore("=") to it.substringAfter("=") }
.toMap()
private val defaultProps get() = mapOf(
"org.gradle.logging.level" to "info",
"org.gradle.daemon" to "true",
"org.gradle.parallel" to "true",
"org.gradle.caching" to "true",
"org.gradle.jvmargs" to "-Xmx2048m -XX:MaxPermSize=512m -Dfile.encoding=UTF-8"
)
private fun saveRootBuildScript() = launcher.workFileOnce("build.gradle.kts") {
println("Saving root Gradle build script file '$this'")
writeText("""
plugins {
id("com.cognifide.aem.common")
id("com.neva.fork")
}
apply(from = "gradle/fork/props.gradle.kts")
if (file("gradle.user.properties").exists()) {
if (aem.mvnBuild.available) defaultTasks(":env:setup")
else defaultTasks(":env:instanceSetup")
}
allprojects {
repositories {
mavenCentral()
}
}
aem {
mvnBuild {
depGraph {
// softRedundantModule("ui.content" to "ui.apps")
}
discover()
}
}
""".trimIndent())
}
private fun saveEnvBuildScript() = launcher.workFileOnce("env/build.gradle.kts") {
println("Saving environment Gradle build script file '$this'")
writeText("""
plugins {
id("com.cognifide.aem.instance.local")
id("com.cognifide.environment")
}
val instancePassword = common.prop.string("instance.default.password")
val publishHttpUrl = common.prop.string("publish.httpUrl") ?: aem.findInstance("local-publish")?.httpUrl ?: "http://127.0.0.1:4503"
val dispatcherHttpUrl = common.prop.string("dispatcher.httpUrl") ?: "http://127.0.0.1:80"
val dispatcherTarUrl = common.prop.string("dispatcher.tarUrl") ?: "http://download.macromedia.com/dispatcher/download/dispatcher-apache2.4-linux-x86_64-4.3.3.tar.gz"
aem {
instance { // https://github.com/Cognifide/gradle-aem-plugin/blob/master/docs/instance-plugin.md
provisioner {
enableCrxDe()
configureReplicationAgentAuthor("publish") {
agent { configure(transportUri = "${'$'}publishHttpUrl/bin/receive?sling:authRequestLogin=1", transportUser = "admin", transportPassword = instancePassword, userId = "admin") }
version.set(publishHttpUrl)
}
configureReplicationAgentPublish("flush") {
agent { configure(transportUri = "${'$'}dispatcherHttpUrl/dispatcher/invalidate.cache") }
version.set(dispatcherHttpUrl)
}
}
}
}
environment { // https://github.com/Cognifide/gradle-environment-plugin
docker {
containers {
"httpd" {
resolve {
resolveFiles {
download(dispatcherTarUrl).use {
copyArchiveFile(it, "**/dispatcher-apache*.so", file("modules/mod_dispatcher.so"))
}
}
ensureDir("htdocs", "cache", "logs")
}
up {
symlink(
"/etc/httpd.extra/conf.modules.d/02-dispatcher.conf" to "/etc/httpd/conf.modules.d/02-dispatcher.conf",
"/etc/httpd.extra/conf.d/variables/default.vars" to "/etc/httpd/conf.d/variables/default.vars"
)
ensureDir("/usr/local/apache2/logs", "/var/www/localhost/htdocs", "/var/www/localhost/cache")
execShell("Starting HTTPD server", "/usr/sbin/httpd -k start")
}
reload {
cleanDir("/var/www/localhost/cache")
execShell("Restarting HTTPD server", "/usr/sbin/httpd -k restart")
}
dev {
watchRootDir(
"dispatcher/src/conf.d",
"dispatcher/src/conf.dispatcher.d",
"env/src/environment/httpd")
}
}
}
}
hosts {
"http://publish" { tag("publish") }
"http://dispatcher" { tag("dispatcher") }
}
healthChecks {
aem.findInstance("local-author")?.let { instance ->
http("Author Sites Editor", "${'$'}{instance.httpUrl}/sites.html") {
containsText("Sites")
options { basicCredentials = instance.credentials }
}
http("Author Replication Agent - Publish", "${'$'}{instance.httpUrl}/etc/replication/agents.author/publish.test.html") {
containsText("succeeded")
options { basicCredentials = instance.credentials }
}
}
aem.findInstance("local-publish")?.let { instance ->
http("Publish Replication Agent - Flush", "${'$'}{instance.httpUrl}/etc/replication/agents.publish/flush.test.html") {
containsText("succeeded")
options { basicCredentials = instance.credentials }
}
/*
http("Site Home", "http://publish/us/en.html") {
containsText("My Site")
}
*/
}
}
}
tasks {
instanceSetup { if (rootProject.aem.mvnBuild.available) dependsOn(":all:deploy") }
instanceResolve { dependsOn(":requireProps") }
instanceCreate { dependsOn(":requireProps") }
environmentUp { mustRunAfter(instanceAwait, instanceUp, instanceProvision, instanceSetup) }
environmentAwait { mustRunAfter(instanceAwait, instanceUp, instanceProvision, instanceSetup) }
}
""".trimIndent())
}
private fun saveEnvSrcFiles() {
launcher.workFileOnce("env/src/environment/docker-compose.yml.peb") {
println("Saving environment Docker compose file '$this'")
writeText("""
version: "3"
services:
httpd:
image: centos/httpd:latest
command: ["tail", "-f", "--retry", "/usr/local/apache2/logs/error.log"]
deploy:
replicas: 1
ports:
- "80:80"
networks:
- docker-net
volumes:
- "{{ rootPath }}/dispatcher/src/conf.d:/etc/httpd/conf.d"
- "{{ rootPath }}/dispatcher/src/conf.dispatcher.d:/etc/httpd/conf.dispatcher.d"
- "{{ sourcePath }}/httpd:/etc/httpd.extra"
- "{{ workPath }}/httpd/modules/mod_dispatcher.so:/etc/httpd/modules/mod_dispatcher.so"
- "{{ workPath }}/httpd/logs:/etc/httpd/logs"
{% if docker.runtime.safeVolumes %}
- "{{ workPath }}/httpd/cache:/var/www/localhost/cache"
- "{{ workPath }}/httpd/htdocs:/var/www/localhost/htdocs"
{% endif %}
{% if docker.runtime.hostInternalIpMissing %}
extra_hosts:
- "host.docker.internal:{{ docker.runtime.hostInternalIp }}"
{% endif %}
networks:
docker-net:
""".trimIndent())
}
launcher.workFileOnce("env/src/environment/httpd/conf.d/variables/default.vars") {
println("Saving environment variables file '$this'")
writeText("""
Define DOCROOT /var/www/localhost/cache
Define AEM_HOST host.docker.internal
Define AEM_IP 10.0.*.*
Define AEM_PORT 4503
Define DISP_LOG_LEVEL Warn
Define REWRITE_LOG_LEVEL Warn
Define EXPIRATION_TIME A2592000
""".trimIndent())
}
launcher.workFileOnce("env/src/environment/httpd/conf.modules.d/02-dispatcher.conf") {
println("Saving environment HTTPD dispatcher config file '$this'")
writeText("""
LoadModule dispatcher_module modules/mod_dispatcher.so
""".trimIndent())
}
}
private fun saveSettings() = launcher.workFileOnce("settings.gradle.kts") {
println("Saving Gradle settings file '$this'")
writeText("""
include(":env")
""".trimIndent())
}
} | launcher/src/main/kotlin/com/cognifide/gradle/aem/launcher/BuildScaffolder.kt | 1535460990 |
/*
* Copyright 2017 Nikola Trubitsyn
*
* 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.trubitsyn.visiblefortesting.visibility
import org.jetbrains.kotlin.lexer.KtTokens
import org.jetbrains.kotlin.psi.KtFunction
class KtFunctionVisibility(val function: KtFunction) : Visibility {
override val isProtected: Boolean
get() = function.hasModifier(KtTokens.PROTECTED_KEYWORD)
override val isPackageLocal: Boolean
get() = function.hasModifier(KtTokens.INTERNAL_KEYWORD)
override val isPrivate: Boolean
get() = function.hasModifier(KtTokens.PRIVATE_KEYWORD)
} | src/main/kotlin/org/trubitsyn/visiblefortesting/visibility/KtFunctionVisibility.kt | 3177380183 |
package ch.rmy.android.http_shortcuts.utils
import androidx.annotation.UiThread
import androidx.fragment.app.FragmentActivity
import ch.rmy.android.framework.extensions.safeRemoveIf
import ch.rmy.android.http_shortcuts.exceptions.NoActivityAvailableException
import java.lang.ref.WeakReference
import javax.inject.Inject
import javax.inject.Singleton
@Singleton
class ActivityProvider
@Inject
constructor() {
fun getActivity(): FragmentActivity =
activeActivities.lastOrNull()?.get() ?: throw NoActivityAvailableException()
companion object {
private val activeActivities = mutableListOf<WeakReference<FragmentActivity>>()
@UiThread
fun registerActivity(activity: FragmentActivity) {
activeActivities.add(WeakReference(activity))
}
@UiThread
fun deregisterActivity(activity: FragmentActivity) {
activeActivities.safeRemoveIf { reference -> reference.get().let { it == null || it == activity } }
}
}
}
| HTTPShortcuts/app/src/main/kotlin/ch/rmy/android/http_shortcuts/utils/ActivityProvider.kt | 4272524286 |
package ch.rmy.android.http_shortcuts.data.domains.pending_executions
typealias ExecutionId = String
| HTTPShortcuts/app/src/main/kotlin/ch/rmy/android/http_shortcuts/data/domains/pending_executions/ExecutionId.kt | 815193214 |
package com.redrield.shortify.common
import com.redrield.shortify.util.ShortifyUtil
import org.apache.commons.io.IOUtils
import org.apache.http.client.methods.HttpGet
import java.net.URLEncoder
class TinyUrlShortener : Shortener {
override fun getShortenedUrl(toShorten: String): String {
val url = "http://tinyurl.com/api-create.php?url=${URLEncoder.encode(toShorten, "UTF-8")}"
val client = ShortifyUtil.CLIENT
val req = HttpGet(url)
val res = client.execute(req)
return IOUtils.toString(res.entity.content)
}
} | common/src/main/kotlin/com/redrield/shortify/common/TinyUrlShortener.kt | 1503793970 |
package cz.filipproch.reactor.ui.events
import cz.filipproch.reactor.base.view.ReactorUiEvent
import io.reactivex.Observable
/**
* @author Filip Prochazka (@filipproch)
*/
class ViewResumedEventKtTest : BaseEventFilterTest() {
override fun filterStream(stream: Observable<ReactorUiEvent>): Observable<out ReactorUiEvent> {
return stream.whenViewResumed()
}
override fun getValidEventInstance(): ReactorUiEvent {
return ViewResumedEvent
}
} | library/src/test/java/cz/filipproch/reactor/ui/events/ViewResumedEventKtTest.kt | 873242975 |
package de.treichels.hott.model.enums
import de.treichels.hott.util.get
import java.util.*
enum class SwitchMode {
single, dual, Unknown;
override fun toString(): String = ResourceBundle.getBundle(javaClass.name)[name]
}
| HoTT-Model/src/main/kotlin/de/treichels/hott/model/enums/SwitchMode.kt | 2593986926 |
package com.softmotions.ncms.rs
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.ObjectMapper
import com.github.kevinsawicki.http.HttpRequest
import org.apache.commons.codec.digest.DigestUtils
import org.apache.commons.codec.net.BCodec
import org.apache.commons.io.IOUtils
import org.apache.commons.lang3.RandomStringUtils
import org.testng.annotations.AfterClass
import org.testng.annotations.BeforeClass
import org.testng.annotations.Test
import java.io.File
import java.nio.file.Files
import java.nio.file.Paths
import kotlin.test.assertEquals
import kotlin.test.assertNotNull
import kotlin.test.assertTrue
/**
* @author Adamansky Anton ([email protected])
*/
@Test(groups = arrayOf("rs"))
class _TestMediaRS(db: String) : BaseRSTest(db) {
constructor() : this(DEFAULT_DB) {
}
private var mapper = ObjectMapper()
@BeforeClass
override fun setup() {
super.setup()
mapper = getEnv()?.injector?.getInstance(ObjectMapper::class.java) ?: ObjectMapper()
}
@AfterClass
override fun shutdown() {
super.shutdown()
}
override fun R(resource: String): String = super.R(resource = "/rs/media$resource")
@Test()
fun testMediaSelect() {
with(GET("/select/count")) {
assertEquals(200, code())
assertEquals("0", body())
}
with(GET("/select")) {
assertEquals(200, code())
val body = body()
assertNotNull(body)
with(mapper.readTree(body)) {
assertTrue(isArray)
assertEquals(0, size())
}
}
}
@Test(dependsOnMethods = arrayOf("testMediaSelect"))
fun testMediaFilePut() {
val fileName = RandomStringUtils.randomAlphanumeric(8) + "." + RandomStringUtils.randomAlphabetic(3)
val file = getTestFile()
with(PUT("/file/$fileName").contentType("text/plain").send(file)) {
assertEquals(204, code())
}
}
@Test(dependsOnMethods = arrayOf("testMediaFilePut"))
fun testMediaFileDelete() {
with(GET("/select")) {
assertEquals(200, code())
val body = body()
assertNotNull(body)
with(mapper.readTree(body)) {
assertTrue(isArray)
forEach {
assertTrue(it.hasNonNull("id"))
assertTrue(it.hasNonNull("folder"))
assertTrue(it.hasNonNull("name"))
assertEquals(200, DELETE("/delete/${it.path("folder").asText()}${it.path("name").asText()}").code())
}
}
}
with(GET("/select/count")) {
assertEquals(200, code())
assertEquals("0", body())
}
}
@Test(dependsOnMethods = arrayOf("testMediaFilePut", "testMediaFileDelete", "testMediaFolderPut", "testMediaFolderDelete"))
fun testMediaFileGet() {
val testFolder = putFolder().path("label").asText()
for (fileType in listOf("txt", "svg", "png")) { // test: different file types
for (folderName in listOf("", testFolder)) { // test: / and subfolder
with(putFile(folderName, fileType)) {
val fileName = path("name").asText()
val folder = prepareFolder(path("folder").asText())
val fileSize = path("size").asLong()
val fileContentType = path("contentType").asText()
val reqIs = Files.newInputStream(getTestFile(fileType).toPath())
val reqMd5 = DigestUtils.md5Hex(IOUtils.toByteArray(reqIs))
for (j in 0..1) { // get by: 0 - name, 1 - id
var resource = ""
if (j == 0) {
resource = "/file/$folder$fileName"
} else {
with(GET("/select?folder=/$folder")) {
assertEquals(200, code())
val body = body()
assertNotNull(body)
with(mapper.readTree(body)) {
assertTrue(isArray)
forEach {
assertTrue(it.hasNonNull("id"))
if (fileName == it.path("name").asText(null)) {
resource = "/fileid/" + it.path("id").asLong()
}
}
}
}
}
for (i in 0..1) { // request: 0 - HEAD, 1 - GET
val req: HttpRequest
if (i == 0) {
req = HEAD(resource)
} else {
req = GET(resource)
}
with(req) {
if (i == 0) {
assertEquals(204, code())
} else {
assertEquals(200, code())
}
val headers = headers()
val respFName = BCodec("UTF-8").decode(
headers["Content-Disposition"]?.get(0)?.
removePrefix("attachment; filename=\"")?.
removeSuffix("\""))
assertEquals(fileName, respFName)
val respCLeng = if (i == 0) {
headers["X-Content-Length"]?.get(0)
} else {
headers["Content-Length"]?.get(0)
}
assertEquals(fileSize.toString(), respCLeng)
val respEnc = headers["Content-Encoding"]?.get(0)
val respCType = headers["Content-Type"]?.get(0)
if (respEnc != null) {
assertEquals(fileContentType + ";charset=" + respEnc, respCType)
} else {
assertEquals(fileContentType, respCType)
}
if (i == 1) {
val tempFile = File("/tmp/$fileName")
receive(tempFile)
assertEquals(fileSize, tempFile.length())
val resIs = Files.newInputStream(tempFile.toPath())
val resMd5 = DigestUtils.md5Hex(IOUtils.toByteArray(resIs))
assertEquals(resMd5, reqMd5)
tempFile.delete()
}
}
}
}
delete(folder, fileName)
}
}
}
delete("", testFolder)
}
@Test(dependsOnMethods = arrayOf("testMediaFileGet"))
fun testMediaFileThumb() {
val testFolder = putFolder().path("label").asText()
for (folderName in listOf("", testFolder)) { // test: / and subfolder
with(putFile(folderName, "png")) {
val fileName = path("name").asText()
val folder = prepareFolder(path("folder").asText())
val fileContentType = path("contentType").asText()
for (j in 0..1) { // get by: 0 - name, 1 - id
var resource = ""
if (j == 0) {
resource = "/thumbnail/$folder$fileName"
} else {
with(GET("/select?folder=/$folder")) {
assertEquals(200, code())
val body = body()
assertNotNull(body)
with(mapper.readTree(body)) {
assertTrue(isArray)
forEach {
assertTrue(it.hasNonNull("id"))
if (fileName == it.path("name").asText(null)) {
resource = "/thumbnail2/" + it.path("id").asLong()
}
}
}
}
}
with(GET(resource)) {
assertEquals(200, code())
val headers = headers()
val respCType = headers["Content-Type"]?.get(0)
assertEquals(fileContentType, respCType)
}
}
delete(folder, fileName)
}
}
delete("", testFolder)
}
@Test(dependsOnMethods = arrayOf("testMediaSelect"))
fun testMediaFolderSelect() {
with(GET("/folders")) {
assertEquals(200, code())
val body = body()
assertNotNull(body)
with(mapper.readTree(body)) {
assertTrue(isArray)
assertEquals(0, size())
}
}
}
@Test(dependsOnMethods = arrayOf("testMediaFolderSelect"))
fun testMediaFolderPut() {
val folderName = RandomStringUtils.randomAlphanumeric(11)
with(PUT("/folder/$folderName")) {
assertEquals(200, code())
val body = body()
assertNotNull(body)
with(mapper.readTree(body)) {
assertEquals(folderName, path("label").asText(null))
assertEquals(1, path("status").asInt())
assertTrue(hasNonNull("system"))
}
}
with(PUT("/folder/$folderName")) {
assertEquals(500, code())
}
}
@Test(dependsOnMethods = arrayOf("testMediaFolderPut"))
fun testMediaFolderDelete() {
with(GET("/folders")) {
assertEquals(200, code())
val body = body()
assertNotNull(body)
with(mapper.readTree(body)) {
assertTrue(isArray)
forEach {
assertTrue(it.hasNonNull("label"))
assertEquals(1, it.path("status").asInt())
assertEquals(200, DELETE("/delete/${it.path("label").asText()}").code())
}
}
}
with(GET("/folders")) {
assertEquals(200, code())
val body = body()
assertNotNull(body)
with(mapper.readTree(body)) {
assertTrue(isArray)
assertEquals(0, size())
}
}
}
@Test(dependsOnMethods = arrayOf("testMediaFilePut", "testMediaFileDelete", "testMediaFolderPut", "testMediaFolderDelete"))
fun testMediaListing() {
/*
* /
* |-file1
* \-folder1
* |---file2
* \---folder2
* \---file3
*/
testMediaSelect()
val file1 = putFile().path("name").asText()
val folder1 = putFolder().path("label").asText()
val file2 = putFile(folder1).path("name").asText()
val folder2 = putFolder(folder1).path("label").asText()
val file3 = putFile(folder1 + "/" + folder2).path("name").asText()
for (i in 0..2) {
val folder: String
val folderName: String
val fileName: String
if (i == 0) {
folder = ""
folderName = folder1
fileName = file1
} else if (i == 1) {
folder = "/$folder1"
folderName = folder2
fileName = file2
} else if (i == 2) {
folder = "/$folder1/$folder2"
folderName = "" // doesn't matter - folder not contain folders
fileName = file3
} else {
folder = ""
folderName = ""
fileName = ""
}
// test files listing
with(GET("/files$folder")) {
assertEquals(200, code())
val body = body()
assertNotNull(body)
with(mapper.readTree(body)) {
assertTrue(isArray)
forEach {
assertEquals(fileName, it.path("label").asText(null))
assertEquals(0, it.path("status").asInt())
}
}
}
// test folder listing
with(GET("/folders$folder")) {
assertEquals(200, code())
val body = body()
assertNotNull(body)
with(mapper.readTree(body)) {
assertTrue(isArray)
forEach {
assertEquals(folderName, it.path("label").asText(null))
assertEquals(1, it.path("status").asInt())
}
}
}
// test "all" listing
with(GET("/all$folder")) {
assertEquals(200, code())
val body = body()
assertNotNull(body)
with(mapper.readTree(body)) {
assertTrue(isArray)
forEach {
val status = it.path("status").asInt()
val fileLabel = if (status == 0) {
fileName
} else {
folderName
}
assertEquals(fileLabel, it.path("label").asText(null))
}
}
}
}
delete(folder2, file3)
delete(folder1, folder2)
delete(folder1, file2)
delete("", folder1)
delete("", file1)
}
@Test(dependsOnMethods = arrayOf("testMediaFilePut", "testMediaFileDelete", "testMediaFolderPut", "testMediaFolderDelete"))
fun testMediaMove() {
val testFolder1 = putFolder().path("label").asText()
val testFolder2 = putFolder().path("label").asText()
with(putFile()) {
val fileName = path("name").asText()
with(PUT("/move/$fileName").contentType("application/json").send("$testFolder1/$fileName")) {
assertEquals(204, code())
}
with(GET("/select?folder=/$testFolder1")) {
assertEquals(200, code())
val body = body()
assertNotNull(body)
with(mapper.readTree(body)) {
assertTrue(isArray)
assertEquals(1, size())
forEach {
assertTrue(it.hasNonNull("id"))
assertEquals(fileName, it.path("name").asText(null))
}
}
}
with(PUT("/move/$testFolder1").contentType("application/json").send("$testFolder2/$testFolder1")) {
assertEquals(204, code())
}
with(GET("/select?folder=/$testFolder2/$testFolder1")) {
assertEquals(200, code())
val body = body()
assertNotNull(body)
with(mapper.readTree(body)) {
assertTrue(isArray)
assertEquals(1, size())
forEach {
assertTrue(it.hasNonNull("id"))
assertEquals(fileName, it.path("name").asText(null))
}
}
}
delete(testFolder2 + "/" + testFolder1, fileName)
}
delete(testFolder2, testFolder1)
delete("", testFolder2)
}
@Test(dependsOnMethods = arrayOf("testMediaFilePut", "testMediaFileDelete", "testMediaFolderPut", "testMediaFolderDelete"))
fun testMediaCopyDeleteBatch() {
val testFolder = putFolder().path("label").asText()
with(putFile()) {
val fileName = path("name").asText()
var props = mapper.createArrayNode().add(fileName)
with(PUT("/copy-batch/$testFolder").contentType("application/json").send(mapper.writeValueAsString(props))) {
assertEquals(204, code())
}
with(GET("/select?folder=/$testFolder")) {
assertEquals(200, code())
val body = body()
assertNotNull(body)
with(mapper.readTree(body)) {
assertTrue(isArray)
assertEquals(1, size())
forEach {
assertTrue(it.hasNonNull("id"))
assertEquals(fileName, it.path("name").asText(null))
}
}
}
props = mapper.createArrayNode().
add("$testFolder/$fileName").
add(fileName).
add(testFolder)
with(DELETE("/delete-batch").contentType("application/json").send(mapper.writeValueAsString(props))) {
assertEquals(204, code())
}
with(GET("/select/count")) {
assertEquals(200, code())
assertEquals("0", body())
}
}
}
@Test(dependsOnMethods = arrayOf("testMediaFilePut", "testMediaFileDelete", "testMediaFolderPut", "testMediaFolderDelete"))
fun testMediaMeta() {
val testFolder = putFolder().path("label").asText()
with(putFile(testFolder)) {
val fileName = path("name").asText()
var fileId = 0L
with(GET("/select?folder=/$testFolder")) {
assertEquals(200, code())
val body = body()
assertNotNull(body)
with(mapper.readTree(body)) {
assertTrue(isArray)
assertEquals(1, size())
forEach {
assertTrue(it.hasNonNull("id"))
assertEquals(fileName, it.path("name").asText(null))
fileId = it.path("id").asLong()
}
}
}
with(GET("/path/$fileId")) {
assertEquals(200, code())
assertEquals("/$testFolder/$fileName", body())
}
with(GET("/meta/$fileId")) {
assertEquals(200, code())
val body = body()
assertNotNull(body)
with(mapper.readTree(body)) {
assertEquals(fileId, path("id").asLong())
assertEquals("/$testFolder/", path("folder").asText(null))
assertEquals(fileName, path("name").asText(null))
}
}
with(POST("/meta/$fileId").contentType("application/x-www-form-urlencoded").form("description", "test")) {
assertEquals(204, code())
}
delete(testFolder, fileName)
}
delete("", testFolder)
}
private fun putFile(folder: String = "", type: String = "txt"): JsonNode {
val fileExt: String
val contentType: String
if ("txt" == type) {
contentType = "text/plain"
fileExt = "txt"
} else if ("png" == type) {
contentType = "image/png"
fileExt = "png"
} else if ("svg" == type) {
contentType = "image/svg+xml"
fileExt = "svg"
} else {
contentType = "text/plain"
fileExt = "txt"
}
val fileName = RandomStringUtils.randomAlphanumeric(8) + "." + fileExt
val file = getTestFile(type)
val folderName = prepareFolder(folder)
with(PUT("/file/$folderName$fileName").contentType(contentType).send(file)) {
assertEquals(204, code())
}
return mapper.createObjectNode().
put("name", fileName).
put("folder", folderName).
put("size", file.length()).
put("contentType", contentType)
}
private fun putFolder(folder: String = ""): JsonNode {
val folderLabel = RandomStringUtils.randomAlphanumeric(11)
val folderName = prepareFolder(folder)
with(PUT("/folder/$folderName$folderLabel")) {
assertEquals(200, code())
val body = body()
assertNotNull(body)
with(mapper.readTree(body)) {
assertEquals(folderLabel, path("label").asText(null))
assertEquals(1, path("status").asInt())
assertTrue(hasNonNull("system"))
@Suppress("LABEL_NAME_CLASH")
return this@with
}
}
}
private fun delete(folder: String = "", fileName: String) {
val code = DELETE("/delete/${prepareFolder(folder)}$fileName").code()
assertTrue(code == 200 || code == 204)
}
private fun prepareFolder(folder: String): String {
if ("" != folder && !folder.endsWith("/")) {
return folder + "/"
} else {
return folder
}
}
private fun getTestFile(type: String = "txt"): File {
val fileName = when (type) {
"txt" -> "file.txt"
"png" -> "file.png"
"svg" -> "file.svg"
else -> "file.txt"
}
return File(Paths.get(System.getProperty("project.basedir"), "/src/test/java/com/softmotions/ncms/rs/data/$fileName").toString())
}
} | ncms-engine/ncms-engine-tests/src/test/java/com/softmotions/ncms/rs/_TestMediaRS.kt | 1719246601 |
@file:Suppress("NOTHING_TO_INLINE", "unused")
package com.commit451.addendum.threetenabp
import org.threeten.bp.*
import java.util.*
inline fun Calendar.toZonedDateTime(): ZonedDateTime {
val zoneId = ZoneId.of(timeZone.id)
val instant = Instant.ofEpochMilli(this.time.time)
return ZonedDateTime.ofInstant(instant, zoneId)
}
inline fun Calendar.toLocalDate(): LocalDate {
//gotta add one to the cal month since it starts at 0
val monthOfYear = get(Calendar.MONTH) + 1
return LocalDate.of(get(Calendar.YEAR), monthOfYear, get(Calendar.DAY_OF_MONTH))
}
inline fun Calendar.toLocalDateTime(): LocalDateTime {
val monthOfYear = get(Calendar.MONTH) + 1
return LocalDateTime.of(get(Calendar.YEAR), monthOfYear, get(Calendar.DAY_OF_MONTH), get(Calendar.HOUR_OF_DAY), get(Calendar.MINUTE), get(Calendar.SECOND))
}
| addendum-threetenabp/src/main/java/com/commit451/addendum/threetenabp/Calendar.kt | 65403782 |
package com.ivanovsky.passnotes.presentation.core.factory
import com.ivanovsky.passnotes.presentation.core.BaseCellViewModel
import com.ivanovsky.passnotes.presentation.core.event.EventProvider
import com.ivanovsky.passnotes.presentation.core.model.BaseCellModel
interface CellViewModelFactory {
fun createCellViewModels(
models: List<BaseCellModel>,
eventProvider: EventProvider
): List<BaseCellViewModel> {
return models.map { createCellViewModel(it, eventProvider) }
}
fun createCellViewModel(
model: BaseCellModel,
eventProvider: EventProvider
): BaseCellViewModel
fun throwUnsupportedModelException(model: BaseCellModel): Nothing {
throw IllegalArgumentException("unable to find ViewModel for model: ${model::class.qualifiedName}")
}
} | app/src/main/kotlin/com/ivanovsky/passnotes/presentation/core/factory/CellViewModelFactory.kt | 1576575671 |
package com.varmateo
fun main(args: Array<String>) {
println("Hello, world!")
}
| build-systems/kotlin-gradle-HelloWorld/src/main/kotlin/com/varmateo/Main.kt | 4251918538 |
/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package androidx.collection
import androidx.testutils.fail
import com.google.common.truth.Truth.assertThat
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertSame
import org.junit.Assert.assertTrue
import org.junit.Test
class SparseArrayCompatTest {
@Test fun sizeProperty() {
val array = SparseArrayCompat<String>()
assertEquals(0, array.size)
array.put(1, "one")
assertEquals(1, array.size)
}
@Test fun containsOperator() {
val array = SparseArrayCompat<String>()
assertFalse(1 in array)
array.put(1, "one")
assertTrue(1 in array)
}
@Test fun containsOperatorWithItem() {
val array = SparseArrayCompat<String>()
array.put(1, "one")
assertFalse(2 in array)
array.put(2, "two")
assertTrue(2 in array)
}
@Test fun setOperator() {
val array = SparseArrayCompat<String>()
array[1] = "one"
assertEquals("one", array.get(1))
}
@Test fun plusOperator() {
val first = SparseArrayCompat<String>().apply { put(1, "one") }
val second = SparseArrayCompat<String>().apply { put(2, "two") }
val combined = first + second
assertEquals(2, combined.size())
assertEquals(1, combined.keyAt(0))
assertEquals("one", combined.valueAt(0))
assertEquals(2, combined.keyAt(1))
assertEquals("two", combined.valueAt(1))
}
@Test fun containsKey() {
val array = SparseArrayCompat<String>()
assertFalse(array.containsKey(1))
array.put(1, "one")
assertTrue(array.containsKey(1))
}
@Test fun containsValue() {
val array = SparseArrayCompat<String>()
assertFalse(array.containsValue("one"))
array.put(1, "one")
assertTrue(array.containsValue("one"))
}
@Test fun getOrDefault() {
val array = SparseArrayCompat<Any>()
val default = Any()
assertSame(default, array.getOrDefault(1, default))
array.put(1, "one")
assertEquals("one", array.getOrDefault(1, default))
}
@Test fun getOrElse() {
val array = SparseArrayCompat<Any>()
val default = Any()
assertSame(default, array.getOrElse(1) { default })
array.put(1, "one")
assertEquals("one", array.getOrElse(1) { fail() })
}
@Test fun isNotEmpty() {
val array = SparseArrayCompat<String>()
assertFalse(array.isNotEmpty())
array.put(1, "one")
assertTrue(array.isNotEmpty())
}
@Test fun removeValue() {
val array = SparseArrayCompat<String>()
array.put(1, "one")
assertFalse(array.remove(0, "one"))
assertEquals(1, array.size())
assertFalse(array.remove(1, "two"))
assertEquals(1, array.size())
assertTrue(array.remove(1, "one"))
assertEquals(0, array.size())
}
@Test fun putAll() {
val dest = SparseArrayCompat<String>()
val source = SparseArrayCompat<String>()
source.put(1, "one")
assertEquals(0, dest.size())
dest.putAll(source)
assertEquals(1, dest.size())
}
@Test fun forEach() {
val array = SparseArrayCompat<String>()
array.forEach { _, _ -> fail() }
array.put(1, "one")
array.put(2, "two")
array.put(6, "six")
val keys = mutableListOf<Int>()
val values = mutableListOf<String>()
array.forEach { key, value ->
keys.add(key)
values.add(value)
}
assertThat(keys).containsExactly(1, 2, 6)
assertThat(values).containsExactly("one", "two", "six")
}
@Test fun keyIterator() {
val array = SparseArrayCompat<String>()
assertFalse(array.keyIterator().hasNext())
array.put(1, "one")
array.put(2, "two")
array.put(6, "six")
val iterator = array.keyIterator()
assertTrue(iterator.hasNext())
assertEquals(1, iterator.nextInt())
assertTrue(iterator.hasNext())
assertEquals(2, iterator.nextInt())
assertTrue(iterator.hasNext())
assertEquals(6, iterator.nextInt())
assertFalse(iterator.hasNext())
}
@Test fun valueIterator() {
val array = SparseArrayCompat<String>()
assertFalse(array.valueIterator().hasNext())
array.put(1, "one")
array.put(2, "two")
array.put(6, "six")
val iterator = array.valueIterator()
assertTrue(iterator.hasNext())
assertEquals("one", iterator.next())
assertTrue(iterator.hasNext())
assertEquals("two", iterator.next())
assertTrue(iterator.hasNext())
assertEquals("six", iterator.next())
assertFalse(iterator.hasNext())
}
}
| collection/ktx/src/test/java/androidx/collection/SparseArrayTest.kt | 2854226698 |
package specs.db.dbexecute
import io.github.adven27.concordion.extensions.exam.core.findResource
import specs.Specs
class DbExecute : Specs() {
val dir: String
get() = "/specs/db/data".findResource().path
}
| example/src/test/kotlin/specs/db/dbexecute/DbExecute.kt | 2157667485 |
package siosio.repository.converter
import com.intellij.codeInsight.lookup.*
import com.intellij.openapi.module.*
import com.intellij.openapi.roots.impl.*
import com.intellij.openapi.vfs.*
import com.intellij.psi.*
import com.intellij.psi.search.*
import com.intellij.util.xml.*
import siosio.*
import siosio.repository.extension.*
import siosio.repository.xml.*
/**
*/
class PsiFileConverter : Converter<PsiFile>(), CustomReferenceConverter<PsiFile> {
override fun createReferences(value: GenericDomValue<PsiFile>?,
element: PsiElement?,
context: ConvertContext?): Array<PsiReference> {
return arrayOf(MyReference(element!!, value, context))
}
override fun fromString(s: String?, context: ConvertContext?): PsiFile? {
val project = context?.project ?: return null
val module = context.module ?: return null
val scope = GlobalSearchScope.moduleRuntimeScope(module, context.file.inTestScope(module))
return ResourceFileUtil.findResourceFileInScope(s, project, scope)?.let {
return PsiManager.getInstance(project).findFile(it)
}
}
override fun toString(t: PsiFile?, context: ConvertContext?): String? {
val project = context?.project ?: return null
val directoryIndex = DirectoryIndex.getInstance(project)
return directoryIndex.toResourceFile(t?.virtualFile ?: return null)
}
class MyReference(psiElement: PsiElement,
val file: GenericDomValue<PsiFile>?,
private val context: ConvertContext?) : PsiReferenceBase<PsiElement>(psiElement) {
override fun getVariants(): Array<out Any> {
context ?: return emptyArray()
val directoryIndex = DirectoryIndex.getInstance(myElement.project)
return XmlHelper.findNablarchXml(myElement) {
map {
LookupElementBuilder.create(directoryIndex.toResourceFile(it.virtualFile))
.withIcon(nablarchIcon)
.withAutoCompletionPolicy(AutoCompletionPolicy.ALWAYS_AUTOCOMPLETE)
}.toList().toTypedArray()
} ?: emptyArray()
}
override fun resolve(): PsiElement? {
return file?.value
}
}
}
private fun DirectoryIndex.toResourceFile(file: VirtualFile): String {
val packageName = getPackageName(file.parent)
return if (packageName.isNullOrEmpty()) {
file.name
} else {
packageName!!.replace('.', '/') + '/' + file.name
}
}
| src/main/java/siosio/repository/converter/PsiFileConverter.kt | 1514212951 |
/*
* Copyright (C) 2016/2022 Litote
*
* 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.litote.kmongo.coroutine
import kotlinx.coroutines.runBlocking
import kotlinx.serialization.Contextual
import kotlinx.serialization.Serializable
import org.bson.types.Binary
import org.junit.Assert
import org.junit.Before
import org.junit.Test
import org.litote.kmongo.MongoOperator
import org.litote.kmongo.coroutine.ReactiveStreamsBinaryTest.BinaryFriend
import org.litote.kmongo.json
import kotlin.reflect.KClass
import kotlin.test.assertEquals
import kotlin.test.assertNotNull
import kotlin.test.assertNull
/**
*
*/
class ReactiveStreamsBinaryTest : KMongoReactiveStreamsCoroutineBaseTest<BinaryFriend>() {
@Serializable
data class BinaryFriend(@Contextual val _id: Binary, var name: String = "none")
lateinit var friendId: Binary
override fun getDefaultCollectionClass(): KClass<BinaryFriend> = BinaryFriend::class
@Before
fun setup() {
friendId = Binary("kmongo".toByteArray())
}
@Test
fun testUpdate() = runBlocking {
val expectedId = Binary("friend2".toByteArray())
val expected = BinaryFriend(expectedId, "friend2")
col.insertOne(expected)
expected.name = "new friend"
col.updateOne("{_id:${expectedId.json}}", expected)
val savedFriend = col.findOne("{_id:${expectedId.json}}")
assertNotNull(savedFriend)
assertEquals(expected, savedFriend)
}
@Test
fun testInsert() = runBlocking {
val expectedId = Binary("friend".toByteArray())
val expected = BinaryFriend(expectedId, "friend")
col.insertOne(expected)
val savedFriend = col.findOne("{_id:${expectedId.json}}")
assertNotNull(savedFriend)
assertEquals(expected, savedFriend)
}
@Test
fun testRemove() = runBlocking {
col.deleteOne("{_id:${friendId.json}}")
val shouldNull = col.findOne("{_id:${friendId.json}}")
assertNull(shouldNull)
}
@Test
fun canMarshallBinary() = runBlocking {
val doc = BinaryFriend(Binary("abcde".toByteArray()))
col.insertOne(doc)
val count =
col.countDocuments("{'_id' : { ${MongoOperator.binary} : 'YWJjZGU=' , ${MongoOperator.type} : '0'}}")
val savedDoc = col.findOne("{_id:${doc._id.json}}") ?: throw AssertionError("Must not NUll")
assertEquals(1, count)
assertEquals(doc._id.type, savedDoc._id.type)
Assert.assertArrayEquals(doc._id.data, savedDoc._id.data)
}
}
| kmongo-coroutine-core-tests/src/main/kotlin/org/litote/kmongo/coroutine/ReactiveStreamsBinaryTest.kt | 4269447439 |
/*
Copyright 2015 Andreas Würl
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.blitzortung.android.app.view
import android.content.Context
import android.graphics.*
import android.graphics.Paint.Align
import android.graphics.Paint.Style
import android.location.Location
import android.preference.PreferenceManager
import android.util.AttributeSet
import android.util.Log
import org.blitzortung.android.alert.AlertResult
import org.blitzortung.android.alert.data.AlertSector
import org.blitzortung.android.alert.event.AlertEvent
import org.blitzortung.android.alert.event.AlertResultEvent
import org.blitzortung.android.alert.handler.AlertHandler
import org.blitzortung.android.app.Main
import org.blitzortung.android.app.R
import org.blitzortung.android.data.MainDataHandler
import org.blitzortung.android.dialogs.AlertDialog
import org.blitzortung.android.dialogs.AlertDialogColorHandler
import org.blitzortung.android.location.LocationEvent
import org.blitzortung.android.map.overlay.color.ColorHandler
import org.blitzortung.android.util.TabletAwareView
import kotlin.math.cos
import kotlin.math.max
import kotlin.math.min
import kotlin.math.sin
class AlertView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyle: Int = 0
) : TabletAwareView(context, attrs, defStyle) {
private val arcArea = RectF()
private val background = Paint()
private val sectorPaint = Paint()
private val lines = Paint(Paint.ANTI_ALIAS_FLAG)
private val textStyle = Paint(Paint.ANTI_ALIAS_FLAG)
private val warnText = Paint(Paint.ANTI_ALIAS_FLAG)
private val transfer = Paint()
private val alarmNotAvailableTextLines: Array<String> = context.getString(R.string.alarms_not_available)
.split("\n".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()
private lateinit var colorHandler: ColorHandler
private var intervalDuration: Int = 0
private var temporaryBitmap: Bitmap? = null
private var temporaryCanvas: Canvas? = null
private var alertResult: AlertResult? = null
private var location: Location? = null
private var enableDescriptionText = false
val alertEventConsumer: (AlertEvent?) -> Unit = { event ->
Log.v(Main.LOG_TAG, "AlertView alertEventConsumer received $event")
alertResult = if (event is AlertResultEvent) {
event.alertResult
} else {
null
}
invalidate()
}
val locationEventConsumer: (LocationEvent) -> Unit = { locationEvent ->
Log.v(Main.LOG_TAG, "AlertView received location ${locationEvent.location}")
location = locationEvent.location
val visibility = if (location != null) VISIBLE else INVISIBLE
setVisibility(visibility)
invalidate()
}
init {
with(lines) {
color = 0xff404040.toInt()
style = Style.STROKE
}
with(textStyle) {
color = 0xff404040.toInt()
textSize = 0.8f * [email protected] * textSizeFactor(context)
}
background.color = 0xffb0b0b0.toInt()
}
fun enableLongClickListener(dataHandler: MainDataHandler, alertHandler: AlertHandler) {
val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context)
setOnLongClickListener {
AlertDialog(context, AlertDialogColorHandler(sharedPreferences), dataHandler, alertHandler)
.show()
true
}
}
fun enableDescriptionText() {
enableDescriptionText = true
}
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
val getSize = fun(spec: Int) = MeasureSpec.getSize(spec)
val parentWidth = getSize(widthMeasureSpec) * sizeFactor
val parentHeight = getSize(heightMeasureSpec) * sizeFactor
val size = min(parentWidth.toInt(), parentHeight.toInt())
super.onMeasure(MeasureSpec.makeMeasureSpec(size, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(size, MeasureSpec.EXACTLY))
}
override fun onDraw(canvas: Canvas) {
val size = max(width, height)
val pad = 4
val center = size / 2.0f
val radius = center - pad
prepareTemporaryBitmap(size)
val alertResult = alertResult
val temporaryCanvas = temporaryCanvas
val temporaryBitmap = temporaryBitmap
if (temporaryBitmap != null && temporaryCanvas != null) {
if (alertResult != null && intervalDuration != 0) {
val alertParameters = alertResult.parameters
val rangeSteps = alertParameters.rangeSteps
val rangeStepCount = rangeSteps.size
val radiusIncrement = radius / rangeStepCount
val sectorWidth = (360 / alertParameters.sectorLabels.size).toFloat()
with(lines) {
color = colorHandler.lineColor
strokeWidth = (size / 150).toFloat()
}
with(textStyle) {
textAlign = Align.CENTER
color = colorHandler.textColor
}
val actualTime = System.currentTimeMillis()
for (alertSector in alertResult.sectors) {
val startAngle = alertSector.minimumSectorBearing + 90f + 180f
val ranges = alertSector.ranges
for (rangeIndex in ranges.indices.reversed()) {
val alertSectorRange = ranges[rangeIndex]
val sectorRadius = (rangeIndex + 1) * radiusIncrement
val leftTop = center - sectorRadius
val bottomRight = center + sectorRadius
val drawColor = alertSectorRange.strikeCount > 0
if (drawColor) {
val color = colorHandler.getColor(actualTime, alertSectorRange.latestStrikeTimestamp, intervalDuration)
sectorPaint.color = color
}
arcArea.set(leftTop, leftTop, bottomRight, bottomRight)
temporaryCanvas.drawArc(arcArea, startAngle, sectorWidth, true, if (drawColor) sectorPaint else background)
}
}
for (alertSector in alertResult.sectors) {
val bearing = alertSector.minimumSectorBearing.toDouble()
temporaryCanvas.drawLine(center, center, center + (radius * sin(bearing / 180.0f * Math.PI)).toFloat(), center + (radius * -cos(bearing / 180.0f * Math.PI)).toFloat(), lines)
if (enableDescriptionText && size > TEXT_MINIMUM_SIZE) {
drawSectorLabel(center, radiusIncrement, alertSector, bearing + sectorWidth / 2.0)
}
}
textStyle.textAlign = Align.RIGHT
val textHeight = textStyle.getFontMetrics(null)
for (radiusIndex in 0 until rangeStepCount) {
val leftTop = center - (radiusIndex + 1) * radiusIncrement
val bottomRight = center + (radiusIndex + 1) * radiusIncrement
arcArea.set(leftTop, leftTop, bottomRight, bottomRight)
temporaryCanvas.drawArc(arcArea, 0f, 360f, false, lines)
if (enableDescriptionText && size > TEXT_MINIMUM_SIZE) {
val text = "%.0f".format(rangeSteps[radiusIndex])
temporaryCanvas.drawText(text, center + (radiusIndex + 0.85f) * radiusIncrement, center + textHeight / 3f, textStyle)
if (radiusIndex == rangeStepCount - 1) {
val distanceUnit = resources.getString(alertParameters.measurementSystem.unitNameString)
temporaryCanvas.drawText(distanceUnit, center + (radiusIndex + 0.85f) * radiusIncrement, center + textHeight * 1.33f, textStyle)
}
}
}
} else {
if (enableDescriptionText && size > TEXT_MINIMUM_SIZE) {
drawAlertOrLocationMissingMessage(center, temporaryCanvas)
} else {
if (location != null) {
drawOwnLocationSymbol(center, radius, size, temporaryCanvas)
}
}
}
canvas.drawBitmap(temporaryBitmap, 0f, 0f, transfer)
}
}
private fun drawAlertOrLocationMissingMessage(center: Float, canvas: Canvas) {
with(warnText) {
color = resources.getColor(R.color.RedWarn)
textAlign = Align.CENTER
textSize = DEFAULT_FONT_SIZE.toFloat()
val maxWidth = alarmNotAvailableTextLines.map { warnText.measureText(it) }.maxOrNull()
?: width.toFloat() - 20
val scale = (width - 20).toFloat() / maxWidth
//Now scale the text so we can use the whole width of the canvas
textSize = scale * DEFAULT_FONT_SIZE
}
for (line in alarmNotAvailableTextLines.indices) {
canvas.drawText(alarmNotAvailableTextLines[line], center, center + (line - 1) * warnText.getFontMetrics(null), warnText)
}
}
private fun drawOwnLocationSymbol(center: Float, radius: Float, size: Int, temporaryCanvas: Canvas) {
with(lines) {
color = colorHandler.lineColor
strokeWidth = (size / 80).toFloat()
}
val largeRadius = radius * 0.8f
val leftTop = center - largeRadius
val bottomRight = center + largeRadius
arcArea.set(leftTop, leftTop, bottomRight, bottomRight)
temporaryCanvas.drawArc(arcArea, 0f, 360f, false, lines)
val smallRadius = radius * 0.6f
temporaryCanvas.drawLine(center - smallRadius, center, center + smallRadius, center, lines)
temporaryCanvas.drawLine(center, center - smallRadius, center, center + smallRadius, lines)
}
private fun drawSectorLabel(center: Float, radiusIncrement: Float, sector: AlertSector, bearing: Double) {
if (bearing != 90.0) {
val text = sector.label
val textRadius = (sector.ranges.size - 0.5f) * radiusIncrement
temporaryCanvas!!.drawText(text, center + (textRadius * sin(bearing / 180.0 * Math.PI)).toFloat(), center + (textRadius * -cos(bearing / 180.0 * Math.PI)).toFloat() + textStyle.getFontMetrics(null) / 3f, textStyle)
}
}
private fun prepareTemporaryBitmap(size: Int) {
if (temporaryBitmap == null) {
val temporaryBitmap = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888)
this.temporaryBitmap = temporaryBitmap
temporaryCanvas = Canvas(temporaryBitmap)
}
background.color = colorHandler.backgroundColor
background.xfermode = XFERMODE_CLEAR
temporaryCanvas!!.drawPaint(background)
background.xfermode = XFERMODE_SRC
}
fun setColorHandler(colorHandler: ColorHandler, intervalDuration: Int) {
this.colorHandler = colorHandler
this.intervalDuration = intervalDuration
}
override fun setBackgroundColor(backgroundColor: Int) {
background.color = backgroundColor
}
fun setAlpha(alpha: Int) {
transfer.alpha = alpha
}
companion object {
private const val TEXT_MINIMUM_SIZE = 300
private const val DEFAULT_FONT_SIZE = 20
private val XFERMODE_CLEAR = PorterDuffXfermode(PorterDuff.Mode.CLEAR)
private val XFERMODE_SRC = PorterDuffXfermode(PorterDuff.Mode.SRC)
}
}
| app/src/main/java/org/blitzortung/android/app/view/AlertView.kt | 738392129 |
package org.evomaster.core.problem.util
import org.evomaster.core.problem.api.service.param.Param
import org.evomaster.core.problem.rest.RestCallAction
import org.evomaster.core.problem.rest.RestPath
import org.evomaster.core.problem.rest.param.*
import org.evomaster.core.search.gene.*
import org.evomaster.core.search.gene.collection.ArrayGene
import org.evomaster.core.search.gene.collection.FixedMapGene
import org.evomaster.core.search.gene.collection.PairGene
import org.evomaster.core.search.gene.datetime.DateTimeGene
import org.evomaster.core.search.gene.numeric.DoubleGene
import org.evomaster.core.search.gene.numeric.FloatGene
import org.evomaster.core.search.gene.numeric.IntegerGene
import org.evomaster.core.search.gene.numeric.LongGene
import org.evomaster.core.search.gene.optional.CustomMutationRateGene
import org.evomaster.core.search.gene.optional.FlexibleGene
import org.evomaster.core.search.gene.optional.OptionalGene
import org.evomaster.core.search.gene.sql.SqlAutoIncrementGene
import org.evomaster.core.search.gene.optional.NullableGene
import org.evomaster.core.search.gene.sql.SqlPrimaryKeyGene
import org.evomaster.core.search.gene.string.StringGene
/**
* this class used to handle binding values among params
*/
class ParamUtil {
companion object {
private const val DISRUPTIVE_NAME = "d_"
private const val BODYGENE_NAME = "body"
private const val separator = "@"
/**
* when identifying relationship based on the "tokens", if the token belongs to [GENERAL_NAMES],
* we may further use up-level token.
*/
private val GENERAL_NAMES = mutableListOf("id", "name", "value")
/**
* @return the actions which have the longest path in [actions]
*/
fun selectLongestPathAction(actions: List<RestCallAction>): List<RestCallAction> {
val max =
actions.asSequence().map { a -> a.path.levels() }
.maxOrNull()!!
return actions.filter { a -> a.path.levels() == max }
}
/**
* append param i.e., [paramToAppend] with additional info [paramsText]
*/
fun appendParam(paramsText: String, paramToAppend: String): String =
if (paramsText.isBlank()) paramToAppend else "$paramsText$separator$paramToAppend"
/**
* @return extracted params
*/
fun parseParams(params: String): List<String> = params.split(separator)
/**
* @return a field name with info of its object
*/
fun modifyFieldName(obj: ObjectGene, field: Gene): String {
return if (isGeneralName(field.name)) (obj.refType ?: "") + field.name else field.name
}
/**
* @return whether [name] is possibly matched with a field [fieldName] of [refType]
*/
fun compareField(fieldName: String, refType: String?, name: String): Boolean {
if (!isGeneralName(fieldName) || refType == null) return fieldName.equals(name, ignoreCase = true)
val prefix = "$refType$fieldName".equals(name, ignoreCase = true)
if (prefix) return true
return "$fieldName$refType".equals(name, ignoreCase = true)
}
/**
* @return are all [params] BodyParam?
*/
fun isAllBodyParam(params: List<Param>): Boolean {
return numOfBodyParam(params) == params.size
}
/**
* @return a number of BodyParam in [params]
*/
fun numOfBodyParam(params: List<Param>): Int {
return params.count { it is BodyParam }
}
/**
* @return do [params] contain any BodyParam?
*/
fun existBodyParam(params: List<Param>): Boolean {
return numOfBodyParam(params) > 0
}
/**
* @return whether [geneA] and [geneB] have same value.
*/
fun compareGenesWithValue(geneA: Gene, geneB: Gene): Boolean {
val geneAWithGeneBType = geneB.copy()
geneAWithGeneBType.bindValueBasedOn(geneA)
return when (geneB) {
is StringGene -> geneB.value == (geneAWithGeneBType as StringGene).value
is IntegerGene -> geneB.value == (geneAWithGeneBType as IntegerGene).value
is DoubleGene -> geneB.value == (geneAWithGeneBType as DoubleGene).value
is FloatGene -> geneB.value == (geneAWithGeneBType as FloatGene).value
is LongGene -> geneB.value == (geneAWithGeneBType as LongGene).value
else -> {
throw IllegalArgumentException("the type of $geneB is not supported")
}
}
}
/**
* @return the score of match between [target] and [source] which represents two genes respectively. Note that 0 means matched.
* @param doContain indicates whether 'contains' can be considered as match. i.e., target contains every token of sources.
*/
fun scoreOfMatch(target: String, source: String, doContain: Boolean): Int {
val targets = target.split(separator).filter { it != DISRUPTIVE_NAME }.toMutableList()
val sources = source.split(separator).filter { it != DISRUPTIVE_NAME }.toMutableList()
if (doContain) {
if (sources.toHashSet().map { s -> if (target.lowercase().contains(s.lowercase())) 1 else 0 }
.sum() == sources.toHashSet().size)
return 0
}
if (targets.toHashSet().size == sources.toHashSet().size) {
if (targets.containsAll(sources)) return 0
}
if (sources.contains(BODYGENE_NAME)) {
val sources_rbody = sources.filter { it != BODYGENE_NAME }.toMutableList()
if (sources_rbody.toHashSet().map { s -> if (target.lowercase().contains(s.lowercase())) 1 else 0 }
.sum() == sources_rbody.toHashSet().size)
return 0
}
if (targets.first() != sources.first())
return -1
else
return targets.plus(sources).filter { targets.contains(it).xor(sources.contains(it)) }.size
}
/**
* @return a map of a path of gene to gene
* @param parameters specifies the params which contains genes to be extracted
* @param tokensInPath specified the tokens of the path which refers to [parameters]
*/
fun geneNameMaps(parameters: List<Param>, tokensInPath: List<String>?): MutableMap<String, Gene> {
val maps = mutableMapOf<String, Gene>()
val pred = { gene: Gene -> (gene is DateTimeGene) }
parameters.forEach { p ->
p.gene.flatView(pred).filter {
!(it is ObjectGene ||
it is CustomMutationRateGene<*> ||
it is OptionalGene ||
it is ArrayGene<*> ||
it is FixedMapGene<*, *>)
}
.forEach { g ->
val names = getGeneNamesInPath(parameters, g)
if (names != null)
maps.put(genGeneNameInPath(names, tokensInPath), g)
}
}
return maps
}
/**
* @return whether [text] is a general name, e.g., 'id' or 'name'
*/
fun isGeneralName(text: String): Boolean {
return GENERAL_NAMES.any { it.equals(text, ignoreCase = true) }
}
private fun genGeneNameInPath(names: MutableList<String>, tokensInPath: List<String>?): String {
tokensInPath?.let {
return names.plus(tokensInPath).joinToString(separator)
}
return names.joinToString(separator)
}
private fun getGeneNamesInPath(parameters: List<Param>, gene: Gene): MutableList<String>? {
parameters.forEach { p ->
val names = mutableListOf<String>()
if (extractPathFromRoot(p.gene, gene, names)) {
return names
}
}
return null
}
/**
* extract a path from [comGene] to [gene]
* @param names contains the name of genes in the path
*
* @return can find [gene] in [comGene]?
*/
private fun extractPathFromRoot(comGene: Gene, gene: Gene, names: MutableList<String>): Boolean {
when (comGene) {
is ObjectGene -> return extractPathFromRoot(comGene, gene, names)
is PairGene<*, *> -> return extractPathFromRoot(comGene, gene, names)
is CustomMutationRateGene<*> -> return extractPathFromRoot(comGene, gene, names)
is OptionalGene -> return extractPathFromRoot(comGene, gene, names)
is ArrayGene<*> -> return extractPathFromRoot(comGene, gene, names)
is FixedMapGene<*, *> -> return extractPathFromRoot(comGene, gene, names)
else -> if (comGene == gene) {
names.add(comGene.name)
return true
} else return false
}
}
private fun extractPathFromRoot(comGene: ObjectGene, gene: Gene, names: MutableList<String>): Boolean {
comGene.fields.forEach {
if (extractPathFromRoot(it, gene, names)) {
names.add(it.name)
return true
}
}
return false
}
private fun extractPathFromRoot(comGene: CustomMutationRateGene<*>, gene: Gene, names: MutableList<String>): Boolean {
if (extractPathFromRoot(comGene.gene, gene, names)) {
names.add(comGene.name)
return true
}
return false
}
private fun extractPathFromRoot(comGene: OptionalGene, gene: Gene, names: MutableList<String>): Boolean {
if (extractPathFromRoot(comGene.gene, gene, names)) {
names.add(comGene.name)
return true
}
return false
}
private fun extractPathFromRoot(comGene: ArrayGene<*>, gene: Gene, names: MutableList<String>): Boolean {
comGene.getViewOfElements().forEach {
if (extractPathFromRoot(it, gene, names)) {
return true
}
}
return false
}
private fun extractPathFromRoot(comGene: PairGene<*, *>, gene: Gene, names: MutableList<String>): Boolean {
listOf(comGene.first, comGene.second).forEach {
if (extractPathFromRoot(it, gene, names)) {
names.add(it.name)
return true
}
}
return false
}
private fun extractPathFromRoot(comGene: FixedMapGene<*, *>, gene: Gene, names: MutableList<String>): Boolean {
comGene.getAllElements().forEach {
if (extractPathFromRoot(it, gene, names)) {
names.add(it.name)
return true
}
}
return false
}
fun getParamId(param: Param, path: RestPath): String {
return listOf(param.name).plus(path.getNonParameterTokens().reversed()).joinToString(separator)
}
fun generateParamId(list: Array<String>): String = list.joinToString(separator)
fun getValueGene(gene: Gene): Gene {
if (gene is OptionalGene) {
return getValueGene(gene.gene)
} else if (gene is CustomMutationRateGene<*>)
return getValueGene(gene.gene)
else if (gene is SqlPrimaryKeyGene) {
if (gene.gene is SqlAutoIncrementGene)
return gene
else return getValueGene(gene.gene)
} else if (gene is NullableGene) {
return getValueGene(gene.gene)
} else if (gene is FlexibleGene){
return getValueGene(gene.gene)
}
return gene
}
fun getObjectGene(gene: Gene): ObjectGene? {
if (gene is ObjectGene) {
return gene
} else if (gene is OptionalGene) {
return getObjectGene(gene.gene)
} else if (gene is CustomMutationRateGene<*>)
return getObjectGene(gene.gene)
else return null
}
}
} | core/src/main/kotlin/org/evomaster/core/problem/util/ParamUtil.kt | 411411231 |
/*
* Copyright 2000-2021 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* See LICENSE in the project root for license information.
*/
package jetbrains.buildServer.rust.commands.cargo
import jetbrains.buildServer.rust.CargoConstants
import jetbrains.buildServer.rust.commands.CommandType
/**
* Provides parameters for cargo test command.
*/
class TestCommandType : CommandType {
override val name: String
get() = CargoConstants.COMMAND_TEST
override val editPage: String
get() = "editTestParameters.jsp"
override val viewPage: String
get() = "viewTestParameters.jsp"
}
| plugin-rust-server/src/main/kotlin/jetbrains/buildServer/rust/commands/cargo/TestCommandType.kt | 3974495280 |
open class Import {
var students: StudentMap? = null
var student: Student? = null
}
open class MyMap : Student {
}
| tests/Generator/resource/kotlin_import.kt | 2358697761 |
/*
* Copyright 2016-2019 JetBrains s.r.o.
* Use of this source code is governed by the Apache 2.0 License that can be found in the LICENSE.txt file.
*/
package benchmarks.immutableList.builder
import benchmarks.*
import kotlinx.collections.immutable.PersistentList
import kotlinx.benchmark.*
@State(Scope.Benchmark)
open class Remove {
@Param(BM_1, BM_10, BM_100, BM_1000, BM_10000, BM_100000, BM_1000000, BM_10000000)
var size: Int = 0
@Param(IP_100, IP_99_09, IP_95, IP_70, IP_50, IP_30, IP_0)
var immutablePercentage: Double = 0.0
@Benchmark
fun addAndRemoveLast(): PersistentList.Builder<String> {
val builder = persistentListBuilderAdd(size, immutablePercentage)
for (i in 0 until size) {
builder.removeAt(builder.size - 1)
}
return builder
}
/**
* Adds [size] elements to an empty persistent list builder
* and then removes one element from the beginning.
*
* Measures (mean time and memory spent per `add` operation) + (time and memory spent on `removeAt` operation) / size.
*
* Expected time: [Add.addLast] + nearly constant.
* Expected memory: [Add.addLast] + nearly constant.
*/
@Benchmark
fun addAndRemoveFirst(): String {
val builder = persistentListBuilderAdd(size, immutablePercentage)
return builder.removeAt(0)
}
/**
* Adds [size] elements to an empty persistent list builder
* and then removes one element from the middle.
*
* Measures (mean time and memory spent per `add` operation) + (time and memory spent on `removeAt` operation) / size.
*
* Expected time: [Add.addLast] + nearly constant.
* Expected memory: [Add.addLast] + nearly constant.
*/
@Benchmark
fun addAndRemoveMiddle(): String {
val builder = persistentListBuilderAdd(size, immutablePercentage)
return builder.removeAt(size / 2)
}
} | benchmarks/commonMain/src/benchmarks/immutableList/builder/Remove.kt | 1704132334 |
package me.proxer.library.api.user
import retrofit2.Retrofit
/**
* API for the User class.
*
* @author Ruben Gees
*/
class UserApi internal constructor(retrofit: Retrofit) {
private val internalApi = retrofit.create(InternalApi::class.java)
/**
* Returns the respective endpoint.
*/
fun login(username: String, password: String): LoginEndpoint {
return LoginEndpoint(internalApi, username, password)
}
/**
* Returns the respective endpoint.
*/
fun logout(): LogoutEndpoint {
return LogoutEndpoint(internalApi)
}
/**
* Returns the respective endpoint.
*/
fun topTen(userId: String? = null, username: String? = null): UserTopTenEndpoint {
return UserTopTenEndpoint(internalApi, userId, username)
}
/**
* Returns the respective endpoint.
*/
fun info(userId: String? = null, username: String? = null): UserInfoEndpoint {
return UserInfoEndpoint(internalApi, userId, username)
}
/**
* Returns the respective endpoint.
*/
fun about(userId: String? = null, username: String? = null): UserAboutEndpoint {
return UserAboutEndpoint(internalApi, userId, username)
}
/**
* Returns the respective endpoint.
*/
fun mediaList(userId: String? = null, username: String? = null): UserMediaListEndpoint {
return UserMediaListEndpoint(internalApi, userId, username)
}
/**
* Returns the respective endpoint.
*/
fun comments(userId: String? = null, username: String? = null): UserCommentsEndpoint {
return UserCommentsEndpoint(internalApi, userId, username)
}
/**
* Returns the respective endpoint.
*/
fun history(userId: String? = null, username: String? = null): UserHistoryEndpoint {
return UserHistoryEndpoint(internalApi, userId, username)
}
}
| library/src/main/kotlin/me/proxer/library/api/user/UserApi.kt | 1610422518 |
package com.acelta.util
class Indexer<T>(val capacity: Int) : MutableIterable<T> {
private val array = arrayOfNulls<Any?>(capacity)
private val reusableIterator = Iterator()
var size = 0
var highest = 0
operator fun get(index: Int) = array[index] as? T
operator fun set(index: Int, element: T?): T? {
val last = array[index]
array[index] = element
if (null === last && null !== element) {
size++
if (highest < index) highest = index
} else if (null !== last && null === element) {
size--
if (highest == index) highest--
}
return last as? T
}
fun nextIndex(): Int {
if (size == capacity)
throw IllegalStateException("There is no next index because the indexer is filled to capacity!")
for (i in 0..array.size - 1) if (null === array[i]) return i
throw IllegalStateException("Could not find an open index!")
}
private inner class Iterator : MutableIterator<T> {
internal var cursor = 0
override fun hasNext() = size > 0 && cursor <= highest
override tailrec fun next(): T = get(cursor++) ?: next()
override fun remove() {
set(cursor, null)
}
}
override fun iterator(): MutableIterator<T> {
reusableIterator.cursor = 0
return reusableIterator
}
} | src/main/kotlin/com/acelta/util/Indexer.kt | 2229944976 |
package com.elkriefy.games.belote.fragments
import android.content.Intent
import android.os.Bundle
import android.support.v4.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Button
import android.widget.Toast
import com.elkriefy.games.belote.R
import com.elkriefy.games.belote.data.types.Player
import com.google.android.gms.auth.api.Auth
import com.google.android.gms.auth.api.signin.GoogleSignInAccount
import com.google.android.gms.auth.api.signin.GoogleSignInOptions
import com.google.android.gms.common.ConnectionResult
import com.google.android.gms.common.api.GoogleApiClient
import com.google.firebase.auth.FirebaseAuth
import com.google.firebase.auth.GoogleAuthProvider
import com.google.firebase.database.DatabaseReference
import com.google.firebase.database.FirebaseDatabase
class MainActivityFragment : Fragment(), GoogleApiClient.OnConnectionFailedListener {
private val RC_SIGN_IN: Int = 78
private lateinit var loginWithGoogleButton: Button
private lateinit var joinToQue: Button
private var mGoogleApiClient: GoogleApiClient? = null
private var currentUserInQue = false
private lateinit var rootView: ViewGroup
private lateinit var playesQueReference: DatabaseReference
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val gso = GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestIdToken(getString(R.string.default_web_client_id))
.requestEmail()
.build()
mGoogleApiClient = GoogleApiClient.Builder(context)
.addApi(Auth.GOOGLE_SIGN_IN_API, gso)
.build()
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?): View? {
rootView = inflater.inflate(R.layout.fragment_main, container, false) as ViewGroup
return rootView
}
override fun onViewCreated(view: View?, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
loginWithGoogleButton = view!!.findViewById<Button>(R.id.login_with_google)
joinToQue = view.findViewById<Button>(R.id.join_to_que)
var currentUser = FirebaseAuth.getInstance().currentUser
joinToQue.setOnClickListener {
when (currentUserInQue) {
true -> {
val database = FirebaseDatabase.getInstance()
database.getReference(Player.TABLE + "/" + FirebaseAuth.getInstance().currentUser!!.uid).removeValue()
currentUserInQue = false
joinToQue.text = getString(R.string.join)
}
else -> {
val database = FirebaseDatabase.getInstance()
var player = Player()
var currentUser1 = FirebaseAuth.getInstance().currentUser
player.id = currentUser1!!.uid
player.email = currentUser1!!.email
database.getReference(Player.TABLE + "/" + currentUser1.uid).setValue(player)
currentUserInQue = true
joinToQue.text = getString(R.string.leave)
}
}
}
when (currentUser) {
null -> {
loginWithGoogleButton.setOnClickListener {
signIn()
}
}
else -> {
loginWithGoogleButton.visibility = View.GONE
joinToQue.visibility = View.VISIBLE
Toast.makeText(context, "hello" + currentUser.displayName, Toast.LENGTH_SHORT).show()
}
}
}
private fun signIn() {
val signInIntent = Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient)
startActivityForResult(signInIntent, RC_SIGN_IN)
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent) {
super.onActivityResult(requestCode, resultCode, data)
// Result returned from launching the Intent from GoogleSignInApi.getSignInIntent(...);
if (requestCode == RC_SIGN_IN) {
val result = Auth.GoogleSignInApi.getSignInResultFromIntent(data)
if (result.isSuccess) {
// Google Sign In was successful, authenticate with Firebase
val account = result.signInAccount
firebaseAuthWithGoogle(account!!)
} else {
// Google Sign In failed, update UI appropriately
// ...
}
}
}
private fun firebaseAuthWithGoogle(acct: GoogleSignInAccount) {
val credential = GoogleAuthProvider.getCredential(acct.idToken, null)
FirebaseAuth.getInstance().signInWithCredential(credential)
.addOnCompleteListener(activity, { task ->
if (task.isSuccessful) {
// Sign in success, update UI with the signed-in user's information
val user = FirebaseAuth.getInstance().currentUser
Toast.makeText(context, "success", Toast.LENGTH_SHORT).show()
loginWithGoogleButton.visibility = View.GONE
joinToQue.visibility = View.VISIBLE
// activity.onBackPressed()
} else {
Toast.makeText(context, "falied", Toast.LENGTH_SHORT).show()
}
// ...
})
}
override fun onConnectionFailed(p0: ConnectionResult) {
}
}
| Belote/app/src/main/java/com/elkriefy/games/belote/fragments/MainActivityFragment.kt | 2593681705 |
package com.encodeering.conflate.experimental.api
/**
* A dispatcher is connected to exactly one [storage][Storage] and starts a mutation cycle for every [passing][dispatch] action intent.
*
* The process of a cycle is completely covered by [Coroutines][https://kotlinlang.org/docs/reference/coroutines.html] and can be described as follows:
*
* - Enter dispatch
* - Enter middleware - one by one in the configured order
* - Perform conflation
* - Perform notification
* - Exit middleware - one by one in reversed order
* - Exit dispatch
*
* A middleware is encouraged to linearize their routines with this process, but may define rare
* exceptions for processes, that run independently in their own context, e.g. saga, epic, ..
*
* Please consult the middleware specific documentation here.
*
* ### Note
*
* Conflate provides a dedicated entity, whereas Redux has left this responsibility to the storage, but this is more likely a design choice.
*
* ### Official documentation:
*
* - Dispatches an action. This is the only way to trigger a state change. [http://redux.js.org/docs/api/Store.html#dispatchaction]
*
* @author Michael Clausen - [email protected]
*/
interface Dispatcher {
/**
* Starts a mutation cycle and returns an observable (future-like) to watch this process.
*
* The observable completes with the same result, exactly when the mentioned process completes.
*
* @param action specifies the action intent
* @return an observable for this process
*/
fun dispatch (action : Action) : Completable<Dispatcher, Unit>
} | modules/conflate-api/src/main/kotlin/com/encodeering/conflate/experimental/api/Dispatcher.kt | 1380881790 |
/*
Copyright (C) 2013-2019 Expedia Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package com.hotels.styx.routing
import com.hotels.styx.api.HttpHeaderNames.HOST
import com.hotels.styx.api.HttpRequest.get
import com.hotels.styx.api.HttpResponseStatus.OK
import com.hotels.styx.client.StyxHttpClient
import com.hotels.styx.support.StyxServerProvider
import com.hotels.styx.support.proxyHttpHostHeader
import com.hotels.styx.support.proxyHttpsHostHeader
import io.kotlintest.Spec
import io.kotlintest.shouldBe
import io.kotlintest.specs.StringSpec
import reactor.core.publisher.toMono
import java.nio.charset.StandardCharsets.UTF_8
class ConditionRoutingSpec : StringSpec() {
init {
"Routes HTTP protocol" {
val request = get("/11")
.header(HOST, styxServer().proxyHttpHostHeader())
.build();
client.send(request)
.toMono()
.block()
.let {
it!!.status() shouldBe (OK)
it.bodyAs(UTF_8) shouldBe ("Hello, from http server!")
}
}
"Routes HTTPS protocol" {
val request = get("/2")
.header(HOST, styxServer().proxyHttpsHostHeader())
.build();
client.secure()
.send(request)
.toMono()
.block()
.let {
it!!.status() shouldBe (OK)
it.bodyAs(UTF_8) shouldBe ("Hello, from secure server!")
}
}
}
val client: StyxHttpClient = StyxHttpClient.Builder().build()
val styxServer = StyxServerProvider("""
proxy:
connectors:
http:
port: 0
https:
port: 0
sslProvider: JDK
sessionTimeoutMillis: 300000
sessionCacheSize: 20000
admin:
connectors:
http:
port: 0
httpPipeline:
type: InterceptorPipeline
config:
handler:
type: ConditionRouter
config:
routes:
- condition: protocol() == "https"
destination:
name: proxy-to-https
type: StaticResponseHandler
config:
status: 200
content: "Hello, from secure server!"
fallback:
type: StaticResponseHandler
config:
status: 200
content: "Hello, from http server!"
""".trimIndent())
override fun beforeSpec(spec: Spec) {
styxServer.restart()
}
override fun afterSpec(spec: Spec) {
styxServer.stop()
}
}
| system-tests/ft-suite/src/test/kotlin/com/hotels/styx/routing/ConditionRoutingSpec.kt | 231522245 |
/*
* The MIT License (MIT)
*
* Copyright (c) 2017-2019 Nephy Project Team
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
@file:Suppress("UNUSED", "PublicApiImplicitType", "KDocMissingDocumentation")
package jp.nephy.penicillin.models
import jp.nephy.jsonkt.JsonObject
import jp.nephy.jsonkt.delegation.string
import jp.nephy.penicillin.core.session.ApiClient
data class Card(override val json: JsonObject, override val client: ApiClient): PenicillinModel {
val cardUri by string("card_uri")
val status by string
}
| src/main/kotlin/jp/nephy/penicillin/models/Card.kt | 1227293152 |
/*
* The MIT License (MIT)
*
* Copyright (c) 2017-2019 Nephy Project Team
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
@file:Suppress("UNUSED")
package jp.nephy.penicillin.core.session.config
import jp.nephy.penicillin.core.session.ApiClientDsl
import jp.nephy.penicillin.core.session.SessionBuilder
import kotlinx.coroutines.Dispatchers
import kotlin.coroutines.CoroutineContext
/**
* Configures [DispatcherConfig].
*/
@ApiClientDsl
fun SessionBuilder.dispatcher(block: DispatcherConfig.Builder.() -> Unit) {
getOrPutBuilder {
DispatcherConfig.Builder()
}.apply(block)
}
internal fun SessionBuilder.createDispatcherConfig(): DispatcherConfig {
return getOrPutBuilder {
DispatcherConfig.Builder()
}.build()
}
/**
* Represents dispatcher config.
*/
data class DispatcherConfig(
/**
* The coroutine content.
*/
val coroutineContext: CoroutineContext,
/**
* Connection threads counts, or null.
*/
val connectionThreadsCount: Int?,
/**
* If true, coroutineContent should close when session disposes.
*/
val shouldClose: Boolean
): SessionConfig {
/**
* Dispatcher config builder.
*/
class Builder: SessionConfigBuilder<DispatcherConfig> {
/**
* Connection threads count, or null.
*/
@Suppress("MemberVisibilityCanBePrivate")
var connectionThreadsCount: Int? = null
set(value) {
if (value != null) {
require(value <= 0)
}
field = value
}
/**
* The coroutine context.
*/
@Suppress("MemberVisibilityCanBePrivate")
var coroutineContext: CoroutineContext = Dispatchers.Default
/**
* If true, coroutineContent should close when session disposes.
*/
var shouldClose: Boolean = false
override fun build(): DispatcherConfig {
return DispatcherConfig(coroutineContext, connectionThreadsCount, shouldClose)
}
}
}
/**
* Sets shouldClose to true.
* CoroutineContent should close when session disposes.
*/
fun DispatcherConfig.Builder.shouldClose() {
shouldClose = true
}
| src/main/kotlin/jp/nephy/penicillin/core/session/config/DispatcherConfig.kt | 1875856237 |
/*
* Copyright (c) 2018. Faruk Toptaş
*
* 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 me.toptas.fancyshowcasesample
import android.os.Bundle
import android.view.View
import java.util.ArrayList
import kotlinx.android.synthetic.main.activity_recycler_view.*
import me.toptas.fancyshowcase.FancyShowCaseView
import android.os.Build
import android.view.ViewTreeObserver
import androidx.recyclerview.widget.LinearLayoutManager
class RecyclerViewActivity : BaseActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_recycler_view)
val modelList = ArrayList<MyModel>()
for (i in 0..24) {
modelList.add(MyModel("Item $i"))
}
val layoutManager = LinearLayoutManager(this)
val adapter = MyRecyclerViewAdapter(modelList)
adapter.setClickListener(View.OnClickListener { v ->
focus(v)
})
recyclerView.adapter = adapter
recyclerView.layoutManager = layoutManager
recyclerView.viewTreeObserver.addOnGlobalLayoutListener(object : ViewTreeObserver.OnGlobalLayoutListener {
override fun onGlobalLayout() {
val width = recyclerView.width
val height = recyclerView.height
if (width > 0 && height > 0) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
recyclerView.viewTreeObserver.removeOnGlobalLayoutListener(this)
} else {
recyclerView.viewTreeObserver.removeGlobalOnLayoutListener(this)
}
}
focus(layoutManager.findViewByPosition(2)!!.findViewById(R.id.ivIcon))
}
})
}
private fun focus(v: View) {
FancyShowCaseView.Builder(this@RecyclerViewActivity)
.focusOn(v)
.title("Focus RecyclerView Items")
.enableAutoTextPosition()
.build()
.show()
}
}
| app/src/main/java/me/toptas/fancyshowcasesample/RecyclerViewActivity.kt | 3084492075 |
package com.joba.barebone.example.di
import android.app.Activity
import com.joba.barebone.app.AndroidApplication
import com.joba.barebone.app.annotations.PerActivity
import com.joba.barebone.app.di.ActivityComponent
import com.joba.barebone.app.di.ActivityModule
import com.joba.barebone.app.di.AppComponent
import com.joba.barebone.example.ui.MainActivity
import dagger.Component
/**
* Dagger component for main activity.
*/
@PerActivity
@Component(dependencies = arrayOf(AppComponent::class), modules = arrayOf(ActivityModule::class, MainActivityModule::class))
interface MainActivityComponent: ActivityComponent {
fun inject(mainActivity: MainActivity)
companion object {
fun init(activity: Activity): MainActivityComponent {
return DaggerMainActivityComponent.builder()
.appComponent(AndroidApplication.instance.appComponent)
.activityModule(ActivityModule(activity))
.mainActivityModule(MainActivityModule())
.build()
}
}
} | app/src/main/kotlin/com/joba/barebone/example/di/MainActivityComponent.kt | 2399911185 |
package edu.kit.iti.formal.automation.smt
/*-
* #%L
* iec-symbex
* %%
* Copyright (C) 2017 Alexander Weigl
* %%
* This program isType free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program isType distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a clone of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
*/
import edu.kit.iti.formal.smt.*
import edu.kit.iti.formal.smv.EnumType
import edu.kit.iti.formal.smv.SMVType
import edu.kit.iti.formal.smv.SMVTypes
import edu.kit.iti.formal.smv.SMVWordType
import edu.kit.iti.formal.smv.ast.SLiteral
import java.math.BigInteger
/**
* Default translator for types from smv to smt. Uses bit vectors!
*
* @author Alexander Weigl
* @version 1 (15.10.17)
*/
class DefaultS2STranslator : S2SDataTypeTranslator {
override fun translate(datatype: SMVType): SExpr {
if (SMVTypes.BOOLEAN == datatype)
return SSymbol(SMTProgram.SMT_BOOLEAN)
if (datatype is SMVWordType) {
val width = datatype.width
val bv = SList()
bv.add(SSymbol("_"))
bv.add(SSymbol("BitVec"))
bv.add(SSymbol(width.toString()))
return bv
}
if (datatype is EnumType) {
return SExprFacade.parseExpr("(_ BitVec 16)")
}
throw IllegalArgumentException()
}
override fun translate(l: SLiteral): SExpr {
val dataType = l.dataType
when (dataType) {
SMVTypes.BOOLEAN ->
return SSymbol(if (l.value.toString().equals("TRUE", ignoreCase = true)) "true" else "false")
is SMVWordType -> {
val prefix = "#b"
val b = l.value as BigInteger
return SSymbol("#b" + twoComplement(b, dataType.width))
}
is EnumType -> {
val et = l.dataType as EnumType?
val value = l.value as String
val i = et!!.values.indexOf(value)
return SSymbol("#b" + twoComplement(BigInteger.valueOf(i.toLong()), 16))
}
SMVTypes.INT -> {
return SInteger(l.value as BigInteger)
}
else ->
throw IllegalArgumentException("Unsupported data type: ${l.dataType}")
}
}
companion object {
fun paddedString(length: Int, fill: Char, s: String): CharArray {
val sb = CharArray(Math.max(length, s.length))
var i = 0
while (i < length - s.length) {
sb[i] = fill
i++
}
var j = 0
while (j < s.length) {
sb[i] = s[j]
j++
i++
}
return sb
}
fun twoComplement(integer: BigInteger, bitLength: Int): String {
val pos = if (integer.signum() < 0) integer.negate() else integer
val binary = pos.toString(2)
val b = paddedString(bitLength, '0', binary)
if (integer.signum() < 0) {
//complement
for (i in b.indices) {
b[i] = if (b[i] == '1') '0' else '1'
}
//+1
for (i in b.indices.reversed()) {
b[i] = (if (b[i] == '1') '0' else '1').toChar()
if (b[i] == '1') {
break
}
}
}
return String(b)
}
}
}
| symbex/src/main/kotlin/edu/kit/iti/formal/automation/smt/DefaultS2STranslator.kt | 23525703 |
package com.jayrave.falkon.mapper
interface DataConsumer {
fun put(short: Short?)
fun put(int: Int?)
fun put(long: Long?)
fun put(float: Float?)
fun put(double: Double?)
fun put(string: String?)
fun put(blob: ByteArray?)
} | falkon-mapper/src/main/kotlin/com/jayrave/falkon/mapper/DataConsumer.kt | 419116342 |
/*
* Copyright 2018 Netflix, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.netflix.spinnaker.orca.q
import com.fasterxml.jackson.module.kotlin.convertValue
import com.netflix.spinnaker.orca.jackson.OrcaObjectMapper
import com.netflix.spinnaker.orca.pipeline.model.SyntheticStageOwner.STAGE_AFTER
import com.netflix.spinnaker.orca.pipeline.model.SyntheticStageOwner.STAGE_BEFORE
import com.netflix.spinnaker.q.Message
import org.assertj.core.api.Assertions.assertThat
import org.jetbrains.spek.api.Spek
import org.jetbrains.spek.api.dsl.describe
import org.jetbrains.spek.api.dsl.given
import org.jetbrains.spek.api.dsl.it
import org.jetbrains.spek.api.dsl.on
import java.util.UUID
internal object MessageCompatibilityTest : Spek({
describe("deserializing ContinueParentStage") {
val mapper = OrcaObjectMapper.newInstance().apply {
registerSubtypes(ContinueParentStage::class.java)
}
val json = mapOf(
"kind" to "continueParentStage",
"executionType" to "PIPELINE",
"executionId" to UUID.randomUUID().toString(),
"application" to "covfefe",
"stageId" to UUID.randomUUID().toString()
)
given("an older message with no syntheticStageOwner") {
on("deserializing the JSON") {
val message = mapper.convertValue<Message>(json)
it("doesn't blow up") {
assertThat(message).isInstanceOf(ContinueParentStage::class.java)
}
it("defaults the missing field") {
assertThat((message as ContinueParentStage).phase).isEqualTo(STAGE_BEFORE)
}
}
}
given("a newer message with a syntheticStageOwner") {
val newJson = json + mapOf("phase" to "STAGE_AFTER")
on("deserializing the JSON") {
val message = mapper.convertValue<Message>(newJson)
it("doesn't blow up") {
assertThat(message).isInstanceOf(ContinueParentStage::class.java)
}
it("deserializes the new field") {
assertThat((message as ContinueParentStage).phase).isEqualTo(STAGE_AFTER)
}
}
}
}
})
| orca-queue/src/test/kotlin/com/netflix/spinnaker/orca/q/MessageCompatibilityTest.kt | 1405294917 |
/*
* Copyright (c) 2018 Regents of the University of Minnesota.
*
* 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 edu.umn.biomedicus.sh
import edu.umn.biomedicus.annotations.Setting
import edu.umn.biomedicus.common.SequenceDetector
import edu.umn.biomedicus.dependencies
import edu.umn.biomedicus.framework.TagEx
import edu.umn.biomedicus.framework.TagExFactory
import edu.umn.biomedicus.parsing.findHead
import edu.umn.biomedicus.sentences.Sentence
import edu.umn.biomedicus.time.TemporalPhrase
import edu.umn.biomedicus.tokenization.ParseToken
import edu.umn.biomedicus.tokenization.Token
import edu.umn.nlpengine.*
import java.io.File
import java.nio.file.Path
import javax.inject.Inject
import javax.inject.Singleton
/**
* The verb that is a head for nicotine social history information.
*/
@LabelMetadata(classpath = "biomedicus.v2", distinct = true)
data class NicotineRelevant(
override val startIndex: Int,
override val endIndex: Int
) : Label() {
constructor(textRange: TextRange) : this(textRange.startIndex, textRange.endIndex)
}
/**
* The unit of a nicotine usage measurement, used in [NicotineAmount] detection.
* E.g. cigarettes, packs, tins.
*/
@LabelMetadata(classpath = "biomedicus.v2", distinct = true)
data class NicotineUnit(override val startIndex: Int, override val endIndex: Int) : Label()
/**
* The quantity and unit of a nicotine usage measurement. E.g. 1 - 5 packs
*/
@LabelMetadata(classpath = "biomedicus.v2", distinct = true)
data class NicotineAmount(override val startIndex: Int, override val endIndex: Int) : Label() {
constructor(textRange: TextRange) : this(textRange.startIndex, textRange.endIndex)
}
/**
* How often nicotine is used. E.g. daily, infrequently
*/
@LabelMetadata(classpath = "biomedicus.v2", distinct = true)
data class NicotineFrequency(override val startIndex: Int, override val endIndex: Int) : Label() {
constructor(textRange: TextRange) : this(textRange.startIndex, textRange.endIndex)
}
/**
* The time period nicotine usage occurs/occurred in or over. Includes phrases like
* "for thirty years" or "at night" or "weekend nights"
*/
@LabelMetadata(classpath = "biomedicus.v2", distinct = true)
data class NicotineTemporal(override val startIndex: Int, override val endIndex: Int) : Label() {
constructor(textRange: TextRange) : this(textRange.startIndex, textRange.endIndex)
}
/**
* The type of nicotine, cigarettes, chewing tobacco, etc.
*/
@LabelMetadata(classpath = "biomedicus.v2", distinct = true)
data class NicotineType(override val startIndex: Int, override val endIndex: Int) : Label()
/**
* A word that indicates whether usage is ongoing or has ceased.
*/
@LabelMetadata(classpath = "biomedicus.v2", distinct = true)
data class NicotineStatus(override val startIndex: Int, override val endIndex: Int) : Label() {
constructor(textRange: TextRange) : this(textRange.startIndex, textRange.endIndex)
}
/**
* The method how nicotine usage occurred. E.g. smoked, chewed, etc.
*/
@LabelMetadata(classpath = "biomedicus.v2", distinct = true)
data class NicotineMethod(override val startIndex: Int, override val endIndex: Int) : Label() {
constructor(textRange: TextRange) : this(textRange.startIndex, textRange.endIndex)
}
/**
* Detects [NicotineRelevant] labels from [NicotineCue] labels in text.
*/
class NicotineRelevantLabeler : DocumentTask {
override fun run(document: Document) {
val relevants = document.findRelevantAncestors(document.labelIndex<NicotineCue>())
.map { NicotineRelevant(it) }
document.labelAll(relevants)
}
}
/**
* Detects if a phrase is a nicotine dependant phrase by seeing if it is, or has a
* [NicotineRelevant] ancestor
*/
internal fun Document.isNicotineDep(textRange: TextRange): Boolean {
val insideSpan = dependencies().inside(textRange)
val nicotineRelevants = labelIndex<NicotineRelevant>()
val alcoholRelevants = labelIndex<AlcoholRelevant>()
val drugRelevants = labelIndex<DrugRelevant>()
val phraseRoot = findHead(insideSpan)
phraseRoot.selfAndParentIterator().forEach {
if (nicotineRelevants.containsSpan(it)) return true
if (alcoholRelevants.containsSpan(it) || drugRelevants.containsSpan(it)) return false
}
return false
}
/**
* The model for nicotine amount units.
*/
@Singleton
class NicotineAmountUnits(
val detector: SequenceDetector<String, Token>
) {
@Inject internal constructor(
@Setting("sh.nicotine.amountUnits.asDataPath") path: Path
) : this(SequenceDetector.loadFromFile(path) { a, b: Token ->
b.text.startsWith(a, true)
})
}
/**
* Detects and labels [NicotineUnit] instances.
*/
class NicotineUnitDetector(
private val detector: SequenceDetector<String, Token>
) : DocumentTask {
@Inject internal constructor(amountUnits: NicotineAmountUnits) : this(amountUnits.detector)
override fun run(document: Document) {
val sentences = document.labelIndex<Sentence>()
val tokens = document.labelIndex<ParseToken>()
val candidates = document.labelIndex<NicotineCandidate>()
val labeler = document.labeler<NicotineUnit>()
candidates
.map { sentences.inside(it) }
.forEach {
it.map { tokens.inside(it).asList() }
.forEach { sentenceTokens ->
detector.detectAll(sentenceTokens).forEach {
val unit = NicotineUnit(
sentenceTokens[it.first].startIndex,
sentenceTokens[it.last].endIndex
)
if (document.isNicotineDep(unit)) labeler.add(unit)
}
}
}
}
}
/**
* The TagEx search expression for nicotine amounts.
*
* @property expr the nicotine amount TagEx search expression
*/
@Singleton
class NicotineAmountSearchExpr(val expr: TagEx) {
@Inject internal constructor(
searchExprFactory: TagExFactory,
@Setting("sh.nicotine.amountExpr.asDataPath") path: Path
) : this(searchExprFactory.parse(path.toFile().readText()))
}
/**
* Detects and labels instances of [NicotineAmount] in text using the nicotine amount TagEx pattern.
*
* @property expr the nicotine amount TagEx search expression
*/
class NicotineAmountDetector(private val expr: TagEx) : DocumentTask {
@Inject internal constructor(
nicotineAmountSearchExpr: NicotineAmountSearchExpr
) : this(nicotineAmountSearchExpr.expr)
override fun run(document: Document) {
val labeler = document.labeler<NicotineAmount>()
document.labelIndex<NicotineCandidate>()
.asSequence()
.flatMap { expr.findAll(document, it) }
.filter(document::isNicotineDep)
.map(::NicotineAmount)
.forEach(labeler::add)
}
}
/**
* Detects and labels [NicotineFrequency] instances in text using the general [UsageFrequency]
* label.
*/
class NicotineFrequencyDetector : DocumentTask {
override fun run(document: Document) {
val nicotineCandidates = document.labelIndex<NicotineCandidate>()
val amounts = document.labelIndex<NicotineAmount>()
val usageFrequencies = document.labelIndex<UsageFrequency>()
val labeler = document.labeler<NicotineFrequency>()
for (nicotineCandidate in nicotineCandidates) {
usageFrequencies
.inside(nicotineCandidate)
.asSequence()
.filter { amounts.containing(it).isEmpty() }
.filter { document.isNicotineDep(it) }
.map { NicotineFrequency(it) }
.forEach { labeler.add(it) }
}
}
}
/**
* Detects and labels [NicotineTemporal] instances in text using the general [TemporalPhrase].
*/
class NicotineTemporalDetector : DocumentTask {
override fun run(document: Document) {
val nicotineCandidates = document.labelIndex<NicotineCandidate>()
val frequencies = document.labelIndex<NicotineFrequency>()
val amounts = document.labelIndex<NicotineAmount>()
val temporalPhrases = document.labelIndex<TemporalPhrase>()
val temporalLabeler = document.labeler<NicotineTemporal>()
for (nicotineCandidate in nicotineCandidates) {
temporalPhrases.inside(nicotineCandidate)
.asSequence()
.filter { amounts.containing(it).isEmpty() }
.filter { frequencies.containing(it).isEmpty() }
.filter { document.isNicotineDep(it) }
.forEach { temporalLabeler.add(NicotineTemporal(it)) }
}
}
}
/**
* The model for nicotine types.
*/
@Singleton
class NicotineTypes(val detector: SequenceDetector<String, Token>) {
@Inject internal constructor(
@Setting("sh.nicotine.types.asDataPath") path: Path
) : this(SequenceDetector.loadFromFile(path, tokenTextEquals))
}
/**
* Detects and labels [NicotineType] instances in text using the nicotine types model.
*/
class NicotineTypeDetector(
private val detector: SequenceDetector<String, Token>
) : DocumentTask {
@Inject internal constructor(nicotineTypes: NicotineTypes) : this(nicotineTypes.detector)
override fun run(document: Document) {
val candidates = document.labelIndex<NicotineCandidate>()
val tokens = document.labelIndex<ParseToken>()
val labeler = document.labeler<NicotineType>()
candidates
.map { tokens.inside(it).asList() }
.forEach { candidateTokens ->
detector.detectAll(candidateTokens)
.forEach {
val type = NicotineType(
candidateTokens[it.first].startIndex,
candidateTokens[it.last].endIndex
)
if (document.isNicotineDep(type)) labeler.add(type)
}
}
}
}
/**
* Model for nicotine status phrases.
*/
@Singleton
class NicotineStatusPhrases(val detector: SequenceDetector<String, ParseToken>) {
@Inject internal constructor(
@Setting("sh.nicotine.statusPhrases.asDataPath") path: Path
) : this(SequenceDetector.loadFromFile(path) { string, token: ParseToken ->
token.text.compareTo(string, true) == 0
})
}
/**
* Detects nicotine status phrases in text using the nicotine status model and the general
* [UsageStatusPhrases]
*/
class NicotineStatusDetector(
private val detector: SequenceDetector<String, ParseToken>
) : DocumentTask {
@Inject internal constructor(
statusPhrases: NicotineStatusPhrases
) : this(statusPhrases.detector)
override fun run(document: Document) {
val tokens = document.labelIndex<ParseToken>()
val usageStatuses = document.labelIndex<UsageStatus>()
val labeler = document.labeler<NicotineStatus>()
document.labelIndex<NicotineCandidate>()
.onEach {
usageStatuses.inside(it)
.filter { document.isNicotineDep(it) }
.forEach {
labeler.add(NicotineStatus(it))
}
}
.map { tokens.inside(it).asList() }
.forEach { sentenceTokens ->
detector.detectAll(sentenceTokens).forEach {
val status = NicotineStatus(sentenceTokens[it.first].startIndex,
sentenceTokens[it.last].endIndex)
if (document.isNicotineDep(status)) labeler.add(status)
}
}
}
}
/**
* Nicotine methods model.
*/
@Singleton
class NicotineMethodPhrases(val detector: SequenceDetector<String, ParseToken>) {
@Inject internal constructor(
@Setting("sh.nicotine.methodPhrases.asDataPath") path: Path
) : this(SequenceDetector.loadFromFile(path) { string, token: ParseToken ->
token.text.compareTo(string, true) == 0
})
}
/**
* Detects and labels instances of [NicotineMethod] in text using the [GenericMethodPhrase]
* instances and the nicotine methods model.
*/
class NicotineMethodDetector(
private val detector: SequenceDetector<String, ParseToken>
) : DocumentTask {
@Inject internal constructor(phrases: NicotineMethodPhrases) : this(phrases.detector)
override fun run(document: Document) {
val candidates = document.labelIndex<NicotineCandidate>()
val tokens = document.labelIndex<ParseToken>()
val genericMethods = document.labelIndex<GenericMethodPhrase>()
val labeler = document.labeler<NicotineMethod>()
candidates
.onEach {
genericMethods
.inside(it)
.filter { document.isNicotineDep(it) }
.forEach {
labeler.add(NicotineMethod(it))
}
}
.map { tokens.inside(it).asList() }
.forEach { sentenceTokens ->
detector.detectAll(sentenceTokens)
.map {
NicotineMethod(sentenceTokens[it.first].startIndex,
sentenceTokens[it.last].endIndex)
}
.filter { document.isNicotineDep(it) }
.forEach {
labeler.add(it)
}
}
}
}
| biomedicus-core/src/main/kotlin/edu/umn/biomedicus/sh/Nicotine.kt | 2618503638 |
import java.util.Scanner
/**
* Created by Lazysoul on 2017. 7. 18..
*/
object DigitalRoot {
@JvmStatic
fun main(args: Array<String>) {
val sc = Scanner(System.`in`)
val result = getResult(sc, listOf())
require(result == listOf(6, 3))
}
tailrec fun getResult(sc: Scanner, acc: List<Int>): List<Int> {
val value = sc.nextLine()
return when (value) {
"0" -> acc
else -> getResult(sc, acc.plus(getDigitalRoot(value)))
}
}
tailrec fun getDigitalRoot(value: String): Int {
return if (value.length == 1) {
value.toInt()
} else {
getDigitalRoot(value
.map { it.toInt() - 48 }
.reduce { x, y -> x + y }
.toString())
}
}
} | kotlin/src/main/kotlin/DigitalRoot.kt | 2512020216 |
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.react
import com.android.build.gradle.AppExtension
import com.android.build.gradle.BaseExtension
import com.android.build.gradle.LibraryExtension
import com.android.build.gradle.internal.tasks.factory.dependsOn
import com.facebook.react.tasks.BuildCodegenCLITask
import com.facebook.react.tasks.GenerateCodegenArtifactsTask
import com.facebook.react.tasks.GenerateCodegenSchemaTask
import com.facebook.react.utils.JsonUtils
import com.facebook.react.utils.findPackageJsonFile
import java.io.File
import kotlin.system.exitProcess
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.Task
import org.gradle.internal.jvm.Jvm
class ReactPlugin : Plugin<Project> {
override fun apply(project: Project) {
checkJvmVersion(project)
val extension = project.extensions.create("react", ReactExtension::class.java, project)
applyAppPlugin(project, extension)
applyCodegenPlugin(project, extension)
}
private fun checkJvmVersion(project: Project) {
val jvmVersion = Jvm.current()?.javaVersion?.majorVersion
if ((jvmVersion?.toIntOrNull() ?: 0) <= 8) {
project.logger.error(
"""
********************************************************************************
ERROR: requires JDK11 or higher.
Incompatible major version detected: '$jvmVersion'
********************************************************************************
""".trimIndent())
exitProcess(1)
}
}
private fun applyAppPlugin(project: Project, config: ReactExtension) {
project.afterEvaluate {
if (config.applyAppPlugin.getOrElse(false)) {
val androidConfiguration = project.extensions.getByType(BaseExtension::class.java)
project.configureDevPorts(androidConfiguration)
val isAndroidLibrary = project.plugins.hasPlugin("com.android.library")
val variants =
if (isAndroidLibrary) {
project.extensions.getByType(LibraryExtension::class.java).libraryVariants
} else {
project.extensions.getByType(AppExtension::class.java).applicationVariants
}
variants.all { project.configureReactTasks(variant = it, config = config) }
}
}
}
/**
* A plugin to enable react-native-codegen in Gradle environment. See the Gradle API docs for more
* information: https://docs.gradle.org/current/javadoc/org/gradle/api/Project.html
*/
private fun applyCodegenPlugin(project: Project, extension: ReactExtension) {
// First, we set up the output dir for the codegen.
val generatedSrcDir = File(project.buildDir, "generated/source/codegen")
val buildCodegenTask =
project.tasks.register("buildCodegenCLI", BuildCodegenCLITask::class.java) {
it.codegenDir.set(extension.codegenDir)
val bashWindowsHome = project.findProperty("REACT_WINDOWS_BASH") as String?
it.bashWindowsHome.set(bashWindowsHome)
}
// We create the task to produce schema from JS files.
val generateCodegenSchemaTask =
project.tasks.register(
"generateCodegenSchemaFromJavaScript", GenerateCodegenSchemaTask::class.java) { it ->
it.dependsOn(buildCodegenTask)
it.nodeExecutableAndArgs.set(extension.nodeExecutableAndArgs)
it.codegenDir.set(extension.codegenDir)
it.generatedSrcDir.set(generatedSrcDir)
// We're reading the package.json at configuration time to properly feed
// the `jsRootDir` @Input property of this task. Therefore, the
// parsePackageJson should be invoked inside this lambda.
val packageJson = findPackageJsonFile(project, extension)
val parsedPackageJson = packageJson?.let { JsonUtils.fromCodegenJson(it) }
val jsSrcsDirInPackageJson = parsedPackageJson?.codegenConfig?.jsSrcsDir
if (jsSrcsDirInPackageJson != null) {
it.jsRootDir.set(File(packageJson.parentFile, jsSrcsDirInPackageJson))
} else {
it.jsRootDir.set(extension.jsRootDir)
}
}
// We create the task to generate Java code from schema.
val generateCodegenArtifactsTask =
project.tasks.register(
"generateCodegenArtifactsFromSchema", GenerateCodegenArtifactsTask::class.java) {
it.dependsOn(generateCodegenSchemaTask)
it.reactNativeDir.set(extension.reactNativeDir)
it.deprecatedReactRoot.set(extension.reactRoot)
it.nodeExecutableAndArgs.set(extension.nodeExecutableAndArgs)
it.codegenDir.set(extension.codegenDir)
it.generatedSrcDir.set(generatedSrcDir)
it.packageJsonFile.set(findPackageJsonFile(project, extension))
it.codegenJavaPackageName.set(extension.codegenJavaPackageName)
it.libraryName.set(extension.libraryName)
}
// We add dependencies & generated sources to the project.
// Note: This last step needs to happen after the project has been evaluated.
project.afterEvaluate {
// `preBuild` is one of the base tasks automatically registered by Gradle.
// This will invoke the codegen before compiling the entire project.
project.tasks.named("preBuild", Task::class.java).dependsOn(generateCodegenArtifactsTask)
/**
* Finally, update the android configuration to include the generated sources. This equivalent
* to this DSL:
*
* android { sourceSets { main { java { srcDirs += "$generatedSrcDir/java" } } } }
*
* See documentation at
* https://google.github.io/android-gradle-dsl/current/com.android.build.gradle.BaseExtension.html.
*/
val android = project.extensions.getByName("android") as BaseExtension
android.sourceSets.getByName("main").java.srcDir(File(generatedSrcDir, "java"))
}
}
}
| packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactPlugin.kt | 2449415254 |
package actor.proto.mailbox
import java.util.*
import java.util.concurrent.atomic.AtomicInteger
private val emptyStats = arrayOf<MailboxStatistics>()
typealias MailboxQueue = Queue<Any>
class DefaultMailbox(private val systemMessages: MailboxQueue,
private val userMailbox: MailboxQueue,
private val stats: Array<MailboxStatistics> = emptyStats) : Mailbox {
private val status = AtomicInteger(MailboxStatus.IDLE)
private val sysCount = AtomicInteger(0)
private val userCount = AtomicInteger(0)
private lateinit var dispatcher: Dispatcher
private lateinit var invoker: MessageInvoker
private var suspended: Boolean = false
fun status(): Int = status.get()
override fun postUserMessage(msg: Any) {
if (userMailbox.offer(msg)) {
userCount.incrementAndGet()
schedule()
for (stats in stats) stats.messagePosted(msg)
} else {
for (stats in stats) stats.messageDropped(msg)
}
}
override fun postSystemMessage(msg: Any) {
sysCount.incrementAndGet()
systemMessages.add(msg)
for (stats in stats) stats.messagePosted(msg)
schedule()
}
override fun registerHandlers(invoker: MessageInvoker, dispatcher: Dispatcher) {
this.invoker = invoker
this.dispatcher = dispatcher
}
override fun start() {
for (stats in stats) stats.mailboxStarted()
}
override suspend fun run() {
var msg: Any? = null
try {
for (i in 0 until dispatcher.throughput) {
if (sysCount.get() > 0) {
msg = systemMessages.poll()
sysCount.decrementAndGet()
if (msg != null) {
when (msg) {
is SuspendMailbox -> suspended = true
is ResumeMailbox -> suspended = false
}
invoker.invokeSystemMessage(msg as SystemMessage)
for (stat in stats) stat.messageReceived(msg)
}
}
if (!suspended && userCount.get() > 0) {
msg = userMailbox.poll()
userCount.decrementAndGet()
if (msg == null) break
else {
invoker.invokeUserMessage(msg)
for (stat in stats) stat.messageReceived(msg)
}
} else {
break
}
}
} catch (e: Exception) {
if (msg != null) invoker.escalateFailure(e, msg)
}
status.set(MailboxStatus.IDLE)
if (sysCount.get() > 0 || (!suspended && userCount.get() > 0)) {
schedule()
} else {
for (stat in stats) stat.mailboxEmpty()
}
}
private fun schedule() {
val wasIdle = status.compareAndSet(MailboxStatus.IDLE, MailboxStatus.BUSY)
if (wasIdle) {
dispatcher.schedule(this)
}
}
}
| proto-mailbox/src/main/kotlin/actor/proto/mailbox/DefaultMailbox.kt | 2070342882 |
/*
* Copyright (c) 2020 Giorgio Antonioli
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.fondesa.recyclerviewdivider
import android.content.Context
import android.content.res.TypedArray
import org.junit.Assert.assertEquals
import org.junit.Test
import org.mockito.kotlin.doReturn
import org.mockito.kotlin.mock
import org.mockito.kotlin.verify
/**
* Tests of WithAttribute.kt file.
*/
class WithAttributeKtTest {
@Test
fun `withAttribute - returns resolved attribute and recycles TypedArray`() {
val typedArray = mock<TypedArray>()
val context = mock<Context> {
on(it.obtainStyledAttributes(intArrayOf(5))) doReturn typedArray
}
val result = context.withAttribute(5) { "resolved" }
verify(typedArray).recycle()
assertEquals("resolved", result)
}
}
| recycler-view-divider/src/test/kotlin/com/fondesa/recyclerviewdivider/WithAttributeKtTest.kt | 633065185 |
package com.fuyoul.sanwenseller.bean.reshttp
/**
* @author: chen
* @CreatDate: 2017\11\4 0004
* @Desc:
*/
class ResQuickTestCount {
// {
//
// "date":0,
// "maxOrdersCount":0,
// "masterId":0,
// "allowableOrdersCount":0
// }
var isChanged: Int = 0
var date: String = ""
var maxOrdersCount = 0
var masterId: Long = 0
var restOrdersCount = 0
} | app/src/main/java/com/fuyoul/sanwenseller/bean/reshttp/ResQuickTestCount.kt | 3667233571 |
@file:JvmName("Sdk28ViewsKt")
package org.jetbrains.anko
import org.jetbrains.anko.custom.*
import org.jetbrains.anko.AnkoViewDslMarker
import android.view.ViewManager
import android.view.ViewGroup.LayoutParams
import android.app.Activity
import android.app.Fragment
import android.content.Context
import android.os.Build
import android.widget.*
@PublishedApi
internal object `$$Anko$Factories$Sdk28View` {
val MEDIA_ROUTE_BUTTON = { ctx: Context -> android.app.MediaRouteButton(ctx) }
val GESTURE_OVERLAY_VIEW = { ctx: Context -> android.gesture.GestureOverlayView(ctx) }
val EXTRACT_EDIT_TEXT = { ctx: Context -> android.inputmethodservice.ExtractEditText(ctx) }
val TV_VIEW = { ctx: Context -> android.media.tv.TvView(ctx) }
val G_L_SURFACE_VIEW = { ctx: Context -> android.opengl.GLSurfaceView(ctx) }
val SURFACE_VIEW = { ctx: Context -> android.view.SurfaceView(ctx) }
val TEXTURE_VIEW = { ctx: Context -> android.view.TextureView(ctx) }
val VIEW = { ctx: Context -> android.view.View(ctx) }
val VIEW_STUB = { ctx: Context -> android.view.ViewStub(ctx) }
val WEB_VIEW = { ctx: Context -> android.webkit.WebView(ctx) }
val ADAPTER_VIEW_FLIPPER = { ctx: Context -> android.widget.AdapterViewFlipper(ctx) }
val ANALOG_CLOCK = { ctx: Context -> android.widget.AnalogClock(ctx) }
val AUTO_COMPLETE_TEXT_VIEW = { ctx: Context -> android.widget.AutoCompleteTextView(ctx) }
val BUTTON = { ctx: Context -> android.widget.Button(ctx) }
val CALENDAR_VIEW = { ctx: Context -> android.widget.CalendarView(ctx) }
val CHECK_BOX = { ctx: Context -> android.widget.CheckBox(ctx) }
val CHECKED_TEXT_VIEW = { ctx: Context -> android.widget.CheckedTextView(ctx) }
val CHRONOMETER = { ctx: Context -> android.widget.Chronometer(ctx) }
val DATE_PICKER = { ctx: Context -> android.widget.DatePicker(ctx) }
val DIALER_FILTER = { ctx: Context -> android.widget.DialerFilter(ctx) }
val DIGITAL_CLOCK = { ctx: Context -> android.widget.DigitalClock(ctx) }
val EDIT_TEXT = { ctx: Context -> android.widget.EditText(ctx) }
val EXPANDABLE_LIST_VIEW = { ctx: Context -> android.widget.ExpandableListView(ctx) }
val IMAGE_BUTTON = { ctx: Context -> android.widget.ImageButton(ctx) }
val IMAGE_VIEW = { ctx: Context -> android.widget.ImageView(ctx) }
val LIST_VIEW = { ctx: Context -> android.widget.ListView(ctx) }
val MULTI_AUTO_COMPLETE_TEXT_VIEW = { ctx: Context -> android.widget.MultiAutoCompleteTextView(ctx) }
val NUMBER_PICKER = { ctx: Context -> android.widget.NumberPicker(ctx) }
val PROGRESS_BAR = { ctx: Context -> android.widget.ProgressBar(ctx) }
val QUICK_CONTACT_BADGE = { ctx: Context -> android.widget.QuickContactBadge(ctx) }
val RADIO_BUTTON = { ctx: Context -> android.widget.RadioButton(ctx) }
val RATING_BAR = { ctx: Context -> android.widget.RatingBar(ctx) }
val SEARCH_VIEW = { ctx: Context -> android.widget.SearchView(ctx) }
val SEEK_BAR = { ctx: Context -> android.widget.SeekBar(ctx) }
val SLIDING_DRAWER = { ctx: Context -> android.widget.SlidingDrawer(ctx, null) }
val SPACE = { ctx: Context -> android.widget.Space(ctx) }
val SPINNER = { ctx: Context -> android.widget.Spinner(ctx) }
val STACK_VIEW = { ctx: Context -> android.widget.StackView(ctx) }
val SWITCH = { ctx: Context -> android.widget.Switch(ctx) }
val TAB_HOST = { ctx: Context -> android.widget.TabHost(ctx) }
val TAB_WIDGET = { ctx: Context -> android.widget.TabWidget(ctx) }
val TEXT_CLOCK = { ctx: Context -> android.widget.TextClock(ctx) }
val TEXT_VIEW = { ctx: Context -> android.widget.TextView(ctx) }
val TIME_PICKER = { ctx: Context -> android.widget.TimePicker(ctx) }
val TOGGLE_BUTTON = { ctx: Context -> android.widget.ToggleButton(ctx) }
val TWO_LINE_LIST_ITEM = { ctx: Context -> android.widget.TwoLineListItem(ctx) }
val VIDEO_VIEW = { ctx: Context -> android.widget.VideoView(ctx) }
val VIEW_FLIPPER = { ctx: Context -> android.widget.ViewFlipper(ctx) }
val ZOOM_BUTTON = { ctx: Context -> android.widget.ZoomButton(ctx) }
val ZOOM_CONTROLS = { ctx: Context -> android.widget.ZoomControls(ctx) }
}
inline fun ViewManager.mediaRouteButton(): android.app.MediaRouteButton = mediaRouteButton() {}
inline fun ViewManager.mediaRouteButton(init: (@AnkoViewDslMarker android.app.MediaRouteButton).() -> Unit): android.app.MediaRouteButton {
return ankoView(`$$Anko$Factories$Sdk28View`.MEDIA_ROUTE_BUTTON, theme = 0) { init() }
}
inline fun ViewManager.themedMediaRouteButton(theme: Int = 0): android.app.MediaRouteButton = themedMediaRouteButton(theme) {}
inline fun ViewManager.themedMediaRouteButton(theme: Int = 0, init: (@AnkoViewDslMarker android.app.MediaRouteButton).() -> Unit): android.app.MediaRouteButton {
return ankoView(`$$Anko$Factories$Sdk28View`.MEDIA_ROUTE_BUTTON, theme) { init() }
}
inline fun ViewManager.gestureOverlayView(): android.gesture.GestureOverlayView = gestureOverlayView() {}
inline fun ViewManager.gestureOverlayView(init: (@AnkoViewDslMarker android.gesture.GestureOverlayView).() -> Unit): android.gesture.GestureOverlayView {
return ankoView(`$$Anko$Factories$Sdk28View`.GESTURE_OVERLAY_VIEW, theme = 0) { init() }
}
inline fun ViewManager.themedGestureOverlayView(theme: Int = 0): android.gesture.GestureOverlayView = themedGestureOverlayView(theme) {}
inline fun ViewManager.themedGestureOverlayView(theme: Int = 0, init: (@AnkoViewDslMarker android.gesture.GestureOverlayView).() -> Unit): android.gesture.GestureOverlayView {
return ankoView(`$$Anko$Factories$Sdk28View`.GESTURE_OVERLAY_VIEW, theme) { init() }
}
inline fun Context.gestureOverlayView(): android.gesture.GestureOverlayView = gestureOverlayView() {}
inline fun Context.gestureOverlayView(init: (@AnkoViewDslMarker android.gesture.GestureOverlayView).() -> Unit): android.gesture.GestureOverlayView {
return ankoView(`$$Anko$Factories$Sdk28View`.GESTURE_OVERLAY_VIEW, theme = 0) { init() }
}
inline fun Context.themedGestureOverlayView(theme: Int = 0): android.gesture.GestureOverlayView = themedGestureOverlayView(theme) {}
inline fun Context.themedGestureOverlayView(theme: Int = 0, init: (@AnkoViewDslMarker android.gesture.GestureOverlayView).() -> Unit): android.gesture.GestureOverlayView {
return ankoView(`$$Anko$Factories$Sdk28View`.GESTURE_OVERLAY_VIEW, theme) { init() }
}
inline fun Activity.gestureOverlayView(): android.gesture.GestureOverlayView = gestureOverlayView() {}
inline fun Activity.gestureOverlayView(init: (@AnkoViewDslMarker android.gesture.GestureOverlayView).() -> Unit): android.gesture.GestureOverlayView {
return ankoView(`$$Anko$Factories$Sdk28View`.GESTURE_OVERLAY_VIEW, theme = 0) { init() }
}
inline fun Activity.themedGestureOverlayView(theme: Int = 0): android.gesture.GestureOverlayView = themedGestureOverlayView(theme) {}
inline fun Activity.themedGestureOverlayView(theme: Int = 0, init: (@AnkoViewDslMarker android.gesture.GestureOverlayView).() -> Unit): android.gesture.GestureOverlayView {
return ankoView(`$$Anko$Factories$Sdk28View`.GESTURE_OVERLAY_VIEW, theme) { init() }
}
inline fun ViewManager.extractEditText(): android.inputmethodservice.ExtractEditText = extractEditText() {}
inline fun ViewManager.extractEditText(init: (@AnkoViewDslMarker android.inputmethodservice.ExtractEditText).() -> Unit): android.inputmethodservice.ExtractEditText {
return ankoView(`$$Anko$Factories$Sdk28View`.EXTRACT_EDIT_TEXT, theme = 0) { init() }
}
inline fun ViewManager.themedExtractEditText(theme: Int = 0): android.inputmethodservice.ExtractEditText = themedExtractEditText(theme) {}
inline fun ViewManager.themedExtractEditText(theme: Int = 0, init: (@AnkoViewDslMarker android.inputmethodservice.ExtractEditText).() -> Unit): android.inputmethodservice.ExtractEditText {
return ankoView(`$$Anko$Factories$Sdk28View`.EXTRACT_EDIT_TEXT, theme) { init() }
}
inline fun ViewManager.tvView(): android.media.tv.TvView = tvView() {}
inline fun ViewManager.tvView(init: (@AnkoViewDslMarker android.media.tv.TvView).() -> Unit): android.media.tv.TvView {
return ankoView(`$$Anko$Factories$Sdk28View`.TV_VIEW, theme = 0) { init() }
}
inline fun ViewManager.themedTvView(theme: Int = 0): android.media.tv.TvView = themedTvView(theme) {}
inline fun ViewManager.themedTvView(theme: Int = 0, init: (@AnkoViewDslMarker android.media.tv.TvView).() -> Unit): android.media.tv.TvView {
return ankoView(`$$Anko$Factories$Sdk28View`.TV_VIEW, theme) { init() }
}
inline fun Context.tvView(): android.media.tv.TvView = tvView() {}
inline fun Context.tvView(init: (@AnkoViewDslMarker android.media.tv.TvView).() -> Unit): android.media.tv.TvView {
return ankoView(`$$Anko$Factories$Sdk28View`.TV_VIEW, theme = 0) { init() }
}
inline fun Context.themedTvView(theme: Int = 0): android.media.tv.TvView = themedTvView(theme) {}
inline fun Context.themedTvView(theme: Int = 0, init: (@AnkoViewDslMarker android.media.tv.TvView).() -> Unit): android.media.tv.TvView {
return ankoView(`$$Anko$Factories$Sdk28View`.TV_VIEW, theme) { init() }
}
inline fun Activity.tvView(): android.media.tv.TvView = tvView() {}
inline fun Activity.tvView(init: (@AnkoViewDslMarker android.media.tv.TvView).() -> Unit): android.media.tv.TvView {
return ankoView(`$$Anko$Factories$Sdk28View`.TV_VIEW, theme = 0) { init() }
}
inline fun Activity.themedTvView(theme: Int = 0): android.media.tv.TvView = themedTvView(theme) {}
inline fun Activity.themedTvView(theme: Int = 0, init: (@AnkoViewDslMarker android.media.tv.TvView).() -> Unit): android.media.tv.TvView {
return ankoView(`$$Anko$Factories$Sdk28View`.TV_VIEW, theme) { init() }
}
inline fun ViewManager.gLSurfaceView(): android.opengl.GLSurfaceView = gLSurfaceView() {}
inline fun ViewManager.gLSurfaceView(init: (@AnkoViewDslMarker android.opengl.GLSurfaceView).() -> Unit): android.opengl.GLSurfaceView {
return ankoView(`$$Anko$Factories$Sdk28View`.G_L_SURFACE_VIEW, theme = 0) { init() }
}
inline fun ViewManager.themedGLSurfaceView(theme: Int = 0): android.opengl.GLSurfaceView = themedGLSurfaceView(theme) {}
inline fun ViewManager.themedGLSurfaceView(theme: Int = 0, init: (@AnkoViewDslMarker android.opengl.GLSurfaceView).() -> Unit): android.opengl.GLSurfaceView {
return ankoView(`$$Anko$Factories$Sdk28View`.G_L_SURFACE_VIEW, theme) { init() }
}
inline fun ViewManager.surfaceView(): android.view.SurfaceView = surfaceView() {}
inline fun ViewManager.surfaceView(init: (@AnkoViewDslMarker android.view.SurfaceView).() -> Unit): android.view.SurfaceView {
return ankoView(`$$Anko$Factories$Sdk28View`.SURFACE_VIEW, theme = 0) { init() }
}
inline fun ViewManager.themedSurfaceView(theme: Int = 0): android.view.SurfaceView = themedSurfaceView(theme) {}
inline fun ViewManager.themedSurfaceView(theme: Int = 0, init: (@AnkoViewDslMarker android.view.SurfaceView).() -> Unit): android.view.SurfaceView {
return ankoView(`$$Anko$Factories$Sdk28View`.SURFACE_VIEW, theme) { init() }
}
inline fun ViewManager.textureView(): android.view.TextureView = textureView() {}
inline fun ViewManager.textureView(init: (@AnkoViewDslMarker android.view.TextureView).() -> Unit): android.view.TextureView {
return ankoView(`$$Anko$Factories$Sdk28View`.TEXTURE_VIEW, theme = 0) { init() }
}
inline fun ViewManager.themedTextureView(theme: Int = 0): android.view.TextureView = themedTextureView(theme) {}
inline fun ViewManager.themedTextureView(theme: Int = 0, init: (@AnkoViewDslMarker android.view.TextureView).() -> Unit): android.view.TextureView {
return ankoView(`$$Anko$Factories$Sdk28View`.TEXTURE_VIEW, theme) { init() }
}
inline fun ViewManager.view(): android.view.View = view() {}
inline fun ViewManager.view(init: (@AnkoViewDslMarker android.view.View).() -> Unit): android.view.View {
return ankoView(`$$Anko$Factories$Sdk28View`.VIEW, theme = 0) { init() }
}
inline fun ViewManager.themedView(theme: Int = 0): android.view.View = themedView(theme) {}
inline fun ViewManager.themedView(theme: Int = 0, init: (@AnkoViewDslMarker android.view.View).() -> Unit): android.view.View {
return ankoView(`$$Anko$Factories$Sdk28View`.VIEW, theme) { init() }
}
inline fun ViewManager.viewStub(): android.view.ViewStub = viewStub() {}
inline fun ViewManager.viewStub(init: (@AnkoViewDslMarker android.view.ViewStub).() -> Unit): android.view.ViewStub {
return ankoView(`$$Anko$Factories$Sdk28View`.VIEW_STUB, theme = 0) { init() }
}
inline fun ViewManager.themedViewStub(theme: Int = 0): android.view.ViewStub = themedViewStub(theme) {}
inline fun ViewManager.themedViewStub(theme: Int = 0, init: (@AnkoViewDslMarker android.view.ViewStub).() -> Unit): android.view.ViewStub {
return ankoView(`$$Anko$Factories$Sdk28View`.VIEW_STUB, theme) { init() }
}
inline fun ViewManager.webView(): android.webkit.WebView = webView() {}
inline fun ViewManager.webView(init: (@AnkoViewDslMarker android.webkit.WebView).() -> Unit): android.webkit.WebView {
return ankoView(`$$Anko$Factories$Sdk28View`.WEB_VIEW, theme = 0) { init() }
}
inline fun ViewManager.themedWebView(theme: Int = 0): android.webkit.WebView = themedWebView(theme) {}
inline fun ViewManager.themedWebView(theme: Int = 0, init: (@AnkoViewDslMarker android.webkit.WebView).() -> Unit): android.webkit.WebView {
return ankoView(`$$Anko$Factories$Sdk28View`.WEB_VIEW, theme) { init() }
}
inline fun Context.webView(): android.webkit.WebView = webView() {}
inline fun Context.webView(init: (@AnkoViewDslMarker android.webkit.WebView).() -> Unit): android.webkit.WebView {
return ankoView(`$$Anko$Factories$Sdk28View`.WEB_VIEW, theme = 0) { init() }
}
inline fun Context.themedWebView(theme: Int = 0): android.webkit.WebView = themedWebView(theme) {}
inline fun Context.themedWebView(theme: Int = 0, init: (@AnkoViewDslMarker android.webkit.WebView).() -> Unit): android.webkit.WebView {
return ankoView(`$$Anko$Factories$Sdk28View`.WEB_VIEW, theme) { init() }
}
inline fun Activity.webView(): android.webkit.WebView = webView() {}
inline fun Activity.webView(init: (@AnkoViewDslMarker android.webkit.WebView).() -> Unit): android.webkit.WebView {
return ankoView(`$$Anko$Factories$Sdk28View`.WEB_VIEW, theme = 0) { init() }
}
inline fun Activity.themedWebView(theme: Int = 0): android.webkit.WebView = themedWebView(theme) {}
inline fun Activity.themedWebView(theme: Int = 0, init: (@AnkoViewDslMarker android.webkit.WebView).() -> Unit): android.webkit.WebView {
return ankoView(`$$Anko$Factories$Sdk28View`.WEB_VIEW, theme) { init() }
}
inline fun ViewManager.adapterViewFlipper(): android.widget.AdapterViewFlipper = adapterViewFlipper() {}
inline fun ViewManager.adapterViewFlipper(init: (@AnkoViewDslMarker android.widget.AdapterViewFlipper).() -> Unit): android.widget.AdapterViewFlipper {
return ankoView(`$$Anko$Factories$Sdk28View`.ADAPTER_VIEW_FLIPPER, theme = 0) { init() }
}
inline fun ViewManager.themedAdapterViewFlipper(theme: Int = 0): android.widget.AdapterViewFlipper = themedAdapterViewFlipper(theme) {}
inline fun ViewManager.themedAdapterViewFlipper(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.AdapterViewFlipper).() -> Unit): android.widget.AdapterViewFlipper {
return ankoView(`$$Anko$Factories$Sdk28View`.ADAPTER_VIEW_FLIPPER, theme) { init() }
}
inline fun Context.adapterViewFlipper(): android.widget.AdapterViewFlipper = adapterViewFlipper() {}
inline fun Context.adapterViewFlipper(init: (@AnkoViewDslMarker android.widget.AdapterViewFlipper).() -> Unit): android.widget.AdapterViewFlipper {
return ankoView(`$$Anko$Factories$Sdk28View`.ADAPTER_VIEW_FLIPPER, theme = 0) { init() }
}
inline fun Context.themedAdapterViewFlipper(theme: Int = 0): android.widget.AdapterViewFlipper = themedAdapterViewFlipper(theme) {}
inline fun Context.themedAdapterViewFlipper(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.AdapterViewFlipper).() -> Unit): android.widget.AdapterViewFlipper {
return ankoView(`$$Anko$Factories$Sdk28View`.ADAPTER_VIEW_FLIPPER, theme) { init() }
}
inline fun Activity.adapterViewFlipper(): android.widget.AdapterViewFlipper = adapterViewFlipper() {}
inline fun Activity.adapterViewFlipper(init: (@AnkoViewDslMarker android.widget.AdapterViewFlipper).() -> Unit): android.widget.AdapterViewFlipper {
return ankoView(`$$Anko$Factories$Sdk28View`.ADAPTER_VIEW_FLIPPER, theme = 0) { init() }
}
inline fun Activity.themedAdapterViewFlipper(theme: Int = 0): android.widget.AdapterViewFlipper = themedAdapterViewFlipper(theme) {}
inline fun Activity.themedAdapterViewFlipper(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.AdapterViewFlipper).() -> Unit): android.widget.AdapterViewFlipper {
return ankoView(`$$Anko$Factories$Sdk28View`.ADAPTER_VIEW_FLIPPER, theme) { init() }
}
inline fun ViewManager.analogClock(): android.widget.AnalogClock = analogClock() {}
inline fun ViewManager.analogClock(init: (@AnkoViewDslMarker android.widget.AnalogClock).() -> Unit): android.widget.AnalogClock {
return ankoView(`$$Anko$Factories$Sdk28View`.ANALOG_CLOCK, theme = 0) { init() }
}
inline fun ViewManager.themedAnalogClock(theme: Int = 0): android.widget.AnalogClock = themedAnalogClock(theme) {}
inline fun ViewManager.themedAnalogClock(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.AnalogClock).() -> Unit): android.widget.AnalogClock {
return ankoView(`$$Anko$Factories$Sdk28View`.ANALOG_CLOCK, theme) { init() }
}
inline fun ViewManager.autoCompleteTextView(): android.widget.AutoCompleteTextView = autoCompleteTextView() {}
inline fun ViewManager.autoCompleteTextView(init: (@AnkoViewDslMarker android.widget.AutoCompleteTextView).() -> Unit): android.widget.AutoCompleteTextView {
return ankoView(`$$Anko$Factories$Sdk28View`.AUTO_COMPLETE_TEXT_VIEW, theme = 0) { init() }
}
inline fun ViewManager.themedAutoCompleteTextView(theme: Int = 0): android.widget.AutoCompleteTextView = themedAutoCompleteTextView(theme) {}
inline fun ViewManager.themedAutoCompleteTextView(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.AutoCompleteTextView).() -> Unit): android.widget.AutoCompleteTextView {
return ankoView(`$$Anko$Factories$Sdk28View`.AUTO_COMPLETE_TEXT_VIEW, theme) { init() }
}
inline fun ViewManager.button(): android.widget.Button = button() {}
inline fun ViewManager.button(init: (@AnkoViewDslMarker android.widget.Button).() -> Unit): android.widget.Button {
return ankoView(`$$Anko$Factories$Sdk28View`.BUTTON, theme = 0) { init() }
}
inline fun ViewManager.themedButton(theme: Int = 0): android.widget.Button = themedButton(theme) {}
inline fun ViewManager.themedButton(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.Button).() -> Unit): android.widget.Button {
return ankoView(`$$Anko$Factories$Sdk28View`.BUTTON, theme) { init() }
}
inline fun ViewManager.button(text: CharSequence?): android.widget.Button {
return ankoView(`$$Anko$Factories$Sdk28View`.BUTTON, theme = 0) {
setText(text)
}
}
inline fun ViewManager.button(text: CharSequence?, init: (@AnkoViewDslMarker android.widget.Button).() -> Unit): android.widget.Button {
return ankoView(`$$Anko$Factories$Sdk28View`.BUTTON, theme = 0) {
init()
setText(text)
}
}
inline fun ViewManager.themedButton(text: CharSequence?, theme: Int): android.widget.Button {
return ankoView(`$$Anko$Factories$Sdk28View`.BUTTON, theme) {
setText(text)
}
}
inline fun ViewManager.themedButton(text: CharSequence?, theme: Int, init: (@AnkoViewDslMarker android.widget.Button).() -> Unit): android.widget.Button {
return ankoView(`$$Anko$Factories$Sdk28View`.BUTTON, theme) {
init()
setText(text)
}
}
inline fun ViewManager.button(text: Int): android.widget.Button {
return ankoView(`$$Anko$Factories$Sdk28View`.BUTTON, theme = 0) {
setText(text)
}
}
inline fun ViewManager.button(text: Int, init: (@AnkoViewDslMarker android.widget.Button).() -> Unit): android.widget.Button {
return ankoView(`$$Anko$Factories$Sdk28View`.BUTTON, theme = 0) {
init()
setText(text)
}
}
inline fun ViewManager.themedButton(text: Int, theme: Int): android.widget.Button {
return ankoView(`$$Anko$Factories$Sdk28View`.BUTTON, theme) {
setText(text)
}
}
inline fun ViewManager.themedButton(text: Int, theme: Int, init: (@AnkoViewDslMarker android.widget.Button).() -> Unit): android.widget.Button {
return ankoView(`$$Anko$Factories$Sdk28View`.BUTTON, theme) {
init()
setText(text)
}
}
inline fun ViewManager.calendarView(): android.widget.CalendarView = calendarView() {}
inline fun ViewManager.calendarView(init: (@AnkoViewDslMarker android.widget.CalendarView).() -> Unit): android.widget.CalendarView {
return ankoView(`$$Anko$Factories$Sdk28View`.CALENDAR_VIEW, theme = 0) { init() }
}
inline fun ViewManager.themedCalendarView(theme: Int = 0): android.widget.CalendarView = themedCalendarView(theme) {}
inline fun ViewManager.themedCalendarView(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.CalendarView).() -> Unit): android.widget.CalendarView {
return ankoView(`$$Anko$Factories$Sdk28View`.CALENDAR_VIEW, theme) { init() }
}
inline fun Context.calendarView(): android.widget.CalendarView = calendarView() {}
inline fun Context.calendarView(init: (@AnkoViewDslMarker android.widget.CalendarView).() -> Unit): android.widget.CalendarView {
return ankoView(`$$Anko$Factories$Sdk28View`.CALENDAR_VIEW, theme = 0) { init() }
}
inline fun Context.themedCalendarView(theme: Int = 0): android.widget.CalendarView = themedCalendarView(theme) {}
inline fun Context.themedCalendarView(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.CalendarView).() -> Unit): android.widget.CalendarView {
return ankoView(`$$Anko$Factories$Sdk28View`.CALENDAR_VIEW, theme) { init() }
}
inline fun Activity.calendarView(): android.widget.CalendarView = calendarView() {}
inline fun Activity.calendarView(init: (@AnkoViewDslMarker android.widget.CalendarView).() -> Unit): android.widget.CalendarView {
return ankoView(`$$Anko$Factories$Sdk28View`.CALENDAR_VIEW, theme = 0) { init() }
}
inline fun Activity.themedCalendarView(theme: Int = 0): android.widget.CalendarView = themedCalendarView(theme) {}
inline fun Activity.themedCalendarView(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.CalendarView).() -> Unit): android.widget.CalendarView {
return ankoView(`$$Anko$Factories$Sdk28View`.CALENDAR_VIEW, theme) { init() }
}
inline fun ViewManager.checkBox(): android.widget.CheckBox = checkBox() {}
inline fun ViewManager.checkBox(init: (@AnkoViewDslMarker android.widget.CheckBox).() -> Unit): android.widget.CheckBox {
return ankoView(`$$Anko$Factories$Sdk28View`.CHECK_BOX, theme = 0) { init() }
}
inline fun ViewManager.themedCheckBox(theme: Int = 0): android.widget.CheckBox = themedCheckBox(theme) {}
inline fun ViewManager.themedCheckBox(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.CheckBox).() -> Unit): android.widget.CheckBox {
return ankoView(`$$Anko$Factories$Sdk28View`.CHECK_BOX, theme) { init() }
}
inline fun ViewManager.checkBox(text: CharSequence?): android.widget.CheckBox {
return ankoView(`$$Anko$Factories$Sdk28View`.CHECK_BOX, theme = 0) {
setText(text)
}
}
inline fun ViewManager.checkBox(text: CharSequence?, init: (@AnkoViewDslMarker android.widget.CheckBox).() -> Unit): android.widget.CheckBox {
return ankoView(`$$Anko$Factories$Sdk28View`.CHECK_BOX, theme = 0) {
init()
setText(text)
}
}
inline fun ViewManager.themedCheckBox(text: CharSequence?, theme: Int): android.widget.CheckBox {
return ankoView(`$$Anko$Factories$Sdk28View`.CHECK_BOX, theme) {
setText(text)
}
}
inline fun ViewManager.themedCheckBox(text: CharSequence?, theme: Int, init: (@AnkoViewDslMarker android.widget.CheckBox).() -> Unit): android.widget.CheckBox {
return ankoView(`$$Anko$Factories$Sdk28View`.CHECK_BOX, theme) {
init()
setText(text)
}
}
inline fun ViewManager.checkBox(text: Int): android.widget.CheckBox {
return ankoView(`$$Anko$Factories$Sdk28View`.CHECK_BOX, theme = 0) {
setText(text)
}
}
inline fun ViewManager.checkBox(text: Int, init: (@AnkoViewDslMarker android.widget.CheckBox).() -> Unit): android.widget.CheckBox {
return ankoView(`$$Anko$Factories$Sdk28View`.CHECK_BOX, theme = 0) {
init()
setText(text)
}
}
inline fun ViewManager.themedCheckBox(text: Int, theme: Int): android.widget.CheckBox {
return ankoView(`$$Anko$Factories$Sdk28View`.CHECK_BOX, theme) {
setText(text)
}
}
inline fun ViewManager.themedCheckBox(text: Int, theme: Int, init: (@AnkoViewDslMarker android.widget.CheckBox).() -> Unit): android.widget.CheckBox {
return ankoView(`$$Anko$Factories$Sdk28View`.CHECK_BOX, theme) {
init()
setText(text)
}
}
inline fun ViewManager.checkBox(text: CharSequence?, checked: Boolean): android.widget.CheckBox {
return ankoView(`$$Anko$Factories$Sdk28View`.CHECK_BOX, theme = 0) {
setText(text)
setChecked(checked)
}
}
inline fun ViewManager.checkBox(text: CharSequence?, checked: Boolean, init: (@AnkoViewDslMarker android.widget.CheckBox).() -> Unit): android.widget.CheckBox {
return ankoView(`$$Anko$Factories$Sdk28View`.CHECK_BOX, theme = 0) {
init()
setText(text)
setChecked(checked)
}
}
inline fun ViewManager.themedCheckBox(text: CharSequence?, checked: Boolean, theme: Int): android.widget.CheckBox {
return ankoView(`$$Anko$Factories$Sdk28View`.CHECK_BOX, theme) {
setText(text)
setChecked(checked)
}
}
inline fun ViewManager.themedCheckBox(text: CharSequence?, checked: Boolean, theme: Int, init: (@AnkoViewDslMarker android.widget.CheckBox).() -> Unit): android.widget.CheckBox {
return ankoView(`$$Anko$Factories$Sdk28View`.CHECK_BOX, theme) {
init()
setText(text)
setChecked(checked)
}
}
inline fun ViewManager.checkBox(text: Int, checked: Boolean): android.widget.CheckBox {
return ankoView(`$$Anko$Factories$Sdk28View`.CHECK_BOX, theme = 0) {
setText(text)
setChecked(checked)
}
}
inline fun ViewManager.checkBox(text: Int, checked: Boolean, init: (@AnkoViewDslMarker android.widget.CheckBox).() -> Unit): android.widget.CheckBox {
return ankoView(`$$Anko$Factories$Sdk28View`.CHECK_BOX, theme = 0) {
init()
setText(text)
setChecked(checked)
}
}
inline fun ViewManager.themedCheckBox(text: Int, checked: Boolean, theme: Int): android.widget.CheckBox {
return ankoView(`$$Anko$Factories$Sdk28View`.CHECK_BOX, theme) {
setText(text)
setChecked(checked)
}
}
inline fun ViewManager.themedCheckBox(text: Int, checked: Boolean, theme: Int, init: (@AnkoViewDslMarker android.widget.CheckBox).() -> Unit): android.widget.CheckBox {
return ankoView(`$$Anko$Factories$Sdk28View`.CHECK_BOX, theme) {
init()
setText(text)
setChecked(checked)
}
}
inline fun ViewManager.checkedTextView(): android.widget.CheckedTextView = checkedTextView() {}
inline fun ViewManager.checkedTextView(init: (@AnkoViewDslMarker android.widget.CheckedTextView).() -> Unit): android.widget.CheckedTextView {
return ankoView(`$$Anko$Factories$Sdk28View`.CHECKED_TEXT_VIEW, theme = 0) { init() }
}
inline fun ViewManager.themedCheckedTextView(theme: Int = 0): android.widget.CheckedTextView = themedCheckedTextView(theme) {}
inline fun ViewManager.themedCheckedTextView(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.CheckedTextView).() -> Unit): android.widget.CheckedTextView {
return ankoView(`$$Anko$Factories$Sdk28View`.CHECKED_TEXT_VIEW, theme) { init() }
}
inline fun ViewManager.chronometer(): android.widget.Chronometer = chronometer() {}
inline fun ViewManager.chronometer(init: (@AnkoViewDslMarker android.widget.Chronometer).() -> Unit): android.widget.Chronometer {
return ankoView(`$$Anko$Factories$Sdk28View`.CHRONOMETER, theme = 0) { init() }
}
inline fun ViewManager.themedChronometer(theme: Int = 0): android.widget.Chronometer = themedChronometer(theme) {}
inline fun ViewManager.themedChronometer(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.Chronometer).() -> Unit): android.widget.Chronometer {
return ankoView(`$$Anko$Factories$Sdk28View`.CHRONOMETER, theme) { init() }
}
inline fun ViewManager.datePicker(): android.widget.DatePicker = datePicker() {}
inline fun ViewManager.datePicker(init: (@AnkoViewDslMarker android.widget.DatePicker).() -> Unit): android.widget.DatePicker {
return ankoView(`$$Anko$Factories$Sdk28View`.DATE_PICKER, theme = 0) { init() }
}
inline fun ViewManager.themedDatePicker(theme: Int = 0): android.widget.DatePicker = themedDatePicker(theme) {}
inline fun ViewManager.themedDatePicker(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.DatePicker).() -> Unit): android.widget.DatePicker {
return ankoView(`$$Anko$Factories$Sdk28View`.DATE_PICKER, theme) { init() }
}
inline fun Context.datePicker(): android.widget.DatePicker = datePicker() {}
inline fun Context.datePicker(init: (@AnkoViewDslMarker android.widget.DatePicker).() -> Unit): android.widget.DatePicker {
return ankoView(`$$Anko$Factories$Sdk28View`.DATE_PICKER, theme = 0) { init() }
}
inline fun Context.themedDatePicker(theme: Int = 0): android.widget.DatePicker = themedDatePicker(theme) {}
inline fun Context.themedDatePicker(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.DatePicker).() -> Unit): android.widget.DatePicker {
return ankoView(`$$Anko$Factories$Sdk28View`.DATE_PICKER, theme) { init() }
}
inline fun Activity.datePicker(): android.widget.DatePicker = datePicker() {}
inline fun Activity.datePicker(init: (@AnkoViewDslMarker android.widget.DatePicker).() -> Unit): android.widget.DatePicker {
return ankoView(`$$Anko$Factories$Sdk28View`.DATE_PICKER, theme = 0) { init() }
}
inline fun Activity.themedDatePicker(theme: Int = 0): android.widget.DatePicker = themedDatePicker(theme) {}
inline fun Activity.themedDatePicker(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.DatePicker).() -> Unit): android.widget.DatePicker {
return ankoView(`$$Anko$Factories$Sdk28View`.DATE_PICKER, theme) { init() }
}
inline fun ViewManager.dialerFilter(): android.widget.DialerFilter = dialerFilter() {}
inline fun ViewManager.dialerFilter(init: (@AnkoViewDslMarker android.widget.DialerFilter).() -> Unit): android.widget.DialerFilter {
return ankoView(`$$Anko$Factories$Sdk28View`.DIALER_FILTER, theme = 0) { init() }
}
inline fun ViewManager.themedDialerFilter(theme: Int = 0): android.widget.DialerFilter = themedDialerFilter(theme) {}
inline fun ViewManager.themedDialerFilter(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.DialerFilter).() -> Unit): android.widget.DialerFilter {
return ankoView(`$$Anko$Factories$Sdk28View`.DIALER_FILTER, theme) { init() }
}
inline fun Context.dialerFilter(): android.widget.DialerFilter = dialerFilter() {}
inline fun Context.dialerFilter(init: (@AnkoViewDslMarker android.widget.DialerFilter).() -> Unit): android.widget.DialerFilter {
return ankoView(`$$Anko$Factories$Sdk28View`.DIALER_FILTER, theme = 0) { init() }
}
inline fun Context.themedDialerFilter(theme: Int = 0): android.widget.DialerFilter = themedDialerFilter(theme) {}
inline fun Context.themedDialerFilter(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.DialerFilter).() -> Unit): android.widget.DialerFilter {
return ankoView(`$$Anko$Factories$Sdk28View`.DIALER_FILTER, theme) { init() }
}
inline fun Activity.dialerFilter(): android.widget.DialerFilter = dialerFilter() {}
inline fun Activity.dialerFilter(init: (@AnkoViewDslMarker android.widget.DialerFilter).() -> Unit): android.widget.DialerFilter {
return ankoView(`$$Anko$Factories$Sdk28View`.DIALER_FILTER, theme = 0) { init() }
}
inline fun Activity.themedDialerFilter(theme: Int = 0): android.widget.DialerFilter = themedDialerFilter(theme) {}
inline fun Activity.themedDialerFilter(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.DialerFilter).() -> Unit): android.widget.DialerFilter {
return ankoView(`$$Anko$Factories$Sdk28View`.DIALER_FILTER, theme) { init() }
}
inline fun ViewManager.digitalClock(): android.widget.DigitalClock = digitalClock() {}
inline fun ViewManager.digitalClock(init: (@AnkoViewDslMarker android.widget.DigitalClock).() -> Unit): android.widget.DigitalClock {
return ankoView(`$$Anko$Factories$Sdk28View`.DIGITAL_CLOCK, theme = 0) { init() }
}
inline fun ViewManager.themedDigitalClock(theme: Int = 0): android.widget.DigitalClock = themedDigitalClock(theme) {}
inline fun ViewManager.themedDigitalClock(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.DigitalClock).() -> Unit): android.widget.DigitalClock {
return ankoView(`$$Anko$Factories$Sdk28View`.DIGITAL_CLOCK, theme) { init() }
}
inline fun ViewManager.editText(): android.widget.EditText = editText() {}
inline fun ViewManager.editText(init: (@AnkoViewDslMarker android.widget.EditText).() -> Unit): android.widget.EditText {
return ankoView(`$$Anko$Factories$Sdk28View`.EDIT_TEXT, theme = 0) { init() }
}
inline fun ViewManager.themedEditText(theme: Int = 0): android.widget.EditText = themedEditText(theme) {}
inline fun ViewManager.themedEditText(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.EditText).() -> Unit): android.widget.EditText {
return ankoView(`$$Anko$Factories$Sdk28View`.EDIT_TEXT, theme) { init() }
}
inline fun ViewManager.editText(text: CharSequence?): android.widget.EditText {
return ankoView(`$$Anko$Factories$Sdk28View`.EDIT_TEXT, theme = 0) {
setText(text)
}
}
inline fun ViewManager.editText(text: CharSequence?, init: (@AnkoViewDslMarker android.widget.EditText).() -> Unit): android.widget.EditText {
return ankoView(`$$Anko$Factories$Sdk28View`.EDIT_TEXT, theme = 0) {
init()
setText(text)
}
}
inline fun ViewManager.themedEditText(text: CharSequence?, theme: Int): android.widget.EditText {
return ankoView(`$$Anko$Factories$Sdk28View`.EDIT_TEXT, theme) {
setText(text)
}
}
inline fun ViewManager.themedEditText(text: CharSequence?, theme: Int, init: (@AnkoViewDslMarker android.widget.EditText).() -> Unit): android.widget.EditText {
return ankoView(`$$Anko$Factories$Sdk28View`.EDIT_TEXT, theme) {
init()
setText(text)
}
}
inline fun ViewManager.editText(text: Int): android.widget.EditText {
return ankoView(`$$Anko$Factories$Sdk28View`.EDIT_TEXT, theme = 0) {
setText(text)
}
}
inline fun ViewManager.editText(text: Int, init: (@AnkoViewDslMarker android.widget.EditText).() -> Unit): android.widget.EditText {
return ankoView(`$$Anko$Factories$Sdk28View`.EDIT_TEXT, theme = 0) {
init()
setText(text)
}
}
inline fun ViewManager.themedEditText(text: Int, theme: Int): android.widget.EditText {
return ankoView(`$$Anko$Factories$Sdk28View`.EDIT_TEXT, theme) {
setText(text)
}
}
inline fun ViewManager.themedEditText(text: Int, theme: Int, init: (@AnkoViewDslMarker android.widget.EditText).() -> Unit): android.widget.EditText {
return ankoView(`$$Anko$Factories$Sdk28View`.EDIT_TEXT, theme) {
init()
setText(text)
}
}
inline fun ViewManager.expandableListView(): android.widget.ExpandableListView = expandableListView() {}
inline fun ViewManager.expandableListView(init: (@AnkoViewDslMarker android.widget.ExpandableListView).() -> Unit): android.widget.ExpandableListView {
return ankoView(`$$Anko$Factories$Sdk28View`.EXPANDABLE_LIST_VIEW, theme = 0) { init() }
}
inline fun ViewManager.themedExpandableListView(theme: Int = 0): android.widget.ExpandableListView = themedExpandableListView(theme) {}
inline fun ViewManager.themedExpandableListView(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.ExpandableListView).() -> Unit): android.widget.ExpandableListView {
return ankoView(`$$Anko$Factories$Sdk28View`.EXPANDABLE_LIST_VIEW, theme) { init() }
}
inline fun Context.expandableListView(): android.widget.ExpandableListView = expandableListView() {}
inline fun Context.expandableListView(init: (@AnkoViewDslMarker android.widget.ExpandableListView).() -> Unit): android.widget.ExpandableListView {
return ankoView(`$$Anko$Factories$Sdk28View`.EXPANDABLE_LIST_VIEW, theme = 0) { init() }
}
inline fun Context.themedExpandableListView(theme: Int = 0): android.widget.ExpandableListView = themedExpandableListView(theme) {}
inline fun Context.themedExpandableListView(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.ExpandableListView).() -> Unit): android.widget.ExpandableListView {
return ankoView(`$$Anko$Factories$Sdk28View`.EXPANDABLE_LIST_VIEW, theme) { init() }
}
inline fun Activity.expandableListView(): android.widget.ExpandableListView = expandableListView() {}
inline fun Activity.expandableListView(init: (@AnkoViewDslMarker android.widget.ExpandableListView).() -> Unit): android.widget.ExpandableListView {
return ankoView(`$$Anko$Factories$Sdk28View`.EXPANDABLE_LIST_VIEW, theme = 0) { init() }
}
inline fun Activity.themedExpandableListView(theme: Int = 0): android.widget.ExpandableListView = themedExpandableListView(theme) {}
inline fun Activity.themedExpandableListView(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.ExpandableListView).() -> Unit): android.widget.ExpandableListView {
return ankoView(`$$Anko$Factories$Sdk28View`.EXPANDABLE_LIST_VIEW, theme) { init() }
}
inline fun ViewManager.imageButton(): android.widget.ImageButton = imageButton() {}
inline fun ViewManager.imageButton(init: (@AnkoViewDslMarker android.widget.ImageButton).() -> Unit): android.widget.ImageButton {
return ankoView(`$$Anko$Factories$Sdk28View`.IMAGE_BUTTON, theme = 0) { init() }
}
inline fun ViewManager.themedImageButton(theme: Int = 0): android.widget.ImageButton = themedImageButton(theme) {}
inline fun ViewManager.themedImageButton(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.ImageButton).() -> Unit): android.widget.ImageButton {
return ankoView(`$$Anko$Factories$Sdk28View`.IMAGE_BUTTON, theme) { init() }
}
inline fun ViewManager.imageButton(imageDrawable: android.graphics.drawable.Drawable?): android.widget.ImageButton {
return ankoView(`$$Anko$Factories$Sdk28View`.IMAGE_BUTTON, theme = 0) {
setImageDrawable(imageDrawable)
}
}
inline fun ViewManager.imageButton(imageDrawable: android.graphics.drawable.Drawable?, init: (@AnkoViewDslMarker android.widget.ImageButton).() -> Unit): android.widget.ImageButton {
return ankoView(`$$Anko$Factories$Sdk28View`.IMAGE_BUTTON, theme = 0) {
init()
setImageDrawable(imageDrawable)
}
}
inline fun ViewManager.themedImageButton(imageDrawable: android.graphics.drawable.Drawable?, theme: Int): android.widget.ImageButton {
return ankoView(`$$Anko$Factories$Sdk28View`.IMAGE_BUTTON, theme) {
setImageDrawable(imageDrawable)
}
}
inline fun ViewManager.themedImageButton(imageDrawable: android.graphics.drawable.Drawable?, theme: Int, init: (@AnkoViewDslMarker android.widget.ImageButton).() -> Unit): android.widget.ImageButton {
return ankoView(`$$Anko$Factories$Sdk28View`.IMAGE_BUTTON, theme) {
init()
setImageDrawable(imageDrawable)
}
}
inline fun ViewManager.imageButton(imageResource: Int): android.widget.ImageButton {
return ankoView(`$$Anko$Factories$Sdk28View`.IMAGE_BUTTON, theme = 0) {
setImageResource(imageResource)
}
}
inline fun ViewManager.imageButton(imageResource: Int, init: (@AnkoViewDslMarker android.widget.ImageButton).() -> Unit): android.widget.ImageButton {
return ankoView(`$$Anko$Factories$Sdk28View`.IMAGE_BUTTON, theme = 0) {
init()
setImageResource(imageResource)
}
}
inline fun ViewManager.themedImageButton(imageResource: Int, theme: Int): android.widget.ImageButton {
return ankoView(`$$Anko$Factories$Sdk28View`.IMAGE_BUTTON, theme) {
setImageResource(imageResource)
}
}
inline fun ViewManager.themedImageButton(imageResource: Int, theme: Int, init: (@AnkoViewDslMarker android.widget.ImageButton).() -> Unit): android.widget.ImageButton {
return ankoView(`$$Anko$Factories$Sdk28View`.IMAGE_BUTTON, theme) {
init()
setImageResource(imageResource)
}
}
inline fun ViewManager.imageView(): android.widget.ImageView = imageView() {}
inline fun ViewManager.imageView(init: (@AnkoViewDslMarker android.widget.ImageView).() -> Unit): android.widget.ImageView {
return ankoView(`$$Anko$Factories$Sdk28View`.IMAGE_VIEW, theme = 0) { init() }
}
inline fun ViewManager.themedImageView(theme: Int = 0): android.widget.ImageView = themedImageView(theme) {}
inline fun ViewManager.themedImageView(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.ImageView).() -> Unit): android.widget.ImageView {
return ankoView(`$$Anko$Factories$Sdk28View`.IMAGE_VIEW, theme) { init() }
}
inline fun ViewManager.imageView(imageDrawable: android.graphics.drawable.Drawable?): android.widget.ImageView {
return ankoView(`$$Anko$Factories$Sdk28View`.IMAGE_VIEW, theme = 0) {
setImageDrawable(imageDrawable)
}
}
inline fun ViewManager.imageView(imageDrawable: android.graphics.drawable.Drawable?, init: (@AnkoViewDslMarker android.widget.ImageView).() -> Unit): android.widget.ImageView {
return ankoView(`$$Anko$Factories$Sdk28View`.IMAGE_VIEW, theme = 0) {
init()
setImageDrawable(imageDrawable)
}
}
inline fun ViewManager.themedImageView(imageDrawable: android.graphics.drawable.Drawable?, theme: Int): android.widget.ImageView {
return ankoView(`$$Anko$Factories$Sdk28View`.IMAGE_VIEW, theme) {
setImageDrawable(imageDrawable)
}
}
inline fun ViewManager.themedImageView(imageDrawable: android.graphics.drawable.Drawable?, theme: Int, init: (@AnkoViewDslMarker android.widget.ImageView).() -> Unit): android.widget.ImageView {
return ankoView(`$$Anko$Factories$Sdk28View`.IMAGE_VIEW, theme) {
init()
setImageDrawable(imageDrawable)
}
}
inline fun ViewManager.imageView(imageResource: Int): android.widget.ImageView {
return ankoView(`$$Anko$Factories$Sdk28View`.IMAGE_VIEW, theme = 0) {
setImageResource(imageResource)
}
}
inline fun ViewManager.imageView(imageResource: Int, init: (@AnkoViewDslMarker android.widget.ImageView).() -> Unit): android.widget.ImageView {
return ankoView(`$$Anko$Factories$Sdk28View`.IMAGE_VIEW, theme = 0) {
init()
setImageResource(imageResource)
}
}
inline fun ViewManager.themedImageView(imageResource: Int, theme: Int): android.widget.ImageView {
return ankoView(`$$Anko$Factories$Sdk28View`.IMAGE_VIEW, theme) {
setImageResource(imageResource)
}
}
inline fun ViewManager.themedImageView(imageResource: Int, theme: Int, init: (@AnkoViewDslMarker android.widget.ImageView).() -> Unit): android.widget.ImageView {
return ankoView(`$$Anko$Factories$Sdk28View`.IMAGE_VIEW, theme) {
init()
setImageResource(imageResource)
}
}
inline fun ViewManager.listView(): android.widget.ListView = listView() {}
inline fun ViewManager.listView(init: (@AnkoViewDslMarker android.widget.ListView).() -> Unit): android.widget.ListView {
return ankoView(`$$Anko$Factories$Sdk28View`.LIST_VIEW, theme = 0) { init() }
}
inline fun ViewManager.themedListView(theme: Int = 0): android.widget.ListView = themedListView(theme) {}
inline fun ViewManager.themedListView(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.ListView).() -> Unit): android.widget.ListView {
return ankoView(`$$Anko$Factories$Sdk28View`.LIST_VIEW, theme) { init() }
}
inline fun Context.listView(): android.widget.ListView = listView() {}
inline fun Context.listView(init: (@AnkoViewDslMarker android.widget.ListView).() -> Unit): android.widget.ListView {
return ankoView(`$$Anko$Factories$Sdk28View`.LIST_VIEW, theme = 0) { init() }
}
inline fun Context.themedListView(theme: Int = 0): android.widget.ListView = themedListView(theme) {}
inline fun Context.themedListView(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.ListView).() -> Unit): android.widget.ListView {
return ankoView(`$$Anko$Factories$Sdk28View`.LIST_VIEW, theme) { init() }
}
inline fun Activity.listView(): android.widget.ListView = listView() {}
inline fun Activity.listView(init: (@AnkoViewDslMarker android.widget.ListView).() -> Unit): android.widget.ListView {
return ankoView(`$$Anko$Factories$Sdk28View`.LIST_VIEW, theme = 0) { init() }
}
inline fun Activity.themedListView(theme: Int = 0): android.widget.ListView = themedListView(theme) {}
inline fun Activity.themedListView(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.ListView).() -> Unit): android.widget.ListView {
return ankoView(`$$Anko$Factories$Sdk28View`.LIST_VIEW, theme) { init() }
}
inline fun ViewManager.multiAutoCompleteTextView(): android.widget.MultiAutoCompleteTextView = multiAutoCompleteTextView() {}
inline fun ViewManager.multiAutoCompleteTextView(init: (@AnkoViewDslMarker android.widget.MultiAutoCompleteTextView).() -> Unit): android.widget.MultiAutoCompleteTextView {
return ankoView(`$$Anko$Factories$Sdk28View`.MULTI_AUTO_COMPLETE_TEXT_VIEW, theme = 0) { init() }
}
inline fun ViewManager.themedMultiAutoCompleteTextView(theme: Int = 0): android.widget.MultiAutoCompleteTextView = themedMultiAutoCompleteTextView(theme) {}
inline fun ViewManager.themedMultiAutoCompleteTextView(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.MultiAutoCompleteTextView).() -> Unit): android.widget.MultiAutoCompleteTextView {
return ankoView(`$$Anko$Factories$Sdk28View`.MULTI_AUTO_COMPLETE_TEXT_VIEW, theme) { init() }
}
inline fun ViewManager.numberPicker(): android.widget.NumberPicker = numberPicker() {}
inline fun ViewManager.numberPicker(init: (@AnkoViewDslMarker android.widget.NumberPicker).() -> Unit): android.widget.NumberPicker {
return ankoView(`$$Anko$Factories$Sdk28View`.NUMBER_PICKER, theme = 0) { init() }
}
inline fun ViewManager.themedNumberPicker(theme: Int = 0): android.widget.NumberPicker = themedNumberPicker(theme) {}
inline fun ViewManager.themedNumberPicker(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.NumberPicker).() -> Unit): android.widget.NumberPicker {
return ankoView(`$$Anko$Factories$Sdk28View`.NUMBER_PICKER, theme) { init() }
}
inline fun Context.numberPicker(): android.widget.NumberPicker = numberPicker() {}
inline fun Context.numberPicker(init: (@AnkoViewDslMarker android.widget.NumberPicker).() -> Unit): android.widget.NumberPicker {
return ankoView(`$$Anko$Factories$Sdk28View`.NUMBER_PICKER, theme = 0) { init() }
}
inline fun Context.themedNumberPicker(theme: Int = 0): android.widget.NumberPicker = themedNumberPicker(theme) {}
inline fun Context.themedNumberPicker(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.NumberPicker).() -> Unit): android.widget.NumberPicker {
return ankoView(`$$Anko$Factories$Sdk28View`.NUMBER_PICKER, theme) { init() }
}
inline fun Activity.numberPicker(): android.widget.NumberPicker = numberPicker() {}
inline fun Activity.numberPicker(init: (@AnkoViewDslMarker android.widget.NumberPicker).() -> Unit): android.widget.NumberPicker {
return ankoView(`$$Anko$Factories$Sdk28View`.NUMBER_PICKER, theme = 0) { init() }
}
inline fun Activity.themedNumberPicker(theme: Int = 0): android.widget.NumberPicker = themedNumberPicker(theme) {}
inline fun Activity.themedNumberPicker(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.NumberPicker).() -> Unit): android.widget.NumberPicker {
return ankoView(`$$Anko$Factories$Sdk28View`.NUMBER_PICKER, theme) { init() }
}
inline fun ViewManager.progressBar(): android.widget.ProgressBar = progressBar() {}
inline fun ViewManager.progressBar(init: (@AnkoViewDslMarker android.widget.ProgressBar).() -> Unit): android.widget.ProgressBar {
return ankoView(`$$Anko$Factories$Sdk28View`.PROGRESS_BAR, theme = 0) { init() }
}
inline fun ViewManager.themedProgressBar(theme: Int = 0): android.widget.ProgressBar = themedProgressBar(theme) {}
inline fun ViewManager.themedProgressBar(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.ProgressBar).() -> Unit): android.widget.ProgressBar {
return ankoView(`$$Anko$Factories$Sdk28View`.PROGRESS_BAR, theme) { init() }
}
inline fun ViewManager.quickContactBadge(): android.widget.QuickContactBadge = quickContactBadge() {}
inline fun ViewManager.quickContactBadge(init: (@AnkoViewDslMarker android.widget.QuickContactBadge).() -> Unit): android.widget.QuickContactBadge {
return ankoView(`$$Anko$Factories$Sdk28View`.QUICK_CONTACT_BADGE, theme = 0) { init() }
}
inline fun ViewManager.themedQuickContactBadge(theme: Int = 0): android.widget.QuickContactBadge = themedQuickContactBadge(theme) {}
inline fun ViewManager.themedQuickContactBadge(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.QuickContactBadge).() -> Unit): android.widget.QuickContactBadge {
return ankoView(`$$Anko$Factories$Sdk28View`.QUICK_CONTACT_BADGE, theme) { init() }
}
inline fun ViewManager.radioButton(): android.widget.RadioButton = radioButton() {}
inline fun ViewManager.radioButton(init: (@AnkoViewDslMarker android.widget.RadioButton).() -> Unit): android.widget.RadioButton {
return ankoView(`$$Anko$Factories$Sdk28View`.RADIO_BUTTON, theme = 0) { init() }
}
inline fun ViewManager.themedRadioButton(theme: Int = 0): android.widget.RadioButton = themedRadioButton(theme) {}
inline fun ViewManager.themedRadioButton(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.RadioButton).() -> Unit): android.widget.RadioButton {
return ankoView(`$$Anko$Factories$Sdk28View`.RADIO_BUTTON, theme) { init() }
}
inline fun ViewManager.ratingBar(): android.widget.RatingBar = ratingBar() {}
inline fun ViewManager.ratingBar(init: (@AnkoViewDslMarker android.widget.RatingBar).() -> Unit): android.widget.RatingBar {
return ankoView(`$$Anko$Factories$Sdk28View`.RATING_BAR, theme = 0) { init() }
}
inline fun ViewManager.themedRatingBar(theme: Int = 0): android.widget.RatingBar = themedRatingBar(theme) {}
inline fun ViewManager.themedRatingBar(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.RatingBar).() -> Unit): android.widget.RatingBar {
return ankoView(`$$Anko$Factories$Sdk28View`.RATING_BAR, theme) { init() }
}
inline fun ViewManager.searchView(): android.widget.SearchView = searchView() {}
inline fun ViewManager.searchView(init: (@AnkoViewDslMarker android.widget.SearchView).() -> Unit): android.widget.SearchView {
return ankoView(`$$Anko$Factories$Sdk28View`.SEARCH_VIEW, theme = 0) { init() }
}
inline fun ViewManager.themedSearchView(theme: Int = 0): android.widget.SearchView = themedSearchView(theme) {}
inline fun ViewManager.themedSearchView(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.SearchView).() -> Unit): android.widget.SearchView {
return ankoView(`$$Anko$Factories$Sdk28View`.SEARCH_VIEW, theme) { init() }
}
inline fun Context.searchView(): android.widget.SearchView = searchView() {}
inline fun Context.searchView(init: (@AnkoViewDslMarker android.widget.SearchView).() -> Unit): android.widget.SearchView {
return ankoView(`$$Anko$Factories$Sdk28View`.SEARCH_VIEW, theme = 0) { init() }
}
inline fun Context.themedSearchView(theme: Int = 0): android.widget.SearchView = themedSearchView(theme) {}
inline fun Context.themedSearchView(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.SearchView).() -> Unit): android.widget.SearchView {
return ankoView(`$$Anko$Factories$Sdk28View`.SEARCH_VIEW, theme) { init() }
}
inline fun Activity.searchView(): android.widget.SearchView = searchView() {}
inline fun Activity.searchView(init: (@AnkoViewDslMarker android.widget.SearchView).() -> Unit): android.widget.SearchView {
return ankoView(`$$Anko$Factories$Sdk28View`.SEARCH_VIEW, theme = 0) { init() }
}
inline fun Activity.themedSearchView(theme: Int = 0): android.widget.SearchView = themedSearchView(theme) {}
inline fun Activity.themedSearchView(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.SearchView).() -> Unit): android.widget.SearchView {
return ankoView(`$$Anko$Factories$Sdk28View`.SEARCH_VIEW, theme) { init() }
}
inline fun ViewManager.seekBar(): android.widget.SeekBar = seekBar() {}
inline fun ViewManager.seekBar(init: (@AnkoViewDslMarker android.widget.SeekBar).() -> Unit): android.widget.SeekBar {
return ankoView(`$$Anko$Factories$Sdk28View`.SEEK_BAR, theme = 0) { init() }
}
inline fun ViewManager.themedSeekBar(theme: Int = 0): android.widget.SeekBar = themedSeekBar(theme) {}
inline fun ViewManager.themedSeekBar(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.SeekBar).() -> Unit): android.widget.SeekBar {
return ankoView(`$$Anko$Factories$Sdk28View`.SEEK_BAR, theme) { init() }
}
inline fun ViewManager.slidingDrawer(): android.widget.SlidingDrawer = slidingDrawer() {}
inline fun ViewManager.slidingDrawer(init: (@AnkoViewDslMarker android.widget.SlidingDrawer).() -> Unit): android.widget.SlidingDrawer {
return ankoView(`$$Anko$Factories$Sdk28View`.SLIDING_DRAWER, theme = 0) { init() }
}
inline fun ViewManager.themedSlidingDrawer(theme: Int = 0): android.widget.SlidingDrawer = themedSlidingDrawer(theme) {}
inline fun ViewManager.themedSlidingDrawer(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.SlidingDrawer).() -> Unit): android.widget.SlidingDrawer {
return ankoView(`$$Anko$Factories$Sdk28View`.SLIDING_DRAWER, theme) { init() }
}
inline fun Context.slidingDrawer(): android.widget.SlidingDrawer = slidingDrawer() {}
inline fun Context.slidingDrawer(init: (@AnkoViewDslMarker android.widget.SlidingDrawer).() -> Unit): android.widget.SlidingDrawer {
return ankoView(`$$Anko$Factories$Sdk28View`.SLIDING_DRAWER, theme = 0) { init() }
}
inline fun Context.themedSlidingDrawer(theme: Int = 0): android.widget.SlidingDrawer = themedSlidingDrawer(theme) {}
inline fun Context.themedSlidingDrawer(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.SlidingDrawer).() -> Unit): android.widget.SlidingDrawer {
return ankoView(`$$Anko$Factories$Sdk28View`.SLIDING_DRAWER, theme) { init() }
}
inline fun Activity.slidingDrawer(): android.widget.SlidingDrawer = slidingDrawer() {}
inline fun Activity.slidingDrawer(init: (@AnkoViewDslMarker android.widget.SlidingDrawer).() -> Unit): android.widget.SlidingDrawer {
return ankoView(`$$Anko$Factories$Sdk28View`.SLIDING_DRAWER, theme = 0) { init() }
}
inline fun Activity.themedSlidingDrawer(theme: Int = 0): android.widget.SlidingDrawer = themedSlidingDrawer(theme) {}
inline fun Activity.themedSlidingDrawer(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.SlidingDrawer).() -> Unit): android.widget.SlidingDrawer {
return ankoView(`$$Anko$Factories$Sdk28View`.SLIDING_DRAWER, theme) { init() }
}
inline fun ViewManager.space(): android.widget.Space = space() {}
inline fun ViewManager.space(init: (@AnkoViewDslMarker android.widget.Space).() -> Unit): android.widget.Space {
return ankoView(`$$Anko$Factories$Sdk28View`.SPACE, theme = 0) { init() }
}
inline fun ViewManager.themedSpace(theme: Int = 0): android.widget.Space = themedSpace(theme) {}
inline fun ViewManager.themedSpace(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.Space).() -> Unit): android.widget.Space {
return ankoView(`$$Anko$Factories$Sdk28View`.SPACE, theme) { init() }
}
inline fun ViewManager.spinner(): android.widget.Spinner = spinner() {}
inline fun ViewManager.spinner(init: (@AnkoViewDslMarker android.widget.Spinner).() -> Unit): android.widget.Spinner {
return ankoView(`$$Anko$Factories$Sdk28View`.SPINNER, theme = 0) { init() }
}
inline fun ViewManager.themedSpinner(theme: Int = 0): android.widget.Spinner = themedSpinner(theme) {}
inline fun ViewManager.themedSpinner(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.Spinner).() -> Unit): android.widget.Spinner {
return ankoView(`$$Anko$Factories$Sdk28View`.SPINNER, theme) { init() }
}
inline fun Context.spinner(): android.widget.Spinner = spinner() {}
inline fun Context.spinner(init: (@AnkoViewDslMarker android.widget.Spinner).() -> Unit): android.widget.Spinner {
return ankoView(`$$Anko$Factories$Sdk28View`.SPINNER, theme = 0) { init() }
}
inline fun Context.themedSpinner(theme: Int = 0): android.widget.Spinner = themedSpinner(theme) {}
inline fun Context.themedSpinner(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.Spinner).() -> Unit): android.widget.Spinner {
return ankoView(`$$Anko$Factories$Sdk28View`.SPINNER, theme) { init() }
}
inline fun Activity.spinner(): android.widget.Spinner = spinner() {}
inline fun Activity.spinner(init: (@AnkoViewDslMarker android.widget.Spinner).() -> Unit): android.widget.Spinner {
return ankoView(`$$Anko$Factories$Sdk28View`.SPINNER, theme = 0) { init() }
}
inline fun Activity.themedSpinner(theme: Int = 0): android.widget.Spinner = themedSpinner(theme) {}
inline fun Activity.themedSpinner(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.Spinner).() -> Unit): android.widget.Spinner {
return ankoView(`$$Anko$Factories$Sdk28View`.SPINNER, theme) { init() }
}
inline fun ViewManager.stackView(): android.widget.StackView = stackView() {}
inline fun ViewManager.stackView(init: (@AnkoViewDslMarker android.widget.StackView).() -> Unit): android.widget.StackView {
return ankoView(`$$Anko$Factories$Sdk28View`.STACK_VIEW, theme = 0) { init() }
}
inline fun ViewManager.themedStackView(theme: Int = 0): android.widget.StackView = themedStackView(theme) {}
inline fun ViewManager.themedStackView(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.StackView).() -> Unit): android.widget.StackView {
return ankoView(`$$Anko$Factories$Sdk28View`.STACK_VIEW, theme) { init() }
}
inline fun Context.stackView(): android.widget.StackView = stackView() {}
inline fun Context.stackView(init: (@AnkoViewDslMarker android.widget.StackView).() -> Unit): android.widget.StackView {
return ankoView(`$$Anko$Factories$Sdk28View`.STACK_VIEW, theme = 0) { init() }
}
inline fun Context.themedStackView(theme: Int = 0): android.widget.StackView = themedStackView(theme) {}
inline fun Context.themedStackView(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.StackView).() -> Unit): android.widget.StackView {
return ankoView(`$$Anko$Factories$Sdk28View`.STACK_VIEW, theme) { init() }
}
inline fun Activity.stackView(): android.widget.StackView = stackView() {}
inline fun Activity.stackView(init: (@AnkoViewDslMarker android.widget.StackView).() -> Unit): android.widget.StackView {
return ankoView(`$$Anko$Factories$Sdk28View`.STACK_VIEW, theme = 0) { init() }
}
inline fun Activity.themedStackView(theme: Int = 0): android.widget.StackView = themedStackView(theme) {}
inline fun Activity.themedStackView(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.StackView).() -> Unit): android.widget.StackView {
return ankoView(`$$Anko$Factories$Sdk28View`.STACK_VIEW, theme) { init() }
}
inline fun ViewManager.switch(): android.widget.Switch = switch() {}
inline fun ViewManager.switch(init: (@AnkoViewDslMarker android.widget.Switch).() -> Unit): android.widget.Switch {
return ankoView(`$$Anko$Factories$Sdk28View`.SWITCH, theme = 0) { init() }
}
inline fun ViewManager.themedSwitch(theme: Int = 0): android.widget.Switch = themedSwitch(theme) {}
inline fun ViewManager.themedSwitch(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.Switch).() -> Unit): android.widget.Switch {
return ankoView(`$$Anko$Factories$Sdk28View`.SWITCH, theme) { init() }
}
inline fun ViewManager.tabHost(): android.widget.TabHost = tabHost() {}
inline fun ViewManager.tabHost(init: (@AnkoViewDslMarker android.widget.TabHost).() -> Unit): android.widget.TabHost {
return ankoView(`$$Anko$Factories$Sdk28View`.TAB_HOST, theme = 0) { init() }
}
inline fun ViewManager.themedTabHost(theme: Int = 0): android.widget.TabHost = themedTabHost(theme) {}
inline fun ViewManager.themedTabHost(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.TabHost).() -> Unit): android.widget.TabHost {
return ankoView(`$$Anko$Factories$Sdk28View`.TAB_HOST, theme) { init() }
}
inline fun Context.tabHost(): android.widget.TabHost = tabHost() {}
inline fun Context.tabHost(init: (@AnkoViewDslMarker android.widget.TabHost).() -> Unit): android.widget.TabHost {
return ankoView(`$$Anko$Factories$Sdk28View`.TAB_HOST, theme = 0) { init() }
}
inline fun Context.themedTabHost(theme: Int = 0): android.widget.TabHost = themedTabHost(theme) {}
inline fun Context.themedTabHost(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.TabHost).() -> Unit): android.widget.TabHost {
return ankoView(`$$Anko$Factories$Sdk28View`.TAB_HOST, theme) { init() }
}
inline fun Activity.tabHost(): android.widget.TabHost = tabHost() {}
inline fun Activity.tabHost(init: (@AnkoViewDslMarker android.widget.TabHost).() -> Unit): android.widget.TabHost {
return ankoView(`$$Anko$Factories$Sdk28View`.TAB_HOST, theme = 0) { init() }
}
inline fun Activity.themedTabHost(theme: Int = 0): android.widget.TabHost = themedTabHost(theme) {}
inline fun Activity.themedTabHost(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.TabHost).() -> Unit): android.widget.TabHost {
return ankoView(`$$Anko$Factories$Sdk28View`.TAB_HOST, theme) { init() }
}
inline fun ViewManager.tabWidget(): android.widget.TabWidget = tabWidget() {}
inline fun ViewManager.tabWidget(init: (@AnkoViewDslMarker android.widget.TabWidget).() -> Unit): android.widget.TabWidget {
return ankoView(`$$Anko$Factories$Sdk28View`.TAB_WIDGET, theme = 0) { init() }
}
inline fun ViewManager.themedTabWidget(theme: Int = 0): android.widget.TabWidget = themedTabWidget(theme) {}
inline fun ViewManager.themedTabWidget(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.TabWidget).() -> Unit): android.widget.TabWidget {
return ankoView(`$$Anko$Factories$Sdk28View`.TAB_WIDGET, theme) { init() }
}
inline fun Context.tabWidget(): android.widget.TabWidget = tabWidget() {}
inline fun Context.tabWidget(init: (@AnkoViewDslMarker android.widget.TabWidget).() -> Unit): android.widget.TabWidget {
return ankoView(`$$Anko$Factories$Sdk28View`.TAB_WIDGET, theme = 0) { init() }
}
inline fun Context.themedTabWidget(theme: Int = 0): android.widget.TabWidget = themedTabWidget(theme) {}
inline fun Context.themedTabWidget(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.TabWidget).() -> Unit): android.widget.TabWidget {
return ankoView(`$$Anko$Factories$Sdk28View`.TAB_WIDGET, theme) { init() }
}
inline fun Activity.tabWidget(): android.widget.TabWidget = tabWidget() {}
inline fun Activity.tabWidget(init: (@AnkoViewDslMarker android.widget.TabWidget).() -> Unit): android.widget.TabWidget {
return ankoView(`$$Anko$Factories$Sdk28View`.TAB_WIDGET, theme = 0) { init() }
}
inline fun Activity.themedTabWidget(theme: Int = 0): android.widget.TabWidget = themedTabWidget(theme) {}
inline fun Activity.themedTabWidget(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.TabWidget).() -> Unit): android.widget.TabWidget {
return ankoView(`$$Anko$Factories$Sdk28View`.TAB_WIDGET, theme) { init() }
}
inline fun ViewManager.textClock(): android.widget.TextClock = textClock() {}
inline fun ViewManager.textClock(init: (@AnkoViewDslMarker android.widget.TextClock).() -> Unit): android.widget.TextClock {
return ankoView(`$$Anko$Factories$Sdk28View`.TEXT_CLOCK, theme = 0) { init() }
}
inline fun ViewManager.themedTextClock(theme: Int = 0): android.widget.TextClock = themedTextClock(theme) {}
inline fun ViewManager.themedTextClock(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.TextClock).() -> Unit): android.widget.TextClock {
return ankoView(`$$Anko$Factories$Sdk28View`.TEXT_CLOCK, theme) { init() }
}
inline fun ViewManager.textView(): android.widget.TextView = textView() {}
inline fun ViewManager.textView(init: (@AnkoViewDslMarker android.widget.TextView).() -> Unit): android.widget.TextView {
return ankoView(`$$Anko$Factories$Sdk28View`.TEXT_VIEW, theme = 0) { init() }
}
inline fun ViewManager.themedTextView(theme: Int = 0): android.widget.TextView = themedTextView(theme) {}
inline fun ViewManager.themedTextView(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.TextView).() -> Unit): android.widget.TextView {
return ankoView(`$$Anko$Factories$Sdk28View`.TEXT_VIEW, theme) { init() }
}
inline fun ViewManager.textView(text: CharSequence?): android.widget.TextView {
return ankoView(`$$Anko$Factories$Sdk28View`.TEXT_VIEW, theme = 0) {
setText(text)
}
}
inline fun ViewManager.textView(text: CharSequence?, init: (@AnkoViewDslMarker android.widget.TextView).() -> Unit): android.widget.TextView {
return ankoView(`$$Anko$Factories$Sdk28View`.TEXT_VIEW, theme = 0) {
init()
setText(text)
}
}
inline fun ViewManager.themedTextView(text: CharSequence?, theme: Int): android.widget.TextView {
return ankoView(`$$Anko$Factories$Sdk28View`.TEXT_VIEW, theme) {
setText(text)
}
}
inline fun ViewManager.themedTextView(text: CharSequence?, theme: Int, init: (@AnkoViewDslMarker android.widget.TextView).() -> Unit): android.widget.TextView {
return ankoView(`$$Anko$Factories$Sdk28View`.TEXT_VIEW, theme) {
init()
setText(text)
}
}
inline fun ViewManager.textView(text: Int): android.widget.TextView {
return ankoView(`$$Anko$Factories$Sdk28View`.TEXT_VIEW, theme = 0) {
setText(text)
}
}
inline fun ViewManager.textView(text: Int, init: (@AnkoViewDslMarker android.widget.TextView).() -> Unit): android.widget.TextView {
return ankoView(`$$Anko$Factories$Sdk28View`.TEXT_VIEW, theme = 0) {
init()
setText(text)
}
}
inline fun ViewManager.themedTextView(text: Int, theme: Int): android.widget.TextView {
return ankoView(`$$Anko$Factories$Sdk28View`.TEXT_VIEW, theme) {
setText(text)
}
}
inline fun ViewManager.themedTextView(text: Int, theme: Int, init: (@AnkoViewDslMarker android.widget.TextView).() -> Unit): android.widget.TextView {
return ankoView(`$$Anko$Factories$Sdk28View`.TEXT_VIEW, theme) {
init()
setText(text)
}
}
inline fun ViewManager.timePicker(): android.widget.TimePicker = timePicker() {}
inline fun ViewManager.timePicker(init: (@AnkoViewDslMarker android.widget.TimePicker).() -> Unit): android.widget.TimePicker {
return ankoView(`$$Anko$Factories$Sdk28View`.TIME_PICKER, theme = 0) { init() }
}
inline fun ViewManager.themedTimePicker(theme: Int = 0): android.widget.TimePicker = themedTimePicker(theme) {}
inline fun ViewManager.themedTimePicker(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.TimePicker).() -> Unit): android.widget.TimePicker {
return ankoView(`$$Anko$Factories$Sdk28View`.TIME_PICKER, theme) { init() }
}
inline fun Context.timePicker(): android.widget.TimePicker = timePicker() {}
inline fun Context.timePicker(init: (@AnkoViewDslMarker android.widget.TimePicker).() -> Unit): android.widget.TimePicker {
return ankoView(`$$Anko$Factories$Sdk28View`.TIME_PICKER, theme = 0) { init() }
}
inline fun Context.themedTimePicker(theme: Int = 0): android.widget.TimePicker = themedTimePicker(theme) {}
inline fun Context.themedTimePicker(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.TimePicker).() -> Unit): android.widget.TimePicker {
return ankoView(`$$Anko$Factories$Sdk28View`.TIME_PICKER, theme) { init() }
}
inline fun Activity.timePicker(): android.widget.TimePicker = timePicker() {}
inline fun Activity.timePicker(init: (@AnkoViewDslMarker android.widget.TimePicker).() -> Unit): android.widget.TimePicker {
return ankoView(`$$Anko$Factories$Sdk28View`.TIME_PICKER, theme = 0) { init() }
}
inline fun Activity.themedTimePicker(theme: Int = 0): android.widget.TimePicker = themedTimePicker(theme) {}
inline fun Activity.themedTimePicker(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.TimePicker).() -> Unit): android.widget.TimePicker {
return ankoView(`$$Anko$Factories$Sdk28View`.TIME_PICKER, theme) { init() }
}
inline fun ViewManager.toggleButton(): android.widget.ToggleButton = toggleButton() {}
inline fun ViewManager.toggleButton(init: (@AnkoViewDslMarker android.widget.ToggleButton).() -> Unit): android.widget.ToggleButton {
return ankoView(`$$Anko$Factories$Sdk28View`.TOGGLE_BUTTON, theme = 0) { init() }
}
inline fun ViewManager.themedToggleButton(theme: Int = 0): android.widget.ToggleButton = themedToggleButton(theme) {}
inline fun ViewManager.themedToggleButton(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.ToggleButton).() -> Unit): android.widget.ToggleButton {
return ankoView(`$$Anko$Factories$Sdk28View`.TOGGLE_BUTTON, theme) { init() }
}
inline fun ViewManager.twoLineListItem(): android.widget.TwoLineListItem = twoLineListItem() {}
inline fun ViewManager.twoLineListItem(init: (@AnkoViewDslMarker android.widget.TwoLineListItem).() -> Unit): android.widget.TwoLineListItem {
return ankoView(`$$Anko$Factories$Sdk28View`.TWO_LINE_LIST_ITEM, theme = 0) { init() }
}
inline fun ViewManager.themedTwoLineListItem(theme: Int = 0): android.widget.TwoLineListItem = themedTwoLineListItem(theme) {}
inline fun ViewManager.themedTwoLineListItem(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.TwoLineListItem).() -> Unit): android.widget.TwoLineListItem {
return ankoView(`$$Anko$Factories$Sdk28View`.TWO_LINE_LIST_ITEM, theme) { init() }
}
inline fun Context.twoLineListItem(): android.widget.TwoLineListItem = twoLineListItem() {}
inline fun Context.twoLineListItem(init: (@AnkoViewDslMarker android.widget.TwoLineListItem).() -> Unit): android.widget.TwoLineListItem {
return ankoView(`$$Anko$Factories$Sdk28View`.TWO_LINE_LIST_ITEM, theme = 0) { init() }
}
inline fun Context.themedTwoLineListItem(theme: Int = 0): android.widget.TwoLineListItem = themedTwoLineListItem(theme) {}
inline fun Context.themedTwoLineListItem(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.TwoLineListItem).() -> Unit): android.widget.TwoLineListItem {
return ankoView(`$$Anko$Factories$Sdk28View`.TWO_LINE_LIST_ITEM, theme) { init() }
}
inline fun Activity.twoLineListItem(): android.widget.TwoLineListItem = twoLineListItem() {}
inline fun Activity.twoLineListItem(init: (@AnkoViewDslMarker android.widget.TwoLineListItem).() -> Unit): android.widget.TwoLineListItem {
return ankoView(`$$Anko$Factories$Sdk28View`.TWO_LINE_LIST_ITEM, theme = 0) { init() }
}
inline fun Activity.themedTwoLineListItem(theme: Int = 0): android.widget.TwoLineListItem = themedTwoLineListItem(theme) {}
inline fun Activity.themedTwoLineListItem(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.TwoLineListItem).() -> Unit): android.widget.TwoLineListItem {
return ankoView(`$$Anko$Factories$Sdk28View`.TWO_LINE_LIST_ITEM, theme) { init() }
}
inline fun ViewManager.videoView(): android.widget.VideoView = videoView() {}
inline fun ViewManager.videoView(init: (@AnkoViewDslMarker android.widget.VideoView).() -> Unit): android.widget.VideoView {
return ankoView(`$$Anko$Factories$Sdk28View`.VIDEO_VIEW, theme = 0) { init() }
}
inline fun ViewManager.themedVideoView(theme: Int = 0): android.widget.VideoView = themedVideoView(theme) {}
inline fun ViewManager.themedVideoView(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.VideoView).() -> Unit): android.widget.VideoView {
return ankoView(`$$Anko$Factories$Sdk28View`.VIDEO_VIEW, theme) { init() }
}
inline fun ViewManager.viewFlipper(): android.widget.ViewFlipper = viewFlipper() {}
inline fun ViewManager.viewFlipper(init: (@AnkoViewDslMarker android.widget.ViewFlipper).() -> Unit): android.widget.ViewFlipper {
return ankoView(`$$Anko$Factories$Sdk28View`.VIEW_FLIPPER, theme = 0) { init() }
}
inline fun ViewManager.themedViewFlipper(theme: Int = 0): android.widget.ViewFlipper = themedViewFlipper(theme) {}
inline fun ViewManager.themedViewFlipper(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.ViewFlipper).() -> Unit): android.widget.ViewFlipper {
return ankoView(`$$Anko$Factories$Sdk28View`.VIEW_FLIPPER, theme) { init() }
}
inline fun Context.viewFlipper(): android.widget.ViewFlipper = viewFlipper() {}
inline fun Context.viewFlipper(init: (@AnkoViewDslMarker android.widget.ViewFlipper).() -> Unit): android.widget.ViewFlipper {
return ankoView(`$$Anko$Factories$Sdk28View`.VIEW_FLIPPER, theme = 0) { init() }
}
inline fun Context.themedViewFlipper(theme: Int = 0): android.widget.ViewFlipper = themedViewFlipper(theme) {}
inline fun Context.themedViewFlipper(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.ViewFlipper).() -> Unit): android.widget.ViewFlipper {
return ankoView(`$$Anko$Factories$Sdk28View`.VIEW_FLIPPER, theme) { init() }
}
inline fun Activity.viewFlipper(): android.widget.ViewFlipper = viewFlipper() {}
inline fun Activity.viewFlipper(init: (@AnkoViewDslMarker android.widget.ViewFlipper).() -> Unit): android.widget.ViewFlipper {
return ankoView(`$$Anko$Factories$Sdk28View`.VIEW_FLIPPER, theme = 0) { init() }
}
inline fun Activity.themedViewFlipper(theme: Int = 0): android.widget.ViewFlipper = themedViewFlipper(theme) {}
inline fun Activity.themedViewFlipper(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.ViewFlipper).() -> Unit): android.widget.ViewFlipper {
return ankoView(`$$Anko$Factories$Sdk28View`.VIEW_FLIPPER, theme) { init() }
}
inline fun ViewManager.zoomButton(): android.widget.ZoomButton = zoomButton() {}
inline fun ViewManager.zoomButton(init: (@AnkoViewDslMarker android.widget.ZoomButton).() -> Unit): android.widget.ZoomButton {
return ankoView(`$$Anko$Factories$Sdk28View`.ZOOM_BUTTON, theme = 0) { init() }
}
inline fun ViewManager.themedZoomButton(theme: Int = 0): android.widget.ZoomButton = themedZoomButton(theme) {}
inline fun ViewManager.themedZoomButton(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.ZoomButton).() -> Unit): android.widget.ZoomButton {
return ankoView(`$$Anko$Factories$Sdk28View`.ZOOM_BUTTON, theme) { init() }
}
inline fun ViewManager.zoomControls(): android.widget.ZoomControls = zoomControls() {}
inline fun ViewManager.zoomControls(init: (@AnkoViewDslMarker android.widget.ZoomControls).() -> Unit): android.widget.ZoomControls {
return ankoView(`$$Anko$Factories$Sdk28View`.ZOOM_CONTROLS, theme = 0) { init() }
}
inline fun ViewManager.themedZoomControls(theme: Int = 0): android.widget.ZoomControls = themedZoomControls(theme) {}
inline fun ViewManager.themedZoomControls(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.ZoomControls).() -> Unit): android.widget.ZoomControls {
return ankoView(`$$Anko$Factories$Sdk28View`.ZOOM_CONTROLS, theme) { init() }
}
inline fun Context.zoomControls(): android.widget.ZoomControls = zoomControls() {}
inline fun Context.zoomControls(init: (@AnkoViewDslMarker android.widget.ZoomControls).() -> Unit): android.widget.ZoomControls {
return ankoView(`$$Anko$Factories$Sdk28View`.ZOOM_CONTROLS, theme = 0) { init() }
}
inline fun Context.themedZoomControls(theme: Int = 0): android.widget.ZoomControls = themedZoomControls(theme) {}
inline fun Context.themedZoomControls(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.ZoomControls).() -> Unit): android.widget.ZoomControls {
return ankoView(`$$Anko$Factories$Sdk28View`.ZOOM_CONTROLS, theme) { init() }
}
inline fun Activity.zoomControls(): android.widget.ZoomControls = zoomControls() {}
inline fun Activity.zoomControls(init: (@AnkoViewDslMarker android.widget.ZoomControls).() -> Unit): android.widget.ZoomControls {
return ankoView(`$$Anko$Factories$Sdk28View`.ZOOM_CONTROLS, theme = 0) { init() }
}
inline fun Activity.themedZoomControls(theme: Int = 0): android.widget.ZoomControls = themedZoomControls(theme) {}
inline fun Activity.themedZoomControls(theme: Int = 0, init: (@AnkoViewDslMarker android.widget.ZoomControls).() -> Unit): android.widget.ZoomControls {
return ankoView(`$$Anko$Factories$Sdk28View`.ZOOM_CONTROLS, theme) { init() }
}
@PublishedApi
internal object `$$Anko$Factories$Sdk28ViewGroup` {
val APP_WIDGET_HOST_VIEW = { ctx: Context -> _AppWidgetHostView(ctx) }
val ABSOLUTE_LAYOUT = { ctx: Context -> _AbsoluteLayout(ctx) }
val ACTION_MENU_VIEW = { ctx: Context -> _ActionMenuView(ctx) }
val FRAME_LAYOUT = { ctx: Context -> _FrameLayout(ctx) }
val GALLERY = { ctx: Context -> _Gallery(ctx) }
val GRID_LAYOUT = { ctx: Context -> _GridLayout(ctx) }
val GRID_VIEW = { ctx: Context -> _GridView(ctx) }
val HORIZONTAL_SCROLL_VIEW = { ctx: Context -> _HorizontalScrollView(ctx) }
val IMAGE_SWITCHER = { ctx: Context -> _ImageSwitcher(ctx) }
val LINEAR_LAYOUT = { ctx: Context -> _LinearLayout(ctx) }
val RADIO_GROUP = { ctx: Context -> _RadioGroup(ctx) }
val RELATIVE_LAYOUT = { ctx: Context -> _RelativeLayout(ctx) }
val SCROLL_VIEW = { ctx: Context -> _ScrollView(ctx) }
val TABLE_LAYOUT = { ctx: Context -> _TableLayout(ctx) }
val TABLE_ROW = { ctx: Context -> _TableRow(ctx) }
val TEXT_SWITCHER = { ctx: Context -> _TextSwitcher(ctx) }
val TOOLBAR = { ctx: Context -> _Toolbar(ctx) }
val VIEW_ANIMATOR = { ctx: Context -> _ViewAnimator(ctx) }
val VIEW_SWITCHER = { ctx: Context -> _ViewSwitcher(ctx) }
}
inline fun ViewManager.appWidgetHostView(): android.appwidget.AppWidgetHostView = appWidgetHostView() {}
inline fun ViewManager.appWidgetHostView(init: (@AnkoViewDslMarker _AppWidgetHostView).() -> Unit): android.appwidget.AppWidgetHostView {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.APP_WIDGET_HOST_VIEW, theme = 0) { init() }
}
inline fun ViewManager.themedAppWidgetHostView(theme: Int = 0): android.appwidget.AppWidgetHostView = themedAppWidgetHostView(theme) {}
inline fun ViewManager.themedAppWidgetHostView(theme: Int = 0, init: (@AnkoViewDslMarker _AppWidgetHostView).() -> Unit): android.appwidget.AppWidgetHostView {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.APP_WIDGET_HOST_VIEW, theme) { init() }
}
inline fun Context.appWidgetHostView(): android.appwidget.AppWidgetHostView = appWidgetHostView() {}
inline fun Context.appWidgetHostView(init: (@AnkoViewDslMarker _AppWidgetHostView).() -> Unit): android.appwidget.AppWidgetHostView {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.APP_WIDGET_HOST_VIEW, theme = 0) { init() }
}
inline fun Context.themedAppWidgetHostView(theme: Int = 0): android.appwidget.AppWidgetHostView = themedAppWidgetHostView(theme) {}
inline fun Context.themedAppWidgetHostView(theme: Int = 0, init: (@AnkoViewDslMarker _AppWidgetHostView).() -> Unit): android.appwidget.AppWidgetHostView {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.APP_WIDGET_HOST_VIEW, theme) { init() }
}
inline fun Activity.appWidgetHostView(): android.appwidget.AppWidgetHostView = appWidgetHostView() {}
inline fun Activity.appWidgetHostView(init: (@AnkoViewDslMarker _AppWidgetHostView).() -> Unit): android.appwidget.AppWidgetHostView {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.APP_WIDGET_HOST_VIEW, theme = 0) { init() }
}
inline fun Activity.themedAppWidgetHostView(theme: Int = 0): android.appwidget.AppWidgetHostView = themedAppWidgetHostView(theme) {}
inline fun Activity.themedAppWidgetHostView(theme: Int = 0, init: (@AnkoViewDslMarker _AppWidgetHostView).() -> Unit): android.appwidget.AppWidgetHostView {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.APP_WIDGET_HOST_VIEW, theme) { init() }
}
inline fun ViewManager.absoluteLayout(): android.widget.AbsoluteLayout = absoluteLayout() {}
inline fun ViewManager.absoluteLayout(init: (@AnkoViewDslMarker _AbsoluteLayout).() -> Unit): android.widget.AbsoluteLayout {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.ABSOLUTE_LAYOUT, theme = 0) { init() }
}
inline fun ViewManager.themedAbsoluteLayout(theme: Int = 0): android.widget.AbsoluteLayout = themedAbsoluteLayout(theme) {}
inline fun ViewManager.themedAbsoluteLayout(theme: Int = 0, init: (@AnkoViewDslMarker _AbsoluteLayout).() -> Unit): android.widget.AbsoluteLayout {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.ABSOLUTE_LAYOUT, theme) { init() }
}
inline fun Context.absoluteLayout(): android.widget.AbsoluteLayout = absoluteLayout() {}
inline fun Context.absoluteLayout(init: (@AnkoViewDslMarker _AbsoluteLayout).() -> Unit): android.widget.AbsoluteLayout {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.ABSOLUTE_LAYOUT, theme = 0) { init() }
}
inline fun Context.themedAbsoluteLayout(theme: Int = 0): android.widget.AbsoluteLayout = themedAbsoluteLayout(theme) {}
inline fun Context.themedAbsoluteLayout(theme: Int = 0, init: (@AnkoViewDslMarker _AbsoluteLayout).() -> Unit): android.widget.AbsoluteLayout {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.ABSOLUTE_LAYOUT, theme) { init() }
}
inline fun Activity.absoluteLayout(): android.widget.AbsoluteLayout = absoluteLayout() {}
inline fun Activity.absoluteLayout(init: (@AnkoViewDslMarker _AbsoluteLayout).() -> Unit): android.widget.AbsoluteLayout {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.ABSOLUTE_LAYOUT, theme = 0) { init() }
}
inline fun Activity.themedAbsoluteLayout(theme: Int = 0): android.widget.AbsoluteLayout = themedAbsoluteLayout(theme) {}
inline fun Activity.themedAbsoluteLayout(theme: Int = 0, init: (@AnkoViewDslMarker _AbsoluteLayout).() -> Unit): android.widget.AbsoluteLayout {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.ABSOLUTE_LAYOUT, theme) { init() }
}
inline fun ViewManager.actionMenuView(): android.widget.ActionMenuView = actionMenuView() {}
inline fun ViewManager.actionMenuView(init: (@AnkoViewDslMarker _ActionMenuView).() -> Unit): android.widget.ActionMenuView {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.ACTION_MENU_VIEW, theme = 0) { init() }
}
inline fun ViewManager.themedActionMenuView(theme: Int = 0): android.widget.ActionMenuView = themedActionMenuView(theme) {}
inline fun ViewManager.themedActionMenuView(theme: Int = 0, init: (@AnkoViewDslMarker _ActionMenuView).() -> Unit): android.widget.ActionMenuView {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.ACTION_MENU_VIEW, theme) { init() }
}
inline fun Context.actionMenuView(): android.widget.ActionMenuView = actionMenuView() {}
inline fun Context.actionMenuView(init: (@AnkoViewDslMarker _ActionMenuView).() -> Unit): android.widget.ActionMenuView {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.ACTION_MENU_VIEW, theme = 0) { init() }
}
inline fun Context.themedActionMenuView(theme: Int = 0): android.widget.ActionMenuView = themedActionMenuView(theme) {}
inline fun Context.themedActionMenuView(theme: Int = 0, init: (@AnkoViewDslMarker _ActionMenuView).() -> Unit): android.widget.ActionMenuView {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.ACTION_MENU_VIEW, theme) { init() }
}
inline fun Activity.actionMenuView(): android.widget.ActionMenuView = actionMenuView() {}
inline fun Activity.actionMenuView(init: (@AnkoViewDslMarker _ActionMenuView).() -> Unit): android.widget.ActionMenuView {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.ACTION_MENU_VIEW, theme = 0) { init() }
}
inline fun Activity.themedActionMenuView(theme: Int = 0): android.widget.ActionMenuView = themedActionMenuView(theme) {}
inline fun Activity.themedActionMenuView(theme: Int = 0, init: (@AnkoViewDslMarker _ActionMenuView).() -> Unit): android.widget.ActionMenuView {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.ACTION_MENU_VIEW, theme) { init() }
}
inline fun ViewManager.frameLayout(): android.widget.FrameLayout = frameLayout() {}
inline fun ViewManager.frameLayout(init: (@AnkoViewDslMarker _FrameLayout).() -> Unit): android.widget.FrameLayout {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.FRAME_LAYOUT, theme = 0) { init() }
}
inline fun ViewManager.themedFrameLayout(theme: Int = 0): android.widget.FrameLayout = themedFrameLayout(theme) {}
inline fun ViewManager.themedFrameLayout(theme: Int = 0, init: (@AnkoViewDslMarker _FrameLayout).() -> Unit): android.widget.FrameLayout {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.FRAME_LAYOUT, theme) { init() }
}
inline fun Context.frameLayout(): android.widget.FrameLayout = frameLayout() {}
inline fun Context.frameLayout(init: (@AnkoViewDslMarker _FrameLayout).() -> Unit): android.widget.FrameLayout {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.FRAME_LAYOUT, theme = 0) { init() }
}
inline fun Context.themedFrameLayout(theme: Int = 0): android.widget.FrameLayout = themedFrameLayout(theme) {}
inline fun Context.themedFrameLayout(theme: Int = 0, init: (@AnkoViewDslMarker _FrameLayout).() -> Unit): android.widget.FrameLayout {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.FRAME_LAYOUT, theme) { init() }
}
inline fun Activity.frameLayout(): android.widget.FrameLayout = frameLayout() {}
inline fun Activity.frameLayout(init: (@AnkoViewDslMarker _FrameLayout).() -> Unit): android.widget.FrameLayout {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.FRAME_LAYOUT, theme = 0) { init() }
}
inline fun Activity.themedFrameLayout(theme: Int = 0): android.widget.FrameLayout = themedFrameLayout(theme) {}
inline fun Activity.themedFrameLayout(theme: Int = 0, init: (@AnkoViewDslMarker _FrameLayout).() -> Unit): android.widget.FrameLayout {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.FRAME_LAYOUT, theme) { init() }
}
inline fun ViewManager.gallery(): android.widget.Gallery = gallery() {}
inline fun ViewManager.gallery(init: (@AnkoViewDslMarker _Gallery).() -> Unit): android.widget.Gallery {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.GALLERY, theme = 0) { init() }
}
inline fun ViewManager.themedGallery(theme: Int = 0): android.widget.Gallery = themedGallery(theme) {}
inline fun ViewManager.themedGallery(theme: Int = 0, init: (@AnkoViewDslMarker _Gallery).() -> Unit): android.widget.Gallery {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.GALLERY, theme) { init() }
}
inline fun Context.gallery(): android.widget.Gallery = gallery() {}
inline fun Context.gallery(init: (@AnkoViewDslMarker _Gallery).() -> Unit): android.widget.Gallery {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.GALLERY, theme = 0) { init() }
}
inline fun Context.themedGallery(theme: Int = 0): android.widget.Gallery = themedGallery(theme) {}
inline fun Context.themedGallery(theme: Int = 0, init: (@AnkoViewDslMarker _Gallery).() -> Unit): android.widget.Gallery {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.GALLERY, theme) { init() }
}
inline fun Activity.gallery(): android.widget.Gallery = gallery() {}
inline fun Activity.gallery(init: (@AnkoViewDslMarker _Gallery).() -> Unit): android.widget.Gallery {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.GALLERY, theme = 0) { init() }
}
inline fun Activity.themedGallery(theme: Int = 0): android.widget.Gallery = themedGallery(theme) {}
inline fun Activity.themedGallery(theme: Int = 0, init: (@AnkoViewDslMarker _Gallery).() -> Unit): android.widget.Gallery {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.GALLERY, theme) { init() }
}
inline fun ViewManager.gridLayout(): android.widget.GridLayout = gridLayout() {}
inline fun ViewManager.gridLayout(init: (@AnkoViewDslMarker _GridLayout).() -> Unit): android.widget.GridLayout {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.GRID_LAYOUT, theme = 0) { init() }
}
inline fun ViewManager.themedGridLayout(theme: Int = 0): android.widget.GridLayout = themedGridLayout(theme) {}
inline fun ViewManager.themedGridLayout(theme: Int = 0, init: (@AnkoViewDslMarker _GridLayout).() -> Unit): android.widget.GridLayout {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.GRID_LAYOUT, theme) { init() }
}
inline fun Context.gridLayout(): android.widget.GridLayout = gridLayout() {}
inline fun Context.gridLayout(init: (@AnkoViewDslMarker _GridLayout).() -> Unit): android.widget.GridLayout {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.GRID_LAYOUT, theme = 0) { init() }
}
inline fun Context.themedGridLayout(theme: Int = 0): android.widget.GridLayout = themedGridLayout(theme) {}
inline fun Context.themedGridLayout(theme: Int = 0, init: (@AnkoViewDslMarker _GridLayout).() -> Unit): android.widget.GridLayout {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.GRID_LAYOUT, theme) { init() }
}
inline fun Activity.gridLayout(): android.widget.GridLayout = gridLayout() {}
inline fun Activity.gridLayout(init: (@AnkoViewDslMarker _GridLayout).() -> Unit): android.widget.GridLayout {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.GRID_LAYOUT, theme = 0) { init() }
}
inline fun Activity.themedGridLayout(theme: Int = 0): android.widget.GridLayout = themedGridLayout(theme) {}
inline fun Activity.themedGridLayout(theme: Int = 0, init: (@AnkoViewDslMarker _GridLayout).() -> Unit): android.widget.GridLayout {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.GRID_LAYOUT, theme) { init() }
}
inline fun ViewManager.gridView(): android.widget.GridView = gridView() {}
inline fun ViewManager.gridView(init: (@AnkoViewDslMarker _GridView).() -> Unit): android.widget.GridView {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.GRID_VIEW, theme = 0) { init() }
}
inline fun ViewManager.themedGridView(theme: Int = 0): android.widget.GridView = themedGridView(theme) {}
inline fun ViewManager.themedGridView(theme: Int = 0, init: (@AnkoViewDslMarker _GridView).() -> Unit): android.widget.GridView {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.GRID_VIEW, theme) { init() }
}
inline fun Context.gridView(): android.widget.GridView = gridView() {}
inline fun Context.gridView(init: (@AnkoViewDslMarker _GridView).() -> Unit): android.widget.GridView {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.GRID_VIEW, theme = 0) { init() }
}
inline fun Context.themedGridView(theme: Int = 0): android.widget.GridView = themedGridView(theme) {}
inline fun Context.themedGridView(theme: Int = 0, init: (@AnkoViewDslMarker _GridView).() -> Unit): android.widget.GridView {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.GRID_VIEW, theme) { init() }
}
inline fun Activity.gridView(): android.widget.GridView = gridView() {}
inline fun Activity.gridView(init: (@AnkoViewDslMarker _GridView).() -> Unit): android.widget.GridView {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.GRID_VIEW, theme = 0) { init() }
}
inline fun Activity.themedGridView(theme: Int = 0): android.widget.GridView = themedGridView(theme) {}
inline fun Activity.themedGridView(theme: Int = 0, init: (@AnkoViewDslMarker _GridView).() -> Unit): android.widget.GridView {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.GRID_VIEW, theme) { init() }
}
inline fun ViewManager.horizontalScrollView(): android.widget.HorizontalScrollView = horizontalScrollView() {}
inline fun ViewManager.horizontalScrollView(init: (@AnkoViewDslMarker _HorizontalScrollView).() -> Unit): android.widget.HorizontalScrollView {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.HORIZONTAL_SCROLL_VIEW, theme = 0) { init() }
}
inline fun ViewManager.themedHorizontalScrollView(theme: Int = 0): android.widget.HorizontalScrollView = themedHorizontalScrollView(theme) {}
inline fun ViewManager.themedHorizontalScrollView(theme: Int = 0, init: (@AnkoViewDslMarker _HorizontalScrollView).() -> Unit): android.widget.HorizontalScrollView {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.HORIZONTAL_SCROLL_VIEW, theme) { init() }
}
inline fun Context.horizontalScrollView(): android.widget.HorizontalScrollView = horizontalScrollView() {}
inline fun Context.horizontalScrollView(init: (@AnkoViewDslMarker _HorizontalScrollView).() -> Unit): android.widget.HorizontalScrollView {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.HORIZONTAL_SCROLL_VIEW, theme = 0) { init() }
}
inline fun Context.themedHorizontalScrollView(theme: Int = 0): android.widget.HorizontalScrollView = themedHorizontalScrollView(theme) {}
inline fun Context.themedHorizontalScrollView(theme: Int = 0, init: (@AnkoViewDslMarker _HorizontalScrollView).() -> Unit): android.widget.HorizontalScrollView {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.HORIZONTAL_SCROLL_VIEW, theme) { init() }
}
inline fun Activity.horizontalScrollView(): android.widget.HorizontalScrollView = horizontalScrollView() {}
inline fun Activity.horizontalScrollView(init: (@AnkoViewDslMarker _HorizontalScrollView).() -> Unit): android.widget.HorizontalScrollView {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.HORIZONTAL_SCROLL_VIEW, theme = 0) { init() }
}
inline fun Activity.themedHorizontalScrollView(theme: Int = 0): android.widget.HorizontalScrollView = themedHorizontalScrollView(theme) {}
inline fun Activity.themedHorizontalScrollView(theme: Int = 0, init: (@AnkoViewDslMarker _HorizontalScrollView).() -> Unit): android.widget.HorizontalScrollView {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.HORIZONTAL_SCROLL_VIEW, theme) { init() }
}
inline fun ViewManager.imageSwitcher(): android.widget.ImageSwitcher = imageSwitcher() {}
inline fun ViewManager.imageSwitcher(init: (@AnkoViewDslMarker _ImageSwitcher).() -> Unit): android.widget.ImageSwitcher {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.IMAGE_SWITCHER, theme = 0) { init() }
}
inline fun ViewManager.themedImageSwitcher(theme: Int = 0): android.widget.ImageSwitcher = themedImageSwitcher(theme) {}
inline fun ViewManager.themedImageSwitcher(theme: Int = 0, init: (@AnkoViewDslMarker _ImageSwitcher).() -> Unit): android.widget.ImageSwitcher {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.IMAGE_SWITCHER, theme) { init() }
}
inline fun Context.imageSwitcher(): android.widget.ImageSwitcher = imageSwitcher() {}
inline fun Context.imageSwitcher(init: (@AnkoViewDslMarker _ImageSwitcher).() -> Unit): android.widget.ImageSwitcher {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.IMAGE_SWITCHER, theme = 0) { init() }
}
inline fun Context.themedImageSwitcher(theme: Int = 0): android.widget.ImageSwitcher = themedImageSwitcher(theme) {}
inline fun Context.themedImageSwitcher(theme: Int = 0, init: (@AnkoViewDslMarker _ImageSwitcher).() -> Unit): android.widget.ImageSwitcher {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.IMAGE_SWITCHER, theme) { init() }
}
inline fun Activity.imageSwitcher(): android.widget.ImageSwitcher = imageSwitcher() {}
inline fun Activity.imageSwitcher(init: (@AnkoViewDslMarker _ImageSwitcher).() -> Unit): android.widget.ImageSwitcher {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.IMAGE_SWITCHER, theme = 0) { init() }
}
inline fun Activity.themedImageSwitcher(theme: Int = 0): android.widget.ImageSwitcher = themedImageSwitcher(theme) {}
inline fun Activity.themedImageSwitcher(theme: Int = 0, init: (@AnkoViewDslMarker _ImageSwitcher).() -> Unit): android.widget.ImageSwitcher {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.IMAGE_SWITCHER, theme) { init() }
}
inline fun ViewManager.linearLayout(): android.widget.LinearLayout = linearLayout() {}
inline fun ViewManager.linearLayout(init: (@AnkoViewDslMarker _LinearLayout).() -> Unit): android.widget.LinearLayout {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.LINEAR_LAYOUT, theme = 0) { init() }
}
inline fun ViewManager.themedLinearLayout(theme: Int = 0): android.widget.LinearLayout = themedLinearLayout(theme) {}
inline fun ViewManager.themedLinearLayout(theme: Int = 0, init: (@AnkoViewDslMarker _LinearLayout).() -> Unit): android.widget.LinearLayout {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.LINEAR_LAYOUT, theme) { init() }
}
inline fun Context.linearLayout(): android.widget.LinearLayout = linearLayout() {}
inline fun Context.linearLayout(init: (@AnkoViewDslMarker _LinearLayout).() -> Unit): android.widget.LinearLayout {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.LINEAR_LAYOUT, theme = 0) { init() }
}
inline fun Context.themedLinearLayout(theme: Int = 0): android.widget.LinearLayout = themedLinearLayout(theme) {}
inline fun Context.themedLinearLayout(theme: Int = 0, init: (@AnkoViewDslMarker _LinearLayout).() -> Unit): android.widget.LinearLayout {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.LINEAR_LAYOUT, theme) { init() }
}
inline fun Activity.linearLayout(): android.widget.LinearLayout = linearLayout() {}
inline fun Activity.linearLayout(init: (@AnkoViewDslMarker _LinearLayout).() -> Unit): android.widget.LinearLayout {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.LINEAR_LAYOUT, theme = 0) { init() }
}
inline fun Activity.themedLinearLayout(theme: Int = 0): android.widget.LinearLayout = themedLinearLayout(theme) {}
inline fun Activity.themedLinearLayout(theme: Int = 0, init: (@AnkoViewDslMarker _LinearLayout).() -> Unit): android.widget.LinearLayout {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.LINEAR_LAYOUT, theme) { init() }
}
inline fun ViewManager.radioGroup(): android.widget.RadioGroup = radioGroup() {}
inline fun ViewManager.radioGroup(init: (@AnkoViewDslMarker _RadioGroup).() -> Unit): android.widget.RadioGroup {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.RADIO_GROUP, theme = 0) { init() }
}
inline fun ViewManager.themedRadioGroup(theme: Int = 0): android.widget.RadioGroup = themedRadioGroup(theme) {}
inline fun ViewManager.themedRadioGroup(theme: Int = 0, init: (@AnkoViewDslMarker _RadioGroup).() -> Unit): android.widget.RadioGroup {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.RADIO_GROUP, theme) { init() }
}
inline fun Context.radioGroup(): android.widget.RadioGroup = radioGroup() {}
inline fun Context.radioGroup(init: (@AnkoViewDslMarker _RadioGroup).() -> Unit): android.widget.RadioGroup {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.RADIO_GROUP, theme = 0) { init() }
}
inline fun Context.themedRadioGroup(theme: Int = 0): android.widget.RadioGroup = themedRadioGroup(theme) {}
inline fun Context.themedRadioGroup(theme: Int = 0, init: (@AnkoViewDslMarker _RadioGroup).() -> Unit): android.widget.RadioGroup {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.RADIO_GROUP, theme) { init() }
}
inline fun Activity.radioGroup(): android.widget.RadioGroup = radioGroup() {}
inline fun Activity.radioGroup(init: (@AnkoViewDslMarker _RadioGroup).() -> Unit): android.widget.RadioGroup {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.RADIO_GROUP, theme = 0) { init() }
}
inline fun Activity.themedRadioGroup(theme: Int = 0): android.widget.RadioGroup = themedRadioGroup(theme) {}
inline fun Activity.themedRadioGroup(theme: Int = 0, init: (@AnkoViewDslMarker _RadioGroup).() -> Unit): android.widget.RadioGroup {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.RADIO_GROUP, theme) { init() }
}
inline fun ViewManager.relativeLayout(): android.widget.RelativeLayout = relativeLayout() {}
inline fun ViewManager.relativeLayout(init: (@AnkoViewDslMarker _RelativeLayout).() -> Unit): android.widget.RelativeLayout {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.RELATIVE_LAYOUT, theme = 0) { init() }
}
inline fun ViewManager.themedRelativeLayout(theme: Int = 0): android.widget.RelativeLayout = themedRelativeLayout(theme) {}
inline fun ViewManager.themedRelativeLayout(theme: Int = 0, init: (@AnkoViewDslMarker _RelativeLayout).() -> Unit): android.widget.RelativeLayout {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.RELATIVE_LAYOUT, theme) { init() }
}
inline fun Context.relativeLayout(): android.widget.RelativeLayout = relativeLayout() {}
inline fun Context.relativeLayout(init: (@AnkoViewDslMarker _RelativeLayout).() -> Unit): android.widget.RelativeLayout {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.RELATIVE_LAYOUT, theme = 0) { init() }
}
inline fun Context.themedRelativeLayout(theme: Int = 0): android.widget.RelativeLayout = themedRelativeLayout(theme) {}
inline fun Context.themedRelativeLayout(theme: Int = 0, init: (@AnkoViewDslMarker _RelativeLayout).() -> Unit): android.widget.RelativeLayout {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.RELATIVE_LAYOUT, theme) { init() }
}
inline fun Activity.relativeLayout(): android.widget.RelativeLayout = relativeLayout() {}
inline fun Activity.relativeLayout(init: (@AnkoViewDslMarker _RelativeLayout).() -> Unit): android.widget.RelativeLayout {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.RELATIVE_LAYOUT, theme = 0) { init() }
}
inline fun Activity.themedRelativeLayout(theme: Int = 0): android.widget.RelativeLayout = themedRelativeLayout(theme) {}
inline fun Activity.themedRelativeLayout(theme: Int = 0, init: (@AnkoViewDslMarker _RelativeLayout).() -> Unit): android.widget.RelativeLayout {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.RELATIVE_LAYOUT, theme) { init() }
}
inline fun ViewManager.scrollView(): android.widget.ScrollView = scrollView() {}
inline fun ViewManager.scrollView(init: (@AnkoViewDslMarker _ScrollView).() -> Unit): android.widget.ScrollView {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.SCROLL_VIEW, theme = 0) { init() }
}
inline fun ViewManager.themedScrollView(theme: Int = 0): android.widget.ScrollView = themedScrollView(theme) {}
inline fun ViewManager.themedScrollView(theme: Int = 0, init: (@AnkoViewDslMarker _ScrollView).() -> Unit): android.widget.ScrollView {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.SCROLL_VIEW, theme) { init() }
}
inline fun Context.scrollView(): android.widget.ScrollView = scrollView() {}
inline fun Context.scrollView(init: (@AnkoViewDslMarker _ScrollView).() -> Unit): android.widget.ScrollView {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.SCROLL_VIEW, theme = 0) { init() }
}
inline fun Context.themedScrollView(theme: Int = 0): android.widget.ScrollView = themedScrollView(theme) {}
inline fun Context.themedScrollView(theme: Int = 0, init: (@AnkoViewDslMarker _ScrollView).() -> Unit): android.widget.ScrollView {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.SCROLL_VIEW, theme) { init() }
}
inline fun Activity.scrollView(): android.widget.ScrollView = scrollView() {}
inline fun Activity.scrollView(init: (@AnkoViewDslMarker _ScrollView).() -> Unit): android.widget.ScrollView {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.SCROLL_VIEW, theme = 0) { init() }
}
inline fun Activity.themedScrollView(theme: Int = 0): android.widget.ScrollView = themedScrollView(theme) {}
inline fun Activity.themedScrollView(theme: Int = 0, init: (@AnkoViewDslMarker _ScrollView).() -> Unit): android.widget.ScrollView {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.SCROLL_VIEW, theme) { init() }
}
inline fun ViewManager.tableLayout(): android.widget.TableLayout = tableLayout() {}
inline fun ViewManager.tableLayout(init: (@AnkoViewDslMarker _TableLayout).() -> Unit): android.widget.TableLayout {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.TABLE_LAYOUT, theme = 0) { init() }
}
inline fun ViewManager.themedTableLayout(theme: Int = 0): android.widget.TableLayout = themedTableLayout(theme) {}
inline fun ViewManager.themedTableLayout(theme: Int = 0, init: (@AnkoViewDslMarker _TableLayout).() -> Unit): android.widget.TableLayout {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.TABLE_LAYOUT, theme) { init() }
}
inline fun Context.tableLayout(): android.widget.TableLayout = tableLayout() {}
inline fun Context.tableLayout(init: (@AnkoViewDslMarker _TableLayout).() -> Unit): android.widget.TableLayout {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.TABLE_LAYOUT, theme = 0) { init() }
}
inline fun Context.themedTableLayout(theme: Int = 0): android.widget.TableLayout = themedTableLayout(theme) {}
inline fun Context.themedTableLayout(theme: Int = 0, init: (@AnkoViewDslMarker _TableLayout).() -> Unit): android.widget.TableLayout {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.TABLE_LAYOUT, theme) { init() }
}
inline fun Activity.tableLayout(): android.widget.TableLayout = tableLayout() {}
inline fun Activity.tableLayout(init: (@AnkoViewDslMarker _TableLayout).() -> Unit): android.widget.TableLayout {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.TABLE_LAYOUT, theme = 0) { init() }
}
inline fun Activity.themedTableLayout(theme: Int = 0): android.widget.TableLayout = themedTableLayout(theme) {}
inline fun Activity.themedTableLayout(theme: Int = 0, init: (@AnkoViewDslMarker _TableLayout).() -> Unit): android.widget.TableLayout {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.TABLE_LAYOUT, theme) { init() }
}
inline fun ViewManager.tableRow(): android.widget.TableRow = tableRow() {}
inline fun ViewManager.tableRow(init: (@AnkoViewDslMarker _TableRow).() -> Unit): android.widget.TableRow {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.TABLE_ROW, theme = 0) { init() }
}
inline fun ViewManager.themedTableRow(theme: Int = 0): android.widget.TableRow = themedTableRow(theme) {}
inline fun ViewManager.themedTableRow(theme: Int = 0, init: (@AnkoViewDslMarker _TableRow).() -> Unit): android.widget.TableRow {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.TABLE_ROW, theme) { init() }
}
inline fun Context.tableRow(): android.widget.TableRow = tableRow() {}
inline fun Context.tableRow(init: (@AnkoViewDslMarker _TableRow).() -> Unit): android.widget.TableRow {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.TABLE_ROW, theme = 0) { init() }
}
inline fun Context.themedTableRow(theme: Int = 0): android.widget.TableRow = themedTableRow(theme) {}
inline fun Context.themedTableRow(theme: Int = 0, init: (@AnkoViewDslMarker _TableRow).() -> Unit): android.widget.TableRow {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.TABLE_ROW, theme) { init() }
}
inline fun Activity.tableRow(): android.widget.TableRow = tableRow() {}
inline fun Activity.tableRow(init: (@AnkoViewDslMarker _TableRow).() -> Unit): android.widget.TableRow {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.TABLE_ROW, theme = 0) { init() }
}
inline fun Activity.themedTableRow(theme: Int = 0): android.widget.TableRow = themedTableRow(theme) {}
inline fun Activity.themedTableRow(theme: Int = 0, init: (@AnkoViewDslMarker _TableRow).() -> Unit): android.widget.TableRow {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.TABLE_ROW, theme) { init() }
}
inline fun ViewManager.textSwitcher(): android.widget.TextSwitcher = textSwitcher() {}
inline fun ViewManager.textSwitcher(init: (@AnkoViewDslMarker _TextSwitcher).() -> Unit): android.widget.TextSwitcher {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.TEXT_SWITCHER, theme = 0) { init() }
}
inline fun ViewManager.themedTextSwitcher(theme: Int = 0): android.widget.TextSwitcher = themedTextSwitcher(theme) {}
inline fun ViewManager.themedTextSwitcher(theme: Int = 0, init: (@AnkoViewDslMarker _TextSwitcher).() -> Unit): android.widget.TextSwitcher {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.TEXT_SWITCHER, theme) { init() }
}
inline fun Context.textSwitcher(): android.widget.TextSwitcher = textSwitcher() {}
inline fun Context.textSwitcher(init: (@AnkoViewDslMarker _TextSwitcher).() -> Unit): android.widget.TextSwitcher {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.TEXT_SWITCHER, theme = 0) { init() }
}
inline fun Context.themedTextSwitcher(theme: Int = 0): android.widget.TextSwitcher = themedTextSwitcher(theme) {}
inline fun Context.themedTextSwitcher(theme: Int = 0, init: (@AnkoViewDslMarker _TextSwitcher).() -> Unit): android.widget.TextSwitcher {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.TEXT_SWITCHER, theme) { init() }
}
inline fun Activity.textSwitcher(): android.widget.TextSwitcher = textSwitcher() {}
inline fun Activity.textSwitcher(init: (@AnkoViewDslMarker _TextSwitcher).() -> Unit): android.widget.TextSwitcher {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.TEXT_SWITCHER, theme = 0) { init() }
}
inline fun Activity.themedTextSwitcher(theme: Int = 0): android.widget.TextSwitcher = themedTextSwitcher(theme) {}
inline fun Activity.themedTextSwitcher(theme: Int = 0, init: (@AnkoViewDslMarker _TextSwitcher).() -> Unit): android.widget.TextSwitcher {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.TEXT_SWITCHER, theme) { init() }
}
inline fun ViewManager.toolbar(): android.widget.Toolbar = toolbar() {}
inline fun ViewManager.toolbar(init: (@AnkoViewDslMarker _Toolbar).() -> Unit): android.widget.Toolbar {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.TOOLBAR, theme = 0) { init() }
}
inline fun ViewManager.themedToolbar(theme: Int = 0): android.widget.Toolbar = themedToolbar(theme) {}
inline fun ViewManager.themedToolbar(theme: Int = 0, init: (@AnkoViewDslMarker _Toolbar).() -> Unit): android.widget.Toolbar {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.TOOLBAR, theme) { init() }
}
inline fun Context.toolbar(): android.widget.Toolbar = toolbar() {}
inline fun Context.toolbar(init: (@AnkoViewDslMarker _Toolbar).() -> Unit): android.widget.Toolbar {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.TOOLBAR, theme = 0) { init() }
}
inline fun Context.themedToolbar(theme: Int = 0): android.widget.Toolbar = themedToolbar(theme) {}
inline fun Context.themedToolbar(theme: Int = 0, init: (@AnkoViewDslMarker _Toolbar).() -> Unit): android.widget.Toolbar {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.TOOLBAR, theme) { init() }
}
inline fun Activity.toolbar(): android.widget.Toolbar = toolbar() {}
inline fun Activity.toolbar(init: (@AnkoViewDslMarker _Toolbar).() -> Unit): android.widget.Toolbar {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.TOOLBAR, theme = 0) { init() }
}
inline fun Activity.themedToolbar(theme: Int = 0): android.widget.Toolbar = themedToolbar(theme) {}
inline fun Activity.themedToolbar(theme: Int = 0, init: (@AnkoViewDslMarker _Toolbar).() -> Unit): android.widget.Toolbar {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.TOOLBAR, theme) { init() }
}
inline fun ViewManager.viewAnimator(): android.widget.ViewAnimator = viewAnimator() {}
inline fun ViewManager.viewAnimator(init: (@AnkoViewDslMarker _ViewAnimator).() -> Unit): android.widget.ViewAnimator {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.VIEW_ANIMATOR, theme = 0) { init() }
}
inline fun ViewManager.themedViewAnimator(theme: Int = 0): android.widget.ViewAnimator = themedViewAnimator(theme) {}
inline fun ViewManager.themedViewAnimator(theme: Int = 0, init: (@AnkoViewDslMarker _ViewAnimator).() -> Unit): android.widget.ViewAnimator {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.VIEW_ANIMATOR, theme) { init() }
}
inline fun Context.viewAnimator(): android.widget.ViewAnimator = viewAnimator() {}
inline fun Context.viewAnimator(init: (@AnkoViewDslMarker _ViewAnimator).() -> Unit): android.widget.ViewAnimator {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.VIEW_ANIMATOR, theme = 0) { init() }
}
inline fun Context.themedViewAnimator(theme: Int = 0): android.widget.ViewAnimator = themedViewAnimator(theme) {}
inline fun Context.themedViewAnimator(theme: Int = 0, init: (@AnkoViewDslMarker _ViewAnimator).() -> Unit): android.widget.ViewAnimator {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.VIEW_ANIMATOR, theme) { init() }
}
inline fun Activity.viewAnimator(): android.widget.ViewAnimator = viewAnimator() {}
inline fun Activity.viewAnimator(init: (@AnkoViewDslMarker _ViewAnimator).() -> Unit): android.widget.ViewAnimator {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.VIEW_ANIMATOR, theme = 0) { init() }
}
inline fun Activity.themedViewAnimator(theme: Int = 0): android.widget.ViewAnimator = themedViewAnimator(theme) {}
inline fun Activity.themedViewAnimator(theme: Int = 0, init: (@AnkoViewDslMarker _ViewAnimator).() -> Unit): android.widget.ViewAnimator {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.VIEW_ANIMATOR, theme) { init() }
}
inline fun ViewManager.viewSwitcher(): android.widget.ViewSwitcher = viewSwitcher() {}
inline fun ViewManager.viewSwitcher(init: (@AnkoViewDslMarker _ViewSwitcher).() -> Unit): android.widget.ViewSwitcher {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.VIEW_SWITCHER, theme = 0) { init() }
}
inline fun ViewManager.themedViewSwitcher(theme: Int = 0): android.widget.ViewSwitcher = themedViewSwitcher(theme) {}
inline fun ViewManager.themedViewSwitcher(theme: Int = 0, init: (@AnkoViewDslMarker _ViewSwitcher).() -> Unit): android.widget.ViewSwitcher {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.VIEW_SWITCHER, theme) { init() }
}
inline fun Context.viewSwitcher(): android.widget.ViewSwitcher = viewSwitcher() {}
inline fun Context.viewSwitcher(init: (@AnkoViewDslMarker _ViewSwitcher).() -> Unit): android.widget.ViewSwitcher {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.VIEW_SWITCHER, theme = 0) { init() }
}
inline fun Context.themedViewSwitcher(theme: Int = 0): android.widget.ViewSwitcher = themedViewSwitcher(theme) {}
inline fun Context.themedViewSwitcher(theme: Int = 0, init: (@AnkoViewDslMarker _ViewSwitcher).() -> Unit): android.widget.ViewSwitcher {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.VIEW_SWITCHER, theme) { init() }
}
inline fun Activity.viewSwitcher(): android.widget.ViewSwitcher = viewSwitcher() {}
inline fun Activity.viewSwitcher(init: (@AnkoViewDslMarker _ViewSwitcher).() -> Unit): android.widget.ViewSwitcher {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.VIEW_SWITCHER, theme = 0) { init() }
}
inline fun Activity.themedViewSwitcher(theme: Int = 0): android.widget.ViewSwitcher = themedViewSwitcher(theme) {}
inline fun Activity.themedViewSwitcher(theme: Int = 0, init: (@AnkoViewDslMarker _ViewSwitcher).() -> Unit): android.widget.ViewSwitcher {
return ankoView(`$$Anko$Factories$Sdk28ViewGroup`.VIEW_SWITCHER, theme) { init() }
}
| anko/library/generated/sdk28/src/main/java/Views.kt | 1589882396 |
/*
* Copyright 2016 Nicolas Fränkel
*
* 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 ch.frankel.kaadin.datainput
import ch.frankel.kaadin.*
import com.vaadin.ui.*
import org.assertj.core.api.Assertions.assertThat
import org.testng.annotations.Test
class SliderTest {
@Test
fun `slider should be added to layout`() {
val layout = horizontalLayout {
slider(min = 0, max = 2, resolution = 1)
}
assertThat(layout.componentCount).isEqualTo(1)
val component = layout.getComponent(0)
assertThat(component).isNotNull.isInstanceOf(Slider::class.java)
}
@Test(dependsOnMethods = ["slider should be added to layout"])
fun `slider mix and max can be initialized through ints`() {
val min = 0.0
val max = 2.0
val resolution = 1
val layout = horizontalLayout {
slider(min = min.toInt(), max = max.toInt(), resolution = resolution)
}
val component = layout.getComponent(0) as Slider
assertThat(component.min).isEqualTo(min)
assertThat(component.max).isEqualTo(max)
assertThat(component.resolution).isEqualTo(resolution)
}
@Test(dependsOnMethods = ["slider should be added to layout"])
fun `slider mix and max can be initialized through doubles`() {
val min = 0.0
val max = 2.0
val layout = horizontalLayout {
slider(min = min, max = max)
}
val component = layout.getComponent(0) as Slider
assertThat(component.min).isEqualTo(min)
assertThat(component.max).isEqualTo(max)
}
@Test(dependsOnMethods = ["slider should be added to layout"])
fun `slider caption can be initialized`() {
val caption = "caption"
val layout = horizontalLayout {
slider(caption, 0.0, 2.0)
}
val component = layout.getComponent(0) as Slider
assertThat(component.caption).isEqualTo(caption)
}
@Test(dependsOnMethods = ["slider should be added to layout"])
fun `slider caption should be configurable`() {
val value = 2.0
val layout = horizontalLayout {
slider(min = 0.0, max = 2.0) {
this.value = value
}
}
val component = layout.getComponent(0) as Slider
assertThat(component.value).isEqualTo(value)
}
} | kaadin-core/src/test/kotlin/ch/frankel/kaadin/datainput/SliderTest.kt | 2095804182 |
package ycj.com.familyledger.view
import android.app.Dialog
import android.content.Context
import android.graphics.drawable.BitmapDrawable
import android.text.Editable
import android.text.InputFilter
import android.text.InputType
import android.text.TextWatcher
import android.view.Gravity
import android.widget.EditText
import android.widget.LinearLayout
import android.widget.TextView
import org.jetbrains.anko.*
import ycj.com.familyledger.R
import ycj.com.familyledger.utils.RegexUtils
import java.text.SimpleDateFormat
import java.util.*
/**
* @author: ycj
* @date: 2017-06-15 15:06
* @version V1.0 <>
*/
class EdxDialog {
companion object {
fun create(): EdxDialog = EdxDialog()
}
fun showEdxDialog(msg: String, context: Context, callBack: DataCallBack) {
val dialog = Dialog(context)
dialog.show()
val wind = dialog.window
wind.setBackgroundDrawable(BitmapDrawable())
val windowMa = context.windowManager
val attri = wind.attributes
attri.width = (windowMa.defaultDisplay.width * 0.75).toInt()
attri.height = (windowMa.defaultDisplay.height * 0.45).toInt()
wind.attributes = attri
var edxDate: EditText? = null
var edxCash: EditText? = null
var tvOk: TextView? = null
val dialogView = context.relativeLayout {
background = context.resources.getDrawable(R.drawable.bg_edx_dialog)
lparams(width = matchParent, height = matchParent) {
topPadding = dip(10)
}
textView(msg) {
gravity = Gravity.CENTER
textSize = sp(5).toFloat()
textColor = context.resources.getColor(R.color.black_text)
}.lparams(width = matchParent, height = dip(40))
linearLayout {
orientation = LinearLayout.VERTICAL
gravity = Gravity.CENTER
edxDate = editText {
id = R.id.edx_date_add
maxLines = 1
textSize = sp(5).toFloat()
inputType = InputType.TYPE_DATETIME_VARIATION_DATE or InputType.TYPE_CLASS_DATETIME
filters = arrayOf<InputFilter>(InputFilter.LengthFilter(10))
background = context.resources.getDrawable(R.drawable.edx_input_bg)
hintTextColor = context.resources.getColor(R.color.gray_text)
hint = "日期模板 2017-06-20"
}.lparams(width = matchParent, height = dip(40)) {
rightMargin = dip(20)
leftMargin = dip(20)
}
edxCash = editText {
id = R.id.edx_cash_add
maxLines = 1
textSize = sp(5).toFloat()
inputType = InputType.TYPE_NUMBER_FLAG_DECIMAL or InputType.TYPE_CLASS_NUMBER
filters = arrayOf<InputFilter>(InputFilter.LengthFilter(8))
background = context.resources.getDrawable(R.drawable.edx_input_bg)
hint = "请输入金额"
hintTextColor = context.resources.getColor(R.color.gray_text)
}.lparams(width = matchParent, height = dip(40)) {
topMargin = dip(20)
rightMargin = dip(20)
leftMargin = dip(20)
}
}.lparams(width = matchParent, height = wrapContent) {
centerInParent()
}
tvOk = textView("确定") {
gravity = Gravity.CENTER
textSize = sp(6).toFloat()
textColor = context.resources.getColor(R.color.btn_text_color_selector)
background = context.resources.getDrawable(R.drawable.bg_btn_bottom_dialog)
}.lparams(width = matchParent, height = dip(40)) {
topMargin = dip(20)
alignParentBottom()
}
}
val date = SimpleDateFormat("yyyy-MM-dd", Locale.CHINA).format(Date())
edxDate?.setText(date)
edxDate?.setSelection(date.length)
tvOk?.setOnClickListener {
val dates = edxDate?.editableText.toString()
val cashs = edxCash?.editableText.toString()
if (dates.length < 6 || cashs == "") {
context.toast("数据有误")
} else if (RegexUtils.create().isDate(dates)) {
callBack.callBack(dates, cashs)
dialog.dismiss()
} else {
context.toast("日期格式不正确")
}
}
edxCash?.addTextChangedListener(object : TextWatcher {
override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {
}
override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {
val res = s.toString()
if (s !is Number && s != ".") return
if (res.length == 1 && res == ".") {
edxCash?.setText("")
return
}
if (res.length == 2 && res.startsWith("0")) {
if (res != "0.") {
edxCash?.setText("0")
edxCash?.setSelection(res.length - 1)
return
}
}
if (res.length == 4 && res.endsWith(".")) {
if (!res.substring(1, res.length - 1).contains(".")) {
} else {
edxCash?.setText(res.substring(0, res.length - 1))
edxCash?.setSelection(res.length - 1)
}
return
}
if (res.length == 4 && res.contains("0.0")) {
if (res.endsWith(".") || res.endsWith("0")) {
edxCash?.setText("0.0")
edxCash?.setSelection(res.length - 1)
}
}
}
override fun afterTextChanged(s: Editable) {
}
})
wind.setContentView(dialogView)
}
interface DataCallBack {
fun callBack(dates: String, cashs: String)
}
}
| app/src/main/java/ycj/com/familyledger/view/EdxDialog.kt | 2041721029 |
/*
* Copyright @ 2018 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.jitsi.jibri.util
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.io.OutputStream
import java.io.PipedInputStream
import java.io.PipedOutputStream
import java.util.concurrent.CopyOnWriteArrayList
import java.util.concurrent.Future
class EndOfStreamException : Exception()
private const val EOF = -1
/**
* Reads from the given [InputStream] and mirrors the read
* data to all of the created 'branches' off of it.
* All branches will 'receive' all data from the original
* [InputStream] starting at the the point of
* the branch's creation.
* NOTE: This class will not read from the given [InputStream]
* automatically, its [read] must be invoked
* to read the data from the original stream and write it to
* the branches
*/
class TeeLogic(inputStream: InputStream) {
private val reader = BufferedReader(InputStreamReader(inputStream))
private var branches = CopyOnWriteArrayList<OutputStream>()
/**
* Reads a byte from the original [InputStream] and
* writes it to all of the branches. If EOF is detected,
* all branches will be closed and [EndOfStreamException]
* will be thrown, so that any callers can know not
* to bother calling again.
*/
fun read() {
val c = reader.read()
if (c == EOF) {
branches.forEach(OutputStream::close)
throw EndOfStreamException()
} else {
branches.forEach { it.write(c) }
}
}
/**
* If you want to close the Tee before the underlying
* [InputStream] closes, you'll need to call [close] to
* properly close all downstream branches. Note that
* calling [read] after [close] when there are branches
* will result in [java.io.IOException].
*/
fun close() {
branches.forEach(OutputStream::close)
}
/**
* Returns an [InputStream] that will receive
* all data from the original [InputStream]
* starting from the time of its creation
*/
fun addBranch(): InputStream {
with(PipedOutputStream()) {
branches.add(this)
return PipedInputStream(this)
}
}
}
/**
* A wrapper around [TeeLogic] which spins up its own thread
* to do the reading automatically
*/
class Tee(inputStream: InputStream) {
private val teeLogic = TeeLogic(inputStream)
private val task: Future<*>
init {
task = TaskPools.ioPool.submit {
while (true) {
teeLogic.read()
}
}
}
fun addBranch(): InputStream {
return teeLogic.addBranch()
}
fun stop() {
task.cancel(true)
teeLogic.close()
}
}
| src/main/kotlin/org/jitsi/jibri/util/Tee.kt | 3098886824 |
package com.androidvip.hebf.ui.internal
import android.os.Bundle
import android.text.method.LinkMovementMethod
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.Toolbar
import com.androidvip.hebf.R
class ThanksActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_thanks)
val toolbar = findViewById<Toolbar>(R.id.toolbar)
setSupportActionBar(toolbar)
supportActionBar?.setDisplayHomeAsUpEnabled(true)
val link1 = findViewById<TextView>(R.id.special_sub)
val link2 = findViewById<TextView>(R.id.special_sub_1)
link1.movementMethod = LinkMovementMethod.getInstance()
link2?.movementMethod = LinkMovementMethod.getInstance()
}
}
| app/src/main/java/com/androidvip/hebf/ui/internal/ThanksActivity.kt | 3962676689 |
package non_test._main_.view
import at.cpickl.gadsu.view.components.DefaultCellView
import at.cpickl.gadsu.view.components.MultiProperties
import at.cpickl.gadsu.view.components.MyListCellRenderer
import non_test.Framed
import javax.swing.JComponent
import javax.swing.JLabel
fun main(args: Array<String>) {
Framed.showWithContextDefaultSize { context ->
MultiProperties<String>(
initialData = 1.rangeTo(10).map { it.toString() },
bus = context.bus,
editorCellRenderer = object : MyListCellRenderer<String>() {
override fun newCell(value: String) = StringCell(value)
},
viewNameId = "x",
createRenderText = { it },
noteEnabled = false
).toComponent()
}
}
private class StringCell(value: String) : DefaultCellView<String>(value) {
private val label = JLabel(value)
override val applicableForegrounds: Array<JComponent> get() = arrayOf(label)
init {
add(label)
}
}
| src/test/kotlin/non_test/_main_/view/MultiProperties.kt | 163326910 |
package com.jaychang.sac
sealed class Error : Throwable()
class AuthenticationError(val code: Int, override val message: String) : Error()
class ClientError(val code: Int, override val message: String) : Error()
class ServerError(val code: Int, override val message: String) : Error()
class NetworkError(val source: Throwable) : Error()
class SSLError(val source: Throwable) : Error() | library/src/main/java/com/jaychang/sac/Error.kt | 1884065741 |
/*
* Copyright 2020 LINE Corporation
*
* LINE Corporation licenses this file to you under the Apache License,
* version 2.0 (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at:
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
package example.armeria.contextpropagation.kotlin
import com.linecorp.armeria.client.WebClient
import com.linecorp.armeria.common.HttpResponse
import com.linecorp.armeria.common.HttpStatus
import com.linecorp.armeria.server.Server
fun main(args: Array<String>) {
val backend = Server.builder()
.service("/square/{num}") { ctx, _ ->
val num = ctx.pathParam("num")?.toLong()
if (num != null) {
HttpResponse.of((num * num).toString())
} else {
HttpResponse.of(HttpStatus.BAD_REQUEST)
}
}
.http(8081)
.build()
val backendClient = WebClient.of("http://localhost:8081")
val frontend = Server.builder()
.http(8080)
.serviceUnder("/", MainService(backendClient))
.build()
Runtime.getRuntime().addShutdownHook(Thread {
backend.stop().join()
frontend.stop().join()
})
backend.start().join()
frontend.start().join()
}
| examples/context-propagation/kotlin/src/main/kotlin/example/armeria/contextpropagation/kotlin/Main.kt | 1443044327 |
package com.makingiants.todayhistory.utils.refresh_layout
import android.content.Context
import android.support.v4.widget.SwipeRefreshLayout
import android.util.AttributeSet
/**
* Use [ScrollEnabler] to know when [CustomScrollSwipeRefreshLayout] can scroll up.
* It's usefull when the mView have multiple inner views that are not inside a [ScrollView]
*/
class CustomScrollSwipeRefreshLayout(context: Context, attrs: AttributeSet) : SwipeRefreshLayout(context, attrs) {
private var mScrollEnabler: ScrollEnabler? = null
fun setScrollEnabler(scrollEnabler: ScrollEnabler?) {
mScrollEnabler = scrollEnabler
}
override fun canChildScrollUp(): Boolean {
if (mScrollEnabler != null) {
return mScrollEnabler!!.canScrollUp()
}
return super.canChildScrollUp()
}
}
| app/src/main/kotlin/com/makingiants/todayhistory/utils/refresh_layout/CustomScrollSwipeRefreshLayout.kt | 1650521173 |
/*
* Copyright 2017 Andrei Heidelbacher <[email protected]>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.andreihh.algostorm.core.drivers.audio
import com.andreihh.algostorm.core.drivers.Driver
import com.andreihh.algostorm.core.drivers.io.Resource
import com.andreihh.algostorm.core.drivers.io.InvalidResourceException
/** A driver that offers audio services. */
interface AudioDriver : Driver, MusicPlayer, SoundPlayer {
/**
* Synchronously loads the given audio stream `resource`, making it
* available to future calls of [playMusic] and [playSound].
*
* If the same resource is loaded multiple times, this method has no effect.
*
* @param resource the sound resource which should be loaded
* @throws InvalidResourceException if any error occurs when parsing and
* loading the `resource`
*/
fun loadAudioStream(resource: Resource<AudioStream>)
}
| algostorm-core/src/main/kotlin/com/andreihh/algostorm/core/drivers/audio/AudioDriver.kt | 1624313863 |
package io.particle.mesh.ui.controlpanel
import android.content.Context
import android.content.Intent
import android.net.Uri
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.core.view.isVisible
import androidx.fragment.app.FragmentActivity
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Observer
import androidx.navigation.fragment.findNavController
import io.particle.android.sdk.cloud.BroadcastContract
import io.particle.android.sdk.cloud.ParticleCloud
import io.particle.android.sdk.cloud.ParticleCloudSDK
import io.particle.android.sdk.cloud.ParticleDevice.ParticleDeviceType
import io.particle.android.sdk.cloud.ParticleDevice.ParticleDeviceType.ARGON
import io.particle.android.sdk.cloud.ParticleDevice.ParticleDeviceType.A_SOM
import io.particle.android.sdk.cloud.ParticleDevice.ParticleDeviceType.B5_SOM
import io.particle.android.sdk.cloud.ParticleDevice.ParticleDeviceType.BLUZ
import io.particle.android.sdk.cloud.ParticleDevice.ParticleDeviceType.BORON
import io.particle.android.sdk.cloud.ParticleDevice.ParticleDeviceType.B_SOM
import io.particle.android.sdk.cloud.ParticleDevice.ParticleDeviceType.CORE
import io.particle.android.sdk.cloud.ParticleDevice.ParticleDeviceType.DIGISTUMP_OAK
import io.particle.android.sdk.cloud.ParticleDevice.ParticleDeviceType.ELECTRON
import io.particle.android.sdk.cloud.ParticleDevice.ParticleDeviceType.ESP32
import io.particle.android.sdk.cloud.ParticleDevice.ParticleDeviceType.OTHER
import io.particle.android.sdk.cloud.ParticleDevice.ParticleDeviceType.P1
import io.particle.android.sdk.cloud.ParticleDevice.ParticleDeviceType.PHOTON
import io.particle.android.sdk.cloud.ParticleDevice.ParticleDeviceType.RASPBERRY_PI
import io.particle.android.sdk.cloud.ParticleDevice.ParticleDeviceType.RED_BEAR_DUO
import io.particle.android.sdk.cloud.ParticleDevice.ParticleDeviceType.XENON
import io.particle.android.sdk.cloud.ParticleDevice.ParticleDeviceType.X_SOM
import io.particle.commonui.DeviceNotesDelegate
import io.particle.commonui.RenameHelper
import io.particle.mesh.common.android.livedata.BroadcastReceiverLD
import io.particle.mesh.setup.flow.FlowRunnerUiListener
import io.particle.mesh.setup.flow.Scopes
import io.particle.mesh.ui.R
import io.particle.mesh.ui.TitleBarOptions
import io.particle.mesh.ui.inflateFragment
import kotlinx.android.synthetic.main.fragment_control_panel_landing.*
import mu.KotlinLogging
class ControlPanelLandingFragment : BaseControlPanelFragment() {
override val titleBarOptions = TitleBarOptions(R.string.p_controlpanel_control_panel)
private lateinit var cloud: ParticleCloud
private lateinit var devicesUpdatedBroadcast: BroadcastReceiverLD<Int>
private val flowManagementScope = Scopes()
private val log = KotlinLogging.logger {}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
cloud = ParticleCloudSDK.getCloud()
var initialValue = 0
devicesUpdatedBroadcast = BroadcastReceiverLD(
requireActivity(),
BroadcastContract.BROADCAST_DEVICES_UPDATED,
{ ++initialValue },
true
)
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return container?.inflateFragment(R.layout.fragment_control_panel_landing)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
devicesUpdatedBroadcast.observe(viewLifecycleOwner, Observer { updateDetails() })
}
override fun onFragmentReady(activity: FragmentActivity, flowUiListener: FlowRunnerUiListener) {
super.onFragmentReady(activity, flowUiListener)
val deviceType = device.deviceType!!
p_controlpanel_landing_name_frame.setOnClickListener {
RenameHelper.renameDevice(activity, device)
}
p_controlpanel_landing_notes_frame.setOnClickListener { editNotes() }
network_info_header.isVisible = deviceType in gen3Devices
p_controlpanel_landing_wifi_item_frame.isVisible = deviceType in listOf(ARGON, A_SOM)
p_controlpanel_landing_wifi_item.setOnClickListener {
flowScopes.onMain {
startFlowWithBarcode(flowRunner::startControlPanelInspectCurrentWifiNetworkFlow)
}
}
p_controlpanel_landing_cellular_item_frame.isVisible = deviceType in listOf(BORON, B_SOM, B5_SOM)
p_controlpanel_landing_cellular_item.setOnClickListener {
flowRunner.startShowControlPanelCellularOptionsFlow(device)
}
p_controlpanel_landing_ethernet_item_frame.isVisible = deviceType in gen3Devices
p_controlpanel_landing_ethernet_item_frame.setOnClickListener {
flowScopes.onMain {
startFlowWithBarcode(flowRunner::startShowControlPanelEthernetOptionsFlow)
}
}
p_controlpanel_landing_mesh_item.isVisible = deviceType in gen3Devices
p_controlpanel_landing_mesh_item.setOnClickListener {
val uri: Uri = Uri.parse(
"https://docs.particle.io/reference/developer-tools/cli/#particle-mesh"
)
val intent = Intent(Intent.ACTION_VIEW, uri)
if (intent.resolveActivity(requireContext().packageManager) != null) {
startActivity(intent)
}
}
p_controlpanel_landing_docs_item.setOnClickListener {
showDocumentation(activity, device.deviceType!!)
}
p_controlpanel_landing_unclaim_item.setOnClickListener {
navigateToUnclaim()
}
}
override fun onResume() {
super.onResume()
updateDetails()
}
override fun onStop() {
super.onStop()
log.info { "onStop()" }
}
private fun updateDetails() {
p_controlpanel_landing_name_value.text = device.name
p_controlpanel_landing_notes_value.text = device.notes
}
private fun navigateToUnclaim() {
flowSystemInterface.showGlobalProgressSpinner(true)
findNavController().navigate(
R.id.action_global_controlPanelUnclaimDeviceFragment,
ControlPanelUnclaimDeviceFragmentArgs(device.name).toBundle()
)
flowSystemInterface.showGlobalProgressSpinner(false)
}
private fun editNotes() {
val editLD = MutableLiveData<String>()
DeviceNotesDelegate.editDeviceNotes(
requireActivity(),
device,
flowManagementScope,
editLD
)
editLD.observe(this, Observer {
p_controlpanel_landing_notes_value.text = it
})
}
}
private val gen3Devices = setOf(
ParticleDeviceType.ARGON,
ParticleDeviceType.A_SOM,
ParticleDeviceType.BORON,
ParticleDeviceType.B_SOM,
ParticleDeviceType.B5_SOM,
ParticleDeviceType.XENON,
ParticleDeviceType.X_SOM
)
private fun showDocumentation(context: Context, deviceType: ParticleDeviceType) {
val finalPathSegment = when (deviceType) {
CORE -> "core"
PHOTON -> "photon"
P1 -> "datasheets/wi-fi/p1-datasheet"
ELECTRON -> "electron"
ARGON, A_SOM -> "argon"
BORON, B_SOM, B5_SOM -> "boron"
XENON, X_SOM -> "xenon"
RASPBERRY_PI,
RED_BEAR_DUO,
BLUZ,
DIGISTUMP_OAK,
ESP32,
OTHER -> null
}
finalPathSegment?.let {
val uri = Uri.parse("https://docs.particle.io/$finalPathSegment")
context.startActivity(Intent(Intent.ACTION_VIEW, uri))
}
}
| meshui/src/main/java/io/particle/mesh/ui/controlpanel/ControlPanelLandingFragment.kt | 1889714309 |
package elite.math.trig
import elite.math.trig.triangle.Adjacent
import elite.math.trig.triangle.Opposite
/**
*
* @author CFerg (Elite)
*/
class Arctangent {
/**
*
*/
var arctangent: Double = 0.toDouble()
/**
*
* @param a
* @param o
*/
constructor(a: Adjacent, o: Opposite) {
this.arctangent = a.adjacent / o.opposite
}
/**
*
* @param tan
*/
constructor(tan: Tangent) {
this.arctangent = 1 / tan.tangent
}
/**
*
* @param cot
*/
constructor(cot: Cotangent) {
this.arctangent = cot.cotangent
}
} | ObjectAvoidance/kotlin/src/elite/math/trig/Arctangent.kt | 845469351 |
/*
* Copyright (c) 2021 toastkidjp.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompany this distribution.
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html.
*/
package jp.toastkid.image.preview.detail
import android.net.Uri
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.core.os.bundleOf
import androidx.exifinterface.media.ExifInterface
import androidx.fragment.app.DialogFragment
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import java.io.File
import java.io.FileInputStream
class ImageDetailFragment : BottomSheetDialogFragment() {
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
super.onCreateView(inflater, container, savedInstanceState)
val context = context ?: return null
val textView = TextView(context)
val imageUri = arguments?.getParcelable<Uri>(KEY_EXTRA_IMAGE_URI) ?: return null
val inputStream = FileInputStream(File(imageUri.toString()))
val exifInterface = ExifInterface(inputStream)
textView.text = ExifInformationExtractorUseCase().invoke(exifInterface)
inputStream.close()
return textView
}
companion object {
private const val KEY_EXTRA_IMAGE_URI = "image_uri"
fun withImageUri(imageUri: Uri): DialogFragment =
ImageDetailFragment().also {
it.arguments = bundleOf(KEY_EXTRA_IMAGE_URI to imageUri)
}
}
} | image/src/main/java/jp/toastkid/image/preview/detail/ImageDetailFragment.kt | 3367078227 |
package com.mewhpm.mewsync.ui
import android.content.Context
import android.util.AttributeSet
import android.util.DisplayMetrics
import android.view.WindowManager
import android.widget.LinearLayout
class FixedHeightLinearLayout : LinearLayout {
constructor(context: Context) : super(context)
constructor(context: Context, attributeSet: AttributeSet?) : super(context, attributeSet)
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr)
var precent = 3.0
var outMetrics = DisplayMetrics()
private val window = this.context.getSystemService(Context.WINDOW_SERVICE) as WindowManager
override fun onAttachedToWindow() {
super.onAttachedToWindow()
outMetrics = DisplayMetrics()
}
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
window.defaultDisplay.getMetrics(outMetrics)
super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(Math.round(outMetrics.heightPixels / precent).toInt(), MeasureSpec.EXACTLY))
}
} | software/MeWSync/app/src/main/java/com/mewhpm/mewsync/ui/FixedHeightLinearLayout.kt | 2455628098 |
/*
* Copyright 2022 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.horologist.networks.okhttp
import com.google.android.horologist.networks.ExperimentalHorologistNetworksApi
import com.google.android.horologist.networks.data.RequestType
import com.google.android.horologist.networks.okhttp.impl.RequestTypeHolder.Companion.withDefaultRequestType
import okhttp3.Call
import okhttp3.Request
/**
* [Call.Factory] wrapper that sets of known [Request.requestType] that a shared
* [NetworkSelectingCallFactory] can make network decisions and bring up high bandwidth networks
* based on the request type.
*/
@ExperimentalHorologistNetworksApi
public class NetworkAwareCallFactory(
private val delegate: Call.Factory,
private val defaultRequestType: RequestType
) : Call.Factory {
override fun newCall(request: Request): Call {
val finalRequest = request.withDefaultRequestType(defaultRequestType)
return delegate.newCall(finalRequest)
}
}
| network-awareness/src/main/java/com/google/android/horologist/networks/okhttp/NetworkAwareCallFactory.kt | 3467572139 |
package com.familyfoundation.li.myapplication.data.db.model
import io.objectbox.annotation.Entity
import io.objectbox.annotation.Id
import io.objectbox.annotation.Index
@Entity
class User {
@Id
private var id: Long = 0
@Index
private var name: String? = null
// Getters and setters for kapt / ObjectBox
fun getId(): Long? {
return id
}
fun getName(): String? {
return name
}
fun setId(idValue : Long) {
id = idValue
}
fun setName(nameValue : String){
name = nameValue
}
}
| app/src/main/java/com/familyfoundation/li/myapplication/data/db/model/User.kt | 1698455459 |
package workflow.response
import model.base.BaseWebserviceResponse
import model.base.WSCode
import model.entity.Item
import org.springframework.http.HttpStatus
import utils.WSString
class ItemsWebserviceResponse(status: HttpStatus,
wsCode: WSCode,
wsCodeValue: String,
reason: String) : BaseWebserviceResponse(status, wsCode, wsCodeValue, reason) {
var items: Iterable<Item>? = null
} | src/main/kotlin/workflow/response/ItemsWebserviceResponse.kt | 298851348 |
package eu.kanade.tachiyomi.data.backup.full
import android.content.Context
import android.net.Uri
import com.hippo.unifile.UniFile
import eu.kanade.tachiyomi.data.backup.AbstractBackupManager
import eu.kanade.tachiyomi.data.backup.BackupCreateService.Companion.BACKUP_CATEGORY
import eu.kanade.tachiyomi.data.backup.BackupCreateService.Companion.BACKUP_CATEGORY_MASK
import eu.kanade.tachiyomi.data.backup.BackupCreateService.Companion.BACKUP_CHAPTER
import eu.kanade.tachiyomi.data.backup.BackupCreateService.Companion.BACKUP_CHAPTER_MASK
import eu.kanade.tachiyomi.data.backup.BackupCreateService.Companion.BACKUP_HISTORY
import eu.kanade.tachiyomi.data.backup.BackupCreateService.Companion.BACKUP_HISTORY_MASK
import eu.kanade.tachiyomi.data.backup.BackupCreateService.Companion.BACKUP_TRACK
import eu.kanade.tachiyomi.data.backup.BackupCreateService.Companion.BACKUP_TRACK_MASK
import eu.kanade.tachiyomi.data.backup.full.models.Backup
import eu.kanade.tachiyomi.data.backup.full.models.BackupCategory
import eu.kanade.tachiyomi.data.backup.full.models.BackupChapter
import eu.kanade.tachiyomi.data.backup.full.models.BackupFull
import eu.kanade.tachiyomi.data.backup.full.models.BackupHistory
import eu.kanade.tachiyomi.data.backup.full.models.BackupManga
import eu.kanade.tachiyomi.data.backup.full.models.BackupSerializer
import eu.kanade.tachiyomi.data.backup.full.models.BackupSource
import eu.kanade.tachiyomi.data.backup.full.models.BackupTracking
import eu.kanade.tachiyomi.data.database.models.Chapter
import eu.kanade.tachiyomi.data.database.models.History
import eu.kanade.tachiyomi.data.database.models.Manga
import eu.kanade.tachiyomi.data.database.models.MangaCategory
import eu.kanade.tachiyomi.data.database.models.Track
import eu.kanade.tachiyomi.util.system.logcat
import kotlinx.serialization.protobuf.ProtoBuf
import logcat.LogPriority
import okio.buffer
import okio.gzip
import okio.sink
import kotlin.math.max
class FullBackupManager(context: Context) : AbstractBackupManager(context) {
val parser = ProtoBuf
/**
* Create backup Json file from database
*
* @param uri path of Uri
* @param isJob backup called from job
*/
override fun createBackup(uri: Uri, flags: Int, isJob: Boolean): String? {
// Create root object
var backup: Backup? = null
databaseHelper.inTransaction {
val databaseManga = getFavoriteManga()
backup = Backup(
backupManga(databaseManga, flags),
backupCategories(),
emptyList(),
backupExtensionInfo(databaseManga)
)
}
try {
val file: UniFile = (
if (isJob) {
// Get dir of file and create
var dir = UniFile.fromUri(context, uri)
dir = dir.createDirectory("automatic")
// Delete older backups
val numberOfBackups = numberOfBackups()
val backupRegex = Regex("""tachiyomi_\d+-\d+-\d+_\d+-\d+.proto.gz""")
dir.listFiles { _, filename -> backupRegex.matches(filename) }
.orEmpty()
.sortedByDescending { it.name }
.drop(numberOfBackups - 1)
.forEach { it.delete() }
// Create new file to place backup
dir.createFile(BackupFull.getDefaultFilename())
} else {
UniFile.fromUri(context, uri)
}
)
?: throw Exception("Couldn't create backup file")
val byteArray = parser.encodeToByteArray(BackupSerializer, backup!!)
file.openOutputStream().sink().gzip().buffer().use { it.write(byteArray) }
val fileUri = file.uri
// Validate it to make sure it works
FullBackupRestoreValidator().validate(context, fileUri)
return fileUri.toString()
} catch (e: Exception) {
logcat(LogPriority.ERROR, e)
throw e
}
}
private fun backupManga(mangas: List<Manga>, flags: Int): List<BackupManga> {
return mangas.map {
backupMangaObject(it, flags)
}
}
private fun backupExtensionInfo(mangas: List<Manga>): List<BackupSource> {
return mangas
.asSequence()
.map { it.source }
.distinct()
.map { sourceManager.getOrStub(it) }
.map { BackupSource.copyFrom(it) }
.toList()
}
/**
* Backup the categories of library
*
* @return list of [BackupCategory] to be backed up
*/
private fun backupCategories(): List<BackupCategory> {
return databaseHelper.getCategories()
.executeAsBlocking()
.map { BackupCategory.copyFrom(it) }
}
/**
* Convert a manga to Json
*
* @param manga manga that gets converted
* @param options options for the backup
* @return [BackupManga] containing manga in a serializable form
*/
private fun backupMangaObject(manga: Manga, options: Int): BackupManga {
// Entry for this manga
val mangaObject = BackupManga.copyFrom(manga)
// Check if user wants chapter information in backup
if (options and BACKUP_CHAPTER_MASK == BACKUP_CHAPTER) {
// Backup all the chapters
val chapters = databaseHelper.getChapters(manga).executeAsBlocking()
if (chapters.isNotEmpty()) {
mangaObject.chapters = chapters.map { BackupChapter.copyFrom(it) }
}
}
// Check if user wants category information in backup
if (options and BACKUP_CATEGORY_MASK == BACKUP_CATEGORY) {
// Backup categories for this manga
val categoriesForManga = databaseHelper.getCategoriesForManga(manga).executeAsBlocking()
if (categoriesForManga.isNotEmpty()) {
mangaObject.categories = categoriesForManga.mapNotNull { it.order }
}
}
// Check if user wants track information in backup
if (options and BACKUP_TRACK_MASK == BACKUP_TRACK) {
val tracks = databaseHelper.getTracks(manga).executeAsBlocking()
if (tracks.isNotEmpty()) {
mangaObject.tracking = tracks.map { BackupTracking.copyFrom(it) }
}
}
// Check if user wants history information in backup
if (options and BACKUP_HISTORY_MASK == BACKUP_HISTORY) {
val historyForManga = databaseHelper.getHistoryByMangaId(manga.id!!).executeAsBlocking()
if (historyForManga.isNotEmpty()) {
val history = historyForManga.mapNotNull { history ->
val url = databaseHelper.getChapter(history.chapter_id).executeAsBlocking()?.url
url?.let { BackupHistory(url, history.last_read) }
}
if (history.isNotEmpty()) {
mangaObject.history = history
}
}
}
return mangaObject
}
fun restoreMangaNoFetch(manga: Manga, dbManga: Manga) {
manga.id = dbManga.id
manga.copyFrom(dbManga)
insertManga(manga)
}
/**
* Fetches manga information
*
* @param manga manga that needs updating
* @return Updated manga info.
*/
fun restoreManga(manga: Manga): Manga {
return manga.also {
it.initialized = it.description != null
it.id = insertManga(it)
}
}
/**
* Restore the categories from Json
*
* @param backupCategories list containing categories
*/
internal fun restoreCategories(backupCategories: List<BackupCategory>) {
// Get categories from file and from db
val dbCategories = databaseHelper.getCategories().executeAsBlocking()
// Iterate over them
backupCategories.map { it.getCategoryImpl() }.forEach { category ->
// Used to know if the category is already in the db
var found = false
for (dbCategory in dbCategories) {
// If the category is already in the db, assign the id to the file's category
// and do nothing
if (category.name == dbCategory.name) {
category.id = dbCategory.id
found = true
break
}
}
// If the category isn't in the db, remove the id and insert a new category
// Store the inserted id in the category
if (!found) {
// Let the db assign the id
category.id = null
val result = databaseHelper.insertCategory(category).executeAsBlocking()
category.id = result.insertedId()?.toInt()
}
}
}
/**
* Restores the categories a manga is in.
*
* @param manga the manga whose categories have to be restored.
* @param categories the categories to restore.
*/
internal fun restoreCategoriesForManga(manga: Manga, categories: List<Int>, backupCategories: List<BackupCategory>) {
val dbCategories = databaseHelper.getCategories().executeAsBlocking()
val mangaCategoriesToUpdate = ArrayList<MangaCategory>(categories.size)
categories.forEach { backupCategoryOrder ->
backupCategories.firstOrNull {
it.order == backupCategoryOrder
}?.let { backupCategory ->
dbCategories.firstOrNull { dbCategory ->
dbCategory.name == backupCategory.name
}?.let { dbCategory ->
mangaCategoriesToUpdate += MangaCategory.create(manga, dbCategory)
}
}
}
// Update database
if (mangaCategoriesToUpdate.isNotEmpty()) {
databaseHelper.deleteOldMangasCategories(listOf(manga)).executeAsBlocking()
databaseHelper.insertMangasCategories(mangaCategoriesToUpdate).executeAsBlocking()
}
}
/**
* Restore history from Json
*
* @param history list containing history to be restored
*/
internal fun restoreHistoryForManga(history: List<BackupHistory>) {
// List containing history to be updated
val historyToBeUpdated = ArrayList<History>(history.size)
for ((url, lastRead) in history) {
val dbHistory = databaseHelper.getHistoryByChapterUrl(url).executeAsBlocking()
// Check if history already in database and update
if (dbHistory != null) {
dbHistory.apply {
last_read = max(lastRead, dbHistory.last_read)
}
historyToBeUpdated.add(dbHistory)
} else {
// If not in database create
databaseHelper.getChapter(url).executeAsBlocking()?.let {
val historyToAdd = History.create(it).apply {
last_read = lastRead
}
historyToBeUpdated.add(historyToAdd)
}
}
}
databaseHelper.updateHistoryLastRead(historyToBeUpdated).executeAsBlocking()
}
/**
* Restores the sync of a manga.
*
* @param manga the manga whose sync have to be restored.
* @param tracks the track list to restore.
*/
internal fun restoreTrackForManga(manga: Manga, tracks: List<Track>) {
// Fix foreign keys with the current manga id
tracks.map { it.manga_id = manga.id!! }
// Get tracks from database
val dbTracks = databaseHelper.getTracks(manga).executeAsBlocking()
val trackToUpdate = mutableListOf<Track>()
tracks.forEach { track ->
var isInDatabase = false
for (dbTrack in dbTracks) {
if (track.sync_id == dbTrack.sync_id) {
// The sync is already in the db, only update its fields
if (track.media_id != dbTrack.media_id) {
dbTrack.media_id = track.media_id
}
if (track.library_id != dbTrack.library_id) {
dbTrack.library_id = track.library_id
}
dbTrack.last_chapter_read = max(dbTrack.last_chapter_read, track.last_chapter_read)
isInDatabase = true
trackToUpdate.add(dbTrack)
break
}
}
if (!isInDatabase) {
// Insert new sync. Let the db assign the id
track.id = null
trackToUpdate.add(track)
}
}
// Update database
if (trackToUpdate.isNotEmpty()) {
databaseHelper.insertTracks(trackToUpdate).executeAsBlocking()
}
}
internal fun restoreChaptersForManga(manga: Manga, chapters: List<Chapter>) {
val dbChapters = databaseHelper.getChapters(manga).executeAsBlocking()
chapters.forEach { chapter ->
val dbChapter = dbChapters.find { it.url == chapter.url }
if (dbChapter != null) {
chapter.id = dbChapter.id
chapter.copyFrom(dbChapter)
if (dbChapter.read && !chapter.read) {
chapter.read = dbChapter.read
chapter.last_page_read = dbChapter.last_page_read
} else if (chapter.last_page_read == 0 && dbChapter.last_page_read != 0) {
chapter.last_page_read = dbChapter.last_page_read
}
if (!chapter.bookmark && dbChapter.bookmark) {
chapter.bookmark = dbChapter.bookmark
}
}
chapter.manga_id = manga.id
}
val newChapters = chapters.groupBy { it.id != null }
newChapters[true]?.let { updateKnownChapters(it) }
newChapters[false]?.let { insertChapters(it) }
}
}
| app/src/main/java/eu/kanade/tachiyomi/data/backup/full/FullBackupManager.kt | 2992322087 |
package org.misuzilla.agqrplayer4tv.component.widget
import android.support.v17.leanback.widget.ImageCardView
import android.util.Log
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
/**
* CommandActionをカード状に表示するPresenterクラスです。
*/
class CommandActionCardPresenter : TypedViewPresenter<ImageCardView, CommandAction>() {
override fun onBindViewHolderWithItem(viewHolder: ViewHolder, view: ImageCardView, item: CommandAction) {
view.apply {
setMainImageDimensions(320, 256)
setMainImageScaleType(ImageView.ScaleType.CENTER)
titleText = item.label1
mainImage = item.icon
item.label2?.let { contentText = it }
}
}
override fun onUnbindViewHolder(viewHolder: ViewHolder, view: ImageCardView) {
}
override fun onCreateView(parent: ViewGroup): ImageCardView {
return ImageCardView(parent.context)
}
} | AgqrPlayer4Tv/app/src/main/java/org/misuzilla/agqrplayer4tv/component/widget/CommandActionCardPresenter.kt | 775099092 |
package y2k.rssreader.components
import android.content.Context
import android.util.AttributeSet
import android.view.View
import android.view.ViewGroup
import android.widget.BaseAdapter
import android.widget.ListView
import android.widget.TextView
import y2k.rssreader.Provider.selectSubscription
import y2k.rssreader.RssSubscription
import y2k.rssreader.getSubscriptions
import y2k.rssreader.toLiveCycleObservable
/**
* Created by y2k on 21/08/16.
*/
class SubscriptionComponent(context: Context, attrs: AttributeSet?) : ListView(context, attrs) {
init {
getSubscriptions()
.toLiveCycleObservable(context)
.subscribe { subs ->
adapter = object : BaseAdapter() {
override fun getView(index: Int, view: View?, parent: ViewGroup?): View {
val v = view ?: View.inflate(context, android.R.layout.simple_list_item_2, null)
val i = subs[index]
(v.findViewById(android.R.id.text1) as TextView).text = i.title
(v.findViewById(android.R.id.text2) as TextView).text = i.url
return v
}
override fun getCount() = subs.size
override fun getItemId(index: Int) = index.toLong()
override fun getItem(index: Int) = TODO()
}
}
setOnItemClickListener { adapterView, view, index, id ->
selectSubscription(adapter.getItem(index) as RssSubscription)
}
}
} | app/src/main/kotlin/y2k/rssreader/components/SubscriptionComponent.kt | 1142464511 |
package org.jetbrains.dokka.android.transformers
import org.jetbrains.dokka.base.transformers.documentables.SuppressedByConditionDocumentableFilterTransformer
import org.jetbrains.dokka.model.Documentable
import org.jetbrains.dokka.model.dfs
import org.jetbrains.dokka.model.doc.CustomTagWrapper
import org.jetbrains.dokka.plugability.DokkaContext
class HideTagDocumentableFilter(val dokkaContext: DokkaContext) :
SuppressedByConditionDocumentableFilterTransformer(dokkaContext) {
override fun shouldBeSuppressed(d: Documentable): Boolean =
d.documentation.any { (_, docs) -> docs.dfs { it is CustomTagWrapper && it.name.trim() == "hide" } != null }
}
| plugins/android-documentation/src/main/kotlin/transformers/HideTagDocumentableFilter.kt | 534329161 |
package transformers
import org.jetbrains.dokka.base.transformers.documentables.ModuleAndPackageDocumentationReader
import org.jetbrains.dokka.base.transformers.documentables.ModuleAndPackageDocumentationTransformer
import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.model.DModule
import org.jetbrains.dokka.model.DPackage
import org.jetbrains.dokka.model.SourceSetDependent
import org.jetbrains.dokka.model.doc.DocumentationNode
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Test
import testApi.testRunner.dPackage
import testApi.testRunner.documentationNode
import testApi.testRunner.sourceSet
class ModuleAndPackageDocumentationTransformerUnitTest {
@Test
fun `empty list of modules`() {
val transformer = ModuleAndPackageDocumentationTransformer(
object : ModuleAndPackageDocumentationReader {
override fun get(module: DModule): SourceSetDependent<DocumentationNode> = throw NotImplementedError()
override fun get(pkg: DPackage): SourceSetDependent<DocumentationNode> = throw NotImplementedError()
}
)
assertEquals(
emptyList<DModule>(), transformer(emptyList()),
)
}
@Test
fun `single module documentation`() {
val transformer = ModuleAndPackageDocumentationTransformer(
object : ModuleAndPackageDocumentationReader {
override fun get(pkg: DPackage): SourceSetDependent<DocumentationNode> = throw NotImplementedError()
override fun get(module: DModule): SourceSetDependent<DocumentationNode> {
return module.sourceSets.associateWith { sourceSet ->
documentationNode("doc" + sourceSet.displayName)
}
}
}
)
val result = transformer(
listOf(
DModule(
"ModuleName",
documentation = emptyMap(),
packages = emptyList(),
sourceSets = setOf(
sourceSet("A"),
sourceSet("B")
)
)
)
)
assertEquals(
DModule(
"ModuleName",
documentation = mapOf(
sourceSet("A") to documentationNode("docA"),
sourceSet("B") to documentationNode("docB")
),
sourceSets = setOf(sourceSet("A"), sourceSet("B")),
packages = emptyList()
),
result.single()
)
}
@Test
fun `merges with already existing module documentation`() {
val transformer = ModuleAndPackageDocumentationTransformer(
object : ModuleAndPackageDocumentationReader {
override fun get(pkg: DPackage): SourceSetDependent<DocumentationNode> = throw NotImplementedError()
override fun get(module: DModule): SourceSetDependent<DocumentationNode> {
/* Only add documentation for first source set */
return module.sourceSets.take(1).associateWith { sourceSet ->
documentationNode("doc" + sourceSet.displayName)
}
}
}
)
val result = transformer(
listOf(
DModule(
"MyModule",
documentation = mapOf(
sourceSet("A") to documentationNode("pre-existing:A"),
sourceSet("B") to documentationNode("pre-existing:B")
),
sourceSets = setOf(sourceSet("A"), sourceSet("B")),
packages = emptyList()
)
)
)
assertEquals(
DModule(
"MyModule",
documentation = mapOf(
/* Expect previous documentation and newly attached one */
sourceSet("A") to documentationNode("pre-existing:A", "docA"),
/* Only first source set will get documentation attached */
sourceSet("B") to documentationNode("pre-existing:B")
),
sourceSets = setOf(sourceSet("A"), sourceSet("B")),
packages = emptyList()
),
result.single()
)
}
@Test
fun `package documentation`() {
val transformer = ModuleAndPackageDocumentationTransformer(
object : ModuleAndPackageDocumentationReader {
override fun get(module: DModule): SourceSetDependent<DocumentationNode> = emptyMap()
override fun get(pkg: DPackage): SourceSetDependent<DocumentationNode> {
/* Only attach documentation to packages with 'attach' */
if ("attach" !in pkg.dri.packageName.orEmpty()) return emptyMap()
/* Only attach documentation to two source sets */
return pkg.sourceSets.take(2).associateWith { sourceSet ->
documentationNode("doc:${sourceSet.displayName}:${pkg.dri.packageName}")
}
}
}
)
val result = transformer(
listOf(
DModule(
"MyModule",
documentation = emptyMap(),
sourceSets = emptySet(),
packages = listOf(
dPackage(
dri = DRI("com.sample"),
documentation = mapOf(
sourceSet("A") to documentationNode("pre-existing:A:com.sample")
),
sourceSets = setOf(sourceSet("A"), sourceSet("B"), sourceSet("C")),
),
dPackage(
dri = DRI("com.attach"),
documentation = mapOf(
sourceSet("A") to documentationNode("pre-existing:A:com.attach")
),
sourceSets = setOf(sourceSet("A"), sourceSet("B"), sourceSet("C"))
),
dPackage(
dri = DRI("com.attach.sub"),
documentation = mapOf(
sourceSet("A") to documentationNode("pre-existing:A:com.attach.sub"),
sourceSet("B") to documentationNode("pre-existing:B:com.attach.sub"),
sourceSet("C") to documentationNode("pre-existing:C:com.attach.sub")
),
sourceSets = setOf(sourceSet("A"), sourceSet("B"), sourceSet("C")),
)
)
)
)
)
result.single().packages.forEach { pkg ->
assertEquals(
setOf(sourceSet("A"), sourceSet("B"), sourceSet("C")), pkg.sourceSets,
"Expected source sets A, B, C for package ${pkg.dri.packageName}"
)
}
val comSample = result.single().packages.single { it.dri.packageName == "com.sample" }
assertEquals(
mapOf(sourceSet("A") to documentationNode("pre-existing:A:com.sample")),
comSample.documentation,
"Expected no documentation added to package 'com.sample' because of wrong package"
)
val comAttach = result.single().packages.single { it.dri.packageName == "com.attach" }
assertEquals(
mapOf(
sourceSet("A") to documentationNode("pre-existing:A:com.attach", "doc:A:com.attach"),
sourceSet("B") to documentationNode("doc:B:com.attach")
),
comAttach.documentation,
"Expected documentation added to source sets A and B"
)
assertEquals(
DModule(
"MyModule",
documentation = emptyMap(),
sourceSets = emptySet(),
packages = listOf(
dPackage(
dri = DRI("com.sample"),
documentation = mapOf(
/* No documentation added, since in wrong package */
sourceSet("A") to documentationNode("pre-existing:A:com.sample")
),
sourceSets = setOf(sourceSet("A"), sourceSet("B"), sourceSet("C")),
),
dPackage(
dri = DRI("com.attach"),
documentation = mapOf(
/* Documentation added */
sourceSet("A") to documentationNode("pre-existing:A:com.attach", "doc:A:com.attach"),
sourceSet("B") to documentationNode("doc:B:com.attach")
),
sourceSets = setOf(sourceSet("A"), sourceSet("B"), sourceSet("C")),
),
dPackage(
dri = DRI("com.attach.sub"),
documentation = mapOf(
/* Documentation added */
sourceSet("A") to documentationNode(
"pre-existing:A:com.attach.sub",
"doc:A:com.attach.sub"
),
/* Documentation added */
sourceSet("B") to documentationNode(
"pre-existing:B:com.attach.sub",
"doc:B:com.attach.sub"
),
/* No documentation added, since in wrong source set */
sourceSet("C") to documentationNode("pre-existing:C:com.attach.sub")
),
sourceSets = setOf(sourceSet("A"), sourceSet("B"), sourceSet("C")),
)
)
), result.single()
)
}
}
| plugins/base/src/test/kotlin/transformers/ModuleAndPackageDocumentationTransformerUnitTest.kt | 366151670 |
package com.hosshan.android.salad.repository.github.entity
import com.google.gson.annotations.SerializedName
data class Tag(
val name: String,
val commit: Commit,
@SerializedName("zipball_url")
val zipballUrl: String,
@SerializedName("tarball_url")
val tarballUrl: String
)
| app/src/main/kotlin/com/hosshan/android/salad/repository/github/entity/Tag.kt | 197164680 |
package renderers.html
import kotlinx.html.body
import kotlinx.html.html
import kotlinx.html.stream.createHTML
import org.jetbrains.dokka.base.renderers.html.buildBreakableText
import org.junit.jupiter.api.Test
import kotlin.test.assertEquals
class FormattingUtilsTest {
@Test
fun `should build breakable text`(){
val testedText = "kotlinx.collections.immutable"
val expectedHtml = """
<html>
<body><span>kotlinx.</span><wbr></wbr><span>collections.</span><wbr></wbr><span>immutable</span></body>
</html>
""".trimIndent()
val html = createHTML(prettyPrint = true).html {
body {
buildBreakableText(testedText)
}
}
assertEquals(expectedHtml.trim(), html.trim())
}
@Test
fun `should build breakable text without empty spans`(){
val testedText = "Package org.jetbrains.dokka.it.moduleC"
val expectedHtml = """
<html>
<body><span><span>Package</span></span> <span>org.</span><wbr></wbr><span>jetbrains.</span><wbr></wbr><span>dokka.</span><wbr></wbr><span>it.</span><wbr></wbr><span>moduleC</span></body>
</html>
""".trimIndent()
val html = createHTML(prettyPrint = true).html {
body {
buildBreakableText(testedText)
}
}
assertEquals(expectedHtml.trim(), html.trim())
}
@Test
fun `should build breakable text for text with braces`(){
val testedText = "[Common]kotlinx.collections.immutable"
val expectedHtml = """
<html>
<body><span>[Common]kotlinx.</span><wbr></wbr><span>collections.</span><wbr></wbr><span>immutable</span></body>
</html>
""".trimIndent()
val html = createHTML(prettyPrint = true).html {
body {
buildBreakableText(testedText)
}
}
assertEquals(expectedHtml.trim(), html.trim())
}
@Test
fun `should build breakable text for camel case notation`(){
val testedText = "DokkkkkkkaIsTheBest"
val expectedHtml = """
<html>
<body><span>Dokkkkkkka</span><wbr></wbr><span>Is</span><wbr></wbr><span>The</span><wbr></wbr><span><span>Best</span></span></body>
</html>
""".trimIndent()
val html = createHTML(prettyPrint = true).html {
body {
buildBreakableText(testedText)
}
}
assertEquals(expectedHtml.trim(), html.trim())
}
} | plugins/base/src/test/kotlin/renderers/html/FormattingUtilsTest.kt | 3209970307 |
package com.github.shynixn.blockball.api.business.annotation
import kotlin.reflect.KClass
/**
* Created by Shynixn 2018.
* <p>
* Version 1.2
* <p>
* MIT License
* <p>
* Copyright (c) 2018 by Shynixn
* <p>
* 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:
* <p>
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* <p>
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
@Retention(AnnotationRetention.RUNTIME)
@Target(AnnotationTarget.FIELD)
annotation class YamlSerialize(
/**
* Name of the target property.
*/
val value: String,
/**
* Order number in the target file.
*/
val orderNumber: Int,
/**
* Custom serialization class.
*/
val customserializer: KClass<*> = Any::class,
/**
* Optional implementation of the class if the type is specified as interface.
*/
val implementation: KClass<*> = Any::class
) | blockball-api/src/main/java/com/github/shynixn/blockball/api/business/annotation/YamlSerialize.kt | 2112137911 |
package com.commit451.gitlab.model.api
import android.os.Parcelable
import com.squareup.moshi.Json
import kotlinx.android.parcel.Parcelize
import java.util.Date
@Parcelize
data class ProjectNamespace(
@Json(name = "id")
var id: Long = 0,
@Json(name = "name")
var name: String? = null,
@Json(name = "path")
var path: String? = null,
@Json(name = "owner_id")
var ownerId: Long = 0,
@Json(name = "created_at")
var createdAt: Date? = null,
@Json(name = "updated_at")
var updatedAt: Date? = null,
@Json(name = "description")
var description: String? = null,
@Json(name = "avatar")
var avatar: Avatar? = null,
@Json(name = "public")
var isPublic: Boolean = false
) : Parcelable {
@Parcelize
data class Avatar(
@Json(name = "url")
var url: String? = null
) : Parcelable
}
| app/src/main/java/com/commit451/gitlab/model/api/ProjectNamespace.kt | 2823602316 |
package net.kibotu.android.recyclerviewpresenter
import androidx.recyclerview.widget.RecyclerView
/**
* Created by [Jan Rabe](https://kibotu.net).
*/
interface IBaseViewHolder {
/**
* [RecyclerView.Adapter.onBindViewHolder]
*/
fun onViewAttachedToWindow() {
}
/**
* [RecyclerView.Adapter.onViewDetachedFromWindow]
*/
fun onViewDetachedFromWindow() {
}
/**
* [RecyclerView.Adapter.onViewRecycled]
*/
fun onViewRecycled() {
}
/**
* [RecyclerView.Adapter.onFailedToRecycleView]
*/
fun onFailedToRecycleView(): Boolean = false
} | lib/src/main/java/net/kibotu/android/recyclerviewpresenter/IBaseViewHolder.kt | 1072668489 |
/*
* Copyright (c) 2017 Fabio Berta
*
* 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 ch.berta.fabio.popularmovies.features.grid.component
import ch.berta.fabio.popularmovies.NavigationTarget
import ch.berta.fabio.popularmovies.R
import ch.berta.fabio.popularmovies.features.details.view.DetailsActivity
import ch.berta.fabio.popularmovies.features.details.view.DetailsArgs
import ch.berta.fabio.popularmovies.features.grid.SortOption
import io.reactivex.Observable
import io.reactivex.functions.BiFunction
const val RQ_DETAILS = 1
fun navigationTargets(actions: Observable<GridAction>): Observable<NavigationTarget> {
val sortSelections = actions
.ofType(GridAction.SortSelection::class.java)
val movieClicks = actions
.ofType(GridAction.MovieClick::class.java)
.withLatestFrom(sortSelections,
BiFunction<GridAction.MovieClick, GridAction.SortSelection, NavigationTarget>
{ (selectedMovie), (sort) ->
val args = DetailsArgs(selectedMovie.id, selectedMovie.title, selectedMovie.releaseDate,
selectedMovie.overview, selectedMovie.voteAverage, selectedMovie.poster,
selectedMovie.backdrop, sort.option == SortOption.SORT_FAVORITE)
NavigationTarget.Activity(DetailsActivity::class.java, args, RQ_DETAILS,
selectedMovie.posterView, R.string.shared_transition_details_poster)
})
val navigationTargets = listOf(movieClicks)
return Observable.merge(navigationTargets)
}
| app/src/main/java/ch/berta/fabio/popularmovies/features/grid/component/Navigation.kt | 981847056 |
package org.team401.lib
import java.io.File
import java.util.ArrayList
object MotionProfileParser {
/**
* Parses a motion profile from a .csv file. Returns an empty profile if any error occurs.
*/
fun parse(name: String, path: String): MotionProfile {
val empty = MotionProfile(name, DoubleArray(0), DoubleArray(0), IntArray(0))
val file = File(path)
val lines = try {
file.readLines()
} catch (e: Exception) {
println("Could not find motion profile $path")
CrashTracker.logThrowableCrash(e)
return empty
}
val positions = ArrayList<Double>()
val speeds = ArrayList<Double>()
val durations = ArrayList<Int>()
try {
lines.forEach {
val entries = it.substring(1, it.length - 3).split(",")
positions.add(entries[0].toDouble())
speeds.add(entries[1].toDouble())
durations.add((entries[2].toDouble() + .5).toInt())
}
} catch (e: Exception) {
print("Could not parse motion profile $path")
CrashTracker.logThrowableCrash(e)
return empty
}
return MotionProfile(name, positions.toDoubleArray(), speeds.toDoubleArray(), durations.toIntArray())
}
} | src/main/java/org/team401/lib/MotionProfileParser.kt | 573032020 |
/*
* Copyright 2019 Google LLC
*
* 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 app.tivi.common.imageloading
import android.app.Application
import app.tivi.appinitializers.AppInitializer
import coil.Coil
import coil.ImageLoader
import coil.annotation.ExperimentalCoilApi
import okhttp3.OkHttpClient
import javax.inject.Inject
@OptIn(ExperimentalCoilApi::class)
class CoilAppInitializer @Inject constructor(
private val application: Application,
private val tmdbImageEntityInterceptor: TmdbImageEntityCoilInterceptor,
private val episodeEntityInterceptor: EpisodeEntityCoilInterceptor,
private val okHttpClient: OkHttpClient
) : AppInitializer {
override fun init() {
Coil.setImageLoader {
ImageLoader.Builder(application)
.components {
add(tmdbImageEntityInterceptor)
add(episodeEntityInterceptor)
}
.okHttpClient(okHttpClient)
.build()
}
}
}
| common/imageloading/src/main/java/app/tivi/common/imageloading/CoilAppInitializer.kt | 482079963 |
package cn.cloudself.model
import javax.persistence.*
/**
* @author HerbLuo
* @version 1.0.0.d
*/
@Entity
@Table(name = "car", schema = "shop")
data class CarEntity(
@get:Id
@get:Column(name = "id", nullable = false)
@get:GeneratedValue(strategy = GenerationType.IDENTITY)
var id: Int = 0,
@get:Basic
@get:Column(name = "user_id", nullable = false)
var userId: Int = 0,
@Suppress("MemberVisibilityCanPrivate")
@get:ManyToOne
@get:JoinColumn(name = "item_id", referencedColumnName = "id", nullable = false)
var item: ItemEntity? = null
) {
constructor(id: Int, item: ItemEntity?) : this() {
this.id = id
this.item = item
}
}
| src/main/java/cn/cloudself/model/CarEntity.kt | 1946607817 |
package wu.seal.jsontokotlin.utils
import com.winterbe.expekt.should
import org.junit.Before
import org.junit.Test
import wu.seal.jsontokotlin.model.ConfigManager
import wu.seal.jsontokotlin.test.TestConfig
class SimplifiedMethodsKtTest {
@Before
fun before() {
TestConfig.setToTestInitState()
}
@Test
fun getIndentTest() {
ConfigManager.indent = 4
val expectedIndent = " "
getIndent().should.be.equal(expectedIndent)
}
@Test
fun getClassesStringListTest() {
val classesStringBlock = """data class Data(
@SerializedName("a") val a: Int? = 0, // 1
@SerializedName("b") val b: String? = "", // ss
@SerializedName("c") val c: C? = C()
)
data class C(
@SerializedName("m") val m: Int? = 0 // 0
)"""
val result = getClassesStringList(classesStringBlock)
result.size.should.be.equal(2)
result[0].should.be.equal(
"""data class Data(
@SerializedName("a") val a: Int? = 0, // 1
@SerializedName("b") val b: String? = "", // ss
@SerializedName("c") val c: C? = C()
)"""
)
result[1].should.be.equal(
"""data class C(
@SerializedName("m") val m: Int? = 0 // 0
)"""
)
}
@Test
fun getClassNameFromClassBlockStringTest() {
val classBlockString = """data class Data(
@SerializedName("a") val a: Int? = 0, // 1
@SerializedName("b") val b: String? = "", // ss
@SerializedName("c") val c: C? = C()
)"""
getClassNameFromClassBlockString(classBlockString).should.be.equal("Data")
}
@Test
fun replaceClassNameToClassBlockStringTest() {
val classBlockString = """data class Data(
@SerializedName("a") val a: Int? = 0, // 1
@SerializedName("b") val b: String? = "", // ss
@SerializedName("c") val c: C? = C()
)"""
val newClassBlockString = """data class DataNew(
@SerializedName("a") val a: Int? = 0, // 1
@SerializedName("b") val b: String? = "", // ss
@SerializedName("c") val c: C? = C()
)"""
replaceClassNameToClassBlockString(classBlockString, "DataNew").should.be.equal(newClassBlockString)
}
@Test
fun firstIndexAfterSpecificIndexTest() {
val list = listOf(1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3)
list.firstIndexAfterSpecificIndex(1,4).should.be.equal(8)
list.firstIndexAfterSpecificIndex(1,8).should.be.equal(-1)
}
@Test
fun getCommentCode() {
val comment = "yes\nheihei"
getCommentCode(comment).should.be.equal("yesheihei")
}
@Test
fun getCommentCode2() {
val comment = "yes\n\rheihei"
getCommentCode(comment).should.be.equal("yesheihei")
}
@Test
fun getCommentCode3() {
val comment = "yes\r\r\n\nheihei"
getCommentCode(comment).should.be.equal("yesheihei")
}
}
| src/test/kotlin/wu/seal/jsontokotlin/utils/SimplifiedMethodsKtTest.kt | 2691021924 |
package org.roylance.yaorm.services.postgres
import org.junit.Test
import org.roylance.yaorm.services.EntityService
import org.roylance.yaorm.services.jdbc.JDBCGranularDatabaseService
import org.roylance.yaorm.utilities.ConnectionUtilities
import org.roylance.yaorm.utilities.common.INestedEnumTest
import org.roylance.yaorm.utilities.common.NestedEnumTestUtilities
class PostgresNestedEnumTest : PostgresBase(), INestedEnumTest {
@Test
override fun simpleMultipleStringsTest() {
if (!ConnectionUtilities.runPostgresTests()) {
return
}
ConnectionUtilities.getPostgresConnectionInfo()
val sourceConnection = PostgresConnectionSourceFactory(
ConnectionUtilities.postgresHost!!,
ConnectionUtilities.postgresPort!!,
ConnectionUtilities.postgresDatabase!!,
ConnectionUtilities.postgresUserName!!,
ConnectionUtilities.postgresPassword!!,
false)
val granularDatabaseService = JDBCGranularDatabaseService(
sourceConnection,
false,
true)
val generatorService = PostgresGeneratorService()
val entityService = EntityService(granularDatabaseService, generatorService)
NestedEnumTestUtilities.simpleMultipleStringsTest(entityService, cleanup())
}
@Test
override fun simplePassThroughExecutionsTest() {
if (!ConnectionUtilities.runPostgresTests()) {
return
}
ConnectionUtilities.getPostgresConnectionInfo()
val sourceConnection = PostgresConnectionSourceFactory(
ConnectionUtilities.postgresHost!!,
ConnectionUtilities.postgresPort!!,
ConnectionUtilities.postgresDatabase!!,
ConnectionUtilities.postgresUserName!!,
ConnectionUtilities.postgresPassword!!,
false)
val granularDatabaseService = JDBCGranularDatabaseService(
sourceConnection,
false,
true)
val generatorService = PostgresGeneratorService()
val entityService = EntityService(granularDatabaseService, generatorService)
NestedEnumTestUtilities.simplePassThroughExecutionsTest(entityService, cleanup())
}
@Test
override fun simplePassThroughTest() {
if (!ConnectionUtilities.runPostgresTests()) {
return
}
NestedEnumTestUtilities.simplePassThroughTest(buildEntityService(), cleanup())
}
@Test
override fun simplePassThroughTest2() {
if (!ConnectionUtilities.runPostgresTests()) {
return
}
NestedEnumTestUtilities.simplePassThroughTest2(buildEntityService(), cleanup())
}
@Test
override fun simpleTablesTest() {
if (!ConnectionUtilities.runPostgresTests()) {
return
}
NestedEnumTestUtilities.simpleTablesTest(buildEntityService(), cleanup(), ConnectionUtilities.postgresDatabase!!)
}
@Test
override fun simpleTableDefinitionTest() {
if (!ConnectionUtilities.runPostgresTests()) {
return
}
NestedEnumTestUtilities.simpleTableDefinitionTest(buildEntityService(), cleanup(), ConnectionUtilities.postgresDatabase!!)
}
@Test
override fun simpleTableDefinitionNullableTest() {
if (!ConnectionUtilities.runPostgresTests()) {
return
}
NestedEnumTestUtilities.simpleTableDefinitionNullableTest(buildEntityService(), cleanup(), ConnectionUtilities.postgresDatabase!!)
}
} | yaorm/src/test/java/org/roylance/yaorm/services/postgres/PostgresNestedEnumTest.kt | 2094144900 |
package com.bnsantos.offline.network
import com.bnsantos.offline.models.Comment
import io.reactivex.Observable
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.Header
import retrofit2.http.POST
interface CommentService {
@GET("/comments/")
fun read(): Observable<List<Comment>>
@POST("/comments/")
fun create(@Header("userId") userId: String, @Body comment: Comment): Observable<Comment>
}
| app/app/src/main/java/com/bnsantos/offline/network/CommentService.kt | 2949665056 |
package eu.kanade.tachiyomi.data.backup
import android.app.Service
import android.content.Context
import android.content.Intent
import android.net.Uri
import android.os.IBinder
import android.os.PowerManager
import com.github.salomonbrys.kotson.fromJson
import com.google.gson.JsonArray
import com.google.gson.JsonParser
import com.google.gson.stream.JsonReader
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.backup.models.Backup.CATEGORIES
import eu.kanade.tachiyomi.data.backup.models.Backup.CHAPTERS
import eu.kanade.tachiyomi.data.backup.models.Backup.HISTORY
import eu.kanade.tachiyomi.data.backup.models.Backup.MANGA
import eu.kanade.tachiyomi.data.backup.models.Backup.MANGAS
import eu.kanade.tachiyomi.data.backup.models.Backup.TRACK
import eu.kanade.tachiyomi.data.backup.models.Backup.VERSION
import eu.kanade.tachiyomi.data.backup.models.DHistory
import eu.kanade.tachiyomi.data.database.DatabaseHelper
import eu.kanade.tachiyomi.data.database.models.*
import eu.kanade.tachiyomi.data.track.TrackManager
import eu.kanade.tachiyomi.source.Source
import eu.kanade.tachiyomi.util.chop
import eu.kanade.tachiyomi.util.isServiceRunning
import eu.kanade.tachiyomi.util.sendLocalBroadcast
import rx.Observable
import rx.Subscription
import rx.schedulers.Schedulers
import timber.log.Timber
import uy.kohesive.injekt.injectLazy
import java.io.File
import java.text.SimpleDateFormat
import java.util.*
import java.util.concurrent.ExecutorService
import java.util.concurrent.Executors
/**
* Restores backup from json file
*/
class BackupRestoreService : Service() {
companion object {
/**
* Returns the status of the service.
*
* @param context the application context.
* @return true if the service is running, false otherwise.
*/
private fun isRunning(context: Context): Boolean =
context.isServiceRunning(BackupRestoreService::class.java)
/**
* Starts a service to restore a backup from Json
*
* @param context context of application
* @param uri path of Uri
*/
fun start(context: Context, uri: Uri) {
if (!isRunning(context)) {
val intent = Intent(context, BackupRestoreService::class.java).apply {
putExtra(BackupConst.EXTRA_URI, uri)
}
context.startService(intent)
}
}
/**
* Stops the service.
*
* @param context the application context.
*/
fun stop(context: Context) {
context.stopService(Intent(context, BackupRestoreService::class.java))
}
}
/**
* Wake lock that will be held until the service is destroyed.
*/
private lateinit var wakeLock: PowerManager.WakeLock
/**
* Subscription where the update is done.
*/
private var subscription: Subscription? = null
/**
* The progress of a backup restore
*/
private var restoreProgress = 0
/**
* Amount of manga in Json file (needed for restore)
*/
private var restoreAmount = 0
/**
* List containing errors
*/
private val errors = mutableListOf<Pair<Date, String>>()
/**
* Backup manager
*/
private lateinit var backupManager: BackupManager
/**
* Database
*/
private val db: DatabaseHelper by injectLazy()
/**
* Tracking manager
*/
internal val trackManager: TrackManager by injectLazy()
private lateinit var executor: ExecutorService
/**
* Method called when the service is created. It injects dependencies and acquire the wake lock.
*/
override fun onCreate() {
super.onCreate()
wakeLock = (getSystemService(Context.POWER_SERVICE) as PowerManager).newWakeLock(
PowerManager.PARTIAL_WAKE_LOCK, "BackupRestoreService:WakeLock")
wakeLock.acquire()
executor = Executors.newSingleThreadExecutor()
}
/**
* Method called when the service is destroyed. It destroys the running subscription and
* releases the wake lock.
*/
override fun onDestroy() {
subscription?.unsubscribe()
executor.shutdown() // must be called after unsubscribe
if (wakeLock.isHeld) {
wakeLock.release()
}
super.onDestroy()
}
/**
* This method needs to be implemented, but it's not used/needed.
*/
override fun onBind(intent: Intent): IBinder? = null
/**
* Method called when the service receives an intent.
*
* @param intent the start intent from.
* @param flags the flags of the command.
* @param startId the start id of this command.
* @return the start value of the command.
*/
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
if (intent == null) return Service.START_NOT_STICKY
val uri = intent.getParcelableExtra<Uri>(BackupConst.EXTRA_URI)
// Unsubscribe from any previous subscription if needed.
subscription?.unsubscribe()
subscription = Observable.using(
{ db.lowLevel().beginTransaction() },
{ getRestoreObservable(uri).doOnNext { db.lowLevel().setTransactionSuccessful() } },
{ executor.execute { db.lowLevel().endTransaction() } })
.doAfterTerminate { stopSelf(startId) }
.subscribeOn(Schedulers.from(executor))
.subscribe()
return Service.START_NOT_STICKY
}
/**
* Returns an [Observable] containing restore process.
*
* @param uri restore file
* @return [Observable<Manga>]
*/
private fun getRestoreObservable(uri: Uri): Observable<List<Manga>> {
val startTime = System.currentTimeMillis()
return Observable.just(Unit)
.map {
val reader = JsonReader(contentResolver.openInputStream(uri).bufferedReader())
val json = JsonParser().parse(reader).asJsonObject
// Get parser version
val version = json.get(VERSION)?.asInt ?: 1
// Initialize manager
backupManager = BackupManager(this, version)
val mangasJson = json.get(MANGAS).asJsonArray
restoreAmount = mangasJson.size() + 1 // +1 for categories
restoreProgress = 0
errors.clear()
// Restore categories
json.get(CATEGORIES)?.let {
backupManager.restoreCategories(it.asJsonArray)
restoreProgress += 1
showRestoreProgress(restoreProgress, restoreAmount, "Categories added", errors.size)
}
mangasJson
}
.flatMap { Observable.from(it) }
.concatMap {
val obj = it.asJsonObject
val manga = backupManager.parser.fromJson<MangaImpl>(obj.get(MANGA))
val chapters = backupManager.parser.fromJson<List<ChapterImpl>>(obj.get(CHAPTERS) ?: JsonArray())
val categories = backupManager.parser.fromJson<List<String>>(obj.get(CATEGORIES) ?: JsonArray())
val history = backupManager.parser.fromJson<List<DHistory>>(obj.get(HISTORY) ?: JsonArray())
val tracks = backupManager.parser.fromJson<List<TrackImpl>>(obj.get(TRACK) ?: JsonArray())
val observable = getMangaRestoreObservable(manga, chapters, categories, history, tracks)
if (observable != null) {
observable
} else {
errors.add(Date() to "${manga.title} - ${getString(R.string.source_not_found)}")
restoreProgress += 1
val content = getString(R.string.dialog_restoring_source_not_found, manga.title.chop(15))
showRestoreProgress(restoreProgress, restoreAmount, manga.title, errors.size, content)
Observable.just(manga)
}
}
.toList()
.doOnNext {
val endTime = System.currentTimeMillis()
val time = endTime - startTime
val logFile = writeErrorLog()
val completeIntent = Intent(BackupConst.INTENT_FILTER).apply {
putExtra(BackupConst.EXTRA_TIME, time)
putExtra(BackupConst.EXTRA_ERRORS, errors.size)
putExtra(BackupConst.EXTRA_ERROR_FILE_PATH, logFile.parent)
putExtra(BackupConst.EXTRA_ERROR_FILE, logFile.name)
putExtra(BackupConst.ACTION, BackupConst.ACTION_RESTORE_COMPLETED_DIALOG)
}
sendLocalBroadcast(completeIntent)
}
.doOnError { error ->
Timber.e(error)
writeErrorLog()
val errorIntent = Intent(BackupConst.INTENT_FILTER).apply {
putExtra(BackupConst.ACTION, BackupConst.ACTION_ERROR_RESTORE_DIALOG)
putExtra(BackupConst.EXTRA_ERROR_MESSAGE, error.message)
}
sendLocalBroadcast(errorIntent)
}
.onErrorReturn { emptyList() }
}
/**
* Write errors to error log
*/
private fun writeErrorLog(): File {
try {
if (errors.isNotEmpty()) {
val destFile = File(externalCacheDir, "tachiyomi_restore.log")
val sdf = SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS", Locale.getDefault())
destFile.bufferedWriter().use { out ->
errors.forEach { (date, message) ->
out.write("[${sdf.format(date)}] $message\n")
}
}
return destFile
}
} catch (e: Exception) {
// Empty
}
return File("")
}
/**
* Returns a manga restore observable
*
* @param manga manga data from json
* @param chapters chapters data from json
* @param categories categories data from json
* @param history history data from json
* @param tracks tracking data from json
* @return [Observable] containing manga restore information
*/
private fun getMangaRestoreObservable(manga: Manga, chapters: List<Chapter>,
categories: List<String>, history: List<DHistory>,
tracks: List<Track>): Observable<Manga>? {
// Get source
val source = backupManager.sourceManager.get(manga.source) ?: return null
val dbManga = backupManager.getMangaFromDatabase(manga)
return if (dbManga == null) {
// Manga not in database
mangaFetchObservable(source, manga, chapters, categories, history, tracks)
} else { // Manga in database
// Copy information from manga already in database
backupManager.restoreMangaNoFetch(manga, dbManga)
// Fetch rest of manga information
mangaNoFetchObservable(source, manga, chapters, categories, history, tracks)
}
}
/**
* [Observable] that fetches manga information
*
* @param manga manga that needs updating
* @param chapters chapters of manga that needs updating
* @param categories categories that need updating
*/
private fun mangaFetchObservable(source: Source, manga: Manga, chapters: List<Chapter>,
categories: List<String>, history: List<DHistory>,
tracks: List<Track>): Observable<Manga> {
return backupManager.restoreMangaFetchObservable(source, manga)
.onErrorReturn {
errors.add(Date() to "${manga.title} - ${it.message}")
manga
}
.filter { it.id != null }
.flatMap {
chapterFetchObservable(source, it, chapters)
// Convert to the manga that contains new chapters.
.map { manga }
}
.doOnNext {
restoreExtraForManga(it, categories, history, tracks)
}
.flatMap {
trackingFetchObservable(it, tracks)
// Convert to the manga that contains new chapters.
.map { manga }
}
.doOnCompleted {
restoreProgress += 1
showRestoreProgress(restoreProgress, restoreAmount, manga.title, errors.size)
}
}
private fun mangaNoFetchObservable(source: Source, backupManga: Manga, chapters: List<Chapter>,
categories: List<String>, history: List<DHistory>,
tracks: List<Track>): Observable<Manga> {
return Observable.just(backupManga)
.flatMap { manga ->
if (!backupManager.restoreChaptersForManga(manga, chapters)) {
chapterFetchObservable(source, manga, chapters)
.map { manga }
} else {
Observable.just(manga)
}
}
.doOnNext {
restoreExtraForManga(it, categories, history, tracks)
}
.flatMap { manga ->
trackingFetchObservable(manga, tracks)
// Convert to the manga that contains new chapters.
.map { manga }
}
.doOnCompleted {
restoreProgress += 1
showRestoreProgress(restoreProgress, restoreAmount, backupManga.title, errors.size)
}
}
private fun restoreExtraForManga(manga: Manga, categories: List<String>, history: List<DHistory>, tracks: List<Track>) {
// Restore categories
backupManager.restoreCategoriesForManga(manga, categories)
// Restore history
backupManager.restoreHistoryForManga(history)
// Restore tracking
backupManager.restoreTrackForManga(manga, tracks)
}
/**
* [Observable] that fetches chapter information
*
* @param source source of manga
* @param manga manga that needs updating
* @return [Observable] that contains manga
*/
private fun chapterFetchObservable(source: Source, manga: Manga, chapters: List<Chapter>): Observable<Pair<List<Chapter>, List<Chapter>>> {
return backupManager.restoreChapterFetchObservable(source, manga, chapters)
// If there's any error, return empty update and continue.
.onErrorReturn {
errors.add(Date() to "${manga.title} - ${it.message}")
Pair(emptyList(), emptyList())
}
}
/**
* [Observable] that refreshes tracking information
* @param manga manga that needs updating.
* @param tracks list containing tracks from restore file.
* @return [Observable] that contains updated track item
*/
private fun trackingFetchObservable(manga: Manga, tracks: List<Track>): Observable<Track> {
return Observable.from(tracks)
.concatMap { track ->
val service = trackManager.getService(track.sync_id)
if (service != null && service.isLogged) {
service.refresh(track)
.doOnNext { db.insertTrack(it).executeAsBlocking() }
.onErrorReturn {
errors.add(Date() to "${manga.title} - ${it.message}")
track
}
} else {
errors.add(Date() to "${manga.title} - ${service?.name} not logged in")
Observable.empty()
}
}
}
/**
* Called to update dialog in [BackupConst]
*
* @param progress restore progress
* @param amount total restoreAmount of manga
* @param title title of restored manga
*/
private fun showRestoreProgress(progress: Int, amount: Int, title: String, errors: Int,
content: String = getString(R.string.dialog_restoring_backup, title.chop(15))) {
val intent = Intent(BackupConst.INTENT_FILTER).apply {
putExtra(BackupConst.EXTRA_PROGRESS, progress)
putExtra(BackupConst.EXTRA_AMOUNT, amount)
putExtra(BackupConst.EXTRA_CONTENT, content)
putExtra(BackupConst.EXTRA_ERRORS, errors)
putExtra(BackupConst.ACTION, BackupConst.ACTION_SET_PROGRESS_DIALOG)
}
sendLocalBroadcast(intent)
}
} | app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupRestoreService.kt | 3484735519 |
package com.devexperts.dxlab.lincheck.verifier.linearizability
/*
* #%L
* Lincheck
* %%
* Copyright (C) 2015 - 2018 Devexperts, LLC
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-3.0.html>.
* #L%
*/
import com.devexperts.dxlab.lincheck.execution.ExecutionResult
import com.devexperts.dxlab.lincheck.execution.ExecutionScenario
import com.devexperts.dxlab.lincheck.verifier.*
/**
* This verifier checks that the specified results could be happen in linearizable execution,
* for what it tries to find a possible linear execution which transitions does not violate both
* regular LTS (see [LTS] and [RegularLTS]) transitions and the happens-before order. Essentially,
* it just tries to execute the next actor in each thread and goes deeper until all actors are executed.
*
* This verifier is based on [AbstractLTSVerifier] and caches the already processed results
* for performance improvement (see [CachedVerifier]).
*/
class LinearizabilityVerifier(scenario: ExecutionScenario, testClass : Class<*>) : AbstractLTSVerifier<RegularLTS.State>(scenario, testClass) {
override fun createInitialContext(results: ExecutionResult): LTSContext<RegularLTS.State>
= LinearizabilityContext(scenario, RegularLTS(testClass).initialState, results)
}
/**
* Next possible states are determined lazily by trying to execute next actor in order for every thread
*
* Current state of scenario execution is represented with the number of actors executed in every thread
*/
private class LinearizabilityContext(scenario: ExecutionScenario,
state: RegularLTS.State,
executed: IntArray,
val results: ExecutionResult
) : LTSContext<RegularLTS.State>(scenario, state, executed) {
constructor(scenario: ExecutionScenario, state: RegularLTS.State, results: ExecutionResult)
: this(scenario, state, IntArray(scenario.threads + 2), results)
override fun nextContexts(threadId: Int): List<LinearizabilityContext> {
// Check if there are unprocessed actors in the specified thread
if (isCompleted(threadId)) return emptyList()
// Check whether an actor from the specified thread can be executed
// in accordance with the rule that all actors from init part should be
// executed at first, after that all actors from parallel part, and
// all actors from post part should be executed at last.
val legal = when (threadId) {
0 -> true // INIT: we already checked that there is an unprocessed actor
in 1 .. scenario.threads -> initCompleted // PARALLEL
else -> initCompleted && parallelCompleted // POST
}
if (!legal) return emptyList()
// Check whether the transition is possible in LTS
val i = executed[threadId]
val nextState = state.next(scenario[threadId][i], results[threadId][i]) ?: return emptyList()
// The transition is possible, create a new context
val nextExecuted = executed.copyOf()
nextExecuted[threadId]++
return listOf(LinearizabilityContext(scenario, nextState, nextExecuted, results))
}
}
| lincheck/src/main/java/com/devexperts/dxlab/lincheck/verifier/linearizability/LinearizabilityVerifier.kt | 1933958433 |
package ii_collections
import util.TODO
fun todoTask24(): Nothing = TODO(
"""
Task 24.
The function should do the same as '_24_JavaCode.doSomethingStrangeWithCollection'.
Replace all invocations of 'todoTask24()' with the appropriate code.
""",
references = { c: Collection<String> -> _24_JavaCode().doSomethingStrangeWithCollection(c) }
)
fun doSomethingStrangeWithCollection(collection: Collection<String>) = collection.groupBy { it.length }.values.maxBy { it.size }
| src/ii_collections/n24ExtensionsOnCollections.kt | 1857535464 |
package com.jara.kotlin_myshare.http
import okhttp3.OkHttpClient
import okhttp3.logging.HttpLoggingInterceptor
import java.util.concurrent.TimeUnit
/**
* Created by jara on 2017-9-20.
*/
object OKHttpClientFactory {
@JvmStatic
fun create() :OkHttpClient{
val loggingInterceptor = HttpLoggingInterceptor()
loggingInterceptor.level = HttpLoggingInterceptor.Level.BODY
val builder = OkHttpClient.Builder()
builder.addInterceptor(loggingInterceptor)
.connectTimeout(60, TimeUnit.SECONDS)
.readTimeout(60, TimeUnit.SECONDS)
.writeTimeout(60, TimeUnit.SECONDS)
return builder.build()
}
} | kotlin_myshare/src/main/java/com/jara/kotlin_myshare/http/OKHttpClientFactory.kt | 2041994562 |
/*
* Copyright (c) 2020. Rei Matsushita
*
* 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.
*/
/* ktlint-disable package-name */
package me.rei_m.hyakuninisshu
class TestApp : App()
| app/src/test/java/me/rei_m/hyakuninisshu/TestApp.kt | 3760663731 |
package com.example.adsl
import android.view.ContextMenu
import android.view.ViewGroup
import android.content.Context
import android.widget.*
import android.app.AlertDialog
import android.widget.LinearLayout.LayoutParams
import android.view.View
var android.app.MediaRouteButton.routeTypes: Int
get() = getRouteTypes()
set(value) = setRouteTypes(value)
val _AppWidgetHostView.appWidgetId: Int
get() = viewGroup.getAppWidgetId()
val _AppWidgetHostView.appWidgetInfo: android.appwidget.AppWidgetProviderInfo?
get() = viewGroup.getAppWidgetInfo()
val _GestureOverlayView.currentStroke: java.util.ArrayList<android.gesture.GesturePoint>
get() = viewGroup.getCurrentStroke()
var _GestureOverlayView.eventsInterceptionEnabled: Boolean
get() = viewGroup.isEventsInterceptionEnabled()
set(value) = viewGroup.setEventsInterceptionEnabled(value)
var _GestureOverlayView.fadeEnabled: Boolean
get() = viewGroup.isFadeEnabled()
set(value) = viewGroup.setFadeEnabled(value)
var _GestureOverlayView.fadeOffset: Long
get() = viewGroup.getFadeOffset()
set(value) = viewGroup.setFadeOffset(value)
var _GestureOverlayView.gesture: android.gesture.Gesture?
get() = viewGroup.getGesture()
set(value) = viewGroup.setGesture(value!!)
var _GestureOverlayView.gestureColor: Int
get() = viewGroup.getGestureColor()
set(value) = viewGroup.setGestureColor(value)
val _GestureOverlayView.gesturePath: android.graphics.Path?
get() = viewGroup.getGesturePath()
var _GestureOverlayView.gestureStrokeAngleThreshold: Float
get() = viewGroup.getGestureStrokeAngleThreshold()
set(value) = viewGroup.setGestureStrokeAngleThreshold(value)
var _GestureOverlayView.gestureStrokeLengthThreshold: Float
get() = viewGroup.getGestureStrokeLengthThreshold()
set(value) = viewGroup.setGestureStrokeLengthThreshold(value)
var _GestureOverlayView.gestureStrokeSquarenessTreshold: Float
get() = viewGroup.getGestureStrokeSquarenessTreshold()
set(value) = viewGroup.setGestureStrokeSquarenessTreshold(value)
var _GestureOverlayView.gestureStrokeType: Int
get() = viewGroup.getGestureStrokeType()
set(value) = viewGroup.setGestureStrokeType(value)
var _GestureOverlayView.gestureStrokeWidth: Float
get() = viewGroup.getGestureStrokeWidth()
set(value) = viewGroup.setGestureStrokeWidth(value)
var _GestureOverlayView.gestureVisible: Boolean
get() = viewGroup.isGestureVisible()
set(value) = viewGroup.setGestureVisible(value)
val _GestureOverlayView.gesturing: Boolean
get() = viewGroup.isGesturing()
var _GestureOverlayView.orientation: Int
get() = viewGroup.getOrientation()
set(value) = viewGroup.setOrientation(value)
var _GestureOverlayView.uncertainGestureColor: Int
get() = viewGroup.getUncertainGestureColor()
set(value) = viewGroup.setUncertainGestureColor(value)
val android.inputmethodservice.ExtractEditText.focused: Boolean
get() = isFocused()
val android.inputmethodservice.ExtractEditText.inputMethodTarget: Boolean
get() = isInputMethodTarget()
var android.inputmethodservice.KeyboardView.keyboard: android.inputmethodservice.Keyboard?
get() = getKeyboard()
set(value) = setKeyboard(value!!)
var android.inputmethodservice.KeyboardView.previewEnabled: Boolean
get() = isPreviewEnabled()
set(value) = setPreviewEnabled(value)
var android.inputmethodservice.KeyboardView.proximityCorrectionEnabled: Boolean
get() = isProximityCorrectionEnabled()
set(value) = setProximityCorrectionEnabled(value)
var android.opengl.GLSurfaceView.debugFlags: Int
get() = getDebugFlags()
set(value) = setDebugFlags(value)
var android.opengl.GLSurfaceView.preserveEGLContextOnPause: Boolean
get() = getPreserveEGLContextOnPause()
set(value) = setPreserveEGLContextOnPause(value)
var android.opengl.GLSurfaceView.renderMode: Int
get() = getRenderMode()
set(value) = setRenderMode(value)
var android.renderscript.RSSurfaceView.renderScriptGL: android.renderscript.RenderScriptGL?
get() = getRenderScriptGL()
set(value) = setRenderScriptGL(value!!)
var android.renderscript.RSTextureView.renderScriptGL: android.renderscript.RenderScriptGL?
get() = getRenderScriptGL()
set(value) = setRenderScriptGL(value!!)
val android.view.SurfaceView.holder: android.view.SurfaceHolder?
get() = getHolder()
val android.view.TextureView.available: Boolean
get() = isAvailable()
val android.view.TextureView.bitmap: android.graphics.Bitmap?
get() = getBitmap()
val android.view.TextureView.layerType: Int
get() = getLayerType()
var android.view.TextureView.opaque: Boolean
get() = isOpaque()
set(value) = setOpaque(value)
var android.view.TextureView.surfaceTexture: android.graphics.SurfaceTexture?
get() = getSurfaceTexture()
set(value) = setSurfaceTexture(value!!)
var android.view.TextureView.surfaceTextureListener: android.view.TextureView.SurfaceTextureListener?
get() = getSurfaceTextureListener()
set(value) = setSurfaceTextureListener(value!!)
var android.view.ViewGroup.alwaysDrawnWithCacheEnabled: Boolean
get() = isAlwaysDrawnWithCacheEnabled()
set(value) = setAlwaysDrawnWithCacheEnabled(value)
var android.view.ViewGroup.animationCacheEnabled: Boolean
get() = isAnimationCacheEnabled()
set(value) = setAnimationCacheEnabled(value)
val android.view.ViewGroup.childCount: Int
get() = getChildCount()
var android.view.ViewGroup.descendantFocusability: Int
get() = getDescendantFocusability()
set(value) = setDescendantFocusability(value)
val android.view.ViewGroup.focusedChild: android.view.View?
get() = getFocusedChild()
var android.view.ViewGroup.layoutAnimation: android.view.animation.LayoutAnimationController?
get() = getLayoutAnimation()
set(value) = setLayoutAnimation(value!!)
var android.view.ViewGroup.layoutAnimationListener: android.view.animation.Animation.AnimationListener?
get() = getLayoutAnimationListener()
set(value) = setLayoutAnimationListener(value!!)
var android.view.ViewGroup.layoutTransition: android.animation.LayoutTransition?
get() = getLayoutTransition()
set(value) = setLayoutTransition(value!!)
var android.view.ViewGroup.motionEventSplittingEnabled: Boolean
get() = isMotionEventSplittingEnabled()
set(value) = setMotionEventSplittingEnabled(value)
var android.view.ViewGroup.persistentDrawingCache: Int
get() = getPersistentDrawingCache()
set(value) = setPersistentDrawingCache(value)
var android.view.ViewStub.inflatedId: Int
get() = getInflatedId()
set(value) = setInflatedId(value)
var android.view.ViewStub.layoutInflater: android.view.LayoutInflater?
get() = getLayoutInflater()
set(value) = setLayoutInflater(value!!)
var android.view.ViewStub.layoutResource: Int
get() = getLayoutResource()
set(value) = setLayoutResource(value)
var _WebView.certificate: android.net.http.SslCertificate?
get() = viewGroup.getCertificate()
set(value) = viewGroup.setCertificate(value!!)
val _WebView.contentHeight: Int
get() = viewGroup.getContentHeight()
val _WebView.favicon: android.graphics.Bitmap?
get() = viewGroup.getFavicon()
val _WebView.hitTestResult: android.webkit.WebView.HitTestResult?
get() = viewGroup.getHitTestResult()
val _WebView.originalUrl: String?
get() = viewGroup.getOriginalUrl()
val _WebView.privateBrowsingEnabled: Boolean
get() = viewGroup.isPrivateBrowsingEnabled()
val _WebView.progress: Int
get() = viewGroup.getProgress()
val _WebView.scale: Float
get() = viewGroup.getScale()
val _WebView.settings: android.webkit.WebSettings?
get() = viewGroup.getSettings()
val _WebView.title: String?
get() = viewGroup.getTitle()
val _WebView.url: String?
get() = viewGroup.getUrl()
var android.widget.AbsSeekBar.keyProgressIncrement: Int
get() = getKeyProgressIncrement()
set(value) = setKeyProgressIncrement(value)
var android.widget.AbsSeekBar.thumb: android.graphics.drawable.Drawable?
get() = getThumb()
set(value) = setThumb(value!!)
var android.widget.AbsSeekBar.thumbOffset: Int
get() = getThumbOffset()
set(value) = setThumbOffset(value)
var _AdapterViewFlipper.autoStart: Boolean
get() = viewGroup.isAutoStart()
set(value) = viewGroup.setAutoStart(value)
var _AdapterViewFlipper.flipInterval: Int
get() = viewGroup.getFlipInterval()
set(value) = viewGroup.setFlipInterval(value)
val _AdapterViewFlipper.flipping: Boolean
get() = viewGroup.isFlipping()
var android.widget.AutoCompleteTextView.completionHint: CharSequence?
get() = getCompletionHint()
set(value) = setCompletionHint(value!!)
var android.widget.AutoCompleteTextView.dropDownAnchor: Int
get() = getDropDownAnchor()
set(value) = setDropDownAnchor(value)
val android.widget.AutoCompleteTextView.dropDownBackground: android.graphics.drawable.Drawable?
get() = getDropDownBackground()
var android.widget.AutoCompleteTextView.dropDownHeight: Int
get() = getDropDownHeight()
set(value) = setDropDownHeight(value)
var android.widget.AutoCompleteTextView.dropDownHorizontalOffset: Int
get() = getDropDownHorizontalOffset()
set(value) = setDropDownHorizontalOffset(value)
var android.widget.AutoCompleteTextView.dropDownVerticalOffset: Int
get() = getDropDownVerticalOffset()
set(value) = setDropDownVerticalOffset(value)
var android.widget.AutoCompleteTextView.dropDownWidth: Int
get() = getDropDownWidth()
set(value) = setDropDownWidth(value)
val android.widget.AutoCompleteTextView.itemClickListener: android.widget.AdapterView.OnItemClickListener?
get() = getItemClickListener()
val android.widget.AutoCompleteTextView.itemSelectedListener: android.widget.AdapterView.OnItemSelectedListener?
get() = getItemSelectedListener()
var android.widget.AutoCompleteTextView.listSelection: Int
get() = getListSelection()
set(value) = setListSelection(value)
var android.widget.AutoCompleteTextView.onItemClickListener: android.widget.AdapterView.OnItemClickListener?
get() = getOnItemClickListener()
set(value) = setOnItemClickListener(value!!)
var android.widget.AutoCompleteTextView.onItemSelectedListener: android.widget.AdapterView.OnItemSelectedListener?
get() = getOnItemSelectedListener()
set(value) = setOnItemSelectedListener(value!!)
val android.widget.AutoCompleteTextView.performingCompletion: Boolean
get() = isPerformingCompletion()
val android.widget.AutoCompleteTextView.popupShowing: Boolean
get() = isPopupShowing()
var android.widget.AutoCompleteTextView.threshold: Int
get() = getThreshold()
set(value) = setThreshold(value)
var android.widget.AutoCompleteTextView.validator: android.widget.AutoCompleteTextView.Validator?
get() = getValidator()
set(value) = setValidator(value!!)
var _CalendarView.date: Long
get() = viewGroup.getDate()
set(value) = viewGroup.setDate(value)
var _CalendarView.dateTextAppearance: Int
get() = viewGroup.getDateTextAppearance()
set(value) = viewGroup.setDateTextAppearance(value)
var _CalendarView.enabled: Boolean
get() = viewGroup.isEnabled()
set(value) = viewGroup.setEnabled(value)
var _CalendarView.firstDayOfWeek: Int
get() = viewGroup.getFirstDayOfWeek()
set(value) = viewGroup.setFirstDayOfWeek(value)
var _CalendarView.focusedMonthDateColor: Int
get() = viewGroup.getFocusedMonthDateColor()
set(value) = viewGroup.setFocusedMonthDateColor(value)
var _CalendarView.maxDate: Long
get() = viewGroup.getMaxDate()
set(value) = viewGroup.setMaxDate(value)
var _CalendarView.minDate: Long
get() = viewGroup.getMinDate()
set(value) = viewGroup.setMinDate(value)
var _CalendarView.selectedDateVerticalBar: android.graphics.drawable.Drawable?
get() = viewGroup.getSelectedDateVerticalBar()
set(value) = viewGroup.setSelectedDateVerticalBar(value!!)
var _CalendarView.selectedWeekBackgroundColor: Int
get() = viewGroup.getSelectedWeekBackgroundColor()
set(value) = viewGroup.setSelectedWeekBackgroundColor(value)
var _CalendarView.showWeekNumber: Boolean
get() = viewGroup.getShowWeekNumber()
set(value) = viewGroup.setShowWeekNumber(value)
var _CalendarView.shownWeekCount: Int
get() = viewGroup.getShownWeekCount()
set(value) = viewGroup.setShownWeekCount(value)
var _CalendarView.unfocusedMonthDateColor: Int
get() = viewGroup.getUnfocusedMonthDateColor()
set(value) = viewGroup.setUnfocusedMonthDateColor(value)
var _CalendarView.weekDayTextAppearance: Int
get() = viewGroup.getWeekDayTextAppearance()
set(value) = viewGroup.setWeekDayTextAppearance(value)
var _CalendarView.weekNumberColor: Int
get() = viewGroup.getWeekNumberColor()
set(value) = viewGroup.setWeekNumberColor(value)
var _CalendarView.weekSeparatorLineColor: Int
get() = viewGroup.getWeekSeparatorLineColor()
set(value) = viewGroup.setWeekSeparatorLineColor(value)
var android.widget.CheckedTextView.checkMarkDrawable: android.graphics.drawable.Drawable?
get() = getCheckMarkDrawable()
set(value) = setCheckMarkDrawable(value!!)
var android.widget.CheckedTextView.checked: Boolean
get() = isChecked()
set(value) = setChecked(value)
var android.widget.Chronometer.base: Long
get() = getBase()
set(value) = setBase(value)
var android.widget.Chronometer.format: String?
get() = getFormat()
set(value) = setFormat(value!!)
var android.widget.Chronometer.onChronometerTickListener: android.widget.Chronometer.OnChronometerTickListener?
get() = getOnChronometerTickListener()
set(value) = setOnChronometerTickListener(value!!)
var android.widget.CompoundButton.checked: Boolean
get() = isChecked()
set(value) = setChecked(value)
val _DatePicker.calendarView: android.widget.CalendarView?
get() = viewGroup.getCalendarView()
var _DatePicker.calendarViewShown: Boolean
get() = viewGroup.getCalendarViewShown()
set(value) = viewGroup.setCalendarViewShown(value)
val _DatePicker.dayOfMonth: Int
get() = viewGroup.getDayOfMonth()
var _DatePicker.enabled: Boolean
get() = viewGroup.isEnabled()
set(value) = viewGroup.setEnabled(value)
var _DatePicker.maxDate: Long
get() = viewGroup.getMaxDate()
set(value) = viewGroup.setMaxDate(value)
var _DatePicker.minDate: Long
get() = viewGroup.getMinDate()
set(value) = viewGroup.setMinDate(value)
val _DatePicker.month: Int
get() = viewGroup.getMonth()
var _DatePicker.spinnersShown: Boolean
get() = viewGroup.getSpinnersShown()
set(value) = viewGroup.setSpinnersShown(value)
val _DatePicker.year: Int
get() = viewGroup.getYear()
val _DialerFilter.digits: CharSequence?
get() = viewGroup.getDigits()
val _DialerFilter.filterText: CharSequence?
get() = viewGroup.getFilterText()
val _DialerFilter.letters: CharSequence?
get() = viewGroup.getLetters()
var _DialerFilter.mode: Int
get() = viewGroup.getMode()
set(value) = viewGroup.setMode(value)
val _DialerFilter.qwertyKeyboard: Boolean
get() = viewGroup.isQwertyKeyboard()
val android.widget.EditText.text: android.text.Editable?
get() = getText()
var _ExpandableListView.adapter: android.widget.ListAdapter?
get() = viewGroup.getAdapter()
set(value) = viewGroup.setAdapter(value!!)
val _ExpandableListView.expandableListAdapter: android.widget.ExpandableListAdapter?
get() = viewGroup.getExpandableListAdapter()
val _ExpandableListView.selectedId: Long
get() = viewGroup.getSelectedId()
val _ExpandableListView.selectedPosition: Long
get() = viewGroup.getSelectedPosition()
val _FrameLayout.considerGoneChildrenWhenMeasuring: Boolean
get() = viewGroup.getConsiderGoneChildrenWhenMeasuring()
var _FrameLayout.foreground: android.graphics.drawable.Drawable?
get() = viewGroup.getForeground()
set(value) = viewGroup.setForeground(value!!)
var _FrameLayout.foregroundGravity: Int
get() = viewGroup.getForegroundGravity()
set(value) = viewGroup.setForegroundGravity(value)
var _FrameLayout.measureAllChildren: Boolean
get() = viewGroup.getMeasureAllChildren()
set(value) = viewGroup.setMeasureAllChildren(value)
var _GridLayout.alignmentMode: Int
get() = viewGroup.getAlignmentMode()
set(value) = viewGroup.setAlignmentMode(value)
var _GridLayout.columnCount: Int
get() = viewGroup.getColumnCount()
set(value) = viewGroup.setColumnCount(value)
var _GridLayout.columnOrderPreserved: Boolean
get() = viewGroup.isColumnOrderPreserved()
set(value) = viewGroup.setColumnOrderPreserved(value)
var _GridLayout.orientation: Int
get() = viewGroup.getOrientation()
set(value) = viewGroup.setOrientation(value)
var _GridLayout.rowCount: Int
get() = viewGroup.getRowCount()
set(value) = viewGroup.setRowCount(value)
var _GridLayout.rowOrderPreserved: Boolean
get() = viewGroup.isRowOrderPreserved()
set(value) = viewGroup.setRowOrderPreserved(value)
var _GridLayout.useDefaultMargins: Boolean
get() = viewGroup.getUseDefaultMargins()
set(value) = viewGroup.setUseDefaultMargins(value)
var _GridView.adapter: android.widget.ListAdapter?
get() = viewGroup.getAdapter()
set(value) = viewGroup.setAdapter(value!!)
var _GridView.columnWidth: Int
get() = viewGroup.getColumnWidth()
set(value) = viewGroup.setColumnWidth(value)
var _GridView.gravity: Int
get() = viewGroup.getGravity()
set(value) = viewGroup.setGravity(value)
var _GridView.horizontalSpacing: Int
get() = viewGroup.getHorizontalSpacing()
set(value) = viewGroup.setHorizontalSpacing(value)
var _GridView.numColumns: Int
get() = viewGroup.getNumColumns()
set(value) = viewGroup.setNumColumns(value)
val _GridView.requestedColumnWidth: Int
get() = viewGroup.getRequestedColumnWidth()
val _GridView.requestedHorizontalSpacing: Int
get() = viewGroup.getRequestedHorizontalSpacing()
var _GridView.stretchMode: Int
get() = viewGroup.getStretchMode()
set(value) = viewGroup.setStretchMode(value)
var _GridView.verticalSpacing: Int
get() = viewGroup.getVerticalSpacing()
set(value) = viewGroup.setVerticalSpacing(value)
var _HorizontalScrollView.fillViewport: Boolean
get() = viewGroup.isFillViewport()
set(value) = viewGroup.setFillViewport(value)
val _HorizontalScrollView.maxScrollAmount: Int
get() = viewGroup.getMaxScrollAmount()
var _HorizontalScrollView.smoothScrollingEnabled: Boolean
get() = viewGroup.isSmoothScrollingEnabled()
set(value) = viewGroup.setSmoothScrollingEnabled(value)
var android.widget.ImageView.adjustViewBounds: Boolean
get() = getAdjustViewBounds()
set(value) = setAdjustViewBounds(value)
var android.widget.ImageView.baseline: Int
get() = getBaseline()
set(value) = setBaseline(value)
var android.widget.ImageView.baselineAlignBottom: Boolean
get() = getBaselineAlignBottom()
set(value) = setBaselineAlignBottom(value)
var android.widget.ImageView.colorFilter: android.graphics.ColorFilter?
get() = getColorFilter()
set(value) = setColorFilter(value!!)
var android.widget.ImageView.cropToPadding: Boolean
get() = getCropToPadding()
set(value) = setCropToPadding(value)
val android.widget.ImageView.drawable: android.graphics.drawable.Drawable?
get() = getDrawable()
var android.widget.ImageView.imageAlpha: Int
get() = getImageAlpha()
set(value) = setImageAlpha(value)
var android.widget.ImageView.imageMatrix: android.graphics.Matrix?
get() = getImageMatrix()
set(value) = setImageMatrix(value!!)
var android.widget.ImageView.maxHeight: Int
get() = getMaxHeight()
set(value) = setMaxHeight(value)
var android.widget.ImageView.maxWidth: Int
get() = getMaxWidth()
set(value) = setMaxWidth(value)
var android.widget.ImageView.scaleType: android.widget.ImageView.ScaleType?
get() = getScaleType()
set(value) = setScaleType(value!!)
val _LinearLayout.baseline: Int
get() = viewGroup.getBaseline()
var _LinearLayout.baselineAligned: Boolean
get() = viewGroup.isBaselineAligned()
set(value) = viewGroup.setBaselineAligned(value)
var _LinearLayout.baselineAlignedChildIndex: Int
get() = viewGroup.getBaselineAlignedChildIndex()
set(value) = viewGroup.setBaselineAlignedChildIndex(value)
var _LinearLayout.dividerDrawable: android.graphics.drawable.Drawable?
get() = viewGroup.getDividerDrawable()
set(value) = viewGroup.setDividerDrawable(value!!)
var _LinearLayout.dividerPadding: Int
get() = viewGroup.getDividerPadding()
set(value) = viewGroup.setDividerPadding(value)
var _LinearLayout.measureWithLargestChildEnabled: Boolean
get() = viewGroup.isMeasureWithLargestChildEnabled()
set(value) = viewGroup.setMeasureWithLargestChildEnabled(value)
var _LinearLayout.orientation: Int
get() = viewGroup.getOrientation()
set(value) = viewGroup.setOrientation(value)
var _LinearLayout.showDividers: Int
get() = viewGroup.getShowDividers()
set(value) = viewGroup.setShowDividers(value)
var _LinearLayout.weightSum: Float
get() = viewGroup.getWeightSum()
set(value) = viewGroup.setWeightSum(value)
var _ListView.adapter: android.widget.ListAdapter?
get() = viewGroup.getAdapter()
set(value) = viewGroup.setAdapter(value!!)
val _ListView.checkItemIds: LongArray?
get() = viewGroup.getCheckItemIds()
var _ListView.divider: android.graphics.drawable.Drawable?
get() = viewGroup.getDivider()
set(value) = viewGroup.setDivider(value!!)
var _ListView.dividerHeight: Int
get() = viewGroup.getDividerHeight()
set(value) = viewGroup.setDividerHeight(value)
val _ListView.footerViewsCount: Int
get() = viewGroup.getFooterViewsCount()
val _ListView.headerViewsCount: Int
get() = viewGroup.getHeaderViewsCount()
var _ListView.itemsCanFocus: Boolean
get() = viewGroup.getItemsCanFocus()
set(value) = viewGroup.setItemsCanFocus(value)
val _ListView.maxScrollAmount: Int
get() = viewGroup.getMaxScrollAmount()
val _ListView.opaque: Boolean
get() = viewGroup.isOpaque()
var _ListView.overscrollFooter: android.graphics.drawable.Drawable?
get() = viewGroup.getOverscrollFooter()
set(value) = viewGroup.setOverscrollFooter(value!!)
var _ListView.overscrollHeader: android.graphics.drawable.Drawable?
get() = viewGroup.getOverscrollHeader()
set(value) = viewGroup.setOverscrollHeader(value!!)
val _MediaController.showing: Boolean
get() = viewGroup.isShowing()
val _NumberPicker.accessibilityNodeProvider: android.view.accessibility.AccessibilityNodeProvider?
get() = viewGroup.getAccessibilityNodeProvider()
var _NumberPicker.displayedValues: Array<String>?
get() = viewGroup.getDisplayedValues()
set(value) = viewGroup.setDisplayedValues(value!!)
var _NumberPicker.maxValue: Int
get() = viewGroup.getMaxValue()
set(value) = viewGroup.setMaxValue(value)
var _NumberPicker.minValue: Int
get() = viewGroup.getMinValue()
set(value) = viewGroup.setMinValue(value)
val _NumberPicker.solidColor: Int
get() = viewGroup.getSolidColor()
var _NumberPicker.value: Int
get() = viewGroup.getValue()
set(value) = viewGroup.setValue(value)
var _NumberPicker.wrapSelectorWheel: Boolean
get() = viewGroup.getWrapSelectorWheel()
set(value) = viewGroup.setWrapSelectorWheel(value)
var android.widget.ProgressBar.indeterminate: Boolean
get() = isIndeterminate()
set(value) = setIndeterminate(value)
var android.widget.ProgressBar.indeterminateDrawable: android.graphics.drawable.Drawable?
get() = getIndeterminateDrawable()
set(value) = setIndeterminateDrawable(value!!)
var android.widget.ProgressBar.interpolator: android.view.animation.Interpolator?
get() = getInterpolator()
set(value) = setInterpolator(value!!)
var android.widget.ProgressBar.max: Int
get() = getMax()
set(value) = setMax(value)
var android.widget.ProgressBar.progress: Int
get() = getProgress()
set(value) = setProgress(value)
var android.widget.ProgressBar.progressDrawable: android.graphics.drawable.Drawable?
get() = getProgressDrawable()
set(value) = setProgressDrawable(value!!)
var android.widget.ProgressBar.secondaryProgress: Int
get() = getSecondaryProgress()
set(value) = setSecondaryProgress(value)
val _RadioGroup.checkedRadioButtonId: Int
get() = viewGroup.getCheckedRadioButtonId()
val android.widget.RatingBar.indicator: Boolean
get() = isIndicator()
var android.widget.RatingBar.numStars: Int
get() = getNumStars()
set(value) = setNumStars(value)
var android.widget.RatingBar.onRatingBarChangeListener: android.widget.RatingBar.OnRatingBarChangeListener?
get() = getOnRatingBarChangeListener()
set(value) = setOnRatingBarChangeListener(value!!)
var android.widget.RatingBar.rating: Float
get() = getRating()
set(value) = setRating(value)
var android.widget.RatingBar.stepSize: Float
get() = getStepSize()
set(value) = setStepSize(value)
val _RelativeLayout.baseline: Int
get() = viewGroup.getBaseline()
var _RelativeLayout.gravity: Int
get() = viewGroup.getGravity()
set(value) = viewGroup.setGravity(value)
var _ScrollView.fillViewport: Boolean
get() = viewGroup.isFillViewport()
set(value) = viewGroup.setFillViewport(value)
val _ScrollView.maxScrollAmount: Int
get() = viewGroup.getMaxScrollAmount()
var _ScrollView.smoothScrollingEnabled: Boolean
get() = viewGroup.isSmoothScrollingEnabled()
set(value) = viewGroup.setSmoothScrollingEnabled(value)
val _SearchView.iconfiedByDefault: Boolean
get() = viewGroup.isIconfiedByDefault()
var _SearchView.iconified: Boolean
get() = viewGroup.isIconified()
set(value) = viewGroup.setIconified(value)
var _SearchView.imeOptions: Int
get() = viewGroup.getImeOptions()
set(value) = viewGroup.setImeOptions(value)
var _SearchView.inputType: Int
get() = viewGroup.getInputType()
set(value) = viewGroup.setInputType(value)
var _SearchView.maxWidth: Int
get() = viewGroup.getMaxWidth()
set(value) = viewGroup.setMaxWidth(value)
val _SearchView.query: CharSequence?
get() = viewGroup.getQuery()
var _SearchView.queryHint: CharSequence?
get() = viewGroup.getQueryHint()
set(value) = viewGroup.setQueryHint(value!!)
var _SearchView.queryRefinementEnabled: Boolean
get() = viewGroup.isQueryRefinementEnabled()
set(value) = viewGroup.setQueryRefinementEnabled(value)
var _SearchView.submitButtonEnabled: Boolean
get() = viewGroup.isSubmitButtonEnabled()
set(value) = viewGroup.setSubmitButtonEnabled(value)
var _SearchView.suggestionsAdapter: android.widget.CursorAdapter?
get() = viewGroup.getSuggestionsAdapter()
set(value) = viewGroup.setSuggestionsAdapter(value!!)
val _SlidingDrawer.content: android.view.View?
get() = viewGroup.getContent()
val _SlidingDrawer.handle: android.view.View?
get() = viewGroup.getHandle()
val _SlidingDrawer.moving: Boolean
get() = viewGroup.isMoving()
val _SlidingDrawer.opened: Boolean
get() = viewGroup.isOpened()
val _Spinner.baseline: Int
get() = viewGroup.getBaseline()
var _Spinner.dropDownHorizontalOffset: Int
get() = viewGroup.getDropDownHorizontalOffset()
set(value) = viewGroup.setDropDownHorizontalOffset(value)
var _Spinner.dropDownVerticalOffset: Int
get() = viewGroup.getDropDownVerticalOffset()
set(value) = viewGroup.setDropDownVerticalOffset(value)
var _Spinner.dropDownWidth: Int
get() = viewGroup.getDropDownWidth()
set(value) = viewGroup.setDropDownWidth(value)
var _Spinner.gravity: Int
get() = viewGroup.getGravity()
set(value) = viewGroup.setGravity(value)
val _Spinner.popupBackground: android.graphics.drawable.Drawable?
get() = viewGroup.getPopupBackground()
var _Spinner.prompt: CharSequence?
get() = viewGroup.getPrompt()
set(value) = viewGroup.setPrompt(value!!)
val android.widget.Switch.compoundPaddingRight: Int
get() = getCompoundPaddingRight()
var android.widget.Switch.switchMinWidth: Int
get() = getSwitchMinWidth()
set(value) = setSwitchMinWidth(value)
var android.widget.Switch.switchPadding: Int
get() = getSwitchPadding()
set(value) = setSwitchPadding(value)
var android.widget.Switch.textOff: CharSequence?
get() = getTextOff()
set(value) = setTextOff(value!!)
var android.widget.Switch.textOn: CharSequence?
get() = getTextOn()
set(value) = setTextOn(value!!)
var android.widget.Switch.thumbDrawable: android.graphics.drawable.Drawable?
get() = getThumbDrawable()
set(value) = setThumbDrawable(value!!)
var android.widget.Switch.thumbTextPadding: Int
get() = getThumbTextPadding()
set(value) = setThumbTextPadding(value)
var android.widget.Switch.trackDrawable: android.graphics.drawable.Drawable?
get() = getTrackDrawable()
set(value) = setTrackDrawable(value!!)
var _TabHost.currentTab: Int
get() = viewGroup.getCurrentTab()
set(value) = viewGroup.setCurrentTab(value)
val _TabHost.currentTabTag: String?
get() = viewGroup.getCurrentTabTag()
val _TabHost.currentTabView: android.view.View?
get() = viewGroup.getCurrentTabView()
val _TabHost.currentView: android.view.View?
get() = viewGroup.getCurrentView()
val _TabHost.tabContentView: android.widget.FrameLayout?
get() = viewGroup.getTabContentView()
val _TabHost.tabWidget: android.widget.TabWidget?
get() = viewGroup.getTabWidget()
var _TabWidget.stripEnabled: Boolean
get() = viewGroup.isStripEnabled()
set(value) = viewGroup.setStripEnabled(value)
val _TabWidget.tabCount: Int
get() = viewGroup.getTabCount()
var _TableLayout.shrinkAllColumns: Boolean
get() = viewGroup.isShrinkAllColumns()
set(value) = viewGroup.setShrinkAllColumns(value)
var _TableLayout.stretchAllColumns: Boolean
get() = viewGroup.isStretchAllColumns()
set(value) = viewGroup.setStretchAllColumns(value)
val _TableRow.virtualChildCount: Int
get() = viewGroup.getVirtualChildCount()
var android.widget.TextView.autoLinkMask: Int
get() = getAutoLinkMask()
set(value) = setAutoLinkMask(value)
val android.widget.TextView.baseline: Int
get() = getBaseline()
var android.widget.TextView.compoundDrawablePadding: Int
get() = getCompoundDrawablePadding()
set(value) = setCompoundDrawablePadding(value)
val android.widget.TextView.compoundDrawables: Array<android.graphics.drawable.Drawable>?
get() = getCompoundDrawables()
val android.widget.TextView.compoundPaddingBottom: Int
get() = getCompoundPaddingBottom()
val android.widget.TextView.compoundPaddingLeft: Int
get() = getCompoundPaddingLeft()
val android.widget.TextView.compoundPaddingRight: Int
get() = getCompoundPaddingRight()
val android.widget.TextView.compoundPaddingTop: Int
get() = getCompoundPaddingTop()
val android.widget.TextView.currentHintTextColor: Int
get() = getCurrentHintTextColor()
val android.widget.TextView.currentTextColor: Int
get() = getCurrentTextColor()
var android.widget.TextView.cursorVisible: Boolean
get() = isCursorVisible()
set(value) = setCursorVisible(value)
var android.widget.TextView.customSelectionActionModeCallback: android.view.ActionMode.Callback?
get() = getCustomSelectionActionModeCallback()
set(value) = setCustomSelectionActionModeCallback(value!!)
val android.widget.TextView.editableText: android.text.Editable?
get() = getEditableText()
var android.widget.TextView.ellipsize: android.text.TextUtils.TruncateAt?
get() = getEllipsize()
set(value) = setEllipsize(value!!)
var android.widget.TextView.error: CharSequence?
get() = getError()
set(value) = setError(value!!)
val android.widget.TextView.extendedPaddingBottom: Int
get() = getExtendedPaddingBottom()
val android.widget.TextView.extendedPaddingTop: Int
get() = getExtendedPaddingTop()
var android.widget.TextView.filters: Array<android.text.InputFilter>?
get() = getFilters()
set(value) = setFilters(value!!)
var android.widget.TextView.freezesText: Boolean
get() = getFreezesText()
set(value) = setFreezesText(value)
var android.widget.TextView.gravity: Int
get() = getGravity()
set(value) = setGravity(value)
var android.widget.TextView.highlightColor: Int
get() = getHighlightColor()
set(value) = setHighlightColor(value)
var android.widget.TextView.hint: CharSequence?
get() = getHint()
set(value) = setHint(value!!)
val android.widget.TextView.hintTextColors: android.content.res.ColorStateList?
get() = getHintTextColors()
val android.widget.TextView.imeActionId: Int
get() = getImeActionId()
val android.widget.TextView.imeActionLabel: CharSequence?
get() = getImeActionLabel()
var android.widget.TextView.imeOptions: Int
get() = getImeOptions()
set(value) = setImeOptions(value)
var android.widget.TextView.includeFontPadding: Boolean
get() = getIncludeFontPadding()
set(value) = setIncludeFontPadding(value)
val android.widget.TextView.inputMethodTarget: Boolean
get() = isInputMethodTarget()
var android.widget.TextView.inputType: Int
get() = getInputType()
set(value) = setInputType(value)
var android.widget.TextView.keyListener: android.text.method.KeyListener?
get() = getKeyListener()
set(value) = setKeyListener(value!!)
val android.widget.TextView.layout: android.text.Layout?
get() = getLayout()
val android.widget.TextView.lineCount: Int
get() = getLineCount()
val android.widget.TextView.lineHeight: Int
get() = getLineHeight()
val android.widget.TextView.lineSpacingExtra: Float
get() = getLineSpacingExtra()
val android.widget.TextView.lineSpacingMultiplier: Float
get() = getLineSpacingMultiplier()
val android.widget.TextView.linkTextColors: android.content.res.ColorStateList?
get() = getLinkTextColors()
var android.widget.TextView.linksClickable: Boolean
get() = getLinksClickable()
set(value) = setLinksClickable(value)
var android.widget.TextView.marqueeRepeatLimit: Int
get() = getMarqueeRepeatLimit()
set(value) = setMarqueeRepeatLimit(value)
var android.widget.TextView.maxEms: Int
get() = getMaxEms()
set(value) = setMaxEms(value)
var android.widget.TextView.maxHeight: Int
get() = getMaxHeight()
set(value) = setMaxHeight(value)
var android.widget.TextView.maxLines: Int
get() = getMaxLines()
set(value) = setMaxLines(value)
var android.widget.TextView.maxWidth: Int
get() = getMaxWidth()
set(value) = setMaxWidth(value)
var android.widget.TextView.minEms: Int
get() = getMinEms()
set(value) = setMinEms(value)
var android.widget.TextView.minHeight: Int
get() = getMinHeight()
set(value) = setMinHeight(value)
var android.widget.TextView.minLines: Int
get() = getMinLines()
set(value) = setMinLines(value)
var android.widget.TextView.minWidth: Int
get() = getMinWidth()
set(value) = setMinWidth(value)
var android.widget.TextView.movementMethod: android.text.method.MovementMethod?
get() = getMovementMethod()
set(value) = setMovementMethod(value!!)
val android.widget.TextView.paint: android.text.TextPaint?
get() = getPaint()
var android.widget.TextView.paintFlags: Int
get() = getPaintFlags()
set(value) = setPaintFlags(value)
var android.widget.TextView.privateImeOptions: String?
get() = getPrivateImeOptions()
set(value) = setPrivateImeOptions(value!!)
val android.widget.TextView.selectionEnd: Int
get() = getSelectionEnd()
val android.widget.TextView.selectionStart: Int
get() = getSelectionStart()
val android.widget.TextView.shadowColor: Int
get() = getShadowColor()
val android.widget.TextView.shadowDx: Float
get() = getShadowDx()
val android.widget.TextView.shadowDy: Float
get() = getShadowDy()
val android.widget.TextView.shadowRadius: Float
get() = getShadowRadius()
val android.widget.TextView.suggestionsEnabled: Boolean
get() = isSuggestionsEnabled()
var android.widget.TextView.text: CharSequence?
get() = getText()
set(value) = setText(value!!)
val android.widget.TextView.textColors: android.content.res.ColorStateList?
get() = getTextColors()
var android.widget.TextView.textScaleX: Float
get() = getTextScaleX()
set(value) = setTextScaleX(value)
val android.widget.TextView.textSelectable: Boolean
get() = isTextSelectable()
var android.widget.TextView.textSize: Float
get() = getTextSize()
set(value) = setTextSize(value)
val android.widget.TextView.totalPaddingBottom: Int
get() = getTotalPaddingBottom()
val android.widget.TextView.totalPaddingLeft: Int
get() = getTotalPaddingLeft()
val android.widget.TextView.totalPaddingRight: Int
get() = getTotalPaddingRight()
val android.widget.TextView.totalPaddingTop: Int
get() = getTotalPaddingTop()
var android.widget.TextView.transformationMethod: android.text.method.TransformationMethod?
get() = getTransformationMethod()
set(value) = setTransformationMethod(value!!)
var android.widget.TextView.typeface: android.graphics.Typeface?
get() = getTypeface()
set(value) = setTypeface(value!!)
val android.widget.TextView.urls: Array<android.text.style.URLSpan>?
get() = getUrls()
val _TimePicker._24HourView: Boolean
get() = viewGroup.is24HourView()
val _TimePicker.baseline: Int
get() = viewGroup.getBaseline()
var _TimePicker.currentHour: Int?
get() = viewGroup.getCurrentHour()
set(value) = viewGroup.setCurrentHour(value!!)
var _TimePicker.currentMinute: Int?
get() = viewGroup.getCurrentMinute()
set(value) = viewGroup.setCurrentMinute(value!!)
var _TimePicker.enabled: Boolean
get() = viewGroup.isEnabled()
set(value) = viewGroup.setEnabled(value)
var android.widget.ToggleButton.textOff: CharSequence?
get() = getTextOff()
set(value) = setTextOff(value!!)
var android.widget.ToggleButton.textOn: CharSequence?
get() = getTextOn()
set(value) = setTextOn(value!!)
val _TwoLineListItem.text1: android.widget.TextView?
get() = viewGroup.getText1()
val _TwoLineListItem.text2: android.widget.TextView?
get() = viewGroup.getText2()
val android.widget.VideoView.bufferPercentage: Int
get() = getBufferPercentage()
val android.widget.VideoView.currentPosition: Int
get() = getCurrentPosition()
val android.widget.VideoView.duration: Int
get() = getDuration()
val android.widget.VideoView.playing: Boolean
get() = isPlaying()
val _ViewAnimator.baseline: Int
get() = viewGroup.getBaseline()
val _ViewAnimator.currentView: android.view.View?
get() = viewGroup.getCurrentView()
var _ViewAnimator.displayedChild: Int
get() = viewGroup.getDisplayedChild()
set(value) = viewGroup.setDisplayedChild(value)
var _ViewAnimator.inAnimation: android.view.animation.Animation?
get() = viewGroup.getInAnimation()
set(value) = viewGroup.setInAnimation(value!!)
var _ViewAnimator.outAnimation: android.view.animation.Animation?
get() = viewGroup.getOutAnimation()
set(value) = viewGroup.setOutAnimation(value!!)
var _ViewFlipper.autoStart: Boolean
get() = viewGroup.isAutoStart()
set(value) = viewGroup.setAutoStart(value)
val _ViewFlipper.flipping: Boolean
get() = viewGroup.isFlipping()
val _ViewSwitcher.nextView: android.view.View?
get() = viewGroup.getNextView()
| androidVNC/src/com/example/adsl/Properties.kt | 586646561 |
package me.panpf.sketch.sample.util
import android.content.Context
import android.content.res.AssetManager
import android.graphics.*
import android.preference.PreferenceManager
import me.panpf.sketch.sample.AssetImage
import me.panpf.sketch.uri.AssetUriModel
import me.panpf.sketch.util.ExifInterface
import me.panpf.sketch.util.SketchUtils
import java.io.*
class ImageOrientationCorrectTestFileGenerator {
private var files: Array<Config>? = null
private var assetManager: AssetManager? = null
private fun init(context: Context) {
if (files != null) {
return
}
if (assetManager == null) {
assetManager = context.assets
}
val changed = isChanged(context)
if (changed) {
updateVersion(context)
}
var externalFilesDir = context.getExternalFilesDir(null)
if (externalFilesDir == null) {
externalFilesDir = context.filesDir
}
val dirPath = externalFilesDir!!.path + File.separator + "TEST_ORIENTATION"
val filesList = arrayListOf<Config>()
for (w in configs.indices) {
val elements = configs[w].split(",".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()
val filePath = String.format("%s%s%s", dirPath, File.separator, elements[0])
filesList += Config(filePath, Integer.parseInt(elements[1]), Integer.parseInt(elements[2]), Integer.parseInt(elements[3]))
}
files = filesList.toTypedArray()
if (changed) {
val dir = File(dirPath)
if (dir.exists()) {
SketchUtils.cleanDir(dir)
}
}
}
private fun isChanged(context: Context): Boolean {
val preferences = PreferenceManager.getDefaultSharedPreferences(context)
return preferences.getInt(TAG_VERSION, 0) != VERSION
}
private fun updateVersion(context: Context) {
PreferenceManager.getDefaultSharedPreferences(context).edit().putInt(TAG_VERSION, VERSION).apply()
}
val filePaths: Array<String>
get() {
val filePaths = arrayListOf<String>()
for (w in configs.indices) {
filePaths += files!![w].filePath
}
return filePaths.toTypedArray()
}
fun onAppStart() {
Thread(Runnable {
val options = BitmapFactory.Options()
options.inSampleSize = 4
val inputStream: InputStream
try {
inputStream = assetManager!!.open(AssetUriModel().getUriContent(AssetImage.MEI_NV))
} catch (e: IOException) {
e.printStackTrace()
return@Runnable
}
val sourceBitmap = BitmapFactory.decodeStream(inputStream, null, options)
SketchUtils.close(inputStream)
if(sourceBitmap != null){
for (config in files!!) {
val file = File(config.filePath)
generatorTestFile(file, sourceBitmap, config.degrees, config.xScale, config.orientation)
}
sourceBitmap.recycle()
}
}).start()
}
private fun generatorTestFile(file: File, sourceBitmap: Bitmap, rotateDegrees: Int, xScale: Int, orientation: Int) {
if (file.exists()) {
return
}
val newBitmap = transformBitmap(sourceBitmap, rotateDegrees, xScale)
if (newBitmap == null || newBitmap.isRecycled) {
return
}
file.parentFile.mkdirs()
val outputStream: FileOutputStream
try {
outputStream = FileOutputStream(file)
} catch (e: FileNotFoundException) {
e.printStackTrace()
newBitmap.recycle()
return
}
newBitmap.compress(Bitmap.CompressFormat.JPEG, 100, outputStream)
SketchUtils.close(outputStream)
newBitmap.recycle()
val exifInterface: ExifInterface
try {
exifInterface = ExifInterface(file.path)
} catch (e: IOException) {
e.printStackTrace()
file.delete()
return
}
exifInterface.setAttribute(ExifInterface.TAG_ORIENTATION, orientation.toString())
try {
exifInterface.saveAttributes()
} catch (e: IOException) {
e.printStackTrace()
file.delete()
}
}
private fun transformBitmap(sourceBitmap: Bitmap, degrees: Int, xScale: Int): Bitmap? {
val matrix = Matrix()
matrix.setScale(xScale.toFloat(), 1f)
matrix.postRotate(degrees.toFloat())
// 根据旋转角度计算新的图片的尺寸
val newRect = RectF(0f, 0f, sourceBitmap.width.toFloat(), sourceBitmap.height.toFloat())
matrix.mapRect(newRect)
val newWidth = newRect.width().toInt()
val newHeight = newRect.height().toInt()
// 角度不能整除90°时新图片会是斜的,因此要支持透明度,这样倾斜导致露出的部分就不会是黑的
var config: Bitmap.Config? = if (sourceBitmap.config != null) sourceBitmap.config else null
if (degrees % 90 != 0 && config != Bitmap.Config.ARGB_8888) {
config = Bitmap.Config.ARGB_8888
}
val result = Bitmap.createBitmap(newWidth, newHeight, config!!)
matrix.postTranslate(-newRect.left, -newRect.top)
val canvas = Canvas(result)
val paint = Paint(Paint.DITHER_FLAG or Paint.FILTER_BITMAP_FLAG)
canvas.drawBitmap(sourceBitmap, matrix, paint)
return result
}
private class Config(internal var filePath: String, internal var degrees: Int, internal var xScale: Int, internal var orientation: Int)
companion object {
private val instance = ImageOrientationCorrectTestFileGenerator()
private val VERSION = 5
private val configs = arrayOf(
String.format("%s_%d.jpg,%d,%d,%d", "TEST_FILE_NAME_ROTATE_90", VERSION, -90, 1, ExifInterface.ORIENTATION_ROTATE_90),
String.format("%s_%d.jpg,%d,%d,%d", "TEST_FILE_NAME_ROTATE_180", VERSION, -180, 1, ExifInterface.ORIENTATION_ROTATE_180),
String.format("%s_%d.jpg,%d,%d,%d", "TEST_FILE_NAME_ROTATE_270", VERSION, -270, 1, ExifInterface.ORIENTATION_ROTATE_270),
String.format("%s_%d.jpg,%d,%d,%d", "TEST_FILE_NAME_FLIP_HORIZONTAL", VERSION, 0, -1, ExifInterface.ORIENTATION_FLIP_HORIZONTAL),
String.format("%s_%d.jpg,%d,%d,%d", "TEST_FILE_NAME_TRANSPOSE", VERSION, -90, -1, ExifInterface.ORIENTATION_TRANSPOSE),
String.format("%s_%d.jpg,%d,%d,%d", "TEST_FILE_NAME_FLIP_VERTICAL", VERSION, -180, -1, ExifInterface.ORIENTATION_FLIP_VERTICAL),
String.format("%s_%d.jpg,%d,%d,%d", "TEST_FILE_NAME_TRANSVERSE", VERSION, -270, -1, ExifInterface.ORIENTATION_TRANSVERSE))
private val TAG_VERSION = "TAG_VERSION"
fun getInstance(context: Context): ImageOrientationCorrectTestFileGenerator {
instance.init(context)
return instance
}
}
}
| sample/src/main/java/me/panpf/sketch/sample/util/ImageOrientationCorrectTestFileGenerator.kt | 3915557621 |
/*
* Copyright (C) 2022 Block, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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 app.cash.zipline.internal.bridge
import app.cash.zipline.ZiplineService
import kotlinx.serialization.KSerializer
import kotlinx.serialization.descriptors.PrimitiveKind
import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder
/**
* This is used with [ZiplineServiceAdapter] to pass services between runtimes by reference and not
* by value. This calls [Endpoint.bind] when serializing, and deserializers call [Endpoint.take].
*/
interface PassByReference
internal class ReceiveByReference(
var name: String,
var endpoint: Endpoint,
) : PassByReference {
fun <T : ZiplineService> take(adapter: ZiplineServiceAdapter<T>): T {
return endpoint.take(name, adapter)
}
}
internal class SendByReference<T : ZiplineService>(
val service: T,
val adapter: ZiplineServiceAdapter<T>,
) : PassByReference {
fun bind(endpoint: Endpoint, name: String) {
endpoint.bind(name, service, adapter)
}
}
internal class PassByReferenceSerializer(
val endpoint: Endpoint,
) : KSerializer<PassByReference> {
override val descriptor = PrimitiveSerialDescriptor("PassByReference", PrimitiveKind.STRING)
override fun serialize(encoder: Encoder, value: PassByReference) {
require(value is SendByReference<*>)
val serviceName = endpoint.generatePassByReferenceName()
endpoint.callCodec.encodedServiceNames += serviceName
value.bind(endpoint, serviceName)
encoder.encodeString(serviceName)
}
override fun deserialize(decoder: Decoder): PassByReference {
val serviceName = decoder.decodeString()
endpoint.callCodec.decodedServiceNames += serviceName
return ReceiveByReference(serviceName, endpoint)
}
}
| zipline/src/commonMain/kotlin/app/cash/zipline/internal/bridge/passByReference.kt | 2963348383 |
package fr.simonlebras.radiofrance.utils
object MediaMetadataUtils {
const val METADATA_KEY_WEBSITE = "__METADATA_KEY_WEBSITE__"
const val METADATA_KEY_TWITTER = "__METADATA_KEY_TWITTER__"
const val METADATA_KEY_FACEBOOK = "__METADATA_KEY_FACEBOOK__"
const val METADATA_KEY_SMALL_LOGO = "__METADATA_KEY_SMALL_LOGO__"
const val METADATA_KEY_MEDIUM_LOGO = "__METADATA_KEY_MEDIUM_LOGO__"
const val METADATA_KEY_LARGE_LOGO = "__METADATA_KEY_LARGE_LOGO__"
}
| app/src/main/kotlin/fr/simonlebras/radiofrance/utils/MediaMetadataUtils.kt | 943764450 |
package cat.xojan.random1.injection.module
import android.app.DownloadManager
import android.content.Context
import cat.xojan.random1.Application
import cat.xojan.random1.BuildConfig
import cat.xojan.random1.data.*
import cat.xojan.random1.domain.interactor.PodcastDataInteractor
import cat.xojan.random1.domain.interactor.ProgramDataInteractor
import cat.xojan.random1.domain.model.CrashReporter
import cat.xojan.random1.domain.model.EventLogger
import cat.xojan.random1.domain.repository.PodcastPreferencesRepository
import cat.xojan.random1.domain.repository.PodcastRepository
import cat.xojan.random1.domain.repository.ProgramRepository
import cat.xojan.random1.feature.mediaplayback.MediaProvider
import cat.xojan.random1.feature.mediaplayback.QueueManager
import com.google.firebase.analytics.FirebaseAnalytics
import com.squareup.moshi.KotlinJsonAdapterFactory
import com.squareup.moshi.Moshi
import com.squareup.moshi.Rfc3339DateJsonAdapter
import dagger.Module
import dagger.Provides
import okhttp3.OkHttpClient
import okhttp3.logging.HttpLoggingInterceptor
import retrofit2.Retrofit
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory
import retrofit2.converter.moshi.MoshiConverterFactory
import java.util.*
import javax.inject.Singleton
@Module
class AppModule(private val application: Application) {
companion object {
private const val BASE_URL = BuildConfig.BASE_URL
}
@Provides
@Singleton
fun provideDownloadManager(): DownloadManager {
return application.getSystemService(Context.DOWNLOAD_SERVICE) as DownloadManager
}
@Provides
@Singleton
fun provideRetrofitRac1Service(): ApiService {
val loggingInterceptor = HttpLoggingInterceptor()
loggingInterceptor.level = HttpLoggingInterceptor.Level.BODY
val httpClientBuilder = OkHttpClient.Builder()
if (BuildConfig.DEBUG) httpClientBuilder.addInterceptor(loggingInterceptor)
val moshi = Moshi.Builder()
.add(KotlinJsonAdapterFactory())
.add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe())
.build()
val retrofit = Retrofit.Builder()
.baseUrl(BASE_URL)
.addConverterFactory(MoshiConverterFactory.create(moshi))
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.client(httpClientBuilder.build())
.build()
return retrofit.create(ApiService::class.java)
}
@Provides
@Singleton
fun provideProgramDataInteractor(programRepository: ProgramRepository) : ProgramDataInteractor {
return ProgramDataInteractor(programRepository)
}
@Provides
@Singleton
fun providePodcastDataInteractor(podcastRepository: PodcastRepository,
programRepository: ProgramRepository,
podcastPrefRepository: PodcastPreferencesRepository,
downloadManager: DownloadManager,
eventLogger: EventLogger)
: PodcastDataInteractor {
return PodcastDataInteractor(
programRepository,
podcastRepository,
podcastPrefRepository,
downloadManager,
application,
SharedPrefDownloadPodcastRepository(application),
eventLogger)
}
@Provides
@Singleton
fun provideEventLogger(): EventLogger {
return EventLogger(FirebaseAnalytics.getInstance(application))
}
@Provides
@Singleton
fun provideCrashReporter(): CrashReporter {
return CrashReporter()
}
@Provides
@Singleton
fun provideMediaProvider(programDataInteractor: ProgramDataInteractor,
podcastDataInteractor: PodcastDataInteractor,
queueManager: QueueManager
): MediaProvider {
return MediaProvider(programDataInteractor, podcastDataInteractor, queueManager)
}
@Provides
@Singleton
fun provideRemoteProgramRepository(service: ApiService): ProgramRepository {
return RemoteProgramRepository(service)
}
@Provides
@Singleton
fun provideRemotePodcastRepository(service: ApiService): PodcastRepository {
return RemotePodcastRepository(service)
}
@Provides
fun providesPodcastsPreferencesRepository(): PodcastPreferencesRepository {
return SharedPrefPodcastPreferencesRepository(application)
}
@Provides
@Singleton
fun provideQueueManager(eventLogger: EventLogger): QueueManager {
return QueueManager(eventLogger)
}
} | app/src/main/java/cat/xojan/random1/injection/module/AppModule.kt | 2370595550 |
package lt.vilnius.tvarkau.api
import lt.vilnius.tvarkau.entity.City
import lt.vilnius.tvarkau.entity.Report
import lt.vilnius.tvarkau.entity.ReportStatus
import lt.vilnius.tvarkau.entity.ReportType
import lt.vilnius.tvarkau.entity.User
class CitiesResponse(val cities: List<City>) : BaseResponse()
class ReportsResponse(val reports: List<Report>) : BaseResponse()
class ReportTypeResponse(val reportTypes: List<ReportType>) : BaseResponse()
class ReportStatusesResponse(val reportStatuses: List<ReportStatus>) : BaseResponse()
class ReportResponse(val report: Report) : BaseResponse()
class UserResponse(val user: User) : BaseResponse()
| app/src/main/java/lt/vilnius/tvarkau/api/responses.kt | 1733746807 |
package com.example.aleckstina.wespeakandroid.activities
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import com.example.aleckstina.wespeakandroid.R
class ReviewActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_review)
supportActionBar!!.hide()
}
}
| app/src/main/java/com/example/aleckstina/wespeakandroid/activities/ReviewActivity.kt | 238015129 |
package com.aidanvii.toolbox.adapterviews.databinding.recyclerpager
import android.content.Context
import android.os.Parcelable
import androidx.annotation.RestrictTo
import androidx.viewpager.widget.ViewPager
import com.aidanvii.toolbox.adapterviews.databinding.BindableAdapter
import com.aidanvii.toolbox.adapterviews.databinding.BindableAdapterDelegate
import com.aidanvii.toolbox.adapterviews.databinding.BindableAdapterItem
import com.aidanvii.toolbox.adapterviews.databinding.BindingInflater
import com.aidanvii.toolbox.adapterviews.databinding.ListBinder
import com.aidanvii.toolbox.adapterviews.databinding.defaultAreContentsSame
/**
* Intermediate class used to configure the [BindingRecyclerPagerAdapter]
*
* Example use case:
*
* Suppose you have a custom [BindingRecyclerPagerAdapter]:
* ```
* class MyCustomBindableAdapter(
* builder: Builder<MyAdapterItemViewModel>
* ) : BindingRecyclerPagerAdapter<MyAdapterItemViewModel>(builder) {
* //... custom optional overrides here ...
* }
* ```
* Where the [BindableAdapterItem] implementation looks like:
* ```
* class MyAdapterItemViewModel(
* val id: Int,
* val content: String
* ) : ObservableViewModel(), BindableAdapterItem {
* override val layoutId: Int get() = R.id.my_item
* override val bindingId: Int get() = BR.viewModel
* //... custom adapterBindable properties etc ...
* }
*
* ```
* Where [MyAdapterItemViewModel] has both [id] and [content] fields, the [BindingRecyclerPagerBinder] would be declared as follows:
* ```
* class MyListViewModel : ObservableViewModel() {
*
* @get:Bindable
* var items by bindable(emptyList<MyAdapterItemViewModel>())
*
* val binder = BindingRecyclerPagerBinder<MyAdapterItemViewModel>(
* hasMultipleViewTypes = false,
* areItemsAndContentsTheSame = { oldItem, newItem -> oldItem.id == newItem.id && oldItem.content == oldItem.content },
* adapterFactory = { MyCustomBindableAdapter(it) }
* )
* }
* ```
* Where [MyListViewModel] is a data-bound variable in xml that provides the [BindingRecyclerPagerBinder]:
* ```
* <variable
* name="listViewModel"
* type="com.example.MyListViewModel"/>
* ```
* And bound to the [ViewPager]:
* ```
* <android.support.v4.view.ViewPager
* android:layout_width="match_parent"
* android:layout_height="wrap_content"
* android:items="@{listViewModel.items}"
* android:binder="@{viewModel.binder}"/>
* ```
* @param hasMultipleViewTypes if the [BindingRecyclerViewAdapter] will have [BindableAdapterItem] with different [BindableAdapterItem.layoutId]s, set to true. False otherwise (minor optimisation)
* @param areItemAndContentsTheSame equivalent of [DiffUtil.Callback.areItemsTheSame] plus [DiffUtil.Callback.areContentsTheSame]. Internally forwards to [RecyclerPagerAdapter.OnDataSetChangedCallback.areItemsTheSame]
* @param adapterFactory optional factory to provide a custom implementation of [BindingRecyclerPagerAdapter], allowing you to override methods from [BindableAdapter]
*/
class BindingRecyclerPagerBinder<Item : BindableAdapterItem>(
hasMultipleViewTypes: Boolean = true,
val areItemAndContentsTheSame: ((oldItem: Item, newItem: Item) -> Boolean) = defaultAreContentsSame,
val adapterFactory: (BindingRecyclerPagerAdapter.Builder<Item>) -> BindingRecyclerPagerAdapter<Item> = { BindingRecyclerPagerAdapter(it) }
) : ListBinder<Item>(
hasMultipleViewTypes = hasMultipleViewTypes,
areItemsTheSame = areItemAndContentsTheSame,
areContentsTheSame = areItemAndContentsTheSame
) {
internal var adapterState: BindingRecyclerPagerAdapter.SavedState? = null
internal lateinit var applicationContext: Context
internal val adapter: BindingRecyclerPagerAdapter<Item>
get() = adapterFactory(
BindingRecyclerPagerAdapter.Builder(
delegate = BindableAdapterDelegate(),
viewTypeHandler = viewTypeHandler,
bindingInflater = BindingInflater,
areItemAndContentsTheSame = areItemAndContentsTheSame,
applicationContext = applicationContext
)
)
@RestrictTo(RestrictTo.Scope.TESTS)
fun testAdapter(
viewTypeHandler: BindableAdapter.ViewTypeHandler<Item> = this.viewTypeHandler,
bindingInflater: BindingInflater = BindingInflater,
areItemAndContentsTheSame: ((old: Item, new: Item) -> Boolean) = this.areItemAndContentsTheSame
) = BindingRecyclerPagerAdapter.Builder(
delegate = BindableAdapterDelegate(),
viewTypeHandler = viewTypeHandler,
bindingInflater = bindingInflater,
areItemAndContentsTheSame = areItemAndContentsTheSame,
applicationContext = applicationContext
).let { builder ->
adapterFactory(builder)
}
} | adapterviews-databinding-recyclerpager/src/main/java/com/aidanvii/toolbox/adapterviews/databinding/recyclerpager/BindingRecyclerPagerBinder.kt | 630798934 |
package de.tfelix.bestia.worldgen.description
import de.tfelix.bestia.worldgen.map.Map2DDiscreteChunk
import de.tfelix.bestia.worldgen.map.Map2DDiscreteInfo
import de.tfelix.bestia.worldgen.map.MapChunk
import de.tfelix.bestia.worldgen.random.NoiseVectorBuilder
/**
* This map info implementation describes a discrete two dimensional map
* usable for tilemap creation.
*
* @author Thomas Felix
*/
class Map2DDescription(
builder: Builder
) : MapDescription {
private val width = builder.width
private val height = builder.height
private val chunkWidth = builder.partWidth
private val chunkHeight = builder.partHeight
override val noiseVectorBuilder = builder.noiseVectorBuilder
override val mapParts: Iterator<MapChunk>
get() = Map2DIterator()
override val mapPartCount: Long
get() {
val parts = width / chunkWidth * (height / chunkHeight)
return if (parts == 0L) 1 else parts
}
private inner class Map2DIterator : Iterator<MapChunk> {
private var i: Long = 0
override fun hasNext(): Boolean {
return i < mapPartCount
}
override fun next(): MapChunk {
val curX = i * chunkWidth
val curY = i * chunkHeight
i += 1
return Map2DDiscreteChunk(
curX,
curY,
chunkWidth,
chunkHeight,
Map2DDiscreteInfo(width, height)
)
}
}
/**
* Builder pattern used for the [Map2DDescription]. Use this builder
* to create an instance of the [MapDescription].
*
*/
class Builder(
var noiseVectorBuilder: NoiseVectorBuilder,
var width: Long = 0,
var height: Long = 0,
var partWidth: Long = 0,
var partHeight: Long = 0
) {
fun build(): Map2DDescription {
return Map2DDescription(this)
}
}
override fun toString(): String {
return "Map2DDescription[chunkWidth: $width, chunkHeight: $height: chunkWidth: $chunkWidth, chunkHeight: $chunkHeight]"
}
}
| src/main/kotlin/de/tfelix/bestia/worldgen/description/Map2DDescription.kt | 2407076603 |
package io.gitlab.arturbosch.detekt
import io.gitlab.arturbosch.detekt.extensions.DetektExtension
import org.gradle.api.GradleException
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.file.FileCollection
import org.gradle.api.internal.HasConvention
import org.gradle.api.plugins.JavaPluginConvention
import org.gradle.api.plugins.ReportingBasePlugin
import org.gradle.api.provider.Provider
import org.gradle.api.reporting.ReportingExtension
import org.gradle.api.tasks.SourceSet
import org.gradle.language.base.plugins.LifecycleBasePlugin
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
import java.io.File
class DetektPlugin : Plugin<Project> {
override fun apply(project: Project) {
project.pluginManager.apply(ReportingBasePlugin::class.java)
val extension = project.extensions.create(DETEKT_TASK_NAME, DetektExtension::class.java, project)
extension.reportsDir = project.extensions.getByType(ReportingExtension::class.java).file("detekt")
val defaultConfigFile =
project.file("${project.rootProject.layout.projectDirectory.dir(CONFIG_DIR_NAME)}/$CONFIG_FILE")
if (defaultConfigFile.exists()) {
extension.config = project.files(defaultConfigFile)
}
configurePluginDependencies(project, extension)
setTaskDefaults(project)
registerOldDetektTask(project, extension)
registerDetektTasks(project, extension)
registerCreateBaselineTask(project, extension)
registerGenerateConfigTask(project)
registerIdeaTasks(project, extension)
}
private fun registerDetektTasks(project: Project, extension: DetektExtension) {
// Kotlin JVM plugin
project.plugins.withId("org.jetbrains.kotlin.jvm") {
project.afterEvaluate {
project.convention.getPlugin(JavaPluginConvention::class.java).sourceSets.all { sourceSet ->
registerDetektTask(project, extension, sourceSet)
}
}
}
}
private fun registerOldDetektTask(project: Project, extension: DetektExtension) {
val detektTaskProvider = project.tasks.register(DETEKT_TASK_NAME, Detekt::class.java) {
it.debugProp.set(project.provider { extension.debug })
it.parallelProp.set(project.provider { extension.parallel })
it.disableDefaultRuleSetsProp.set(project.provider { extension.disableDefaultRuleSets })
it.buildUponDefaultConfigProp.set(project.provider { extension.buildUponDefaultConfig })
it.failFastProp.set(project.provider { extension.failFast })
it.autoCorrectProp.set(project.provider { extension.autoCorrect })
it.config.setFrom(project.provider { extension.config })
it.baseline.set(project.layout.file(project.provider { extension.baseline }))
it.setSource(existingInputDirectoriesProvider(project, extension))
it.setIncludes(defaultIncludes)
it.setExcludes(defaultExcludes)
it.reportsDir.set(project.provider { extension.customReportsDir })
it.reports = extension.reports
it.ignoreFailuresProp.set(project.provider { extension.ignoreFailures })
}
project.tasks.matching { it.name == LifecycleBasePlugin.CHECK_TASK_NAME }.configureEach {
it.dependsOn(detektTaskProvider)
}
}
private fun registerDetektTask(project: Project, extension: DetektExtension, sourceSet: SourceSet) {
val kotlinSourceSet = (sourceSet as HasConvention).convention.plugins["kotlin"] as? KotlinSourceSet
?: throw GradleException("Kotlin source set not found. Please report on detekt's issue tracker")
project.tasks.register(DETEKT_TASK_NAME + sourceSet.name.capitalize(), Detekt::class.java) {
it.debugProp.set(project.provider { extension.debug })
it.parallelProp.set(project.provider { extension.parallel })
it.disableDefaultRuleSetsProp.set(project.provider { extension.disableDefaultRuleSets })
it.buildUponDefaultConfigProp.set(project.provider { extension.buildUponDefaultConfig })
it.failFastProp.set(project.provider { extension.failFast })
it.autoCorrectProp.set(project.provider { extension.autoCorrect })
it.config.setFrom(project.provider { extension.config })
it.baseline.set(project.layout.file(project.provider { extension.baseline }))
it.setSource(kotlinSourceSet.kotlin.files)
it.classpath.setFrom(sourceSet.compileClasspath, sourceSet.output.classesDirs)
it.reports.xml.destination = File(extension.reportsDir, sourceSet.name + ".xml")
it.reports.html.destination = File(extension.reportsDir, sourceSet.name + ".html")
it.reports.txt.destination = File(extension.reportsDir, sourceSet.name + ".txt")
it.ignoreFailuresProp.set(project.provider { extension.ignoreFailures })
it.description =
"EXPERIMENTAL & SLOW: Run detekt analysis for ${sourceSet.name} classes with type resolution"
}
}
private fun registerCreateBaselineTask(project: Project, extension: DetektExtension) =
project.tasks.register(BASELINE, DetektCreateBaselineTask::class.java) {
it.baseline.set(project.layout.file(project.provider { extension.baseline }))
it.config.setFrom(project.provider { extension.config })
it.debug.set(project.provider { extension.debug })
it.parallel.set(project.provider { extension.parallel })
it.disableDefaultRuleSets.set(project.provider { extension.disableDefaultRuleSets })
it.buildUponDefaultConfig.set(project.provider { extension.buildUponDefaultConfig })
it.failFast.set(project.provider { extension.failFast })
it.autoCorrect.set(project.provider { extension.autoCorrect })
it.setSource(existingInputDirectoriesProvider(project, extension))
it.setIncludes(defaultIncludes)
it.setExcludes(defaultExcludes)
}
private fun registerGenerateConfigTask(project: Project) =
project.tasks.register(GENERATE_CONFIG, DetektGenerateConfigTask::class.java)
private fun registerIdeaTasks(project: Project, extension: DetektExtension) {
project.tasks.register(IDEA_FORMAT, DetektIdeaFormatTask::class.java) {
it.setSource(existingInputDirectoriesProvider(project, extension))
it.setIncludes(defaultIncludes)
it.setExcludes(defaultExcludes)
it.ideaExtension = extension.idea
}
project.tasks.register(IDEA_INSPECT, DetektIdeaInspectionTask::class.java) {
it.setSource(existingInputDirectoriesProvider(project, extension))
it.setIncludes(defaultIncludes)
it.setExcludes(defaultExcludes)
it.ideaExtension = extension.idea
}
}
private fun existingInputDirectoriesProvider(
project: Project,
extension: DetektExtension
): Provider<FileCollection> = project.provider { extension.input.filter { it.exists() } }
private fun configurePluginDependencies(project: Project, extension: DetektExtension) {
project.configurations.create(CONFIGURATION_DETEKT_PLUGINS) { configuration ->
configuration.isVisible = false
configuration.isTransitive = true
configuration.description = "The $CONFIGURATION_DETEKT_PLUGINS libraries to be used for this project."
}
project.configurations.create(CONFIGURATION_DETEKT) { configuration ->
configuration.isVisible = false
configuration.isTransitive = true
configuration.description = "The $CONFIGURATION_DETEKT dependencies to be used for this project."
configuration.defaultDependencies { dependencySet ->
val version = extension.toolVersion ?: DEFAULT_DETEKT_VERSION
dependencySet.add(project.dependencies.create("io.gitlab.arturbosch.detekt:detekt-cli:$version"))
}
}
}
private fun setTaskDefaults(project: Project) {
project.tasks.withType(Detekt::class.java) {
it.detektClasspath.setFrom(project.configurations.getAt(CONFIGURATION_DETEKT))
it.pluginClasspath.setFrom(project.configurations.getAt(CONFIGURATION_DETEKT_PLUGINS))
}
project.tasks.withType(DetektCreateBaselineTask::class.java) {
it.detektClasspath.setFrom(project.configurations.getAt(CONFIGURATION_DETEKT))
it.pluginClasspath.setFrom(project.configurations.getAt(CONFIGURATION_DETEKT_PLUGINS))
}
project.tasks.withType(DetektGenerateConfigTask::class.java) {
it.detektClasspath.setFrom(project.configurations.getAt(CONFIGURATION_DETEKT))
}
}
companion object {
private const val DETEKT_TASK_NAME = "detekt"
private const val IDEA_FORMAT = "detektIdeaFormat"
private const val IDEA_INSPECT = "detektIdeaInspect"
private const val GENERATE_CONFIG = "detektGenerateConfig"
private const val BASELINE = "detektBaseline"
private val defaultExcludes = listOf("build/")
private val defaultIncludes = listOf("**/*.kt", "**/*.kts")
internal const val CONFIG_DIR_NAME = "config/detekt"
internal const val CONFIG_FILE = "detekt.yml"
}
}
const val CONFIGURATION_DETEKT = "detekt"
const val CONFIGURATION_DETEKT_PLUGINS = "detektPlugins"
| detekt-gradle-plugin/src/main/kotlin/io/gitlab/arturbosch/detekt/DetektPlugin.kt | 1231077669 |
package com.slim.slimfilemanager.utils
interface FragmentLifecycle {
fun onResumeFragment()
fun onPauseFragment()
}
| manager/src/main/java/com/slim/slimfilemanager/utils/FragmentLifecycle.kt | 1178823897 |
/****************************************************************************************
* Copyright (c) 2014 Michael Goldbach <[email protected]> *
* *
* This program is free software; you can redistribute it and/or modify it under *
* the terms of the GNU General Public License as published by the Free Software *
* Foundation; either version 3 of the License, or (at your option) any later *
* version. *
* *
* This program is distributed in the hope that it will be useful, but WITHOUT ANY *
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A *
* PARTICULAR PURPOSE. See the GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License along with *
* this program. If not, see <http://www.gnu.org/licenses/>. *
****************************************************************************************/
package com.wildplot.android.rendering
import com.wildplot.android.rendering.graphics.wrapper.ColorWrap
import com.wildplot.android.rendering.graphics.wrapper.GraphicsWrap
import com.wildplot.android.rendering.graphics.wrapper.RectangleWrap
import com.wildplot.android.rendering.interfaces.Drawable
/**
* This class represents grid lines parallel to the y-axis
*/
class YGrid
/**
* Constructor for an Y-Grid object
*
* @param plotSheet the sheet the grid will be drawn onto
* @param ticStart start point for relative positioning of grid
* @param tic the space between two grid lines
*/(
/**
* the Sheet the grid lines will be drawn onto
*/
private val plotSheet: PlotSheet,
/**
* start point for relative positioning of grid
*/
private val ticStart: Double,
/**
* the space between two grid lines
*/
private val tic: Double
) : Drawable {
/**
* the color of the grid lines
*/
private var color = ColorWrap.LIGHT_GRAY
/**
* maximal distance from x axis the grid will be drawn
*/
private var xLength = 10.0
/**
* maximal distance from y axis the grid will be drawn
*/
private var yLength = 2.0
private var mTickPositions: DoubleArray? = null
override fun paint(g: GraphicsWrap) {
val oldColor = g.color
g.color = color
xLength = Math.max(
Math.abs(plotSheet.getxRange()[0]),
Math.abs(
plotSheet.getxRange()[1]
)
)
yLength = Math.max(
Math.abs(plotSheet.getyRange()[0]),
Math.abs(
plotSheet.getyRange()[1]
)
)
val tics = ((ticStart - (0 - xLength)) / tic).toInt()
val leftStart = ticStart - tic * tics
if (mTickPositions == null) {
drawImplicitLines(g, leftStart)
} else {
drawExplicitLines(g)
}
g.color = oldColor
}
private fun drawImplicitLines(g: GraphicsWrap, leftStart: Double) {
val field = g.clipBounds
var currentX = leftStart
while (currentX <= xLength) {
drawGridLine(currentX, g, field)
currentX += tic
}
}
private fun drawExplicitLines(g: GraphicsWrap) {
val field = g.clipBounds
for (currentX in mTickPositions!!) {
drawGridLine(currentX, g, field)
}
}
/**
* Draw a grid line in specified graphics object
*
* @param x x-position the vertical line shall be drawn
* @param g graphic the line shall be drawn onto
* @param field definition of the graphic boundaries
*/
private fun drawGridLine(x: Double, g: GraphicsWrap, field: RectangleWrap) {
g.drawLine(
plotSheet.xToGraphic(x, field), plotSheet.yToGraphic(0.0, field),
plotSheet.xToGraphic(x, field), plotSheet.yToGraphic(yLength, field)
)
g.drawLine(
plotSheet.xToGraphic(x, field), plotSheet.yToGraphic(0.0, field),
plotSheet.xToGraphic(x, field), plotSheet.yToGraphic(-yLength, field)
)
}
override fun isOnFrame(): Boolean {
return false
}
override fun isClusterable(): Boolean {
return true
}
override fun isCritical(): Boolean {
return true
}
fun setColor(color: ColorWrap) {
this.color = color
}
fun setExplicitTicks(tickPositions: DoubleArray?) {
mTickPositions = tickPositions
}
}
| AnkiDroid/src/main/java/com/wildplot/android/rendering/YGrid.kt | 3324538928 |
package fi.evident.apina.output.ts
import fi.evident.apina.model.ApiDefinition
import fi.evident.apina.model.settings.TranslationSettings
import fi.evident.apina.utils.readResourceAsString
/**
* Generates Angular TypeScript code for client side.
*/
class TypeScriptAngularGenerator(api: ApiDefinition, settings: TranslationSettings) : AbstractTypeScriptGenerator(api, settings, "Observable", "@Injectable()") {
override fun writeRuntime() {
out.write(readResourceAsString("typescript/runtime-angular.ts"))
out.writeLine()
}
override fun writePlatformSpecificImports() {
out.writeImport("@angular/core", listOf("Injectable", "NgModule"))
out.writeImport("@angular/common/http", listOf("HttpClient", "HttpClientModule", "HttpParams"))
out.writeImport("rxjs", listOf("Observable"))
out.writeImport("rxjs/operators", listOf("map"))
}
override fun writePlatformSpecific() {
out.writeLine()
out.writeLine("export function apinaConfigFactory() {")
out.writeLine(" return new ApinaConfig();")
out.writeLine("}")
out.writeLine()
out.writeLine("@NgModule({")
out.writeLine(" imports: [HttpClientModule],")
out.writeLine(" providers: [")
for (endpointGroup in api.endpointGroups)
out.writeLine(" " + endpointClassName(endpointGroup) + ",")
out.writeLine(" { provide: ApinaEndpointContext, useClass: DefaultApinaEndpointContext },")
out.writeLine(" { provide: ApinaConfig, useFactory: apinaConfigFactory }")
out.writeLine(" ]")
out.writeLine("})")
out.writeLine("export class ApinaModule {}")
}
}
| apina-core/src/main/kotlin/fi/evident/apina/output/ts/TypeScriptAngularGenerator.kt | 3426517803 |
Subsets and Splits