Commit Graph

6967 Commits

Author SHA1 Message Date
Andrei Stingaceanu
2c2c3eea8e Merge "AutoSize TextView (part 10) - final APIs" 2017-02-20 10:27:07 +00:00
TreeHugger Robot
a42ba85b0e Merge "Clarify extra data argument nullness." 2017-02-17 19:47:02 +00:00
Phil Weaver
d666953f57 Clarify extra data argument nullness.
Bug: 35098706
Test: Trivial change, so I just verified that it builds.
Change-Id: I234afe4f1e52ef1c4c64e44b486a539f0d46854c
2017-02-17 09:55:46 -08:00
Andrei Stingaceanu
30574766ef AutoSize TextView (part 10) - final APIs
Gets rid of setting auto-size configuration
items one by one and instead provides setter
constructs that take all the params needed
to auto-size. This version is much closer to
how this feature can be set up from XML
attributes and also provides no doubt about
validation failures.

Bug: 32221168
Bug: 34494052
Test: in attached topic CL
Change-Id: Ic70ad43d5c6739ee312ea24984534a35c49c17dc
2017-02-17 12:02:10 +00:00
TreeHugger Robot
ceb250424a Merge "Resolve pointer icon over FastScroller to arrow." 2017-02-16 21:18:42 +00:00
Vladislav Kaznacheev
11372fa466 Resolve pointer icon over FastScroller to arrow.
Currently the icon defined by the host AbsListView is displayed
over the fast scroll area.

Bug: 35424111
Test: manual
Change-Id: Ia9897a44550922f16573b97337841c3f6ae263da
2017-02-16 09:37:56 -08:00
Andrei Stingaceanu
302fe9098b Merge "TextView/LinkMovementMethod/ClickableSpan - touch up revert" 2017-02-15 14:28:55 +00:00
TreeHugger Robot
fb30f7ca28 Merge "Do not move PopupWindow when its anchor is detached" 2017-02-13 19:59:49 +00:00
Abodunrinwa Toki
bbc21401b3 Merge "TextClassifierImpl: Handle urls." 2017-02-13 17:35:18 +00:00
Abodunrinwa Toki
9b4c82a83c TextClassifierImpl: Handle urls.
This cl also updates label strings, renames an internal method,
and fixes some bugs in TextClassifierImpl caught by tests.

Test: See: I31ee94177e58c986e61e9b24c6c5816fa4b022e1
Bug: 34778263
Bug: 34922928
Change-Id: Ibf60d345d462dfc8a13dead6f01053f1ae50f35a
2017-02-13 15:00:32 +00:00
Yohei Yukawa
22dac1c8df Introduce @SoftInputModeFlags annotation
Doing this allows us to annotate integer values that should corresponds
to WindowManager.LayoutParams#softInputMode.

Test: There should be no behavior change.  RetentionPolicy.SOURCE
      annotation should change nothing in production code.
Test: checkbuild
Bug: 32784563
Bug: 35079353
Change-Id: I96300b090edce327d0515c740183abe91ded6bac
2017-02-12 16:54:16 -08:00
Andrei Stingaceanu
d834c58252 TextView/LinkMovementMethod/ClickableSpan - touch up revert
Reverts the change which adds a gesture detector in
TextView for detecting clicks on ClickableSpans. A click
is considered MotionEvent.ACTION_UP. Revert needed because
the singleTapUp refactoring has a potential to break
existing apps.

Bug: 23692690
Test: attached in the same topic
Change-Id: Ife47fd0608480130123091bc60a7e9dd1efe8785
2017-02-10 12:55:01 +00:00
Vladislav Kaznacheev
afaa932ece Do not move PopupWindow when its anchor is detached
The current PopupWindow implementation might call
the anchor view's getLocationInWindow even if the anchor
is currently detached from the window (and the location is
a meaningless (0,0)). This results in the popup jumping to
the top of the screen.

This patch is adding tracking of the anchor's attachment state.
The position is never updated while the anchor is detached.
When the anchor is re-attached, the popup position is updated.

Bug: 34853580
Test: manual (see bug)
Change-Id: Icca1b9b558a70ee3edbe6236e076d2d08a1f8f11
2017-02-09 11:43:28 -08:00
Andrei Stingaceanu
fbfead24c2 AutoSize TextView (part 9) - sanitize APIs naming
This CL is no-op (cosmetics only)
* renames autoSizeText type "xy" to "uniform"
* renames attribute "autoSizeStepSizeSet" to "autoSizePresetSizes"
* renames "AUTO_SIZE_TEXT_TYPE_XY" to "AUTO_SIZE_TEXT_TYPE_UNIFORM"
* renames public TextView#getAutoSizeTextPresetSizes() to public
  TextView#getAutoSizeTextAvailableSizes() because this method can
  return either preset sizes or computed sizes (via min/max/step)

Bug: 34923754
Bug: 32221168
Test: associated test renames in the same topic
Change-Id: Ifacccf21ca014b6c0a07322fa02b7859ee53e387
2017-02-09 15:30:02 +00:00
TreeHugger Robot
4127c138e1 Merge "FloatingToolbar: Support for menu groups." 2017-02-08 20:19:52 +00:00
Abodunrinwa Toki
5fedfb8d46 FloatingToolbar: Support for menu groups.
1. Menu groups are now separated by dividers
2. Update to menu item spacing as specified in new UX mocks
3. TextView-Editor now passes the "assist" menu as a group
4. "Share" menu reordered after "Cut/Copy/Paste" as per UX mocks update.

Test: Manual tests.
Bug: 34777048
Bug: 34777833
Change-Id: I3d435d8a38e5b146a54706f12dbf3ff629c504bf
2017-02-08 16:55:26 +00:00
Adam Powell
2ec94fde4f Merge "Provide old behavior for View#hasFocusable to old apps" 2017-02-08 16:21:06 +00:00
TreeHugger Robot
f9a55d42d2 Merge "AutoSize TextView (part 8) - APIs for predefined sizes" 2017-02-08 14:57:43 +00:00
Andrei Stingaceanu
9fe208fe6b AutoSize TextView (part 8) - APIs for predefined sizes
* getter/setter for predefined sizes
* reads and configures from XML at construction time
* fix for an ugly bug where the sizes were missing an
  entry in certain cases, e.g: min = 10; max = 20;
  step = 2 would have produced [10, 12, 14, 16, 18]
  instead of [10, 12, 14, 16, 18, 20]
* fix using getHeight()/getWidth() instead of
  untrusted getMeasuredHeight()/getMeasuredWidth()
  and move the auto-sizing triggering to
  onLayout() instead of onMeasure() (while manually
  testing discovered missing or extra pixels and
  sometimes resizing being skipped - it's all fixed
  now)
* fix using deceiving getTotalPaddingBottom()/...Top()
  and replaced with getExtendedPaddingBottom()/..Top()
  (getTotal... was removing the whitespace height but
  auto-size needs to know about it so it can fill the
  space)

Bug: 32221168
Test: attached in the same topic
      run cts-dev -m CtsWidgetTestCases -t \
      android.widget.cts.TextViewTest

Change-Id: Id5a31d0d32b2b4082af45b4bd65af8cb85bdc92e
2017-02-08 12:48:21 +00:00
Paul Duffin
ca4964ccbe Replace com.android.internal.util.Predicate with java.util.function.Predicate
Bug: 35089332
Bug: 30188076
Test: make checkbuild
Change-Id: I0a5b4bf520fc39b59d8d790b01e9cff0d54e6d21
2017-02-08 11:55:39 +00:00
TreeHugger Robot
bf1a0e23ae Merge "start/invalidate selection actionMode asynchronously" 2017-02-08 10:35:54 +00:00
Phil Weaver
1e2758256a Merge "Provide text locations to accessibility services." 2017-02-07 19:14:09 +00:00
Adam Powell
0f552f4d50 Provide old behavior for View#hasFocusable to old apps
Existing apps have copies of ListView behavior that expects the old
hasFocusable behavior of only reporting explicitly focusable views.
Use targetSdkVersion to give the old behavior to existing apps.
Add hasExplicitFocusable method to View to offer the old behavior
to apps that need it. ViewCompat method required in support library
to shim through to hasFocusable pre-O.

Bug: 34946284
Test: CTS
Change-Id: I65503fa2c5fe4cb8b635efa464e653bbf5e7f821
2017-02-07 10:44:37 -08:00
Felipe Leme
fb0f360222 Merge "Refined session management so Save can be automatically called." 2017-02-07 17:50:29 +00:00
Abodunrinwa Toki
8710ea13c1 start/invalidate selection actionMode asynchronously
Text selection is now started/updated using AsyncTasks that first get
a result from the TextClassifier before actually starting/invalidating
the actionMode on the UI thread with the result.

Bug: 34778899
Test: cts-tradefed run cts-dev -m CtsWidgetTestCases -t android.widget.cts.TextViewTest#testSmartSelection
Change-Id: Ie7eda04bb64335744d88b8874363d46af4f94742
2017-02-07 16:14:56 +00:00
Andrei Stingaceanu
155c3a88ac Merge "Clickable spans - trigger onClick onSingleTapUp" 2017-02-07 11:19:53 +00:00
Felipe Leme
bab851c7c9 Refined session management so Save can be automatically called.
This is yet another big refactoring:

- AutoFillManager keeps track of its current AutoFillSession.
- Views call AFM.startSession(View) when they can trigger autofill.
  (virtual views can call it as well). At this point, the manager
  sets an AutoFillSession, gets the activity token, and passes it to
  the service.
- Subsequent calls to AFM.start() will be ignored since the session
  is set.
- When the Activity is gone, it calls AFM.finishSession().
- Simlilarly, virtual views could call it as well.
- Added getAutoFillValue() to View.
- Removed AFM.updateAutoFillInput(childId): virtual views should now
  call startSession(childId) to start a session, and use the
  VirtualViewListener callbacks for updates.
- Change AutoFillValue to use String (which is immutable) instead of
  CharSequence for text values.
- Check if view is enabled before auto-filling.
- Removed 'cmd autofill fill' since it would require the appCallback
- Automatically dismiss the snack bar after 30s
- Moved the "don't change autofill value when autofilling" Inception
  logic into the service side.
- Etc...

BUG: 34819567
BUG: 33269702
BUG: 31001899

Test: manual verification
Test: CtsAutoFillServiceTestCases passes

Change-Id: I5fad928d4d666701302049d142026a1efa7291cd
2017-02-06 18:22:03 -08:00
Phil Weaver
c2e28932d2 Provide text locations to accessibility services.
Bug: 30170631
Test: New CTS tests on linked CL.
Change-Id: I723e3777189c8df71c59dada00abdf339ebc983d
2017-02-06 12:57:17 -08:00
Aurimas Liutikas
ab14d825c3 Adding text input mode to TimePicker.
Test: Tests will have a follow up CL.
Bug:30044800

Change-Id: I71a0fba97026da76251768016edf1b159617abb9
2017-02-06 11:29:38 -08:00
TreeHugger Robot
40eb0ba427 Merge "Revert "Implicitly cast views obtained via View.findView methods"" 2017-02-06 17:37:49 +00:00
Andrei Stingaceanu
f0ebee91f8 Clickable spans - trigger onClick onSingleTapUp
Previously (post Android N) we decided to introduce
a gesture detector in textView and trigger the onClick()
over a clickable span when onSingleTapConfirmed was
called. The problem is that onSingleTapConfirmed also
waits for double tap timeout to make sure (to confirm).
This has a chance to break some apps so relax the
rule to only look for onSingleTapUp.

* the bug for which the initial change was made is
still fixed
* slightly amended the ClickableSpan JavaDoc to
specify that the onClick gets triggered if the
span is selected when clicked (note that this
behavior is unchanged since ClickableSpan exists,
added just an extra hint to devs)

Bug: 23692690
Test: in the attached CL (same topic)
Change-Id: Iead434aa558301d61879c27edc48dc4148ca187f
2017-02-06 17:03:28 +00:00
Ben Weiss
995f4b5721 Merge "Extract and unhide TransitionListenerAdapter" 2017-02-06 10:16:50 +00:00
Alan Viverette
177f37367e Revert "Implicitly cast views obtained via View.findView methods"
This reverts commit 06c2fffdaa.

Reason for revert: Java 8 doesn't support this magic.

Change-Id: Iaa41f4e4d0072b9a97cff9cd3788403d4ab79d13
2017-02-03 17:08:47 -05:00
Abodunrinwa Toki
fafdb7372f Fix TextClassifier.getTextClassificationResult()
Gracefully handles situations where a default app cannot be found
to handle the intent.

1. If we can not find any app to handle the intent,
   do not include an "assist" menu item entry to fire the intent.
   Also, do not linkify the entry.
2. If we do not have a default app to handle the intent,
   show a generic title for apps that will handle the intent
   and do not include an icon.

In the ideal case where we find a default app to include the intent,
show the app's (preferably activity's) title and icon.

Test: Manually tested. There's an AI to write more automated tests.
Bug: 34777322
Bug: 34927631
Change-Id: Ia94efbbdda3da8f181fac9228cd2d3a76cb727d3
2017-02-02 20:35:51 +00:00
Felipe Leme
5523f9a2fc Merge "Improved AutoFill Save workflow." 2017-02-02 02:05:32 +00:00
Felipe Leme
0200d9ea15 Improved AutoFill Save workflow.
Currently, the onProvideAutoFillStructure() methods can be called
twice: to auto-fill an activity and to save the activity's data
in the service.

The problem with this approach is that when the save workflow is
called, the activity might have been gone. Hence, a proper approach
is to keep the initial AssistStructure data in the system_service
memory, watch for view changes, and then passed the new structure
back to the AutoFillService.

A side effect of this change is that we need another way to determine
if the view is sanitized or not. For "standard" views, that will be
defined based on whether the view content come from a resource or not,
but that logic is not implemented yet (for now, all views will be
considered sanitized, except for TextView passwords). For "custom"
views (such as WebView), this logic is responsibility of the view
implementation, through the newChild() method, which now takes a
flag (whose value could be AUTO_FILL_FLAG_SANITIZED for sanitized
views).

The SaveCallback.onSuccess() method was simplified: it does
not need a list of saved ids anymore the auto-fill UI will not use it
anymore.

Another side effect is that the Save notification is gone - until
it's attached again, it can be test by using:

    adb shell cmd autofill save

Finally, hook AutoFillUI on ACTION_CLOSE_SYSTEM_DIALOGS events.

BUG: 33269702
BUG: 31001899
Test: manual verification
Test: CtsAutoFillServiceTestCases passes
Change-Id: I907a7e21d1b3cd1ab6dec3a08d144a52655da46f
2017-02-01 11:00:15 -08:00
Abodunrinwa Toki
8e332cc54b Merge "Ignore smart selection for multi-word selections." 2017-02-01 10:51:06 +00:00
Abodunrinwa Toki
f9a81f352e Ignore smart selection for multi-word selections.
Test: See: Ic273fd68f300671d8e7c0dabe4a3ae9470056fcc
Bug: 34831428
Bug: 34778597
Bug: 34778381
Change-Id: Ib15828996081a72f02f5075acac1f2f6c51d3601
2017-02-01 00:17:59 +00:00
TreeHugger Robot
7b552516ae Merge "Implicitly cast views obtained via View.findView methods" 2017-01-31 22:04:25 +00:00
TreeHugger Robot
a06155011e Merge "Fix crash in TextView getFont" 2017-01-31 17:56:10 +00:00
Yura
e2896febe4 Merge "Fix for endless loop in RelativeLayout." 2017-01-31 15:18:13 +00:00
Clara Bayarri
060332400d Fix crash in TextView getFont
The wrong TypedArray was being used to retrieve the value.

Bug: 34818260
Test: run cts -m CtsWidgetTestCases -t
android.widget.cts.TextViewTest#testFontResources_setInXmlStyle

Change-Id: I09334710b9b21f1397bc02d92d14b41fbc96178f
2017-01-31 12:15:50 +00:00
TreeHugger Robot
cf45c85297 Merge "Introduce set/getFontVariationSettings." 2017-01-31 05:46:27 +00:00
TreeHugger Robot
9f5d2b0886 Merge "Don't scroll popup parent in response to parent scrolling" 2017-01-30 18:31:21 +00:00
Yura
a354c4f156 Fix for endless loop in RelativeLayout.
getRelatedView(int[] rules, int relation)

is stuck in the loop, when a view is GONE, and references itself.
There is already a check in:

  getSortedViews(View[] sorted, int... rules) {

to make sure there are no loops of ViewA -> ViewB -> ViewA

BUT, there was a change made in findRoots(int[] rulesFilter)

to "Remove exception throw when a view has a self dependency
inside a RelativeLayout." so this means we must allow this case.

Other change git commit sha: da3003e1d7

Bug: http://b/android.com/231353
Change-Id: Icc26b86ebbb19e482c3afe6a39db996ec493586d
2017-01-30 18:10:34 +00:00
Chet Haase
b64e777f6c Add methods to query animation state
Testing utilities want the ability to know whether things in the UI
are in flux and they need to wait before testing on-screen values.
These changes (a subset of what's needed, but will have to do for
a start) allow querying of ActivityTransitions and ProgressBar, two
common/difficult pieces in the puzzle.

Test: CTS tests at ag/1835467
Bug: 30978257 Provide view transition Api to prevent flaky tests

Change-Id: If63b3d0dde2178d826ac1dbfad0fc50e5ed9a780
2017-01-30 12:57:43 +00:00
Seigo Nonaka
9ff994d988 Introduce set/getFontVariationSettings.
This is 2nd attempt of I249d464f8cdaa56017a987588b94ed685aadeb58.
The original CL was reverted due to conflicting with another CL submitted
before.
Nothing has changed except for following class name changes.

Here is the original commit message of reverted change.

This CL enables developers to specify axis values to the underlying
font collection. The specification of the font variation settings is
the same as the CSS font-variation-settings attribute in CSS working
draft as of 2016-11-30.

Code example: Here is an example to set width 100 and weight 1.5.

  TextView tv = (TextView) findViewById(R.id.textView);
  tv.setFontVariationSettings("'wdth' 100, 'wght' 1.5");

Bug: 33062398
Test: Manually done. Ran FrameworksGraphicsTests, CtsGraphicsTestCases
      and CtsWidgetTestCases

Change-Id: I9cdfbdecc87c995d805096883ef2652768c6c21e
2017-01-30 20:22:41 +09:00
TreeHugger Robot
fe98ad919b Merge "Implement .xml font resource support" 2017-01-30 09:37:13 +00:00
TreeHugger Robot
b46df69a77 Merge "Move autofill focus triggers from TextView to View." 2017-01-28 01:54:48 +00:00
TreeHugger Robot
c7b21e2263 Merge "Fix ListView click handling under new focus rules" 2017-01-27 23:11:45 +00:00