Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ad9874e1 authored by Arc Wang's avatar Arc Wang Committed by Android (Google) Code Review
Browse files

Merge "Add more Wi-Fi DPP UI features."

parents 6be224a9 c8cd5d38
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -68,7 +68,7 @@
                        android:layout_centerVertical="true"
                        android:layout_margin="5dp"
                        android:background="@null"
                        android:src="@drawable/ic_qrcode_24dp"
                        android:src="@drawable/ic_scan_24dp"
                        android:visibility="gone"
                        android:contentDescription="@string/wifi_add_network" />
                </RelativeLayout>
@@ -303,7 +303,7 @@
                        android:layout_centerVertical="true"
                        android:layout_margin="5dp"
                        android:background="@null"
                        android:src="@drawable/ic_qrcode_24dp"
                        android:src="@drawable/ic_scan_24dp"
                        android:visibility="gone"
                        android:contentDescription="@string/wifi_add_network" />
                </RelativeLayout>
+5 −8
Original line number Diff line number Diff line
@@ -24,22 +24,19 @@

    <include layout="@layout/wifi_dpp_fragment_header"/>

    <ProgressBar
      android:id="@+id/progress_bar"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:indeterminate="true"/>

    <ImageView
        android:id="@+id/wifi_ap_picture_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="center"/>

    <TextView android:id="@+id/choose_different_network"
    <TextView
        android:id="@+id/choose_different_network"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"/>
        android:layout_gravity="center"
        android:layout_marginTop="8dp"
        android:text="@string/wifi_dpp_choose_different_network"/>

    <include layout="@layout/wifi_dpp_fragment_footer"
        android:gravity="center|bottom"/>
+16 −4
Original line number Diff line number Diff line
@@ -2077,13 +2077,13 @@
    <!-- Label for the spinner to show Wifi MAC randomization [CHAR LIMIT=25] -->
    <string name="wifi_privacy_settings">Privacy</string>
    <!-- Title for the fragment to add a device into the wifi network [CHAR LIMIT=50]  -->
    <string name="wifi_dpp_add_device_to_network">Add a device to this network</string>
    <string name="wifi_dpp_add_device_to_network">Add a device</string>
    <!-- Hint for the user to center another device's QR code in the below camera window [CHAR LIMIT=120] -->
    <string name="wifi_dpp_center_qr_code">Center the device\u2019s QR code below to add device to \u201c<xliff:g id="ssid" example="OfficeWifi">%1$s</xliff:g>\u201d</string>
    <string name="wifi_dpp_center_qr_code">Center the QR code below to add the device to \u201c<xliff:g id="ssid" example="OfficeWifi">%1$s</xliff:g>\u201d</string>
    <!-- Title for the fragment to scan QR code [CHAR LIMIT=50]  -->
    <string name="wifi_dpp_scan_qr_code">Scan QR code</string>
    <!-- Hint for the user to center another device's QR code in the below camera window [CHAR LIMIT=NONE] -->
    <string name="wifi_dpp_scan_qr_code_join_network">Join \u201c<xliff:g id="ssid" example="OfficeWifi">%1$s</xliff:g>\u201d by scanning a QR code</string>
    <string name="wifi_dpp_scan_qr_code_join_network">Center the QR code below to connect to \u201c<xliff:g id="ssid" example="OfficeWifi">%1$s</xliff:g>\u201d</string>
    <!-- Hint for the user to center another device's QR code in the below camera window [CHAR LIMIT=NONE] -->
    <string name="wifi_dpp_scan_qr_code_join_unknown_network">Join Wi\u2011Fi by scanning a QR code</string>
    <!-- Title for the fragment to share Wi-Fi [CHAR LIMIT=50]  -->
@@ -2091,7 +2091,19 @@
    <!-- Hint for the user to use another device to scan QR code on screen to join Wi-Fi [CHAR LIMIT=NONE] -->
    <string name="wifi_dpp_scan_qr_code_with_another_device">Scan this QR code with another device to join \u201c<xliff:g id="ssid" example="OfficeWifi">%1$s</xliff:g>\u201d</string>
    <!-- Hint for QR code detection [CHAR LIMIT=NONE]  -->
    <string name="wifi_dpp_could_not_detect_valid_qr_code">Could not detect valid QR code</string>
    <string name="wifi_dpp_could_not_detect_valid_qr_code">Couldn\u2019t read QR code</string>
    <!-- Title for the fragment choose network [CHAR LIMIT=50]  -->
    <string name="wifi_dpp_choose_network">Choose network</string>
    <!-- Hint for the user to center another device's QR code in the below camera window [CHAR LIMIT=NONE] -->
    <string name="wifi_dpp_choose_network_to_connect_device">To connect your device, choose a network</string>
    <!-- Hint for the user to add the device to a Wi-Fi network [CHAR LIMIT=NONE] -->
    <string name="wifi_dpp_add_device_to_wifi">Add this device to \u201c<xliff:g id="ssid" example="OfficeWifi">%1$s</xliff:g>\u201d?</string>
    <!-- Title for the fragment to tell the user that Wi-Fi shared with device successfully [CHAR LIMIT=50]  -->
    <string name="wifi_dpp_wifi_shared_with_device">Wi\u2011Fi shared with device</string>
    <!-- Button label to add another device to Wi-Fi [CHAR LIMIT=50]  -->
    <string name="wifi_dpp_add_another_device">Add another device</string>
    <!-- Button label to choose different Wi-Fi network [CHAR LIMIT=80]  -->
    <string name="wifi_dpp_choose_different_network">Choose different network</string>
    <!-- Label for the check box to share a network with other users on the same device -->
    <string name="wifi_shared">Share with other device users</string>
    <!-- Hint for unchanged fields -->
+1 −1
Original line number Diff line number Diff line
@@ -240,7 +240,7 @@ public class WifiSettings extends RestrictedSettingsFragment
        mAddPreference.setIcon(R.drawable.ic_menu_add);
        mAddPreference.setTitle(R.string.wifi_add_network);
        if (WifiDppUtils.isSharingNetworkEnabled(getContext())) {
            mAddPreference.setButtonIcon(R.drawable.ic_qrcode_24dp);
            mAddPreference.setButtonIcon(R.drawable.ic_scan_24dp);
            mAddPreference.setButtonOnClickListener((View v) -> {
                // Launch QR code scanner to join a network.
                getContext().startActivity(
+29 −2
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.settings.wifi.dpp;

import android.app.ActionBar;
import android.app.Activity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
@@ -33,7 +35,6 @@ import com.android.settings.R;
 * to the Wi-Fi network.
 */
public class WifiDppAddDeviceFragment extends WifiDppQrCodeBaseFragment {
    private ProgressBar mProgressBar;
    private ImageView mWifiApPictureView;
    private TextView mChooseDifferentNetwork;
    private Button mButtonLeft;
@@ -44,6 +45,16 @@ public class WifiDppAddDeviceFragment extends WifiDppQrCodeBaseFragment {
        return MetricsProto.MetricsEvent.SETTINGS_WIFI_DPP_CONFIGURATOR;
    }

    @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) {
@@ -55,10 +66,26 @@ public class WifiDppAddDeviceFragment extends WifiDppQrCodeBaseFragment {
    public void onViewCreated(View view, Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);

        mProgressBar = view.findViewById(R.id.progress_bar);
        final WifiNetworkConfig wifiNetworkConfig = ((WifiDppConfiguratorActivity) getActivity())
                .getWifiNetworkConfig();
        if (!WifiNetworkConfig.isValidConfig(wifiNetworkConfig)) {
            throw new IllegalStateException("Invalid Wi-Fi network for configuring");
        }
        mSummary.setText(getString(R.string.wifi_dpp_add_device_to_wifi,
                wifiNetworkConfig.getSsid()));

        mWifiApPictureView = view.findViewById(R.id.wifi_ap_picture_view);
        mChooseDifferentNetwork = view.findViewById(R.id.choose_different_network);
        mButtonLeft = view.findViewById(R.id.button_left);
        mButtonLeft.setText(R.string.cancel);
        mButtonLeft.setOnClickListener(v -> getFragmentManager().popBackStack());

        mButtonRight = view.findViewById(R.id.button_right);
        mButtonRight.setText(R.string.wifi_dpp_share_wifi);
        mButtonRight.setOnClickListener(v -> startWifiDppInitiator());
    }

    private void startWifiDppInitiator() {
        //TODO(b/122331217): starts Wi-Fi DPP initiator handshake here
    }
}
Loading