|
|
@ -30,6 +30,7 @@ import org.tasks.widget.WidgetHelper;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.inject.Inject;
|
|
|
|
import javax.inject.Inject;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import static com.todoroo.andlib.utility.AndroidUtilities.preHoneycomb;
|
|
|
|
import static com.todoroo.andlib.utility.AndroidUtilities.preIceCreamSandwich;
|
|
|
|
import static com.todoroo.andlib.utility.AndroidUtilities.preIceCreamSandwich;
|
|
|
|
|
|
|
|
|
|
|
|
public class WidgetConfigActivity extends InjectingListActivity {
|
|
|
|
public class WidgetConfigActivity extends InjectingListActivity {
|
|
|
@ -40,7 +41,8 @@ public class WidgetConfigActivity extends InjectingListActivity {
|
|
|
|
public static final String PREF_CUSTOM_INTENT = "widget-intent-";
|
|
|
|
public static final String PREF_CUSTOM_INTENT = "widget-intent-";
|
|
|
|
public static final String PREF_CUSTOM_EXTRAS = "widget-extras-";
|
|
|
|
public static final String PREF_CUSTOM_EXTRAS = "widget-extras-";
|
|
|
|
public static final String PREF_TAG_ID = "widget-tag-id-";
|
|
|
|
public static final String PREF_TAG_ID = "widget-tag-id-";
|
|
|
|
public static final String PREF_DUE_DATE = "widget-due-date-";
|
|
|
|
public static final String PREF_SHOW_DUE_DATE = "widget-show-due-date-";
|
|
|
|
|
|
|
|
public static final String PREF_HIDE_CHECKBOXES = "widget-hide-checkboxes-";
|
|
|
|
public static final String PREF_DARK_THEME = "widget-dark-theme-";
|
|
|
|
public static final String PREF_DARK_THEME = "widget-dark-theme-";
|
|
|
|
|
|
|
|
|
|
|
|
int mAppWidgetId = AppWidgetManager.INVALID_APPWIDGET_ID;
|
|
|
|
int mAppWidgetId = AppWidgetManager.INVALID_APPWIDGET_ID;
|
|
|
@ -75,6 +77,10 @@ public class WidgetConfigActivity extends InjectingListActivity {
|
|
|
|
// Set the view layout resource to use.
|
|
|
|
// Set the view layout resource to use.
|
|
|
|
setContentView(R.layout.widget_config_activity);
|
|
|
|
setContentView(R.layout.widget_config_activity);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (preHoneycomb()) {
|
|
|
|
|
|
|
|
findViewById(R.id.hideCheckboxes).setVisibility(View.GONE);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
setTitle(R.string.WCA_title);
|
|
|
|
setTitle(R.string.WCA_title);
|
|
|
|
|
|
|
|
|
|
|
|
// Find the widget id from the intent.
|
|
|
|
// Find the widget id from the intent.
|
|
|
@ -101,9 +107,11 @@ public class WidgetConfigActivity extends InjectingListActivity {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onClick(View v) {
|
|
|
|
public void onClick(View v) {
|
|
|
|
// Save configuration options
|
|
|
|
// Save configuration options
|
|
|
|
CheckBox showDueDate = (CheckBox) findViewById(R.id.showDueDate);
|
|
|
|
CheckBox hideDueDate = (CheckBox) findViewById(R.id.hideDueDate);
|
|
|
|
CheckBox darkTheme = (CheckBox) findViewById(R.id.darkTheme);
|
|
|
|
CheckBox darkTheme = (CheckBox) findViewById(R.id.darkTheme);
|
|
|
|
saveConfiguration(adapter.getSelection(), showDueDate.isChecked(), darkTheme.isChecked());
|
|
|
|
CheckBox hideCheckboxes = (CheckBox) findViewById(R.id.hideCheckboxes);
|
|
|
|
|
|
|
|
saveConfiguration(adapter.getSelection(), !hideDueDate.isChecked(),
|
|
|
|
|
|
|
|
darkTheme.isChecked(), hideCheckboxes.isChecked());
|
|
|
|
|
|
|
|
|
|
|
|
updateWidget();
|
|
|
|
updateWidget();
|
|
|
|
|
|
|
|
|
|
|
@ -136,7 +144,7 @@ public class WidgetConfigActivity extends InjectingListActivity {
|
|
|
|
adapter.unregisterRecevier();
|
|
|
|
adapter.unregisterRecevier();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void saveConfiguration(FilterListItem filterListItem, boolean showDueDate, boolean darkTheme){
|
|
|
|
private void saveConfiguration(FilterListItem filterListItem, boolean showDueDate, boolean darkTheme, boolean hideCheckboxes){
|
|
|
|
DisplayMetrics metrics = new DisplayMetrics();
|
|
|
|
DisplayMetrics metrics = new DisplayMetrics();
|
|
|
|
getWindowManager().getDefaultDisplay().getMetrics(metrics);
|
|
|
|
getWindowManager().getDefaultDisplay().getMetrics(metrics);
|
|
|
|
|
|
|
|
|
|
|
@ -156,8 +164,9 @@ public class WidgetConfigActivity extends InjectingListActivity {
|
|
|
|
preferences.setString(WidgetConfigActivity.PREF_TITLE + mAppWidgetId, title);
|
|
|
|
preferences.setString(WidgetConfigActivity.PREF_TITLE + mAppWidgetId, title);
|
|
|
|
preferences.setString(WidgetConfigActivity.PREF_SQL + mAppWidgetId, sql);
|
|
|
|
preferences.setString(WidgetConfigActivity.PREF_SQL + mAppWidgetId, sql);
|
|
|
|
preferences.setString(WidgetConfigActivity.PREF_VALUES + mAppWidgetId, contentValuesString);
|
|
|
|
preferences.setString(WidgetConfigActivity.PREF_VALUES + mAppWidgetId, contentValuesString);
|
|
|
|
preferences.setBoolean(WidgetConfigActivity.PREF_DUE_DATE + mAppWidgetId, showDueDate);
|
|
|
|
preferences.setBoolean(WidgetConfigActivity.PREF_SHOW_DUE_DATE + mAppWidgetId, showDueDate);
|
|
|
|
preferences.setBoolean(WidgetConfigActivity.PREF_DARK_THEME + mAppWidgetId, darkTheme);
|
|
|
|
preferences.setBoolean(WidgetConfigActivity.PREF_DARK_THEME + mAppWidgetId, darkTheme);
|
|
|
|
|
|
|
|
preferences.setBoolean(WidgetConfigActivity.PREF_HIDE_CHECKBOXES + mAppWidgetId, hideCheckboxes);
|
|
|
|
|
|
|
|
|
|
|
|
if(filterListItem instanceof FilterWithCustomIntent) {
|
|
|
|
if(filterListItem instanceof FilterWithCustomIntent) {
|
|
|
|
String flattenedName = ((FilterWithCustomIntent)filterListItem).customTaskList.flattenToString();
|
|
|
|
String flattenedName = ((FilterWithCustomIntent)filterListItem).customTaskList.flattenToString();
|
|
|
|