Deleting frameworks/base/tests/ActivityViewTest
This CL is part of the effort of removing ActivityView. Test: m frameworks/base/tests Bug: 179161778 Change-Id: I613107bbdde17b0d1cd2bb920d35953198a3195d
This commit is contained in:
@@ -1,15 +0,0 @@
|
||||
package {
|
||||
// See: http://go/android-license-faq
|
||||
// A large-scale-change added 'default_applicable_licenses' to import
|
||||
// all of the 'license_kinds' from "frameworks_base_license"
|
||||
// to get the below license kinds:
|
||||
// SPDX-license-identifier-Apache-2.0
|
||||
default_applicable_licenses: ["frameworks_base_license"],
|
||||
}
|
||||
|
||||
android_test {
|
||||
name: "ActivityViewTest",
|
||||
srcs: ["src/**/*.java"],
|
||||
platform_apis: true,
|
||||
certificate: "platform",
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2018 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.
|
||||
-->
|
||||
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.google.android.test.activityview">
|
||||
<uses-permission android:name="android.permission.INJECT_EVENTS"/>
|
||||
<uses-permission android:name="android.permission.MANAGE_ACTIVITY_TASKS"/>
|
||||
<uses-permission android:name="android.permission.ACTIVITY_EMBEDDING"/>
|
||||
<uses-permission android:name="android.permission.INTERNAL_SYSTEM_WINDOW"/>
|
||||
|
||||
<uses-sdk android:targetSdkVersion="27"/>
|
||||
<application android:label="ActivityViewTest">
|
||||
<activity android:name=".ActivityViewMainActivity"
|
||||
android:label="AV Main"
|
||||
android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|colorMode|density"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
<category android:name="android.intent.category.DEFAULT"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity android:name=".ActivityViewActivity"
|
||||
android:label="AV"
|
||||
android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|colorMode|density"
|
||||
android:windowSoftInputMode="stateHidden|adjustResize">
|
||||
</activity>
|
||||
|
||||
<activity android:name=".ActivityViewResizeActivity"
|
||||
android:label="AV Resize"
|
||||
android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|colorMode|density"
|
||||
android:windowSoftInputMode="stateHidden|adjustResize">
|
||||
</activity>
|
||||
|
||||
<activity android:name=".ActivityViewScrollActivity"
|
||||
android:label="AV Scroll"
|
||||
android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|colorMode|density"
|
||||
android:windowSoftInputMode="stateHidden">
|
||||
</activity>
|
||||
|
||||
<activity android:name=".ActivityViewTestActivity"
|
||||
android:resizeableActivity="true"
|
||||
android:theme="@*android:style/Theme.NoTitleBar"
|
||||
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>
|
||||
@@ -1,47 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2018 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" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/activity_pick_launch_button"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Launch from picker" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ActivityView
|
||||
android:id="@+id/activity_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -1,50 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2018 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/activity_view_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Test ActivityView"
|
||||
android:textAllCaps="false"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/scroll_activity_view_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Test Scroll ActivityView"
|
||||
android:textAllCaps="false"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/resize_activity_view_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
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>
|
||||
@@ -1,51 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2018 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="100dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Launch" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/activity_resize_button"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Resize" />
|
||||
</LinearLayout>
|
||||
|
||||
<SeekBar
|
||||
android:id="@+id/activity_view_seek_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<ActivityView
|
||||
android:id="@+id/activity_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="600dp" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -1,57 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2018 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">
|
||||
|
||||
<Button
|
||||
android:id="@+id/activity_launch_button"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Launch" />
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/activity_view_host_scroll_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:color="#cfd8dc">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="300dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:background="#eeeeee" />
|
||||
|
||||
<ActivityView
|
||||
android:id="@+id/activity_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="300dp"
|
||||
android:background="#fce4ec" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="300dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:background="#eeeeee" />
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</LinearLayout>
|
||||
@@ -1,70 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2018 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.
|
||||
-->
|
||||
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/test_activity_root"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#ffe0b2">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:orientation="vertical"
|
||||
android:background="#00000000" >
|
||||
<TextView
|
||||
android:id="@+id/test_activity_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@android:color/black"
|
||||
android:background="#00000000"
|
||||
android:gravity="center" />
|
||||
<TextView
|
||||
android:id="@+id/test_activity_touch_state"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@android:color/black"
|
||||
android:background="#00000000"
|
||||
android:gravity="center" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/test_activity_width_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@android:color/black"
|
||||
android:background="#00000000"
|
||||
android:gravity="center" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/test_activity_height_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:textColor="@android:color/black"
|
||||
android:background="#00000000"
|
||||
android:gravity="center" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/test_activity_edittext"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_margin="16dp" />
|
||||
</RelativeLayout>
|
||||
@@ -1,46 +0,0 @@
|
||||
<?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>
|
||||
@@ -1,56 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2018 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 com.google.android.test.activityview;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityView;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Parcelable;
|
||||
import android.widget.Button;
|
||||
|
||||
public class ActivityViewActivity extends Activity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_view_activity);
|
||||
|
||||
final ActivityView activityView = findViewById(R.id.activity_view);
|
||||
final Button launchButton = findViewById(R.id.activity_launch_button);
|
||||
launchButton.setOnClickListener(v -> {
|
||||
final Intent intent = new Intent(this, ActivityViewTestActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
|
||||
activityView.startActivity(intent);
|
||||
});
|
||||
final Button pickActivityLaunchButton = findViewById(R.id.activity_pick_launch_button);
|
||||
pickActivityLaunchButton.setOnClickListener(v -> {
|
||||
final Intent intent = Intent.makeMainActivity(null);
|
||||
final Intent chooser = Intent.createChooser(intent,
|
||||
"Pick an app to launch in ActivityView");
|
||||
chooser.putExtra(Intent.EXTRA_INITIAL_INTENTS, new Parcelable[] {
|
||||
new Intent(Intent.ACTION_MAIN)
|
||||
.addCategory("com.android.internal.category.PLATLOGO")
|
||||
});
|
||||
if (intent.resolveActivity(getPackageManager()) != null) {
|
||||
chooser.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
|
||||
| Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
|
||||
activityView.startActivity(chooser);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2018 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 com.google.android.test.activityview;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
|
||||
public class ActivityViewMainActivity extends Activity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_view_main_activity);
|
||||
|
||||
findViewById(R.id.activity_view_button).setOnClickListener(
|
||||
v -> startActivity(new Intent(this, ActivityViewActivity.class)));
|
||||
|
||||
findViewById(R.id.scroll_activity_view_button).setOnClickListener(
|
||||
v -> startActivity(new Intent(this, ActivityViewScrollActivity.class)));
|
||||
|
||||
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)));
|
||||
}
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2018 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 com.google.android.test.activityview;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityView;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.widget.Button;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.SeekBar;
|
||||
|
||||
public class ActivityViewResizeActivity extends Activity {
|
||||
private static final int SMALL_SIZE = 600;
|
||||
private static final int LARGE_SIZE = 1200;
|
||||
|
||||
private ActivityView mActivityView;
|
||||
|
||||
private boolean mFlipSize;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_view_resize_activity);
|
||||
|
||||
mActivityView = findViewById(R.id.activity_view);
|
||||
|
||||
final Button launchButton = findViewById(R.id.activity_launch_button);
|
||||
launchButton.setOnClickListener(v -> {
|
||||
final Intent intent = new Intent(this, ActivityViewTestActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
|
||||
mActivityView.startActivity(intent);
|
||||
});
|
||||
final Button resizeButton = findViewById(R.id.activity_resize_button);
|
||||
if (resizeButton != null) {
|
||||
resizeButton.setOnClickListener(v -> {
|
||||
LinearLayout.LayoutParams params =
|
||||
(LinearLayout.LayoutParams) mActivityView.getLayoutParams();
|
||||
params.height = mFlipSize ? SMALL_SIZE : LARGE_SIZE;
|
||||
mFlipSize = !mFlipSize;
|
||||
mActivityView.setLayoutParams(params);
|
||||
});
|
||||
}
|
||||
final SeekBar seekBar = findViewById(R.id.activity_view_seek_bar);
|
||||
if (seekBar != null) {
|
||||
seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
||||
@Override
|
||||
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
|
||||
final LinearLayout.LayoutParams params =
|
||||
(LinearLayout.LayoutParams) mActivityView.getLayoutParams();
|
||||
params.height = SMALL_SIZE + progress * 10;
|
||||
mActivityView.setLayoutParams(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartTrackingTouch(SeekBar seekBar) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopTrackingTouch(SeekBar seekBar) {
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2018 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 com.google.android.test.activityview;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityView;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
|
||||
public class ActivityViewScrollActivity extends Activity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_view_scroll_activity);
|
||||
|
||||
final ActivityView activityView = findViewById(R.id.activity_view);
|
||||
final Button launchButton = findViewById(R.id.activity_launch_button);
|
||||
launchButton.setOnClickListener(v -> {
|
||||
final Intent intent = new Intent(this, ActivityViewTestActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
|
||||
activityView.startActivity(intent);
|
||||
});
|
||||
findViewById(R.id.activity_view_host_scroll_view).setOnScrollChangeListener(
|
||||
(View v, int scrollX, int scrollY, int oldScrollX, int oldScrollY)
|
||||
-> activityView.onLocationChanged());
|
||||
}
|
||||
}
|
||||
@@ -1,116 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2018 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 com.google.android.test.activityview;
|
||||
|
||||
import static android.view.MotionEvent.ACTION_CANCEL;
|
||||
import static android.view.MotionEvent.ACTION_DOWN;
|
||||
import static android.view.MotionEvent.ACTION_MOVE;
|
||||
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;
|
||||
private TextView mWidthTextView;
|
||||
private TextView mHeightTextView;
|
||||
private TextView mTouchStateTextView;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_view_test_activity);
|
||||
mRoot = findViewById(R.id.test_activity_root);
|
||||
mTextView = findViewById(R.id.test_activity_title);
|
||||
mWidthTextView = findViewById(R.id.test_activity_width_text);
|
||||
mHeightTextView = findViewById(R.id.test_activity_height_text);
|
||||
mTouchStateTextView = findViewById(R.id.test_activity_touch_state);
|
||||
ViewTreeObserver viewTreeObserver = mRoot.getViewTreeObserver();
|
||||
if (viewTreeObserver.isAlive()) {
|
||||
viewTreeObserver.addOnGlobalLayoutListener(this::updateDimensionTexts);
|
||||
}
|
||||
updateStateText("CREATED");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
updateStateText("STARTED");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
updateStateText("RESUMED");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
updateStateText("PAUSED");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
updateStateText("STOPPED");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfigurationChanged(Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
updateDimensionTexts();
|
||||
}
|
||||
|
||||
private void updateStateText(String state) {
|
||||
Log.d(TAG, state);
|
||||
mTextView.setText(state);
|
||||
}
|
||||
|
||||
private void updateDimensionTexts() {
|
||||
mWidthTextView.setText("" + mRoot.getWidth());
|
||||
mHeightTextView.setText("" + mRoot.getHeight());
|
||||
}
|
||||
|
||||
private void updateTouchState(MotionEvent event) {
|
||||
switch (event.getAction()) {
|
||||
case ACTION_DOWN:
|
||||
case ACTION_MOVE:
|
||||
mTouchStateTextView.setText("[" + event.getX() + "," + event.getY() + "]");
|
||||
break;
|
||||
case ACTION_UP:
|
||||
case ACTION_CANCEL:
|
||||
mTouchStateTextView.setText("");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean dispatchTouchEvent(MotionEvent event) {
|
||||
updateTouchState(event);
|
||||
return super.dispatchTouchEvent(event);
|
||||
}
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package com.google.android.test.activityview;
|
||||
|
||||
import static android.view.View.GONE;
|
||||
import static android.view.View.INVISIBLE;
|
||||
import static android.view.View.VISIBLE;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityView;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.Spinner;
|
||||
|
||||
public class ActivityViewVisibilityActivity extends Activity {
|
||||
private static final String[] sVisibilityOptions = {"VISIBLE", "INVISIBLE", "GONE"};
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_view_visibility_activity);
|
||||
|
||||
final ActivityView activityView = findViewById(R.id.activity_view);
|
||||
final Button launchButton = findViewById(R.id.activity_launch_button);
|
||||
launchButton.setOnClickListener(v -> {
|
||||
final Intent intent = new Intent(this, ActivityViewTestActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
|
||||
activityView.startActivity(intent);
|
||||
});
|
||||
|
||||
final Spinner visibilitySpinner = findViewById(R.id.visibility_spinner);
|
||||
final ArrayAdapter<String> adapter = new ArrayAdapter<>(this,
|
||||
android.R.layout.simple_spinner_item, sVisibilityOptions);
|
||||
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
visibilitySpinner.setAdapter(adapter);
|
||||
visibilitySpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
switch (position) {
|
||||
case 0:
|
||||
activityView.setVisibility(VISIBLE);
|
||||
break;
|
||||
case 1:
|
||||
activityView.setVisibility(INVISIBLE);
|
||||
break;
|
||||
case 2:
|
||||
activityView.setVisibility(GONE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parent) {
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user