mirror of https://github.com/tasks/tasks
Convert widget config to preference activity
parent
323ec90a33
commit
385e19c363
@ -1,281 +0,0 @@
|
|||||||
package org.tasks.widget;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.app.Dialog;
|
|
||||||
import android.appwidget.AppWidgetManager;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.DialogInterface;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.CheckBox;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import com.google.common.base.Strings;
|
|
||||||
import com.todoroo.astrid.api.Filter;
|
|
||||||
|
|
||||||
import org.tasks.R;
|
|
||||||
import org.tasks.activities.ColorPickerActivity;
|
|
||||||
import org.tasks.activities.FilterSelectionActivity;
|
|
||||||
import org.tasks.dialogs.ColorPickerDialog;
|
|
||||||
import org.tasks.dialogs.DialogBuilder;
|
|
||||||
import org.tasks.dialogs.SeekBarDialog;
|
|
||||||
import org.tasks.injection.DialogFragmentComponent;
|
|
||||||
import org.tasks.injection.ForApplication;
|
|
||||||
import org.tasks.injection.InjectingDialogFragment;
|
|
||||||
import org.tasks.preferences.DefaultFilterProvider;
|
|
||||||
import org.tasks.preferences.Preferences;
|
|
||||||
import org.tasks.themes.Theme;
|
|
||||||
import org.tasks.themes.ThemeCache;
|
|
||||||
|
|
||||||
import java.text.NumberFormat;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
|
|
||||||
import butterknife.BindView;
|
|
||||||
import butterknife.ButterKnife;
|
|
||||||
import butterknife.OnClick;
|
|
||||||
|
|
||||||
import static org.tasks.dialogs.SeekBarDialog.newSeekBarDialog;
|
|
||||||
|
|
||||||
public class WidgetConfigDialog extends InjectingDialogFragment {
|
|
||||||
|
|
||||||
private static final String EXTRA_FILTER = "extra_filter";
|
|
||||||
private static final String EXTRA_THEME = "extra_theme";
|
|
||||||
private static final String EXTRA_APP_WIDGET_ID = "extra_app_widget_id";
|
|
||||||
private static final String EXTRA_OPACITY = "extra_opacity";
|
|
||||||
private static final String EXTRA_FONT_SIZE = "extra_font_size";
|
|
||||||
private static final String FRAG_TAG_SEEKBAR = "frag_tag_seekbar";
|
|
||||||
|
|
||||||
public static WidgetConfigDialog newWidgetConfigDialog(int appWidgetId) {
|
|
||||||
WidgetConfigDialog dialog = new WidgetConfigDialog();
|
|
||||||
dialog.appWidgetId = appWidgetId;
|
|
||||||
return dialog;
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface WidgetConfigCallback {
|
|
||||||
void ok();
|
|
||||||
|
|
||||||
void cancel();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final int REQUEST_FILTER = 1005;
|
|
||||||
private static final int REQUEST_THEME_SELECTION = 1006;
|
|
||||||
private static final int REQUEST_COLOR_SELECTION = 1007;
|
|
||||||
private static final int REQUEST_OPACITY = 1008;
|
|
||||||
private static final int REQUEST_FONT_SIZE = 1009;
|
|
||||||
|
|
||||||
@BindView(R.id.opacity_value) TextView opacityValue;
|
|
||||||
@BindView(R.id.selected_filter) TextView selectedFilter;
|
|
||||||
@BindView(R.id.selected_theme) TextView selectedTheme;
|
|
||||||
@BindView(R.id.selected_color) TextView selectedColor;
|
|
||||||
@BindView(R.id.showDueDate) CheckBox showDueDate;
|
|
||||||
@BindView(R.id.showCheckBoxes) CheckBox showCheckBoxes;
|
|
||||||
@BindView(R.id.showHeader) CheckBox showHeader;
|
|
||||||
@BindView(R.id.font_size_value) TextView selectedFontSize;
|
|
||||||
@BindView(R.id.showSettings) CheckBox showSettings;
|
|
||||||
|
|
||||||
@Inject DialogBuilder dialogBuilder;
|
|
||||||
@Inject DefaultFilterProvider defaultFilterProvider;
|
|
||||||
@Inject Preferences preferences;
|
|
||||||
@Inject @ForApplication Context context;
|
|
||||||
@Inject Theme theme;
|
|
||||||
@Inject ThemeCache themeCache;
|
|
||||||
|
|
||||||
private Filter filter;
|
|
||||||
private int themeIndex = 0;
|
|
||||||
private int colorIndex = 0;
|
|
||||||
private int appWidgetId;
|
|
||||||
private WidgetConfigCallback callback;
|
|
||||||
private int opacityPercentage;
|
|
||||||
private int fontSize;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
|
||||||
|
|
||||||
View view = theme.getLayoutInflater(context).inflate(R.layout.widget_config_activity, null);
|
|
||||||
|
|
||||||
ButterKnife.bind(this, view);
|
|
||||||
|
|
||||||
if (savedInstanceState != null) {
|
|
||||||
themeIndex = savedInstanceState.getInt(EXTRA_THEME);
|
|
||||||
filter = savedInstanceState.getParcelable(EXTRA_FILTER);
|
|
||||||
appWidgetId = savedInstanceState.getInt(EXTRA_APP_WIDGET_ID);
|
|
||||||
opacityPercentage = savedInstanceState.getInt(EXTRA_OPACITY);
|
|
||||||
fontSize = savedInstanceState.getInt(EXTRA_FONT_SIZE);
|
|
||||||
} else {
|
|
||||||
String filterId = preferences.getStringValue(WidgetConfigActivity.PREF_WIDGET_ID + appWidgetId);
|
|
||||||
if (Strings.isNullOrEmpty(filterId)) {
|
|
||||||
filter = defaultFilterProvider.getDefaultFilter();
|
|
||||||
} else {
|
|
||||||
filter = defaultFilterProvider.getFilterFromPreference(filterId);
|
|
||||||
}
|
|
||||||
opacityPercentage = preferences.getInt(WidgetConfigActivity.PREF_WIDGET_OPACITY + appWidgetId, 100);
|
|
||||||
fontSize = preferences.getInt(WidgetConfigActivity.PREF_FONT_SIZE + appWidgetId, 16);
|
|
||||||
themeIndex = preferences.getInt(WidgetConfigActivity.PREF_THEME + appWidgetId, 0);
|
|
||||||
colorIndex = preferences.getInt(WidgetConfigActivity.PREF_COLOR + appWidgetId, 0);
|
|
||||||
showDueDate.setChecked(preferences.getBoolean(WidgetConfigActivity.PREF_SHOW_DUE_DATE + appWidgetId, true));
|
|
||||||
showCheckBoxes.setChecked(preferences.getBoolean(WidgetConfigActivity.PREF_SHOW_CHECKBOXES + appWidgetId, true));
|
|
||||||
showHeader.setChecked(preferences.getBoolean(WidgetConfigActivity.PREF_SHOW_HEADER + appWidgetId, true));
|
|
||||||
showSettings.setChecked(preferences.getBoolean(WidgetConfigActivity.PREF_SHOW_SETTINGS + appWidgetId, true));
|
|
||||||
}
|
|
||||||
|
|
||||||
updateFilter();
|
|
||||||
updateTheme();
|
|
||||||
updateColor();
|
|
||||||
updateOpacity();
|
|
||||||
updateFontSize();
|
|
||||||
|
|
||||||
return dialogBuilder.newDialog()
|
|
||||||
.setView(view)
|
|
||||||
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
|
||||||
saveConfiguration();
|
|
||||||
callback.ok();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialogInterface, int i) {
|
|
||||||
callback.cancel();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSaveInstanceState(Bundle outState) {
|
|
||||||
super.onSaveInstanceState(outState);
|
|
||||||
|
|
||||||
outState.putInt(EXTRA_APP_WIDGET_ID, appWidgetId);
|
|
||||||
outState.putInt(EXTRA_THEME, themeIndex);
|
|
||||||
outState.putInt(EXTRA_OPACITY, opacityPercentage);
|
|
||||||
outState.putInt(EXTRA_FONT_SIZE, fontSize);
|
|
||||||
outState.putParcelable(EXTRA_FILTER, filter);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCancel(DialogInterface dialog) {
|
|
||||||
super.onCancel(dialog);
|
|
||||||
|
|
||||||
callback.cancel();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onAttach(Activity activity) {
|
|
||||||
super.onAttach(activity);
|
|
||||||
|
|
||||||
callback = (WidgetConfigCallback) getActivity();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateFilter() {
|
|
||||||
selectedFilter.setText(filter.listingTitle);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateOpacity() {
|
|
||||||
opacityValue.setText(NumberFormat.getPercentInstance().format(opacityPercentage / 100.0));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateFontSize() {
|
|
||||||
selectedFontSize.setText(NumberFormat.getIntegerInstance().format(fontSize));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateTheme() {
|
|
||||||
selectedTheme.setText(themeCache.getWidgetTheme(themeIndex).getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateColor() {
|
|
||||||
selectedColor.setText(themeCache.getThemeColor(colorIndex).getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
@OnClick(R.id.filter_selection)
|
|
||||||
void changeFilter() {
|
|
||||||
startActivityForResult(new Intent(getActivity(), FilterSelectionActivity.class) {{
|
|
||||||
putExtra(FilterSelectionActivity.EXTRA_RETURN_FILTER, true);
|
|
||||||
}}, REQUEST_FILTER);
|
|
||||||
}
|
|
||||||
|
|
||||||
@OnClick(R.id.theme_selection)
|
|
||||||
public void showThemeSelection() {
|
|
||||||
startActivityForResult(new Intent(context, ColorPickerActivity.class) {{
|
|
||||||
putExtra(ColorPickerActivity.EXTRA_PALETTE, ColorPickerDialog.ColorPalette.WIDGET_BACKGROUND);
|
|
||||||
}}, REQUEST_THEME_SELECTION);
|
|
||||||
}
|
|
||||||
|
|
||||||
@OnClick(R.id.theme_color)
|
|
||||||
public void showColorSelection() {
|
|
||||||
startActivityForResult(new Intent(context, ColorPickerActivity.class) {{
|
|
||||||
putExtra(ColorPickerActivity.EXTRA_PALETTE, ColorPickerDialog.ColorPalette.COLORS);
|
|
||||||
}}, REQUEST_COLOR_SELECTION);
|
|
||||||
}
|
|
||||||
|
|
||||||
@OnClick(R.id.widget_opacity)
|
|
||||||
public void showOpacitySlider() {
|
|
||||||
SeekBarDialog seekBarDialog = newSeekBarDialog(R.layout.dialog_opacity_seekbar, opacityPercentage);
|
|
||||||
seekBarDialog.setTargetFragment(this, REQUEST_OPACITY);
|
|
||||||
seekBarDialog.show(getChildFragmentManager(), FRAG_TAG_SEEKBAR);
|
|
||||||
}
|
|
||||||
|
|
||||||
@OnClick(R.id.font_size)
|
|
||||||
public void showFontSizeSlider() {
|
|
||||||
SeekBarDialog seekBarDialog = newSeekBarDialog(R.layout.dialog_font_size_seekbar, fontSize);
|
|
||||||
seekBarDialog.setTargetFragment(this, REQUEST_FONT_SIZE);
|
|
||||||
seekBarDialog.show(getChildFragmentManager(), FRAG_TAG_SEEKBAR);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void inject(DialogFragmentComponent component) {
|
|
||||||
component.inject(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
|
||||||
if (requestCode == REQUEST_THEME_SELECTION) {
|
|
||||||
if (resultCode == Activity.RESULT_OK) {
|
|
||||||
themeIndex = data.getIntExtra(ColorPickerActivity.EXTRA_THEME_INDEX, 0);
|
|
||||||
updateTheme();
|
|
||||||
}
|
|
||||||
} else if (requestCode == REQUEST_COLOR_SELECTION) {
|
|
||||||
if (resultCode == Activity.RESULT_OK) {
|
|
||||||
colorIndex = data.getIntExtra(ColorPickerActivity.EXTRA_THEME_INDEX, 0);
|
|
||||||
updateColor();
|
|
||||||
}
|
|
||||||
} else if (requestCode == REQUEST_FILTER) {
|
|
||||||
if (resultCode == Activity.RESULT_OK) {
|
|
||||||
filter = data.getParcelableExtra(FilterSelectionActivity.EXTRA_FILTER);
|
|
||||||
updateFilter();
|
|
||||||
}
|
|
||||||
} else if (requestCode == REQUEST_OPACITY) {
|
|
||||||
if (resultCode == Activity.RESULT_OK) {
|
|
||||||
opacityPercentage = data.getIntExtra(SeekBarDialog.EXTRA_VALUE, 100);
|
|
||||||
updateOpacity();
|
|
||||||
}
|
|
||||||
} else if (requestCode == REQUEST_FONT_SIZE) {
|
|
||||||
if (resultCode == Activity.RESULT_OK) {
|
|
||||||
fontSize = data.getIntExtra(SeekBarDialog.EXTRA_VALUE, 16);
|
|
||||||
updateFontSize();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
super.onActivityResult(requestCode, resultCode, data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void saveConfiguration(){
|
|
||||||
preferences.setString(WidgetConfigActivity.PREF_WIDGET_ID + appWidgetId, defaultFilterProvider.getFilterPreferenceValue(filter));
|
|
||||||
preferences.setBoolean(WidgetConfigActivity.PREF_SHOW_DUE_DATE + appWidgetId, showDueDate.isChecked());
|
|
||||||
preferences.setBoolean(WidgetConfigActivity.PREF_SHOW_CHECKBOXES+ appWidgetId, showCheckBoxes.isChecked());
|
|
||||||
preferences.setBoolean(WidgetConfigActivity.PREF_SHOW_HEADER + appWidgetId, showHeader.isChecked());
|
|
||||||
preferences.setBoolean(WidgetConfigActivity.PREF_SHOW_SETTINGS + appWidgetId, showSettings.isChecked());
|
|
||||||
preferences.setInt(WidgetConfigActivity.PREF_THEME + appWidgetId, themeIndex);
|
|
||||||
preferences.setInt(WidgetConfigActivity.PREF_COLOR + appWidgetId, colorIndex);
|
|
||||||
preferences.setInt(WidgetConfigActivity.PREF_WIDGET_OPACITY + appWidgetId, opacityPercentage);
|
|
||||||
preferences.setInt(WidgetConfigActivity.PREF_FONT_SIZE + appWidgetId, fontSize);
|
|
||||||
|
|
||||||
// force update after setting preferences
|
|
||||||
context.sendBroadcast(new Intent(context, TasksWidget.class) {{
|
|
||||||
setAction(AppWidgetManager.ACTION_APPWIDGET_UPDATE);
|
|
||||||
putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, new int[]{appWidgetId});
|
|
||||||
}});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -0,0 +1,78 @@
|
|||||||
|
package org.tasks.widget;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import org.tasks.R;
|
||||||
|
import org.tasks.preferences.Preferences;
|
||||||
|
|
||||||
|
public class WidgetPreferences {
|
||||||
|
private final Context context;
|
||||||
|
private final Preferences preferences;
|
||||||
|
private final int widgetId;
|
||||||
|
|
||||||
|
public WidgetPreferences(Context context, Preferences preferences, int widgetId) {
|
||||||
|
this.context = context;
|
||||||
|
this.preferences = preferences;
|
||||||
|
this.widgetId = widgetId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean showDueDate() {
|
||||||
|
return preferences.getBoolean(getKey(R.string.p_widget_show_due_date), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean showHeader() {
|
||||||
|
return preferences.getBoolean(getKey(R.string.p_widget_show_header), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean showCheckboxes() {
|
||||||
|
return preferences.getBoolean(getKey(R.string.p_widget_show_checkboxes), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean showSettings() {
|
||||||
|
return preferences.getBoolean(getKey(R.string.p_widget_show_settings), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getFontSize() {
|
||||||
|
return preferences.getInt(getKey(R.string.p_widget_font_size), 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFilterId() {
|
||||||
|
return preferences.getStringValue(getKey(R.string.p_widget_filter));
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getThemeIndex() {
|
||||||
|
return preferences.getInt(getKey(R.string.p_widget_theme), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getColorIndex() {
|
||||||
|
return preferences.getInt(getKey(R.string.p_widget_color), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getOpacity() {
|
||||||
|
return preferences.getInt(getKey(R.string.p_widget_opacity), 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOpacity(int value) {
|
||||||
|
preferences.setInt(getKey(R.string.p_widget_opacity), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFontSize(int value) {
|
||||||
|
preferences.setInt(getKey(R.string.p_widget_font_size), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setColor(int index) {
|
||||||
|
preferences.setInt(getKey(R.string.p_widget_color), index);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTheme(int index) {
|
||||||
|
preferences.setInt(getKey(R.string.p_widget_theme), index);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getKey(int resId) {
|
||||||
|
return context.getString(resId) + widgetId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFilter(String filterPreferenceValue) {
|
||||||
|
preferences.setString(getKey(R.string.p_widget_filter), filterPreferenceValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,177 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<RelativeLayout
|
|
||||||
android:id="@+id/filter_selection"
|
|
||||||
style="@style/WidgetConfigRow">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/selected_filter"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_alignParentEnd="true"
|
|
||||||
android:layout_alignParentRight="true"
|
|
||||||
android:textColor="?attr/asTextColor"
|
|
||||||
android:textSize="18sp" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_alignParentLeft="true"
|
|
||||||
android:layout_alignParentStart="true"
|
|
||||||
android:layout_toLeftOf="@id/selected_filter"
|
|
||||||
android:layout_toStartOf="@id/selected_filter"
|
|
||||||
android:text="@string/filter"
|
|
||||||
android:gravity="start"
|
|
||||||
android:textAlignment="viewStart"
|
|
||||||
android:textColor="?attr/asTextColor"
|
|
||||||
android:textSize="18sp" />
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
<RelativeLayout
|
|
||||||
android:id="@+id/theme_selection"
|
|
||||||
style="@style/WidgetConfigRow">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/selected_theme"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_alignParentEnd="true"
|
|
||||||
android:layout_alignParentRight="true"
|
|
||||||
android:textColor="?attr/asTextColor"
|
|
||||||
android:textSize="18sp" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_alignParentLeft="true"
|
|
||||||
android:layout_alignParentStart="true"
|
|
||||||
android:layout_toLeftOf="@id/selected_theme"
|
|
||||||
android:layout_toStartOf="@id/selected_theme"
|
|
||||||
android:text="@string/theme"
|
|
||||||
android:gravity="start"
|
|
||||||
android:textAlignment="viewStart"
|
|
||||||
android:textColor="?attr/asTextColor"
|
|
||||||
android:textSize="18sp" />
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
<RelativeLayout
|
|
||||||
android:id="@+id/theme_color"
|
|
||||||
style="@style/WidgetConfigRow">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/selected_color"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_alignParentEnd="true"
|
|
||||||
android:layout_alignParentRight="true"
|
|
||||||
android:textColor="?attr/asTextColor"
|
|
||||||
android:textSize="18sp" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_alignParentLeft="true"
|
|
||||||
android:layout_alignParentStart="true"
|
|
||||||
android:layout_toLeftOf="@id/selected_color"
|
|
||||||
android:layout_toStartOf="@id/selected_color"
|
|
||||||
android:text="@string/color"
|
|
||||||
android:gravity="start"
|
|
||||||
android:textAlignment="viewStart"
|
|
||||||
android:textColor="?attr/asTextColor"
|
|
||||||
android:textSize="18sp" />
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
<RelativeLayout
|
|
||||||
android:id="@+id/widget_opacity"
|
|
||||||
style="@style/WidgetConfigRow">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/opacity_value"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_alignParentEnd="true"
|
|
||||||
android:layout_alignParentRight="true"
|
|
||||||
android:textColor="?attr/asTextColor"
|
|
||||||
android:textSize="18sp" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_alignParentLeft="true"
|
|
||||||
android:layout_alignParentStart="true"
|
|
||||||
android:layout_toLeftOf="@id/opacity_value"
|
|
||||||
android:layout_toStartOf="@id/opacity_value"
|
|
||||||
android:text="@string/opacity"
|
|
||||||
android:gravity="start"
|
|
||||||
android:textAlignment="viewStart"
|
|
||||||
android:textColor="?attr/asTextColor"
|
|
||||||
android:textSize="18sp" />
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
<RelativeLayout
|
|
||||||
android:id="@+id/font_size"
|
|
||||||
style="@style/WidgetConfigRow">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/font_size_value"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_alignParentEnd="true"
|
|
||||||
android:layout_alignParentRight="true"
|
|
||||||
android:textColor="?attr/asTextColor"
|
|
||||||
android:textSize="18sp" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_alignParentLeft="true"
|
|
||||||
android:layout_alignParentStart="true"
|
|
||||||
android:layout_toLeftOf="@id/font_size_value"
|
|
||||||
android:layout_toStartOf="@id/font_size_value"
|
|
||||||
android:text="@string/font_size"
|
|
||||||
android:gravity="start"
|
|
||||||
android:textAlignment="viewStart"
|
|
||||||
android:textColor="?attr/asTextColor"
|
|
||||||
android:textSize="18sp" />
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
<CheckBox
|
|
||||||
android:id="@+id/showDueDate"
|
|
||||||
style="@style/WidgetConfigRow.CheckBox"
|
|
||||||
android:checked="true"
|
|
||||||
android:text="@string/widget_show_due_date" />
|
|
||||||
|
|
||||||
<CheckBox
|
|
||||||
android:id="@+id/showCheckBoxes"
|
|
||||||
style="@style/WidgetConfigRow.CheckBox"
|
|
||||||
android:checked="true"
|
|
||||||
android:text="@string/widget_show_checkboxes" />
|
|
||||||
|
|
||||||
<CheckBox
|
|
||||||
android:id="@+id/showHeader"
|
|
||||||
style="@style/WidgetConfigRow.CheckBox"
|
|
||||||
android:checked="true"
|
|
||||||
android:text="@string/widget_show_header" />
|
|
||||||
|
|
||||||
<CheckBox
|
|
||||||
android:id="@+id/showSettings"
|
|
||||||
style="@style/WidgetConfigRow.CheckBox"
|
|
||||||
android:checked="true"
|
|
||||||
android:text="@string/widget_show_settings" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</ScrollView>
|
|
||||||
@ -0,0 +1,50 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<com.todoroo.astrid.ui.MultilinePreference
|
||||||
|
android:key="@string/p_widget_filter"
|
||||||
|
android:title="@string/filter" />
|
||||||
|
|
||||||
|
<com.todoroo.astrid.ui.MultilinePreference
|
||||||
|
android:key="@string/p_widget_theme"
|
||||||
|
android:title="@string/theme" />
|
||||||
|
|
||||||
|
<com.todoroo.astrid.ui.MultilinePreference
|
||||||
|
android:key="@string/p_widget_opacity"
|
||||||
|
android:title="@string/opacity" />
|
||||||
|
|
||||||
|
<PreferenceCategory
|
||||||
|
android:title="@string/widget_header_settings">
|
||||||
|
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:title="@string/widget_show_header"
|
||||||
|
android:key="@string/p_widget_show_header" />
|
||||||
|
|
||||||
|
<com.todoroo.astrid.ui.MultilinePreference
|
||||||
|
android:key="@string/p_widget_color"
|
||||||
|
android:title="@string/color" />
|
||||||
|
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:key="@string/p_widget_show_settings"
|
||||||
|
android:title="@string/widget_show_settings" />
|
||||||
|
|
||||||
|
</PreferenceCategory>
|
||||||
|
|
||||||
|
<PreferenceCategory
|
||||||
|
android:title="@string/widget_row_settings">
|
||||||
|
|
||||||
|
<com.todoroo.astrid.ui.MultilinePreference
|
||||||
|
android:key="@string/p_widget_font_size"
|
||||||
|
android:title="@string/font_size" />
|
||||||
|
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:key="@string/p_widget_show_due_date"
|
||||||
|
android:title="@string/widget_show_due_date" />
|
||||||
|
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:key="@string/p_widget_show_checkboxes"
|
||||||
|
android:title="@string/widget_show_checkboxes" />
|
||||||
|
|
||||||
|
</PreferenceCategory>
|
||||||
|
|
||||||
|
</PreferenceScreen>
|
||||||
Loading…
Reference in New Issue