summaryrefslogtreecommitdiffstats
path: root/mobile/android/android-components/components/ui
diff options
context:
space:
mode:
Diffstat (limited to 'mobile/android/android-components/components/ui')
-rw-r--r--mobile/android/android-components/components/ui/autocomplete/src/main/java/mozilla/components/ui/autocomplete/InlineAutocompleteEditText.kt4
-rw-r--r--mobile/android/android-components/components/ui/autocomplete/src/test/java/mozilla/components/ui/autocomplete/InlineAutocompleteEditTextTest.kt15
-rw-r--r--mobile/android/android-components/components/ui/icons/src/main/res/drawable/mozac_ic_private_mode_circle_fill_20.xml10
-rw-r--r--mobile/android/android-components/components/ui/icons/src/main/res/drawable/mozac_ic_private_mode_circle_fill_24.xml10
-rw-r--r--mobile/android/android-components/components/ui/icons/src/main/res/values/attrs.xml6
-rw-r--r--mobile/android/android-components/components/ui/widgets/src/test/java/mozilla/components/ui/widgets/behavior/EngineViewScrollingBehaviorTest.kt2
6 files changed, 26 insertions, 21 deletions
diff --git a/mobile/android/android-components/components/ui/autocomplete/src/main/java/mozilla/components/ui/autocomplete/InlineAutocompleteEditText.kt b/mobile/android/android-components/components/ui/autocomplete/src/main/java/mozilla/components/ui/autocomplete/InlineAutocompleteEditText.kt
index c029f226eb..1ae1fe739a 100644
--- a/mobile/android/android-components/components/ui/autocomplete/src/main/java/mozilla/components/ui/autocomplete/InlineAutocompleteEditText.kt
+++ b/mobile/android/android-components/components/ui/autocomplete/src/main/java/mozilla/components/ui/autocomplete/InlineAutocompleteEditText.kt
@@ -182,7 +182,7 @@ open class InlineAutocompleteEditText @JvmOverloads constructor(
return false
}
- if (keyCode == KeyEvent.KEYCODE_ENTER) {
+ if (keyCode == KeyEvent.KEYCODE_ENTER || keyCode == KeyEvent.KEYCODE_NUMPAD_ENTER) {
// If the edit text has a composition string, don't submit the text yet.
// ENTER is needed to commit the composition string.
val content = text
@@ -201,7 +201,7 @@ open class InlineAutocompleteEditText @JvmOverloads constructor(
}
private val onKey = fun (_: View, keyCode: Int, event: KeyEvent): Boolean {
- if (keyCode == KeyEvent.KEYCODE_ENTER) {
+ if (keyCode == KeyEvent.KEYCODE_ENTER || keyCode == KeyEvent.KEYCODE_NUMPAD_ENTER) {
if (event.action != KeyEvent.ACTION_DOWN) {
return true
}
diff --git a/mobile/android/android-components/components/ui/autocomplete/src/test/java/mozilla/components/ui/autocomplete/InlineAutocompleteEditTextTest.kt b/mobile/android/android-components/components/ui/autocomplete/src/test/java/mozilla/components/ui/autocomplete/InlineAutocompleteEditTextTest.kt
index d455b0a28e..bf519e81a1 100644
--- a/mobile/android/android-components/components/ui/autocomplete/src/test/java/mozilla/components/ui/autocomplete/InlineAutocompleteEditTextTest.kt
+++ b/mobile/android/android-components/components/ui/autocomplete/src/test/java/mozilla/components/ui/autocomplete/InlineAutocompleteEditTextTest.kt
@@ -101,8 +101,8 @@ class InlineAutocompleteEditTextTest {
doReturn(false).`when`(et).isShown
doReturn(mock(ViewParent::class.java)).`when`(et).parent
- val event = AccessibilityEvent()
- event.eventType = AccessibilityEvent.TYPE_VIEW_TEXT_SELECTION_CHANGED
+ val event = mock<AccessibilityEvent>()
+ doReturn(AccessibilityEvent.TYPE_VIEW_TEXT_SELECTION_CHANGED).`when`(event).eventType
et.sendAccessibilityEventUnchecked(event)
verify(et).onInitializeAccessibilityEvent(event)
@@ -227,6 +227,17 @@ class InlineAutocompleteEditTextTest {
}
@Test
+ fun `onCommitListenerInvocation with Numpad ENTER`() {
+ val et = InlineAutocompleteEditText(testContext, attributes)
+ var invoked = false
+ et.setOnCommitListener { invoked = true }
+ et.onAttachedToWindow()
+
+ et.dispatchKeyEvent(KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_NUMPAD_ENTER))
+ assertTrue(invoked)
+ }
+
+ @Test
fun onTextChangeListenerInvocation() {
val et = InlineAutocompleteEditText(testContext, attributes)
var invokedWithParams: List<Any>? = null
diff --git a/mobile/android/android-components/components/ui/icons/src/main/res/drawable/mozac_ic_private_mode_circle_fill_20.xml b/mobile/android/android-components/components/ui/icons/src/main/res/drawable/mozac_ic_private_mode_circle_fill_20.xml
index b6ce9a33e8..8c6fc9b212 100644
--- a/mobile/android/android-components/components/ui/icons/src/main/res/drawable/mozac_ic_private_mode_circle_fill_20.xml
+++ b/mobile/android/android-components/components/ui/icons/src/main/res/drawable/mozac_ic_private_mode_circle_fill_20.xml
@@ -2,16 +2,14 @@
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
android:width="20dp"
android:height="20dp"
android:viewportWidth="20"
android:viewportHeight="20">
<path
- android:fillColor="?mozac_ic_private_mode_circle_fill_background_color"
- android:pathData="M10,18c-4.411,0 -8,-3.589 -8,-8s3.589,-8 8,-8 8,3.589 8,8 -3.589,8 -8,8z" />
+ android:fillColor="@color/mozac_ui_icons_fill"
+ android:pathData="M7.5,11.148c0.558,0 1.054,-0.25 1.374,-0.637a0.586,0.586 0,0 0,0 -0.726A1.775,1.775 0,0 0,7.5 9.148c-0.558,0 -1.054,0.249 -1.374,0.636a0.587,0.587 0,0 0,0 0.727c0.32,0.388 0.816,0.637 1.374,0.637zM12.5,11.148c0.558,0 1.054,-0.25 1.374,-0.637a0.587,0.587 0,0 0,0 -0.727,1.775 1.775,0 0,0 -1.374,-0.637c-0.558,0 -1.054,0.25 -1.374,0.637a0.587,0.587 0,0 0,0 0.727c0.32,0.388 0.816,0.637 1.374,0.637z" />
<path
- android:fillColor="?mozac_ic_private_mode_circle_fill_icon_color"
- android:pathData="M14.957,8.51a1.02,1.02 0,0 0,-0.793 -1.046,3.714 3.714,0 0,0 -3.351,0.902l-0.154,0.143a0.968,0.968 0,0 1,-1.321 0l-0.15,-0.14a3.712,3.712 0,0 0,-3.354 -0.905c-0.482,0.11 -0.817,0.549 -0.794,1.043v0.003c-0.123,0.488 0.067,2.287 0.175,2.571 0.217,1.144 1.152,2.004 2.272,2.004 0.56,0 1.066,-0.223 1.467,-0.581l0.244,-0.209a1.219,1.219 0,0 1,1.57 -0.012l0.366,0.303v-0.002c0.386,0.31 0.859,0.5 1.377,0.5 1.12,0 2.055,-0.86 2.272,-2.004 0.107,-0.283 0.304,-2.075 0.174,-2.57zM8.874,10.511c-0.32,0.387 -0.816,0.637 -1.374,0.637a1.775,1.775 0,0 1,-1.374 -0.637,0.587 0.587,0 0,1 0,-0.727c0.32,-0.387 0.816,-0.636 1.374,-0.636 0.558,0 1.054,0.249 1.374,0.637a0.586,0.586 0,0 1,0 0.726zM13.874,10.511c-0.32,0.387 -0.816,0.637 -1.374,0.637a1.775,1.775 0,0 1,-1.374 -0.637,0.587 0.587,0 0,1 0,-0.727c0.32,-0.387 0.816,-0.637 1.374,-0.637 0.558,0 1.054,0.249 1.374,0.637a0.587,0.587 0,0 1,0 0.727z"
- tools:ignore="VectorPath" />
+ android:fillColor="@color/mozac_ui_icons_fill"
+ android:pathData="M2,10c0,4.411 3.589,8 8,8s8,-3.589 8,-8 -3.589,-8 -8,-8 -8,3.589 -8,8zM14.164,7.464c0.483,0.109 0.818,0.551 0.793,1.046 0.13,0.495 -0.067,2.287 -0.174,2.57 -0.217,1.144 -1.152,2.004 -2.272,2.004a2.19,2.19 0,0 1,-1.377 -0.5v0.002l-0.366,-0.303a1.219,1.219 0,0 0,-1.57 0.012l-0.244,0.209a2.194,2.194 0,0 1,-1.467 0.58c-1.12,0 -2.055,-0.86 -2.272,-2.003 -0.108,-0.284 -0.298,-2.083 -0.175,-2.571v-0.003a1.022,1.022 0,0 1,0.794 -1.043,3.712 3.712,0 0,1 3.354,0.905l0.15,0.14a0.972,0.972 0,0 0,1.321 0l0.154,-0.143a3.714,3.714 0,0 1,3.351 -0.902z" />
</vector>
diff --git a/mobile/android/android-components/components/ui/icons/src/main/res/drawable/mozac_ic_private_mode_circle_fill_24.xml b/mobile/android/android-components/components/ui/icons/src/main/res/drawable/mozac_ic_private_mode_circle_fill_24.xml
index bcb350e8fd..995a646e66 100644
--- a/mobile/android/android-components/components/ui/icons/src/main/res/drawable/mozac_ic_private_mode_circle_fill_24.xml
+++ b/mobile/android/android-components/components/ui/icons/src/main/res/drawable/mozac_ic_private_mode_circle_fill_24.xml
@@ -2,16 +2,14 @@
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
- android:fillColor="?mozac_ic_private_mode_circle_fill_background_color"
- android:pathData="M12,22C6.486,22 2,17.514 2,12S6.486,2 12,2s10,4.486 10,10 -4.486,10 -10,10z" />
+ android:fillColor="@color/mozac_ui_icons_fill"
+ android:pathData="M9,13.267c0.65,0 1.23,-0.291 1.603,-0.743a0.685,0.685 0,0 0,0 -0.848A2.072,2.072 0,0 0,9 10.933c-0.651,0 -1.23,0.291 -1.603,0.743a0.685,0.685 0,0 0,0 0.848c0.373,0.452 0.952,0.743 1.603,0.743zM15,13.267c0.651,0 1.23,-0.291 1.603,-0.743a0.685,0.685 0,0 0,0 -0.848A2.072,2.072 0,0 0,15 10.933c-0.651,0 -1.23,0.291 -1.603,0.743a0.685,0.685 0,0 0,0 0.848c0.373,0.452 0.952,0.743 1.603,0.743z" />
<path
- android:fillColor="?mozac_ic_private_mode_circle_fill_icon_color"
- android:pathData="M18.196,10.053a1.275,1.275 0,0 0,-0.992 -1.308,4.642 4.642,0 0,0 -4.189,1.127l-0.192,0.179a1.208,1.208 0,0 1,-1.651 -0.001l-0.188,-0.175a4.643,4.643 0,0 0,-4.192 -1.13,1.277 1.277,0 0,0 -0.992,1.304v0.004c-0.154,0.609 0.084,2.859 0.219,3.213 0.271,1.429 1.439,2.505 2.84,2.505 0.699,0 1.332,-0.279 1.833,-0.726l0.305,-0.261a1.524,1.524 0,0 1,1.962 -0.016l0.458,0.379v-0.002a2.734,2.734 0,0 0,1.72 0.626c1.4,0 2.569,-1.075 2.841,-2.505 0.134,-0.354 0.38,-2.594 0.218,-3.213zM10.603,12.524A2.072,2.072 0,0 1,9 13.267c-0.651,0 -1.23,-0.291 -1.603,-0.743a0.685,0.685 0,0 1,0 -0.848A2.072,2.072 0,0 1,9 10.933c0.65,0 1.23,0.291 1.603,0.743a0.685,0.685 0,0 1,0 0.848zM16.603,12.524a2.072,2.072 0,0 1,-1.603 0.743c-0.651,0 -1.23,-0.291 -1.603,-0.743a0.685,0.685 0,0 1,0 -0.848A2.072,2.072 0,0 1,15 10.933c0.651,0 1.23,0.291 1.603,0.743a0.685,0.685 0,0 1,0 0.848z"
- tools:ignore="VectorPath" />
+ android:fillColor="@color/mozac_ui_icons_fill"
+ android:pathData="M2,12c0,5.514 4.486,10 10,10s10,-4.486 10,-10S17.514,2 12,2 2,6.486 2,12zM17.204,8.745c0.605,0.137 1.023,0.689 0.992,1.308 0.163,0.619 -0.084,2.859 -0.218,3.213 -0.272,1.43 -1.44,2.505 -2.84,2.505a2.733,2.733 0,0 1,-1.721 -0.626v0.002l-0.458,-0.379a1.524,1.524 0,0 0,-1.962 0.016l-0.305,0.261c-0.501,0.447 -1.134,0.726 -1.833,0.726 -1.401,0 -2.569,-1.076 -2.84,-2.505 -0.135,-0.354 -0.373,-2.604 -0.22,-3.213v-0.004a1.277,1.277 0,0 1,0.993 -1.304,4.643 4.643,0 0,1 4.192,1.13l0.188,0.175a1.21,1.21 0,0 0,1.651 0.001l0.192,-0.179a4.642,4.642 0,0 1,4.189 -1.127z" />
</vector>
diff --git a/mobile/android/android-components/components/ui/icons/src/main/res/values/attrs.xml b/mobile/android/android-components/components/ui/icons/src/main/res/values/attrs.xml
index c41244c9c1..3fa2851901 100644
--- a/mobile/android/android-components/components/ui/icons/src/main/res/values/attrs.xml
+++ b/mobile/android/android-components/components/ui/icons/src/main/res/values/attrs.xml
@@ -3,10 +3,8 @@
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<resources>
- <!-- Background color for mozac_ic_private_mode_circle_fill_20,
- mozac_ic_private_mode_circle_fill_24 and mozac_ic_private_mode_circle_fill_48 -->
+ <!-- Background color for mozac_ic_private_mode_circle_fill_48 -->
<attr name="mozac_ic_private_mode_circle_fill_background_color" format="reference" />
- <!-- Icon color for mozac_ic_private_mode_circle_fill_20,
- mozac_ic_private_mode_circle_fill_24 and mozac_ic_private_mode_circle_fill_48 -->
+ <!-- Icon color for mozac_ic_private_mode_circle_fill_48 -->
<attr name="mozac_ic_private_mode_circle_fill_icon_color" format="reference" />
</resources>
diff --git a/mobile/android/android-components/components/ui/widgets/src/test/java/mozilla/components/ui/widgets/behavior/EngineViewScrollingBehaviorTest.kt b/mobile/android/android-components/components/ui/widgets/src/test/java/mozilla/components/ui/widgets/behavior/EngineViewScrollingBehaviorTest.kt
index 0f0c10b71a..d00b657f10 100644
--- a/mobile/android/android-components/components/ui/widgets/src/test/java/mozilla/components/ui/widgets/behavior/EngineViewScrollingBehaviorTest.kt
+++ b/mobile/android/android-components/components/ui/widgets/src/test/java/mozilla/components/ui/widgets/behavior/EngineViewScrollingBehaviorTest.kt
@@ -534,7 +534,7 @@ class EngineViewScrollingBehaviorTest {
}
val behavior = spy(EngineViewScrollingBehavior(testContext, null, ViewPosition.BOTTOM))
- behavior.onLayoutChild(container, view, ViewCompat.LAYOUT_DIRECTION_LTR)
+ behavior.onLayoutChild(container, view, View.LAYOUT_DIRECTION_LTR)
assertEquals(view, behavior.dynamicScrollView)
assertEquals(engineView, behavior.engineView)