Skip to content
Browse files

Initial commit

  • Loading branch information...
0 parents commit cc52b3fd959708f5daa56af41bf295c947b91f78 @Nightonke committed
Showing with 1,531 additions and 0 deletions.
  1. +8 −0 .gitignore
  2. +1 −0 .idea/.name
  3. +22 −0 .idea/compiler.xml
  4. +3 −0 .idea/copyright/profiles_settings.xml
  5. +6 −0 .idea/encodings.xml
  6. +25 −0 .idea/gradle.xml
  7. +62 −0 .idea/misc.xml
  8. +10 −0 .idea/modules.xml
  9. +12 −0 .idea/runConfigurations.xml
  10. +1 −0 app/.gitignore
  11. +31 −0 app/build.gradle
  12. +17 −0 app/proguard-rules.pro
  13. +13 −0 app/src/androidTest/java/com/nightonke/blurlockviewsample/ApplicationTest.java
  14. +22 −0 app/src/main/AndroidManifest.xml
  15. +29 −0 app/src/main/java/com/nightonke/blurlockviewsample/MainActivity.java
  16. BIN app/src/main/res/drawable/test_background.jpg
  17. +22 −0 app/src/main/res/layout/activity_main.xml
  18. BIN app/src/main/res/mipmap-hdpi/ic_launcher.png
  19. BIN app/src/main/res/mipmap-mdpi/ic_launcher.png
  20. BIN app/src/main/res/mipmap-xhdpi/ic_launcher.png
  21. BIN app/src/main/res/mipmap-xxhdpi/ic_launcher.png
  22. BIN app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
  23. +6 −0 app/src/main/res/values-w820dp/dimens.xml
  24. +6 −0 app/src/main/res/values/colors.xml
  25. +5 −0 app/src/main/res/values/dimens.xml
  26. +3 −0 app/src/main/res/values/strings.xml
  27. +11 −0 app/src/main/res/values/styles.xml
  28. +15 −0 app/src/test/java/com/nightonke/blurlockviewsample/ExampleUnitTest.java
  29. +1 −0 blurlockview/.gitignore
  30. +25 −0 blurlockview/build.gradle
  31. +17 −0 blurlockview/proguard-rules.pro
  32. +13 −0 blurlockview/src/androidTest/java/com/nightonke/blurlockview/ApplicationTest.java
  33. +11 −0 blurlockview/src/main/AndroidManifest.xml
  34. +147 −0 blurlockview/src/main/java/com/nightonke/blurlockview/BigButtonView.java
  35. +155 −0 blurlockview/src/main/java/com/nightonke/blurlockview/BlurLockView.java
  36. +170 −0 blurlockview/src/main/java/com/nightonke/blurlockview/BlurView.java
  37. +17 −0 blurlockview/src/main/java/com/nightonke/blurlockview/Password.java
  38. +20 −0 blurlockview/src/main/res/drawable/button_background.xml
  39. +8 −0 blurlockview/src/main/res/drawable/button_click_effect.xml
  40. +48 −0 blurlockview/src/main/res/layout/big_button_view.xml
  41. +174 −0 blurlockview/src/main/res/layout/number_blur_lock_view.xml
  42. BIN blurlockview/src/main/res/mipmap-hdpi/ic_launcher.png
  43. BIN blurlockview/src/main/res/mipmap-mdpi/ic_launcher.png
  44. BIN blurlockview/src/main/res/mipmap-xhdpi/ic_launcher.png
  45. BIN blurlockview/src/main/res/mipmap-xxhdpi/ic_launcher.png
  46. BIN blurlockview/src/main/res/mipmap-xxxhdpi/ic_launcher.png
  47. +15 −0 blurlockview/src/main/res/values/attrs.xml
  48. +6 −0 blurlockview/src/main/res/values/colors.xml
  49. +43 −0 blurlockview/src/main/res/values/defaults.xml
  50. +6 −0 blurlockview/src/main/res/values/dimens.xml
  51. +3 −0 blurlockview/src/main/res/values/strings.xml
  52. +8 −0 blurlockview/src/main/res/values/styles.xml
  53. +15 −0 blurlockview/src/test/java/com/nightonke/blurlockview/ExampleUnitTest.java
  54. +24 −0 build.gradle
  55. +18 −0 gradle.properties
  56. BIN gradle/wrapper/gradle-wrapper.jar
  57. +6 −0 gradle/wrapper/gradle-wrapper.properties
  58. +160 −0 gradlew
  59. +90 −0 gradlew.bat
  60. +1 −0 settings.gradle
8 .gitignore
@@ -0,0 +1,8 @@
+*.iml
+.gradle
+/local.properties
+/.idea/workspace.xml
+/.idea/libraries
+.DS_Store
+/build
+/captures
1 .idea/.name
@@ -0,0 +1 @@
+BlurLockViewSample
22 .idea/compiler.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="CompilerConfiguration">
+ <resourceExtensions />
+ <wildcardResourcePatterns>
+ <entry name="!?*.java" />
+ <entry name="!?*.form" />
+ <entry name="!?*.class" />
+ <entry name="!?*.groovy" />
+ <entry name="!?*.scala" />
+ <entry name="!?*.flex" />
+ <entry name="!?*.kt" />
+ <entry name="!?*.clj" />
+ <entry name="!?*.aj" />
+ </wildcardResourcePatterns>
+ <annotationProcessing>
+ <profile default="true" name="Default" enabled="false">
+ <processorPath useClasspath="true" />
+ </profile>
+ </annotationProcessing>
+ </component>
+</project>
3 .idea/copyright/profiles_settings.xml
@@ -0,0 +1,3 @@
+<component name="CopyrightManager">
+ <settings default="" />
+</component>
6 .idea/encodings.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="Encoding">
+ <file url="PROJECT" charset="UTF-8" />
+ </component>
+</project>
25 .idea/gradle.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="GradleSettings">
+ <option name="linkedExternalProjectsSettings">
+ <GradleProjectSettings>
+ <option name="distributionType" value="DEFAULT_WRAPPED" />
+ <option name="externalProjectPath" value="$PROJECT_DIR$" />
+ <option name="modules">
+ <set>
+ <option value="$PROJECT_DIR$" />
+ <option value="$PROJECT_DIR$/app" />
+ <option value="$PROJECT_DIR$/blurlockview" />
+ </set>
+ </option>
+ <option name="myModules">
+ <set>
+ <option value="$PROJECT_DIR$" />
+ <option value="$PROJECT_DIR$/app" />
+ <option value="$PROJECT_DIR$/blurlockview" />
+ </set>
+ </option>
+ </GradleProjectSettings>
+ </option>
+ </component>
+</project>
62 .idea/misc.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="EntryPointsManager">
+ <entry_points version="2.0" />
+ </component>
+ <component name="NullableNotNullManager">
+ <option name="myDefaultNullable" value="android.support.annotation.Nullable" />
+ <option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
+ <option name="myNullables">
+ <value>
+ <list size="4">
+ <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
+ <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
+ <item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
+ <item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
+ </list>
+ </value>
+ </option>
+ <option name="myNotNulls">
+ <value>
+ <list size="4">
+ <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
+ <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
+ <item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
+ <item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
+ </list>
+ </value>
+ </option>
+ </component>
+ <component name="ProjectLevelVcsManager" settingsEditedManually="false">
+ <OptionsSetting value="true" id="Add" />
+ <OptionsSetting value="true" id="Remove" />
+ <OptionsSetting value="true" id="Checkout" />
+ <OptionsSetting value="true" id="Update" />
+ <OptionsSetting value="true" id="Status" />
+ <OptionsSetting value="true" id="Edit" />
+ <ConfirmationsSetting value="0" id="Add" />
+ <ConfirmationsSetting value="0" id="Remove" />
+ </component>
+ <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
+ <output url="file://$PROJECT_DIR$/build/classes" />
+ </component>
+ <component name="ProjectType">
+ <option name="id" value="Android" />
+ </component>
+ <component name="masterDetails">
+ <states>
+ <state key="ProjectJDKs.UI">
+ <settings>
+ <last-edited>1.8</last-edited>
+ <splitter-proportions>
+ <option name="proportions">
+ <list>
+ <option value="0.2" />
+ </list>
+ </option>
+ </splitter-proportions>
+ </settings>
+ </state>
+ </states>
+ </component>
+</project>
10 .idea/modules.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="ProjectModuleManager">
+ <modules>
+ <module fileurl="file://$PROJECT_DIR$/BlurLockViewSample.iml" filepath="$PROJECT_DIR$/BlurLockViewSample.iml" />
+ <module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
+ <module fileurl="file://$PROJECT_DIR$/blurlockview/blurlockview.iml" filepath="$PROJECT_DIR$/blurlockview/blurlockview.iml" />
+ </modules>
+ </component>
+</project>
12 .idea/runConfigurations.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="RunConfigurationProducerService">
+ <option name="ignoredProducers">
+ <set>
+ <option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
+ <option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
+ <option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
+ </set>
+ </option>
+ </component>
+</project>
1 app/.gitignore
@@ -0,0 +1 @@
+/build
31 app/build.gradle
@@ -0,0 +1,31 @@
+apply plugin: 'com.android.application'
+
+android {
+ compileSdkVersion 23
+ buildToolsVersion "23.0.2"
+
+ defaultConfig {
+ applicationId "com.nightonke.blurlockviewsample"
+ minSdkVersion 17
+ targetSdkVersion 23
+ versionCode 1
+ versionName "1.0"
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+}
+
+dependencies {
+ compile fileTree(include: ['*.jar'], dir: 'libs')
+ testCompile 'junit:junit:4.12'
+ compile 'com.android.support:appcompat-v7:23.2.0'
+ compile project(':blurlockview')
+
+ compile('com.github.afollestad.material-dialogs:core:0.8.5.7@aar') {
+ transitive = true
+ }
+}
17 app/proguard-rules.pro
@@ -0,0 +1,17 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in D:\Programs\SDK/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
13 app/src/androidTest/java/com/nightonke/blurlockviewsample/ApplicationTest.java
@@ -0,0 +1,13 @@
+package com.nightonke.blurlockviewsample;
+
+import android.app.Application;
+import android.test.ApplicationTestCase;
+
+/**
+ * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
+ */
+public class ApplicationTest extends ApplicationTestCase<Application> {
+ public ApplicationTest() {
+ super(Application.class);
+ }
+}
22 app/src/main/AndroidManifest.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.nightonke.blurlockviewsample">
+
+ <application
+ android:allowBackup="true"
+ android:icon="@mipmap/ic_launcher"
+ android:label="@string/app_name"
+ android:supportsRtl="true"
+ android:theme="@style/AppTheme">
+ <activity
+ android:name=".MainActivity"
+ android:theme="@style/Theme.AppCompat.NoActionBar">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ </application>
+
+</manifest>
29 app/src/main/java/com/nightonke/blurlockviewsample/MainActivity.java
@@ -0,0 +1,29 @@
+package com.nightonke.blurlockviewsample;
+
+import android.support.v7.app.AppCompatActivity;
+import android.os.Bundle;
+import android.view.Window;
+import android.view.WindowManager;
+
+import com.nightonke.blurlockview.BlurLockView;
+
+public class MainActivity extends AppCompatActivity {
+
+ private BlurLockView blurLockView;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ requestWindowFeature(Window.FEATURE_NO_TITLE);
+ getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
+ WindowManager.LayoutParams.FLAG_FULLSCREEN);
+
+ setContentView(R.layout.activity_main);
+
+ blurLockView = (BlurLockView)findViewById(R.id.blurlockview);
+ blurLockView.setBlurredView(findViewById(R.id.image));
+ blurLockView.setCorrectPassword("1234");
+ blurLockView.invalidate();
+ }
+}
BIN app/src/main/res/drawable/test_background.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 app/src/main/res/layout/activity_main.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ tools:context="com.nightonke.blurlockviewsample.MainActivity">
+
+ <ImageView
+ android:id="@+id/image"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:src="@drawable/test_background"
+ />
+
+ <com.nightonke.blurlockview.BlurLockView
+ android:id="@+id/blurlockview"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ />
+
+
+</FrameLayout>
BIN app/src/main/res/mipmap-hdpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN app/src/main/res/mipmap-mdpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN app/src/main/res/mipmap-xhdpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 app/src/main/res/values-w820dp/dimens.xml
@@ -0,0 +1,6 @@
+<resources>
+ <!-- Example customization of dimensions originally defined in res/values/dimens.xml
+ (such as screen margins) for screens with more than 820dp of available width. This
+ would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
+ <dimen name="activity_horizontal_margin">64dp</dimen>
+</resources>
6 app/src/main/res/values/colors.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <color name="colorPrimary">#3F51B5</color>
+ <color name="colorPrimaryDark">#303F9F</color>
+ <color name="colorAccent">#FF4081</color>
+</resources>
5 app/src/main/res/values/dimens.xml
@@ -0,0 +1,5 @@
+<resources>
+ <!-- Default screen margins, per the Android Design guidelines. -->
+ <dimen name="activity_horizontal_margin">16dp</dimen>
+ <dimen name="activity_vertical_margin">16dp</dimen>
+</resources>
3 app/src/main/res/values/strings.xml
@@ -0,0 +1,3 @@
+<resources>
+ <string name="app_name">BlurLockViewSample</string>
+</resources>
11 app/src/main/res/values/styles.xml
@@ -0,0 +1,11 @@
+<resources>
+
+ <!-- Base application theme. -->
+ <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
+ <!-- Customize your theme here. -->
+ <item name="colorPrimary">@color/colorPrimary</item>
+ <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
+ <item name="colorAccent">@color/colorAccent</item>
+ </style>
+
+</resources>
15 app/src/test/java/com/nightonke/blurlockviewsample/ExampleUnitTest.java
@@ -0,0 +1,15 @@
+package com.nightonke.blurlockviewsample;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * To work on unit tests, switch the Test Artifact in the Build Variants view.
+ */
+public class ExampleUnitTest {
+ @Test
+ public void addition_isCorrect() throws Exception {
+ assertEquals(4, 2 + 2);
+ }
+}
1 blurlockview/.gitignore
@@ -0,0 +1 @@
+/build
25 blurlockview/build.gradle
@@ -0,0 +1,25 @@
+apply plugin: 'com.android.library'
+
+android {
+ compileSdkVersion 23
+ buildToolsVersion "23.0.2"
+
+ defaultConfig {
+ minSdkVersion 17
+ targetSdkVersion 23
+ versionCode 1
+ versionName "1.0"
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+}
+
+dependencies {
+ compile fileTree(dir: 'libs', include: ['*.jar'])
+ testCompile 'junit:junit:4.12'
+ compile 'com.android.support:appcompat-v7:23.2.0'
+}
17 blurlockview/proguard-rules.pro
@@ -0,0 +1,17 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in D:\Programs\SDK/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
13 blurlockview/src/androidTest/java/com/nightonke/blurlockview/ApplicationTest.java
@@ -0,0 +1,13 @@
+package com.nightonke.blurlockview;
+
+import android.app.Application;
+import android.test.ApplicationTestCase;
+
+/**
+ * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
+ */
+public class ApplicationTest extends ApplicationTestCase<Application> {
+ public ApplicationTest() {
+ super(Application.class);
+ }
+}
11 blurlockview/src/main/AndroidManifest.xml
@@ -0,0 +1,11 @@
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.nightonke.blurlockview">
+
+ <application
+ android:allowBackup="true"
+ android:label="@string/app_name"
+ android:supportsRtl="true">
+
+ </application>
+
+</manifest>
147 blurlockview/src/main/java/com/nightonke/blurlockview/BigButtonView.java
@@ -0,0 +1,147 @@
+package com.nightonke.blurlockview;
+
+import android.animation.ObjectAnimator;
+import android.content.Context;
+import android.content.res.Resources;
+import android.support.v4.content.ContextCompat;
+import android.util.AttributeSet;
+import android.util.TypedValue;
+import android.view.Gravity;
+import android.view.LayoutInflater;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.FrameLayout;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+/**
+ * Created by Weiping on 2016/3/16.
+ */
+public class BigButtonView extends FrameLayout {
+
+ private FrameLayout frameLayout;
+ private View clickEffect;
+ private TextView text;
+ private TextView subText;
+ private String textString = "";
+ private String subTextString = "";
+ private ObjectAnimator clickEffectAnimator;
+ private OnPressListener onPressListener;
+
+ public BigButtonView(Context context) {
+ this(context, null);
+ }
+
+ public BigButtonView(Context context, AttributeSet attrs) {
+ super(context, attrs);
+
+ LayoutInflater.from(context).inflate(R.layout.big_button_view, this, true);
+
+ Resources resources = getResources();
+
+ frameLayout = (FrameLayout)findViewById(R.id.frame_layout);
+
+ text = (TextView)findViewById(R.id.text);
+ text.setText(textString);
+ text.setTextColor(ContextCompat.getColor(context, R.color.default_big_button_text_color));
+ text.setTextSize(resources.getInteger(R.integer.default_big_button_text_size));
+
+ subText = (TextView)findViewById(R.id.sub_text);
+ subText.setText(subTextString);
+ subText.setTextColor(ContextCompat.getColor(context, R.color.default_big_button_sub_text_color));
+ subText.setTextSize(resources.getInteger(R.integer.default_big_button_sub_text_size));
+
+ clickEffect = findViewById(R.id.click_effect);
+ clickEffect.setAlpha(0);
+ clickEffectAnimator = ObjectAnimator.ofFloat(clickEffect, "alpha", 1f, 0f);
+ clickEffectAnimator.setDuration(500);
+ }
+
+ public void setOnPressListener(OnPressListener onPressListener) {
+ this.onPressListener = onPressListener;
+ }
+
+ public void setWidth(int width) {
+ ViewGroup.LayoutParams layoutParams = frameLayout.getLayoutParams();
+ layoutParams.width = width;
+ frameLayout.setLayoutParams(layoutParams);
+ }
+
+ public void setHeight(int height) {
+ ViewGroup.LayoutParams layoutParams = frameLayout.getLayoutParams();
+ layoutParams.height = height;
+ frameLayout.setLayoutParams(layoutParams);
+ }
+
+ /**
+ * Set the string of the text.
+ *
+ * @param textString The new string.
+ */
+ public void setText(String textString) {
+ this.textString = textString;
+ if (text != null) text.setText(textString);
+ }
+
+ /**
+ * Set the string of the sub text.
+ *
+ * @param subTextString The new string.
+ */
+ public void setSubText(String subTextString) {
+ this.subTextString = subTextString;
+ if (subText != null) subText.setText(subTextString);
+ }
+
+ /**
+ * Set the visibility of sub textview.
+ *
+ * @param visibility The visibility.
+ */
+ public void setSubTextVisibility(int visibility) {
+ if (visibility == GONE) {
+ text.setGravity(Gravity.CENTER);
+ text.setLayoutParams(new LinearLayout.LayoutParams(
+ LinearLayout.LayoutParams.MATCH_PARENT,
+ 0,
+ 10));
+ } else {
+ text.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM);
+ text.setLayoutParams(new LinearLayout.LayoutParams(
+ LinearLayout.LayoutParams.MATCH_PARENT,
+ 0,
+ 7));
+ }
+ subText.setVisibility(visibility);
+ }
+
+ /**
+ * Perform the click effect.
+ *
+ * @param event MotionEvent.
+ * @return
+ */
+ @Override
+ public boolean dispatchTouchEvent(MotionEvent event) {
+ if (event.getPointerCount() > 1) return true;
+ switch(event.getAction()){
+ case MotionEvent.ACTION_DOWN:
+ if (onPressListener != null) onPressListener.onPress(textString);
+ clickEffectAnimator.cancel();
+ clickEffect.setAlpha(1);
+ break;
+ case MotionEvent.ACTION_UP:
+ clickEffectAnimator.start();
+ break;
+ default:break;
+ }
+
+ return super.dispatchTouchEvent(event);
+ }
+
+ public interface OnPressListener {
+ void onPress(String string);
+ }
+
+}
155 blurlockview/src/main/java/com/nightonke/blurlockview/BlurLockView.java
@@ -0,0 +1,155 @@
+package com.nightonke.blurlockview;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.FrameLayout;
+import android.widget.TextView;
+
+import java.util.Stack;
+
+/**
+ * Created by Weiping on 2016/3/16.
+ */
+public class BlurLockView extends FrameLayout
+ implements BigButtonView.OnPressListener {
+
+ private Password type = Password.NUMBER;
+
+ private int passwordLength = 4;
+ private String correctPassword = null;
+ private int errorInputTimes = 0;
+ private boolean returnInputPasswordAlways = false;
+ private boolean autoQuit = true;
+
+ private Stack<String> passwordStack = new Stack<>();
+
+ private BigButtonView[] bigButtonViews;
+ private BlurView mBlurView;
+ private TextView leftButton;
+ private TextView rightButton;
+
+ private OnLeftButtonClickListener onLeftButtonClickListener;
+ private OnPasswordInputListener onPasswordInputListener;
+
+ public BlurLockView(Context context) {
+ this(context, null);
+ }
+
+ public BlurLockView(Context context, AttributeSet attrs) {
+ super(context, attrs);
+
+ if (type.equals(Password.NUMBER)) {
+ // is number password
+ LayoutInflater.from(context).inflate(R.layout.number_blur_lock_view, this, true);
+
+ bigButtonViews = new BigButtonView[10];
+ bigButtonViews[0] = (BigButtonView)findViewById(R.id.button_0);
+ bigButtonViews[1] = (BigButtonView)findViewById(R.id.button_1);
+ bigButtonViews[2] = (BigButtonView)findViewById(R.id.button_2);
+ bigButtonViews[3] = (BigButtonView)findViewById(R.id.button_3);
+ bigButtonViews[4] = (BigButtonView)findViewById(R.id.button_4);
+ bigButtonViews[5] = (BigButtonView)findViewById(R.id.button_5);
+ bigButtonViews[6] = (BigButtonView)findViewById(R.id.button_6);
+ bigButtonViews[7] = (BigButtonView)findViewById(R.id.button_7);
+ bigButtonViews[8] = (BigButtonView)findViewById(R.id.button_8);
+ bigButtonViews[9] = (BigButtonView)findViewById(R.id.button_9);
+
+ String[] texts = getResources().getStringArray(R.array.default_big_button_text);
+ String[] subTexts = getResources().getStringArray(R.array.default_big_button_sub_text);
+ for (int i = 0; i < 10; i++) {
+ bigButtonViews[i].setOnPressListener(this);
+ bigButtonViews[i].setText(texts[i]);
+ bigButtonViews[i].setSubText(subTexts[i]);
+ }
+
+ bigButtonViews[0].setSubTextVisibility(View.GONE);
+ bigButtonViews[1].setSubTextVisibility(View.INVISIBLE);
+ }
+
+ mBlurView = (BlurView)findViewById(R.id.blurview);
+ leftButton = (TextView)findViewById(R.id.left_button);
+ leftButton.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if (onLeftButtonClickListener != null) onLeftButtonClickListener.onClick();
+ }
+ });
+ rightButton = (TextView)findViewById(R.id.right_button);
+ rightButton.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if (passwordStack.size() > 0) passwordStack.pop();
+ }
+ });
+ }
+
+ public void setBlurredView(View blurredView) {
+ mBlurView.setBlurredView(blurredView);
+ }
+
+ @Override
+ public void onPress(String string) {
+ if (correctPassword == null) {
+ throw new RuntimeException("The correct password has NOT been set!");
+ }
+ passwordStack.push(string);
+ StringBuilder nowPassword = new StringBuilder("");
+ for (String s : passwordStack) {
+ nowPassword.append(s);
+ }
+ String nowPasswordString = nowPassword.toString();
+ if (correctPassword.equals(nowPasswordString)) {
+ // correct password
+ if (onPasswordInputListener != null)
+ onPasswordInputListener.correct(nowPasswordString);
+ if (autoQuit) {
+ // perform the quit animation
+ } else {
+
+ }
+ } else {
+ if (correctPassword.length() > nowPasswordString.length()) {
+ // input right now
+ if (onPasswordInputListener != null)
+ onPasswordInputListener.input(nowPasswordString);
+ } else {
+ // incorrect password
+ if (onPasswordInputListener != null)
+ onPasswordInputListener.incorrect(nowPasswordString);
+ // perform the clear animation
+ }
+ }
+ }
+
+ public void setType(Password type) {
+ this.type = type;
+ }
+
+ public void setCorrectPassword(String correctPassword) {
+ this.correctPassword = correctPassword;
+ }
+
+ public void setErrorInputTimes(int errorInputTimes) {
+ this.errorInputTimes = errorInputTimes;
+ }
+
+ public void setReturnInputPasswordAlways(boolean returnInputPasswordAlways) {
+ this.returnInputPasswordAlways = returnInputPasswordAlways;
+ }
+
+ public void setAutoQuit(boolean autoQuit) {
+ this.autoQuit = autoQuit;
+ }
+
+ public interface OnPasswordInputListener {
+ void correct(String inputPassword);
+ void incorrect(String inputPassword);
+ void input(String inputPassword);
+ }
+
+ public interface OnLeftButtonClickListener {
+ void onClick();
+ }
+}
170 blurlockview/src/main/java/com/nightonke/blurlockview/BlurView.java
@@ -0,0 +1,170 @@
+package com.nightonke.blurlockview;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.content.res.TypedArray;
+import android.graphics.Bitmap;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.drawable.ColorDrawable;
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.renderscript.RenderScript;
+import android.renderscript.ScriptIntrinsicBlur;
+import android.util.AttributeSet;
+import android.view.View;
+
+/**
+ * Created by Weiping on 2016/3/16.
+ */
+public class BlurView extends View {
+
+ private int mDownsampleFactor;
+ private int mOverlayColor;
+
+ private View mBlurredView;
+ private int mBlurredViewWidth, mBlurredViewHeight;
+
+ private boolean mDownsampleFactorChanged;
+ private Bitmap mBitmapToBlur, mBlurredBitmap;
+ private Canvas mBlurringCanvas;
+ private RenderScript mRenderScript;
+ private ScriptIntrinsicBlur mBlurScript;
+ private Allocation mBlurInput, mBlurOutput;
+
+ public BlurView(Context context) {
+ this(context, null);
+ }
+
+ public BlurView(Context context, AttributeSet attrs) {
+ super(context, attrs);
+
+ final Resources res = getResources();
+ final int defaultBlurRadius = res.getInteger(R.integer.default_blur_radius);
+ final int defaultDownsampleFactor = res.getInteger(R.integer.default_downsample_factor);
+ final int defaultOverlayColor = res.getColor(R.color.default_overlay_color);
+
+ initializeRenderScript(context);
+
+ TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.BlurView);
+ setBlurRadius(a.getInt(R.styleable.BlurView_blurRadius, defaultBlurRadius));
+ setDownsampleFactor(a.getInt(R.styleable.BlurView_downsampleFactor,
+ defaultDownsampleFactor));
+ setOverlayColor(a.getColor(R.styleable.BlurView_overlayColor, defaultOverlayColor));
+ a.recycle();
+ }
+
+ public void setBlurredView(View blurredView) {
+ mBlurredView = blurredView;
+ }
+
+ @Override
+ protected void onDraw(Canvas canvas) {
+ super.onDraw(canvas);
+ if (mBlurredView != null) {
+ if (prepare()) {
+ // If the background of the blurred view is a color drawable, we use it to clear
+ // the blurring canvas, which ensures that edges of the child views are blurred
+ // as well; otherwise we clear the blurring canvas with a transparent color.
+ if (mBlurredView.getBackground() != null && mBlurredView.getBackground() instanceof ColorDrawable) {
+ mBitmapToBlur.eraseColor(((ColorDrawable) mBlurredView.getBackground()).getColor());
+ } else {
+ mBitmapToBlur.eraseColor(Color.TRANSPARENT);
+ }
+
+ mBlurredView.draw(mBlurringCanvas);
+ blur();
+
+ canvas.save();
+ canvas.translate(mBlurredView.getX() - getX(), mBlurredView.getY() - getY());
+ canvas.scale(mDownsampleFactor, mDownsampleFactor);
+ canvas.drawBitmap(mBlurredBitmap, 0, 0, null);
+ canvas.restore();
+ }
+ canvas.drawColor(mOverlayColor);
+ }
+ }
+
+ public void setBlurRadius(int radius) {
+ mBlurScript.setRadius(radius);
+ }
+
+ public void setDownsampleFactor(int factor) {
+ if (factor <= 0) {
+ throw new IllegalArgumentException("Downsample factor must be greater than 0.");
+ }
+
+ if (mDownsampleFactor != factor) {
+ mDownsampleFactor = factor;
+ mDownsampleFactorChanged = true;
+ }
+ }
+
+ public void setOverlayColor(int color) {
+ mOverlayColor = color;
+ }
+
+ private void initializeRenderScript(Context context) {
+ mRenderScript = RenderScript.create(context);
+ mBlurScript = ScriptIntrinsicBlur.create(mRenderScript, Element.U8_4(mRenderScript));
+ }
+
+ protected boolean prepare() {
+ final int width = mBlurredView.getWidth();
+ final int height = mBlurredView.getHeight();
+
+ if (mBlurringCanvas == null || mDownsampleFactorChanged
+ || mBlurredViewWidth != width || mBlurredViewHeight != height) {
+ mDownsampleFactorChanged = false;
+
+ mBlurredViewWidth = width;
+ mBlurredViewHeight = height;
+
+ int scaledWidth = width / mDownsampleFactor;
+ int scaledHeight = height / mDownsampleFactor;
+
+ // The following manipulation is to avoid some RenderScript artifacts at the edge.
+ scaledWidth = scaledWidth - scaledWidth % 4 + 4;
+ scaledHeight = scaledHeight - scaledHeight % 4 + 4;
+
+ if (mBlurredBitmap == null
+ || mBlurredBitmap.getWidth() != scaledWidth
+ || mBlurredBitmap.getHeight() != scaledHeight) {
+ mBitmapToBlur = Bitmap.createBitmap(scaledWidth, scaledHeight,
+ Bitmap.Config.ARGB_8888);
+ if (mBitmapToBlur == null) {
+ return false;
+ }
+
+ mBlurredBitmap = Bitmap.createBitmap(scaledWidth, scaledHeight,
+ Bitmap.Config.ARGB_8888);
+ if (mBlurredBitmap == null) {
+ return false;
+ }
+ }
+
+ mBlurringCanvas = new Canvas(mBitmapToBlur);
+ mBlurringCanvas.scale(1f / mDownsampleFactor, 1f / mDownsampleFactor);
+ mBlurInput = Allocation.createFromBitmap(mRenderScript, mBitmapToBlur,
+ Allocation.MipmapControl.MIPMAP_NONE, Allocation.USAGE_SCRIPT);
+ mBlurOutput = Allocation.createTyped(mRenderScript, mBlurInput.getType());
+ }
+ return true;
+ }
+
+ protected void blur() {
+ mBlurInput.copyFrom(mBitmapToBlur);
+ mBlurScript.setInput(mBlurInput);
+ mBlurScript.forEach(mBlurOutput);
+ mBlurOutput.copyTo(mBlurredBitmap);
+ }
+
+ @Override
+ protected void onDetachedFromWindow() {
+ super.onDetachedFromWindow();
+ if (mRenderScript != null) {
+ mRenderScript.destroy();
+ }
+ }
+
+}
17 blurlockview/src/main/java/com/nightonke/blurlockview/Password.java
@@ -0,0 +1,17 @@
+package com.nightonke.blurlockview;
+
+/**
+ * Created by Weiping on 2016/3/17.
+ */
+public enum Password {
+
+ NUMBER(0),
+ TEXT(1);
+
+ private int type;
+
+ private Password(int type) {
+ this.type = type;
+ }
+
+}
20 blurlockview/src/main/res/drawable/button_background.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android" >
+ <item android:state_pressed="true" >
+ <shape android:shape="oval" >
+
+ </shape>
+ </item>
+ <item android:state_focused="true">
+ <shape android:shape="oval" >
+ <stroke android:width="1.5dip" android:color="@color/default_button_press" />
+ <solid android:color="@android:color/transparent"/>
+ </shape>
+ </item>
+ <item >
+ <shape android:shape="oval" >
+ <stroke android:width="1.5dip" android:color="@color/default_button_press" />
+ <solid android:color="@android:color/transparent"/>
+ </shape>
+ </item>
+</selector>
8 blurlockview/src/main/res/drawable/button_click_effect.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android" >
+ <item >
+ <shape android:shape="oval" >
+ <solid android:color="@color/default_button_press"/>
+ </shape>
+ </item>
+</selector>
48 blurlockview/src/main/res/layout/big_button_view.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="utf-8"?>
+<FrameLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/frame_layout"
+ android:layout_width="@dimen/default_big_button_width"
+ android:layout_height="@dimen/default_big_button_height"
+ android:background="@drawable/button_background"
+ android:clickable="true"
+ >
+
+ <View
+ android:id="@+id/click_effect"
+ android:layout_width="@dimen/default_big_button_width"
+ android:layout_height="@dimen/default_big_button_height"
+ android:background="@drawable/button_click_effect"
+ />
+
+ <LinearLayout
+ android:layout_height="match_parent"
+ android:layout_width="match_parent"
+ android:orientation="vertical"
+ android:layout_gravity="center"
+ android:weightSum="10"
+ >
+
+ <TextView
+ android:id="@+id/text"
+ android:layout_height="0dp"
+ android:layout_width="match_parent"
+ android:layout_weight="7"
+ android:text="5"
+ android:textSize="35sp"
+ android:gravity="center_horizontal|bottom"
+ />
+
+ <TextView
+ android:id="@+id/sub_text"
+ android:layout_height="0dp"
+ android:layout_width="match_parent"
+ android:layout_weight="3"
+ android:layout_marginTop="-7dp"
+ android:text="ABC"
+ android:gravity="center_horizontal|top"
+ />
+
+ </LinearLayout>
+
+</FrameLayout>
174 blurlockview/src/main/res/layout/number_blur_lock_view.xml
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="utf-8"?>
+<FrameLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <com.nightonke.blurlockview.BlurView
+ android:id="@+id/blurview"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ />
+
+ <RelativeLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ >
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:layout_above="@+id/layout_123"
+ >
+
+ <TextView
+ android:id="@+id/title"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ android:text="Input Password"
+ android:textSize="20sp"
+ android:layout_marginBottom="15dp"
+ android:layout_marginTop="56dp"
+ />
+
+ <TextView
+ android:id="@+id/indicator"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ android:text="Indicator here"
+ android:layout_marginBottom="30dp"
+ />
+
+ </LinearLayout>
+
+ <RelativeLayout
+ android:id="@+id/layout_123"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_above="@+id/layout_456"
+ >
+
+ <com.nightonke.blurlockview.BigButtonView
+ android:id="@+id/button_1"
+ android:layout_width="80dp"
+ android:layout_height="80dp"
+ android:layout_toStartOf="@+id/button_2"
+ android:layout_marginEnd="@dimen/button_margin"
+ />
+
+ <com.nightonke.blurlockview.BigButtonView
+ android:id="@+id/button_2"
+ android:layout_width="80dp"
+ android:layout_height="80dp"
+ android:layout_centerHorizontal="true"
+ android:layout_marginBottom="@dimen/button_margin"
+ />
+
+ <com.nightonke.blurlockview.BigButtonView
+ android:id="@+id/button_3"
+ android:layout_width="80dp"
+ android:layout_height="80dp"
+ android:layout_toEndOf="@id/button_2"
+ android:layout_marginStart="@dimen/button_margin"
+ />
+
+ </RelativeLayout>
+
+ <RelativeLayout
+ android:id="@+id/layout_456"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_centerInParent="true"
+ >
+
+ <com.nightonke.blurlockview.BigButtonView
+ android:id="@+id/button_4"
+ android:layout_width="80dp"
+ android:layout_height="80dp"
+ android:layout_toStartOf="@+id/button_5"
+ android:layout_marginEnd="@dimen/button_margin"
+ />
+
+ <com.nightonke.blurlockview.BigButtonView
+ android:id="@+id/button_5"
+ android:layout_width="80dp"
+ android:layout_height="80dp"
+ android:layout_centerHorizontal="true"
+ android:layout_marginBottom="@dimen/button_margin"
+ />
+
+ <com.nightonke.blurlockview.BigButtonView
+ android:id="@+id/button_6"
+ android:layout_width="80dp"
+ android:layout_height="80dp"
+ android:layout_toEndOf="@id/button_5"
+ android:layout_marginStart="@dimen/button_margin"
+ />
+
+ </RelativeLayout>
+
+ <RelativeLayout
+ android:id="@+id/layout_789"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_below="@+id/layout_456"
+ >
+
+ <com.nightonke.blurlockview.BigButtonView
+ android:id="@+id/button_7"
+ android:layout_width="80dp"
+ android:layout_height="80dp"
+ android:layout_toStartOf="@+id/button_8"
+ android:layout_marginEnd="@dimen/button_margin"
+ />
+
+ <com.nightonke.blurlockview.BigButtonView
+ android:id="@+id/button_8"
+ android:layout_width="80dp"
+ android:layout_height="80dp"
+ android:layout_centerHorizontal="true"
+ android:layout_marginBottom="@dimen/button_margin"
+ />
+
+ <com.nightonke.blurlockview.BigButtonView
+ android:id="@+id/button_9"
+ android:layout_width="80dp"
+ android:layout_height="80dp"
+ android:layout_toEndOf="@id/button_8"
+ android:layout_marginStart="@dimen/button_margin"
+ />
+
+ </RelativeLayout>
+
+ <com.nightonke.blurlockview.BigButtonView
+ android:id="@+id/button_0"
+ android:layout_width="80dp"
+ android:layout_height="80dp"
+ android:layout_centerHorizontal="true"
+ android:layout_below="@+id/layout_789"
+ />
+
+ </RelativeLayout>
+
+ <TextView
+ android:id="@+id/left_button"
+ android:layout_width="100dp"
+ android:layout_height="50dp"
+ android:text="紧急情况"
+ android:gravity="center"
+ android:layout_gravity="bottom|start"
+ />
+
+ <TextView
+ android:id="@+id/right_button"
+ android:layout_width="100dp"
+ android:layout_height="50dp"
+ android:text="删除"
+ android:gravity="center"
+ android:layout_gravity="bottom|end"
+ />
+
+</FrameLayout>
BIN blurlockview/src/main/res/mipmap-hdpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN blurlockview/src/main/res/mipmap-mdpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN blurlockview/src/main/res/mipmap-xhdpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN blurlockview/src/main/res/mipmap-xxhdpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN blurlockview/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 blurlockview/src/main/res/values/attrs.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+ <declare-styleable name="BlurView">
+ <attr name="blurRadius" format="integer"/>
+ <attr name="downsampleFactor" format="integer"/>
+ <attr name="overlayColor" format="color"/>
+ </declare-styleable>
+
+ <declare-styleable name="BigButtonView">
+ <attr name="text" format="string"/>
+ <attr name="subText" format="string"/>
+ </declare-styleable>
+
+</resources>
6 blurlockview/src/main/res/values/colors.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+ <color name="default_button_press">#66ffffff</color>
+
+</resources>
43 blurlockview/src/main/res/values/defaults.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+ <dimen name="default_big_button_width">80dp</dimen>
+ <dimen name="default_big_button_height">80dp</dimen>
+ <color name="default_big_button_text_color">#ffffff</color>
+ <integer name="default_big_button_text_size">35</integer>
+ <color name="default_big_button_sub_text_color">#ffffff</color>
+ <integer name="default_big_button_sub_text_size">12</integer>
+
+ <string-array
+ name="default_big_button_text">
+ <item>0</item>
+ <item>1</item>
+ <item>2</item>
+ <item>3</item>
+ <item>4</item>
+ <item>5</item>
+ <item>6</item>
+ <item>7</item>
+ <item>8</item>
+ <item>9</item>
+ </string-array>
+
+ <string-array
+ name="default_big_button_sub_text">
+ <item>0</item>
+ <item>1</item>
+ <item>ABC</item>
+ <item>DEF</item>
+ <item>GHI</item>
+ <item>JKL</item>
+ <item>MNO</item>
+ <item>PQRS</item>
+ <item>TUV</item>
+ <item>WXYZ</item>
+ </string-array>
+
+ <integer name="default_blur_radius">11</integer>
+ <integer name="default_downsample_factor">6</integer>
+ <color name="default_overlay_color">#99FFFFFF</color>
+
+</resources>
6 blurlockview/src/main/res/values/dimens.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+ <dimen name="button_margin">15dp</dimen>
+
+</resources>
3 blurlockview/src/main/res/values/strings.xml
@@ -0,0 +1,3 @@
+<resources>
+ <string name="app_name">BlurLockView</string>
+</resources>
8 blurlockview/src/main/res/values/styles.xml
@@ -0,0 +1,8 @@
+<resources>
+
+ <!-- Base application theme. -->
+ <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
+ <!-- Customize your theme here. -->
+ </style>
+
+</resources>
15 blurlockview/src/test/java/com/nightonke/blurlockview/ExampleUnitTest.java
@@ -0,0 +1,15 @@
+package com.nightonke.blurlockview;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * To work on unit tests, switch the Test Artifact in the Build Variants view.
+ */
+public class ExampleUnitTest {
+ @Test
+ public void addition_isCorrect() throws Exception {
+ assertEquals(4, 2 + 2);
+ }
+}
24 build.gradle
@@ -0,0 +1,24 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+
+buildscript {
+ repositories {
+ jcenter()
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:2.0.0-beta6'
+
+ // NOTE: Do not place your application dependencies here; they belong
+ // in the individual module build.gradle files
+ }
+}
+
+allprojects {
+ repositories {
+ jcenter()
+ maven { url "https://jitpack.io" }
+ }
+}
+
+task clean(type: Delete) {
+ delete rootProject.buildDir
+}
18 gradle.properties
@@ -0,0 +1,18 @@
+# Project-wide Gradle settings.
+
+# IDE (e.g. Android Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+# Default value: -Xmx10248m -XX:MaxPermSize=256m
+# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
+
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. More details, visit
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
+# org.gradle.parallel=true
BIN gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
6 gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Mon Dec 28 10:00:20 PST 2015
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
160 gradlew
@@ -0,0 +1,160 @@
+#!/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
+
+# 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\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+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"`
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # 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 "$@"
90 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
1 settings.gradle
@@ -0,0 +1 @@
+include ':app', ':blurlockview'

0 comments on commit cc52b3f

Please sign in to comment.
Something went wrong with that request. Please try again.