Depracated - use Anko by jetbrains
A collection of Kotlin extensions for Android, based on KotlinAndroidLib and Android Kotlin Extensions.
abstract class BaseFragment<VB : ViewDataBinding, VM : BaseViewModel> : DaggerFragment() { | |
abstract fun getViewModelClass(): Class<VM> | |
abstract fun layoutId(): Int | |
@Inject | |
lateinit var viewModelFactory: ViewModelProvider.Factory | |
protected lateinit var binding: VB | |
protected lateinit var viewModel: VM |
inline fun <V : View> V.alpha(alpha: Double): V { | |
this.alpha = alpha.toFloat() | |
return this | |
} | |
inline fun <V : View> V.backgroundColor(color: Int): V { | |
backgroundColor = color | |
return this | |
} |
class AnkoUIMaker(val context: Context) { | |
private val constraintlayoutID = R.id.ankoConstraintLayout | |
fun UiMake(): View = | |
context.constraintLayout { | |
id = constraintlayoutID | |
// 추가 | |
textView("Anko Hello").lparams(wrapContent, wrapContent) { | |
startToStart = constraintlayoutID | |
endToEnd = constraintlayoutID | |
topToTop = constraintlayoutID |
class AnkoViewHolder<out V : AnkoComponent<ViewGroup>>(val parent: ViewGroup, val createUI: () -> V) { | |
class ViewHolder<out V : AnkoComponent<ViewGroup>>(val view: View, val ui: V) : RecyclerView.ViewHolder(view) | |
val ankoContext by lazy { AnkoContext.createReusable(parent.context, parent) } | |
val viewHolder by lazy { | |
val ui = createUI() | |
val view = ui.createView(ankoContext) | |
view.setupTapEffectForBG(true) // default for every item in application | |
// TODO some items may be disabled... | |
ViewHolder(view, ui) |
service: service-name | |
provider: | |
name: aws | |
runtime: nodejs6.10 | |
functions: | |
myfunc: | |
handler: handler.myfunc |
Depracated - use Anko by jetbrains
A collection of Kotlin extensions for Android, based on KotlinAndroidLib and Android Kotlin Extensions.
/** | |
* ANY | |
*/ | |
fun Any.toJson(): String = GsonInitializer.toJson(this) | |
/** | |
* VIEW | |
*/ | |
fun View.toggleVisibility(setAsVisible: Boolean) = if (setAsVisible) this.visible() else this.gone() |
apply plugin: 'android' | |
android { | |
compileSdkVersion 19 | |
buildToolsVersion "19.0.3" | |
defaultConfig { | |
minSdkVersion 14 | |
targetSdkVersion 19 | |
versionCode 23 |
// Added by Ben Yanke | |
// from https://gist.github.com/benyanke/862e446e5a816551928d8acc2d98b752 | |
console.log('Loading function'); | |
const https = require('https'); | |
const url = require('url'); | |
// SETUP | |
// urlToUse = in this environment variable, place the name of another environment variable which contains the key. | |
// This allows easy dev/prod switching. |
import com.amazonaws.auth.profile.internal.{BasicProfile, ProfileStaticCredentialsProvider} | |
import com.amazonaws.auth.profile.{ProfileCredentialsProvider, ProfilesConfigFile} | |
import com.amazonaws.auth.{AWSCredentials, AWSCredentialsProvider, AWSStaticCredentialsProvider, BasicSessionCredentials, DefaultAWSCredentialsProviderChain} | |
import com.amazonaws.services.s3.AmazonS3ClientBuilder | |
import com.amazonaws.services.securitytoken.model.{AssumeRoleRequest, GetSessionTokenRequest} | |
import com.amazonaws.services.securitytoken.{AWSSecurityTokenServiceClient, AWSSecurityTokenServiceClientBuilder} | |
import scala.collection.JavaConversions._ | |
object STSTesting { |