Fingerprint + message

This commit is contained in:
Mikołaj wojdyło 2020-06-18 20:58:10 +02:00
parent efd7bde5f3
commit d1f0d65176
6 changed files with 60 additions and 7 deletions

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View File

@ -10,6 +10,8 @@ import android.os.Build
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.os.CancellationSignal
import android.widget.Button
import android.widget.EditText
import android.widget.Toast
import androidx.annotation.RequiresApi
import androidx.core.app.ActivityCompat
@ -32,6 +34,17 @@ class MainActivity : AppCompatActivity() {
super.onAuthenticationSucceeded(result)
notifyUser("Autoryzacja Poprawna")
startActivity(Intent(this@MainActivity, SecretActivity::class.java))
val nameEt = findViewById<EditText>(R.id.nameEt)
var name = nameEt.text.toString()
val intent = Intent(this@MainActivity, SecretActivity::class.java)
intent.putExtra("Name", name)
startActivity(intent)
}
}
@ -41,14 +54,16 @@ class MainActivity : AppCompatActivity() {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
checkBiometricSupport()
btn_authenticate.setOnClickListener {
val biometricPrompt = BiometricPrompt.Builder(this)
.setTitle("Tytuł pytania")
.setTitle("Odcisk Palca")
.setSubtitle("Autoryzacja wymagana")
.setDescription("Ta aplikacja używa Odcisku Palca do ochrony wiadomości")
.setNegativeButton("Cancel",this.mainExecutor, DialogInterface.OnClickListener { dialog, which ->
.setNegativeButton("Anuluj",this.mainExecutor, DialogInterface.OnClickListener { dialog, which ->
notifyUser("Autoryzacja Anulowana")
} ).build()

View File

@ -1,11 +1,20 @@
package com.example.myapp1
import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.TextView
class SecretActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_secret)
var intent = intent
val name = intent.getStringExtra("Name")
val resultTv = findViewById<TextView>(R.id.resultTv)
resultTv.text = "Name " + name
}
}

View File

@ -3,9 +3,22 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_gravity="center"
android:layout_height="match_parent"
tools:context=".MainActivity">
<EditText
android:id="@+id/nameEt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:hint="Wpisz wiadomosc"
app:layout_constraintBottom_toTopOf="@+id/btn_authenticate"
app:layout_constraintTop_toTopOf="parent"
tools:layout_editor_absoluteX="0dp" />
<Button
android:id="@+id/btn_authenticate"
android:layout_width="wrap_content"

View File

@ -4,14 +4,23 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="10pt"
tools:context=".SecretActivity">
<TextView
android:layout_width="wrap_content"
android:id="@+id/resultTv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="SEKRETNA WIADOMOSC, DUDA TO GEJ"
android:textColor="@android:color/black"
android:textSize="30sp" />
android:padding="10dp"
android:textColor="#000"
android:textSize="30sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.652"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.357" />
</androidx.constraintlayout.widget.ConstraintLayout>