Add more Wi-Fi DPP UI features.

1. Use ConstraintLayout to fix footer buttons at bottom
2. ScrollViews have all other UI components excepts footer buttons
3. Use style/SuwGlifButton for buttons
4. Fix scan fragment crash when rotating screen

Bug: 118794978
Test: manual test
Change-Id: I509b0156c4835c75da75fb7ac4c82f55a0b506a1
This commit is contained in:
Arc Wang
2019-01-07 11:51:42 +08:00
parent 1cb7e12fab
commit 8eda83d071
11 changed files with 189 additions and 94 deletions

View File

@@ -19,29 +19,40 @@
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">
android:layout_height="match_parent">
<include layout="@layout/wifi_dpp_fragment_header"/>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.android.settings.wifi.qrcode.QrPreviewLayout
android:layout_width="@dimen/qrcode_preview_size"
android:layout_height="@dimen/qrcode_preview_size"
android:layout_gravity="center">
<TextureView
android:id="@+id/preview_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"/>
<com.android.settings.wifi.qrcode.QrDecorateView
android:id="@+id/decorate_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"/>
</com.android.settings.wifi.qrcode.QrPreviewLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center_horizontal">
<TextView android:id="@+id/error_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"/>
<include layout="@layout/wifi_dpp_fragment_header"/>
<com.android.settings.wifi.qrcode.QrPreviewLayout
android:layout_width="@dimen/qrcode_preview_size"
android:layout_height="@dimen/qrcode_preview_size">
<TextureView
android:id="@+id/preview_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"/>
<com.android.settings.wifi.qrcode.QrDecorateView
android:id="@+id/decorate_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"/>
</com.android.settings.wifi.qrcode.QrPreviewLayout>
<TextView android:id="@+id/error_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
</ScrollView>
</LinearLayout>

View File

@@ -15,7 +15,7 @@
limitations under the License.
-->
<ScrollView
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/root"
android:layout_width="match_parent"
@@ -27,4 +27,4 @@
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</ScrollView>
</LinearLayout>

View File

@@ -15,31 +15,49 @@
limitations under the License.
-->
<LinearLayout
<androidx.constraintlayout.widget.ConstraintLayout
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:orientation="vertical">
android:layout_height="match_parent">
<include layout="@layout/wifi_dpp_fragment_header"/>
<ImageView
android:id="@+id/wifi_ap_picture_view"
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"/>
android:layout_height="match_parent">
<TextView
android:id="@+id/choose_different_network"
android:layout_width="wrap_content"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:orientation="vertical">
<include layout="@layout/wifi_dpp_fragment_header"/>
<ImageView
android:id="@+id/wifi_ap_picture_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@+id/header"/>
<Button
android:id="@+id/choose_different_network"
style="@style/SuwGlifButton.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>
<include
layout="@layout/wifi_dpp_fragment_footer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="8dp"
android:text="@string/wifi_dpp_choose_different_network"/>
app:layout_constraintBottom_toBottomOf="parent"/>
<include layout="@layout/wifi_dpp_fragment_footer"
android:gravity="center|bottom"/>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -15,21 +15,39 @@
limitations under the License.
-->
<LinearLayout
<androidx.constraintlayout.widget.ConstraintLayout
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:orientation="vertical">
android:layout_height="match_parent">
<include layout="@layout/wifi_dpp_fragment_header"/>
<ListView android:id="@+id/saved_wifi_network_list"
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
android:layout_height="match_parent">
<include layout="@layout/wifi_dpp_fragment_footer"
android:gravity="center|bottom"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:orientation="vertical">
</LinearLayout>
<include layout="@layout/wifi_dpp_fragment_header"/>
<ListView android:id="@+id/saved_wifi_network_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@+id/header"/>
</LinearLayout>
</ScrollView>
<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>

View File

@@ -18,16 +18,15 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
android:layout_height="wrap_content"
style="@style/SuwGlifButtonBar">
<Button
android:id="@+id/button_left"
style="@style/SuwGlifButton.Secondary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|start"
android:text="left"
style="?android:attr/borderlessButtonStyle"/>
android:layout_gravity="start"/>
<Space
android:layout_width="0dp"
@@ -36,9 +35,9 @@
<Button
android:id="@+id/button_right"
style="@style/SuwGlifButton.Primary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:text="right"/>
android:layout_gravity="end"/>
</LinearLayout>

View File

@@ -22,14 +22,27 @@
android:layout_height="match_parent"
android:orientation="vertical">
<include layout="@layout/wifi_dpp_fragment_header"/>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/qrcode_view"
android:layout_width="@dimen/qrcode_size"
android:layout_height="@dimen/qrcode_size"
android:src="@android:color/transparent"
android:layout_gravity="center"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:orientation="vertical">
<include layout="@layout/wifi_dpp_fragment_header"/>
<ImageView
android:id="@+id/qrcode_view"
android:layout_width="@dimen/qrcode_size"
android:layout_height="@dimen/qrcode_size"
android:src="@android:color/transparent"/>
</LinearLayout>
</ScrollView>
</LinearLayout>

View File

@@ -19,35 +19,45 @@
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">
android:layout_height="match_parent">
<include layout="@layout/wifi_dpp_fragment_header"/>
<com.android.settings.wifi.qrcode.QrPreviewLayout
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextureView
android:id="@+id/preview_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"/>
<com.android.settings.wifi.qrcode.QrDecorateView
android:id="@+id/decorate_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"/>
</com.android.settings.wifi.qrcode.QrPreviewLayout>
<TextView
android:id="@+id/error_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="8dp"
android:text="@string/wifi_dpp_could_not_detect_valid_qr_code"
android:visibility="invisible"
android:textColor="?android:attr/colorError"/>
<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"/>
<com.android.settings.wifi.qrcode.QrPreviewLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextureView
android:id="@+id/preview_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<com.android.settings.wifi.qrcode.QrDecorateView
android:id="@+id/decorate_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</com.android.settings.wifi.qrcode.QrPreviewLayout>
<TextView
android:id="@+id/error_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="@string/wifi_dpp_could_not_detect_valid_qr_code"
android:visibility="invisible"
android:textColor="?android:attr/colorError"/>
</LinearLayout>
</ScrollView>
</LinearLayout>