Make return filter optional

pull/384/head
Alex Baker 9 years ago
parent f18777f127
commit 19c7e4a6f4

@ -18,6 +18,7 @@ import javax.inject.Inject;
public class FilterSelectionActivity extends InjectingAppCompatActivity {
public static final String EXTRA_RETURN_FILTER = "extra_include_filter";
public static final String EXTRA_FILTER = "extra_filter";
public static final String EXTRA_FILTER_NAME = "extra_filter_name";
public static final String EXTRA_FILTER_SQL = "extra_filter_query";
@ -32,6 +33,8 @@ public class FilterSelectionActivity extends InjectingAppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final boolean returnFilter = getIntent().getBooleanExtra(EXTRA_RETURN_FILTER, false);
activityPreferences.applyTheme();
final FilterAdapter filterAdapter = new FilterAdapter(filterProvider, filterCounter, this, null, false);
@ -43,7 +46,9 @@ public class FilterSelectionActivity extends InjectingAppCompatActivity {
public void onClick(DialogInterface dialog, int which) {
final Filter selectedFilter = (Filter) filterAdapter.getItem(which);
setResult(RESULT_OK, new Intent() {{
putExtra(EXTRA_FILTER, selectedFilter);
if (returnFilter) {
putExtra(EXTRA_FILTER, selectedFilter);
}
putExtra(EXTRA_FILTER_NAME, selectedFilter.listingTitle);
putExtra(EXTRA_FILTER_SQL, selectedFilter.getSqlQuery());
if (selectedFilter.valuesForNewTasks != null) {

@ -56,7 +56,9 @@ public class AppearancePreferences extends InjectingPreferenceActivity {
defaultList.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
startActivityForResult(new Intent(AppearancePreferences.this, FilterSelectionActivity.class), REQUEST_DEFAULT_LIST);
startActivityForResult(new Intent(AppearancePreferences.this, FilterSelectionActivity.class) {{
putExtra(FilterSelectionActivity.EXTRA_RETURN_FILTER, true);
}}, REQUEST_DEFAULT_LIST);
return true;
}
});

Loading…
Cancel
Save