diff --git a/.project b/.project
deleted file mode 100644
index 43c9323..0000000
--- a/.project
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
- OneClickAndroid
-
-
-
-
-
- com.android.ide.eclipse.adt.ResourceManagerBuilder
-
-
-
-
- com.android.ide.eclipse.adt.PreCompilerBuilder
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
- com.android.ide.eclipse.adt.ApkBuilder
-
-
-
-
-
- com.android.ide.eclipse.adt.AndroidNature
- org.eclipse.jdt.core.javanature
-
-
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..13145ab
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,10 @@
+language: android
+
+before_install:
+ - 'sudo mv /usr/local/android-sdk/tools/android-* /usr/local/bin'
+ - "android-update-sdk --components='platform-tools,tools' --accept-licenses='.+'"
+ - "android-update-sdk --components='build-tools-20.0.0' --accept-licenses='.+'"
+ - "android-update-sdk --components='android-20' --accept-licenses='.+'"
+
+script:
+ ./gradlew build
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 4371214..19497fa 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -4,7 +4,7 @@
android:versionCode="1013"
android:versionName="1.0.1.3">
-
+
+ android:screenOrientation="portrait"/>
+ android:screenOrientation="portrait"/>
+ android:screenOrientation="portrait"/>
+ android:screenOrientation="portrait"/>
+ android:exported="true"
+ android:screenOrientation="portrait" />
+ android:exported="false"/>
+ android:exported="false"/>
+ android:exported="false"/>
+ android:exported="false"/>
diff --git a/LICENSE b/LICENSE
index 0392aea..4ba25c8 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
-Copyright 2013 Koushik Dutta (2013)
+Copyright 2014 Cyanogen, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -10,4 +10,4 @@ Copyright 2013 Koushik Dutta (2013)
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
- limitations under the License.
\ No newline at end of file
+ limitations under the License.
diff --git a/OneClick.iml b/OneClick.iml
deleted file mode 100644
index 8f9999a..0000000
--- a/OneClick.iml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/README.md b/README.md
index 713df5f..1706be1 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,23 @@
# CyanogenMod Installer #
+[](https://travis-ci.org/cyngn/OneClickAndroid)
+
This app will assist you as you install the CyanogenMod experience.
-
\ No newline at end of file
+
+
+## License
+
+ Copyright 2014 Cyanogen, Inc.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/ant.properties b/ant.properties
deleted file mode 100644
index b0971e8..0000000
--- a/ant.properties
+++ /dev/null
@@ -1,17 +0,0 @@
-# This file is used to override default values used by the Ant build system.
-#
-# This file must be checked into Version Control Systems, as it is
-# integral to the build system of your project.
-
-# This file is only used by the Ant script.
-
-# You can use this to override default values such as
-# 'source.dir' for the location of your java source folder and
-# 'out.dir' for the location of your output folder.
-
-# You can also use it define how the release builds are signed by declaring
-# the following properties:
-# 'key.store' for the location of your keystore and
-# 'key.alias' for the name of the key to use.
-# The password will be asked during the build when you use the 'release' target.
-
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 0000000..8b71588
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,46 @@
+buildscript {
+ repositories {
+ mavenCentral()
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:0.12.+'
+ }
+}
+apply plugin: 'com.android.application'
+
+dependencies {
+ compile fileTree(dir: 'libs', include: '*.jar')
+}
+
+android {
+ compileSdkVersion 20
+ buildToolsVersion "20.0.0"
+
+ lintOptions {
+ abortOnError false
+ }
+
+ sourceSets {
+ main {
+ manifest.srcFile 'AndroidManifest.xml'
+ java.srcDirs = ['src']
+ resources.srcDirs = ['src']
+ aidl.srcDirs = ['src']
+ renderscript.srcDirs = ['src']
+ res.srcDirs = ['res']
+ assets.srcDirs = ['assets']
+ }
+
+ // Move the tests to tests/java, tests/res, etc...
+ //androidTest.setRoot('tests')
+
+ // Move the build types to build-types/
+ // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
+ // This moves them out of them default location under src//... which would
+ // conflict with src/ being used by the main source set.
+ // Adding new build types or product flavors should be accompanied
+ // by a similar customization.
+ debug.setRoot('build-types/debug')
+ release.setRoot('build-types/release')
+ }
+}
diff --git a/build.xml b/build.xml
deleted file mode 100644
index 912625e..0000000
--- a/build.xml
+++ /dev/null
@@ -1,92 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..0087cd3
Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..e9f95bc
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Fri May 23 16:28:18 PDT 2014
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-1.12-bin.zip
diff --git a/gradlew b/gradlew
new file mode 100755
index 0000000..91a7e26
--- /dev/null
+++ b/gradlew
@@ -0,0 +1,164 @@
+#!/usr/bin/env bash
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn ( ) {
+ echo "$*"
+}
+
+die ( ) {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+esac
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched.
+if $cygwin ; then
+ [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+fi
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >&-
+APP_HOME="`pwd -P`"
+cd "$SAVED" >&-
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
+function splitJvmOpts() {
+ JVM_OPTS=("$@")
+}
+eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
+JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+
+exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/gradlew.bat b/gradlew.bat
new file mode 100644
index 0000000..8a0b282
--- /dev/null
+++ b/gradlew.bat
@@ -0,0 +1,90 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windowz variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+if "%@eval[2+2]" == "4" goto 4NT_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+goto execute
+
+:4NT_args
+@rem Get arguments from the 4NT Shell from JP Software
+set CMD_LINE_ARGS=%$
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/project.properties b/project.properties
deleted file mode 100644
index 4ab1256..0000000
--- a/project.properties
+++ /dev/null
@@ -1,14 +0,0 @@
-# This file is automatically generated by Android Tools.
-# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
-#
-# This file must be checked in Version Control Systems.
-#
-# To customize properties used by the Ant build system edit
-# "ant.properties", and override values to adapt the script to your
-# project structure.
-#
-# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
-#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
-
-# Project target.
-target=android-19
diff --git a/res/drawable/button_default.xml b/res/drawable/button_default.xml
index f08cc0c..db2f4de 100644
--- a/res/drawable/button_default.xml
+++ b/res/drawable/button_default.xml
@@ -1,8 +1,8 @@
-
-
-
-
\ No newline at end of file
+
+
+
+
+
+
\ No newline at end of file
diff --git a/res/layout/disclaimer.xml b/res/layout/disclaimer.xml
index ab2ef95..808d0e9 100644
--- a/res/layout/disclaimer.xml
+++ b/res/layout/disclaimer.xml
@@ -27,16 +27,15 @@
style="@style/Title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:text="@string/warning"/>
+ android:text="@string/warning" />
-
+
-
+ android:paddingBottom="30dp"
+ android:text="@string/disclaimer" />
+
\ No newline at end of file
diff --git a/res/values-large/styles.xml b/res/values-large/styles.xml
index 7bca92e..66fd6bc 100644
--- a/res/values-large/styles.xml
+++ b/res/values-large/styles.xml
@@ -2,37 +2,37 @@
-
+
-
+
-
+
+
\ No newline at end of file
diff --git a/res/values-normal/styles.xml b/res/values-normal/styles.xml
index 7b2a847..a16898c 100644
--- a/res/values-normal/styles.xml
+++ b/res/values-normal/styles.xml
@@ -2,37 +2,37 @@
-
+
-
+
-
+
-
+
-
+
+
\ No newline at end of file
diff --git a/res/values-xlarge/styles.xml b/res/values-xlarge/styles.xml
index f5003d2..a0a69aa 100644
--- a/res/values-xlarge/styles.xml
+++ b/res/values-xlarge/styles.xml
@@ -2,37 +2,37 @@
-
+
-
+
-
+
-
+
-
+
-
+
+
\ No newline at end of file
diff --git a/src/org/cyanogenmod/oneclick/CompatibilityActivity.java b/src/org/cyanogenmod/oneclick/CompatibilityActivity.java
index 3491953..fa5fb29 100644
--- a/src/org/cyanogenmod/oneclick/CompatibilityActivity.java
+++ b/src/org/cyanogenmod/oneclick/CompatibilityActivity.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2014 Cyanogen, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.cyanogenmod.oneclick;
import android.app.Activity;
diff --git a/src/org/cyanogenmod/oneclick/DisclaimerActivity.java b/src/org/cyanogenmod/oneclick/DisclaimerActivity.java
index dde1c67..e1901ba 100644
--- a/src/org/cyanogenmod/oneclick/DisclaimerActivity.java
+++ b/src/org/cyanogenmod/oneclick/DisclaimerActivity.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2014 Cyanogen, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.cyanogenmod.oneclick;
import android.app.Activity;
@@ -5,9 +21,6 @@
import android.os.Bundle;
import android.view.View;
-/**
- * Created by koush on 11/28/13.
- */
public class DisclaimerActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
diff --git a/src/org/cyanogenmod/oneclick/FinishActivity.java b/src/org/cyanogenmod/oneclick/FinishActivity.java
index 10244b9..40a1b71 100644
--- a/src/org/cyanogenmod/oneclick/FinishActivity.java
+++ b/src/org/cyanogenmod/oneclick/FinishActivity.java
@@ -1,9 +1,24 @@
+/*
+ * Copyright 2014 Cyanogen, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.cyanogenmod.oneclick;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
-import android.provider.Settings;
import android.view.WindowManager;
public class FinishActivity extends Activity {
@@ -17,15 +32,10 @@ public void onCreate(Bundle savedInstanceState) {
@Override
public void onResume() {
super.onResume();
- if (!adbIsEnabled()) {
- // oh snap. we need to start over
+ if (!Utils.adbIsEnabled(this)) {
+ // oh snap. we need to start over
startActivity(new Intent(getBaseContext(), StartActivity.class));
finish();
}
}
-
- @SuppressWarnings("deprecation")
- private boolean adbIsEnabled() {
- return (Settings.Secure.getInt(getContentResolver(), Settings.Secure.ADB_ENABLED, 0) == 1);
- }
}
diff --git a/src/org/cyanogenmod/oneclick/HTCFastBootActivity.java b/src/org/cyanogenmod/oneclick/HTCFastBootActivity.java
index 527dafc..c3ba88f 100644
--- a/src/org/cyanogenmod/oneclick/HTCFastBootActivity.java
+++ b/src/org/cyanogenmod/oneclick/HTCFastBootActivity.java
@@ -1,11 +1,25 @@
+/*
+ * Copyright 2014 Cyanogen, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.cyanogenmod.oneclick;
import android.app.Activity;
import android.content.ActivityNotFoundException;
-import android.content.ComponentName;
import android.content.Intent;
import android.os.Bundle;
-import android.provider.Settings;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.animation.AlphaAnimation;
@@ -16,7 +30,6 @@
import android.widget.ImageView;
public class HTCFastBootActivity extends Activity {
-
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -60,7 +73,7 @@ public void onCreate(Bundle savedInstanceState) {
@Override
public void onClick(View view) {
Intent intent = new Intent();
- intent.setComponent(htcPowerManager);
+ intent.setComponent(HTCFastBootMonitorService.HTC_POWER_MANAGER);
try {
startActivity(intent);
startService(new Intent(getBaseContext(), HTCFastBootMonitorService.class));
@@ -73,8 +86,6 @@ public void onClick(View view) {
findViewById(R.id.next).setOnClickListener(openHtcFastBootListener);
}
- ComponentName htcPowerManager = new ComponentName("com.htc.htcpowermanager", "com.htc.htcpowermanager.PowerManagerActivity");
-
@Override
public void onResume() {
super.onResume();
@@ -87,11 +98,11 @@ public void onResume() {
private boolean fastBootIsDisabled() {
try {
// check the activity
- getPackageManager().getActivityInfo(htcPowerManager, 0);
+ getPackageManager().getActivityInfo(HTCFastBootMonitorService.HTC_POWER_MANAGER, 0);
} catch (Exception e) {
return true;
}
- return Settings.Secure.getInt(getContentResolver(), "enable_fastboot", 1) == 0;
+ return Utils.fastbootIsDisabled(getBaseContext());
}
}
diff --git a/src/org/cyanogenmod/oneclick/HTCFastBootMonitorService.java b/src/org/cyanogenmod/oneclick/HTCFastBootMonitorService.java
index c7ead3a..383ef70 100644
--- a/src/org/cyanogenmod/oneclick/HTCFastBootMonitorService.java
+++ b/src/org/cyanogenmod/oneclick/HTCFastBootMonitorService.java
@@ -1,24 +1,36 @@
+/*
+ * Copyright 2014 Cyanogen, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.cyanogenmod.oneclick;
import android.app.Activity;
import android.content.ComponentName;
-import android.provider.Settings;
-/**
- * Created by koush on 10/3/13.
- */
public class HTCFastBootMonitorService extends MonitorService {
- ComponentName htcPowerManager = new ComponentName("com.htc.htcpowermanager", "com.htc.htcpowermanager.PowerManagerActivity");
+ public static final ComponentName HTC_POWER_MANAGER = new ComponentName("com.htc.htcpowermanager", "com.htc.htcpowermanager.PowerManagerActivity");
@Override
protected boolean canContinue() {
try {
- getPackageManager().getActivityInfo(htcPowerManager, 0);
+ getPackageManager().getActivityInfo(HTC_POWER_MANAGER, 0);
} catch (Exception e) {
return true;
}
- return Settings.Secure.getInt(getContentResolver(), "enable_fastboot", 1) == 0;
+ return Utils.fastbootIsDisabled(getBaseContext());
}
@Override
diff --git a/src/org/cyanogenmod/oneclick/MonitorService.java b/src/org/cyanogenmod/oneclick/MonitorService.java
index f53e79b..b444815 100644
--- a/src/org/cyanogenmod/oneclick/MonitorService.java
+++ b/src/org/cyanogenmod/oneclick/MonitorService.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2014 Cyanogen, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.cyanogenmod.oneclick;
import android.app.Activity;
@@ -6,10 +22,7 @@
import android.os.Handler;
import android.os.IBinder;
-/**
- * Created by koush on 10/3/13.
- */
-abstract public class MonitorService extends Service {
+public abstract class MonitorService extends Service {
private Handler mHandler;
@Override
@@ -38,11 +51,12 @@ public void onCreate() {
mHandler = new Handler();
- new Runnable() {
+ (new Runnable() {
@Override
public void run() {
- if (mHandler == null)
+ if (mHandler == null) {
return;
+ }
if (canContinue()) {
Intent i = new Intent(getBaseContext(), getNextActivityClass());
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
@@ -54,7 +68,7 @@ public void run() {
}
mHandler.postDelayed(this, 1000);
}
- }.run();
+ }).run();
mHandler.postDelayed(new Runnable() {
@Override
diff --git a/src/org/cyanogenmod/oneclick/PtpActivity.java b/src/org/cyanogenmod/oneclick/PtpActivity.java
index 392c798..842d6b4 100644
--- a/src/org/cyanogenmod/oneclick/PtpActivity.java
+++ b/src/org/cyanogenmod/oneclick/PtpActivity.java
@@ -1,10 +1,25 @@
+/*
+ * Copyright 2014 Cyanogen, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.cyanogenmod.oneclick;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.os.Bundle;
-import android.os.SystemProperties;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.animation.AlphaAnimation;
@@ -20,7 +35,7 @@ public class PtpActivity extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- if (ptpIsEnabled()) {
+ if (Utils.ptpIsEnabled()) {
startActivity(new Intent(getBaseContext(), HTCFastBootActivity.class));
finish();
return;
@@ -76,17 +91,9 @@ public void onClick(View view) {
public void onResume() {
super.onResume();
- if (ptpIsEnabled()) {
+ if (Utils.ptpIsEnabled()) {
startActivity(new Intent(getBaseContext(), UnplugDeviceActivity.class));
finish();
}
}
-
- private boolean ptpIsEnabled() {
- String usbConfig = SystemProperties.get("persist.sys.usb.config");
- if (usbConfig != null && usbConfig.contains("mtp")) {
- return false;
- }
- return true;
- }
}
diff --git a/src/org/cyanogenmod/oneclick/PtpMonitorService.java b/src/org/cyanogenmod/oneclick/PtpMonitorService.java
index 696f619..59bc8ca 100644
--- a/src/org/cyanogenmod/oneclick/PtpMonitorService.java
+++ b/src/org/cyanogenmod/oneclick/PtpMonitorService.java
@@ -1,16 +1,27 @@
+/*
+ * Copyright 2014 Cyanogen, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.cyanogenmod.oneclick;
import android.app.Activity;
-import android.os.SystemProperties;
public class PtpMonitorService extends MonitorService {
@Override
protected boolean canContinue() {
- String usbConfig = SystemProperties.get("persist.sys.usb.config");
- if (usbConfig != null && usbConfig.contains("mtp")) {
- return false;
- }
- return true;
+ return Utils.ptpIsEnabled();
}
@Override
diff --git a/src/org/cyanogenmod/oneclick/ReturnToMacActivity.java b/src/org/cyanogenmod/oneclick/ReturnToMacActivity.java
index dac01fb..5660434 100644
--- a/src/org/cyanogenmod/oneclick/ReturnToMacActivity.java
+++ b/src/org/cyanogenmod/oneclick/ReturnToMacActivity.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2014 Cyanogen, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.cyanogenmod.oneclick;
import android.app.Activity;
diff --git a/src/org/cyanogenmod/oneclick/ReturnToWindowsActivity.java b/src/org/cyanogenmod/oneclick/ReturnToWindowsActivity.java
index 95ada4f..3341af2 100644
--- a/src/org/cyanogenmod/oneclick/ReturnToWindowsActivity.java
+++ b/src/org/cyanogenmod/oneclick/ReturnToWindowsActivity.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2014 Cyanogen, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.cyanogenmod.oneclick;
import android.app.Activity;
diff --git a/src/org/cyanogenmod/oneclick/StartActivity.java b/src/org/cyanogenmod/oneclick/StartActivity.java
index 62203c8..2465bed 100644
--- a/src/org/cyanogenmod/oneclick/StartActivity.java
+++ b/src/org/cyanogenmod/oneclick/StartActivity.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2014 Cyanogen, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.cyanogenmod.oneclick;
import android.app.Activity;
diff --git a/src/org/cyanogenmod/oneclick/UnplugDeviceActivity.java b/src/org/cyanogenmod/oneclick/UnplugDeviceActivity.java
index 233e17f..0402766 100644
--- a/src/org/cyanogenmod/oneclick/UnplugDeviceActivity.java
+++ b/src/org/cyanogenmod/oneclick/UnplugDeviceActivity.java
@@ -1,9 +1,23 @@
+/*
+ * Copyright 2014 Cyanogen, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.cyanogenmod.oneclick;
import android.app.Activity;
import android.content.Intent;
-import android.content.IntentFilter;
-import android.os.BatteryManager;
import android.os.Bundle;
public class UnplugDeviceActivity extends Activity {
@@ -12,7 +26,7 @@ public class UnplugDeviceActivity extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- if (!deviceIsPluggedIn()) {
+ if (!Utils.deviceIsPluggedIn(this)) {
startActivity(new Intent(getBaseContext(), FinishActivity.class));
finish();
return;
@@ -27,14 +41,8 @@ public void onCreate(Bundle savedInstanceState) {
public void onResume() {
super.onResume();
- if (!deviceIsPluggedIn()) {
+ if (!Utils.deviceIsPluggedIn(this)) {
finish();
}
}
-
- private boolean deviceIsPluggedIn() {
- Intent intent = getBaseContext().registerReceiver(null, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
- int plugged = intent.getIntExtra(BatteryManager.EXTRA_PLUGGED, -1);
- return (plugged == BatteryManager.BATTERY_PLUGGED_USB) || (plugged == BatteryManager.BATTERY_PLUGGED_AC);
- }
}
diff --git a/src/org/cyanogenmod/oneclick/UnplugDeviceMonitorService.java b/src/org/cyanogenmod/oneclick/UnplugDeviceMonitorService.java
index f0be386..fa63016 100644
--- a/src/org/cyanogenmod/oneclick/UnplugDeviceMonitorService.java
+++ b/src/org/cyanogenmod/oneclick/UnplugDeviceMonitorService.java
@@ -1,17 +1,27 @@
+/*
+ * Copyright 2014 Cyanogen, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.cyanogenmod.oneclick;
import android.app.Activity;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.os.BatteryManager;
public class UnplugDeviceMonitorService extends MonitorService {
@Override
protected boolean canContinue() {
- Intent intent = getBaseContext().registerReceiver(null, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
- int plugged = intent.getIntExtra(BatteryManager.EXTRA_PLUGGED, -1);
- boolean isPlugged = (plugged == BatteryManager.BATTERY_PLUGGED_USB) || (plugged == BatteryManager.BATTERY_PLUGGED_AC);
- return !isPlugged;
+ return !Utils.deviceIsPluggedIn(this);
}
@Override
diff --git a/src/org/cyanogenmod/oneclick/UsbActivity.java b/src/org/cyanogenmod/oneclick/UsbActivity.java
index 3328dc6..8af5c93 100644
--- a/src/org/cyanogenmod/oneclick/UsbActivity.java
+++ b/src/org/cyanogenmod/oneclick/UsbActivity.java
@@ -1,10 +1,25 @@
+/*
+ * Copyright 2014 Cyanogen, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.cyanogenmod.oneclick;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.os.Bundle;
-import android.provider.Settings;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.animation.AlphaAnimation;
@@ -20,7 +35,7 @@ public class UsbActivity extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- if (adbIsEnabled()) {
+ if (Utils.adbIsEnabled(this)) {
startActivity(new Intent(getBaseContext(), PtpActivity.class));
finish();
return;
@@ -76,13 +91,8 @@ public void onClick(View view) {
public void onResume() {
super.onResume();
- if (adbIsEnabled()) {
+ if (Utils.adbIsEnabled(this)) {
finish();
}
}
-
- @SuppressWarnings("deprecation")
- private boolean adbIsEnabled() {
- return (Settings.Secure.getInt(getContentResolver(), Settings.Secure.ADB_ENABLED, 0) == 1);
- }
}
diff --git a/src/org/cyanogenmod/oneclick/UsbDebuggingMonitorService.java b/src/org/cyanogenmod/oneclick/UsbDebuggingMonitorService.java
index 1210d31..7e7eecd 100644
--- a/src/org/cyanogenmod/oneclick/UsbDebuggingMonitorService.java
+++ b/src/org/cyanogenmod/oneclick/UsbDebuggingMonitorService.java
@@ -1,13 +1,27 @@
+/*
+ * Copyright 2014 Cyanogen, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.cyanogenmod.oneclick;
import android.app.Activity;
-import android.provider.Settings;
public class UsbDebuggingMonitorService extends MonitorService {
- @SuppressWarnings("deprecation")
@Override
protected boolean canContinue() {
- return (Settings.Secure.getInt(getContentResolver(), Settings.Secure.ADB_ENABLED, 0) == 1);
+ return Utils.adbIsEnabled(this);
}
@Override
diff --git a/src/org/cyanogenmod/oneclick/Utils.java b/src/org/cyanogenmod/oneclick/Utils.java
index c9f31e7..2e093bd 100644
--- a/src/org/cyanogenmod/oneclick/Utils.java
+++ b/src/org/cyanogenmod/oneclick/Utils.java
@@ -1,6 +1,27 @@
+/*
+ * Copyright 2014 Cyanogen, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.cyanogenmod.oneclick;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.os.BatteryManager;
import android.os.SystemProperties;
+import android.provider.Settings;
import java.util.ArrayList;
@@ -106,4 +127,27 @@ public static boolean isDeviceSupported() {
return false;
}
+
+ public static boolean ptpIsEnabled() {
+ String usbConfig = SystemProperties.get("persist.sys.usb.config");
+ if (usbConfig != null && usbConfig.contains("mtp")) {
+ return false;
+ }
+ return true;
+ }
+
+ @SuppressWarnings("deprecation")
+ public static boolean adbIsEnabled(Context context) {
+ return Settings.Secure.getInt(context.getContentResolver(), Settings.Secure.ADB_ENABLED, 0) == 1;
+ }
+
+ public static boolean fastbootIsDisabled(Context context) {
+ return Settings.Secure.getInt(context.getContentResolver(), "enable_fastboot", 1) == 0;
+ }
+
+ public static boolean deviceIsPluggedIn(Context context) {
+ Intent intent = context.registerReceiver(null, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
+ int plugged = intent.getIntExtra(BatteryManager.EXTRA_PLUGGED, -1);
+ return (plugged == BatteryManager.BATTERY_PLUGGED_USB) || (plugged == BatteryManager.BATTERY_PLUGGED_AC);
+ }
}