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

Commit b8de9952 authored by chaviw's avatar chaviw
Browse files

Added demo for ActiviyView visibility

Allows user to control the ActivityView's visibility at runtime to test
the behavior.

Test: mmma tests/ActivityViewTest, install apk, and run app

Change-Id: Ia01ffa825c2a96a35760574a205c41196c9b1976
parent e3ecbde6
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -57,5 +57,10 @@
                  android:exported="true"
                  android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|colorMode|density">
        </activity>

        <activity android:name=".ActivityViewVisibilityActivity"
                  android:label="AV Visibility"
                  android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|colorMode|density">
        </activity>
    </application>
</manifest>
+6 −0
Original line number Diff line number Diff line
@@ -41,4 +41,10 @@
        android:text="Test Resize ActivityView"
        android:textAllCaps="false"/>

    <Button
        android:id="@+id/visibility_activity_view_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Test ActivityView Visibility"
        android:textAllCaps="false"/>
</LinearLayout>
+46 −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.
-->

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

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">

        <Button
            android:id="@+id/activity_launch_button"
            android:layout_width="200dp"
            android:layout_height="wrap_content"
            android:text="Launch test activity" />

        <Spinner
            android:id="@+id/visibility_spinner"
            android:layout_width="200dp"
            android:layout_height="match_parent"/>

    </LinearLayout>

    <ActivityView
        android:id="@+id/activity_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

</LinearLayout>
+3 −0
Original line number Diff line number Diff line
@@ -35,5 +35,8 @@ public class ActivityViewMainActivity extends Activity {

        findViewById(R.id.resize_activity_view_button).setOnClickListener(
                v -> startActivity(new Intent(this, ActivityViewResizeActivity.class)));

        findViewById(R.id.visibility_activity_view_button).setOnClickListener(
                v -> startActivity(new Intent(this, ActivityViewVisibilityActivity.class)));
    }
}
+3 −0
Original line number Diff line number Diff line
@@ -24,12 +24,14 @@ import static android.view.MotionEvent.ACTION_UP;
import android.app.Activity;
import android.content.res.Configuration;
import android.os.Bundle;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewTreeObserver;
import android.widget.TextView;

public class ActivityViewTestActivity extends Activity {
    private static final String TAG = "ActivityViewTestActivity";

    private View mRoot;
    private TextView mTextView;
@@ -84,6 +86,7 @@ public class ActivityViewTestActivity extends Activity {
    }

    private void updateStateText(String state) {
        Log.d(TAG, state);
        mTextView.setText(state);
    }

Loading