f2prateek / rx-preferences

Reactive SharedPreferences for Android
http://f2prateek.com/2015/10/05/rx-preferences/
Apache License 2.0
1.54k stars 132 forks source link

Add MemoryPreference artifact? #114

Open NightlyNexus opened 6 years ago

NightlyNexus commented 6 years ago

I have rewritten MemoryPreference a few times in various projects for tests and mock mode.

public final class MemoryPreference<T> implements Preference<T> {
  private final String key;
  private final T defaultValue;
  @Nullable private volatile T value;
  ...
}

Maybe there should be an artifact here for it?

f2prateek commented 6 years ago

Is there a strong reason to prefer a memory backed preference over just a normal preference?

f2prateek commented 6 years ago

Actually, I guess it might make sense if you're not using Robolectric.

NightlyNexus commented 6 years ago

Yes, I don't use Robolectric.

MrVilkaman commented 6 years ago

@NightlyNexus show full code, please =)

ShaishavGandhi commented 4 years ago

Is this still on the table? I basically have a small test class that i end up copying in every project I use this library in. Would be nice to have an official artifact. Happy to contribute a PR or continue on the existing one