Skip to content

Commit

Permalink
#1 feat: Databinding apply
Browse files Browse the repository at this point in the history
  • Loading branch information
l2hyunwoo committed Nov 6, 2020
1 parent e41a3be commit 416e486
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-kapt'
}

android {
Expand All @@ -17,6 +18,10 @@ android {
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildFeatures {
dataBinding true
}

buildTypes {
release {
minifyEnabled false
Expand Down
16 changes: 16 additions & 0 deletions app/src/main/java/com/siba/baseclass/BaseActivity.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.siba.baseclass

import android.os.Bundle
import androidx.annotation.LayoutRes
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding

abstract class BaseActivity<T : ViewDataBinding>(@LayoutRes private val layoutResId: Int) : AppCompatActivity() {
protected lateinit var binding: T

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = DataBindingUtil.setContentView(this, layoutResId)
}
}

0 comments on commit 416e486

Please sign in to comment.