From d351f89cce722485033711f90edaf5a0f28e81ae Mon Sep 17 00:00:00 2001 From: Torsten Grote Date: Tue, 8 Sep 2020 16:49:28 -0300 Subject: Fix minor lint warnings --- anastasis-ui/build.gradle | 8 ++++---- .../src/main/java/org/gnu/anastasis/ui/IntroFragment.kt | 2 -- .../src/main/java/org/gnu/anastasis/ui/MainViewModel.kt | 2 +- .../gnu/anastasis/ui/authentication/AuthenticationFragment.kt | 6 +++--- .../java/org/gnu/anastasis/ui/authentication/SmsFragment.kt | 4 ++-- .../java/org/gnu/anastasis/ui/identity/IdentityFragment.kt | 2 +- anastasis-ui/src/main/res/drawable/ic_add_circle.xml | 10 ++++++++++ anastasis-ui/src/main/res/layout/fragment_identity.xml | 6 +++--- 8 files changed, 24 insertions(+), 16 deletions(-) create mode 100644 anastasis-ui/src/main/res/drawable/ic_add_circle.xml (limited to 'anastasis-ui') diff --git a/anastasis-ui/build.gradle b/anastasis-ui/build.gradle index 0f86815..cbb0077 100644 --- a/anastasis-ui/build.gradle +++ b/anastasis-ui/build.gradle @@ -57,8 +57,8 @@ android { dependencies { implementation project(":taler-kotlin-android") - implementation 'com.google.android.material:material:1.2.0-beta01' - implementation 'androidx.constraintlayout:constraintlayout:1.1.3' + implementation "com.google.android.material:material:$material_version" + implementation "androidx.constraintlayout:constraintlayout:$constraintlayout_version" // Navigation Library implementation "androidx.navigation:navigation-fragment-ktx:$nav_version" @@ -69,6 +69,6 @@ dependencies { testImplementation 'junit:junit:4.13' - androidTestImplementation 'androidx.test.ext:junit:1.1.1' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' + androidTestImplementation 'androidx.test.ext:junit:1.1.2' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' } 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 c4b8e73..1e5a8d1 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 @@ -27,8 +27,6 @@ import kotlinx.android.synthetic.main.fragment_intro.* class IntroFragment : Fragment() { - private val model: MainViewModel by activityViewModels() - override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? diff --git a/anastasis-ui/src/main/java/org/gnu/anastasis/ui/MainViewModel.kt b/anastasis-ui/src/main/java/org/gnu/anastasis/ui/MainViewModel.kt index 3b97578..e2bf0c8 100644 --- a/anastasis-ui/src/main/java/org/gnu/anastasis/ui/MainViewModel.kt +++ b/anastasis-ui/src/main/java/org/gnu/anastasis/ui/MainViewModel.kt @@ -21,7 +21,7 @@ import androidx.lifecycle.AndroidViewModel import androidx.lifecycle.MutableLiveData import org.gnu.anastasis.ui.identity.LOCATIONS -class MainViewModel(private val app: Application) : AndroidViewModel(app) { +class MainViewModel(app: Application) : AndroidViewModel(app) { val currentCountry = MutableLiveData(LOCATIONS[0]) 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 fd770cb..5f7ab2e 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 @@ -79,17 +79,17 @@ class AuthenticationFragment : Fragment() { ) } - viewModel.securityQuestionChecked.observe(viewLifecycleOwner, Observer { checked -> + viewModel.securityQuestionChecked.observe(viewLifecycleOwner, { checked -> passwordCard.isChecked = checked updatePrice(checked, Amount.fromJSONString("KUDOS:0.5")) updateNextButtonState() }) - viewModel.smsChecked.observe(viewLifecycleOwner, Observer { checked -> + viewModel.smsChecked.observe(viewLifecycleOwner, { checked -> smsCard.isChecked = checked updatePrice(checked, Amount.fromJSONString("KUDOS:1.0")) updateNextButtonState() }) - viewModel.videoChecked.observe(viewLifecycleOwner, Observer { checked -> + viewModel.videoChecked.observe(viewLifecycleOwner, { checked -> videoCard.isChecked = checked updatePrice(checked, Amount.fromJSONString("KUDOS:2.25")) updateNextButtonState() 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 f20fba5..2daf14a 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 @@ -97,8 +97,8 @@ class SmsFragment : Fragment() { private fun fillPhoneNumber() { val telephonyService = requireContext().getSystemService(TelephonyManager::class.java) telephonyService?.line1Number?.let { phoneNumber -> - smsView?.editText?.setText(phoneNumber) - smsView?.editText?.setSelection(phoneNumber.length) + 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 40fa477..bcfbf24 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 @@ -52,7 +52,7 @@ class AnastasisIdentityFragment : Fragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) - model.currentCountry.observe(viewLifecycleOwner, Observer { country -> + model.currentCountry.observe(viewLifecycleOwner, { country -> countryView.text = country.name if (stub != null) { stub.layoutResource = country.layoutRes diff --git a/anastasis-ui/src/main/res/drawable/ic_add_circle.xml b/anastasis-ui/src/main/res/drawable/ic_add_circle.xml new file mode 100644 index 0000000..76e1fcb --- /dev/null +++ b/anastasis-ui/src/main/res/drawable/ic_add_circle.xml @@ -0,0 +1,10 @@ + + + diff --git a/anastasis-ui/src/main/res/layout/fragment_identity.xml b/anastasis-ui/src/main/res/layout/fragment_identity.xml index 072414d..bcf6e4d 100644 --- a/anastasis-ui/src/main/res/layout/fragment_identity.xml +++ b/anastasis-ui/src/main/res/layout/fragment_identity.xml @@ -68,7 +68,7 @@ android:layout_height="wrap_content" android:layout_marginStart="8dp" android:text="Change" - android:textColor="@color/colorAccent" + android:textColor="?attr/colorAccent" app:layout_constraintBaseline_toBaselineOf="@+id/countryView" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintHorizontal_bias="0.0" @@ -144,9 +144,9 @@ android:layout_height="wrap_content" android:layout_margin="16dp" android:backgroundTint="@color/green" - android:drawableLeft="@drawable/ic_baseline_lock" - android:drawableTint="?attr/colorOnPrimarySurface" + android:drawableStart="@drawable/ic_baseline_lock" android:text="Encrypt Identity" + app:drawableTint="?attr/colorOnPrimarySurface" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" /> -- cgit v1.2.3