The base files for the project & activities and XML resources
Test: build and run manually Change-Id: I6eb7f1a444703e99f592ac9106261f9c6bd90127
19
samples/IntentPlayground/Android.mk
Normal file
@@ -0,0 +1,19 @@
|
||||
LOCAL_PATH:= $(call my-dir)
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE_TAGS := samples tests
|
||||
|
||||
# Only compile source java files in this apk.
|
||||
LOCAL_SRC_FILES := $(call all-java-files-under, src)
|
||||
|
||||
LOCAL_STATIC_JAVA_LIBRARIES = android-support-v13
|
||||
|
||||
LOCAL_PACKAGE_NAME := IntentPlayground
|
||||
|
||||
LOCAL_SDK_VERSION := current
|
||||
|
||||
|
||||
include $(BUILD_PACKAGE)
|
||||
|
||||
# Use the folloing include to make our test apk.
|
||||
include $(call all-makefiles-under,$(LOCAL_PATH))
|
||||
78
samples/IntentPlayground/AndroidManifest.xml
Normal file
@@ -0,0 +1,78 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 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.
|
||||
-->
|
||||
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.example.android.intentplayground">
|
||||
<uses-permission android:name="android.permission.REORDER_TASKS" />
|
||||
<application
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
<activity
|
||||
android:name=".LauncherActivity"
|
||||
android:launchMode="singleInstance"
|
||||
android:documentLaunchMode="always">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".SingleTopActivity"
|
||||
android:launchMode="singleTop" />
|
||||
<activity
|
||||
android:name=".SingleInstanceActivity"
|
||||
android:launchMode="singleInstance" />
|
||||
<activity
|
||||
android:name=".SingleTaskActivity"
|
||||
android:launchMode="singleTask" />
|
||||
<activity
|
||||
android:name=".TaskAffinity1Activity"
|
||||
android:launchMode="standard"
|
||||
android:allowTaskReparenting="true"
|
||||
android:taskAffinity=".t1" />
|
||||
<activity
|
||||
android:name=".TaskAffinity2Activity"
|
||||
android:launchMode="standard"
|
||||
android:allowTaskReparenting="true"
|
||||
android:taskAffinity=".t2" />
|
||||
<activity
|
||||
android:name=".TaskAffinity3Activity"
|
||||
android:launchMode="standard"
|
||||
android:allowTaskReparenting="true"
|
||||
android:taskAffinity=".t3" />
|
||||
<activity
|
||||
android:name=".ClearTaskOnLaunchActivity"
|
||||
android:launchMode="standard"
|
||||
android:clearTaskOnLaunch="true"
|
||||
android:allowTaskReparenting="true"
|
||||
android:taskAffinity=".t2" />
|
||||
<activity
|
||||
android:name=".DocumentLaunchIntoActivity"
|
||||
android:documentLaunchMode="intoExisting" />
|
||||
<activity
|
||||
android:name=".DocumentLaunchAlwaysActivity"
|
||||
android:documentLaunchMode="always" />
|
||||
<activity
|
||||
android:name=".DocumentLaunchNeverActivity"
|
||||
android:documentLaunchMode="never" />
|
||||
<activity
|
||||
android:name=".NoHistoryActivity"
|
||||
android:noHistory="true" />
|
||||
</application>
|
||||
</manifest>
|
||||
20
samples/IntentPlayground/res/drawable/card_background.xml
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 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.
|
||||
-->
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@android:color/background_light"/>
|
||||
<corners android:radius="2dp"/>
|
||||
<padding android:left="0dp" android:top="0dp" android:right="0dp" android:bottom="0dp" />
|
||||
</shape>
|
||||
19
samples/IntentPlayground/res/drawable/divider.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 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.
|
||||
-->
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<size android:height="1dp" />
|
||||
<solid android:color="#ffE0E0E0" />
|
||||
</shape>
|
||||
24
samples/IntentPlayground/res/drawable/expand_less_mtrl.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 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.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF9E9E9E"
|
||||
android:pathData="M12,8l-6,6 1.41,1.41L12,10.83l4.59,4.58L18,14z"/>
|
||||
</vector>
|
||||
24
samples/IntentPlayground/res/drawable/expand_more_mtrl.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 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.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF9E9E9E"
|
||||
android:pathData="M16.59,8.59L12,13.17 7.41,8.59 6,10l6,6 6,-6z"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 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.
|
||||
-->
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_expanded="true" android:drawable="@drawable/expand_more_mtrl" />
|
||||
<item android:drawable="@drawable/expand_less_mtrl" />
|
||||
</selector>
|
||||
24
samples/IntentPlayground/res/drawable/info_icon.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 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.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13,17h-2v-6h2v6zM13,9h-2L11,7h2v2z"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 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.
|
||||
-->
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@android:color/holo_green_dark"/>
|
||||
<corners android:radius="2dp"/>
|
||||
<padding android:left="0dp" android:top="0dp" android:right="0dp" android:bottom="0dp" />
|
||||
</shape>
|
||||
31
samples/IntentPlayground/res/layout/activity_main.xml
Normal file
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 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.
|
||||
-->
|
||||
<ScrollView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/scroll_container"
|
||||
tools:context="com.example.android.intentplayground.BaseActivity">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/fragment_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:visibility="visible">
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
72
samples/IntentPlayground/res/layout/activity_node.xml
Normal file
@@ -0,0 +1,72 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 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.
|
||||
-->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:paddingBottom="@dimen/medMargin"
|
||||
android:paddingEnd="@dimen/fullMargin"
|
||||
android:paddingLeft="@dimen/fullMargin"
|
||||
android:paddingRight="@dimen/fullMargin"
|
||||
android:paddingStart="@dimen/fullMargin"
|
||||
android:paddingTop="@dimen/medMargin">
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="@dimen/listIcon"
|
||||
android:layout_height="@dimen/listIcon"
|
||||
android:clipChildren="true">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/color_label"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:src="@drawable/card_background"
|
||||
android:tint="@color/defaultTint" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/activity_label"
|
||||
android:layout_width="@dimen/listLabelTextBox"
|
||||
android:layout_height="@dimen/listLabelTextBox"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/activity_label"
|
||||
android:textAlignment="center"
|
||||
android:textAppearance="@style/medium"
|
||||
android:textColor="@color/labelText"
|
||||
android:textSize="@dimen/titleText" />
|
||||
</FrameLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/activity_name"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/medMargin"
|
||||
android:layout_marginEnd="@dimen/smallMargin"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/activity_name"
|
||||
android:textAppearance="@style/normal" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/intent_button"
|
||||
style="?android:attr/borderlessButtonStyle"
|
||||
android:layout_width="@dimen/listIcon"
|
||||
android:layout_height="@dimen/listIcon"
|
||||
android:src="@drawable/info_icon"
|
||||
android:tint="@color/defaultTint"
|
||||
android:tooltipText="@string/intent_button_tooltip"
|
||||
android:contentDescription="@string/intent_button_description" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 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.
|
||||
-->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="@dimen/medMargin">
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/radio_launchMode"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:tag="activityTag"
|
||||
android:text="@string/activity_name_placeholder"
|
||||
android:textAppearance="@style/medium" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/activity_desc"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/blockMargin"
|
||||
android:text="@string/activity_radio_description"
|
||||
android:textAppearance="@style/caption" />
|
||||
</LinearLayout>
|
||||
23
samples/IntentPlayground/res/layout/checkbox_list_item.xml
Normal file
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 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.
|
||||
-->
|
||||
<CheckBox
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/checkBox_item"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/checkbox_placeholder"
|
||||
android:textAppearance="@style/normal" />
|
||||
27
samples/IntentPlayground/res/layout/dialog_list_item.xml
Normal file
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 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.
|
||||
-->
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/item"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/listItem"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingLeft="@dimen/fullMargin"
|
||||
android:paddingRight="@dimen/fullMargin"
|
||||
android:text="@string/dialog_intent_flag_placeholder"
|
||||
android:textAppearance="@style/normal"
|
||||
android:textSize="@dimen/regularText">
|
||||
|
||||
</TextView>
|
||||
@@ -0,0 +1,79 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 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.
|
||||
-->
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/build_intent_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/smallMargin"
|
||||
android:layout_marginLeft="@dimen/smallMargin"
|
||||
android:layout_marginRight="@dimen/smallMargin"
|
||||
android:layout_marginStart="@dimen/smallMargin"
|
||||
android:layout_marginTop="@dimen/smallMargin"
|
||||
android:background="@drawable/card_background"
|
||||
android:elevation="@dimen/cardElevation"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/medMargin">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/build_intent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/build_intent"
|
||||
android:textAppearance="@style/title" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/flags_hint"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/build_intent_caption" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/build_intent_flags"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="@dimen/smallMargin"
|
||||
android:paddingTop="@dimen/smallMargin" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dividerHeight"
|
||||
android:layout_marginVertical="@dimen/smallMargin"
|
||||
android:background="@drawable/divider" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginVertical="@dimen/smallMargin"
|
||||
android:text="@string/target_activity" />
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/radioGroup_launchMode"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:checkedButton="@+id/radio_launchMode_standard"
|
||||
android:orientation="vertical" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/launch_button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="launchActivity"
|
||||
android:text="@string/launch_activity_button" />
|
||||
</LinearLayout>
|
||||
117
samples/IntentPlayground/res/layout/fragment_current_task.xml
Normal file
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 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.
|
||||
-->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/smallMargin"
|
||||
android:background="@drawable/card_background"
|
||||
android:elevation="@dimen/cardElevation"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="@dimen/medMargin"
|
||||
android:paddingEnd="@dimen/fullMargin"
|
||||
android:paddingLeft="@dimen/fullMargin"
|
||||
android:paddingRight="@dimen/fullMargin"
|
||||
android:paddingStart="@dimen/fullMargin"
|
||||
android:paddingTop="@dimen/medMargin">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/medMargin"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/medMargin"
|
||||
android:text="@string/current_task"
|
||||
android:textAppearance="@style/medium" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/current_task"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/current_task_placeholder"
|
||||
android:textAppearance="@style/normal" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/medMargin"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/medMargin"
|
||||
android:text="@string/current_activity"
|
||||
android:textAppearance="@style/medium" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/current_activity"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/current_activity_placeholder"
|
||||
android:textAppearance="@style/normal" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/medMargin"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/medMargin"
|
||||
android:text="@string/last_task"
|
||||
android:textAppearance="@style/medium" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/last_task"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/last_task_placeholder"
|
||||
android:textAppearance="@style/normal" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/medMargin"
|
||||
android:text="@string/last_activity"
|
||||
android:textAppearance="@style/medium" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/last_activity"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/last_activity_placeholder"
|
||||
android:textAppearance="@style/normal" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
186
samples/IntentPlayground/res/layout/fragment_intent.xml
Normal file
@@ -0,0 +1,186 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 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.
|
||||
-->
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/intent_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/smallMargin"
|
||||
android:layout_marginLeft="@dimen/smallMargin"
|
||||
android:layout_marginRight="@dimen/smallMargin"
|
||||
android:layout_marginStart="@dimen/smallMargin"
|
||||
android:layout_marginTop="@dimen/smallMargin"
|
||||
android:background="@drawable/card_background"
|
||||
android:elevation="@dimen/cardElevation"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/medMargin">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/editText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/current_intent_label_description"
|
||||
android:inputType="none"
|
||||
android:maxLines="1"
|
||||
android:text="@string/intent_fragment_title"
|
||||
android:textAppearance="@style/title" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="@dimen/smallMargin"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/actionLabel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/smallMargin"
|
||||
android:contentDescription="@string/action_label_description"
|
||||
android:text="@string/action_label"
|
||||
android:textAppearance="@style/medium" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/intentAction"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/action_placeholder"
|
||||
android:textAppearance="@style/normal" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="@dimen/smallMargin"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/uriLabel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/smallMargin"
|
||||
android:contentDescription="@string/data_uri_label_description"
|
||||
android:text="@string/data_uri_label"
|
||||
android:textAppearance="@style/medium" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/intentUri"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/data_uri_placeholder"
|
||||
android:textAppearance="@style/normal" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="@dimen/smallMargin"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/typeLabel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/smallMargin"
|
||||
android:contentDescription="@string/type_label_description"
|
||||
android:text="@string/type_label"
|
||||
android:textAppearance="@style/medium" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/intentType"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/type_placeholder"
|
||||
android:textAppearance="@style/normal" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="@dimen/smallMargin"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/packageLabel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/smallMargin"
|
||||
android:contentDescription="@string/package_label_description"
|
||||
android:text="@string/package_label"
|
||||
android:textAppearance="@style/medium" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/intentPackage"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/package_placeholder"
|
||||
android:textAppearance="@style/normal" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="@dimen/smallMargin"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/categoryLabel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/smallMargin"
|
||||
android:contentDescription="@string/category_label_description"
|
||||
android:text="@string/category_label"
|
||||
android:textAppearance="@style/medium" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/intentCategories"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="@dimen/smallMargin"
|
||||
android:paddingTop="@dimen/smallMargin" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/smallMargin"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/flagsLabel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/smallMargin"
|
||||
android:contentDescription="@string/flags_label_description"
|
||||
android:text="@string/flags_label"
|
||||
android:textAppearance="@style/medium" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/intentFlags"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="@dimen/smallMargin"
|
||||
android:paddingTop="@dimen/smallMargin" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 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.
|
||||
-->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:orientation="vertical" android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:minWidth="@dimen/dialogWidth">
|
||||
|
||||
<ListView
|
||||
android:id="@+id/flag_list"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="right"
|
||||
android:orientation="horizontal"
|
||||
android:paddingEnd="@dimen/smallMargin">
|
||||
|
||||
<Button
|
||||
android:id="@+id/copy_flags_button"
|
||||
style="@android:style/Widget.Material.Light.Button.Borderless.Colored"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Use flags for next launch" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/dialog_cancel"
|
||||
style="@android:style/Widget.Material.Light.Button.Borderless.Colored"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/smallMargin"
|
||||
android:text="@android:string/cancel" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
42
samples/IntentPlayground/res/layout/fragment_tree.xml
Normal file
@@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 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.
|
||||
-->
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/task_tree_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/smallMargin"
|
||||
android:background="@drawable/card_background"
|
||||
android:elevation="@dimen/cardElevation"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/task_tree_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/smallMargin"
|
||||
android:layout_marginStart="@dimen/medMargin"
|
||||
android:layout_marginTop="@dimen/medMargin"
|
||||
android:text="@string/task_tree_title"
|
||||
android:textAppearance="@style/title" />
|
||||
<LinearLayout
|
||||
android:id="@+id/task_tree"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:divider="@drawable/divider"
|
||||
android:showDividers="middle"/>
|
||||
</LinearLayout>
|
||||
27
samples/IntentPlayground/res/layout/section_header.xml
Normal file
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 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.
|
||||
-->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical" android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/smallMargin">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/header_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/intent_section_title"
|
||||
android:textAppearance="@style/subsection" />
|
||||
</LinearLayout>
|
||||
20
samples/IntentPlayground/res/layout/simple_list_item.xml
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 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.
|
||||
-->
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/text1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:text="@string/placeholder" />
|
||||
58
samples/IntentPlayground/res/layout/task_node.xml
Normal file
@@ -0,0 +1,58 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 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.
|
||||
-->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:gravity="center_vertical|left"
|
||||
android:layout_height="@dimen/listItem" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/task_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/fullMargin"
|
||||
android:layout_weight="0"
|
||||
android:text="@string/placeholder"
|
||||
android:textAppearance="@style/medium"
|
||||
android:textSize="@dimen/regularText" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/task_id"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0"
|
||||
android:text="@string/placeholder"
|
||||
android:textAppearance="@style/medium"
|
||||
android:textSize="@dimen/regularText" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/num_activities"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/medMargin"
|
||||
android:layout_marginStart="@dimen/medMargin"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/placeholder"
|
||||
android:textSize="@dimen/smallText" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/group_indicator"
|
||||
android:layout_width="@dimen/listControl"
|
||||
android:layout_height="@dimen/listControl"
|
||||
android:layout_marginEnd="@dimen/fullMargin"
|
||||
android:src="@drawable/expand_more_mtrl" />
|
||||
</LinearLayout>
|
||||
60
samples/IntentPlayground/res/layout/tree_node_composite.xml
Normal file
@@ -0,0 +1,60 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 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.
|
||||
-->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical" android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<LinearLayout
|
||||
android:id="@+id/group_item"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" />
|
||||
<LinearLayout
|
||||
android:id="@+id/child_item"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone"
|
||||
android:paddingBottom="@dimen/medMargin" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/move_task_to_front_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="end"
|
||||
android:orientation="horizontal"
|
||||
android:paddingBottom="@dimen/medMargin"
|
||||
android:paddingEnd="@dimen/smallMargin"
|
||||
android:paddingStart="@dimen/smallMargin"
|
||||
android:visibility="gone" >
|
||||
|
||||
<Button
|
||||
android:id="@+id/kill_task_button"
|
||||
style="@style/flatButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0"
|
||||
android:text="@string/kill_task_button" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/move_task_to_front_button"
|
||||
style="@style/flatButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0"
|
||||
android:text="@string/move_to_front" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
BIN
samples/IntentPlayground/res/mipmap-hdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 3.3 KiB |
BIN
samples/IntentPlayground/res/mipmap-hdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 4.1 KiB |
BIN
samples/IntentPlayground/res/mipmap-mdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
samples/IntentPlayground/res/mipmap-mdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
samples/IntentPlayground/res/mipmap-xhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 4.7 KiB |
BIN
samples/IntentPlayground/res/mipmap-xhdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 6.0 KiB |
BIN
samples/IntentPlayground/res/mipmap-xxhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 7.5 KiB |
BIN
samples/IntentPlayground/res/mipmap-xxhdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 9.8 KiB |
BIN
samples/IntentPlayground/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 14 KiB |
43
samples/IntentPlayground/res/values/colors.xml
Normal file
@@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 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.
|
||||
-->
|
||||
<resources>
|
||||
<color name="colorPrimary">#3F51B5</color>
|
||||
<color name="colorPrimaryDark">#303F9F</color>
|
||||
<color name="colorAccent">#FF4081</color>
|
||||
<!-- Material design colours from
|
||||
https://material.io/guidelines/style/color.html#color-color-palette -->
|
||||
<color name="md_red_500">#F44336</color>
|
||||
<color name="md_pink_500">#E91E63</color>
|
||||
<color name="md_purple_500">#9C27B0</color>
|
||||
<color name="md_deep_purple_500">#673AB7</color>
|
||||
<color name="md_indigo_500">#3F51B5</color>
|
||||
<color name="md_blue_500">#2196F3</color>
|
||||
<color name="md_light_blue_500">#03A9F4</color>
|
||||
<color name="md_cyan_500">#00BCD4</color>
|
||||
<color name="md_teal_500">#009688</color>
|
||||
<color name="md_green_500">#4CAF50</color>
|
||||
<color name="md_light_green_500">#8BC34A</color>
|
||||
<color name="md_lime_500">#CDDC39</color>
|
||||
<color name="md_grey_500">#9E9E9E</color>
|
||||
<color name="md_amber_500">#FFC107</color>
|
||||
<color name="md_yellow_500">#FFEB3B</color>
|
||||
<color name="md_orange_500">#FF9800</color>
|
||||
<color name="md_deep_orange_500">#FF5722</color>
|
||||
<color name="md_brown_500">#795548</color>
|
||||
<color name="md_blue_grey_500">#607D8B</color>
|
||||
<color name="defaultTint">@color/md_teal_500</color>
|
||||
<color name="labelText">@android:color/white</color>
|
||||
</resources>
|
||||
17
samples/IntentPlayground/res/values/dimens.xml
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="dialogWidth">@android:dimen/dialog_min_width_major</dimen>
|
||||
<dimen name="smallMargin">8dp</dimen>
|
||||
<dimen name="medMargin">16dp</dimen>
|
||||
<dimen name="fullMargin">24dp</dimen>
|
||||
<dimen name="blockMargin">32dp</dimen>
|
||||
<dimen name="cardElevation">2dp</dimen>
|
||||
<dimen name="titleText">20sp</dimen>
|
||||
<dimen name="regularText">16sp</dimen>
|
||||
<dimen name="smallText">12sp</dimen>
|
||||
<dimen name="listItem">48dp</dimen>
|
||||
<dimen name="listIcon">48dp</dimen>
|
||||
<dimen name="listControl">24dp</dimen>
|
||||
<dimen name="listLabelTextBox">24dp</dimen>
|
||||
<dimen name="dividerHeight">1dp</dimen>
|
||||
</resources>
|
||||
65
samples/IntentPlayground/res/values/strings.xml
Normal file
@@ -0,0 +1,65 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 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.
|
||||
-->
|
||||
<resources>
|
||||
<string name="app_name">Intent Playground</string>
|
||||
<string name="task_id">com.example.android.intentplayground.taskId</string>
|
||||
<string name="activity_index">com.example.android.intentplayground.activityIndex</string>
|
||||
<string name="activity_name">CompName</string>
|
||||
<string name="activity_label">#1</string>
|
||||
<string name="intent_button_description">This button triggers the intent list dialog for this activity</string>
|
||||
<string name="build_intent">Build Intent</string>
|
||||
<string name="build_intent_caption">Select flags with which the intent for the launched activity will be built:</string>
|
||||
<string name="target_activity">Select the target activity:</string>
|
||||
<string name="launch_activity_button">Launch activity</string>
|
||||
<string name="activity_name_placeholder">Activity Name</string>
|
||||
<string name="intent_button_tooltip">View Intent flags</string>
|
||||
<string name="activity_radio_description">Activity description</string>
|
||||
<string name="checkbox_placeholder">CheckBox</string>
|
||||
<string name="dialog_intent_flag_placeholder">intent flag</string>
|
||||
<string name="current_task">Current Task</string>
|
||||
<string name="current_task_placeholder">None</string>
|
||||
<string name="current_activity">Current Activity</string>
|
||||
<string name="current_activity_placeholder">None</string>
|
||||
<string name="last_task">Last Task</string>
|
||||
<string name="last_task_placeholder">None</string>
|
||||
<string name="last_activity">Last Activity</string>
|
||||
<string name="last_activity_placeholder">None</string>
|
||||
<string name="current_intent_label_description">Intent passed to current activity</string>
|
||||
<string name="intent_fragment_title">Current Intent</string>
|
||||
<string name="action_label_description">Label for the action of the current intent</string>
|
||||
<string name="action_label">Action</string>
|
||||
<string name="action_placeholder">which action?</string>
|
||||
<string name="data_uri_label_description">Label for the action of the current intent</string>
|
||||
<string name="data_uri_label">Data URI</string>
|
||||
<string name="data_uri_placeholder">://</string>
|
||||
<string name="type_label_description">Label for the action of the current intent</string>
|
||||
<string name="type_label">Type</string>
|
||||
<string name="type_placeholder">which action?</string>
|
||||
<string name="package_label_description">Label for the action of the current intent</string>
|
||||
<string name="package_label">Package</string>
|
||||
<string name="package_placeholder">which action?</string>
|
||||
<string name="category_label_description">Label for the action of the current intent</string>
|
||||
<string name="category_label">Categories</string>
|
||||
<string name="flags_label_description">Label for the action of the current intent</string>
|
||||
<string name="flags_label">Flags</string>
|
||||
<string name="task_tree_title">Hierarchy</string>
|
||||
<string name="intent_section_title">Title</string>
|
||||
<string name="placeholder">placeholder</string>
|
||||
<string name="kill_task_button">remove</string>
|
||||
<string name="move_to_front">Move to front</string>
|
||||
<string name="current_task_hierarchy_title">Current Hierarchy</string>
|
||||
<string name="expected_task_hierarchy_title">Expected Hierarchy</string>
|
||||
</resources>
|
||||
29
samples/IntentPlayground/res/values/styles.xml
Normal file
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 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.
|
||||
-->
|
||||
<resources>
|
||||
<!-- Base application theme. -->
|
||||
<style name="AppTheme" parent="@android:style/Theme.Material.Light">
|
||||
<item name="android:colorPrimary">@color/colorPrimary</item>
|
||||
<item name="android:colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||
<item name="android:colorAccent">@color/colorAccent</item>
|
||||
</style>
|
||||
<style name="flatButton" parent="@android:style/Widget.Material.Light.Button.Borderless.Colored" />
|
||||
<style name="title" parent="@android:style/TextAppearance.Material.Title" />
|
||||
<style name="normal" parent="@android:style/TextAppearance.Material.Body1" />
|
||||
<style name="medium" parent="@android:style/TextAppearance.Material.Body2" />
|
||||
<style name="caption" parent="@android:style/TextAppearance.Material.Caption" />
|
||||
<style name="subsection" parent="@android:style/TextAppearance.Material.Medium" />
|
||||
</resources>
|
||||
@@ -0,0 +1,126 @@
|
||||
/*
|
||||
* 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 com.example.android.intentplayground;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.FragmentManager;
|
||||
import android.app.FragmentTransaction;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* All of the other activities extend BaseActivity, the shared functionality is implemented here
|
||||
*/
|
||||
public abstract class BaseActivity extends Activity {
|
||||
public final static String LAUNCH_FORWARD = "com.example.android.launchForward";
|
||||
public final static String BUILDER_FRAGMENT = "com.example.android.builderFragment";
|
||||
protected ComponentName mActivityToLaunch;
|
||||
protected List<ActivityManager.AppTask> mTasks;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
if (BuildConfig.DEBUG) Log.d(this.getLocalClassName(), "onCreate()");
|
||||
Intent intent = getIntent();
|
||||
FragmentManager fragmentManager = getFragmentManager();
|
||||
FragmentTransaction transaction = fragmentManager.beginTransaction();
|
||||
transaction.add(R.id.fragment_container, new CurrentTaskFragment());
|
||||
TreeFragment currentTaskFrag = new TreeFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putString(TreeFragment.FRAGMENT_TITLE,
|
||||
getString(R.string.current_task_hierarchy_title));
|
||||
currentTaskFrag.setArguments(args);
|
||||
transaction.add(R.id.fragment_container, currentTaskFrag);
|
||||
|
||||
if (intent.hasExtra(TestBase.EXPECTED_HIERARCHY)) {
|
||||
// That means this activity was launched as a test show the result fragment
|
||||
TreeFragment expectedView = new TreeFragment();
|
||||
Bundle expectedArgs = new Bundle();
|
||||
expectedArgs.putParcelable(TreeFragment.TREE_NODE,
|
||||
intent.getParcelableExtra(TestBase.EXPECTED_HIERARCHY));
|
||||
expectedArgs.putString(TreeFragment.FRAGMENT_TITLE,
|
||||
getString(R.string.expected_task_hierarchy_title));
|
||||
expectedView.setArguments(expectedArgs);
|
||||
transaction.add(R.id.fragment_container, expectedView);
|
||||
}
|
||||
|
||||
transaction.add(R.id.fragment_container, new IntentFragment());
|
||||
transaction.add(R.id.fragment_container, new IntentBuilderFragment(), BUILDER_FRAGMENT);
|
||||
transaction.commit();
|
||||
|
||||
if (intent.hasExtra(LAUNCH_FORWARD)) {
|
||||
ArrayList<Intent> intents = intent.getParcelableArrayListExtra(LAUNCH_FORWARD);
|
||||
if (!intents.isEmpty()) {
|
||||
Intent nextIntent = intents.remove(0);
|
||||
nextIntent.putParcelableArrayListExtra(LAUNCH_FORWARD, intents);
|
||||
if (BuildConfig.DEBUG) {
|
||||
Log.d(this.getLocalClassName(),
|
||||
LAUNCH_FORWARD + " " + nextIntent.getComponent().toString());
|
||||
}
|
||||
startActivity(nextIntent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Launches activity with the selected options
|
||||
*/
|
||||
public void launchActivity(View view) {
|
||||
Intent customIntent = new Intent();
|
||||
LinearLayout flagBuilder = findViewById(R.id.build_intent_flags);
|
||||
// Gather flags from flag builder checkbox list
|
||||
childrenOfGroup(flagBuilder, CheckBox.class)
|
||||
.forEach(checkbox -> {
|
||||
int flagVal = FlagUtils.value(checkbox.getText().toString());
|
||||
if (checkbox.isChecked()) customIntent.addFlags(flagVal);
|
||||
else customIntent.removeFlags(flagVal);
|
||||
});
|
||||
customIntent.setComponent(mActivityToLaunch);
|
||||
startActivity(customIntent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method to retrieve children of a certain type from a {@link ViewGroup}
|
||||
* @param group the ViewGroup to retrieve children from
|
||||
*/
|
||||
protected static <T> List<T> childrenOfGroup(ViewGroup group, Class<T> viewType) {
|
||||
List<T> list = new LinkedList<>();
|
||||
for (int i = 0; i < group.getChildCount(); i++) {
|
||||
View v = group.getChildAt(i);
|
||||
if (viewType.isAssignableFrom(v.getClass())) list.add(viewType.cast(v));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNewIntent(Intent intent) {
|
||||
super.onNewIntent(intent);
|
||||
setIntent(intent);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* 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 com.example.android.intentplayground;
|
||||
|
||||
/**
|
||||
* An activity with clearTaskOnLaunch flag set in AndroidManifest.xml
|
||||
*/
|
||||
public class ClearTaskOnLaunchActivity extends BaseActivity {}
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* 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 com.example.android.intentplayground;
|
||||
|
||||
/**
|
||||
* An activity with documentLaunch="always" set in AndroidManifest.xml
|
||||
*/
|
||||
public class DocumentLaunchAlwaysActivity extends BaseActivity {}
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* 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 com.example.android.intentplayground;
|
||||
|
||||
/**
|
||||
* An activity with documentLaunch="intoExisting" set in AndroidManifest.xml
|
||||
*/
|
||||
public class DocumentLaunchIntoActivity extends BaseActivity {}
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* 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 com.example.android.intentplayground;
|
||||
|
||||
/**
|
||||
* An activity with documentLaunch="never" set in AndroidManifest.xml
|
||||
*/
|
||||
public class DocumentLaunchNeverActivity extends BaseActivity {}
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* 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 com.example.android.intentplayground;
|
||||
|
||||
import android.content.ComponentName;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
|
||||
/**
|
||||
* A singleInstance activity that is responsible for a launching a bootstrap stack of activities
|
||||
*/
|
||||
public class LauncherActivity extends BaseActivity {
|
||||
private TestBase mTester;
|
||||
public static final String TAG = "LauncherActivity";
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
Node mRoot = new Node(new ComponentName(this, LauncherActivity.class));
|
||||
// Describe initial setup of tasks
|
||||
// create singleTask, singleInstance, and two documents in separate tasks
|
||||
mRoot.addChild( new Node(new ComponentName(this, SingleTaskActivity.class)))
|
||||
.addChild( new Node(new ComponentName(this, DocumentLaunchAlwaysActivity.class)))
|
||||
.addChild( new Node(new ComponentName(this, DocumentLaunchIntoActivity.class)));
|
||||
// Create three tasks with three activities each, with affinity set
|
||||
Node taskAffinity1 = new Node(new ComponentName(this, TaskAffinity1Activity.class));
|
||||
taskAffinity1
|
||||
.addChild(new Node(new ComponentName(this, TaskAffinity1Activity.class)))
|
||||
.addChild(new Node(new ComponentName(this, TaskAffinity1Activity.class)));
|
||||
Node taskAffinity2 = new Node(new ComponentName(this, ClearTaskOnLaunchActivity.class));
|
||||
taskAffinity2
|
||||
.addChild(new Node(new ComponentName(this, TaskAffinity2Activity.class)))
|
||||
.addChild(new Node(new ComponentName(this, TaskAffinity2Activity.class)));
|
||||
Node taskAffinity3 = new Node(new ComponentName(this, TaskAffinity3Activity.class));
|
||||
taskAffinity3
|
||||
.addChild(new Node(new ComponentName(this, TaskAffinity3Activity.class)))
|
||||
.addChild(new Node(new ComponentName(this, TaskAffinity3Activity.class)));
|
||||
mRoot.addChild(taskAffinity1).addChild(taskAffinity2).addChild(taskAffinity3);
|
||||
mTester = new TestBase(this, mRoot);
|
||||
mTester.setupActivities(TestBase.LaunchStyle.TASK_STACK_BUILDER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Launches activity with the selected options
|
||||
*/
|
||||
public void launchActivity(Intent customIntent) {
|
||||
customIntent.putExtra(TestBase.EXPECTED_HIERARCHY, mTester.computeExpected(customIntent));
|
||||
startActivity(customIntent);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* 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 com.example.android.intentplayground;
|
||||
|
||||
/**
|
||||
* An activity with noHistory="true" set in AndroidManifest.xml
|
||||
*/
|
||||
public class NoHistoryActivity extends BaseActivity {}
|
||||
@@ -0,0 +1,76 @@
|
||||
/** TODO: http://go/java-style#javadoc */
|
||||
package com.example.android.intentplayground;
|
||||
|
||||
import android.app.Fragment;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.view.View;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
class TestBase {
|
||||
static final String EXPECTED_HIERARCHY = "";
|
||||
enum LaunchStyle { TASK_STACK_BUILDER, COMMAND_LINE, LAUNCH_FORWARD }
|
||||
TestBase(Context context, Node hierarchy) {}
|
||||
void setupActivities(LaunchStyle style) {}
|
||||
Node computeExpected(Intent intent) { return null; }
|
||||
static Node describeTaskHierarchy(Context context) { return null; }
|
||||
|
||||
}
|
||||
class TreeFragment extends Fragment {
|
||||
static final String TREE_NODE = "";
|
||||
static final String FRAGMENT_TITLE = "";
|
||||
}
|
||||
class CurrentTaskFragment extends Fragment {}
|
||||
class IntentFragment extends Fragment {}
|
||||
class IntentBuilderFragment extends Fragment implements View.OnClickListener {
|
||||
ComponentName mActivityToLaunch;
|
||||
void selectLaunchMode(View view) {}
|
||||
public void onClick(View view) {}
|
||||
void clearFlags() {}
|
||||
void selectFlags(List<String> flags) {}
|
||||
}
|
||||
class BuildConfig {
|
||||
static final boolean DEBUG = true;
|
||||
}
|
||||
class Node implements Parcelable, Comparable<Node> {
|
||||
ComponentName name;
|
||||
boolean isTaskNode;
|
||||
int taskId;
|
||||
static final String TAG = "";
|
||||
public static final Creator<Node> CREATOR = new Creator<Node>() {
|
||||
@Override
|
||||
public Node createFromParcel(Parcel in) {
|
||||
return new Node(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node[] newArray(int size) {
|
||||
return new Node[size];
|
||||
}
|
||||
};;
|
||||
List<Node> children;
|
||||
Node(ComponentName data) {}
|
||||
Node(int taskId) {}
|
||||
Node(Node other) {}
|
||||
Node(Parcel in) {}
|
||||
Node addChild(Node child) { return null; }
|
||||
boolean equals(Node other) { return false; }
|
||||
public int compareTo(Node o) {return 0;}
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {}
|
||||
@Override
|
||||
public int describeContents() { return 0; }
|
||||
}
|
||||
class FlagUtils {
|
||||
static List<String> discoverFlags(Intent intent) { return null; }
|
||||
static List<String> intentFlags() { return null; }
|
||||
static Map<String, List<String>> intentFlagsByCategory() { return null; }
|
||||
static int value(String flagName) { return 0; }
|
||||
static List<String> discoverActivityFlags() { return null; }
|
||||
static String camelify(String snake) { return null; }
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* 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 com.example.android.intentplayground;
|
||||
|
||||
/**
|
||||
* An activity with launchMode="singleInstance" set in AndroidManifest.xml
|
||||
*/
|
||||
public class SingleInstanceActivity extends BaseActivity {}
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* 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 com.example.android.intentplayground;
|
||||
|
||||
/**
|
||||
* An activity with launchMode="singleTask" set in AndroidManifest.xml
|
||||
*/
|
||||
public class SingleTaskActivity extends BaseActivity {}
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* 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 com.example.android.intentplayground;
|
||||
|
||||
/**
|
||||
* An activity with launchMode="singleTop" set in AndroidManifest.xml
|
||||
*/
|
||||
public class SingleTopActivity extends BaseActivity {}
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* 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 com.example.android.intentplayground;
|
||||
|
||||
/**
|
||||
* An activity with taskAffinity=".t1" set in AndroidManifest.xml
|
||||
*/
|
||||
public class TaskAffinity1Activity extends BaseActivity {}
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* 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 com.example.android.intentplayground;
|
||||
|
||||
/**
|
||||
* An activity with taskAffinity=".t2" set in AndroidManifest.xml
|
||||
*/
|
||||
public class TaskAffinity2Activity extends BaseActivity {}
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* 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 com.example.android.intentplayground;
|
||||
|
||||
/**
|
||||
* An activity with taskAffinity=".t3" set in AndroidManifest.xml
|
||||
*/
|
||||
public class TaskAffinity3Activity extends BaseActivity {}
|
||||