├── app
├── .gitignore
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── web_hi_res_512.png
│ │ │ ├── mipmap-hdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-mdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── res
│ │ │ │ ├── mipmap-hdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-mdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xhdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xxhdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ └── mipmap-xxxhdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ ├── values
│ │ │ │ ├── dimens.xml
│ │ │ │ ├── styles.xml
│ │ │ │ ├── strings.xml
│ │ │ │ └── colors.xml
│ │ │ ├── drawable
│ │ │ │ ├── circle_bg.xml
│ │ │ │ └── ic_launcher_background.xml
│ │ │ ├── layout
│ │ │ │ ├── item_header.xml
│ │ │ │ ├── item_preference_text.xml
│ │ │ │ ├── item_preference_icon.xml
│ │ │ │ └── item_preference_switch.xml
│ │ │ └── drawable-v24
│ │ │ │ └── ic_launcher_foreground.xml
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── kieronquinn
│ │ │ │ └── app
│ │ │ │ └── springboardsettings
│ │ │ │ ├── settings
│ │ │ │ ├── BaseSetting.java
│ │ │ │ ├── HeaderSetting.java
│ │ │ │ ├── TextSetting.java
│ │ │ │ ├── IconSetting.java
│ │ │ │ ├── SwitchSetting.java
│ │ │ │ ├── SpringboardSetting.java
│ │ │ │ └── Adapter.java
│ │ │ │ ├── SpringboardItem.java
│ │ │ │ ├── helper
│ │ │ │ ├── OnStartDragListener.java
│ │ │ │ ├── ItemTouchHelperViewHolder.java
│ │ │ │ ├── ItemTouchHelperAdapter.java
│ │ │ │ └── SimpleItemTouchHelperCallback.java
│ │ │ │ ├── AlwaysMarqueeTextView.java
│ │ │ │ └── MainActivity.java
│ │ └── AndroidManifest.xml
│ ├── test
│ │ └── java
│ │ │ └── com
│ │ │ └── kieronquinn
│ │ │ └── app
│ │ │ └── springboardsettings
│ │ │ └── ExampleUnitTest.java
│ └── androidTest
│ │ └── java
│ │ └── com
│ │ └── kieronquinn
│ │ └── app
│ │ └── springboardsettings
│ │ └── ExampleInstrumentedTest.java
├── release
│ └── output.json
├── proguard-rules.pro
└── build.gradle
├── settings.gradle
├── .gitattributes
├── Images
└── springboard_settings.png
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── .idea
├── encodings.xml
├── vcs.xml
├── modules.xml
├── runConfigurations.xml
└── misc.xml
├── gradle.properties
├── README.md
├── .gitignore
├── gradlew.bat
├── gradlew
└── LICENSE
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
--------------------------------------------------------------------------------
/Images/springboard_settings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KieronQuinn/AmazfitSpringboardSettings/HEAD/Images/springboard_settings.png
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KieronQuinn/AmazfitSpringboardSettings/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/app/src/main/res/web_hi_res_512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KieronQuinn/AmazfitSpringboardSettings/HEAD/app/src/main/res/web_hi_res_512.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KieronQuinn/AmazfitSpringboardSettings/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KieronQuinn/AmazfitSpringboardSettings/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KieronQuinn/AmazfitSpringboardSettings/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KieronQuinn/AmazfitSpringboardSettings/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KieronQuinn/AmazfitSpringboardSettings/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KieronQuinn/AmazfitSpringboardSettings/HEAD/app/src/main/res/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KieronQuinn/AmazfitSpringboardSettings/HEAD/app/src/main/res/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KieronQuinn/AmazfitSpringboardSettings/HEAD/app/src/main/res/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KieronQuinn/AmazfitSpringboardSettings/HEAD/app/src/main/res/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KieronQuinn/AmazfitSpringboardSettings/HEAD/app/src/main/res/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/release/output.json:
--------------------------------------------------------------------------------
1 | [{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":11},"path":"app-release.apk","properties":{"packageId":"com.kieronquinn.app.springboardsettings","split":"","minSdkVersion":"22"}}]
--------------------------------------------------------------------------------
/app/src/main/java/com/kieronquinn/app/springboardsettings/settings/BaseSetting.java:
--------------------------------------------------------------------------------
1 | package com.kieronquinn.app.springboardsettings.settings;
2 |
3 | public class BaseSetting {
4 | //Empty base class
5 | public BaseSetting() {
6 | }
7 | }
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 8dp
5 | 24dp
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/circle_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
7 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sun Feb 11 20:39:03 GMT 2018
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/java/com/kieronquinn/app/springboardsettings/settings/HeaderSetting.java:
--------------------------------------------------------------------------------
1 | package com.kieronquinn.app.springboardsettings.settings;
2 |
3 | /**
4 | * Created by Kieron on 20/01/2018.
5 | */
6 |
7 | public class HeaderSetting extends BaseSetting {
8 |
9 | //Simple setting with only a title
10 |
11 | String title;
12 |
13 | public HeaderSetting(String title) {
14 | this.title = title;
15 | }
16 | }
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Springboard Settings
3 | Springboard
4 | Unknown
5 | Saved
6 | Unable to load springboard pages. Please try opening the Amazfit app on your phone, rearranging and enabling/disabling widget pages in the settings, then tap to reload
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #FF5722
4 | #E64A19
5 | #FFCCBC
6 | #FF9800
7 | #212121
8 | #757575
9 | #FFFFFF
10 | #BDBDBD
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/java/com/kieronquinn/app/springboardsettings/settings/TextSetting.java:
--------------------------------------------------------------------------------
1 | package com.kieronquinn.app.springboardsettings.settings;
2 |
3 | import android.view.View;
4 |
5 | /**
6 | * Created by Kieron on 25/02/2018.
7 | */
8 |
9 | public class TextSetting extends BaseSetting {
10 |
11 | View.OnClickListener onClickListener;
12 | String text;
13 |
14 | public TextSetting(String text, View.OnClickListener onClickListener) {
15 | this.text = text;
16 | this.onClickListener = onClickListener;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/app/src/test/java/com/kieronquinn/app/springboardsettings/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.kieronquinn.app.springboardsettings;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_header.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
15 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/app/src/main/java/com/kieronquinn/app/springboardsettings/settings/IconSetting.java:
--------------------------------------------------------------------------------
1 | package com.kieronquinn.app.springboardsettings.settings;
2 |
3 | import android.graphics.drawable.Drawable;
4 | import android.view.View;
5 |
6 | /**
7 | * Created by Kieron on 20/01/2018.
8 | */
9 |
10 | public class IconSetting extends BaseSetting {
11 |
12 | //Setting with a click listener, two strings and an icon
13 |
14 | View.OnClickListener onClickListener;
15 | String title;
16 | String subtitle;
17 | Drawable icon;
18 |
19 | public IconSetting(Drawable icon, String title, String subtitle, View.OnClickListener onClickListener) {
20 | this.onClickListener = onClickListener;
21 | this.title = title;
22 | this.subtitle = subtitle;
23 | this.icon = icon;
24 | }
25 | }
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/java/com/kieronquinn/app/springboardsettings/settings/SwitchSetting.java:
--------------------------------------------------------------------------------
1 | package com.kieronquinn.app.springboardsettings.settings;
2 |
3 | import android.graphics.drawable.Drawable;
4 | import android.widget.CompoundButton;
5 |
6 | /**
7 | * Created by Kieron on 20/01/2018.
8 | */
9 |
10 | public class SwitchSetting extends BaseSetting {
11 |
12 | //Setting with a change listener, two strings, a state and an icon
13 |
14 | boolean isChecked;
15 | CompoundButton.OnCheckedChangeListener changeListener;
16 | String title;
17 | String subtitle;
18 | Drawable icon;
19 |
20 | public SwitchSetting(Drawable icon, String title, String subtitle, CompoundButton.OnCheckedChangeListener changeListener, boolean isChecked) {
21 | this.changeListener = changeListener;
22 | this.isChecked = isChecked;
23 | this.title = title;
24 | this.subtitle = subtitle;
25 | this.icon = icon;
26 | }
27 | }
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/kieronquinn/app/springboardsettings/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.kieronquinn.app.springboardsettings;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.kieronquinn.app.springboardsettings", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_preference_text.xml:
--------------------------------------------------------------------------------
1 |
2 |
13 |
14 |
22 |
23 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 26
5 | defaultConfig {
6 | applicationId "com.kieronquinn.app.springboardsettings"
7 | minSdkVersion 22
8 | targetSdkVersion 26
9 | versionCode 11
10 | versionName "1.1"
11 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
12 | }
13 | buildTypes {
14 | release {
15 | minifyEnabled false
16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17 | }
18 | }
19 | }
20 |
21 | dependencies {
22 | implementation fileTree(dir: 'libs', include: ['*.jar'])
23 | implementation 'com.android.support:appcompat-v7:27.0.2'
24 | compile 'com.android.support:recyclerview-v7:27.0.2'
25 | testImplementation 'junit:junit:4.12'
26 | androidTestImplementation 'com.android.support.test:runner:1.0.1'
27 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
28 | }
29 |
--------------------------------------------------------------------------------
/app/src/main/java/com/kieronquinn/app/springboardsettings/settings/SpringboardSetting.java:
--------------------------------------------------------------------------------
1 | package com.kieronquinn.app.springboardsettings.settings;
2 |
3 | import android.graphics.drawable.Drawable;
4 | import android.widget.CompoundButton;
5 |
6 | import com.kieronquinn.app.springboardsettings.SpringboardItem;
7 |
8 | /**
9 | * Created by Kieron on 12/02/2018.
10 | */
11 |
12 | public class SpringboardSetting extends SwitchSetting {
13 |
14 | //Hold springboard item for use later
15 | private SpringboardItem springboardItem;
16 |
17 | //Constructor to be identical to the super but with an item for setting
18 | public SpringboardSetting(Drawable icon, String title, String subtitle, CompoundButton.OnCheckedChangeListener changeListener, boolean isChecked, SpringboardItem springboardItem) {
19 | super(icon, title, subtitle, changeListener, isChecked);
20 | //Set item
21 | this.springboardItem = springboardItem;
22 | }
23 |
24 | //Getter for item
25 | public SpringboardItem getSpringboardItem() {
26 | return springboardItem;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/app/src/main/java/com/kieronquinn/app/springboardsettings/SpringboardItem.java:
--------------------------------------------------------------------------------
1 | package com.kieronquinn.app.springboardsettings;
2 |
3 | /**
4 | * Created by Kieron on 12/02/2018.
5 | */
6 |
7 | public class SpringboardItem {
8 |
9 | //SpringboardItem contains a package name, class name and state. Title is only used in _out (and therefore not needed because we don't modify it), and srl is overwritten so no need to store it
10 | private String packageName, className;
11 | private boolean enable;
12 |
13 | //Constructor for the data to update information
14 | public SpringboardItem(String packageName, String className, boolean enable){
15 | this.packageName = packageName;
16 | this.className = className;
17 | this.enable = enable;
18 | }
19 |
20 | //Getters for data
21 | public String getPackageName() {
22 | return packageName;
23 | }
24 |
25 | public String getClassName() {
26 | return className;
27 | }
28 |
29 | public boolean isEnable() {
30 | return enable;
31 | }
32 |
33 | //Update enabled state
34 | public void setEnabled(boolean enabled) {
35 | this.enable = enabled;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/app/src/main/java/com/kieronquinn/app/springboardsettings/helper/OnStartDragListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 Paul Burke
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.kieronquinn.app.springboardsettings.helper;
18 |
19 | import android.support.v7.widget.RecyclerView;
20 |
21 | /**
22 | * Listener for manual initiation of a drag.
23 | */
24 | public interface OnStartDragListener {
25 |
26 | /**
27 | * Called when a view is requesting a start of a drag.
28 | *
29 | * @param viewHolder The holder of the view to drag.
30 | */
31 | void onStartDrag(RecyclerView.ViewHolder viewHolder);
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Amazfit Springboard Settings
2 |
3 | Simple application for enabling, disabling and rearranging pages on the launcher (aka Springboard) on the Amazfit Pace. Does not require root, does not require installing to the system, just install as normal and run it
4 |
5 | ## Features
6 | - Enable and disable pages (including those not available for modifying in the Amazfit phone app)
7 | - Rearrange pages (including those not available for modifying in the Amazfit phone app)
8 | - Includes capability to enable and disable custom pages if they ever become available
9 |
10 | ## Download
11 | Download either from the [XDA post](#) or the [releases page](https://github.com/KieronQuinn/AmazfitSpringboardSettings/releases)
12 |
13 | ## Installation
14 |
15 | `adb install -r SpringboardSettings-1.0.apk`
16 |
17 | ## Uninstallation
18 |
19 | `adb uninstall com.kieronquinn.app.springboardsettings`
20 |
21 | ## Screenshots
22 |
23 |
24 | These screenshots were created using a custom frame, which can be found [here](https://github.com/KieronQuinn/AmazfitStepNotify/raw/master/Images/pace_frame.png)
25 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Built application files
2 | *.apk
3 | *.ap_
4 |
5 | # Files for the ART/Dalvik VM
6 | *.dex
7 |
8 | # Java class files
9 | *.class
10 |
11 | # Generated files
12 | bin/
13 | gen/
14 | out/
15 |
16 | # Gradle files
17 | .gradle/
18 | build/
19 |
20 | # Local configuration file (sdk path, etc)
21 | local.properties
22 |
23 | # Proguard folder generated by Eclipse
24 | proguard/
25 |
26 | # Log Files
27 | *.log
28 |
29 | # Android Studio Navigation editor temp files
30 | .navigation/
31 |
32 | # Android Studio captures folder
33 | captures/
34 |
35 | # IntelliJ
36 | *.iml
37 | .idea/workspace.xml
38 | .idea/tasks.xml
39 | .idea/gradle.xml
40 | .idea/dictionaries
41 | .idea/libraries
42 |
43 | # Keystore files
44 | # Uncomment the following line if you do not want to check your keystore files in.
45 | #*.jks
46 |
47 | # External native build folder generated in Android Studio 2.2 and later
48 | .externalNativeBuild
49 |
50 | # Google Services (e.g. APIs or Firebase)
51 | google-services.json
52 |
53 | # Freeline
54 | freeline.py
55 | freeline/
56 | freeline_project_description.json
57 |
58 | # fastlane
59 | fastlane/report.xml
60 | fastlane/Preview.html
61 | fastlane/screenshots
62 | fastlane/test_output
63 | fastlane/readme.md
--------------------------------------------------------------------------------
/app/src/main/java/com/kieronquinn/app/springboardsettings/helper/ItemTouchHelperViewHolder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 Paul Burke
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.kieronquinn.app.springboardsettings.helper;
18 |
19 | import android.support.v7.widget.helper.ItemTouchHelper;
20 |
21 | /**
22 | * Interface to notify an item ViewHolder of relevant callbacks from {@link
23 | * ItemTouchHelper.Callback}.
24 | *
25 | * @author Paul Burke (ipaulpro)
26 | */
27 | public interface ItemTouchHelperViewHolder {
28 |
29 | /**
30 | * Called when the {@link ItemTouchHelper} first registers an item as being moved or swiped.
31 | * Implementations should update the item view to indicate it's active state.
32 | */
33 | void onItemSelected();
34 |
35 |
36 | /**
37 | * Called when the {@link ItemTouchHelper} has completed the move or swipe, and the active item
38 | * state should be cleared.
39 | */
40 | void onItemClear();
41 | }
42 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_preference_icon.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
21 |
22 |
27 |
28 |
37 |
38 |
45 |
46 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_preference_switch.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
23 |
24 |
29 |
30 |
39 |
40 |
47 |
48 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 | 1.8
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/app/src/main/java/com/kieronquinn/app/springboardsettings/AlwaysMarqueeTextView.java:
--------------------------------------------------------------------------------
1 | package com.kieronquinn.app.springboardsettings;
2 |
3 | import android.content.Context;
4 | import android.graphics.Rect;
5 | import android.os.CountDownTimer;
6 | import android.support.v7.widget.AppCompatTextView;
7 | import android.text.TextUtils;
8 | import android.util.AttributeSet;
9 |
10 | /*
11 |
12 | Imported from:
13 | https://github.com/Noobknight/MusicPlayer/blob/master/app/src/main/java/com/tadev/musicplayer/supports/design/AlwaysMarqueeTextView.java
14 | Modified to add a countdown to automatically starting the marquee after 1s
15 |
16 | */
17 |
18 | public class AlwaysMarqueeTextView extends AppCompatTextView {
19 | protected boolean a;
20 |
21 | public AlwaysMarqueeTextView(Context context) {
22 | super(context);
23 | a = false;
24 | setAlwaysMarquee(true);
25 | setAlwaysMarquee(false);
26 | countDownTimer.start();
27 | }
28 |
29 | public AlwaysMarqueeTextView(Context context, AttributeSet attributeset) {
30 | super(context, attributeset);
31 | a = false;
32 | countDownTimer.start();
33 | }
34 |
35 | public AlwaysMarqueeTextView(Context context, AttributeSet attributeset, int i) {
36 | super(context, attributeset, i);
37 | a = false;
38 | countDownTimer.start();
39 | }
40 |
41 | CountDownTimer countDownTimer = new CountDownTimer(1000, 1000) {
42 | @Override
43 | public void onTick(long l) {
44 |
45 | }
46 |
47 | @Override
48 | public void onFinish() {
49 | setAlwaysMarquee(true);
50 | }
51 | };
52 |
53 | public boolean isFocused() {
54 | return a || super.isFocused();
55 | }
56 |
57 | public void setAlwaysMarquee(boolean flag) {
58 | setSelected(flag);
59 | setSingleLine(flag);
60 | if (flag)
61 | setEllipsize(TextUtils.TruncateAt.MARQUEE);
62 | a = flag;
63 | }
64 |
65 | @Override
66 | protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) {
67 | if (focused)super.onFocusChanged(focused, direction, previouslyFocusedRect);
68 | }
69 |
70 | @Override
71 | public void onWindowFocusChanged(boolean focused) {
72 | if (focused)super.onWindowFocusChanged(focused);
73 | }
74 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/kieronquinn/app/springboardsettings/helper/ItemTouchHelperAdapter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 Paul Burke
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.kieronquinn.app.springboardsettings.helper;
18 |
19 | import android.support.v7.widget.RecyclerView;
20 | import android.support.v7.widget.helper.ItemTouchHelper;
21 |
22 | /**
23 | * Interface to listen for a move or dismissal event from a {@link ItemTouchHelper.Callback}.
24 | *
25 | * @author Paul Burke (ipaulpro)
26 | */
27 | public interface ItemTouchHelperAdapter {
28 |
29 | /**
30 | * Called when an item has been dragged far enough to trigger a move. This is called every time
31 | * an item is shifted, and not at the end of a "drop" event.
32 | *
33 | * Implementations should call {@link RecyclerView.Adapter#notifyItemMoved(int, int)} after
34 | * adjusting the underlying data to reflect this move.
35 | *
36 | * @param fromPosition The start position of the moved item.
37 | * @param toPosition Then resolved position of the moved item.
38 | * @return True if the item was moved to the new adapter position.
39 | *
40 | * @see RecyclerView#getAdapterPositionFor(RecyclerView.ViewHolder)
41 | * @see RecyclerView.ViewHolder#getAdapterPosition()
42 | */
43 | boolean onItemMove(int fromPosition, int toPosition);
44 |
45 |
46 | /**
47 | * Called when an item has been dismissed by a swipe.
48 | *
49 | * Implementations should call {@link RecyclerView.Adapter#notifyItemRemoved(int)} after
50 | * adjusting the underlying data to reflect this removal.
51 | *
52 | * @param position The position of the item dismissed.
53 | *
54 | * @see RecyclerView#getAdapterPositionFor(RecyclerView.ViewHolder)
55 | * @see RecyclerView.ViewHolder#getAdapterPosition()
56 | */
57 | void onItemDismiss(int position);
58 | }
59 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/app/src/main/java/com/kieronquinn/app/springboardsettings/helper/SimpleItemTouchHelperCallback.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 Paul Burke
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.kieronquinn.app.springboardsettings.helper;
18 |
19 | import android.graphics.Canvas;
20 | import android.support.v7.widget.GridLayoutManager;
21 | import android.support.v7.widget.RecyclerView;
22 | import android.support.v7.widget.helper.ItemTouchHelper;
23 |
24 | /**
25 | * An implementation of {@link ItemTouchHelper.Callback} that enables basic drag & drop and
26 | * swipe-to-dismiss. Drag events are automatically started by an item long-press.
27 | *
28 | * Expects the RecyclerView.Adapter to listen for {@link
29 | * ItemTouchHelperAdapter} callbacks and the RecyclerView.ViewHolder to implement
30 | * {@link ItemTouchHelperViewHolder}.
31 | *
32 | * @author Paul Burke (ipaulpro)
33 | */
34 | public class SimpleItemTouchHelperCallback extends ItemTouchHelper.Callback {
35 |
36 | public static final float ALPHA_FULL = 1.0f;
37 |
38 | private final ItemTouchHelperAdapter mAdapter;
39 |
40 | public SimpleItemTouchHelperCallback(ItemTouchHelperAdapter adapter) {
41 | mAdapter = adapter;
42 | }
43 |
44 | @Override
45 | public boolean isLongPressDragEnabled() {
46 | return true;
47 | }
48 |
49 | @Override
50 | public boolean isItemViewSwipeEnabled() {
51 | return false;
52 | }
53 |
54 | @Override
55 | public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
56 | // Set movement flags based on the layout manager
57 | if (recyclerView.getLayoutManager() instanceof GridLayoutManager) {
58 | final int dragFlags = ItemTouchHelper.UP | ItemTouchHelper.DOWN | ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT;
59 | final int swipeFlags = 0;
60 | return makeMovementFlags(dragFlags, swipeFlags);
61 | } else {
62 | final int dragFlags = ItemTouchHelper.UP | ItemTouchHelper.DOWN;
63 | final int swipeFlags = ItemTouchHelper.START | ItemTouchHelper.END;
64 | return makeMovementFlags(dragFlags, swipeFlags);
65 | }
66 | }
67 |
68 | @Override
69 | public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder source, RecyclerView.ViewHolder target) {
70 | if (source.getItemViewType() != target.getItemViewType()) {
71 | return false;
72 | }
73 |
74 | // Notify the adapter of the move
75 | mAdapter.onItemMove(source.getAdapterPosition(), target.getAdapterPosition());
76 | return true;
77 | }
78 |
79 | @Override
80 | public void onSwiped(RecyclerView.ViewHolder viewHolder, int i) {
81 | // Notify the adapter of the dismissal
82 | mAdapter.onItemDismiss(viewHolder.getAdapterPosition());
83 | }
84 |
85 | @Override
86 | public void onChildDraw(Canvas c, RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, float dX, float dY, int actionState, boolean isCurrentlyActive) {
87 | if (actionState == ItemTouchHelper.ACTION_STATE_SWIPE) {
88 | // Fade out the view as it is swiped out of the parent's bounds
89 | final float alpha = ALPHA_FULL - Math.abs(dX) / (float) viewHolder.itemView.getWidth();
90 | viewHolder.itemView.setAlpha(alpha);
91 | viewHolder.itemView.setTranslationX(dX);
92 | } else {
93 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive);
94 | }
95 | }
96 |
97 | @Override
98 | public void onSelectedChanged(RecyclerView.ViewHolder viewHolder, int actionState) {
99 | // We only want the active item to change
100 | if (actionState != ItemTouchHelper.ACTION_STATE_IDLE) {
101 | if (viewHolder instanceof ItemTouchHelperViewHolder) {
102 | // Let the view holder know that this item is being moved or dragged
103 | ItemTouchHelperViewHolder itemViewHolder = (ItemTouchHelperViewHolder) viewHolder;
104 | itemViewHolder.onItemSelected();
105 | }
106 | }
107 |
108 | super.onSelectedChanged(viewHolder, actionState);
109 | }
110 |
111 | @Override
112 | public void clearView(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
113 | super.clearView(recyclerView, viewHolder);
114 |
115 | viewHolder.itemView.setAlpha(ALPHA_FULL);
116 |
117 | if (viewHolder instanceof ItemTouchHelperViewHolder) {
118 | // Tell the view holder it's time to restore the idle state
119 | ItemTouchHelperViewHolder itemViewHolder = (ItemTouchHelperViewHolder) viewHolder;
120 | itemViewHolder.onItemClear();
121 | }
122 | }
123 | }
124 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
15 |
20 |
25 |
30 |
35 |
40 |
45 |
50 |
55 |
60 |
65 |
70 |
75 |
80 |
85 |
90 |
95 |
100 |
105 |
110 |
115 |
120 |
125 |
130 |
135 |
140 |
145 |
150 |
155 |
160 |
165 |
170 |
171 |
--------------------------------------------------------------------------------
/app/src/main/java/com/kieronquinn/app/springboardsettings/settings/Adapter.java:
--------------------------------------------------------------------------------
1 | package com.kieronquinn.app.springboardsettings.settings;
2 |
3 | import android.content.Context;
4 | import android.graphics.Color;
5 | import android.support.v7.widget.RecyclerView;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 | import android.widget.ImageView;
10 | import android.widget.Switch;
11 | import android.widget.TextView;
12 |
13 | import com.kieronquinn.app.springboardsettings.R;
14 | import com.kieronquinn.app.springboardsettings.helper.ItemTouchHelperAdapter;
15 | import com.kieronquinn.app.springboardsettings.helper.ItemTouchHelperViewHolder;
16 |
17 | import java.util.Collections;
18 | import java.util.List;
19 |
20 | public class Adapter extends RecyclerView.Adapter implements ItemTouchHelperAdapter {
21 |
22 | private final Context context;
23 | private final List settings;
24 | private ChangeListener changeListener;
25 |
26 | public Adapter(Context context, List settings, ChangeListener changeListener) {
27 | this.context = context;
28 | this.settings = settings;
29 | this.changeListener = changeListener;
30 | }
31 |
32 | public interface ChangeListener {
33 | void onChange();
34 | }
35 |
36 | @Override
37 | public Adapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
38 | LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
39 | //Three layouts possible - Header, icon and switch
40 | if (viewType == 0) {
41 | //Header
42 | return new ViewHolder(layoutInflater.inflate(R.layout.item_header, parent, false));
43 | } else if (viewType == 1) {
44 | //Icon Item
45 | return new ViewHolder(layoutInflater.inflate(R.layout.item_preference_icon, parent, false));
46 | } else if (viewType == 2) {
47 | //Switch Item
48 | return new ViewHolder(layoutInflater.inflate(R.layout.item_preference_switch, parent, false));
49 | } else if (viewType == 3) {
50 | //Text Item
51 | return new ViewHolder(layoutInflater.inflate(R.layout.item_preference_text, parent, false));
52 | }
53 | return null;
54 | }
55 |
56 | @Override
57 | public int getItemViewType(int position) {
58 | //Return the type of a given item
59 | BaseSetting setting = settings.get(position);
60 | if (setting instanceof HeaderSetting) return 0;
61 | if (setting instanceof IconSetting) return 1;
62 | if (setting instanceof SwitchSetting) return 2;
63 | else return 3;
64 | }
65 |
66 |
67 | @Override
68 | public void onBindViewHolder(final Adapter.ViewHolder holder, int position) {
69 | //Get base setting for position
70 | BaseSetting setting = settings.get(position);
71 | if (setting instanceof HeaderSetting) {
72 | //Header, just set text
73 | holder.title.setText(((HeaderSetting) setting).title);
74 | } else if (setting instanceof SwitchSetting) {
75 | //Switch, setup the change listener and click listener for the root view
76 | SwitchSetting switchSetting = (SwitchSetting) setting;
77 | holder.sw.setOnCheckedChangeListener(switchSetting.changeListener);
78 | holder.root.setOnClickListener(new View.OnClickListener() {
79 | @Override
80 | public void onClick(View view) {
81 | holder.sw.toggle();
82 | }
83 | });
84 | //Set default check
85 | holder.sw.setChecked(switchSetting.isChecked);
86 | //Setup title
87 | holder.title.setText(switchSetting.title);
88 | //Setup subtitle if required
89 | if (switchSetting.subtitle != null) {
90 | holder.subtitle.setText(switchSetting.subtitle);
91 | holder.subtitle.setVisibility(View.VISIBLE);
92 | } else {
93 | holder.subtitle.setText("");
94 | holder.subtitle.setVisibility(View.GONE);
95 | }
96 | } else if(setting instanceof TextSetting) {
97 | //TextSetting, just set content
98 | TextSetting textSetting = (TextSetting) setting;
99 | holder.subtitle.setText(textSetting.text);
100 | //And the click listener
101 | holder.root.setOnClickListener(textSetting.onClickListener);
102 | } else {
103 | //Icon, setup icon, click listener and title
104 | IconSetting iconSetting = (IconSetting) setting;
105 | holder.icon.setImageDrawable(iconSetting.icon);
106 | holder.root.setOnClickListener(iconSetting.onClickListener);
107 | holder.title.setText(iconSetting.title);
108 | //Setup subtitle if required
109 | if (iconSetting.subtitle != null) {
110 | holder.subtitle.setText(iconSetting.subtitle);
111 | holder.subtitle.setVisibility(View.VISIBLE);
112 | } else {
113 | holder.subtitle.setText("");
114 | holder.subtitle.setVisibility(View.GONE);
115 | }
116 | }
117 | }
118 |
119 | @Override
120 | public int getItemCount() {
121 | return settings.size();
122 | }
123 |
124 | @Override
125 | public void onItemDismiss(int position) {
126 | settings.remove(position);
127 | notifyItemRemoved(position);
128 | }
129 |
130 | @Override
131 | public boolean onItemMove(int fromPosition, int toPosition) {
132 | Collections.swap(settings, fromPosition, toPosition);
133 | notifyItemMoved(fromPosition, toPosition);
134 | if (changeListener != null) changeListener.onChange();
135 | return true;
136 | }
137 |
138 | public class ViewHolder extends RecyclerView.ViewHolder implements ItemTouchHelperViewHolder {
139 | View root;
140 | TextView title, subtitle;
141 | ImageView icon;
142 | Switch sw;
143 |
144 | public ViewHolder(View itemView) {
145 | super(itemView);
146 | //Set views
147 | title = itemView.findViewById(R.id.title);
148 | subtitle = itemView.findViewById(R.id.subtitle);
149 | icon = itemView.findViewById(R.id.icon);
150 | sw = itemView.findViewById(R.id.sw);
151 | root = itemView;
152 | }
153 |
154 | @Override
155 | public void onItemSelected() {
156 | itemView.setBackgroundColor(Color.LTGRAY);
157 | }
158 |
159 | @Override
160 | public void onItemClear() {
161 | itemView.setBackgroundColor(0);
162 | }
163 | }
164 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/kieronquinn/app/springboardsettings/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.kieronquinn.app.springboardsettings;
2 |
3 | import android.content.Intent;
4 | import android.content.pm.PackageManager;
5 | import android.os.Bundle;
6 | import android.os.CountDownTimer;
7 | import android.provider.Settings;
8 | import android.support.v7.app.AppCompatActivity;
9 | import android.support.v7.widget.LinearLayoutManager;
10 | import android.support.v7.widget.RecyclerView;
11 | import android.support.v7.widget.helper.ItemTouchHelper;
12 | import android.view.View;
13 | import android.widget.CompoundButton;
14 | import android.widget.Toast;
15 |
16 | import com.kieronquinn.app.springboardsettings.helper.SimpleItemTouchHelperCallback;
17 | import com.kieronquinn.app.springboardsettings.settings.Adapter;
18 | import com.kieronquinn.app.springboardsettings.settings.BaseSetting;
19 | import com.kieronquinn.app.springboardsettings.settings.HeaderSetting;
20 | import com.kieronquinn.app.springboardsettings.settings.SpringboardSetting;
21 | import com.kieronquinn.app.springboardsettings.settings.TextSetting;
22 |
23 | import org.json.JSONArray;
24 | import org.json.JSONException;
25 | import org.json.JSONObject;
26 |
27 | import java.util.ArrayList;
28 | import java.util.List;
29 |
30 | public class MainActivity extends AppCompatActivity {
31 |
32 | //List to hold all settings
33 | private ArrayList settingList;
34 |
35 | @Override
36 | protected void onCreate(Bundle savedInstanceState) {
37 | super.onCreate(savedInstanceState);
38 | //Get in and out settings. In is the main setting, which defines the order and state of a page, but does not always contain them all. Out contains them all, but no ordering
39 | String springboard_widget_order_in = Settings.System.getString(getContentResolver(), "springboard_widget_order_in");
40 | String springboard_widget_order_out = Settings.System.getString(getContentResolver(), "springboard_widget_order_out");
41 | //Create empty list
42 | settingList = new ArrayList<>();
43 | try {
44 | //Parse JSON
45 | JSONObject root = new JSONObject(springboard_widget_order_in);
46 | JSONArray data = root.getJSONArray("data");
47 | List addedComponents = new ArrayList<>();
48 | //Data array contains all the elements
49 | for(int x = 0; x < data.length(); x++){
50 | //Get item
51 | JSONObject item = data.getJSONObject(x);
52 | //srl is the position, stored as a string for some reason
53 | int srl = Integer.parseInt(item.getString("srl"));
54 | //State is stored as an integer when it would be better as a boolean so convert it
55 | boolean enable = item.getInt("enable") == 1;
56 | //Create springboard item with the package name, class name and state
57 | final SpringboardItem springboardItem = new SpringboardItem(item.getString("pkg"), item.getString("cls"), enable);
58 | //Create a setting (extending switch) with the relevant data and a callback
59 | SpringboardSetting springboardSetting = new SpringboardSetting(null, getTitle(springboardItem.getPackageName()), formatComponentName(springboardItem.getClassName()), new CompoundButton.OnCheckedChangeListener() {
60 | @Override
61 | public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
62 | //Ignore on create to reduce load
63 | if(!compoundButton.isPressed())return;
64 | //Update state
65 | springboardItem.setEnabled(b);
66 | //Save
67 | save();
68 | }
69 | }, springboardItem.isEnable(), springboardItem);
70 | //Store component name for later
71 | addedComponents.add(springboardItem.getClassName());
72 | try {
73 | //Attempt to add at position, may cause exception
74 | settingList.add(srl, springboardSetting);
75 | }catch (IndexOutOfBoundsException e){
76 | //Add at top as position won't work
77 | settingList.add(springboardSetting);
78 | }
79 | }
80 | //Parse JSON
81 | JSONObject rootOut = new JSONObject(springboard_widget_order_out);
82 | JSONArray dataOut = rootOut.getJSONArray("data");
83 | //Loop through main data array
84 | for(int x = 0; x < data.length(); x++){
85 | //Get item
86 | JSONObject item = dataOut.getJSONObject(x);
87 | //Get component name to check list
88 | String componentName = item.getString("cls");
89 | if(!addedComponents.contains(componentName)){
90 | //Get if item is enabled, this time stored as a string (why?)
91 | boolean enable = item.getString("enable").equals("true");
92 | //Create item with the package name, class name and state
93 | final SpringboardItem springboardItem = new SpringboardItem(item.getString("pkg"), item.getString("cls"), enable);
94 | //Create setting with all the relevant data
95 | SpringboardSetting springboardSetting = new SpringboardSetting(null, getTitle(springboardItem.getPackageName()), formatComponentName(springboardItem.getClassName()), new CompoundButton.OnCheckedChangeListener() {
96 | @Override
97 | public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
98 | if(!compoundButton.isPressed())return;
99 | springboardItem.setEnabled(b);
100 | save();
101 | }
102 | }, springboardItem.isEnable(), springboardItem);
103 | //Add class name to list to prevent it being adding more than once
104 | addedComponents.add(springboardItem.getClassName());
105 | //Add setting to main list
106 | settingList.add(springboardSetting);
107 | }
108 | }
109 | } catch (JSONException e) {
110 | e.printStackTrace();
111 | }
112 | //Empty settings list can be confusing to the user, and is quite common, so we'll add the FAQ to save them having to read the OP (oh the horror)
113 | if(settingList.size() == 0){
114 | //Add error message
115 | settingList.add(new TextSetting(getString(R.string.error_loading), new View.OnClickListener() {
116 | @Override
117 | public void onClick(View view) {
118 | //Restart
119 | startActivity(new Intent(MainActivity.this, MainActivity.class));
120 | finish();
121 | }
122 | }));
123 | }
124 | //Add main header to top (pos 0)
125 | settingList.add(0, new HeaderSetting(getString(R.string.springboard)));
126 | //Create adapter with setting list and a change listener to save the settings on move
127 | Adapter adapter = new Adapter(this, settingList, new Adapter.ChangeListener() {
128 | @Override
129 | public void onChange() {
130 | checkSave();
131 | }
132 | });
133 | //Create recyclerview as layout
134 | RecyclerView recyclerView = new RecyclerView(this);
135 | recyclerView.setLayoutManager(new LinearLayoutManager(this));
136 | recyclerView.setAdapter(adapter);
137 | //Setup drag to move using the helper
138 | ItemTouchHelper.Callback callback = new SimpleItemTouchHelperCallback(adapter);
139 | ItemTouchHelper touchHelper = new ItemTouchHelper(callback);
140 | touchHelper.attachToRecyclerView(recyclerView);
141 | //Add padding for the watch
142 | recyclerView.setPadding((int) getResources().getDimension(R.dimen.padding_round_small), 0, (int) getResources().getDimension(R.dimen.padding_round_small), (int) getResources().getDimension(R.dimen.padding_round_large));
143 | recyclerView.setClipToPadding(false);
144 | //Set the view
145 | setContentView(recyclerView);
146 | }
147 |
148 | //Get an app name from the package name
149 | private String getTitle(String pkg) {
150 | PackageManager packageManager = getPackageManager();
151 | try {
152 | return String.valueOf(packageManager.getApplicationLabel(packageManager.getApplicationInfo(pkg, 0)));
153 | } catch (PackageManager.NameNotFoundException e) {
154 | return getString(R.string.unknown);
155 | }
156 | }
157 |
158 | private void save() {
159 | //Create a blank array
160 | JSONArray data = new JSONArray();
161 | //Hold position for use as srl
162 | int pos = 0;
163 | for(BaseSetting springboardSetting : settingList){
164 | //Ignore if not a springboard setting
165 | if(!(springboardSetting instanceof SpringboardSetting))continue;
166 | //Get item
167 | SpringboardItem springboardItem = ((SpringboardSetting) springboardSetting).getSpringboardItem();
168 | JSONObject item = new JSONObject();
169 | //Setup item with data from the item
170 | try {
171 | item.put("pkg", springboardItem.getPackageName());
172 | item.put("cls", springboardItem.getClassName());
173 | item.put("srl", String.valueOf(pos));
174 | item.put("enable", springboardItem.isEnable() ? "1" : "0");
175 | } catch (JSONException e) {
176 | e.printStackTrace();
177 | }
178 | //Add to list and increment position
179 | data.put(item);
180 | pos++;
181 | }
182 | //Add to root object
183 | JSONObject root = new JSONObject();
184 | try {
185 | root.put("data", data);
186 | } catch (JSONException e) {
187 | e.printStackTrace();
188 | }
189 | //Save setting
190 | Settings.System.putString(getContentResolver(), "springboard_widget_order_in", root.toString());
191 | //Notify user
192 | Toast.makeText(this, getString(R.string.saved), Toast.LENGTH_LONG).show();
193 | }
194 |
195 | //Countdown timer to prevent saving too often
196 | private CountDownTimer countDownTimer;
197 | private void checkSave(){
198 | //Create timer if not already, for 2 seconds. Call save after completion
199 | if(countDownTimer == null)countDownTimer = new CountDownTimer(2000, 2000) {
200 | @Override
201 | public void onTick(long l) {
202 |
203 | }
204 |
205 | @Override
206 | public void onFinish() {
207 | save();
208 | }
209 | };
210 | //Cancel and start timer. This means that this method must be called ONCE in 2 seconds before save will be called, it prevents save from being called more than once every 2 seconds (buffers moving)
211 | countDownTimer.cancel();
212 | countDownTimer.start();
213 | }
214 |
215 | //Get last part of component name
216 | private String formatComponentName(String componentName){
217 | //Ignore if no . and just return component name
218 | if(!componentName.contains("."))return componentName;
219 | //Return just the last section of component name
220 | return componentName.substring(componentName.lastIndexOf(".") + 1);
221 | }
222 | }
223 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "{}"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright {yyyy} {name of copyright owner}
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------