From adbd75863f3753affe3398fe659b0ed5e91a8040 Mon Sep 17 00:00:00 2001 From: Alex Baker Date: Fri, 22 Jul 2016 21:49:01 -0500 Subject: [PATCH] Apply theme when loading task list fragment --- .../todoroo/astrid/activity/TaskListActivity.java | 1 + .../todoroo/astrid/activity/TaskListFragment.java | 12 ++++-------- src/main/java/org/tasks/themes/ThemeColor.java | 2 -- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/todoroo/astrid/activity/TaskListActivity.java b/src/main/java/com/todoroo/astrid/activity/TaskListActivity.java index 0e40e2f36..0be39f905 100644 --- a/src/main/java/com/todoroo/astrid/activity/TaskListActivity.java +++ b/src/main/java/com/todoroo/astrid/activity/TaskListActivity.java @@ -191,6 +191,7 @@ public class TaskListActivity extends InjectingAppCompatActivity implements : theme.getThemeColor(); themeColor.applyStatusBarColor(drawerLayout); themeColor.applyTaskDescription(this, filter.listingTitle); + theme.withColor(themeColor).applyToContext(this); FragmentManager fragmentManager = getSupportFragmentManager(); fragmentManager.popBackStackImmediate(null, FragmentManager.POP_BACK_STACK_INCLUSIVE); diff --git a/src/main/java/com/todoroo/astrid/activity/TaskListFragment.java b/src/main/java/com/todoroo/astrid/activity/TaskListFragment.java index 102ce79ce..97317039c 100644 --- a/src/main/java/com/todoroo/astrid/activity/TaskListFragment.java +++ b/src/main/java/com/todoroo/astrid/activity/TaskListFragment.java @@ -80,7 +80,6 @@ import org.tasks.injection.FragmentComponent; import org.tasks.injection.InjectingListFragment; import org.tasks.notifications.NotificationManager; import org.tasks.preferences.Preferences; -import org.tasks.themes.Theme; import org.tasks.themes.ThemeCache; import org.tasks.ui.CheckBoxes; import org.tasks.ui.MenuColorizer; @@ -147,7 +146,6 @@ public class TaskListFragment extends InjectingListFragment implements @Inject Broadcaster broadcaster; @Inject TagService tagService; @Inject ThemeCache themeCache; - @Inject Theme theme; @BindView(R.id.swipe_layout) SwipeRefreshLayout swipeRefreshLayout; @BindView(R.id.swipe_layout_empty) SwipeRefreshLayout emptyView; @@ -242,12 +240,10 @@ public class TaskListFragment extends InjectingListFragment implements } @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - LayoutInflater themedLayoutInflater = - ((filter.tint >= 0) ? theme.withColor(themeCache.getThemeColor(filter.tint)) : theme) - .getLayoutInflater(context); - View parent = themedLayoutInflater.inflate(R.layout.fragment_task_list, container, false); - ((ViewGroup) parent.findViewById(R.id.task_list_body)).addView(themedLayoutInflater.inflate(getListBody(), null), 0); + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + View parent = inflater.inflate(R.layout.fragment_task_list, container, false); + ((ViewGroup) parent.findViewById(R.id.task_list_body)).addView(inflater.inflate(getListBody(), null), 0); ButterKnife.bind(this, parent); setupRefresh(swipeRefreshLayout); setupRefresh(emptyView); diff --git a/src/main/java/org/tasks/themes/ThemeColor.java b/src/main/java/org/tasks/themes/ThemeColor.java index 0eca50062..0ce97cb07 100644 --- a/src/main/java/org/tasks/themes/ThemeColor.java +++ b/src/main/java/org/tasks/themes/ThemeColor.java @@ -2,12 +2,10 @@ package org.tasks.themes; import android.app.Activity; import android.app.ActivityManager; -import android.content.Context; import android.content.res.Resources; import android.support.v4.widget.DrawerLayout; import android.support.v7.widget.Toolbar; import android.view.View; -import android.view.Window; import org.tasks.R; import org.tasks.ui.MenuColorizer;