diff --git a/android/build.gradle b/android/build.gradle index 5ce23c33..3cde3f0b 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,38 +1,32 @@ -// Inspired by rayronvictor's PR #248 tp react-native-config -// https://github.com/luggit/react-native-config/pull/248 - -def _ext = rootProject.ext +def safeExtGet(prop, fallback) { + rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback +} buildscript { - repositories { - maven { - url 'https://maven.google.com/' - name 'Google' + // The Android Gradle plugin is only required when opening the android folder stand-alone. + // This avoids unnecessary downloads and potential conflicts when the library is included as a + // module dependency in an application project. + if (project == rootProject) { + repositories { + google() + jcenter() } - jcenter() - google() - } - dependencies { - classpath _ext.has('gradleBuildTools') ? _ext.gradleBuildTools : 'com.android.tools.build:gradle:3.4.0' + dependencies { + classpath("com.android.tools.build:gradle:3.4.1") + } } } apply plugin: 'com.android.library' -def _reactNativeVersion = _ext.has('reactNative') ? _ext.reactNative : '+' -def _compileSdkVersion = _ext.has('compileSdkVersion') ? _ext.compileSdkVersion : 27 -def _buildToolsVersion = _ext.has('buildToolsVersion') ? _ext.buildToolsVersion : '27.0.3' -def _minSdkVersion = _ext.has('minSdkVersion') ? _ext.minSdkVersion : 16 -def _targetSdkVersion = _ext.has('targetSdkVersion') ? _ext.targetSdkVersion : 27 - android { - compileSdkVersion _compileSdkVersion - buildToolsVersion _buildToolsVersion + compileSdkVersion safeExtGet('compileSdkVersion', 28) + buildToolsVersion safeExtGet('buildToolsVersion', '28.0.3') defaultConfig { - minSdkVersion _minSdkVersion - targetSdkVersion _targetSdkVersion + minSdkVersion safeExtGet('minSdkVersion', 16) + targetSdkVersion safeExtGet('targetSdkVersion', 28) versionCode 1 versionName "1.0" } @@ -43,8 +37,9 @@ android { repositories { mavenCentral() + jcenter() } dependencies { - implementation "com.facebook.react:react-native:${_reactNativeVersion}" + implementation "com.facebook.react:react-native:0.60.6" } diff --git a/android/src/main/java/com/rnfingerprint/FingerprintDialog.java b/android/src/main/java/com/rnfingerprint/FingerprintDialog.java index c4876afd..63a53f02 100644 --- a/android/src/main/java/com/rnfingerprint/FingerprintDialog.java +++ b/android/src/main/java/com/rnfingerprint/FingerprintDialog.java @@ -33,6 +33,7 @@ public class FingerprintDialog extends DialogFragment implements FingerprintHand private String cancelText = ""; private String sensorDescription = ""; private String sensorErrorDescription = ""; + private String sensorTitle = ""; private String errorText = ""; @Override @@ -45,7 +46,7 @@ public void onAttach(Context context) { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setStyle(DialogFragment.STYLE_NORMAL, android.R.style.Theme_Material_Light_Dialog); + setStyle(DialogFragment.STYLE_NO_TITLE, 0); setCancelable(false); } @@ -56,6 +57,9 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa final TextView mFingerprintDescription = (TextView) v.findViewById(R.id.fingerprint_description); mFingerprintDescription.setText(this.authReason); + final TextView mFingerprintTitle = (TextView) v.findViewById(R.id.fingerprint_title); + mFingerprintTitle.setText(this.sensorTitle); + this.mFingerprintImage = (ImageView) v.findViewById(R.id.fingerprint_icon); if (this.imageColor != 0) { this.mFingerprintImage.setColorFilter(this.imageColor); @@ -67,16 +71,15 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa this.mFingerprintError = (TextView) v.findViewById(R.id.fingerprint_error); this.mFingerprintError.setText(this.errorText); - final Button mCancelButton = (Button) v.findViewById(R.id.cancel_button); - mCancelButton.setText(this.cancelText); - mCancelButton.setOnClickListener(new View.OnClickListener() { + final TextView mSkip = (TextView) v.findViewById(R.id.skip); + mSkip.setText(this.cancelText); + mSkip.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { onCancelled(); } }); - getDialog().setTitle(this.dialogTitle); getDialog().setOnKeyListener(new DialogInterface.OnKeyListener() { public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) { if (keyCode != KeyEvent.KEYCODE_BACK || mFingerprintHandler == null) { @@ -153,6 +156,10 @@ public void setAuthConfig(final ReadableMap config) { if (config.hasKey("imageErrorColor")) { this.imageErrorColor = config.getInt("imageErrorColor"); } + + if (config.hasKey("sensorTitle")) { + this.sensorTitle = config.getString("sensorTitle"); + } } public interface DialogResultListener { @@ -172,7 +179,7 @@ public void onAuthenticated() { @Override public void onError(String errorString, int errorCode) { - this.mFingerprintError.setText(errorString); + this.mFingerprintError.setText("Try again"); this.mFingerprintImage.setColorFilter(this.imageErrorColor); this.mFingerprintSensorDescription.setText(this.sensorErrorDescription); } diff --git a/android/src/main/res/font/montserratbold.ttf b/android/src/main/res/font/montserratbold.ttf new file mode 100644 index 00000000..221819bc Binary files /dev/null and b/android/src/main/res/font/montserratbold.ttf differ diff --git a/android/src/main/res/font/montserratlight.ttf b/android/src/main/res/font/montserratlight.ttf new file mode 100644 index 00000000..990857de Binary files /dev/null and b/android/src/main/res/font/montserratlight.ttf differ diff --git a/android/src/main/res/font/montserratmedium.ttf b/android/src/main/res/font/montserratmedium.ttf new file mode 100644 index 00000000..6e079f69 Binary files /dev/null and b/android/src/main/res/font/montserratmedium.ttf differ diff --git a/android/src/main/res/font/montserratmediumitalic.ttf b/android/src/main/res/font/montserratmediumitalic.ttf new file mode 100644 index 00000000..0dc3ac9c Binary files /dev/null and b/android/src/main/res/font/montserratmediumitalic.ttf differ diff --git a/android/src/main/res/font/montserratregular.ttf b/android/src/main/res/font/montserratregular.ttf new file mode 100644 index 00000000..8d443d5d Binary files /dev/null and b/android/src/main/res/font/montserratregular.ttf differ diff --git a/android/src/main/res/font/montserratsemibold.ttf b/android/src/main/res/font/montserratsemibold.ttf new file mode 100644 index 00000000..f8a43f2b Binary files /dev/null and b/android/src/main/res/font/montserratsemibold.ttf differ diff --git a/android/src/main/res/layout/fingerprint_dialog.xml b/android/src/main/res/layout/fingerprint_dialog.xml index fe631909..e5ebf832 100644 --- a/android/src/main/res/layout/fingerprint_dialog.xml +++ b/android/src/main/res/layout/fingerprint_dialog.xml @@ -1,79 +1,86 @@ - - + android:background="#0c2646"> - - - - - + android:orientation="vertical" + android:layout_centerVertical="true" + android:paddingTop="15dp" + android:paddingBottom="15dp"> + + - + android:textSize="15dp" + android:visibility="gone" /> + + - - - -