Automation layouts improvement

This commit is contained in:
Milos Kozak 2019-10-01 13:11:10 +02:00
parent 2d395b625e
commit 3ecee09443
10 changed files with 34 additions and 8 deletions

View file

@ -77,7 +77,7 @@ class AutomationFragment : Fragment() {
if (eventListAdapter == null) return if (eventListAdapter == null) return
eventListAdapter?.notifyDataSetChanged() eventListAdapter?.notifyDataSetChanged()
val sb = StringBuilder() val sb = StringBuilder()
for (l in AutomationPlugin.executionLog) { for (l in AutomationPlugin.executionLog.reversed()) {
sb.append(l) sb.append(l)
sb.append("\n") sb.append("\n")
} }

View file

@ -56,6 +56,11 @@ class ChooseActionDialog : DialogFragment() {
cancel.setOnClickListener { dismiss() } cancel.setOnClickListener { dismiss() }
} }
override fun onStart() {
super.onStart()
dialog?.window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
}
override fun onSaveInstanceState(bundle: Bundle) { override fun onSaveInstanceState(bundle: Bundle) {
bundle.putInt("checkedIndex", determineCheckedIndex()) bundle.putInt("checkedIndex", determineCheckedIndex())
} }

View file

@ -58,6 +58,11 @@ class ChooseTriggerDialog : DialogFragment() {
cancel.setOnClickListener { dismiss() } cancel.setOnClickListener { dismiss() }
} }
override fun onStart() {
super.onStart()
dialog?.window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
}
fun setOnClickListener(clickListener: OnClickListener) { fun setOnClickListener(clickListener: OnClickListener) {
this.clickListener = clickListener this.clickListener = clickListener
} }

View file

@ -14,7 +14,6 @@ import kotlinx.android.synthetic.main.okcancel.*
import org.json.JSONObject import org.json.JSONObject
class EditActionDialog : DialogFragment() { class EditActionDialog : DialogFragment() {
private var action: Action? = null private var action: Action? = null
private var actionPosition: Int = -1 private var actionPosition: Int = -1
@ -51,6 +50,11 @@ class EditActionDialog : DialogFragment() {
cancel.setOnClickListener { dismiss() } cancel.setOnClickListener { dismiss() }
} }
override fun onStart() {
super.onStart()
dialog?.window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
}
override fun onSaveInstanceState(bundle: Bundle) { override fun onSaveInstanceState(bundle: Bundle) {
super.onSaveInstanceState(bundle) super.onSaveInstanceState(bundle)
action?.let { action?.let {

View file

@ -137,6 +137,11 @@ class EditEventDialog : DialogFragment() {
) )
} }
override fun onStart() {
super.onStart()
dialog?.window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
}
override fun onDestroyView() { override fun onDestroyView() {
super.onDestroyView() super.onDestroyView()
disposable.clear() disposable.clear()

View file

@ -31,18 +31,23 @@ class EditTriggerDialog : DialogFragment() {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
// display root trigger // display root trigger
trigger?.let { it.generateDialog(automation_layoutTrigger, fragmentManager) } trigger?.generateDialog(automation_layoutTrigger, fragmentManager)
// OK button // OK button
ok.setOnClickListener { ok.setOnClickListener {
dismiss() dismiss()
RxBus.send(EventAutomationUpdateTrigger(trigger!!)) trigger?.let { trigger -> RxBus.send(EventAutomationUpdateTrigger(trigger)) }
} }
// Cancel button // Cancel button
cancel.setOnClickListener { dismiss() } cancel.setOnClickListener { dismiss() }
} }
override fun onStart() {
super.onStart()
dialog?.window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
}
override fun onSaveInstanceState(bundle: Bundle) { override fun onSaveInstanceState(bundle: Bundle) {
super.onSaveInstanceState(bundle) super.onSaveInstanceState(bundle)
trigger?.let { bundle.putString("trigger", it.toJSON()) } trigger?.let { bundle.putString("trigger", it.toJSON()) }

View file

@ -2,7 +2,6 @@
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:minWidth="300dp"
android:padding="10dp"> android:padding="10dp">
<LinearLayout <LinearLayout

View file

@ -15,7 +15,8 @@
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/please_choose_an_action_type" /> android:text="@string/please_choose_an_action_type"
android:textAppearance="@style/TextAppearance.AppCompat.Large" />
<RadioGroup <RadioGroup
android:id="@+id/automation_radioGroup" android:id="@+id/automation_radioGroup"

View file

@ -15,7 +15,8 @@
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/please_choose_a_trigger_type" /> android:text="@string/please_choose_a_trigger_type"
android:textAppearance="@style/TextAppearance.AppCompat.Large" />
<RadioGroup <RadioGroup
android:id="@+id/automation_chooseTriggerRadioGroup" android:id="@+id/automation_chooseTriggerRadioGroup"

View file

@ -15,7 +15,8 @@
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/triggers" /> android:text="@string/triggers"
android:textAppearance="@style/TextAppearance.AppCompat.Large" />
<LinearLayout <LinearLayout
android:id="@+id/automation_layoutTrigger" android:id="@+id/automation_layoutTrigger"