Comments (8)
I will have a look!
from esperandro.
Thanks. Just take your time, I don't need the new features in the project where I need the initDefaults
... I can simply continue using v2.2.0 for now
from esperandro.
Hi, I looked into it and guess it is a user error 😁
(And a lack of documentation from my side)
Initidefaults uses (at least in the newer versions, I can't remember the old ones) the getter and setter methods since the getters already contain the complete logic to generate the correct defaults.
If setter or getter is missing no default initialization is generated for this specific preference. I even can't decide how to init them, so it wouldn't make sense to generate them.
Can you check and confirm for your examples that this is the case for the different files you use?
from esperandro.
In this very old app of mine I use it like following:
@SharedPreferences(name = Preferences.PREF_NAME, mode = SharedPreferenceMode.PRIVATE)
public interface Preferences extends SharedPreferenceActions
{
String PREF_NAME = "APP_PREFERENCES";
public static final String userKnowsNavigationDrawer = "userKnowsNavigationDrawer";
@Default(ofBoolean = false)
boolean userKnowsNavigationDrawer();
boolean userKnowsNavigationDrawer(boolean userKnowsNavigationDrawer);
public static final String language = "language";
@Default(ofString = "0")
String language();
boolean language(String language);
}
Should work, shouldn't it?
from esperandro.
Yeah, that's the bug I found after writing my comment 👍
If you had a commit setter (boolean return type) it also didn't work. This is fixed locally. I will also remove the need for a setter and use the normal SharedPreference object for writing, and then push a new version.
from esperandro.
great, thanks a lot
from esperandro.
I just pushed 2.7.1 to maven central. initDefaults should no show better results.
from esperandro.
Great, works. Thank you
from esperandro.
Related Issues (20)
- Java version - support java 8 HOT 3
- Incremental annotation processor HOT 4
- AndroidX - import problem HOT 3
- warning: No SupportedSourceVersion annotation found on de.devland.esperandro.processor.EsperandroAnnotationProcessor, returning RELEASE_6. HOT 2
- Gradle sample
- Migrate whole project to gradle
- Migrate Github Pages to Wiki
- warnings for each preference after upgrading to 2.5.2 - 3.0.0 HOT 2
- Support usage of Kotlin properties in interface definition HOT 3
- Poll: Change method names to Java Bean Accessor Syntax HOT 6
- Serializer for Kotlinx serialization library HOT 2
- Memory leak in ProcessingMessager HOT 8
- Proguard configuration (revisited) HOT 2
- Return type of remove() on List object is void, should be boolean
- Add operations for ALL preference classes
- Add and Remove operations on Set<String> won't work correctly
- Default for serialize values does not work HOT 1
- 4.0.x changelog items HOT 1
- Deprecation warnings after migration to CompileSDK 29 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from esperandro.