aliasadi / powerpreference Goto Github PK
View Code? Open in Web Editor NEW💾 A Powerful library to control and simplify the usage of shared preference in Android.
Home Page: https://aliasadi.github.io/PowerPreference/
License: Apache License 2.0
💾 A Powerful library to control and simplify the usage of shared preference in Android.
Home Page: https://aliasadi.github.io/PowerPreference/
License: Apache License 2.0
Hey been using your library for awhile, but wanted to bring this to your attention. Looks like soon they are going to be removing non-AndroidX support. Is this something you have looked into? If you do not have time to do it, I may take a crack and converting it.
Output from Gradle currently:
Your project has set android.useAndroidX=true
, but configuration :app:debugRuntimeClasspath
still contains legacy support libraries, which may cause runtime issues.
This behavior will not be allowed in Android Gradle plugin 8.0.
Please use only AndroidX dependencies or set android.enableJetifier=true
in the gradle.properties
file to migrate your project to AndroidX (see https://developer.android.com/jetpack/androidx/migrate for more info).
The following legacy support libraries are detected:
:app:debugRuntimeClasspath -> com.github.AliAsadi:PowerPreference:2.1.0 -> com.android.support:recyclerview-v7:25.0.0
:app:debugRuntimeClasspath -> com.github.AliAsadi:PowerPreference:2.1.0 -> com.android.support:recyclerview-v7:25.0.0 -> com.android.support:support-annotations:25.0.0
:app:debugRuntimeClasspath -> com.github.AliAsadi:PowerPreference:2.1.0 -> com.android.support:recyclerview-v7:25.0.0 -> com.android.support:support-compat:25.0.0
:app:debugRuntimeClasspath -> com.github.AliAsadi:PowerPreference:2.1.0 -> com.android.support:recyclerview-v7:25.0.0 -> com.android.support:support-core-ui:25.0.0
:app:debugRuntimeClasspath -> com.github.AliAsadi:PowerPreference:2.1.0 -> com.android.support:appcompat-v7:25.0.0
:app:debugRuntimeClasspath -> com.github.AliAsadi:PowerPreference:2.1.0 -> com.android.support:appcompat-v7:25.0.0 -> com.android.support:support-v4:25.0.0
:app:debugRuntimeClasspath -> com.github.AliAsadi:PowerPreference:2.1.0 -> com.android.support:appcompat-v7:25.0.0 -> com.android.support:support-v4:25.0.0 -> com.android.support:support-media-compat:25.0.0
:app:debugRuntimeClasspath -> com.github.AliAsadi:PowerPreference:2.1.0 -> com.android.support:appcompat-v7:25.0.0 -> com.android.support:support-v4:25.0.0 -> com.android.support:support-core-utils:25.0.0
:app:debugRuntimeClasspath -> com.github.AliAsadi:PowerPreference:2.1.0 -> com.android.support:appcompat-v7:25.0.0 -> com.android.support:support-v4:25.0.0 -> com.android.support:support-fragment:25.0.0
:app:debugRuntimeClasspath -> com.github.AliAsadi:PowerPreference:2.1.0 -> com.android.support:appcompat-v7:25.0.0 -> com.android.support:support-vector-drawable:25.0.0
:app:debugRuntimeClasspath -> com.github.AliAsadi:PowerPreference:2.1.0 -> com.android.support:appcompat-v7:25.0.0 -> com.android.support:animated-vector-drawable:25.0.0
Hi Ali, is it possible to save a list of values?
I noticed the Android Studio's Settings Activity template saves MultiSelectListPreference
data as follows:
<map>
<set name="list">
<string>sat</string>
<string>sun</string>
</set>
</map>
What is the best way to save this kind of list with Powerpreference?
Thanks!
Hello..
How can I set the context when getting a value?
OR
How do i use it inside a service?
Hello author, read your code, it is really great for SP packaging~
But unfortunately, every time "edit" is to open a file, each time "apply" is full-write, which is actually the reason for poor SP performance.
Recently, I also want to write an efficient "key-value" component, so I saw your code, welcome to exchange ~
作者你好,看了你的代码,对于 SP 封装的的确很棒~
但是可惜的是,每次 “edit” 都是打开一次文件,每次 “apply” 都是全量写入,这其实也是 SP 性能差的原因所在。
最近,我也想写一个高效的 "key-value" 组件,所以看到了你的代码,欢迎交流~
I am been using Power Preferences and it is great and works perfectly but recently I have added another key-value pair it acts strange
I am able to store the key-value pair and able to retrieve it only once after that it gets deleted
I have narrowed it down getting deleted on the retrieve as it shows the same result on both Android studio device file explorer and PowerPreference.showDebugScreen();
code for setting the power preferences
String deviceDBID = data.getDevicedbid(); PowerPreference.getFileByName(powerPrefFile).putString(powerPrefDeviceDBID, deviceDBID);
code for retrieving the power preferences
String deviceID = PowerPreference.getFileByName(powerPrefFile).getString(powerPrefDeviceDBID);
Also posted this on StackOverflow for reference
https://stackoverflow.com/questions/60734816/shared-preferences-removing-data-after-one-time-use
When I add implementation 'com.aliassadi:power-preference-lib:1.3.0'
to the dependencies I get this (suggestive) error:
All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 27.0.0, 25.0.0. Examples include com.android.support:animated-vector-drawable:27.0.0 and com.android.support:recyclerview-v7:25.0.0
Here's my build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.prakaz.databinding"
minSdkVersion 21
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dataBinding{
enabled = true
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.aliassadi:power-preference-lib:1.3.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
//Other dependencies... for LiveData, ViewModel
def lifecycle_version = "1.1.1"
implementation "android.arch.lifecycle:extensions:$lifecycle_version"
annotationProcessor "android.arch.lifecycle:compiler:$lifecycle_version"
testImplementation "android.arch.core:core-testing:$lifecycle_version"
}
I'm an Android newbie, so not sure what's happening here.
If I remove jCenter from my project, I get the following error:
Could not find com.thoughtbot:expandablerecyclerview:1.3
Required by com.github.AliAsadi:PowerPreference:2.0.0
As JCenter is entering end-of-life, do you plan to switch artifact distribution to another repository? I know JCenter will be around in read-only mode, but we'd like to get rid of it from our project, if possible.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.