[Wi-Fi DPP] Refine Wi-Fi DPP UI layouts with SUW library
1. Use GlifLayout in all fragments 2. Fragments use 32dp icon instead of 48 dp 3. Replace ScrollView & ProgressBar & Header & Footer of original layout with GlifLayout design 4. Remove ActionBar (no more back button on screen top) Bug: 129021867 Test: manual Change-Id: I2fda48cb7f7819b2c8dd85c10d39e1f187463bd8
This commit is contained in:
@@ -15,8 +15,8 @@
|
||||
-->
|
||||
<vector
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:width="16dp"
|
||||
android:height="16dp"
|
||||
android:viewportWidth="64.0"
|
||||
android:viewportHeight="64.0">
|
||||
<path
|
||||
|
@@ -16,15 +16,15 @@
|
||||
<layer-list
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:drawable="@drawable/ic_devices_other_opaque_black"
|
||||
android:width="@dimen/wifi_dpp_fragment_icon_width_height"
|
||||
android:height="@dimen/wifi_dpp_fragment_icon_width_height"
|
||||
android:drawable="@drawable/ic_devices_other_32dp"
|
||||
android:width="40dp"
|
||||
android:height="40dp"
|
||||
android:gravity="center"/>
|
||||
|
||||
<item
|
||||
android:drawable="@drawable/ic_check_circle_green"
|
||||
android:top="28dp"
|
||||
android:left="44dp"
|
||||
android:top="16dp"
|
||||
android:left="32dp"
|
||||
android:gravity="center"/>
|
||||
|
||||
</layer-list>
|
@@ -14,10 +14,11 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:width="32dp"
|
||||
android:height="32dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
android:viewportHeight="24"
|
||||
android:tint="?android:attr/colorAccent">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M3,6h18L21,4L3,4c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h4v-2L3,18L3,6zM13,12L9,12v1.78c-0.61,0.55 -1,1.33 -1,2.22 0,0.89 0.39,1.67 1,2.22L9,20h4v-1.78c0.61,-0.55 1,-1.34 1,-2.22s-0.39,-1.67 -1,-2.22L13,12zM11,17.5c-0.83,0 -1.5,-0.67 -1.5,-1.5s0.67,-1.5 1.5,-1.5 1.5,0.67 1.5,1.5 -0.67,1.5 -1.5,1.5zM22,8h-6c-0.5,0 -1,0.5 -1,1v10c0,0.5 0.5,1 1,1h6c0.5,0 1,-0.5 1,-1L23,9c0,-0.5 -0.5,-1 -1,-1zM21,18h-4v-8h4v8z"/>
|
25
res/drawable/ic_qrcode_32dp.xml
Normal file
25
res/drawable/ic_qrcode_32dp.xml
Normal file
@@ -0,0 +1,25 @@
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="32dp"
|
||||
android:height="32dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="?android:attr/colorAccent">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M3,9h6V3H3V9zM5,5h2v2H5V5zM15,3v6h6V3H15zM19,7h-2V5h2V7zM3,21h6v-6H3V21zM5,17h2v2H5V17zM13,15v2h-2v-2v-2v-2h2v2h2v-2h2v2v2H13zM17,19h4v2h-4h-2v-2v-2h2V19zM19,11h2v6h-2V11zM7,11h2v2H7V11zM11,19h2v2h-2V19zM5,13H3v-2h2V13zM13,9h-2V3h2V9z"/>
|
||||
</vector>
|
25
res/drawable/ic_scan_32dp.xml
Normal file
25
res/drawable/ic_scan_32dp.xml
Normal file
@@ -0,0 +1,25 @@
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="32dp"
|
||||
android:height="32dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="?android:attr/colorAccent">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M3,9h6V3H3V9zM5,5h2v2H5V5zM15,3v6h6V3H15zM19,7h-2V5h2V7zM3,21h6v-6H3V21zM5,17h2v2H5V17zM17,15h4v2h-4v4h-2v-4h-4v-2h4v-4h2V15zM7,11h2v2H7V11zM5,13H3v-2h2V13zM13,9h-2V3h2V9z"/>
|
||||
</vector>
|
22
res/drawable/ic_wifi_signal_4_32dp.xml
Normal file
22
res/drawable/ic_wifi_signal_4_32dp.xml
Normal file
@@ -0,0 +1,22 @@
|
||||
<?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.
|
||||
-->
|
||||
<com.android.settings.widget.TintDrawable
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:drawable="@*android:drawable/ic_wifi_signal_4"
|
||||
android:width="32dp"
|
||||
android:height="32dp"
|
||||
android:tint="?android:attr/colorAccent"/>
|
@@ -15,33 +15,33 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<LinearLayout
|
||||
<com.google.android.setupdesign.GlifLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/root"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:icon="@drawable/ic_scan_32dp">
|
||||
|
||||
<ScrollView
|
||||
<LinearLayout
|
||||
style="@style/SudContentFrame"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@android:id/summary"
|
||||
style="@style/TextAppearance.SudGlifBody"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="?attr/sudMarginSides"
|
||||
android:layout_marginEnd="?attr/sudMarginSides"
|
||||
android:textAlignment="center"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center_horizontal">
|
||||
|
||||
<include layout="@layout/wifi_dpp_fragment_header"/>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/indeterminate_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:indeterminate="true"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
style="?android:attr/progressBarStyleHorizontal"/>
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="@dimen/qrcode_preview_size"
|
||||
@@ -58,18 +58,18 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/error_message"
|
||||
style="@style/TextAppearance.ErrorText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:layout_marginStart="?attr/sudMarginSides"
|
||||
android:layout_marginEnd="?attr/sudMarginSides"
|
||||
android:textAlignment="center"
|
||||
android:textColor="?android:attr/colorError"
|
||||
android:visibility="invisible"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</com.google.android.setupdesign.GlifLayout>
|
||||
|
||||
|
@@ -15,62 +15,52 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
<com.google.android.setupdesign.GlifLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/root"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:icon="@drawable/ic_devices_other_32dp">
|
||||
|
||||
<LinearLayout
|
||||
style="@style/SudContentFrame"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical">
|
||||
|
||||
<include layout="@layout/wifi_dpp_fragment_header"/>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/indeterminate_bar"
|
||||
android:layout_width="match_parent"
|
||||
<TextView
|
||||
android:id="@android:id/summary"
|
||||
style="@style/TextAppearance.SudGlifBody"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:indeterminate="true"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:visibility="invisible"/>
|
||||
android:layout_marginStart="?attr/sudMarginSides"
|
||||
android:layout_marginEnd="?attr/sudMarginSides"
|
||||
android:textAlignment="center"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/wifi_ap_picture_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/wifi_dpp_success"
|
||||
android:scaleType="fitCenter"
|
||||
app:layout_constraintTop_toBottomOf="@+id/header"/>
|
||||
android:scaleType="fitCenter"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/choose_different_network"
|
||||
style="@style/SudGlifButton.Secondary"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toBottomOf="@+id/wifi_ap_picture_view"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="@string/wifi_dpp_choose_different_network"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
</LinearLayout>
|
||||
|
||||
<include
|
||||
layout="@layout/wifi_dpp_fragment_footer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</com.google.android.setupdesign.GlifLayout>
|
||||
|
||||
|
@@ -15,22 +15,27 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
<com.google.android.setupdesign.GlifLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/root"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:icon="@drawable/ic_wifi_signal_4_32dp">
|
||||
|
||||
<LinearLayout
|
||||
style="@style/SudContentFrame"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@+id/footer">
|
||||
android:orientation="vertical">
|
||||
|
||||
<include layout="@layout/wifi_dpp_fragment_header"/>
|
||||
<TextView
|
||||
android:id="@android:id/summary"
|
||||
style="@style/TextAppearance.SudGlifBody"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="?attr/sudMarginSides"
|
||||
android:layout_marginEnd="?attr/sudMarginSides"
|
||||
android:textAlignment="center"/>
|
||||
|
||||
<LinearLayout android:id="@+id/wifi_network_list_container"
|
||||
android:layout_width="match_parent"
|
||||
@@ -38,12 +43,5 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include
|
||||
android:id="@+id/footer"
|
||||
layout="@layout/wifi_dpp_fragment_footer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</com.google.android.setupdesign.GlifLayout>
|
||||
|
||||
|
@@ -1,43 +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="wrap_content"
|
||||
style="@style/SudGlifButtonBar">
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_left"
|
||||
style="@style/SudGlifButton.Secondary"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start"/>
|
||||
|
||||
<Space
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_right"
|
||||
style="@style/SudGlifButton.Primary"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end"/>
|
||||
|
||||
</LinearLayout>
|
@@ -1,74 +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"
|
||||
style="@style/EntityHeader"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@android:id/icon"
|
||||
android:layout_width="@dimen/wifi_dpp_fragment_icon_width_height"
|
||||
android:layout_height="@dimen/wifi_dpp_fragment_icon_width_height"
|
||||
android:scaleType="fitCenter"/>
|
||||
|
||||
<!-- Special header icon only for ic_devices_check_circle_green -->
|
||||
<ImageView
|
||||
android:id="@+id/devices_check_circle_green_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_devices_check_circle_green"
|
||||
android:scaleType="fitCenter"/>
|
||||
|
||||
<!-- Add title_summary_container to group content for Talkback -->
|
||||
<LinearLayout
|
||||
android:id="@+id/title_summary_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:focusable="true">
|
||||
|
||||
<TextView
|
||||
android:id="@android:id/title"
|
||||
style="@style/TextAppearance.EntityHeaderTitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:textAlignment="center"
|
||||
android:layout_marginTop="8dp"
|
||||
android:paddingStart="32dp"
|
||||
android:paddingEnd="32dp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@android:id/summary"
|
||||
style="@style/TextAppearance.EntityHeaderSummary"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="false"
|
||||
android:gravity="center_horizontal"
|
||||
android:textAlignment="center"
|
||||
android:layout_marginTop="2dp"
|
||||
android:paddingStart="32dp"
|
||||
android:paddingEnd="32dp"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
@@ -15,24 +15,33 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<LinearLayout
|
||||
<com.google.android.setupdesign.GlifLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/root"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:icon="@drawable/ic_qrcode_32dp">
|
||||
|
||||
<LinearLayout
|
||||
style="@style/SudContentFrame"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical">
|
||||
|
||||
<include layout="@layout/wifi_dpp_fragment_header"/>
|
||||
<TextView
|
||||
android:id="@android:id/summary"
|
||||
style="@style/TextAppearance.SudGlifBody"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="?attr/sudMarginSides"
|
||||
android:layout_marginEnd="?attr/sudMarginSides"
|
||||
android:textAlignment="center"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/qrcode_view"
|
||||
@@ -50,7 +59,7 @@
|
||||
android:textColor="?android:attr/textColorSecondary"/>
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</com.google.android.setupdesign.GlifLayout>
|
||||
|
||||
|
@@ -15,33 +15,33 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<LinearLayout
|
||||
<com.google.android.setupdesign.GlifLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/root"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:icon="@drawable/ic_scan_32dp">
|
||||
|
||||
<LinearLayout
|
||||
style="@style/SudContentFrame"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center_horizontal">
|
||||
|
||||
<include layout="@layout/wifi_dpp_fragment_header"/>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/indeterminate_bar"
|
||||
android:layout_width="match_parent"
|
||||
<TextView
|
||||
android:id="@android:id/summary"
|
||||
style="@style/TextAppearance.SudGlifBody"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:indeterminate="true"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
style="?android:attr/progressBarStyleHorizontal"/>
|
||||
android:layout_marginStart="?attr/sudMarginSides"
|
||||
android:layout_marginEnd="?attr/sudMarginSides"
|
||||
android:textAlignment="center"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="wrap_content"
|
||||
@@ -59,18 +59,18 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/error_message"
|
||||
style="@style/TextAppearance.ErrorText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:layout_marginStart="?attr/sudMarginSides"
|
||||
android:layout_marginEnd="?attr/sudMarginSides"
|
||||
android:textAlignment="center"
|
||||
android:textColor="?android:attr/colorError"
|
||||
android:visibility="invisible"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</com.google.android.setupdesign.GlifLayout>
|
||||
|
||||
|
@@ -400,9 +400,6 @@
|
||||
<dimen name="qrcode_size">264dp</dimen>
|
||||
<dimen name="qrcode_preview_size">360dp</dimen>
|
||||
|
||||
<!-- Wi-Fi DPP fragment icon size -->
|
||||
<dimen name="wifi_dpp_fragment_icon_width_height">48dp</dimen>
|
||||
|
||||
<!-- Elevation of bluetooth icon -->
|
||||
<dimen name="bt_icon_elevation">4dp</dimen>
|
||||
|
||||
|
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.android.settings.wifi.dpp;
|
||||
|
||||
import android.app.ActionBar;
|
||||
import android.app.Activity;
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
@@ -32,7 +31,6 @@ import android.view.ViewGroup;
|
||||
import android.view.accessibility.AccessibilityEvent;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ProgressBar;
|
||||
|
||||
import androidx.lifecycle.ViewModelProviders;
|
||||
|
||||
@@ -47,11 +45,8 @@ import java.util.concurrent.Executor;
|
||||
public class WifiDppAddDeviceFragment extends WifiDppQrCodeBaseFragment {
|
||||
private static final String TAG = "WifiDppAddDeviceFragment";
|
||||
|
||||
private ProgressBar mProgressBar;
|
||||
private ImageView mWifiApPictureView;
|
||||
private Button mChooseDifferentNetwork;
|
||||
private Button mButtonLeft;
|
||||
private Button mButtonRight;
|
||||
|
||||
private int mLatestStatusCode = WifiDppUtils.EASY_CONNECT_EVENT_FAILURE_NONE;
|
||||
|
||||
@@ -83,16 +78,16 @@ public class WifiDppAddDeviceFragment extends WifiDppQrCodeBaseFragment {
|
||||
}
|
||||
|
||||
private void showSuccessUi(boolean isConfigurationChange) {
|
||||
setHeaderIconImageResource(R.drawable.ic_devices_check_circle_green);
|
||||
mTitle.setText(R.string.wifi_dpp_wifi_shared_with_device);
|
||||
mProgressBar.setVisibility(isGoingInitiator() ? View.VISIBLE : View.INVISIBLE);
|
||||
setHeaderIconImageResource(R.drawable.ic_devices_check_circle_green_32dp);
|
||||
setHeaderTitle(R.string.wifi_dpp_wifi_shared_with_device);
|
||||
setProgressBarShown(isGoingInitiator());
|
||||
mSummary.setVisibility(View.INVISIBLE);
|
||||
mWifiApPictureView.setImageResource(R.drawable.wifi_dpp_success);
|
||||
mChooseDifferentNetwork.setVisibility(View.INVISIBLE);
|
||||
mButtonLeft.setText(R.string.wifi_dpp_add_another_device);
|
||||
mButtonLeft.setOnClickListener(v -> getFragmentManager().popBackStack());
|
||||
mButtonRight.setText(R.string.done);
|
||||
mButtonRight.setOnClickListener(v -> {
|
||||
mLeftButton.setText(getContext(), R.string.wifi_dpp_add_another_device);
|
||||
mLeftButton.setOnClickListener(v -> getFragmentManager().popBackStack());
|
||||
mRightButton.setText(getContext(), R.string.done);
|
||||
mRightButton.setOnClickListener(v -> {
|
||||
final Activity activity = getActivity();
|
||||
activity.setResult(Activity.RESULT_OK);
|
||||
activity.finish();
|
||||
@@ -100,7 +95,6 @@ public class WifiDppAddDeviceFragment extends WifiDppQrCodeBaseFragment {
|
||||
|
||||
if (!isConfigurationChange) {
|
||||
mLatestStatusCode = WifiDppUtils.EASY_CONNECT_EVENT_SUCCESS;
|
||||
changeFocusAndAnnounceChange(mButtonRight, mTitle);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,27 +153,26 @@ public class WifiDppAddDeviceFragment extends WifiDppQrCodeBaseFragment {
|
||||
throw(new IllegalStateException("Unexpected Wi-Fi DPP error"));
|
||||
}
|
||||
|
||||
mTitle.setText(R.string.wifi_dpp_could_not_add_device);
|
||||
setHeaderTitle(R.string.wifi_dpp_could_not_add_device);
|
||||
mWifiApPictureView.setImageResource(R.drawable.wifi_dpp_error);
|
||||
mChooseDifferentNetwork.setVisibility(View.INVISIBLE);
|
||||
if (hasRetryButton(code)) {
|
||||
mButtonRight.setText(R.string.retry);
|
||||
mRightButton.setText(getContext(), R.string.retry);
|
||||
} else {
|
||||
mButtonRight.setText(R.string.done);
|
||||
mButtonRight.setOnClickListener(v -> getActivity().finish());
|
||||
mButtonLeft.setVisibility(View.INVISIBLE);
|
||||
mRightButton.setText(getContext(), R.string.done);
|
||||
mRightButton.setOnClickListener(v -> getActivity().finish());
|
||||
mLeftButton.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
|
||||
if (isGoingInitiator()) {
|
||||
mSummary.setText(R.string.wifi_dpp_sharing_wifi_with_this_device);
|
||||
}
|
||||
|
||||
mProgressBar.setVisibility(isGoingInitiator() ? View.VISIBLE : View.INVISIBLE);
|
||||
mButtonRight.setVisibility(isGoingInitiator() ? View.INVISIBLE : View.VISIBLE);
|
||||
setProgressBarShown(isGoingInitiator());
|
||||
mRightButton.setVisibility(isGoingInitiator() ? View.INVISIBLE : View.VISIBLE);
|
||||
|
||||
if (!isConfigurationChange) {
|
||||
mLatestStatusCode = code;
|
||||
changeFocusAndAnnounceChange(mButtonRight, mSummary);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,16 +221,6 @@ public class WifiDppAddDeviceFragment extends WifiDppQrCodeBaseFragment {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
|
||||
final ActionBar actionBar = getActivity().getActionBar();
|
||||
if (actionBar != null) {
|
||||
actionBar.hide();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
@@ -249,17 +232,15 @@ public class WifiDppAddDeviceFragment extends WifiDppQrCodeBaseFragment {
|
||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
setHeaderIconImageResource(R.drawable.ic_devices_other_opaque_black);
|
||||
|
||||
mProgressBar = view.findViewById(R.id.indeterminate_bar);
|
||||
setHeaderIconImageResource(R.drawable.ic_devices_other_32dp);
|
||||
|
||||
final WifiQrCode wifiQrCode = ((WifiDppConfiguratorActivity) getActivity())
|
||||
.getWifiDppQrCode();
|
||||
final String information = wifiQrCode.getInformation();
|
||||
if (TextUtils.isEmpty(information)) {
|
||||
mTitle.setText(R.string.wifi_dpp_device_found);
|
||||
setHeaderTitle(R.string.wifi_dpp_device_found);
|
||||
} else {
|
||||
mTitle.setText(information);
|
||||
setHeaderTitle(information);
|
||||
}
|
||||
|
||||
updateSummary();
|
||||
@@ -270,31 +251,26 @@ public class WifiDppAddDeviceFragment extends WifiDppQrCodeBaseFragment {
|
||||
mClickChooseDifferentNetworkListener.onClickChooseDifferentNetwork()
|
||||
);
|
||||
|
||||
mButtonLeft = view.findViewById(R.id.button_left);
|
||||
mButtonLeft.setText(R.string.cancel);
|
||||
mButtonLeft.setOnClickListener(v -> getActivity().finish());
|
||||
mLeftButton.setText(getContext(), R.string.cancel);
|
||||
mLeftButton.setOnClickListener(v -> getActivity().finish());
|
||||
|
||||
mButtonRight = view.findViewById(R.id.button_right);
|
||||
mButtonRight.setText(R.string.wifi_dpp_share_wifi);
|
||||
mButtonRight.setOnClickListener(v -> {
|
||||
mProgressBar.setVisibility(View.VISIBLE);
|
||||
mButtonRight.setVisibility(View.INVISIBLE);
|
||||
mRightButton.setText(getContext(), R.string.wifi_dpp_share_wifi);
|
||||
mRightButton.setOnClickListener(v -> {
|
||||
setProgressBarShown(true);
|
||||
mRightButton.setVisibility(View.INVISIBLE);
|
||||
startWifiDppConfiguratorInitiator();
|
||||
updateSummary();
|
||||
mTitleSummaryContainer.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_FOCUSED);
|
||||
});
|
||||
|
||||
if (savedInstanceState != null) {
|
||||
if (mLatestStatusCode == WifiDppUtils.EASY_CONNECT_EVENT_SUCCESS) {
|
||||
showSuccessUi(/* isConfigurationChange */ true);
|
||||
} else if (mLatestStatusCode == WifiDppUtils.EASY_CONNECT_EVENT_FAILURE_NONE) {
|
||||
mProgressBar.setVisibility(isGoingInitiator() ? View.VISIBLE : View.INVISIBLE);
|
||||
mButtonRight.setVisibility(isGoingInitiator() ? View.INVISIBLE : View.VISIBLE);
|
||||
setProgressBarShown(isGoingInitiator());
|
||||
mRightButton.setVisibility(isGoingInitiator() ? View.INVISIBLE : View.VISIBLE);
|
||||
} else {
|
||||
showErrorUi(mLatestStatusCode, /* isConfigurationChange */ true);
|
||||
}
|
||||
} else {
|
||||
changeFocusAndAnnounceChange(mButtonRight, mTitleSummaryContainer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -374,4 +350,9 @@ public class WifiDppAddDeviceFragment extends WifiDppQrCodeBaseFragment {
|
||||
focusView.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_FOCUSED);
|
||||
announceView.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isFooterAvailable() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.android.settings.wifi.dpp;
|
||||
|
||||
import android.app.ActionBar;
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
@@ -24,7 +23,6 @@ import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.accessibility.AccessibilityEvent;
|
||||
import android.widget.Button;
|
||||
import android.widget.ListView;
|
||||
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
@@ -40,8 +38,6 @@ public class WifiDppChooseSavedWifiNetworkFragment extends WifiDppQrCodeBaseFrag
|
||||
private static final String TAG_FRAGMENT_WIFI_NETWORK_LIST = "wifi_network_list_fragment";
|
||||
|
||||
private ListView mSavedWifiNetworkList;
|
||||
private Button mButtonLeft;
|
||||
private Button mButtonRight;
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
@@ -52,11 +48,6 @@ public class WifiDppChooseSavedWifiNetworkFragment extends WifiDppQrCodeBaseFrag
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
|
||||
final ActionBar actionBar = getActivity().getActionBar();
|
||||
if (actionBar != null) {
|
||||
actionBar.hide();
|
||||
}
|
||||
|
||||
/** Embeded WifiNetworkListFragment as child fragment within
|
||||
* WifiDppChooseSavedWifiNetworkFragment. */
|
||||
final FragmentManager fragmentManager = getChildFragmentManager();
|
||||
@@ -82,14 +73,11 @@ public class WifiDppChooseSavedWifiNetworkFragment extends WifiDppQrCodeBaseFrag
|
||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
setHeaderIconImageResource(R.drawable.ic_wifi_signal_4);
|
||||
|
||||
mTitle.setText(R.string.wifi_dpp_choose_network);
|
||||
setHeaderTitle(R.string.wifi_dpp_choose_network);
|
||||
mSummary.setText(R.string.wifi_dpp_choose_network_to_connect_device);
|
||||
|
||||
mButtonLeft = view.findViewById(R.id.button_left);
|
||||
mButtonLeft.setText(R.string.cancel);
|
||||
mButtonLeft.setOnClickListener(v -> {
|
||||
mLeftButton.setText(getContext(), R.string.cancel);
|
||||
mLeftButton.setOnClickListener(v -> {
|
||||
String action = null;
|
||||
final Intent intent = getActivity().getIntent();
|
||||
if (intent != null) {
|
||||
@@ -104,13 +92,11 @@ public class WifiDppChooseSavedWifiNetworkFragment extends WifiDppQrCodeBaseFrag
|
||||
}
|
||||
});
|
||||
|
||||
mButtonRight = view.findViewById(R.id.button_right);
|
||||
mButtonRight.setVisibility(View.GONE);
|
||||
mRightButton.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if (savedInstanceState == null) {
|
||||
// For Talkback to describe this fragment
|
||||
mTitleSummaryContainer.sendAccessibilityEvent(
|
||||
AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
|
||||
}
|
||||
@Override
|
||||
protected boolean isFooterAvailable() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -16,9 +16,9 @@
|
||||
|
||||
package com.android.settings.wifi.dpp;
|
||||
|
||||
import android.app.ActionBar;
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Resources;
|
||||
import android.net.Uri;
|
||||
import android.net.wifi.WifiConfiguration;
|
||||
import android.net.wifi.WifiInfo;
|
||||
@@ -33,6 +33,7 @@ import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SetupWizardUtils;
|
||||
import com.android.settings.core.InstrumentedActivity;
|
||||
|
||||
import java.util.List;
|
||||
@@ -93,6 +94,13 @@ public class WifiDppConfiguratorActivity extends InstrumentedActivity implements
|
||||
return SettingsEnums.SETTINGS_WIFI_DPP_CONFIGURATOR;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onApplyThemeResource(Resources.Theme theme, int resid, boolean first) {
|
||||
resid = SetupWizardUtils.getTheme(getIntent());
|
||||
theme.applyStyle(R.style.SetupWizardPartnerResource, /* force */ true);
|
||||
super.onApplyThemeResource(theme, resid, first);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -117,12 +125,6 @@ public class WifiDppConfiguratorActivity extends InstrumentedActivity implements
|
||||
} else {
|
||||
handleIntent(getIntent());
|
||||
}
|
||||
|
||||
ActionBar actionBar = getActionBar();
|
||||
if (actionBar != null) {
|
||||
actionBar.setElevation(0);
|
||||
actionBar.setDisplayShowTitleEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void handleIntent(Intent intent) {
|
||||
@@ -321,14 +323,6 @@ public class WifiDppConfiguratorActivity extends InstrumentedActivity implements
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onNavigateUp() {
|
||||
if (!mFragmentManager.popBackStackImmediate()) {
|
||||
finish();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onQrCodeGeneratorFragmentAddButtonClicked() {
|
||||
showQrCodeScannerFragment(/* addToBackStack */ true);
|
||||
|
@@ -16,9 +16,9 @@
|
||||
|
||||
package com.android.settings.wifi.dpp;
|
||||
|
||||
import android.app.ActionBar;
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
||||
@@ -27,10 +27,9 @@ import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SetupWizardUtils;
|
||||
import com.android.settings.core.InstrumentedActivity;
|
||||
|
||||
import com.google.android.setupcompat.util.WizardManagerHelper;
|
||||
|
||||
/**
|
||||
* To provision "this" device with specified Wi-Fi network.
|
||||
*
|
||||
@@ -51,26 +50,23 @@ public class WifiDppEnrolleeActivity extends InstrumentedActivity implements
|
||||
return SettingsEnums.SETTINGS_WIFI_DPP_ENROLLEE;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onApplyThemeResource(Resources.Theme theme, int resid, boolean first) {
|
||||
resid = SetupWizardUtils.getTheme(getIntent());
|
||||
theme.applyStyle(R.style.SetupWizardPartnerResource, /* force */ true);
|
||||
super.onApplyThemeResource(theme, resid, first);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
if (WizardManagerHelper.isAnySetupWizard(getIntent())) {
|
||||
setTheme(R.style.LightTheme_SettingsBase_SetupWizard);
|
||||
}
|
||||
|
||||
setContentView(R.layout.wifi_dpp_activity);
|
||||
mFragmentManager = getSupportFragmentManager();
|
||||
|
||||
if (savedInstanceState == null) {
|
||||
handleIntent(getIntent());
|
||||
}
|
||||
|
||||
ActionBar actionBar = getActionBar();
|
||||
if (actionBar != null) {
|
||||
actionBar.setElevation(0);
|
||||
actionBar.setDisplayShowTitleEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void handleIntent(Intent intent) {
|
||||
@@ -112,12 +108,6 @@ public class WifiDppEnrolleeActivity extends InstrumentedActivity implements
|
||||
fragmentTransaction.commit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onNavigateUp(){
|
||||
finish();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScanWifiDppSuccess(WifiQrCode wifiQrCode) {
|
||||
// Do nothing
|
||||
|
@@ -16,14 +16,22 @@
|
||||
|
||||
package com.android.settings.wifi.dpp;
|
||||
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.DrawableRes;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.core.InstrumentedFragment;
|
||||
|
||||
import com.google.android.setupcompat.template.FooterBarMixin;
|
||||
import com.google.android.setupcompat.template.FooterButton;
|
||||
import com.google.android.setupdesign.GlifLayout;
|
||||
|
||||
/**
|
||||
* There are below 4 fragments for Wi-Fi DPP UI flow, to reduce redundant code of UI components,
|
||||
* this parent fragment instantiates common UI components
|
||||
@@ -34,37 +42,63 @@ import com.android.settings.core.InstrumentedFragment;
|
||||
* {@code WifiDppAddDeviceFragment}
|
||||
*/
|
||||
public abstract class WifiDppQrCodeBaseFragment extends InstrumentedFragment {
|
||||
private GlifLayout mGlifLayout;
|
||||
private ImageView mHeaderIcon;
|
||||
private ImageView mDevicesCheckCircleGreenHeaderIcon;
|
||||
protected TextView mTitle;
|
||||
protected TextView mSummary;
|
||||
protected View mTitleSummaryContainer;
|
||||
protected FooterButton mLeftButton;
|
||||
protected FooterButton mRightButton;
|
||||
|
||||
@Override
|
||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
mGlifLayout = (GlifLayout) view;
|
||||
|
||||
mHeaderIcon = view.findViewById(android.R.id.icon);
|
||||
mDevicesCheckCircleGreenHeaderIcon =
|
||||
view.findViewById(R.id.devices_check_circle_green_icon);
|
||||
mTitle = view.findViewById(android.R.id.title);
|
||||
mSummary = view.findViewById(android.R.id.summary);
|
||||
|
||||
// This is the LinearLayout which groups mTitle and mSummary for Talkback to announce the
|
||||
// content in a way that reflects its natural groupings.
|
||||
mTitleSummaryContainer = view.findViewById(R.id.title_summary_container);
|
||||
if (isFooterAvailable()) {
|
||||
FooterBarMixin FooterBarMixin = ((GlifLayout) view).getMixin(FooterBarMixin.class);
|
||||
|
||||
mLeftButton = new FooterButton.Builder(getContext())
|
||||
.setButtonType(FooterButton.ButtonType.CANCEL)
|
||||
.setTheme(R.style.SudGlifButton_Secondary)
|
||||
.build();
|
||||
mGlifLayout.getMixin(FooterBarMixin.class).setSecondaryButton(mLeftButton);
|
||||
|
||||
mRightButton = new FooterButton.Builder(getContext())
|
||||
.setButtonType(FooterButton.ButtonType.NEXT)
|
||||
.setTheme(R.style.SudGlifButton_Primary)
|
||||
.build();
|
||||
mGlifLayout.getMixin(FooterBarMixin.class).setPrimaryButton(mRightButton);
|
||||
}
|
||||
}
|
||||
|
||||
protected void setHeaderIconImageResource(int resId) {
|
||||
// ic_devices_check_circle_green is a LayerDrawable,
|
||||
// it has different size from other VectorDrawable icons
|
||||
if (resId == R.drawable.ic_devices_check_circle_green) {
|
||||
mHeaderIcon.setVisibility(View.GONE);
|
||||
mDevicesCheckCircleGreenHeaderIcon.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mDevicesCheckCircleGreenHeaderIcon.setVisibility(View.GONE);
|
||||
mHeaderIcon.setImageResource(resId);
|
||||
mHeaderIcon.setVisibility(View.VISIBLE);
|
||||
protected void setHeaderIconImageResource(@DrawableRes int iconResId) {
|
||||
mGlifLayout.setIcon(getDrawable(iconResId));
|
||||
}
|
||||
|
||||
private Drawable getDrawable(@DrawableRes int iconResId) {
|
||||
Drawable buttonIcon = null;
|
||||
|
||||
try {
|
||||
buttonIcon = getContext().getDrawable(iconResId);
|
||||
} catch (Resources.NotFoundException exception) {
|
||||
}
|
||||
return buttonIcon;
|
||||
}
|
||||
|
||||
protected void setHeaderTitle(String title) {
|
||||
mGlifLayout.setHeaderText(title);
|
||||
}
|
||||
|
||||
protected void setHeaderTitle(int resId, Object... formatArgs) {
|
||||
mGlifLayout.setHeaderText(getString(resId, formatArgs));
|
||||
}
|
||||
|
||||
protected void setProgressBarShown(boolean shown) {
|
||||
mGlifLayout.setProgressBarShown(shown);
|
||||
}
|
||||
|
||||
protected abstract boolean isFooterAvailable();
|
||||
}
|
||||
|
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.android.settings.wifi.dpp;
|
||||
|
||||
import android.app.ActionBar;
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
@@ -70,13 +69,6 @@ public class WifiDppQrCodeGeneratorFragment extends WifiDppQrCodeBaseFragment {
|
||||
} else {
|
||||
getActivity().setTitle(R.string.wifi_dpp_share_wifi);
|
||||
}
|
||||
|
||||
setHasOptionsMenu(true);
|
||||
final ActionBar actionBar = getActivity().getActionBar();
|
||||
if (actionBar != null) {
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
actionBar.show();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -116,13 +108,11 @@ public class WifiDppQrCodeGeneratorFragment extends WifiDppQrCodeBaseFragment {
|
||||
|
||||
mQrCodeView = view.findViewById(R.id.qrcode_view);
|
||||
|
||||
setHeaderIconImageResource(R.drawable.ic_qrcode_24dp);
|
||||
|
||||
final WifiNetworkConfig wifiNetworkConfig = getWifiNetworkConfigFromHostActivity();
|
||||
if (wifiNetworkConfig.isHotspot()) {
|
||||
mTitle.setText(R.string.wifi_dpp_share_hotspot);
|
||||
setHeaderTitle(R.string.wifi_dpp_share_hotspot);
|
||||
} else {
|
||||
mTitle.setText(R.string.wifi_dpp_share_wifi);
|
||||
setHeaderTitle(R.string.wifi_dpp_share_wifi);
|
||||
}
|
||||
|
||||
final String password = wifiNetworkConfig.getPreSharedKey();
|
||||
@@ -168,4 +158,9 @@ public class WifiDppQrCodeGeneratorFragment extends WifiDppQrCodeBaseFragment {
|
||||
|
||||
return wifiNetworkConfig;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isFooterAvailable() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.android.settings.wifi.dpp;
|
||||
|
||||
import android.app.ActionBar;
|
||||
import android.app.Activity;
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
@@ -42,7 +41,6 @@ import android.view.TextureView.SurfaceTextureListener;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.accessibility.AccessibilityEvent;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.StringRes;
|
||||
@@ -91,7 +89,6 @@ public class WifiDppQrCodeScannerFragment extends WifiDppQrCodeBaseFragment impl
|
||||
|
||||
private static final int ARG_RESTART_CAMERA = 1;
|
||||
|
||||
private ProgressBar mProgressBar;
|
||||
private QrCamera mCamera;
|
||||
private TextureView mTextureView;
|
||||
private QrDecorateView mDecorateView;
|
||||
@@ -136,7 +133,7 @@ public class WifiDppQrCodeScannerFragment extends WifiDppQrCodeBaseFragment impl
|
||||
SHOW_ERROR_MESSAGE_INTERVAL);
|
||||
|
||||
if (msg.arg1 == ARG_RESTART_CAMERA) {
|
||||
mProgressBar.setVisibility(View.INVISIBLE);
|
||||
setProgressBarShown(false);
|
||||
mDecorateView.setFocused(false);
|
||||
restartCamera();
|
||||
}
|
||||
@@ -150,7 +147,7 @@ public class WifiDppQrCodeScannerFragment extends WifiDppQrCodeBaseFragment impl
|
||||
mScanWifiDppSuccessListener.onScanWifiDppSuccess((WifiQrCode)msg.obj);
|
||||
|
||||
if (!mIsConfiguratorMode) {
|
||||
mProgressBar.setVisibility(View.VISIBLE);
|
||||
setProgressBarShown(true);
|
||||
startWifiDppEnrolleeInitiator((WifiQrCode)msg.obj);
|
||||
updateEnrolleeSummary();
|
||||
mSummary.sendAccessibilityEvent(
|
||||
@@ -335,12 +332,6 @@ public class WifiDppQrCodeScannerFragment extends WifiDppQrCodeBaseFragment impl
|
||||
} else {
|
||||
getActivity().setTitle(R.string.wifi_dpp_scan_qr_code);
|
||||
}
|
||||
|
||||
final ActionBar actionBar = getActivity().getActionBar();
|
||||
if (actionBar != null) {
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
actionBar.show();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -373,13 +364,10 @@ public class WifiDppQrCodeScannerFragment extends WifiDppQrCodeBaseFragment impl
|
||||
|
||||
mDecorateView = (QrDecorateView) view.findViewById(R.id.decorate_view);
|
||||
|
||||
setHeaderIconImageResource(R.drawable.ic_scan_24dp);
|
||||
|
||||
mProgressBar = view.findViewById(R.id.indeterminate_bar);
|
||||
mProgressBar.setVisibility(isGoingInitiator() ? View.VISIBLE : View.INVISIBLE);
|
||||
setProgressBarShown(isGoingInitiator());
|
||||
|
||||
if (mIsConfiguratorMode) {
|
||||
mTitle.setText(R.string.wifi_dpp_add_device_to_network);
|
||||
setHeaderTitle(R.string.wifi_dpp_add_device_to_network);
|
||||
|
||||
WifiNetworkConfig wifiNetworkConfig = ((WifiNetworkConfig.Retriever) getActivity())
|
||||
.getWifiNetworkConfig();
|
||||
@@ -389,7 +377,7 @@ public class WifiDppQrCodeScannerFragment extends WifiDppQrCodeBaseFragment impl
|
||||
mSummary.setText(getString(R.string.wifi_dpp_center_qr_code,
|
||||
wifiNetworkConfig.getSsid()));
|
||||
} else {
|
||||
mTitle.setText(R.string.wifi_dpp_scan_qr_code);
|
||||
setHeaderTitle(R.string.wifi_dpp_scan_qr_code);
|
||||
|
||||
updateEnrolleeSummary();
|
||||
}
|
||||
@@ -733,4 +721,9 @@ public class WifiDppQrCodeScannerFragment extends WifiDppQrCodeBaseFragment impl
|
||||
protected boolean isDecodeTaskAlive() {
|
||||
return mCamera != null && mCamera.isDecodeTaskAlive();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isFooterAvailable() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@@ -40,7 +40,7 @@
|
||||
<item>@drawable/ic_delete</item>
|
||||
<item>@drawable/ic_delete_accent</item>
|
||||
<item>@drawable/ic_devices_other</item>
|
||||
<item>@drawable/ic_devices_other_opaque_black</item>
|
||||
<item>@drawable/ic_devices_other_32dp</item>
|
||||
<item>@drawable/ic_do_not_disturb_on_24dp</item>
|
||||
<item>@drawable/ic_eject_24dp</item>
|
||||
<item>@drawable/ic_expand_less</item>
|
||||
|
@@ -27,7 +27,6 @@ import com.android.settings.R;
|
||||
import com.android.settings.testutils.shadow.ShadowAlertDialogCompat;
|
||||
import com.android.settings.testutils.shadow.ShadowConnectivityManager;
|
||||
import com.android.settings.testutils.shadow.ShadowWifiManager;
|
||||
import com.android.settings.wifi.dpp.WifiDppEnrolleeActivity;
|
||||
|
||||
import com.google.android.setupcompat.util.WizardManagerHelper;
|
||||
|
||||
@@ -38,7 +37,6 @@ import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
import org.robolectric.Robolectric;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
import org.robolectric.android.controller.ActivityController;
|
||||
import org.robolectric.annotation.Config;
|
||||
import org.robolectric.util.ReflectionHelpers;
|
||||
|
||||
@@ -113,23 +111,4 @@ public class WifiDialogActivityTest {
|
||||
assertThat(dialog.getContext().getThemeResId())
|
||||
.isEqualTo(R.style.SuwAlertDialogThemeCompat_Light);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onScan_whenLaunchFromDeferredSetup_shouldApplyLightTheme() {
|
||||
ActivityController<WifiDppEnrolleeActivity> controller = Robolectric.buildActivity(
|
||||
WifiDppEnrolleeActivity.class,
|
||||
new Intent()
|
||||
.setAction(WifiDppEnrolleeActivity.ACTION_ENROLLEE_QR_CODE_SCANNER)
|
||||
.putExtra(WizardManagerHelper.EXTRA_IS_FIRST_RUN, true)
|
||||
.putExtra(WizardManagerHelper.EXTRA_IS_SETUP_FLOW, true)
|
||||
);
|
||||
controller.create();
|
||||
|
||||
Intent intent = controller.getIntent();
|
||||
assertThat(intent.getBooleanExtra(WizardManagerHelper.EXTRA_IS_FIRST_RUN, false)).isTrue();
|
||||
assertThat(intent.getBooleanExtra(WizardManagerHelper.EXTRA_IS_SETUP_FLOW, false)).isTrue();
|
||||
|
||||
assertThat(controller.get().getThemeResId()).
|
||||
isEqualTo(R.style.LightTheme_SettingsBase_SetupWizard);
|
||||
}
|
||||
}
|
||||
|
@@ -26,10 +26,13 @@ import android.os.RemoteException;
|
||||
import android.provider.Settings;
|
||||
import android.support.test.uiautomator.UiDevice;
|
||||
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.test.InstrumentationRegistry;
|
||||
import androidx.test.rule.ActivityTestRule;
|
||||
import androidx.test.runner.AndroidJUnit4;
|
||||
|
||||
import com.google.android.setupdesign.GlifLayout;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
@@ -60,8 +63,13 @@ public class WifiDppConfiguratorActivityTest {
|
||||
intent.putExtra(WifiDppUtils.EXTRA_WIFI_PRE_SHARED_KEY, "password");
|
||||
|
||||
mActivityRule.launchActivity(intent);
|
||||
FragmentManager fragmentManager = mActivityRule.getActivity().getSupportFragmentManager();
|
||||
WifiDppQrCodeScannerFragment fragment =
|
||||
(WifiDppQrCodeScannerFragment) fragmentManager.findFragmentByTag(
|
||||
WifiDppUtils.TAG_FRAGMENT_QR_CODE_SCANNER);
|
||||
|
||||
assertThat(mActivityRule.getActivity().isFinishing()).isEqualTo(false);
|
||||
assertThat(fragment.getView() instanceof GlifLayout).isTrue();
|
||||
assertThat(mActivityRule.getActivity().isFinishing()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -73,8 +81,13 @@ public class WifiDppConfiguratorActivityTest {
|
||||
intent.putExtra(WifiDppUtils.EXTRA_WIFI_PRE_SHARED_KEY, "password");
|
||||
|
||||
mActivityRule.launchActivity(intent);
|
||||
FragmentManager fragmentManager = mActivityRule.getActivity().getSupportFragmentManager();
|
||||
WifiDppQrCodeGeneratorFragment fragment =
|
||||
(WifiDppQrCodeGeneratorFragment) fragmentManager.findFragmentByTag(
|
||||
WifiDppUtils.TAG_FRAGMENT_QR_CODE_GENERATOR);
|
||||
|
||||
assertThat(mActivityRule.getActivity().isFinishing()).isEqualTo(false);
|
||||
assertThat(fragment.getView() instanceof GlifLayout).isTrue();
|
||||
assertThat(mActivityRule.getActivity().isFinishing()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -84,14 +97,14 @@ public class WifiDppConfiguratorActivityTest {
|
||||
|
||||
mActivityRule.launchActivity(intent);
|
||||
|
||||
assertThat(mActivityRule.getActivity().isFinishing()).isEqualTo(false);
|
||||
assertThat(mActivityRule.getActivity().isFinishing()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testActivity_shouldImplementsWifiNetworkConfigRetriever() {
|
||||
WifiDppConfiguratorActivity activity = mActivityRule.getActivity();
|
||||
|
||||
assertThat(activity instanceof WifiNetworkConfig.Retriever).isEqualTo(true);
|
||||
assertThat(activity instanceof WifiNetworkConfig.Retriever).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -99,7 +112,7 @@ public class WifiDppConfiguratorActivityTest {
|
||||
WifiDppConfiguratorActivity activity = mActivityRule.getActivity();
|
||||
|
||||
assertThat(activity instanceof WifiDppQrCodeGeneratorFragment
|
||||
.OnQrCodeGeneratorFragmentAddButtonClickedListener).isEqualTo(true);
|
||||
.OnQrCodeGeneratorFragmentAddButtonClickedListener).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -107,7 +120,7 @@ public class WifiDppConfiguratorActivityTest {
|
||||
WifiDppConfiguratorActivity activity = mActivityRule.getActivity();
|
||||
|
||||
assertThat(activity instanceof WifiDppQrCodeScannerFragment
|
||||
.OnScanWifiDppSuccessListener).isEqualTo(true);
|
||||
.OnScanWifiDppSuccessListener).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -115,7 +128,7 @@ public class WifiDppConfiguratorActivityTest {
|
||||
WifiDppConfiguratorActivity activity = mActivityRule.getActivity();
|
||||
|
||||
assertThat(activity instanceof WifiDppAddDeviceFragment
|
||||
.OnClickChooseDifferentNetworkListener).isEqualTo(true);
|
||||
.OnClickChooseDifferentNetworkListener).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -175,40 +188,4 @@ public class WifiDppConfiguratorActivityTest {
|
||||
assertThat(restoredWifiNetworkConfig.getNetworkId()).isEqualTo(0);
|
||||
assertThat(restoredWifiNetworkConfig.isHotspot()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void launchScanner_onNavigateUp_shouldFinish() {
|
||||
Intent intent = new Intent(WifiDppConfiguratorActivity.ACTION_CONFIGURATOR_QR_CODE_SCANNER);
|
||||
intent.putExtra(WifiDppUtils.EXTRA_WIFI_SECURITY, "WEP");
|
||||
intent.putExtra(WifiDppUtils.EXTRA_WIFI_SSID, "GoogleGuest");
|
||||
intent.putExtra(WifiDppUtils.EXTRA_WIFI_PRE_SHARED_KEY, "password");
|
||||
final Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation();
|
||||
|
||||
mActivityRule.launchActivity(intent);
|
||||
|
||||
instrumentation.runOnMainSync(() -> {
|
||||
mActivityRule.getActivity().onNavigateUp();
|
||||
|
||||
assertThat(mActivityRule.getActivity().isFinishing()).isEqualTo(true);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void launchGenerator_onNavigateUp_shouldFinish() {
|
||||
Intent intent = new Intent(
|
||||
WifiDppConfiguratorActivity.ACTION_CONFIGURATOR_QR_CODE_GENERATOR);
|
||||
intent.putExtra(WifiDppUtils.EXTRA_WIFI_SECURITY, "WEP");
|
||||
intent.putExtra(WifiDppUtils.EXTRA_WIFI_SSID, "GoogleGuest");
|
||||
intent.putExtra(WifiDppUtils.EXTRA_WIFI_PRE_SHARED_KEY, "password");
|
||||
final Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation();
|
||||
|
||||
mActivityRule.launchActivity(intent);
|
||||
|
||||
instrumentation.runOnMainSync(() -> {
|
||||
mActivityRule.getActivity().onNavigateUp();
|
||||
|
||||
assertThat(mActivityRule.getActivity().isFinishing()).isEqualTo(true);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user