Merge "Small improvements in code cleanliness" into udc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
8367afeb36
@@ -87,7 +87,7 @@ class KeyboardBacklightDialog(
|
|||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
setUpWindowProperties(this)
|
setUpWindowProperties(this)
|
||||||
setWindowTitle()
|
setWindowPosition()
|
||||||
updateResources()
|
updateResources()
|
||||||
rootView = buildRootView()
|
rootView = buildRootView()
|
||||||
setContentView(rootView)
|
setContentView(rootView)
|
||||||
@@ -233,24 +233,29 @@ class KeyboardBacklightDialog(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setWindowTitle() {
|
private fun setWindowPosition() {
|
||||||
val attrs = window.attributes
|
window?.apply {
|
||||||
attrs.title = "KeyboardBacklightDialog"
|
setGravity(Gravity.BOTTOM or Gravity.CENTER_HORIZONTAL)
|
||||||
attrs?.y = dialogBottomMargin
|
this.attributes =
|
||||||
window.attributes = attrs
|
WindowManager.LayoutParams().apply {
|
||||||
|
copyFrom(attributes)
|
||||||
|
y = dialogBottomMargin
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setUpWindowProperties(dialog: Dialog) {
|
private fun setUpWindowProperties(dialog: Dialog) {
|
||||||
val window = dialog.window
|
dialog.window?.apply {
|
||||||
window.requestFeature(Window.FEATURE_NO_TITLE) // otherwise fails while creating actionBar
|
requestFeature(Window.FEATURE_NO_TITLE) // otherwise fails while creating actionBar
|
||||||
window.setType(WindowManager.LayoutParams.TYPE_STATUS_BAR_SUB_PANEL)
|
setType(WindowManager.LayoutParams.TYPE_STATUS_BAR_SUB_PANEL)
|
||||||
window.addFlags(
|
addFlags(
|
||||||
WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM or
|
WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM or
|
||||||
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
|
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
|
||||||
)
|
)
|
||||||
window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND)
|
clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND)
|
||||||
window.setBackgroundDrawableResource(android.R.color.transparent)
|
setBackgroundDrawableResource(android.R.color.transparent)
|
||||||
window.setGravity(Gravity.BOTTOM or Gravity.CENTER_HORIZONTAL)
|
attributes.title = "KeyboardBacklightDialog"
|
||||||
|
}
|
||||||
setCanceledOnTouchOutside(true)
|
setCanceledOnTouchOutside(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user