diff options
| author | Felipe Leme <felipeal@google.com> | 2016-12-08 17:13:25 -0800 |
|---|---|---|
| committer | Felipe Leme <felipeal@google.com> | 2017-01-10 12:50:47 -0800 |
| commit | 6d553874bed06280766ae24ea605f9bbde3f5a4a (patch) | |
| tree | 4ba8338d6c7850b177104dab4ec0ea6b72016cff /core/java/android/widget/CompoundButton.java | |
| parent | e961992ed313ea1c733500d9b66f1af5349b59b2 (diff) | |
YAMAFFR - Yet Another Major AutoFill Framework Refactoring
- Explicitly split View methods into Assist and AutoFill methods, rather
than use an overloaded method that takes flags.
- Simarly, renamed ASSIST_FLAG_SANITIZED_TEXT and
ASSIST_FLAG_NON_SANITIZED_TEXT flags to
AUTO_FILL_FLAG_TYPE_FILL and AUTO_FILL_FLAG_TYPE_SAVE respectively.
- Created a AutoFillUI class to host the auto-fill bar and other UI
affordances.
- Moved the temporary notifications to AutoFillUI (eventually that
class will host the real UI).
- Moved FillData to android.app.view.autofill package.
- Split IAutoFillCallback in 2 (IAutoFillAppCallback and
IAutoFillServerCallback, residing at the app and system_server
respectively), so service cannot fill the app directly (which lets
the framework control the UI).
- Moved assist's IResultReceiver to AutoFillServiceImpl so
system_server can act as a mediator between the AutoFillService
implementation and the app being auto-filled.
- Replaced FillData and FillableInputFields by a bunch of new objects:
- FillResponse contains a group of Datasets, each representing
different values
that can be used to auto-fill an activity (for example, different
user accounts), optional id of fields the service is interested
to save, and an optional bundle for service-side extras.
- Dataset contains a name, Fields, and an optional bundle for
service-side extras.
- Fields contain an AutoFillId (parcelable) and a value (Bundle)
- Changed the temporary notifications to emulate the new workflow:
- Initial notification requests the auto-fill data but do not
auto-fill.
- Once service calls back, a new notification is shown with the
results.
- Then if the user selects a dataset, the activity is auto-filled
with it.
- It also shows a notification to emulate what can be saved.
- Created an VirtualViewDelegate for views that uses a virtual
hierarchy for assist data.
- Added new methods on ViewStructure to add children with virtual ids.
- Added 2 methods on View to support auto-fill:
- autoFill(Bundle) to auto-fill the view.
- getAutoFillType() to return how the view can be auto-filled.
- AutoFillType defines the input fields that support auto-fill:
- Text fields (like EditText)
- Toggle fields (like CheckBox)
- Lists (like RadioGroup)
- AutoFillType can also have a sub-type representing its semantic (for
now only text fields have it, and it's the same as getInputType()).
- etc :-)
Bug: 31001899
Test: manual verification
Change-Id: I2dd2fdedcb3ecd1e4403f9c32fa644cb914e186f
Diffstat (limited to 'core/java/android/widget/CompoundButton.java')
| -rw-r--r-- | core/java/android/widget/CompoundButton.java | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/core/java/android/widget/CompoundButton.java b/core/java/android/widget/CompoundButton.java index 3213a34e28f1..718070d0d49a 100644 --- a/core/java/android/widget/CompoundButton.java +++ b/core/java/android/widget/CompoundButton.java @@ -34,6 +34,8 @@ import android.view.ViewDebug; import android.view.ViewHierarchyEncoder; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityNodeInfo; +import android.view.autofill.AutoFillType; +import android.view.autofill.AutoFillValue; import com.android.internal.R; @@ -52,6 +54,7 @@ import com.android.internal.R; * </p> */ public abstract class CompoundButton extends Button implements Checkable { + private boolean mChecked; private boolean mBroadcasting; @@ -111,6 +114,7 @@ public abstract class CompoundButton extends Button implements Checkable { applyButtonTint(); } + @Override public void toggle() { setChecked(!mChecked); } @@ -130,6 +134,7 @@ public abstract class CompoundButton extends Button implements Checkable { } @ViewDebug.ExportedProperty + @Override public boolean isChecked() { return mChecked; } @@ -139,6 +144,7 @@ public abstract class CompoundButton extends Button implements Checkable { * * @param checked true to check the button, false to uncheck it */ + @Override public void setChecked(boolean checked) { if (mChecked != checked) { mChecked = checked; @@ -514,12 +520,15 @@ public abstract class CompoundButton extends Button implements Checkable { + " checked=" + checked + "}"; } - public static final Parcelable.Creator<SavedState> CREATOR - = new Parcelable.Creator<SavedState>() { + @SuppressWarnings("hiding") + public static final Parcelable.Creator<SavedState> CREATOR = + new Parcelable.Creator<SavedState>() { + @Override public SavedState createFromParcel(Parcel in) { return new SavedState(in); } + @Override public SavedState[] newArray(int size) { return new SavedState[size]; } @@ -551,4 +560,16 @@ public abstract class CompoundButton extends Button implements Checkable { super.encodeProperties(stream); stream.addProperty("checked", isChecked()); } + + // TODO(b/33197203): add unit/CTS tests for auto-fill methods + + @Override + public void autoFill(AutoFillValue value) { + setChecked(value.getToggleValue()); + } + + @Override + public AutoFillType getAutoFillType() { + return AutoFillType.forToggle(); + } } |
