Use the same HabitCardListCache for all activities

Fixes #147
This commit is contained in:
2016-07-29 07:40:56 -04:00
parent 9ec3d9048a
commit a527140802
2 changed files with 8 additions and 3 deletions

View File

@@ -19,6 +19,7 @@
package org.isoron.uhabits; package org.isoron.uhabits;
import org.isoron.uhabits.activities.habits.list.model.*;
import org.isoron.uhabits.commands.*; import org.isoron.uhabits.commands.*;
import org.isoron.uhabits.intents.*; import org.isoron.uhabits.intents.*;
import org.isoron.uhabits.io.*; import org.isoron.uhabits.io.*;
@@ -70,4 +71,6 @@ public interface AppComponent
WidgetPreferences getWidgetPreferences(); WidgetPreferences getWidgetPreferences();
WidgetUpdater getWidgetUpdater(); WidgetUpdater getWidgetUpdater();
HabitCardListCache getHabitCardListCache();
} }

View File

@@ -21,7 +21,6 @@ package org.isoron.uhabits.activities.habits.list.model;
import android.support.annotation.*; import android.support.annotation.*;
import org.isoron.uhabits.activities.*;
import org.isoron.uhabits.commands.*; import org.isoron.uhabits.commands.*;
import org.isoron.uhabits.models.*; import org.isoron.uhabits.models.*;
import org.isoron.uhabits.tasks.*; import org.isoron.uhabits.tasks.*;
@@ -38,8 +37,11 @@ import javax.inject.*;
* This is needed since performing database lookups during scrolling can make * This is needed since performing database lookups during scrolling can make
* the ListView very slow. It also registers itself as an observer of the * the ListView very slow. It also registers itself as an observer of the
* models, in order to update itself automatically. * models, in order to update itself automatically.
* <p>
* Note that this class is singleton-scoped, therefore it is shared among all
* activities.
*/ */
@ActivityScope @Singleton
public class HabitCardListCache implements CommandRunner.Listener public class HabitCardListCache implements CommandRunner.Listener
{ {
private int checkmarkCount; private int checkmarkCount;