mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 09:08:52 -06:00
@@ -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;
|
||||||
@@ -359,7 +361,7 @@ public class HabitCardListCache implements CommandRunner.Listener
|
|||||||
boolean unchanged = true;
|
boolean unchanged = true;
|
||||||
if (!oldScore.equals(newScore)) unchanged = false;
|
if (!oldScore.equals(newScore)) unchanged = false;
|
||||||
if (!Arrays.equals(oldCheckmarks, newCheckmarks)) unchanged = false;
|
if (!Arrays.equals(oldCheckmarks, newCheckmarks)) unchanged = false;
|
||||||
if(unchanged) return;
|
if (unchanged) return;
|
||||||
|
|
||||||
data.scores.put(id, newScore);
|
data.scores.put(id, newScore);
|
||||||
data.checkmarks.put(id, newCheckmarks);
|
data.checkmarks.put(id, newCheckmarks);
|
||||||
|
|||||||
Reference in New Issue
Block a user