Integrate QrCode Camera with WifiDppQrCodeScannerFragment

Bug: 118797380
Test: RunSettingsRoboTests
Change-Id: I328bebbbcf44136df2c18ca1929a5da377a0cf6b
This commit is contained in:
Johnson Lu
2018-11-28 15:31:16 +08:00
parent 0173c5f532
commit a558c01696
6 changed files with 189 additions and 21 deletions

View File

@@ -21,6 +21,7 @@ import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
@@ -86,21 +87,21 @@ public class WifiDppConfiguratorActivity extends InstrumentedActivity {
}
private void addQrCodeScannerFragment() {
WifiDppQrCodeScannerFragment fragment = new WifiDppQrCodeScannerFragment();
final WifiDppQrCodeScannerFragment fragment = new WifiDppQrCodeScannerFragment();
mFragmentTransaction.add(R.id.fragment_container, fragment);
mFragmentTransaction.addToBackStack(null);
mFragmentTransaction.addToBackStack(/* name */ null);
mFragmentTransaction.commit();
}
private void addQrCodeGeneratorFragment() {
WifiDppQrCodeGeneratorFragment fragment = new WifiDppQrCodeGeneratorFragment();
final WifiDppQrCodeGeneratorFragment fragment = new WifiDppQrCodeGeneratorFragment();
mFragmentTransaction.add(R.id.fragment_container, fragment);
mFragmentTransaction.addToBackStack(null);
mFragmentTransaction.addToBackStack(/* name */ null);
mFragmentTransaction.commit();
}
private void addChooseSavedWifiNetworkFragment() {
ActionBar action = getActionBar();
final ActionBar action = getActionBar();
if (action != null) {
action.hide();
}
@@ -108,7 +109,18 @@ public class WifiDppConfiguratorActivity extends InstrumentedActivity {
WifiDppChooseSavedWifiNetworkFragment fragment =
new WifiDppChooseSavedWifiNetworkFragment();
mFragmentTransaction.add(R.id.fragment_container, fragment);
mFragmentTransaction.addToBackStack(null);
mFragmentTransaction.addToBackStack(/* name */ null);
mFragmentTransaction.commit();
}
@Override
protected void onStop() {
final Fragment fragment = mFragmentManager.findFragmentById(R.id.fragment_container);
if (fragment != null) {
// Remove it to prevent stacking multiple fragments after screen rotated.
mFragmentManager.beginTransaction().remove(fragment).commit();
}
super.onStop();
}
}