Skip to content

Instantly share code, notes, and snippets.

View wellingtoncosta's full-sized avatar

Wellington Costa wellingtoncosta

View GitHub Profile
<androidx.constraintlayout.widget.ConstraintLayout
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"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.FragmentTwo">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar_fragment_two"
<androidx.constraintlayout.widget.ConstraintLayout
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"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.FragmentOne">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar_fragment_one"
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.MainActivity">
<FrameLayout
android:id="@+id/frame_layout"
android:layout_width="match_parent"
class AwesomeActivity : Activity(), CallbackListener {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstance)
setContentView(R.layout.awesome_activity)
}
override fun onCallback() {
Toast.makeText(context, "onCallback called!", Toast.LENGTH_LONG).show()
}
}
class AwesomeFragment : Fragment() {
private var callback: CallbackListener? = null
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_awesome, container, false)
}
override fun onActivityCreated(savedInstanceState: Bundle?) {
interface CallbackListener {
fun onCallback()
}
//versions
ext.kotlin_version = '1.2.51'
ext.support_version = '27.1.1'
ext.dagger_version = '2.16'
ext.room_version = '1.1.1'
dependencies {
// Kotlin
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
apply plugin: 'kotlin-kapt'
class ListContactsViewHolder(view: View) : RecyclerView.ViewHolder(view) {
val binding: ListContactItemBinding? = DataBindingUtil.bind(view)
}