Wednesday, October 4, 2023
Alternative Way
  • Home
  • Latest
    • Latest
  • News
  • World Tech
  • World Gaming
  • Minecraft
  • Guides
  • Contact Us
  • About The Team
    • Privacy Policy
    • Terms of Use
No Result
View All Result
  • Home
  • Latest
    • Latest
  • News
  • World Tech
  • World Gaming
  • Minecraft
  • Guides
  • Contact Us
  • About The Team
    • Privacy Policy
    • Terms of Use
No Result
View All Result
Alternative Way
No Result
View All Result

Simple Settings library for Android

Gordon James by Gordon James
October 3, 2021
in Latest
0 0
0
Home Latest

Simple installation activity

Simple Settings is a library that offers an easy to use and manage solution for creating a control panel without template code. This saves costs, time and effort.

Screenshots (Android 10)

Screenshot1

Screenshot2

Screenshot3

Try

If you want to test the library, see the sample application on Google Play!

Use

The first step to using this library is to add it to the dependencies section of your project:

Implementation of com.chillibits:simpleettings:1.0.0-alpha11.

//
‘com.google.android.material:material:’.
Implementation of androidx.preference:.

You must also mention the activity in your manifesto:

 

The library accepts two different ways to provide information through the control panel.

Delivery of articles per program

With this callback you can create configuration items using the show() method:

SimpleSettings(this).show {
section {
title = Test section
for (i in 1…4) {
SwitchPref {
title = Test 1,$i
summary = Test 1,$i
default = if(i % 2 == 0) SimpleSwitchPref.ON otherwise SimpleSwitchPref.OFF
}
}
if (true) {
TextPref {
title = Test 2
summary = This is a Test 2
}
}
}
part {
InputPref {
title = Test 3
summary = This is a Test 3
}
}
}.

This is especially useful if you need to generate your preferences at runtime. You can use the hinges and conditions as described above.

Pay attention: It is not obligatory to hand over the keys for each preference. In this case, the library automatically generates a key by converting the header of each preference into CamelCase.

Examples :

List Preferences –> list Preference
List Preference –> list Preference
These are user rights –> thisIsACustomPreference
custom –> custom.

Optionally, you can pass the SimpleSettingsConfig object to the builder of your SimpleSettings instance to customize the appearance of the setup activity. The different parameters are listed below.

Delivery of elements with the xml file

You can also specify your preferred screen as a normal xml file:

 

 

 

 

To create the settings screen in the default configuration, simply call the SimpleSettings show method and send the prepared xml resource file.

SimpleSettings([protected by email])).show(R.xml.preferences)

or (if you need to add preferences, click on Earphones in your preferences)

private fun showPreferences() {
fall config = SimpleSettingsConfig().apply {
showResetOption = true
preferenceCallback = [Email Protection] }
SimpleSettings([Email Protection], config).show(R.xml.preferences)
}

Overload the fun onPreferenceClick (context: context, button: line) : Preferences. OnPreferenceClickListener? {{{{Preference-> WebsiteClickListener([Email protected], getString(R.string.url_github))custom preference -> Preference.OnPreferenceClickListener {{{{Preference-> WebsiteClickListener([Email protected], getString(R.string.url_github)).

real
}

else -> super.onPreferenceClick(context, key)
}
}

Obtaining preferential values

Simultaneous search

You can retrieve the preferred values as usual via SharedPreferences, or use the built-in shortcuts provided with the library.
It provides improvement functions for the context class to facilitate access to the preferred values:

val-Wert1 = getPrefStringValue (stringPreference, default)
val-Wert2 = getPrefIntValue (intPreference, 99)
val-Wert3 = getPrefBooleanValue (booleanPreference, true)
val-Wert4 = getPrefFloatValue (floatPreference, 101.6f)
val-Wert5 = getPrefLongValue (longPref, 4834597833234)
val-Wert6 = getPrefStringSetValue (stringSetPreference, setOf(default 1, default 2)).

As you can see, this works for the types String, Int, Boolean, Float, Long, StringSet.

Search as LiveData

In addition, the library offers the possibility to monitor the setting values as LiveData :

getPrefObserver( listpreference, Observer { value ->
textField.text = value
})).

As described above it works for String, Int, Boolean, Float, Long, StringSet types.

Pay attention: The expansion functions are only available for the AppCompatibleActivity class, as the LifecycleOwner is required for making observations.

Library facilities

The library offers various configuration options. To apply these options, you need to pass the SimpleSettingsConfig object to your SimpleSettings instance constructor.

Method Description
setActivityTitle(string) Sets the title of the SettingsActivity toolbar. The default value is Settings, translated into all supported languages.
setActivityTitle (Context, Int) Sets the title of the SettingsActivity toolbar with a string source. The default value is Settings, translated into all supported languages.
displayHomeAsUpEnabled (boolean) Activates or deactivates the arrow symbol in the top left corner of the operating window to return to the call procedure. The default value is correct.
showResetOption (boolean) Enables or disables the menu item options to reset all settings to default values. The default value is wrong.
setPreferenceCallback(context) Sets a reminder to subscribe to a one-click subscription to privileged object events

If you missed the setting option, please let us know by opening the question.

Pre-defined listener clicks

The library offers several predefined clicks to store a large amount of template code. These listening clicks are available:

In-depth access to the project

Consult the wiki if you want to understand the benefits of this library or learn more about certain types of preferences.

Languages supported

Here are the languages currently supported by this library

The new translations are highly appreciated. If you want to translate the library, open pr.

GitHub

Related Tags:

Total
0
Shares
Share 0
Tweet 0
Pin it 0
Share 0
ShareTweetShare
Gordon James

Gordon James

Next Post
🥇 Virtual Memory  What is it? + Operation ▷ 2020

🥇 Virtual Memory  What is it? + Operation ▷ 2020

  • Trending
  • Comments
  • Latest
How To Get Free Internet On Android Without Service

How To Get Free Internet On Android Without Service

March 10, 2022
🥇 +4 Neo Geo Emulators for Android  List ▷ 2021

🥇 +4 Neo Geo Emulators for Android  List ▷ 2021

October 3, 2021

Fix: Notifications not working on Nova Launcher

October 3, 2021
How to Fix OpenVPN Connected but Not Changing IP Address

How to Fix OpenVPN Connected but Not Changing IP Address

October 3, 2021

Setting Up Directory Sync Between On-Premises Active Directory with Microsoft 365 Azure AD

0
🥇 DELETE ACCOUNT from PS4  ▷ Step by Step Guide ▷ 2020

🥇 DELETE ACCOUNT from PS4  ▷ Step by Step Guide ▷ 2020

0
🥇 PPTX File Extension  What is .Pptx and how to open them? ▷ 2020

🥇 PPTX File Extension  What is .Pptx and how to open them? ▷ 2020

0
🥇 Make a Crossword in Microsoft Word  Step by Step Guide ▷ 2020

🥇 Make a Crossword in Microsoft Word  Step by Step Guide ▷ 2020

0
Image2

The 3 Qualities of a Good Sports Betting Site

September 12, 2023
Image1

From Casino Chips to Cryptocurrency: The Evolution of Payment Methods

September 8, 2023
Image1

The Most Effective Online Casino Guide for Online Gambling in the World

August 30, 2023
Image3

Around the Globe

August 23, 2023

There's always an alternative Way!
No Result
View All Result
  • Home
  • Latest
    • Latest
  • News
  • World Tech
  • World Gaming
  • Minecraft
  • Guides
  • Contact Us
  • About The Team
    • Privacy Policy
    • Terms of Use

© 2022 - Alternative Way

No Result
View All Result
  • Home
    • Home – Layout 1
    • Home – Layout 2
    • Home – Layout 3
    • Home – Layout 4
    • Home – Layout 5
  • Travel News

© 2023 JNews - Premium WordPress news & magazine theme by Jegtheme.

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept All”, you consent to the use of ALL the cookies. However, you may visit "Cookie Settings" to provide a controlled consent.
Cookie SettingsAccept All
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT