SetupWizard: Aggressively hide nav bar on soft key devices

Change-Id: Ic23fd7e605a323411fe2f581235ff3ed45bfcaed
(cherry picked from commit 1d7988a4c78aa8a4c768e8ddb8e0ced2c8f8c530)
This commit is contained in:
cretin45 2015-04-09 10:44:41 -07:00 committed by Ed Carrigan
parent 317a15e0eb
commit 714be1a490
2 changed files with 24 additions and 6 deletions

View File

@ -66,6 +66,7 @@
<application android:label="@string/app_name" <application android:label="@string/app_name"
android:icon="@drawable/icon" android:icon="@drawable/icon"
android:theme="@style/Theme.Setup" android:theme="@style/Theme.Setup"
android:uiOptions="none"
android:name=".SetupWizardApp"> android:name=".SetupWizardApp">
<meta-data android:name="com.google.android.gms.version" <meta-data android:name="com.google.android.gms.version"
@ -75,9 +76,9 @@
android:label="@string/product_name" android:label="@string/product_name"
android:launchMode="singleInstance" android:launchMode="singleInstance"
android:excludeFromRecents="true" android:excludeFromRecents="true"
android:uiOptions="none"
android:configChanges="themeChange|mcc|mnc" android:configChanges="themeChange|mcc|mnc"
android:immersive="true"> android:immersive="true"
android:windowSoftInputMode="stateAlwaysHidden">
<intent-filter android:priority="9"> <intent-filter android:priority="9">

View File

@ -56,6 +56,12 @@ public class SetupWizardActivity extends Activity implements SetupDataCallbacks,
private static final String TAG = SetupWizardActivity.class.getSimpleName(); private static final String TAG = SetupWizardActivity.class.getSimpleName();
private static final int UI_FLAGS = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
private View mRootView; private View mRootView;
private View mButtonBar; private View mButtonBar;
private Button mNextButton; private Button mNextButton;
@ -77,12 +83,25 @@ public class SetupWizardActivity extends Activity implements SetupDataCallbacks,
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
final View decorView = getWindow().getDecorView();
decorView.setSystemUiVisibility(UI_FLAGS);
decorView.setOnSystemUiVisibilityChangeListener(
new View.OnSystemUiVisibilityChangeListener() {
@Override
public void onSystemUiVisibilityChange(int visibility) {
if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) {
decorView.setSystemUiVisibility(UI_FLAGS);
}
}
});
if (sLaunchTime == 0) { if (sLaunchTime == 0) {
SetupStats.addEvent(SetupStats.Categories.APP_LAUNCH, TAG); SetupStats.addEvent(SetupStats.Categories.APP_LAUNCH, TAG);
sLaunchTime = System.nanoTime(); sLaunchTime = System.nanoTime();
} }
setContentView(R.layout.setup_main); setContentView(R.layout.setup_main);
mRootView = findViewById(R.id.root); mRootView = findViewById(R.id.root);
mRootView.setSystemUiVisibility(UI_FLAGS);
mReveal = (ImageView)mRootView.findViewById(R.id.reveal); mReveal = (ImageView)mRootView.findViewById(R.id.reveal);
mButtonBar = findViewById(R.id.button_bar); mButtonBar = findViewById(R.id.button_bar);
mFinishingProgressBar = (ProgressBar)findViewById(R.id.finishing_bar); mFinishingProgressBar = (ProgressBar)findViewById(R.id.finishing_bar);
@ -134,10 +153,8 @@ public class SetupWizardActivity extends Activity implements SetupDataCallbacks,
@Override @Override
protected void onResume() { protected void onResume() {
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE final View decorView = getWindow().getDecorView();
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN decorView.setSystemUiVisibility(UI_FLAGS);
| View.SYSTEM_UI_FLAG_IMMERSIVE
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
super.onResume(); super.onResume();
if (mSetupData.isFinished()) { if (mSetupData.isFinished()) {
mHandler.postDelayed(new Runnable() { mHandler.postDelayed(new Runnable() {