summaryrefslogtreecommitdiffstats
path: root/samples/ApiDemos
diff options
context:
space:
mode:
authorAdrian Roos <roosa@google.com>2018-03-15 15:32:12 +0100
committerAdrian Roos <roosa@google.com>2018-03-15 15:32:12 +0100
commit59e2e04dc134d36fa499121b149cadc5a9a31830 (patch)
tree80e8e0b7a26ebf8a0905e08ca7a1649b3dec951c /samples/ApiDemos
parent86178041916ecb475e77d85d8e6475876d4867da (diff)
downloadandroid_development-59e2e04dc134d36fa499121b149cadc5a9a31830.tar.gz
android_development-59e2e04dc134d36fa499121b149cadc5a9a31830.tar.bz2
android_development-59e2e04dc134d36fa499121b149cadc5a9a31830.zip
ApiDemos: Add maxAspectRatio demo
Bug: 72696928 Test: Install and open ApiDemos > App > Activity > Max Aspect Ratio > 1:1 / 16:9 / Any Change-Id: Ie76c8c4babd6b4c281eec8ff977a0c02a868ee0e
Diffstat (limited to 'samples/ApiDemos')
-rw-r--r--samples/ApiDemos/AndroidManifest.xml32
-rw-r--r--samples/ApiDemos/res/values/strings.xml3
-rw-r--r--samples/ApiDemos/src/com/example/android/apis/app/MaxAspectRatio.java31
3 files changed, 66 insertions, 0 deletions
diff --git a/samples/ApiDemos/AndroidManifest.xml b/samples/ApiDemos/AndroidManifest.xml
index 3f975f220..3896c74fc 100644
--- a/samples/ApiDemos/AndroidManifest.xml
+++ b/samples/ApiDemos/AndroidManifest.xml
@@ -298,6 +298,38 @@
</intent-filter>
</activity>
+ <activity android:name=".app.MaxAspectRatio$Square"
+ android:label="@string/activity_max_aspect_ratio_square"
+ android:resizeableActivity="false"
+ android:theme="@android:style/Theme.DeviceDefault.Settings"
+ android:maxAspectRatio="1">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.SAMPLE_CODE" />
+ </intent-filter>
+ </activity>
+
+ <activity android:name=".app.MaxAspectRatio$SixteenToNine"
+ android:label="@string/activity_max_aspect_ratio_16to9"
+ android:resizeableActivity="false"
+ android:theme="@android:style/Theme.DeviceDefault.Settings"
+ android:maxAspectRatio="1.77777778">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.SAMPLE_CODE" />
+ </intent-filter>
+ </activity>
+
+ <activity android:name=".app.MaxAspectRatio$Any"
+ android:label="@string/activity_max_aspect_ratio_any"
+ android:resizeableActivity="true"
+ android:theme="@android:style/Theme.DeviceDefault.Settings">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.SAMPLE_CODE" />
+ </intent-filter>
+ </activity>
+
<activity android:name=".app.PresentationActivity"
android:label="@string/activity_presentation">
<intent-filter>
diff --git a/samples/ApiDemos/res/values/strings.xml b/samples/ApiDemos/res/values/strings.xml
index 30d92ab88..59f2fe96e 100644
--- a/samples/ApiDemos/res/values/strings.xml
+++ b/samples/ApiDemos/res/values/strings.xml
@@ -63,6 +63,9 @@
<string name="screen_orientation">Screen Orientation</string>
<string name="activity_picture_in_picture">App/Activity/Picture in Picture</string>
+ <string name="activity_max_aspect_ratio_square">App/Activity/Max Aspect Ratio/1:1</string>
+ <string name="activity_max_aspect_ratio_16to9">App/Activity/Max Aspect Ratio/16:9</string>
+ <string name="activity_max_aspect_ratio_any">App/Activity/Max Aspect Ratio/Any</string>
<string name="enter_picture_in_picture">Enter picture-in-picture mode</string>
<string name="activity_translucent">App/Activity/Translucent</string>
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/MaxAspectRatio.java b/samples/ApiDemos/src/com/example/android/apis/app/MaxAspectRatio.java
new file mode 100644
index 000000000..223cd9290
--- /dev/null
+++ b/samples/ApiDemos/src/com/example/android/apis/app/MaxAspectRatio.java
@@ -0,0 +1,31 @@
+/*
+ * 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.example.android.apis.app;
+
+import android.app.Activity;
+
+public abstract class MaxAspectRatio extends Activity {
+
+ public static class Square extends MaxAspectRatio {
+ }
+
+ public static class SixteenToNine extends MaxAspectRatio {
+ }
+
+ public static class Any extends MaxAspectRatio {
+ }
+}