[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
|
<vector
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:width="24dp"
|
android:width="16dp"
|
||||||
android:height="24dp"
|
android:height="16dp"
|
||||||
android:viewportWidth="64.0"
|
android:viewportWidth="64.0"
|
||||||
android:viewportHeight="64.0">
|
android:viewportHeight="64.0">
|
||||||
<path
|
<path
|
||||||
|
@@ -16,15 +16,15 @@
|
|||||||
<layer-list
|
<layer-list
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<item
|
<item
|
||||||
android:drawable="@drawable/ic_devices_other_opaque_black"
|
android:drawable="@drawable/ic_devices_other_32dp"
|
||||||
android:width="@dimen/wifi_dpp_fragment_icon_width_height"
|
android:width="40dp"
|
||||||
android:height="@dimen/wifi_dpp_fragment_icon_width_height"
|
android:height="40dp"
|
||||||
android:gravity="center"/>
|
android:gravity="center"/>
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:drawable="@drawable/ic_check_circle_green"
|
android:drawable="@drawable/ic_check_circle_green"
|
||||||
android:top="28dp"
|
android:top="16dp"
|
||||||
android:left="44dp"
|
android:left="32dp"
|
||||||
android:gravity="center"/>
|
android:gravity="center"/>
|
||||||
|
|
||||||
</layer-list>
|
</layer-list>
|
@@ -14,10 +14,11 @@
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:width="24dp"
|
android:width="32dp"
|
||||||
android:height="24dp"
|
android:height="32dp"
|
||||||
android:viewportWidth="24"
|
android:viewportWidth="24"
|
||||||
android:viewportHeight="24">
|
android:viewportHeight="24"
|
||||||
|
android:tint="?android:attr/colorAccent">
|
||||||
<path
|
<path
|
||||||
android:fillColor="#FF000000"
|
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"/>
|
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.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<LinearLayout
|
<com.google.android.setupdesign.GlifLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:id="@+id/root"
|
|
||||||
android:layout_width="match_parent"
|
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_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
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
android:gravity="center"
|
||||||
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"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:indeterminate="true"
|
|
||||||
android:paddingStart="16dp"
|
|
||||||
android:paddingEnd="16dp"
|
|
||||||
android:layout_marginBottom="8dp"
|
|
||||||
style="?android:attr/progressBarStyleHorizontal"/>
|
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:layout_width="@dimen/qrcode_preview_size"
|
android:layout_width="@dimen/qrcode_preview_size"
|
||||||
@@ -58,18 +58,18 @@
|
|||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/error_message"
|
android:id="@+id/error_message"
|
||||||
|
style="@style/TextAppearance.ErrorText"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="16dp"
|
android:layout_marginTop="16dp"
|
||||||
android:layout_marginStart="24dp"
|
android:layout_marginStart="?attr/sudMarginSides"
|
||||||
android:layout_marginEnd="24dp"
|
android:layout_marginEnd="?attr/sudMarginSides"
|
||||||
android:textAlignment="center"
|
android:textAlignment="center"
|
||||||
android:textColor="?android:attr/colorError"
|
|
||||||
android:visibility="invisible"/>
|
android:visibility="invisible"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</ScrollView>
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</com.google.android.setupdesign.GlifLayout>
|
||||||
|
|
||||||
|
@@ -15,62 +15,52 @@
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<com.google.android.setupdesign.GlifLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
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_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent"
|
||||||
|
android:icon="@drawable/ic_devices_other_32dp">
|
||||||
|
|
||||||
<ScrollView
|
<LinearLayout
|
||||||
|
style="@style/SudContentFrame"
|
||||||
android:layout_width="match_parent"
|
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
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:gravity="center_horizontal"
|
android:gravity="center"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<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:visibility="invisible"/>
|
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/wifi_ap_picture_view"
|
android:id="@+id/wifi_ap_picture_view"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:src="@drawable/wifi_dpp_success"
|
android:src="@drawable/wifi_dpp_success"
|
||||||
android:scaleType="fitCenter"
|
android:scaleType="fitCenter"/>
|
||||||
app:layout_constraintTop_toBottomOf="@+id/header"/>
|
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/choose_different_network"
|
android:id="@+id/choose_different_network"
|
||||||
style="@style/SudGlifButton.Secondary"
|
style="@style/SudGlifButton.Secondary"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/wifi_ap_picture_view"
|
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
android:text="@string/wifi_dpp_choose_different_network"/>
|
android:text="@string/wifi_dpp_choose_different_network"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</ScrollView>
|
</LinearLayout>
|
||||||
|
|
||||||
<include
|
</com.google.android.setupdesign.GlifLayout>
|
||||||
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>
|
|
||||||
|
|
||||||
|
@@ -15,22 +15,27 @@
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<com.google.android.setupdesign.GlifLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
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_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent"
|
||||||
|
android:icon="@drawable/ic_wifi_signal_4_32dp">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
style="@style/SudContentFrame"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="match_parent"
|
||||||
android:gravity="center_horizontal"
|
android:gravity="center_horizontal"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical">
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
app:layout_constraintBottom_toTopOf="@+id/footer">
|
|
||||||
|
|
||||||
<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"
|
<LinearLayout android:id="@+id/wifi_network_list_container"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -38,12 +43,5 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<include
|
</com.google.android.setupdesign.GlifLayout>
|
||||||
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>
|
|
||||||
|
|
||||||
|
@@ -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,25 +15,34 @@
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<LinearLayout
|
<com.google.android.setupdesign.GlifLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:id="@+id/root"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical">
|
android:icon="@drawable/ic_qrcode_32dp">
|
||||||
|
|
||||||
<ScrollView
|
<LinearLayout
|
||||||
|
style="@style/SudContentFrame"
|
||||||
android:layout_width="match_parent"
|
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
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:gravity="center_horizontal"
|
android:gravity="center"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<include layout="@layout/wifi_dpp_fragment_header"/>
|
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/qrcode_view"
|
android:id="@+id/qrcode_view"
|
||||||
android:layout_width="@dimen/qrcode_size"
|
android:layout_width="@dimen/qrcode_size"
|
||||||
@@ -50,7 +59,7 @@
|
|||||||
android:textColor="?android:attr/textColorSecondary"/>
|
android:textColor="?android:attr/textColorSecondary"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</ScrollView>
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</com.google.android.setupdesign.GlifLayout>
|
||||||
|
|
||||||
|
@@ -15,33 +15,33 @@
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<LinearLayout
|
<com.google.android.setupdesign.GlifLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:id="@+id/root"
|
|
||||||
android:layout_width="match_parent"
|
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_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:gravity="center_horizontal">
|
||||||
|
|
||||||
|
<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
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
android:gravity="center"
|
||||||
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"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:indeterminate="true"
|
|
||||||
android:paddingStart="16dp"
|
|
||||||
android:paddingEnd="16dp"
|
|
||||||
android:layout_marginBottom="8dp"
|
|
||||||
style="?android:attr/progressBarStyleHorizontal"/>
|
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
@@ -59,18 +59,18 @@
|
|||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/error_message"
|
android:id="@+id/error_message"
|
||||||
|
style="@style/TextAppearance.ErrorText"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="16dp"
|
android:layout_marginTop="16dp"
|
||||||
android:layout_marginStart="24dp"
|
android:layout_marginStart="?attr/sudMarginSides"
|
||||||
android:layout_marginEnd="24dp"
|
android:layout_marginEnd="?attr/sudMarginSides"
|
||||||
android:textAlignment="center"
|
android:textAlignment="center"
|
||||||
android:textColor="?android:attr/colorError"
|
|
||||||
android:visibility="invisible"/>
|
android:visibility="invisible"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</ScrollView>
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</com.google.android.setupdesign.GlifLayout>
|
||||||
|
|
||||||
|
@@ -400,9 +400,6 @@
|
|||||||
<dimen name="qrcode_size">264dp</dimen>
|
<dimen name="qrcode_size">264dp</dimen>
|
||||||
<dimen name="qrcode_preview_size">360dp</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 -->
|
<!-- Elevation of bluetooth icon -->
|
||||||
<dimen name="bt_icon_elevation">4dp</dimen>
|
<dimen name="bt_icon_elevation">4dp</dimen>
|
||||||
|
|
||||||
|
@@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
package com.android.settings.wifi.dpp;
|
package com.android.settings.wifi.dpp;
|
||||||
|
|
||||||
import android.app.ActionBar;
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.settings.SettingsEnums;
|
import android.app.settings.SettingsEnums;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -32,7 +31,6 @@ import android.view.ViewGroup;
|
|||||||
import android.view.accessibility.AccessibilityEvent;
|
import android.view.accessibility.AccessibilityEvent;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.ProgressBar;
|
|
||||||
|
|
||||||
import androidx.lifecycle.ViewModelProviders;
|
import androidx.lifecycle.ViewModelProviders;
|
||||||
|
|
||||||
@@ -47,11 +45,8 @@ import java.util.concurrent.Executor;
|
|||||||
public class WifiDppAddDeviceFragment extends WifiDppQrCodeBaseFragment {
|
public class WifiDppAddDeviceFragment extends WifiDppQrCodeBaseFragment {
|
||||||
private static final String TAG = "WifiDppAddDeviceFragment";
|
private static final String TAG = "WifiDppAddDeviceFragment";
|
||||||
|
|
||||||
private ProgressBar mProgressBar;
|
|
||||||
private ImageView mWifiApPictureView;
|
private ImageView mWifiApPictureView;
|
||||||
private Button mChooseDifferentNetwork;
|
private Button mChooseDifferentNetwork;
|
||||||
private Button mButtonLeft;
|
|
||||||
private Button mButtonRight;
|
|
||||||
|
|
||||||
private int mLatestStatusCode = WifiDppUtils.EASY_CONNECT_EVENT_FAILURE_NONE;
|
private int mLatestStatusCode = WifiDppUtils.EASY_CONNECT_EVENT_FAILURE_NONE;
|
||||||
|
|
||||||
@@ -83,16 +78,16 @@ public class WifiDppAddDeviceFragment extends WifiDppQrCodeBaseFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void showSuccessUi(boolean isConfigurationChange) {
|
private void showSuccessUi(boolean isConfigurationChange) {
|
||||||
setHeaderIconImageResource(R.drawable.ic_devices_check_circle_green);
|
setHeaderIconImageResource(R.drawable.ic_devices_check_circle_green_32dp);
|
||||||
mTitle.setText(R.string.wifi_dpp_wifi_shared_with_device);
|
setHeaderTitle(R.string.wifi_dpp_wifi_shared_with_device);
|
||||||
mProgressBar.setVisibility(isGoingInitiator() ? View.VISIBLE : View.INVISIBLE);
|
setProgressBarShown(isGoingInitiator());
|
||||||
mSummary.setVisibility(View.INVISIBLE);
|
mSummary.setVisibility(View.INVISIBLE);
|
||||||
mWifiApPictureView.setImageResource(R.drawable.wifi_dpp_success);
|
mWifiApPictureView.setImageResource(R.drawable.wifi_dpp_success);
|
||||||
mChooseDifferentNetwork.setVisibility(View.INVISIBLE);
|
mChooseDifferentNetwork.setVisibility(View.INVISIBLE);
|
||||||
mButtonLeft.setText(R.string.wifi_dpp_add_another_device);
|
mLeftButton.setText(getContext(), R.string.wifi_dpp_add_another_device);
|
||||||
mButtonLeft.setOnClickListener(v -> getFragmentManager().popBackStack());
|
mLeftButton.setOnClickListener(v -> getFragmentManager().popBackStack());
|
||||||
mButtonRight.setText(R.string.done);
|
mRightButton.setText(getContext(), R.string.done);
|
||||||
mButtonRight.setOnClickListener(v -> {
|
mRightButton.setOnClickListener(v -> {
|
||||||
final Activity activity = getActivity();
|
final Activity activity = getActivity();
|
||||||
activity.setResult(Activity.RESULT_OK);
|
activity.setResult(Activity.RESULT_OK);
|
||||||
activity.finish();
|
activity.finish();
|
||||||
@@ -100,7 +95,6 @@ public class WifiDppAddDeviceFragment extends WifiDppQrCodeBaseFragment {
|
|||||||
|
|
||||||
if (!isConfigurationChange) {
|
if (!isConfigurationChange) {
|
||||||
mLatestStatusCode = WifiDppUtils.EASY_CONNECT_EVENT_SUCCESS;
|
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"));
|
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);
|
mWifiApPictureView.setImageResource(R.drawable.wifi_dpp_error);
|
||||||
mChooseDifferentNetwork.setVisibility(View.INVISIBLE);
|
mChooseDifferentNetwork.setVisibility(View.INVISIBLE);
|
||||||
if (hasRetryButton(code)) {
|
if (hasRetryButton(code)) {
|
||||||
mButtonRight.setText(R.string.retry);
|
mRightButton.setText(getContext(), R.string.retry);
|
||||||
} else {
|
} else {
|
||||||
mButtonRight.setText(R.string.done);
|
mRightButton.setText(getContext(), R.string.done);
|
||||||
mButtonRight.setOnClickListener(v -> getActivity().finish());
|
mRightButton.setOnClickListener(v -> getActivity().finish());
|
||||||
mButtonLeft.setVisibility(View.INVISIBLE);
|
mLeftButton.setVisibility(View.INVISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isGoingInitiator()) {
|
if (isGoingInitiator()) {
|
||||||
mSummary.setText(R.string.wifi_dpp_sharing_wifi_with_this_device);
|
mSummary.setText(R.string.wifi_dpp_sharing_wifi_with_this_device);
|
||||||
}
|
}
|
||||||
|
|
||||||
mProgressBar.setVisibility(isGoingInitiator() ? View.VISIBLE : View.INVISIBLE);
|
setProgressBarShown(isGoingInitiator());
|
||||||
mButtonRight.setVisibility(isGoingInitiator() ? View.INVISIBLE : View.VISIBLE);
|
mRightButton.setVisibility(isGoingInitiator() ? View.INVISIBLE : View.VISIBLE);
|
||||||
|
|
||||||
if (!isConfigurationChange) {
|
if (!isConfigurationChange) {
|
||||||
mLatestStatusCode = code;
|
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
|
@Override
|
||||||
public final View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public final View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
@@ -249,17 +232,15 @@ public class WifiDppAddDeviceFragment extends WifiDppQrCodeBaseFragment {
|
|||||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||||
super.onViewCreated(view, savedInstanceState);
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
|
||||||
setHeaderIconImageResource(R.drawable.ic_devices_other_opaque_black);
|
setHeaderIconImageResource(R.drawable.ic_devices_other_32dp);
|
||||||
|
|
||||||
mProgressBar = view.findViewById(R.id.indeterminate_bar);
|
|
||||||
|
|
||||||
final WifiQrCode wifiQrCode = ((WifiDppConfiguratorActivity) getActivity())
|
final WifiQrCode wifiQrCode = ((WifiDppConfiguratorActivity) getActivity())
|
||||||
.getWifiDppQrCode();
|
.getWifiDppQrCode();
|
||||||
final String information = wifiQrCode.getInformation();
|
final String information = wifiQrCode.getInformation();
|
||||||
if (TextUtils.isEmpty(information)) {
|
if (TextUtils.isEmpty(information)) {
|
||||||
mTitle.setText(R.string.wifi_dpp_device_found);
|
setHeaderTitle(R.string.wifi_dpp_device_found);
|
||||||
} else {
|
} else {
|
||||||
mTitle.setText(information);
|
setHeaderTitle(information);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateSummary();
|
updateSummary();
|
||||||
@@ -270,31 +251,26 @@ public class WifiDppAddDeviceFragment extends WifiDppQrCodeBaseFragment {
|
|||||||
mClickChooseDifferentNetworkListener.onClickChooseDifferentNetwork()
|
mClickChooseDifferentNetworkListener.onClickChooseDifferentNetwork()
|
||||||
);
|
);
|
||||||
|
|
||||||
mButtonLeft = view.findViewById(R.id.button_left);
|
mLeftButton.setText(getContext(), R.string.cancel);
|
||||||
mButtonLeft.setText(R.string.cancel);
|
mLeftButton.setOnClickListener(v -> getActivity().finish());
|
||||||
mButtonLeft.setOnClickListener(v -> getActivity().finish());
|
|
||||||
|
|
||||||
mButtonRight = view.findViewById(R.id.button_right);
|
mRightButton.setText(getContext(), R.string.wifi_dpp_share_wifi);
|
||||||
mButtonRight.setText(R.string.wifi_dpp_share_wifi);
|
mRightButton.setOnClickListener(v -> {
|
||||||
mButtonRight.setOnClickListener(v -> {
|
setProgressBarShown(true);
|
||||||
mProgressBar.setVisibility(View.VISIBLE);
|
mRightButton.setVisibility(View.INVISIBLE);
|
||||||
mButtonRight.setVisibility(View.INVISIBLE);
|
|
||||||
startWifiDppConfiguratorInitiator();
|
startWifiDppConfiguratorInitiator();
|
||||||
updateSummary();
|
updateSummary();
|
||||||
mTitleSummaryContainer.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_FOCUSED);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (savedInstanceState != null) {
|
if (savedInstanceState != null) {
|
||||||
if (mLatestStatusCode == WifiDppUtils.EASY_CONNECT_EVENT_SUCCESS) {
|
if (mLatestStatusCode == WifiDppUtils.EASY_CONNECT_EVENT_SUCCESS) {
|
||||||
showSuccessUi(/* isConfigurationChange */ true);
|
showSuccessUi(/* isConfigurationChange */ true);
|
||||||
} else if (mLatestStatusCode == WifiDppUtils.EASY_CONNECT_EVENT_FAILURE_NONE) {
|
} else if (mLatestStatusCode == WifiDppUtils.EASY_CONNECT_EVENT_FAILURE_NONE) {
|
||||||
mProgressBar.setVisibility(isGoingInitiator() ? View.VISIBLE : View.INVISIBLE);
|
setProgressBarShown(isGoingInitiator());
|
||||||
mButtonRight.setVisibility(isGoingInitiator() ? View.INVISIBLE : View.VISIBLE);
|
mRightButton.setVisibility(isGoingInitiator() ? View.INVISIBLE : View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
showErrorUi(mLatestStatusCode, /* isConfigurationChange */ true);
|
showErrorUi(mLatestStatusCode, /* isConfigurationChange */ true);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
changeFocusAndAnnounceChange(mButtonRight, mTitleSummaryContainer);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -374,4 +350,9 @@ public class WifiDppAddDeviceFragment extends WifiDppQrCodeBaseFragment {
|
|||||||
focusView.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_FOCUSED);
|
focusView.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_FOCUSED);
|
||||||
announceView.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
|
announceView.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean isFooterAvailable() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
package com.android.settings.wifi.dpp;
|
package com.android.settings.wifi.dpp;
|
||||||
|
|
||||||
import android.app.ActionBar;
|
|
||||||
import android.app.settings.SettingsEnums;
|
import android.app.settings.SettingsEnums;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@@ -24,7 +23,6 @@ import android.view.LayoutInflater;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.accessibility.AccessibilityEvent;
|
import android.view.accessibility.AccessibilityEvent;
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
|
|
||||||
import androidx.fragment.app.FragmentManager;
|
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 static final String TAG_FRAGMENT_WIFI_NETWORK_LIST = "wifi_network_list_fragment";
|
||||||
|
|
||||||
private ListView mSavedWifiNetworkList;
|
private ListView mSavedWifiNetworkList;
|
||||||
private Button mButtonLeft;
|
|
||||||
private Button mButtonRight;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetricsCategory() {
|
public int getMetricsCategory() {
|
||||||
@@ -52,11 +48,6 @@ public class WifiDppChooseSavedWifiNetworkFragment extends WifiDppQrCodeBaseFrag
|
|||||||
public void onActivityCreated(Bundle savedInstanceState) {
|
public void onActivityCreated(Bundle savedInstanceState) {
|
||||||
super.onActivityCreated(savedInstanceState);
|
super.onActivityCreated(savedInstanceState);
|
||||||
|
|
||||||
final ActionBar actionBar = getActivity().getActionBar();
|
|
||||||
if (actionBar != null) {
|
|
||||||
actionBar.hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Embeded WifiNetworkListFragment as child fragment within
|
/** Embeded WifiNetworkListFragment as child fragment within
|
||||||
* WifiDppChooseSavedWifiNetworkFragment. */
|
* WifiDppChooseSavedWifiNetworkFragment. */
|
||||||
final FragmentManager fragmentManager = getChildFragmentManager();
|
final FragmentManager fragmentManager = getChildFragmentManager();
|
||||||
@@ -82,14 +73,11 @@ public class WifiDppChooseSavedWifiNetworkFragment extends WifiDppQrCodeBaseFrag
|
|||||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||||
super.onViewCreated(view, savedInstanceState);
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
|
||||||
setHeaderIconImageResource(R.drawable.ic_wifi_signal_4);
|
setHeaderTitle(R.string.wifi_dpp_choose_network);
|
||||||
|
|
||||||
mTitle.setText(R.string.wifi_dpp_choose_network);
|
|
||||||
mSummary.setText(R.string.wifi_dpp_choose_network_to_connect_device);
|
mSummary.setText(R.string.wifi_dpp_choose_network_to_connect_device);
|
||||||
|
|
||||||
mButtonLeft = view.findViewById(R.id.button_left);
|
mLeftButton.setText(getContext(), R.string.cancel);
|
||||||
mButtonLeft.setText(R.string.cancel);
|
mLeftButton.setOnClickListener(v -> {
|
||||||
mButtonLeft.setOnClickListener(v -> {
|
|
||||||
String action = null;
|
String action = null;
|
||||||
final Intent intent = getActivity().getIntent();
|
final Intent intent = getActivity().getIntent();
|
||||||
if (intent != null) {
|
if (intent != null) {
|
||||||
@@ -104,13 +92,11 @@ public class WifiDppChooseSavedWifiNetworkFragment extends WifiDppQrCodeBaseFrag
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
mButtonRight = view.findViewById(R.id.button_right);
|
mRightButton.setVisibility(View.GONE);
|
||||||
mButtonRight.setVisibility(View.GONE);
|
}
|
||||||
|
|
||||||
if (savedInstanceState == null) {
|
@Override
|
||||||
// For Talkback to describe this fragment
|
protected boolean isFooterAvailable() {
|
||||||
mTitleSummaryContainer.sendAccessibilityEvent(
|
return true;
|
||||||
AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -16,9 +16,9 @@
|
|||||||
|
|
||||||
package com.android.settings.wifi.dpp;
|
package com.android.settings.wifi.dpp;
|
||||||
|
|
||||||
import android.app.ActionBar;
|
|
||||||
import android.app.settings.SettingsEnums;
|
import android.app.settings.SettingsEnums;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.res.Resources;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.net.wifi.WifiConfiguration;
|
import android.net.wifi.WifiConfiguration;
|
||||||
import android.net.wifi.WifiInfo;
|
import android.net.wifi.WifiInfo;
|
||||||
@@ -33,6 +33,7 @@ import androidx.fragment.app.FragmentManager;
|
|||||||
import androidx.fragment.app.FragmentTransaction;
|
import androidx.fragment.app.FragmentTransaction;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
|
import com.android.settings.SetupWizardUtils;
|
||||||
import com.android.settings.core.InstrumentedActivity;
|
import com.android.settings.core.InstrumentedActivity;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -93,6 +94,13 @@ public class WifiDppConfiguratorActivity extends InstrumentedActivity implements
|
|||||||
return SettingsEnums.SETTINGS_WIFI_DPP_CONFIGURATOR;
|
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
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@@ -117,12 +125,6 @@ public class WifiDppConfiguratorActivity extends InstrumentedActivity implements
|
|||||||
} else {
|
} else {
|
||||||
handleIntent(getIntent());
|
handleIntent(getIntent());
|
||||||
}
|
}
|
||||||
|
|
||||||
ActionBar actionBar = getActionBar();
|
|
||||||
if (actionBar != null) {
|
|
||||||
actionBar.setElevation(0);
|
|
||||||
actionBar.setDisplayShowTitleEnabled(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleIntent(Intent intent) {
|
private void handleIntent(Intent intent) {
|
||||||
@@ -321,14 +323,6 @@ public class WifiDppConfiguratorActivity extends InstrumentedActivity implements
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onNavigateUp() {
|
|
||||||
if (!mFragmentManager.popBackStackImmediate()) {
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onQrCodeGeneratorFragmentAddButtonClicked() {
|
public void onQrCodeGeneratorFragmentAddButtonClicked() {
|
||||||
showQrCodeScannerFragment(/* addToBackStack */ true);
|
showQrCodeScannerFragment(/* addToBackStack */ true);
|
||||||
|
@@ -16,9 +16,9 @@
|
|||||||
|
|
||||||
package com.android.settings.wifi.dpp;
|
package com.android.settings.wifi.dpp;
|
||||||
|
|
||||||
import android.app.ActionBar;
|
|
||||||
import android.app.settings.SettingsEnums;
|
import android.app.settings.SettingsEnums;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.res.Resources;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
@@ -27,10 +27,9 @@ import androidx.fragment.app.FragmentManager;
|
|||||||
import androidx.fragment.app.FragmentTransaction;
|
import androidx.fragment.app.FragmentTransaction;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
|
import com.android.settings.SetupWizardUtils;
|
||||||
import com.android.settings.core.InstrumentedActivity;
|
import com.android.settings.core.InstrumentedActivity;
|
||||||
|
|
||||||
import com.google.android.setupcompat.util.WizardManagerHelper;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To provision "this" device with specified Wi-Fi network.
|
* 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;
|
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
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
if (WizardManagerHelper.isAnySetupWizard(getIntent())) {
|
|
||||||
setTheme(R.style.LightTheme_SettingsBase_SetupWizard);
|
|
||||||
}
|
|
||||||
|
|
||||||
setContentView(R.layout.wifi_dpp_activity);
|
setContentView(R.layout.wifi_dpp_activity);
|
||||||
mFragmentManager = getSupportFragmentManager();
|
mFragmentManager = getSupportFragmentManager();
|
||||||
|
|
||||||
if (savedInstanceState == null) {
|
if (savedInstanceState == null) {
|
||||||
handleIntent(getIntent());
|
handleIntent(getIntent());
|
||||||
}
|
}
|
||||||
|
|
||||||
ActionBar actionBar = getActionBar();
|
|
||||||
if (actionBar != null) {
|
|
||||||
actionBar.setElevation(0);
|
|
||||||
actionBar.setDisplayShowTitleEnabled(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleIntent(Intent intent) {
|
private void handleIntent(Intent intent) {
|
||||||
@@ -112,12 +108,6 @@ public class WifiDppEnrolleeActivity extends InstrumentedActivity implements
|
|||||||
fragmentTransaction.commit();
|
fragmentTransaction.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onNavigateUp(){
|
|
||||||
finish();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onScanWifiDppSuccess(WifiQrCode wifiQrCode) {
|
public void onScanWifiDppSuccess(WifiQrCode wifiQrCode) {
|
||||||
// Do nothing
|
// Do nothing
|
||||||
|
@@ -16,14 +16,22 @@
|
|||||||
|
|
||||||
package com.android.settings.wifi.dpp;
|
package com.android.settings.wifi.dpp;
|
||||||
|
|
||||||
|
import android.content.res.Resources;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.DrawableRes;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.core.InstrumentedFragment;
|
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,
|
* 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
|
* this parent fragment instantiates common UI components
|
||||||
@@ -34,37 +42,63 @@ import com.android.settings.core.InstrumentedFragment;
|
|||||||
* {@code WifiDppAddDeviceFragment}
|
* {@code WifiDppAddDeviceFragment}
|
||||||
*/
|
*/
|
||||||
public abstract class WifiDppQrCodeBaseFragment extends InstrumentedFragment {
|
public abstract class WifiDppQrCodeBaseFragment extends InstrumentedFragment {
|
||||||
|
private GlifLayout mGlifLayout;
|
||||||
private ImageView mHeaderIcon;
|
private ImageView mHeaderIcon;
|
||||||
private ImageView mDevicesCheckCircleGreenHeaderIcon;
|
|
||||||
protected TextView mTitle;
|
|
||||||
protected TextView mSummary;
|
protected TextView mSummary;
|
||||||
protected View mTitleSummaryContainer;
|
protected FooterButton mLeftButton;
|
||||||
|
protected FooterButton mRightButton;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||||
super.onViewCreated(view, savedInstanceState);
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
|
||||||
|
mGlifLayout = (GlifLayout) view;
|
||||||
|
|
||||||
mHeaderIcon = view.findViewById(android.R.id.icon);
|
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);
|
mSummary = view.findViewById(android.R.id.summary);
|
||||||
|
|
||||||
// This is the LinearLayout which groups mTitle and mSummary for Talkback to announce the
|
if (isFooterAvailable()) {
|
||||||
// content in a way that reflects its natural groupings.
|
FooterBarMixin FooterBarMixin = ((GlifLayout) view).getMixin(FooterBarMixin.class);
|
||||||
mTitleSummaryContainer = view.findViewById(R.id.title_summary_container);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void setHeaderIconImageResource(int resId) {
|
mLeftButton = new FooterButton.Builder(getContext())
|
||||||
// ic_devices_check_circle_green is a LayerDrawable,
|
.setButtonType(FooterButton.ButtonType.CANCEL)
|
||||||
// it has different size from other VectorDrawable icons
|
.setTheme(R.style.SudGlifButton_Secondary)
|
||||||
if (resId == R.drawable.ic_devices_check_circle_green) {
|
.build();
|
||||||
mHeaderIcon.setVisibility(View.GONE);
|
mGlifLayout.getMixin(FooterBarMixin.class).setSecondaryButton(mLeftButton);
|
||||||
mDevicesCheckCircleGreenHeaderIcon.setVisibility(View.VISIBLE);
|
|
||||||
} else {
|
mRightButton = new FooterButton.Builder(getContext())
|
||||||
mDevicesCheckCircleGreenHeaderIcon.setVisibility(View.GONE);
|
.setButtonType(FooterButton.ButtonType.NEXT)
|
||||||
mHeaderIcon.setImageResource(resId);
|
.setTheme(R.style.SudGlifButton_Primary)
|
||||||
mHeaderIcon.setVisibility(View.VISIBLE);
|
.build();
|
||||||
|
mGlifLayout.getMixin(FooterBarMixin.class).setPrimaryButton(mRightButton);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
package com.android.settings.wifi.dpp;
|
||||||
|
|
||||||
import android.app.ActionBar;
|
|
||||||
import android.app.settings.SettingsEnums;
|
import android.app.settings.SettingsEnums;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
@@ -70,13 +69,6 @@ public class WifiDppQrCodeGeneratorFragment extends WifiDppQrCodeBaseFragment {
|
|||||||
} else {
|
} else {
|
||||||
getActivity().setTitle(R.string.wifi_dpp_share_wifi);
|
getActivity().setTitle(R.string.wifi_dpp_share_wifi);
|
||||||
}
|
}
|
||||||
|
|
||||||
setHasOptionsMenu(true);
|
|
||||||
final ActionBar actionBar = getActivity().getActionBar();
|
|
||||||
if (actionBar != null) {
|
|
||||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
|
||||||
actionBar.show();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -116,13 +108,11 @@ public class WifiDppQrCodeGeneratorFragment extends WifiDppQrCodeBaseFragment {
|
|||||||
|
|
||||||
mQrCodeView = view.findViewById(R.id.qrcode_view);
|
mQrCodeView = view.findViewById(R.id.qrcode_view);
|
||||||
|
|
||||||
setHeaderIconImageResource(R.drawable.ic_qrcode_24dp);
|
|
||||||
|
|
||||||
final WifiNetworkConfig wifiNetworkConfig = getWifiNetworkConfigFromHostActivity();
|
final WifiNetworkConfig wifiNetworkConfig = getWifiNetworkConfigFromHostActivity();
|
||||||
if (wifiNetworkConfig.isHotspot()) {
|
if (wifiNetworkConfig.isHotspot()) {
|
||||||
mTitle.setText(R.string.wifi_dpp_share_hotspot);
|
setHeaderTitle(R.string.wifi_dpp_share_hotspot);
|
||||||
} else {
|
} else {
|
||||||
mTitle.setText(R.string.wifi_dpp_share_wifi);
|
setHeaderTitle(R.string.wifi_dpp_share_wifi);
|
||||||
}
|
}
|
||||||
|
|
||||||
final String password = wifiNetworkConfig.getPreSharedKey();
|
final String password = wifiNetworkConfig.getPreSharedKey();
|
||||||
@@ -168,4 +158,9 @@ public class WifiDppQrCodeGeneratorFragment extends WifiDppQrCodeBaseFragment {
|
|||||||
|
|
||||||
return wifiNetworkConfig;
|
return wifiNetworkConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean isFooterAvailable() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
package com.android.settings.wifi.dpp;
|
package com.android.settings.wifi.dpp;
|
||||||
|
|
||||||
import android.app.ActionBar;
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.settings.SettingsEnums;
|
import android.app.settings.SettingsEnums;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -42,7 +41,6 @@ import android.view.TextureView.SurfaceTextureListener;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.accessibility.AccessibilityEvent;
|
import android.view.accessibility.AccessibilityEvent;
|
||||||
import android.widget.ProgressBar;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.StringRes;
|
import androidx.annotation.StringRes;
|
||||||
@@ -91,7 +89,6 @@ public class WifiDppQrCodeScannerFragment extends WifiDppQrCodeBaseFragment impl
|
|||||||
|
|
||||||
private static final int ARG_RESTART_CAMERA = 1;
|
private static final int ARG_RESTART_CAMERA = 1;
|
||||||
|
|
||||||
private ProgressBar mProgressBar;
|
|
||||||
private QrCamera mCamera;
|
private QrCamera mCamera;
|
||||||
private TextureView mTextureView;
|
private TextureView mTextureView;
|
||||||
private QrDecorateView mDecorateView;
|
private QrDecorateView mDecorateView;
|
||||||
@@ -136,7 +133,7 @@ public class WifiDppQrCodeScannerFragment extends WifiDppQrCodeBaseFragment impl
|
|||||||
SHOW_ERROR_MESSAGE_INTERVAL);
|
SHOW_ERROR_MESSAGE_INTERVAL);
|
||||||
|
|
||||||
if (msg.arg1 == ARG_RESTART_CAMERA) {
|
if (msg.arg1 == ARG_RESTART_CAMERA) {
|
||||||
mProgressBar.setVisibility(View.INVISIBLE);
|
setProgressBarShown(false);
|
||||||
mDecorateView.setFocused(false);
|
mDecorateView.setFocused(false);
|
||||||
restartCamera();
|
restartCamera();
|
||||||
}
|
}
|
||||||
@@ -150,7 +147,7 @@ public class WifiDppQrCodeScannerFragment extends WifiDppQrCodeBaseFragment impl
|
|||||||
mScanWifiDppSuccessListener.onScanWifiDppSuccess((WifiQrCode)msg.obj);
|
mScanWifiDppSuccessListener.onScanWifiDppSuccess((WifiQrCode)msg.obj);
|
||||||
|
|
||||||
if (!mIsConfiguratorMode) {
|
if (!mIsConfiguratorMode) {
|
||||||
mProgressBar.setVisibility(View.VISIBLE);
|
setProgressBarShown(true);
|
||||||
startWifiDppEnrolleeInitiator((WifiQrCode)msg.obj);
|
startWifiDppEnrolleeInitiator((WifiQrCode)msg.obj);
|
||||||
updateEnrolleeSummary();
|
updateEnrolleeSummary();
|
||||||
mSummary.sendAccessibilityEvent(
|
mSummary.sendAccessibilityEvent(
|
||||||
@@ -335,12 +332,6 @@ public class WifiDppQrCodeScannerFragment extends WifiDppQrCodeBaseFragment impl
|
|||||||
} else {
|
} else {
|
||||||
getActivity().setTitle(R.string.wifi_dpp_scan_qr_code);
|
getActivity().setTitle(R.string.wifi_dpp_scan_qr_code);
|
||||||
}
|
}
|
||||||
|
|
||||||
final ActionBar actionBar = getActivity().getActionBar();
|
|
||||||
if (actionBar != null) {
|
|
||||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
|
||||||
actionBar.show();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -373,13 +364,10 @@ public class WifiDppQrCodeScannerFragment extends WifiDppQrCodeBaseFragment impl
|
|||||||
|
|
||||||
mDecorateView = (QrDecorateView) view.findViewById(R.id.decorate_view);
|
mDecorateView = (QrDecorateView) view.findViewById(R.id.decorate_view);
|
||||||
|
|
||||||
setHeaderIconImageResource(R.drawable.ic_scan_24dp);
|
setProgressBarShown(isGoingInitiator());
|
||||||
|
|
||||||
mProgressBar = view.findViewById(R.id.indeterminate_bar);
|
|
||||||
mProgressBar.setVisibility(isGoingInitiator() ? View.VISIBLE : View.INVISIBLE);
|
|
||||||
|
|
||||||
if (mIsConfiguratorMode) {
|
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())
|
WifiNetworkConfig wifiNetworkConfig = ((WifiNetworkConfig.Retriever) getActivity())
|
||||||
.getWifiNetworkConfig();
|
.getWifiNetworkConfig();
|
||||||
@@ -389,7 +377,7 @@ public class WifiDppQrCodeScannerFragment extends WifiDppQrCodeBaseFragment impl
|
|||||||
mSummary.setText(getString(R.string.wifi_dpp_center_qr_code,
|
mSummary.setText(getString(R.string.wifi_dpp_center_qr_code,
|
||||||
wifiNetworkConfig.getSsid()));
|
wifiNetworkConfig.getSsid()));
|
||||||
} else {
|
} else {
|
||||||
mTitle.setText(R.string.wifi_dpp_scan_qr_code);
|
setHeaderTitle(R.string.wifi_dpp_scan_qr_code);
|
||||||
|
|
||||||
updateEnrolleeSummary();
|
updateEnrolleeSummary();
|
||||||
}
|
}
|
||||||
@@ -733,4 +721,9 @@ public class WifiDppQrCodeScannerFragment extends WifiDppQrCodeBaseFragment impl
|
|||||||
protected boolean isDecodeTaskAlive() {
|
protected boolean isDecodeTaskAlive() {
|
||||||
return mCamera != null && mCamera.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</item>
|
||||||
<item>@drawable/ic_delete_accent</item>
|
<item>@drawable/ic_delete_accent</item>
|
||||||
<item>@drawable/ic_devices_other</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_do_not_disturb_on_24dp</item>
|
||||||
<item>@drawable/ic_eject_24dp</item>
|
<item>@drawable/ic_eject_24dp</item>
|
||||||
<item>@drawable/ic_expand_less</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.ShadowAlertDialogCompat;
|
||||||
import com.android.settings.testutils.shadow.ShadowConnectivityManager;
|
import com.android.settings.testutils.shadow.ShadowConnectivityManager;
|
||||||
import com.android.settings.testutils.shadow.ShadowWifiManager;
|
import com.android.settings.testutils.shadow.ShadowWifiManager;
|
||||||
import com.android.settings.wifi.dpp.WifiDppEnrolleeActivity;
|
|
||||||
|
|
||||||
import com.google.android.setupcompat.util.WizardManagerHelper;
|
import com.google.android.setupcompat.util.WizardManagerHelper;
|
||||||
|
|
||||||
@@ -38,7 +37,6 @@ import org.mockito.Mock;
|
|||||||
import org.mockito.MockitoAnnotations;
|
import org.mockito.MockitoAnnotations;
|
||||||
import org.robolectric.Robolectric;
|
import org.robolectric.Robolectric;
|
||||||
import org.robolectric.RobolectricTestRunner;
|
import org.robolectric.RobolectricTestRunner;
|
||||||
import org.robolectric.android.controller.ActivityController;
|
|
||||||
import org.robolectric.annotation.Config;
|
import org.robolectric.annotation.Config;
|
||||||
import org.robolectric.util.ReflectionHelpers;
|
import org.robolectric.util.ReflectionHelpers;
|
||||||
|
|
||||||
@@ -113,23 +111,4 @@ public class WifiDialogActivityTest {
|
|||||||
assertThat(dialog.getContext().getThemeResId())
|
assertThat(dialog.getContext().getThemeResId())
|
||||||
.isEqualTo(R.style.SuwAlertDialogThemeCompat_Light);
|
.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.provider.Settings;
|
||||||
import android.support.test.uiautomator.UiDevice;
|
import android.support.test.uiautomator.UiDevice;
|
||||||
|
|
||||||
|
import androidx.fragment.app.FragmentManager;
|
||||||
import androidx.test.InstrumentationRegistry;
|
import androidx.test.InstrumentationRegistry;
|
||||||
import androidx.test.rule.ActivityTestRule;
|
import androidx.test.rule.ActivityTestRule;
|
||||||
import androidx.test.runner.AndroidJUnit4;
|
import androidx.test.runner.AndroidJUnit4;
|
||||||
|
|
||||||
|
import com.google.android.setupdesign.GlifLayout;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@@ -60,8 +63,13 @@ public class WifiDppConfiguratorActivityTest {
|
|||||||
intent.putExtra(WifiDppUtils.EXTRA_WIFI_PRE_SHARED_KEY, "password");
|
intent.putExtra(WifiDppUtils.EXTRA_WIFI_PRE_SHARED_KEY, "password");
|
||||||
|
|
||||||
mActivityRule.launchActivity(intent);
|
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
|
@Test
|
||||||
@@ -73,8 +81,13 @@ public class WifiDppConfiguratorActivityTest {
|
|||||||
intent.putExtra(WifiDppUtils.EXTRA_WIFI_PRE_SHARED_KEY, "password");
|
intent.putExtra(WifiDppUtils.EXTRA_WIFI_PRE_SHARED_KEY, "password");
|
||||||
|
|
||||||
mActivityRule.launchActivity(intent);
|
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
|
@Test
|
||||||
@@ -84,14 +97,14 @@ public class WifiDppConfiguratorActivityTest {
|
|||||||
|
|
||||||
mActivityRule.launchActivity(intent);
|
mActivityRule.launchActivity(intent);
|
||||||
|
|
||||||
assertThat(mActivityRule.getActivity().isFinishing()).isEqualTo(false);
|
assertThat(mActivityRule.getActivity().isFinishing()).isFalse();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testActivity_shouldImplementsWifiNetworkConfigRetriever() {
|
public void testActivity_shouldImplementsWifiNetworkConfigRetriever() {
|
||||||
WifiDppConfiguratorActivity activity = mActivityRule.getActivity();
|
WifiDppConfiguratorActivity activity = mActivityRule.getActivity();
|
||||||
|
|
||||||
assertThat(activity instanceof WifiNetworkConfig.Retriever).isEqualTo(true);
|
assertThat(activity instanceof WifiNetworkConfig.Retriever).isTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -99,7 +112,7 @@ public class WifiDppConfiguratorActivityTest {
|
|||||||
WifiDppConfiguratorActivity activity = mActivityRule.getActivity();
|
WifiDppConfiguratorActivity activity = mActivityRule.getActivity();
|
||||||
|
|
||||||
assertThat(activity instanceof WifiDppQrCodeGeneratorFragment
|
assertThat(activity instanceof WifiDppQrCodeGeneratorFragment
|
||||||
.OnQrCodeGeneratorFragmentAddButtonClickedListener).isEqualTo(true);
|
.OnQrCodeGeneratorFragmentAddButtonClickedListener).isTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -107,7 +120,7 @@ public class WifiDppConfiguratorActivityTest {
|
|||||||
WifiDppConfiguratorActivity activity = mActivityRule.getActivity();
|
WifiDppConfiguratorActivity activity = mActivityRule.getActivity();
|
||||||
|
|
||||||
assertThat(activity instanceof WifiDppQrCodeScannerFragment
|
assertThat(activity instanceof WifiDppQrCodeScannerFragment
|
||||||
.OnScanWifiDppSuccessListener).isEqualTo(true);
|
.OnScanWifiDppSuccessListener).isTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -115,7 +128,7 @@ public class WifiDppConfiguratorActivityTest {
|
|||||||
WifiDppConfiguratorActivity activity = mActivityRule.getActivity();
|
WifiDppConfiguratorActivity activity = mActivityRule.getActivity();
|
||||||
|
|
||||||
assertThat(activity instanceof WifiDppAddDeviceFragment
|
assertThat(activity instanceof WifiDppAddDeviceFragment
|
||||||
.OnClickChooseDifferentNetworkListener).isEqualTo(true);
|
.OnClickChooseDifferentNetworkListener).isTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -175,40 +188,4 @@ public class WifiDppConfiguratorActivityTest {
|
|||||||
assertThat(restoredWifiNetworkConfig.getNetworkId()).isEqualTo(0);
|
assertThat(restoredWifiNetworkConfig.getNetworkId()).isEqualTo(0);
|
||||||
assertThat(restoredWifiNetworkConfig.isHotspot()).isTrue();
|
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