<commit_before>Android Slider Preference Library
=================================

![A dialog-based preference that provides slider widget functionality. Useful for settings where the range of values are not discrete and fall along a continuum. This preference will store a float between 0.0 and 1.0 in the SharedPreferences.](https://raw.github.com/jayschwa/AndroidSliderPreference/master/screenshot.png)

## Overview

* Slider represents a `float` between `0.0` and `1.0`
  * Access with `SliderPreference.getValue()` or [`SharedPreferences.getFloat()`][shar]
* Supports multiple summaries (e.g. "Low", "Medium", "High") and selects one based on the slider's position
  * Java: `SliderPreference.setSummary(CharSequence[] summaries)`
  * XML: `android:summary="@array/string_array_of_summaries"`
  * A single `String` still works too
* Subclass of [`DialogPreference`][diag]
  * Supports all [dialog-specific attributes][datr] such as `android:dialogMessage`
  * Visually-consistent with Android's built-in preferences
  * Less error-prone than displaying the slider directly on the settings screen
* [MIT License](#license)

[datr]: https://developer.android.com/reference/android/preference/DialogPreference.html#lattrs "DialogPreference attributes"
[diag]: https://developer.android.com/reference/android/preference/DialogPreference.html "DialogPreference"
[shar]: https://developer.android.com/reference/android/content/SharedPreferences.html#getFloat(java.lang.String,%20float) "getFloat()"

## How To Use

### Android Studio

#### Using Gradle

1. Step: Add this to your root build.gradle
```
allprojects {
	repositories {
		// [...]
		maven { url 'https://jitpack.io' }
	}
}
```
2. Step: Add the dependency to your project build.gradle
```
dependencies {
    // [...]
    compile 'com.github.jayschwa:AndroidSliderPreference:v1.0.1'
}
```

#### Using a Module

1. Paste or clone this library into the `/libs` folder, in the root directory of your project. Create a new folder: `/libs` if not already present.  (This step is not required - only for keeping cleaner project structure)

2. Edit `settings.gradle` by adding the library. You have also define a project directory for the library. Your `settings.gradle` should look like below:

    ```
    include ':app', ':SliderPreference'
    project(':SliderPreference').projectDir = new File('libs/AndroidSliderPreference')
    ```

3. In `app/build.gradle` add the SliderPreference library as a dependency:

    ```
    dependencies {<commit_msg>Grammar and style tweaks to Gradle section<commit_after>Android Slider Preference Library
=================================

![A dialog-based preference that provides slider widget functionality. Useful for settings where the range of values are not discrete and fall along a continuum. This preference will store a float between 0.0 and 1.0 in the SharedPreferences.](https://raw.github.com/jayschwa/AndroidSliderPreference/master/screenshot.png)

## Overview

* Slider represents a `float` between `0.0` and `1.0`
  * Access with `SliderPreference.getValue()` or [`SharedPreferences.getFloat()`][shar]
* Supports multiple summaries (e.g. "Low", "Medium", "High") and selects one based on the slider's position
  * Java: `SliderPreference.setSummary(CharSequence[] summaries)`
  * XML: `android:summary="@array/string_array_of_summaries"`
  * A single `String` still works too
* Subclass of [`DialogPreference`][diag]
  * Supports all [dialog-specific attributes][datr] such as `android:dialogMessage`
  * Visually-consistent with Android's built-in preferences
  * Less error-prone than displaying the slider directly on the settings screen
* [MIT License](#license)

[datr]: https://developer.android.com/reference/android/preference/DialogPreference.html#lattrs "DialogPreference attributes"
[diag]: https://developer.android.com/reference/android/preference/DialogPreference.html "DialogPreference"
[shar]: https://developer.android.com/reference/android/content/SharedPreferences.html#getFloat(java.lang.String,%20float) "getFloat()"

## How To Use

### Android Studio

#### Using Gradle

1. Step: Add [JitPack](https://jitpack.io/) to your root `build.gradle`:
```
allprojects {
	repositories {
		// [...]
		maven { url 'https://jitpack.io' }
	}
}
```
2. Step: Add the library as a dependency to your project `build.gradle`:
```
dependencies {
    // [...]
    compile 'com.github.jayschwa:AndroidSliderPreference:v1.0.1'
}
```

#### Using a Module

1. Paste or clone this library into the `/libs` folder, in the root directory of your project. Create a new folder: `/libs` if not already present.  (This step is not required - only for keeping cleaner project structure)

2. Edit `settings.gradle` by adding the library. You also have to define a project directory for the library. Your `settings.gradle` should look like below:

    ```
    include ':app', ':SliderPreference'
    project(':SliderPreference').projectDir = new File('libs/AndroidSliderPreference')
    ```

3. In `app/build.gradle` add the SliderPreference library as a dependency:

    ```
    dependencies {
{'fraction_non_alphanumeric': 0.1318012178353958, 'fraction_numerical': 0.007071302298173247, 'mean_word_length': 4.832760595647193, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 11, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '157784', 'n_tokens_mistral': 1515, 'n_tokens_neox': 1428, 'n_words': 472}