Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linked settings #11

Open
Koxx3 opened this issue Sep 18, 2020 · 4 comments
Open

Linked settings #11

Koxx3 opened this issue Sep 18, 2020 · 4 comments

Comments

@Koxx3
Copy link

Koxx3 commented Sep 18, 2020

Hello,
first, thanks for this library. It makes settings management much easier !
I'd like to link settings.
For example :

  • setting1 (checkbox)
  • setting2 (text)

I'd liked to gray/disable setting2 if setting1 is not enabled.

How can I do that ?
I found nothing in the example or the documentation.

Thanks

@or-dvir
Copy link
Owner

or-dvir commented Sep 19, 2020

you mean in the ui, like in this picture? (couldn't directly post it for some reason).
so when the user enables "data roaming", "preferred network type" also becomes enabled?

if thats the case, unfortunately you'll have to do this yourself.
This library is about storing and accessing values (settings) saved in SharedPreferences. it is not possible in android to enable/disable a value saved in SharedPreferences. the idea is for you, the developer, to have your app act differently depending on the value saved in one (or more) such preferences.

so for example you could do something like this for the example above (very simplified pseudo code):

//this code should probably be in the `settings` activity/fragment
View networkType = findViewById(R.id.preferredNetworkType)
networkType.setEnabled(getValue(dataRoaming))

if that is not what you meant, please clarify (i'll leave this issue open).

@Koxx3
Copy link
Author

Koxx3 commented Sep 19, 2020

hello, thanks for your reply.
yes, this is exactly what i meant 😅
i'll try to do it myself then 😁

@Koxx3
Copy link
Author

Koxx3 commented Sep 19, 2020

how can i find the view id since they are created by easysettings ?

@or-dvir
Copy link
Owner

or-dvir commented Sep 19, 2020

the view is the one in your activity/fragment you want to disable. so if we go with the same image as before, it would be the 2 TextViews

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants