Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d6ae2381 authored by Tiger Huang's avatar Tiger Huang
Browse files

Add an activity for testing WindowInsetsController

Which tests these APIs:
- WindowInsetsController#setSystemBarsBehavior
- WindowInsetsController#show
- WindowInsetsController#hide
- WindowInsetsController#addOnControllableInsetsChangedListener
- WindowInsetsController#controlWindowInsetsAnimation
- WindowInsetsAnimationController#setInsetsAndAlpha
- WindowInsetsAnimationController#finish

Bug: 118118435
Test: Manual test
Change-Id: I7f365007abf2c3e6f04e1493e8be7aaef07cb807
parent 9d1c4da6
Loading
Loading
Loading
Loading
+15 −9
Original line number Diff line number Diff line
@@ -18,16 +18,22 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.google.android.test.windowinsetstests">

    <application android:label="@string/activity_title">
        <activity android:name=".WindowInsetsActivity"
             android:theme="@style/appTheme"
             android:windowSoftInputMode="adjustResize"
    <application android:label="@string/application_title">
        <activity android:name=".WindowInsetsTestsMainActivity"
                  android:exported="true">

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <activity android:name=".ChatActivity"
                  android:label="@string/chat_activity_title"
                  android:theme="@style/chat"
                  android:windowSoftInputMode="adjustResize" />

        <activity android:name=".ControllerActivity"
                  android:label="@string/controller_activity_title"
                  android:theme="@style/controller" />
    </application>
</manifest>
+106 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2019 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.
-->


<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="match_parent"
            android:layout_height="match_parent">

    <LinearLayout
        android:id="@+id/content"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <Spinner
            android:id="@+id/spinnerBehavior"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:layout_marginBottom="20dp" />

        <ToggleButton
            android:id="@+id/toggleButtonStatus"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:checked="true"
            android:text="Status Bars Toggle Button"
            android:textOff="Status Bars Invisible"
            android:textOn="Status Bars Visible" />

        <SeekBar
            android:id="@+id/seekBarStatus"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:layout_marginBottom="20dp"
            android:max="10000"
            android:progress="10000" />

        <ToggleButton
            android:id="@+id/toggleButtonNavigation"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:checked="true"
            android:text="Navigation Bars Toggle Button"
            android:textOff="Navigation Bars Invisible"
            android:textOn="Navigation Bars Visible" />

        <SeekBar
            android:id="@+id/seekBarNavigation"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:layout_marginBottom="20dp"
            android:max="10000"
            android:progress="10000" />

        <ToggleButton
            android:id="@+id/toggleButtonIme"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:checked="true"
            android:text="IME Toggle Button"
            android:textOff="IME Invisible"
            android:textOn="IME Visible" />

        <SeekBar
            android:id="@+id/seekBarIme"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:layout_marginBottom="20dp"
            android:max="10000"
            android:progress="0" />

        <TextView
            android:id="@+id/textViewControllableInsets"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="5dp" />

        <EditText
            android:id="@+id/editText"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:ems="10"
            android:hint="For testing IME..."
            android:inputType="text"
            android:text="" />

    </LinearLayout>

</ScrollView>
 No newline at end of file
+37 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2020 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.
-->

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <Button
        android:id="@+id/chat_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/chat_activity_title"
        android:textAllCaps="false"/>

    <Button
        android:id="@+id/controller_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/controller_activity_title"
        android:textAllCaps="false"/>

</LinearLayout>
+10 −1
Original line number Diff line number Diff line
@@ -16,5 +16,14 @@
  -->

<resources>
    <string name="activity_title">New Insets Chat</string>
    <string name="application_title">Window Insets Tests</string>
    <string name="chat_activity_title">New Insets Chat</string>
    <string name="controller_activity_title">Window Insets Controller</string>

    <!-- The item positions should match the flag values respectively. -->
    <string-array name="behaviors">
        <item>BEHAVIOR_SHOW_BARS_BY_TOUCH</item>
        <item>BEHAVIOR_SHOW_BARS_BY_SWIPE</item>
        <item>BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE</item>
    </string-array>
</resources>
Loading