Last active
May 29, 2020 07:55
-
-
Save ktvipin27/9bdb916c896c380226f94f3d38d9457f to your computer and use it in GitHub Desktop.
Sample template files for demo of template architecture.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ${escapeKotlinIdentifiers(packageName)} | |
import android.content.Context | |
import android.content.Intent | |
import android.os.Bundle | |
import ${applicationPackage}.R | |
import ${applicationPackage}.core.BaseActivity | |
import ${applicationPackage}.databinding.${underscoreToCamelCase(layoutName)}Binding | |
class ${activityClass} : BaseActivity<${underscoreToCamelCase(layoutName)}Binding,${viewModelClass}>() { | |
override val layoutId: Int | |
get() = R.layout.${layoutName} | |
override val viewModelClass: Class<${viewModelClass}> | |
get() = ${viewModelClass}::class.java | |
override fun onCreated(savedInstanceState: Bundle?, extras: Bundle?) { | |
super.onCreated(savedInstanceState, extras) | |
} | |
companion object{ | |
fun start(context: Context) { | |
context.startActivity((Intent(context,${activityClass}::class.java))) | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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="${packageName}.${viewModelClass}" /> | |
</data> | |
<androidx.constraintlayout.widget.ConstraintLayout | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
tools:context="${packageName}.${activityClass}"> | |
</androidx.constraintlayout.widget.ConstraintLayout> | |
</layout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> | |
<application> | |
<activity android:name="${packageName}.${activityClass}" | |
android:label="@string/title_${activityToLayout(activityClass)}" /> | |
</application> | |
</manifest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<resources> | |
<string name="title_${activityToLayout(activityClass)}">${escapeXmlString(activityTitle)}</string> | |
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ${escapeKotlinIdentifiers(packageName)} | |
import android.os.Bundle | |
import ${applicationPackage}.core.BaseViewModel | |
class ${viewModelClass} : 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