Skip to content

Commit 1ad36f7

Browse files
Alex ZhangAlex Zhang
authored andcommitted
Initial commit
0 parents  commit 1ad36f7

File tree

36 files changed

+1177
-0
lines changed

36 files changed

+1177
-0
lines changed

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea
5+
.DS_Store
6+
/build
7+
/captures
8+
*.apk

DONATE.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
## Paypal
2+
3+
My PayPal link: [PayPal.Me/ztc1997](https://paypal.me/ztc1997)
4+
5+
## AliPay
6+
7+
![AliPay](./art/alipay.jpg)

README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
[![GitHub version](https://badge.fury.io/gh/ztc1997%2FFingerprint2Sleep.svg)](https://github.com/ztc1997/Fingerprint2Sleep/releases) ![license](http://img.shields.io/badge/license-GPLv3-brightgreen.svg) ![platform](http://img.shields.io/badge/platform-Android-blue.svg)
2+
# Fingerprint to Sleep
3+
4+
Sleep your device via fingerprint sensor. Currently, it only works
5+
well on MIUI, in other systems it will cause the fingerprint to
6+
unlock doesn't work.
7+
8+
## Tips
9+
10+
1. If you Boot Manager app, please allow `Fingerprint to Sleep` autostart.
11+
On MIUI, go to `Security``Permissions``Autostart`, and choose `Fingerprint to Sleep`.
12+
2. If you use Task Management app, please add `Fingerprint to Sleep` to whitelist.
13+
On MIUI, go to `Settings``Battery & performance``Manager apps battery usage`
14+
`Choose apps``Fingerprint to Sleep`, and choose `No restriction`.
15+
16+
## Donate
17+
18+
If you like Actinium and want to support the developer of this repo, consider buying me a cup of coffee.
19+
[Donate](./DONATE.md)
20+
21+
## License
22+
```
23+
Copyright 2016 Alex Zhang aka. ztc1997
24+
25+
This program is free software: you can redistribute it and/or modify
26+
it under the terms of the GNU General Public License as published by
27+
the Free Software Foundation, either version 3 of the License, or
28+
(at your option) any later version.
29+
30+
This program is distributed in the hope that it will be useful,
31+
but WITHOUT ANY WARRANTY; without even the implied warranty of
32+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33+
GNU General Public License for more details.
34+
35+
You should have received a copy of the GNU General Public License
36+
along with this program. If not, see <http://www.gnu.org/licenses/>.
37+
```

app/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/build
2+
google-services.json

app/build.gradle

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
apply plugin: 'com.android.application'
2+
3+
android {
4+
compileSdkVersion 24
5+
buildToolsVersion "24.0.1"
6+
7+
defaultConfig {
8+
applicationId "com.ztc1997.fingerprint2sleep"
9+
minSdkVersion 23
10+
targetSdkVersion 24
11+
versionCode 1
12+
versionName "0.1.0"
13+
}
14+
buildTypes {
15+
release {
16+
shrinkResources true
17+
minifyEnabled true
18+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
19+
}
20+
}
21+
22+
sourceSets {
23+
main.java.srcDirs += 'src/main/kotlin'
24+
}
25+
}
26+
27+
dependencies {
28+
compile fileTree(dir: 'libs', include: ['*.jar'])
29+
testCompile 'junit:junit:4.12'
30+
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
31+
32+
// Android support library
33+
compile "com.android.support:appcompat-v7:$supportLibVersion"
34+
35+
// DSL
36+
compile "org.jetbrains.anko:anko-sdk23:$ankoVersion"
37+
compile "org.jetbrains.anko:anko-appcompat-v7:$ankoVersion"
38+
39+
// Firebase
40+
compile 'com.google.firebase:firebase-core:9.4.0'
41+
compile 'com.google.firebase:firebase-crash:9.4.0'
42+
compile 'com.google.firebase:firebase-ads:9.4.0'
43+
}
44+
45+
buildscript {
46+
repositories {
47+
jcenter()
48+
}
49+
dependencies {
50+
classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlinVersion"
51+
}
52+
}
53+
54+
apply plugin: 'kotlin-android'
55+
apply plugin: 'kotlin-android-extensions'
56+
apply plugin: 'com.google.gms.google-services'

app/proguard-rules.pro

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Add project specific ProGuard rules here.
2+
# By default, the flags in this file are appended to flags specified
3+
# in G:\android-sdk/tools/proguard/proguard-android.txt
4+
# You can edit the include path and order by changing the proguardFiles
5+
# directive in build.gradle.
6+
#
7+
# For more details, see
8+
# http://developer.android.com/guide/developing/tools/proguard.html
9+
10+
# Add any project specific keep options here:
11+
12+
# If your project uses WebView with JS, uncomment the following
13+
# and specify the fully qualified class name to the JavaScript interface
14+
# class:
15+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16+
# public *;
17+
#}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.ztc1997.fingerprint2sleep;
2+
3+
import android.app.Application;
4+
import android.test.ApplicationTestCase;
5+
6+
/**
7+
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
8+
*/
9+
public class ApplicationTest extends ApplicationTestCase<Application> {
10+
public ApplicationTest() {
11+
super(Application.class);
12+
}
13+
}

app/src/main/AndroidManifest.xml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2+
package="com.ztc1997.fingerprint2sleep">
3+
4+
<uses-feature android:name="android.hardware.fingerprint" />
5+
6+
<uses-permission android:name="android.permission.USE_FINGERPRINT" />
7+
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
8+
9+
<application
10+
android:allowBackup="true"
11+
android:icon="@mipmap/ic_launcher"
12+
android:label="@string/app_name"
13+
android:supportsRtl="true"
14+
android:theme="@style/AppTheme">
15+
16+
<activity android:name=".SettingsActivity">
17+
<intent-filter>
18+
<action android:name="android.intent.action.MAIN" />
19+
<category android:name="android.intent.category.LAUNCHER" />
20+
</intent-filter>
21+
</activity>
22+
23+
<activity
24+
android:name=".SplashActivity"
25+
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
26+
27+
<service
28+
android:name=".FP2SService"
29+
android:enabled="true"
30+
android:exported="false" />
31+
32+
<receiver
33+
android:name=".AdminReceiver"
34+
android:permission="android.permission.BIND_DEVICE_ADMIN">
35+
<meta-data
36+
android:name="android.app.device_admin"
37+
android:resource="@xml/device_admin" />
38+
<intent-filter>
39+
<action android:name="android.app.action.DEVICE_ADMIN_ENABLED" />
40+
</intent-filter>
41+
</receiver>
42+
43+
<receiver android:name=".BootReceiver">
44+
<intent-filter>
45+
<action android:name="android.intent.action.BOOT_COMPLETED" />
46+
<category android:name="android.intent.category.LAUNCHER" />
47+
</intent-filter>
48+
</receiver>
49+
</application>
50+
51+
</manifest>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.ztc1997.fingerprint2sleep
2+
3+
import android.content.BroadcastReceiver
4+
import android.content.Context
5+
import android.content.Intent
6+
7+
class AdminReceiver : BroadcastReceiver() {
8+
override fun onReceive(context: Context?, intent: Intent?) {
9+
10+
}
11+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.ztc1997.fingerprint2sleep
2+
3+
import android.content.BroadcastReceiver
4+
import android.content.Context
5+
import android.content.Intent
6+
import org.jetbrains.anko.defaultSharedPreferences
7+
import org.jetbrains.anko.startService
8+
9+
class BootReceiver : BroadcastReceiver() {
10+
override fun onReceive(context: Context, intent: Intent?) {
11+
if (!FP2SService.isRunning &&
12+
context.defaultSharedPreferences.getBoolean(SettingsActivity.PREF_ENABLE_FINGERPRINT2SLEEP, false))
13+
context.startService<FP2SService>()
14+
}
15+
}

0 commit comments

Comments
 (0)