aboutsummaryrefslogtreecommitdiff
path: root/anastasis-ui
diff options
context:
space:
mode:
Diffstat (limited to 'anastasis-ui')
-rw-r--r--anastasis-ui/build.gradle2
-rw-r--r--anastasis-ui/src/main/java/org/gnu/anastasis/ui/IntroFragment.kt1
-rw-r--r--anastasis-ui/src/main/java/org/gnu/anastasis/ui/authentication/AuthenticationFragment.kt1
-rw-r--r--anastasis-ui/src/main/java/org/gnu/anastasis/ui/authentication/SmsFragment.kt3
-rw-r--r--anastasis-ui/src/main/java/org/gnu/anastasis/ui/identity/IdentityFragment.kt30
-rw-r--r--anastasis-ui/src/main/res/layout/fragment_identity.xml4
-rw-r--r--anastasis-ui/src/main/res/layout/fragment_intro.xml4
-rw-r--r--anastasis-ui/src/main/res/layout/fragment_security_question.xml8
-rw-r--r--anastasis-ui/src/main/res/layout/fragment_sms.xml2
-rw-r--r--anastasis-ui/src/main/res/layout/fragment_video.xml6
10 files changed, 37 insertions, 24 deletions
diff --git a/anastasis-ui/build.gradle b/anastasis-ui/build.gradle
index cbb0077..17e9530 100644
--- a/anastasis-ui/build.gradle
+++ b/anastasis-ui/build.gradle
@@ -24,7 +24,7 @@ android {
buildToolsVersion "$build_tools_version"
defaultConfig {
- minSdkVersion 24
+ minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "0.1"
diff --git a/anastasis-ui/src/main/java/org/gnu/anastasis/ui/IntroFragment.kt b/anastasis-ui/src/main/java/org/gnu/anastasis/ui/IntroFragment.kt
index 1e5a8d1..d8f0185 100644
--- a/anastasis-ui/src/main/java/org/gnu/anastasis/ui/IntroFragment.kt
+++ b/anastasis-ui/src/main/java/org/gnu/anastasis/ui/IntroFragment.kt
@@ -21,7 +21,6 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
-import androidx.fragment.app.activityViewModels
import androidx.navigation.fragment.findNavController
import kotlinx.android.synthetic.main.fragment_intro.*
diff --git a/anastasis-ui/src/main/java/org/gnu/anastasis/ui/authentication/AuthenticationFragment.kt b/anastasis-ui/src/main/java/org/gnu/anastasis/ui/authentication/AuthenticationFragment.kt
index 5f7ab2e..59d0410 100644
--- a/anastasis-ui/src/main/java/org/gnu/anastasis/ui/authentication/AuthenticationFragment.kt
+++ b/anastasis-ui/src/main/java/org/gnu/anastasis/ui/authentication/AuthenticationFragment.kt
@@ -26,7 +26,6 @@ import android.widget.Toast.LENGTH_SHORT
import androidx.annotation.IdRes
import androidx.fragment.app.Fragment
import androidx.fragment.app.activityViewModels
-import androidx.lifecycle.Observer
import androidx.navigation.fragment.FragmentNavigatorExtras
import androidx.navigation.fragment.findNavController
import com.google.android.material.card.MaterialCardView
diff --git a/anastasis-ui/src/main/java/org/gnu/anastasis/ui/authentication/SmsFragment.kt b/anastasis-ui/src/main/java/org/gnu/anastasis/ui/authentication/SmsFragment.kt
index 2daf14a..a5d872d 100644
--- a/anastasis-ui/src/main/java/org/gnu/anastasis/ui/authentication/SmsFragment.kt
+++ b/anastasis-ui/src/main/java/org/gnu/anastasis/ui/authentication/SmsFragment.kt
@@ -26,6 +26,7 @@ import android.view.View
import android.view.ViewGroup
import androidx.annotation.RequiresPermission
import androidx.core.content.ContextCompat
+import androidx.core.content.getSystemService
import androidx.fragment.app.Fragment
import androidx.fragment.app.activityViewModels
import androidx.navigation.fragment.findNavController
@@ -95,7 +96,7 @@ class SmsFragment : Fragment() {
@SuppressLint("HardwareIds")
@RequiresPermission(PERMISSION)
private fun fillPhoneNumber() {
- val telephonyService = requireContext().getSystemService(TelephonyManager::class.java)
+ val telephonyService = requireContext().getSystemService<TelephonyManager>()
telephonyService?.line1Number?.let { phoneNumber ->
smsView.editText?.setText(phoneNumber)
smsView.editText?.setSelection(phoneNumber.length)
diff --git a/anastasis-ui/src/main/java/org/gnu/anastasis/ui/identity/IdentityFragment.kt b/anastasis-ui/src/main/java/org/gnu/anastasis/ui/identity/IdentityFragment.kt
index bcfbf24..ad97ab6 100644
--- a/anastasis-ui/src/main/java/org/gnu/anastasis/ui/identity/IdentityFragment.kt
+++ b/anastasis-ui/src/main/java/org/gnu/anastasis/ui/identity/IdentityFragment.kt
@@ -18,15 +18,18 @@ package org.gnu.anastasis.ui.identity
import android.annotation.SuppressLint
import android.app.DatePickerDialog
+import android.os.Build.VERSION.SDK_INT
import android.os.Bundle
import android.telephony.TelephonyManager
import android.text.format.DateFormat.getDateFormat
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
+import android.widget.Toast
+import android.widget.Toast.LENGTH_LONG
+import androidx.core.content.getSystemService
import androidx.fragment.app.Fragment
import androidx.fragment.app.activityViewModels
-import androidx.lifecycle.Observer
import androidx.navigation.fragment.findNavController
import kotlinx.android.synthetic.main.fragment_identity.*
import org.gnu.anastasis.ui.MainViewModel
@@ -63,17 +66,22 @@ class AnastasisIdentityFragment : Fragment() {
findNavController().navigate(R.id.action_nav_anastasis_identity_to_nav_change_location)
}
birthDateInput.editText?.setOnClickListener {
- val picker = DatePickerDialog(requireContext())
- picker.datePicker.maxDate = System.currentTimeMillis() - DAYS.toMillis(365) * MIN_AGE
- picker.setOnDateSetListener { _, year, month, dayOfMonth ->
- val calender = Calendar.getInstance().apply {
- set(year, month, dayOfMonth)
+ if (SDK_INT >= 24) {
+ val picker = DatePickerDialog(requireContext())
+ picker.datePicker.maxDate =
+ System.currentTimeMillis() - DAYS.toMillis(365) * MIN_AGE
+ picker.setOnDateSetListener { _, year, month, dayOfMonth ->
+ val calender = Calendar.getInstance().apply {
+ set(year, month, dayOfMonth)
+ }
+ val date = Date(calender.timeInMillis)
+ val dateStr = getDateFormat(requireContext()).format(date)
+ birthDateInput.editText?.setText(dateStr)
}
- val date = Date(calender.timeInMillis)
- val dateStr = getDateFormat(requireContext()).format(date)
- birthDateInput.editText?.setText(dateStr)
+ picker.show()
+ } else {
+ Toast.makeText(requireContext(), "Needs newer phone", LENGTH_LONG).show()
}
- picker.show()
}
createIdentifierButton.setOnClickListener {
findNavController().navigate(R.id.action_nav_anastasis_intro_to_nav_anastasis_authentication)
@@ -82,7 +90,7 @@ class AnastasisIdentityFragment : Fragment() {
@Suppress("unused")
private fun getCountryName(): String {
- val tm = requireContext().getSystemService(TelephonyManager::class.java)!!
+ val tm = requireContext().getSystemService<TelephonyManager>()!!
val countryIso = if (tm.networkCountryIso.isNullOrEmpty()) {
if (tm.simCountryIso.isNullOrEmpty()) {
if (Locale.getDefault().country.isNullOrEmpty()) "unknown"
diff --git a/anastasis-ui/src/main/res/layout/fragment_identity.xml b/anastasis-ui/src/main/res/layout/fragment_identity.xml
index bcf6e4d..4a48d32 100644
--- a/anastasis-ui/src/main/res/layout/fragment_identity.xml
+++ b/anastasis-ui/src/main/res/layout/fragment_identity.xml
@@ -16,6 +16,7 @@
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
+ xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
@@ -31,7 +32,8 @@
android:layout_margin="16dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
- app:srcCompat="@drawable/ic_baseline_person" />
+ app:srcCompat="@drawable/ic_baseline_person"
+ tools:ignore="ContentDescription" />
<TextView
android:id="@+id/identityIntro"
diff --git a/anastasis-ui/src/main/res/layout/fragment_intro.xml b/anastasis-ui/src/main/res/layout/fragment_intro.xml
index 32b5b33..04e5d60 100644
--- a/anastasis-ui/src/main/res/layout/fragment_intro.xml
+++ b/anastasis-ui/src/main/res/layout/fragment_intro.xml
@@ -16,6 +16,7 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
+ xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
@@ -33,7 +34,8 @@
app:layout_constraintVertical_bias="1.0"
app:layout_constraintVertical_chainStyle="spread"
app:srcCompat="@drawable/ic_baseline_cloud_circle"
- app:tint="@color/green" />
+ app:tint="@color/green"
+ tools:ignore="ContentDescription" />
<TextView
android:id="@+id/textView"
diff --git a/anastasis-ui/src/main/res/layout/fragment_security_question.xml b/anastasis-ui/src/main/res/layout/fragment_security_question.xml
index 4df4f97..5a7c41f 100644
--- a/anastasis-ui/src/main/res/layout/fragment_security_question.xml
+++ b/anastasis-ui/src/main/res/layout/fragment_security_question.xml
@@ -16,6 +16,7 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
+ xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
@@ -80,11 +81,12 @@
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:background="?attr/selectableItemBackground"
- android:drawableTint="?attr/colorOnPrimarySurface"
android:src="@drawable/ic_add_circle"
android:text="Save"
+ app:drawableTint="?attr/colorOnPrimarySurface"
app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintTop_toBottomOf="@+id/questionCard" />
+ app:layout_constraintTop_toBottomOf="@+id/questionCard"
+ tools:ignore="ContentDescription" />
<Button
android:id="@+id/saveQuestionButton"
@@ -92,8 +94,8 @@
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:backgroundTint="@color/green"
- android:drawableTint="?attr/colorOnPrimarySurface"
android:text="Save"
+ app:drawableTint="?attr/colorOnPrimarySurface"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
diff --git a/anastasis-ui/src/main/res/layout/fragment_sms.xml b/anastasis-ui/src/main/res/layout/fragment_sms.xml
index f855d38..c80f892 100644
--- a/anastasis-ui/src/main/res/layout/fragment_sms.xml
+++ b/anastasis-ui/src/main/res/layout/fragment_sms.xml
@@ -43,8 +43,8 @@
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:backgroundTint="@color/green"
- android:drawableTint="?attr/colorOnPrimarySurface"
android:text="Save"
+ app:drawableTint="?attr/colorOnPrimarySurface"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
diff --git a/anastasis-ui/src/main/res/layout/fragment_video.xml b/anastasis-ui/src/main/res/layout/fragment_video.xml
index c08e269..ecdd102 100644
--- a/anastasis-ui/src/main/res/layout/fragment_video.xml
+++ b/anastasis-ui/src/main/res/layout/fragment_video.xml
@@ -47,12 +47,12 @@
android:layout_margin="16dp"
android:scaleType="fitCenter"
android:visibility="gone"
- tools:visibility="visible"
app:layout_constraintBottom_toTopOf="@+id/saveVideoButton"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/videoIntro"
- tools:srcCompat="@tools:sample/avatars" />
+ tools:srcCompat="@tools:sample/avatars"
+ tools:visibility="visible" />
<Button
android:id="@+id/takePhotoButton"
@@ -80,9 +80,9 @@
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:backgroundTint="@color/green"
- android:drawableTint="?attr/colorOnPrimarySurface"
android:enabled="false"
android:text="Save"
+ app:drawableTint="?attr/colorOnPrimarySurface"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />