Skip to content

Commit

Permalink
Support >= Android N
Browse files Browse the repository at this point in the history
Support Galaxy S8+
支持Android Studio 3.0
移除多余代码
  • Loading branch information
eritpchy committed Sep 7, 2017
1 parent d5e785b commit 5cd747a
Show file tree
Hide file tree
Showing 10 changed files with 216 additions and 222 deletions.
23 changes: 8 additions & 15 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.yyxx.wechatfp"
minSdkVersion 14
targetSdkVersion 25
targetSdkVersion 26
versionCode 6
versionName "1.3"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
versionName "1.3.0"
}
buildTypes {
release {
Expand All @@ -26,15 +25,9 @@ android {
}
}


dependencies {
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:support-v4:25.1.0'
compile 'com.wei.android.lib:fingerprintidentify:1.2.1'
implementation 'com.android.support:support-v4:26.0.2'
implementation 'com.wei.android.lib:fingerprintidentify:1.2.1'
implementation 'com.crossbowffs.remotepreferences:remotepreferences:0.5'
provided 'de.robv.android.xposed:api:53'
provided 'de.robv.android.xposed:api:53:sources'

testCompile 'junit:junit:4.12'
}
}

This file was deleted.

5 changes: 5 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@
</intent-filter>
</activity>

<provider
android:name=".XPreferenceProvider"
android:authorities="com.yyxx.wechatfp.XPreferenceProvider"
android:exported="true"/>

</application>

</manifest>
58 changes: 24 additions & 34 deletions app/src/main/java/com/yyxx/wechatfp/SettingsActivity.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
package com.yyxx.wechatfp;


import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.CheckBoxPreference;
import android.preference.EditTextPreference;
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.preference.PreferenceManager;
import android.provider.Settings;
import android.util.Log;
import android.widget.Toast;
Expand All @@ -34,32 +31,32 @@ public class SettingsActivity extends PreferenceActivity implements Preference.O
* A preference value change listener that updates the preference's summary
* to reflect its new value.
*/
private SharedPreferences prefs,defaultprefs;
private SharedPreferences prefs;
private EditTextPreference mPaypwd;
private CheckBoxPreference mEnable;
private FingerprintIdentify mFingerprintIdentify;
private static final String MOD_PREFS = "fp_settings";

public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
prefs=getSharedPreferences(MOD_PREFS, 1);
defaultprefs= PreferenceManager.getDefaultSharedPreferences(this);
prefs = XPreferenceProvider.getRemoteSharedPreference(this);
addPreferencesFromResource(R.xml.preference);
mEnable=(CheckBoxPreference)findPreference("enable_fp");
mPaypwd=(EditTextPreference)findPreference("paypwd");
mPaypwd.setText(prefs.getString("paypwd",""));
mEnable.setChecked(prefs.getBoolean("enable_fp",false));
mEnable = (CheckBoxPreference) findPreference("enable_fp");
mPaypwd = (EditTextPreference) findPreference("paypwd");
mPaypwd.setText(prefs.getString("paypwd", ""));
mEnable.setChecked(prefs.getBoolean("enable_fp", false));
mPaypwd.setOnPreferenceChangeListener(this);
mEnable.setOnPreferenceChangeListener(this);
mEnable.setOnPreferenceClickListener(this);
mPaypwd.setOnPreferenceClickListener(this);
mFingerprintIdentify = new FingerprintIdentify(this);
if(!mFingerprintIdentify.isHardwareEnable()){
if (!mFingerprintIdentify.isHardwareEnable()) {
Toast.makeText(this, "指纹传感器不可用,请确认本机已配备指纹传感器", Toast.LENGTH_SHORT).show();
mEnable.setChecked(false);
mEnable.setEnabled(false);
mPaypwd.setEnabled(false);
}else{
if(!mFingerprintIdentify.isRegisteredFingerprint()){
} else {
if (!mFingerprintIdentify.isRegisteredFingerprint()) {
Toast.makeText(this, "未录入指纹,请在设置中录入有效指纹", Toast.LENGTH_SHORT).show();
mEnable.setChecked(false);
mEnable.setEnabled(false);
Expand All @@ -71,40 +68,33 @@ public void onCreate(Bundle savedInstanceState) {

@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
if(preference==mPaypwd){
SharedPreferences.Editor mEditor=prefs.edit();
SharedPreferences.Editor dmEditor=defaultprefs.edit();
if (preference == mPaypwd) {
SharedPreferences.Editor mEditor = prefs.edit();

String ANDROID_ID = Settings.System.getString(getContentResolver(), Settings.System.ANDROID_ID);
Log.e("deviceid",ANDROID_ID);
Log.e("deviceid", ANDROID_ID);

String pwd=(String)newValue;
Log.e("deviceid",AESHelper.encrypt(pwd,ANDROID_ID));
if(pwd.length()>10){
mEditor.putString("paypwd",pwd);
dmEditor.putString("paypwd",pwd);
}else{
mEditor.putString("paypwd", AESHelper.encrypt(pwd,ANDROID_ID));
dmEditor.putString("paypwd", AESHelper.encrypt(pwd,ANDROID_ID));
String pwd = (String) newValue;
Log.e("deviceid", AESHelper.encrypt(pwd, ANDROID_ID));
if (pwd.length() > 10) {
mEditor.putString("paypwd", pwd);
} else {
mEditor.putString("paypwd", AESHelper.encrypt(pwd, ANDROID_ID));
}
dmEditor.commit();
return mEditor.commit();
}
if(preference==mEnable){
SharedPreferences.Editor mEditor=prefs.edit();
SharedPreferences.Editor dmEditor=defaultprefs.edit();
mEditor.putBoolean("enable_fp",(boolean)newValue);
mEditor.putBoolean("enable_fp",(boolean)newValue);
dmEditor.commit();
if (preference == mEnable) {
SharedPreferences.Editor mEditor = prefs.edit();
mEditor.putBoolean("enable_fp", (boolean) newValue);
return mEditor.commit();
}
return false;
}

@Override
public boolean onPreferenceClick(Preference preference) {
if(preference==mPaypwd){
mPaypwd.setText(prefs.getString("paypwd",""));
if (preference == mPaypwd) {
mPaypwd.setText(prefs.getString("paypwd", ""));
}
return false;
}
Expand Down
Loading

0 comments on commit 5cd747a

Please sign in to comment.