[WifiSetup] Make dialogs immersive
Added a dialog specific applyImmersiveFlags method that adds immersive flags without the LAYOUT_ flags. The LAYOUT_ flags causes the dialog to not resize when IME is visible, and the dialog doesn't need to be drawn under the navigation / status bars anyway. Bug: 17759269 Change-Id: I0186e85d9f398af73c511b1a5ec6e83febe97f83
This commit is contained in:
@@ -21,17 +21,23 @@ import com.android.setupwizard.navigationbar.SetupWizardNavBar;
|
||||
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.LayerDrawable;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class SetupWizardUtils {
|
||||
private static final String TAG = "SetupWizardUtils";
|
||||
|
||||
public static final int DIALOG_IMMERSIVE_FLAGS = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
||||
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
|
||||
|
||||
// Extra containing the resource name of the theme to be used
|
||||
public static final String EXTRA_THEME = "theme";
|
||||
public static final String THEME_HOLO = "holo";
|
||||
@@ -95,6 +101,16 @@ public class SetupWizardUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public static void applyImmersiveFlags(final Dialog dialog) {
|
||||
applyImmersiveFlags(dialog.getWindow(), DIALOG_IMMERSIVE_FLAGS);
|
||||
}
|
||||
|
||||
private static void applyImmersiveFlags(final Window window, final int vis) {
|
||||
WindowManager.LayoutParams attrs = window.getAttributes();
|
||||
attrs.systemUiVisibility |= vis;
|
||||
window.setAttributes(attrs);
|
||||
}
|
||||
|
||||
public static TextView getHeader(Activity activity) {
|
||||
return (TextView) activity.findViewById(R.id.title);
|
||||
}
|
||||
|
Reference in New Issue
Block a user