Use the same HabitCardListCache for all activities

Fixes #147
pull/151/head
Alinson S. Xavier 9 years ago
parent 9ec3d9048a
commit a527140802

@ -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();
} }

@ -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;

Loading…
Cancel
Save