diff --git a/app/src/main/java/com/todoroo/astrid/activity/MainActivity.kt b/app/src/main/java/com/todoroo/astrid/activity/MainActivity.kt
index 860951467..5bcc9ad32 100644
--- a/app/src/main/java/com/todoroo/astrid/activity/MainActivity.kt
+++ b/app/src/main/java/com/todoroo/astrid/activity/MainActivity.kt
@@ -33,7 +33,6 @@ import io.reactivex.schedulers.Schedulers
import org.tasks.BuildConfig
import org.tasks.LocalBroadcastManager
import org.tasks.R
-import org.tasks.Strings.isNullOrEmpty
import org.tasks.activities.TagSettingsActivity
import org.tasks.billing.Inventory
import org.tasks.data.Place
@@ -56,8 +55,8 @@ import org.tasks.themes.Theme
import org.tasks.themes.ThemeColor
import org.tasks.ui.DeadlineControlSet.DueDateChangeListener
import org.tasks.ui.EmptyTaskEditFragment.Companion.newEmptyTaskEditFragment
-import org.tasks.ui.NavigationDrawerFragment
import org.tasks.ui.ListFragment.OnListChanged
+import org.tasks.ui.NavigationDrawerFragment
import org.tasks.ui.TaskListViewModel
import javax.inject.Inject
@@ -182,7 +181,11 @@ class MainActivity : InjectingAppCompatActivity(), TaskListFragmentCallbackHandl
Single.fromCallable {
val filter = intent.getStringExtra(LOAD_FILTER)
intent.removeExtra(LOAD_FILTER)
- if (isNullOrEmpty(filter)) defaultFilterProvider.defaultFilter else defaultFilterProvider.getFilterFromPreference(filter)
+ if (filter.isNullOrBlank()) {
+ defaultFilterProvider.startupFilter
+ } else {
+ defaultFilterProvider.getFilterFromPreference(filter)
+ }
}
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
@@ -245,6 +248,7 @@ class MainActivity : InjectingAppCompatActivity(), TaskListFragmentCallbackHandl
}
filter = newFilter
navigationDrawer.setSelected(filter)
+ defaultFilterProvider.setLastViewedFilter(filter)
applyTheme()
val fragmentManager = supportFragmentManager
fragmentManager
diff --git a/app/src/main/java/org/tasks/preferences/DefaultFilterProvider.java b/app/src/main/java/org/tasks/preferences/DefaultFilterProvider.java
index 86c5600c1..e801fd2a1 100644
--- a/app/src/main/java/org/tasks/preferences/DefaultFilterProvider.java
+++ b/app/src/main/java/org/tasks/preferences/DefaultFilterProvider.java
@@ -94,6 +94,10 @@ public class DefaultFilterProvider {
setFilterPreference(filter, R.string.p_default_list);
}
+ public void setLastViewedFilter(Filter filter) {
+ setFilterPreference(filter, R.string.p_last_viewed_list);
+ }
+
public Filter getDefaultRemoteList() {
return getFilterFromPreference(
preferences.getStringValue(R.string.p_default_remote_list), null);
@@ -103,6 +107,13 @@ public class DefaultFilterProvider {
setFilterPreference(filter, R.string.p_default_remote_list);
}
+ public Filter getStartupFilter() {
+ return getFilterFromPreference(
+ preferences.getBoolean(R.string.p_open_last_viewed_list, true)
+ ? R.string.p_last_viewed_list
+ : R.string.p_default_list);
+ }
+
public Filter getFilterFromPreference(int resId) {
return getFilterFromPreference(preferences.getStringValue(resId));
}
diff --git a/app/src/main/java/org/tasks/widget/ShortcutConfigActivity.java b/app/src/main/java/org/tasks/widget/ShortcutConfigActivity.java
index 8da210766..120d774b3 100644
--- a/app/src/main/java/org/tasks/widget/ShortcutConfigActivity.java
+++ b/app/src/main/java/org/tasks/widget/ShortcutConfigActivity.java
@@ -74,7 +74,7 @@ public class ShortcutConfigActivity extends ThemedInjectingAppCompatActivity
toolbar.setNavigationOnClickListener(v -> save());
if (icicle == null) {
- selectedFilter = defaultFilterProvider.getDefaultFilter();
+ selectedFilter = defaultFilterProvider.getStartupFilter();
selectedTheme = 7;
} else {
selectedFilter = icicle.getParcelable(EXTRA_FILTER);
diff --git a/app/src/main/res/values/keys.xml b/app/src/main/res/values/keys.xml
index 538a4c5bb..d87d3e138 100644
--- a/app/src/main/res/values/keys.xml
+++ b/app/src/main/res/values/keys.xml
@@ -281,6 +281,8 @@
collect_statistics
back_button_saves_task
+ open_last_viewed_list
+ last_viewed_list
default_list
badges_enabled
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 750ec03ab..afb83a246 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -631,4 +631,6 @@ File %1$s contained %2$s.\n\n
Got it!
Created %s
Modified %s
+ On launch
+ Open last viewed list
diff --git a/app/src/main/res/xml/preferences_look_and_feel.xml b/app/src/main/res/xml/preferences_look_and_feel.xml
index e5a315e32..b9f1e4117 100644
--- a/app/src/main/res/xml/preferences_look_and_feel.xml
+++ b/app/src/main/res/xml/preferences_look_and_feel.xml
@@ -27,12 +27,24 @@
android:summaryOff="@string/desaturate_colors_summary_off" />
+ android:title="@string/on_launch">
+
+
+ android:title="@string/widget_open_list"
+ android:dependency="@string/p_open_last_viewed_list" />
+
+
+
+