Skip to content

Instantly share code, notes, and snippets.

@ktvipin27
Last active May 29, 2020
Embed
What would you like to do?
Demo files created using Android studio template engine.
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<data>
<variable
name="viewModel"
type="com.ktvipin.templatedemo.demo.DemoViewModel" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.ktvipin.templatedemo.demo.DemoActivity">
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
package com.ktvipin.templatedemo.demo
import android.content.Context
import android.content.Intent
import android.os.Bundle
import com.ktvipin.templatedemo.R
import com.ktvipin.templatedemo.core.BaseActivity
import com.ktvipin.templatedemo.databinding.ActivityDemoBinding
class DemoActivity : BaseActivity<ActivityDemoBinding, DemoViewModel>() {
override val layoutId: Int
get() = R.layout.activity_demo
override val viewModelClass: Class<DemoViewModel>
get() = DemoViewModel::class.java
override fun onCreated(savedInstanceState: Bundle?, extras: Bundle?) {
super.onCreated(savedInstanceState, extras)
}
companion object {
fun start(context: Context) {
context.startActivity((Intent(context, DemoActivity::class.java)))
}
}
}
package com.ktvipin.templatedemo.demo
import android.os.Bundle
import com.ktvipin.templatedemo.core.BaseViewModel
class DemoViewModel : BaseViewModel() {
override fun onActivityCreated(extras: Bundle?) {
super.onActivityCreated(extras)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment