Minor widget tweaks

pull/996/head
Alex Baker 5 years ago
parent 5c0ec4a5a3
commit ccde7f61a2

@ -64,8 +64,8 @@ class ScrollableWidget : InjectingPreferenceFragment() {
setupSlider(R.string.p_widget_font_size, 16) setupSlider(R.string.p_widget_font_size, 16)
setupCheckbox(R.string.p_widget_show_due_date) setupCheckbox(R.string.p_widget_show_due_date)
setupCheckbox(R.string.p_widget_show_checkboxes) setupCheckbox(R.string.p_widget_show_checkboxes)
setupCheckbox(R.string.p_widget_due_date_underneath) setupCheckbox(R.string.p_widget_due_date_underneath, false)
setupCheckbox(R.string.p_widget_show_full_task_title) setupCheckbox(R.string.p_widget_show_full_task_title, false)
setupList(R.string.p_widget_spacing) setupList(R.string.p_widget_spacing)
val showHeader = setupCheckbox(R.string.p_widget_show_header) val showHeader = setupCheckbox(R.string.p_widget_show_header)
val showSettings = setupCheckbox(R.string.p_widget_show_settings) val showSettings = setupCheckbox(R.string.p_widget_show_settings)
@ -163,11 +163,11 @@ class ScrollableWidget : InjectingPreferenceFragment() {
return preference return preference
} }
private fun setupCheckbox(resId: Int): SwitchPreferenceCompat { private fun setupCheckbox(resId: Int, defaultValue: Boolean = true): SwitchPreferenceCompat {
val preference = findPreference(resId) as SwitchPreferenceCompat val preference = findPreference(resId) as SwitchPreferenceCompat
val key = getString(resId) + appWidgetId val key = getString(resId) + appWidgetId
preference.key = key preference.key = key
preference.isChecked = preferences.getBoolean(key, true) preference.isChecked = preferences.getBoolean(key, defaultValue)
return preference return preference
} }

@ -16,7 +16,7 @@
android:layout_alignParentStart="true" android:layout_alignParentStart="true"
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:padding="@dimen/widget_padding" android:padding="@dimen/widget_padding"
tools:src="@drawable/ic_outline_check_box_outline_blank_24px"/> tools:src="@drawable/ic_outline_check_box_outline_blank_24px" />
<TextView <TextView
android:id="@+id/widget_due_end" android:id="@+id/widget_due_end"
@ -31,12 +31,12 @@
android:singleLine="true" android:singleLine="true"
android:textAlignment="viewStart" android:textAlignment="viewStart"
android:textSize="14sp" android:textSize="14sp"
tools:text="Tomorrow"/> tools:text="Tomorrow" />
<TextView <TextView
android:id="@+id/widget_text"
android:layout_toEndOf="@id/widget_complete_box" android:layout_toEndOf="@id/widget_complete_box"
android:layout_toStartOf="@id/widget_due_end" android:layout_toStartOf="@id/widget_due_end"
android:id="@+id/widget_text"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignBaseline="@id/widget_complete_box" android:layout_alignBaseline="@id/widget_complete_box"
@ -45,9 +45,10 @@
android:paddingStart="0dp" android:paddingStart="0dp"
android:gravity="start|center_vertical" android:gravity="start|center_vertical"
android:maxLines="1" android:maxLines="1"
android:ellipsize="end"
android:textAlignment="viewStart" android:textAlignment="viewStart"
android:textSize="16sp" android:textSize="16sp"
tools:text="Task title"/> tools:text="Task title" />
<TextView <TextView
android:id="@+id/widget_due_bottom" android:id="@+id/widget_due_bottom"
@ -60,7 +61,7 @@
android:singleLine="true" android:singleLine="true"
android:textAlignment="viewStart" android:textAlignment="viewStart"
android:textSize="14sp" android:textSize="14sp"
tools:text="Tomorrow"/> tools:text="Tomorrow" />
<ImageView <ImageView
android:id="@+id/divider" android:id="@+id/divider"

@ -49,10 +49,13 @@
app:min="10" app:min="10"
app:showSeekBarValue="true" /> app:showSeekBarValue="true" />
<SwitchPreferenceCompat <ListPreference
android:defaultValue="false" android:defaultValue="0"
android:key="@string/p_widget_show_full_task_title" android:key="@string/p_widget_spacing"
android:title="@string/EPr_fullTask_title" /> android:entries="@array/widget_spacing_titles"
android:entryValues="@array/widget_spacing_values"
android:title="@string/row_spacing"
android:summary="%s" />
<SwitchPreferenceCompat <SwitchPreferenceCompat
android:key="@string/p_widget_show_due_date" android:key="@string/p_widget_show_due_date"
@ -62,13 +65,10 @@
android:key="@string/p_widget_show_checkboxes" android:key="@string/p_widget_show_checkboxes"
android:title="@string/widget_show_checkboxes" /> android:title="@string/widget_show_checkboxes" />
<ListPreference <SwitchPreferenceCompat
android:defaultValue="0" android:defaultValue="false"
android:key="@string/p_widget_spacing" android:key="@string/p_widget_show_full_task_title"
android:entries="@array/widget_spacing_titles" android:title="@string/EPr_fullTask_title" />
android:entryValues="@array/widget_spacing_values"
android:title="@string/row_spacing"
android:summary="%s" />
<SwitchPreferenceCompat <SwitchPreferenceCompat
android:defaultValue="false" android:defaultValue="false"

Loading…
Cancel
Save