<?xml version="1.0" encoding="utf-8"?>
<example.com.exampledrawview.CustomLinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<example.com.exampledrawview.CustomTextView
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
data class City(val name: String, val isEnabled: Boolean) { | |
override fun toString(): String { | |
return name | |
} | |
} |
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
class MainActivity : AppCompatActivity() { | |
... | |
private var notificationsActionView: NotificationsActionView? = null | |
... | |
override fun onCreateOptionsMenu(menu: Menu): Boolean { | |
menuInflater.inflate(R.menu.main_menu, menu) | |
return true | |
} | |
override fun onPrepareOptionsMenu(menu: Menu?): Boolean { |
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
class MyDialogFragment : DialogFragment() { | |
... | |
private fun setupToolbar() { | |
setupToolbarCloseButton(toolbar, R.string.my_dialog_title) | |
setupToolbarMenu() | |
} | |
private fun setupToolbarMenu() { | |
toolbar.inflateMenu(R.menu.menu_my_dialog) | |
toolbar.setOnMenuItemClickListener { menuItem -> |
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
... | |
import androidx.fragment.app.DialogFragment | |
import android.os.Handler | |
... | |
class MyDialogFragment : DialogFragment() { | |
... | |
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | |
super.onViewCreated(view, savedInstanceState) | |
setupSlideFromTopAnimation() | |
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
... | |
import androidx.fragment.app.DialogFragment | |
... | |
class MyDialogFragmentDialog : DialogFragment() { | |
... | |
private val statusBarColorRes = R.color.colorPrimaryDark | |
private var previousSystemUiVisibility: Int? = null | |
... | |
override fun getTheme(): Int = R.style.FullscreenDialog | |
... |
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
fun DialogFragment.setupWidthToMatchParent() { | |
dialog?.window?.setLayout( | |
ViewGroup.LayoutParams.MATCH_PARENT, | |
ViewGroup.LayoutParams.WRAP_CONTENT | |
) | |
} |
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
fun DialogFragment.setupToShowAtTheTop() { | |
dialog?.window?.setGravity(Gravity.CENTER_HORIZONTAL or Gravity.TOP) | |
} |