Implement receiver flow of WiFi sharing feature

1.Add a button to launch QR code scanner when add a network.
2.Scan button added in AddNetworkFragment / WifiDialog / WifiSettings.

Bug: 120630683
Test: make RunSettingsRoboTests
Change-Id: I340bfa2247e092f586dd90dfea37c355e681ffee
This commit is contained in:
Johnson Lu
2018-12-07 11:56:49 +08:00
parent 15cdfc4ec2
commit 5aef897e9b
8 changed files with 356 additions and 13 deletions

View File

@@ -23,12 +23,14 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageButton;
import androidx.annotation.VisibleForTesting;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settings.R;
import com.android.settings.core.InstrumentedFragment;
import com.android.settings.wifi.dpp.WifiDppUtils;
public class AddNetworkFragment extends InstrumentedFragment implements WifiConfigUiBase,
View.OnClickListener {
@@ -64,6 +66,18 @@ public class AddNetworkFragment extends InstrumentedFragment implements WifiConf
mCancelBtn.setOnClickListener(this);
mUIController = new WifiConfigController(this, rootView, null, getMode());
if (WifiDppUtils.isSharingNetworkEnabled(getContext())) {
final ImageButton scannerButton = rootView.findViewById(R.id.ssid_scanner_button);
if (scannerButton != null) {
scannerButton.setVisibility(View.VISIBLE);
scannerButton.setOnClickListener((View v) -> {
// Launch QR code scanner to join a network.
getContext().startActivity(
WifiDppUtils.getConfiguratorQRCodeScannerIntent(/* ssid */ null));
});
}
}
return rootView;
}