From c80e4addfeef8216cee4e53dcef727959eb4e159 Mon Sep 17 00:00:00 2001 From: usg-ishimura Date: Mon, 17 Apr 2023 09:28:16 +0200 Subject: [PATCH] disable focus move --- app/build.gradle | 4 +-- .../ssh/utils/NonFocusingScrollView.kt | 28 +++++++++++++++++++ .../usgishimura/ssh/views/AliasActivity.kt | 7 +++++ app/src/main/res/layout/activity_alias.xml | 9 +++--- 4 files changed, 42 insertions(+), 6 deletions(-) create mode 100644 app/src/main/java/com/usgishimura/ssh/utils/NonFocusingScrollView.kt diff --git a/app/build.gradle b/app/build.gradle index 1970315..333e3cb 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -12,8 +12,8 @@ android { applicationId "com.usgishimura.ssh" minSdkVersion 21 targetSdkVersion 31 - versionCode 12 - versionName "1.2.7" + versionCode 13 + versionName "1.2.8" } buildTypes { diff --git a/app/src/main/java/com/usgishimura/ssh/utils/NonFocusingScrollView.kt b/app/src/main/java/com/usgishimura/ssh/utils/NonFocusingScrollView.kt new file mode 100644 index 0000000..88cbe3a --- /dev/null +++ b/app/src/main/java/com/usgishimura/ssh/utils/NonFocusingScrollView.kt @@ -0,0 +1,28 @@ +package com.usgishimura.ssh.utils +import android.content.Context +import android.graphics.Rect +import android.util.AttributeSet +import android.view.View +import android.widget.ScrollView + + +class NonFocusingScrollView : ScrollView { + constructor(context: Context?) : super(context) {} + constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs) {} + constructor(context: Context?, attrs: AttributeSet?, defStyle: Int) : super( + context, + attrs, + defStyle + ) { + } + + override fun getFocusables(direction: Int): ArrayList? { + return ArrayList() + } + override fun onRequestFocusInDescendants( + direction: Int, + previouslyFocusedRect: Rect? + ): Boolean { + return true + } +} \ No newline at end of file diff --git a/app/src/main/java/com/usgishimura/ssh/views/AliasActivity.kt b/app/src/main/java/com/usgishimura/ssh/views/AliasActivity.kt index f5d3890..5c06b53 100644 --- a/app/src/main/java/com/usgishimura/ssh/views/AliasActivity.kt +++ b/app/src/main/java/com/usgishimura/ssh/views/AliasActivity.kt @@ -64,6 +64,13 @@ class AliasActivity : AppCompatActivity() { aliasScrollView.post { aliasScrollView.fullScroll(View.FOCUS_DOWN) } + /*val lastvoicealias = lunghezzaLista + 1 + val resIDLVA = resources.getIdentifier( + "$lastvoicealias", + "id", packageName + ) + val tietLVA: TextInputEditText = findViewById(resIDLVA) + tietLVA.requestFocus()*/ lunghezzaLista += 2 } } diff --git a/app/src/main/res/layout/activity_alias.xml b/app/src/main/res/layout/activity_alias.xml index 7cd5f6e..ca49d61 100644 --- a/app/src/main/res/layout/activity_alias.xml +++ b/app/src/main/res/layout/activity_alias.xml @@ -3,8 +3,10 @@ android:layout_width="match_parent" android:layout_height="match_parent" xmlns:app="http://schemas.android.com/apk/res-auto" - android:paddingTop="16dp"> - + @@ -117,8 +119,7 @@ android:layout_height="1dp" android:background="?attr/colorControlNormal"/>--> - - +