* removed "scale" from the show(...) API
* made the zoom scale a dimension => the widget is
fully self-configured
* fixed the magnifier not always scaling the content
to the full pop-up window size
Bug: 63531115
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: manual test that shows the magnifier working
Change-Id: Ibf5c571970c8f6bd3cdbc6d46fbe57d08291783c
* due to having to make the API public, drop the
invalidate_by_client strategy in favor of self invalidation
by polling
* in Magnifier#show(...) stop sending screen coordinates in favor
of view coordinates
* UI/UX:
** width from 200dp to 164dp
** fixed the shadow depth (elevation)
** fixed the rounded corners (2dp)
Bug: 63531115
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: manual test that shows the magnifier working
Change-Id: I6451767b0a618c0c4ea396ba3ee3144523dadc57
The host passes an IServiceConnection to the AppWidgetManager which
is used to bind to the RemoteViewsService. This allows the host to
recieve the connection callbacks directly instead of proxying it via
the AppWidgetManager. The host is also responsible for unbinding to
the service.
Bug: 26481160
Test: adb shell \
am instrument -w -e class android.widget.RemoteViewsAdapterTest \
com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner
Change-Id: Iac400095a319c3a43714c82fda7516be1ccc68af
The cache holds large number of remoteViews each of which have a
separate copy of applicationInfo.
Also simplifying some cache objects
Test: Manually tested on device
Change-Id: I353239354d329d3b0219ade55d39fe3b89e3bb02
* Magnifier#show() takes snapshots of the content and displays
them in the Magnifier bitmap
* calling show(...) consecutive times with the same arguments is
a no-op if already showing (to cater with the miriad of motion
events produced by touch which end up calling show(...))
* introduced Magnifier#invalidate(...) which, if currently
showing, forces updating the content using the last configuration
* clamped the start horizontal value of the Rect which delimits the
content to show in order to avoid distorting the rendering of the
magnifier content
* fixed invalidating the magnifier (invalidate() does not
automatically call invalidate(RectF) !)
Bug: 63531115
Bug: 67296158
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: manual test that shows the magnifier working
Change-Id: I8e53dfb6582d541922fe05b60311658fb07ca880
- Replace SHOW_AS_OVERFLOW_ALWAYS with SHOW_AS_ACTION_NEVER
- MenuItem ordering
- Allow textAssist items in overflow to show text with images
- MenuItem label text now standard case (not allcaps)
Bug: 62447250
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Change-Id: I07fa06f433a34adfad20b371417c95ce76422456
* magnifier zoom from 1.5 to 1.25
* max scale from 10 to 4
* magnifier shows over the text if there is no more space above
instead of showing underneath the cursor
* paused the blink while showing the magnifier and resumed when
dismissing
Bug: 63531115
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: manual test that shows the magnifier working
Change-Id: Ief3e0b7dc9e287e7dd1a9102548b1861598b69c4
1. smart_selection_enabled_for_edit_text
Disables smart selection for editable text.
2. smart_selection_dark_launch
Dark launch TextClassifierImpl.suggestSelection(...)
In this mode we run the method, but never change the user's
selection to measure the quality of the results based on what
the user actually wanted.
Bug: 65959640
Test: Manually tested flags turn on/off feature with 'adb shell
settings put global' and GServices override.
Test: bit FrameworksCoreTests:android.provider.SettingsBackupTest
Change-Id: Iacc561c8ee004b0123de66ad1ee06b1f56b4e4b4
The previous implementation did not take into account the various
expansions that happen for OVERSHOOT and LEFT and RIGHT rectangles, thus
causing the initial shape to be an oval instead of a circle.
Test: manual - triggered smart select and verified that the intial shape
is a circle under the touch point for both single line and multiline
scenarios
Change-Id: I75175bc3972db3f0608ef364109e0571268da4af
Flip the flag for turning ON the magnifier attached
to Editor's handles.
Bug: 66657373
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: manual test that shows the magnifier working
Change-Id: I644c2b834a0c630e5a84a0b948b8667ea988eea6
To go around app bugs caused by assuming that mCursorDrawable is an
array. The apps try to manipulate mCursorDrawable by using
reflection, but crash since they access it incorrectly after it
changed from an array to a single Drawable in
I249befaf70630bef435c8db9039e8aacf233bf7c.
Bug: 66988832
Test: mmm -j frameworks/base
Change-Id: I04fc930d786dd4c74b560d7a25d17353f49ea25b
* implementation of a magnifier which can be attached to any view
* important APIs:
** show(float centerXOnScreen, float centerYOnScreen, float scale)
** dismiss()
* smart offset => shows below if there is no space above
* controlled by boolean flag (easy to turn off)
* attached the magnifier to Editor's handles
* vertically snaps to the middle of the line containing the
selection
* horizontally snaps to the offset of the character where
the selection starts/ends
Bug: 66657373
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: manual test that shows the magnifier working
Change-Id: I1d4616b8bb1210d869ac47dca137ea9636355250
These should not be drawn at all, but the expansion logic for OVERSHOOT
and LEFT and RIGHT rectangles will expand the rectangle into something
that gets drawn.
Test: manual - triggered smart selection and verified that rectangles on
non-primary lines do not get prematurely shown
Change-Id: I5235e4b214401e6ceee3f07bc5cc937907c261ba
When smart select is performed over right-to-left text (either
standalone or mixed with left-to-right text), the animation should flow
in from the opposite side than what it does over left-to-right text.
Test: manual - verify smart select still works
Test: manual - manually set the layout flags to RTL and verify the
animation behaves as expected
Test: bit FrameworksCoreTests:android.widget.SelectionActionModeHelperTest
Change-Id: I2e7766e7dfe74e0861e91fc50b061da74432aee0
Although the stream approach is elegant, we already have a simple loop
iterating over the rectangles which we can reuse for finding the
starting rectangle and save the overhead of the stream / additional
iteration over the rectangles.
Test: manual - verify smart select still works
Change-Id: I4e4195ded4268a7c18ad1b0bc352a9c273396932
Increase the duration allowed for a TextClassifier (TC) result when
it is being initialized for the first time.
Initialization typically takes more time that other calls to the TC.
A timeout during initialization means the user doesn't see the
effect of running the TC the first time. Subsequent calls typically
work fine as they're less likely to timeout.
We increase this value only slightly because we don't want the user
waiting too long for a slow TC's result. Finding the right balance
is an art and most likely depends on the TC being used.
Note that although a TextView's TC can change for each individual
call to the TC, such a situation does not benefit from the bump in
the timeout. Again, we really want to discourage larger timeouts.
Bug: 66217281
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: Manual test:
- Delayed TextClassifier response by about 150ms (allowing only 50ms for initialization)
- Before cl: Sometimes the result is not shown to the user the
first time the textclassifier runs
- After cl: Results consistently show for even for first
textclassifier call
Change-Id: Iabc8279fa57ef6a9a2db0c7e9c7e3ab8c131bf02
> Using helper methods when writing and reading typed objects
> Moving the tag write outside the action, as it is read outside
the action as well
> Removing usused tags
Test: am instrument -w -e class android.widget.RemoteViewsTest com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner
Bug: 65574108
Change-Id: Iaf51cae6ef9f82b70dc1f19c2f019af40c4424a2
This CL ensures that a null text is not passed to
TextClassificationHelper.reset(...)
This CL does not handle the issue of TextView.getText() being null.
Bug: 65682674
Test: none
Change-Id: Id8bdc062ecf21cc14810586580fef9052672cfd8
The clipping rectangle needs to be expanded in order to cover the
content drawn by the stroke. Since half the stroke is drawn on one side
of the bounding rectangle and the other half on the other side, we need
to expand the clip by half of the stroke width.
The previous implementation expanded the clipping rectangle by the whole
stroke width, this allowed for a part of the rounded rectangle to draw
outside of the bounding box.
Test: manual - verify smart select still works and that the rounded
rectangle does not draw outside of the bounding box
Change-Id: I8ca80b7b224d1ac2aa7638405b3cf516bd04b39f
Previously, making two selections quickly one after the other could lead
to the first session missing the terminal event, and the second one getting
terminated prematurely - getting marked incorrectly as abandoned.
Bug: 64914512
Test: Manually tested that logs are correct.
Change-Id: Icd75dcabe707b591f30629b9b9b42c5459ed7dda
Previously, no version was defined for Android P. Now that
I0a90033239081c583b10021cbc06d032e206beb4 defines it, we can switch
the version gate on the new fallback-based linespacing behavior of
TextView and Switch to it.
Test: bit CtsWidgetTestCases:android.widget.cts.CheckedTextViewTest
Test: bit CtsWidgetTestCases:android.widget.cts.EditTextTest
Test: bit CtsWidgetTestCases:android.widget.cts.SwitchTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: bit FrameworksCoreTests:android.widget.TextViewTest
Change-Id: Id68ea4b26baa8a632d9f516083a73a0b8879513f
Fixes: 64648475