diff options
Diffstat (limited to 'FilledApp')
-rw-r--r-- | FilledApp/Android.mk | 13 | ||||
-rw-r--r-- | FilledApp/AndroidManifest.xml | 18 | ||||
-rw-r--r-- | FilledApp/res/drawable-hdpi/ic_launcher.png | bin | 3014 -> 0 bytes | |||
-rw-r--r-- | FilledApp/res/drawable-ldpi/ic_launcher.png | bin | 1504 -> 0 bytes | |||
-rw-r--r-- | FilledApp/res/drawable-mdpi/ic_launcher.png | bin | 1969 -> 0 bytes | |||
-rw-r--r-- | FilledApp/res/drawable-xhdpi/ic_launcher.png | bin | 4006 -> 0 bytes | |||
-rw-r--r-- | FilledApp/res/layout/activity_main.xml | 107 | ||||
-rw-r--r-- | FilledApp/res/values/strings.xml | 8 | ||||
-rw-r--r-- | FilledApp/src/foo/bar/filled/CustomLinearLayout.java | 143 | ||||
-rw-r--r-- | FilledApp/src/foo/bar/filled/MainActivity.java | 54 |
10 files changed, 0 insertions, 343 deletions
diff --git a/FilledApp/Android.mk b/FilledApp/Android.mk deleted file mode 100644 index 2d3c308..0000000 --- a/FilledApp/Android.mk +++ /dev/null @@ -1,13 +0,0 @@ -LOCAL_PATH:= $(call my-dir) - -include $(CLEAR_VARS) - -LOCAL_MODULE_TAGS := optional - -LOCAL_SRC_FILES := $(call all-java-files-under, src) - -LOCAL_PACKAGE_NAME := FilledApp - -LOCAL_PROGUARD_ENABLED := disabled - -include $(BUILD_PACKAGE) diff --git a/FilledApp/AndroidManifest.xml b/FilledApp/AndroidManifest.xml deleted file mode 100644 index 383be7e..0000000 --- a/FilledApp/AndroidManifest.xml +++ /dev/null @@ -1,18 +0,0 @@ -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="foo.bar.filled" > - - <application - android:icon="@drawable/ic_launcher" - android:label="@string/app_name" - android:allowBackup="false" > - <activity - android:name=".MainActivity" - android:label="@string/app_name" > - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> - </intent-filter> - </activity> - </application> - -</manifest> diff --git a/FilledApp/res/drawable-hdpi/ic_launcher.png b/FilledApp/res/drawable-hdpi/ic_launcher.png Binary files differdeleted file mode 100644 index a301d57..0000000 --- a/FilledApp/res/drawable-hdpi/ic_launcher.png +++ /dev/null diff --git a/FilledApp/res/drawable-ldpi/ic_launcher.png b/FilledApp/res/drawable-ldpi/ic_launcher.png Binary files differdeleted file mode 100644 index 2c2a58b..0000000 --- a/FilledApp/res/drawable-ldpi/ic_launcher.png +++ /dev/null diff --git a/FilledApp/res/drawable-mdpi/ic_launcher.png b/FilledApp/res/drawable-mdpi/ic_launcher.png Binary files differdeleted file mode 100644 index f91f736..0000000 --- a/FilledApp/res/drawable-mdpi/ic_launcher.png +++ /dev/null diff --git a/FilledApp/res/drawable-xhdpi/ic_launcher.png b/FilledApp/res/drawable-xhdpi/ic_launcher.png Binary files differdeleted file mode 100644 index 96095ec..0000000 --- a/FilledApp/res/drawable-xhdpi/ic_launcher.png +++ /dev/null diff --git a/FilledApp/res/layout/activity_main.xml b/FilledApp/res/layout/activity_main.xml deleted file mode 100644 index 7bf5e18..0000000 --- a/FilledApp/res/layout/activity_main.xml +++ /dev/null @@ -1,107 +0,0 @@ -<foo.bar.filled.CustomLinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:id="@+id/content" - android:layout_width="match_parent" - android:layout_height="match_parent" - tools:context=".MainActivity" - android:orientation="vertical" > - - <ScrollView - android:layout_width="fill_parent" - android:layout_height="wrap_content"> - - <LinearLayout - android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:orientation="vertical"> - - <View - android:layout_width="fill_parent" - android:layout_height="500dip"> - </View> - - <HorizontalScrollView - android:layout_width="fill_parent" - android:layout_height="wrap_content"> - - <LinearLayout - android:layout_width="wrap_content" - android:layout_height="fill_parent" - android:orientation="horizontal"> - - <View - android:layout_width="500dip" - android:layout_height="fill_parent"> - </View> - - <LinearLayout - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:orientation="vertical"> - - <LinearLayout - android:layout_width="wrap_content" - android:layout_height="wrap_content"> - - <TextView - android:id="@+id/username_label" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/username"> - </TextView> - - <EditText - android:id="@+id/username" - android:layout_width="200dip" - android:layout_height="wrap_content"> - </EditText> - - </LinearLayout> - - <LinearLayout - android:layout_width="wrap_content" - android:layout_height="wrap_content"> - - <TextView - android:id="@+id/password_label" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/password"> - </TextView> - - <EditText - android:id="@+id/password" - android:layout_width="200dip" - android:layout_height="wrap_content"> - </EditText> - - </LinearLayout> - - </LinearLayout> - - <View - android:layout_width="500dip" - android:layout_height="fill_parent"> - </View> - - </LinearLayout> - - </HorizontalScrollView> - - <Button - android:id="@+id/finish" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="Finish"> - </Button> - - <View - android:layout_width="fill_parent" - android:layout_height="500dip"> - </View> - - </LinearLayout> - - </ScrollView> - -</foo.bar.filled.CustomLinearLayout> diff --git a/FilledApp/res/values/strings.xml b/FilledApp/res/values/strings.xml deleted file mode 100644 index 691778f..0000000 --- a/FilledApp/res/values/strings.xml +++ /dev/null @@ -1,8 +0,0 @@ -<resources> - - <string name="app_name">Filled App</string> - <string name="title_activity_main">MainActivity</string> - <string name="username">Username</string> - <string name="password">Password</string> - -</resources>
\ No newline at end of file diff --git a/FilledApp/src/foo/bar/filled/CustomLinearLayout.java b/FilledApp/src/foo/bar/filled/CustomLinearLayout.java deleted file mode 100644 index a2fffed..0000000 --- a/FilledApp/src/foo/bar/filled/CustomLinearLayout.java +++ /dev/null @@ -1,143 +0,0 @@ -package foo.bar.filled; - -import android.annotation.Nullable; -import android.content.Context; -import android.content.res.Resources; -import android.graphics.Rect; -import android.text.TextUtils; -import android.util.AttributeSet; -import android.util.SparseArray; -import android.view.View; -import android.view.ViewGroup; -import android.view.ViewStructure; -import android.view.autofill.AutofillManager; -import android.view.autofill.AutofillValue; -import android.widget.EditText; -import android.widget.LinearLayout; -import android.widget.TextView; - -public class CustomLinearLayout extends LinearLayout { - static final boolean VIRTUAL = false; - - public CustomLinearLayout(Context context, @Nullable AttributeSet attrs) { - super(context, attrs); - if (VIRTUAL) { - getViewTreeObserver().addOnGlobalFocusChangeListener((oldFocus, newFocus) -> { - AutofillManager autofillManager = getContext().getSystemService( - AutofillManager.class); - if (oldFocus != null) { - autofillManager.notifyViewExited(CustomLinearLayout.this, - oldFocus.getAccessibilityViewId()); - } - if (newFocus != null) { - Rect bounds = new Rect(); - newFocus.getBoundsOnScreen(bounds); - autofillManager.notifyViewEntered(CustomLinearLayout.this, - newFocus.getAccessibilityViewId(), bounds); - } - }); - } - } - - @Override - public void dispatchProvideAutofillStructure(ViewStructure structure, int flags) { - if (!VIRTUAL) { - super.dispatchProvideAutofillStructure(structure, flags); - } else { - onProvideAutofillVirtualStructure(structure, flags); - } - } - - @Override - public void onProvideAutofillVirtualStructure(ViewStructure structure, int flags) { - if (!VIRTUAL) { - return; - } - populateViewStructure(this, structure); - onProvideAutofillVirtualStructureRecursive(this, structure); - } - - @Override - public void autofill(SparseArray<AutofillValue> values) { - final int valueCount = values.size(); - for (int i = 0; i < valueCount; i++) { - final int virtualId = values.keyAt(i); - final AutofillValue value = values.valueAt(i); - View view = findViewByAccessibilityIdTraversal(virtualId); - if (view instanceof EditText && !TextUtils.isEmpty(value.getTextValue())) { - EditText editText = (EditText) view; - editText.setText(value.getTextValue()); - - } - } - } - - private void onProvideAutofillVirtualStructureRecursive(View view, ViewStructure node) { - if (node == null) { - return; - } - if (view instanceof ViewGroup) { - ViewGroup viewGroup = (ViewGroup) view; - final int childCount = viewGroup.getChildCount(); - node.setChildCount(childCount); - for (int i = 0; i < childCount; i++) { - View child = viewGroup.getChildAt(i); - ViewStructure chlidNode = node.newChild(i); - chlidNode.setAutofillId(node, child.getAccessibilityViewId()); - populateViewStructure(child, chlidNode); - onProvideAutofillVirtualStructureRecursive(child, chlidNode); - } - } - } - - private void populateViewStructure(View view, ViewStructure structure) { - if (view.getId() != NO_ID) { - String pkg, type, entry; - try { - final Resources res = getResources(); - entry = res.getResourceEntryName(view.getId()); - type = res.getResourceTypeName(view.getId()); - pkg = res.getResourcePackageName(view.getId()); - } catch (Resources.NotFoundException e) { - entry = type = pkg = null; - } - structure.setId(view.getId(), pkg, type, entry); - } else { - structure.setId(view.getId(), null, null, null); - } - Rect rect = structure.getTempRect(); - view.getDrawingRect(rect); - structure.setDimens(rect.left, rect.top, 0, 0, rect.width(), rect.height()); - structure.setVisibility(VISIBLE); - structure.setEnabled(view.isEnabled()); - if (view.isClickable()) { - structure.setClickable(true); - } - if (view.isFocusable()) { - structure.setFocusable(true); - } - if (view.isFocused()) { - structure.setFocused(true); - } - if (view.isAccessibilityFocused()) { - structure.setAccessibilityFocused(true); - } - if (view.isSelected()) { - structure.setSelected(true); - } - if (view.isLongClickable()) { - structure.setLongClickable(true); - } - CharSequence cname = view.getClass().getName(); - structure.setClassName(cname != null ? cname.toString() : null); - structure.setContentDescription(view.getContentDescription()); - if (view instanceof TextView) { - TextView textView = (TextView) view; - structure.setText(textView.getText(), textView.getSelectionStart(), - textView.getSelectionEnd()); - } - structure.setAutofillHints(view.getAutofillHints()); - structure.setAutofillType(view.getAutofillType()); - structure.setAutofillValue(view.getAutofillValue()); - } -} diff --git a/FilledApp/src/foo/bar/filled/MainActivity.java b/FilledApp/src/foo/bar/filled/MainActivity.java deleted file mode 100644 index f260f37..0000000 --- a/FilledApp/src/foo/bar/filled/MainActivity.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package foo.bar.filled; - -import android.annotation.NonNull; -import android.app.Activity; -import android.os.Bundle; -import android.view.View; -import android.view.autofill.AutofillManager; -import android.widget.Button; - -import foo.bar.filled.R; - -public class MainActivity extends Activity { - public static final String LOG_TAG = "PrintActivity"; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_main); - - if (!CustomLinearLayout.VIRTUAL) { - findViewById(R.id.username).setImportantForAutofill( - View.IMPORTANT_FOR_AUTOFILL_AUTO); - findViewById(R.id.password).setImportantForAutofill( - View.IMPORTANT_FOR_AUTOFILL_AUTO); - } - - Button finishButton = findViewById(R.id.finish); - finishButton.setOnClickListener((view) -> finish()); - - AutofillManager autofillManager = getSystemService(AutofillManager.class); - autofillManager.registerCallback(new AutofillManager.AutofillCallback() { - @Override - public void onAutofillEvent(@NonNull View view, int event) { - super.onAutofillEvent(view, event); - } - }); - } -} |