Loading core/java/com/android/internal/app/AlertController.java +55 −20 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import android.content.DialogInterface; import android.content.res.TypedArray; import android.database.Cursor; import android.graphics.drawable.Drawable; import android.os.Build; import android.os.Handler; import android.os.Message; import android.text.TextUtils; Loading @@ -38,6 +39,7 @@ import android.view.View; import android.view.ViewGroup; import android.view.ViewGroup.LayoutParams; import android.view.Window; import android.view.WindowInsets; import android.view.WindowManager; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; Loading Loading @@ -239,6 +241,7 @@ public class AlertController { } mWindow.setContentView(mAlertDialogLayout); setupView(); setupDecor(); } public void setTitle(CharSequence title) { Loading Loading @@ -390,6 +393,27 @@ public class AlertController { return mScrollView != null && mScrollView.executeKeyEvent(event); } private void setupDecor() { final View decor = mWindow.getDecorView(); final View parent = mWindow.findViewById(R.id.parentPanel); if (parent != null && decor != null) { decor.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() { @Override public WindowInsets onApplyWindowInsets(View view, WindowInsets insets) { if (insets.isRound()) { // TODO: Get the padding as a function of the window size. int roundOffset = mContext.getResources().getDimensionPixelOffset( R.dimen.alert_dialog_round_padding); parent.setPadding(roundOffset, roundOffset, roundOffset, roundOffset); } return insets.consumeSystemWindowInsets(); } }); decor.setFitsSystemWindows(true); decor.requestApplyInsets(); } } private void setupView() { LinearLayout contentPanel = (LinearLayout) mWindow.findViewById(R.id.contentPanel); setupContent(contentPanel); Loading Loading @@ -601,24 +625,35 @@ public class AlertController { View buttonPanel) { /* Get all the different background required */ int fullDark = a.getResourceId( R.styleable.AlertDialog_fullDark, R.drawable.popup_full_dark); int topDark = a.getResourceId( R.styleable.AlertDialog_topDark, R.drawable.popup_top_dark); int centerDark = a.getResourceId( R.styleable.AlertDialog_centerDark, R.drawable.popup_center_dark); int bottomDark = a.getResourceId( R.styleable.AlertDialog_bottomDark, R.drawable.popup_bottom_dark); int fullBright = a.getResourceId( R.styleable.AlertDialog_fullBright, R.drawable.popup_full_bright); int topBright = a.getResourceId( R.styleable.AlertDialog_topBright, R.drawable.popup_top_bright); int centerBright = a.getResourceId( R.styleable.AlertDialog_centerBright, R.drawable.popup_center_bright); int bottomBright = a.getResourceId( R.styleable.AlertDialog_bottomBright, R.drawable.popup_bottom_bright); int bottomMedium = a.getResourceId( R.styleable.AlertDialog_bottomMedium, R.drawable.popup_bottom_medium); int fullDark = 0; int topDark = 0; int centerDark = 0; int bottomDark = 0; int fullBright = 0; int topBright = 0; int centerBright = 0; int bottomBright = 0; int bottomMedium = 0; if (mContext.getApplicationInfo().targetSdkVersion <= Build.VERSION_CODES.KITKAT) { fullDark = R.drawable.popup_full_dark; topDark = R.drawable.popup_top_dark; centerDark = R.drawable.popup_center_dark; bottomDark = R.drawable.popup_bottom_dark; fullBright = R.drawable.popup_full_bright; topBright = R.drawable.popup_top_bright; centerBright = R.drawable.popup_center_bright; bottomBright = R.drawable.popup_bottom_bright; bottomMedium = R.drawable.popup_bottom_medium; } fullDark = a.getResourceId(R.styleable.AlertDialog_fullDark, fullDark); topDark = a.getResourceId(R.styleable.AlertDialog_topDark, topDark); centerDark = a.getResourceId(R.styleable.AlertDialog_centerDark, centerDark); bottomDark = a.getResourceId(R.styleable.AlertDialog_bottomDark, bottomDark); fullBright = a.getResourceId(R.styleable.AlertDialog_fullBright, fullBright); topBright = a.getResourceId(R.styleable.AlertDialog_topBright, topBright); centerBright = a.getResourceId(R.styleable.AlertDialog_centerBright, centerBright); bottomBright = a.getResourceId(R.styleable.AlertDialog_bottomBright, bottomBright); bottomMedium = a.getResourceId(R.styleable.AlertDialog_bottomMedium, bottomMedium); /* * We now set the background of all of the sections of the alert. Loading core/res/res/layout/alert_dialog_micro.xml +2 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,8 @@ android:id="@+id/parentPanel" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@android:color/white" android:layout_gravity="center" android:orientation="vertical"> <LinearLayout android:id="@+id/topPanel" Loading core/res/res/values/dimens.xml +2 −0 Original line number Diff line number Diff line Loading @@ -161,6 +161,8 @@ <!-- Preferred width of the search view. --> <dimen name="search_view_preferred_width">320dip</dimen> <!-- Dialog padding for round display --> <dimen name="alert_dialog_round_padding">27dip</dimen> <!-- Dialog title height --> <dimen name="alert_dialog_title_height">64dip</dimen> <!-- Dialog button bar height --> Loading core/res/res/values/styles_micro.xml +10 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,16 @@ --> <resources> <style name="AlertDialog.Micro" parent="AlertDialog.Holo.Light"> <item name="fullDark">@null</item> <item name="topDark">@null</item> <item name="centerDark">@null</item> <item name="bottomDark">@null</item> <item name="fullBright">@null</item> <item name="topBright">@null</item> <item name="centerBright">@null</item> <item name="bottomBright">@null</item> <item name="bottomMedium">@null</item> <item name="centerMedium">@null</item> <item name="layout">@layout/alert_dialog_micro</item> </style> Loading core/res/res/values/symbols.xml +2 −0 Original line number Diff line number Diff line Loading @@ -120,6 +120,7 @@ <java-symbol type="id" name="overlay_display_window_title" /> <java-symbol type="id" name="package_label" /> <java-symbol type="id" name="packages_list" /> <java-symbol type="id" name="parentPanel" /> <java-symbol type="id" name="pause" /> <java-symbol type="id" name="perms_list" /> <java-symbol type="id" name="perm_icon" /> Loading Loading @@ -324,6 +325,7 @@ <java-symbol type="color" name="tab_indicator_text_v4" /> <java-symbol type="dimen" name="accessibility_touch_slop" /> <java-symbol type="dimen" name="alert_dialog_round_padding"/> <java-symbol type="dimen" name="config_prefDialogWidth" /> <java-symbol type="dimen" name="config_viewConfigurationTouchSlop" /> <java-symbol type="dimen" name="config_viewMinFlingVelocity" /> Loading Loading
core/java/com/android/internal/app/AlertController.java +55 −20 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import android.content.DialogInterface; import android.content.res.TypedArray; import android.database.Cursor; import android.graphics.drawable.Drawable; import android.os.Build; import android.os.Handler; import android.os.Message; import android.text.TextUtils; Loading @@ -38,6 +39,7 @@ import android.view.View; import android.view.ViewGroup; import android.view.ViewGroup.LayoutParams; import android.view.Window; import android.view.WindowInsets; import android.view.WindowManager; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; Loading Loading @@ -239,6 +241,7 @@ public class AlertController { } mWindow.setContentView(mAlertDialogLayout); setupView(); setupDecor(); } public void setTitle(CharSequence title) { Loading Loading @@ -390,6 +393,27 @@ public class AlertController { return mScrollView != null && mScrollView.executeKeyEvent(event); } private void setupDecor() { final View decor = mWindow.getDecorView(); final View parent = mWindow.findViewById(R.id.parentPanel); if (parent != null && decor != null) { decor.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() { @Override public WindowInsets onApplyWindowInsets(View view, WindowInsets insets) { if (insets.isRound()) { // TODO: Get the padding as a function of the window size. int roundOffset = mContext.getResources().getDimensionPixelOffset( R.dimen.alert_dialog_round_padding); parent.setPadding(roundOffset, roundOffset, roundOffset, roundOffset); } return insets.consumeSystemWindowInsets(); } }); decor.setFitsSystemWindows(true); decor.requestApplyInsets(); } } private void setupView() { LinearLayout contentPanel = (LinearLayout) mWindow.findViewById(R.id.contentPanel); setupContent(contentPanel); Loading Loading @@ -601,24 +625,35 @@ public class AlertController { View buttonPanel) { /* Get all the different background required */ int fullDark = a.getResourceId( R.styleable.AlertDialog_fullDark, R.drawable.popup_full_dark); int topDark = a.getResourceId( R.styleable.AlertDialog_topDark, R.drawable.popup_top_dark); int centerDark = a.getResourceId( R.styleable.AlertDialog_centerDark, R.drawable.popup_center_dark); int bottomDark = a.getResourceId( R.styleable.AlertDialog_bottomDark, R.drawable.popup_bottom_dark); int fullBright = a.getResourceId( R.styleable.AlertDialog_fullBright, R.drawable.popup_full_bright); int topBright = a.getResourceId( R.styleable.AlertDialog_topBright, R.drawable.popup_top_bright); int centerBright = a.getResourceId( R.styleable.AlertDialog_centerBright, R.drawable.popup_center_bright); int bottomBright = a.getResourceId( R.styleable.AlertDialog_bottomBright, R.drawable.popup_bottom_bright); int bottomMedium = a.getResourceId( R.styleable.AlertDialog_bottomMedium, R.drawable.popup_bottom_medium); int fullDark = 0; int topDark = 0; int centerDark = 0; int bottomDark = 0; int fullBright = 0; int topBright = 0; int centerBright = 0; int bottomBright = 0; int bottomMedium = 0; if (mContext.getApplicationInfo().targetSdkVersion <= Build.VERSION_CODES.KITKAT) { fullDark = R.drawable.popup_full_dark; topDark = R.drawable.popup_top_dark; centerDark = R.drawable.popup_center_dark; bottomDark = R.drawable.popup_bottom_dark; fullBright = R.drawable.popup_full_bright; topBright = R.drawable.popup_top_bright; centerBright = R.drawable.popup_center_bright; bottomBright = R.drawable.popup_bottom_bright; bottomMedium = R.drawable.popup_bottom_medium; } fullDark = a.getResourceId(R.styleable.AlertDialog_fullDark, fullDark); topDark = a.getResourceId(R.styleable.AlertDialog_topDark, topDark); centerDark = a.getResourceId(R.styleable.AlertDialog_centerDark, centerDark); bottomDark = a.getResourceId(R.styleable.AlertDialog_bottomDark, bottomDark); fullBright = a.getResourceId(R.styleable.AlertDialog_fullBright, fullBright); topBright = a.getResourceId(R.styleable.AlertDialog_topBright, topBright); centerBright = a.getResourceId(R.styleable.AlertDialog_centerBright, centerBright); bottomBright = a.getResourceId(R.styleable.AlertDialog_bottomBright, bottomBright); bottomMedium = a.getResourceId(R.styleable.AlertDialog_bottomMedium, bottomMedium); /* * We now set the background of all of the sections of the alert. Loading
core/res/res/layout/alert_dialog_micro.xml +2 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,8 @@ android:id="@+id/parentPanel" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@android:color/white" android:layout_gravity="center" android:orientation="vertical"> <LinearLayout android:id="@+id/topPanel" Loading
core/res/res/values/dimens.xml +2 −0 Original line number Diff line number Diff line Loading @@ -161,6 +161,8 @@ <!-- Preferred width of the search view. --> <dimen name="search_view_preferred_width">320dip</dimen> <!-- Dialog padding for round display --> <dimen name="alert_dialog_round_padding">27dip</dimen> <!-- Dialog title height --> <dimen name="alert_dialog_title_height">64dip</dimen> <!-- Dialog button bar height --> Loading
core/res/res/values/styles_micro.xml +10 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,16 @@ --> <resources> <style name="AlertDialog.Micro" parent="AlertDialog.Holo.Light"> <item name="fullDark">@null</item> <item name="topDark">@null</item> <item name="centerDark">@null</item> <item name="bottomDark">@null</item> <item name="fullBright">@null</item> <item name="topBright">@null</item> <item name="centerBright">@null</item> <item name="bottomBright">@null</item> <item name="bottomMedium">@null</item> <item name="centerMedium">@null</item> <item name="layout">@layout/alert_dialog_micro</item> </style> Loading
core/res/res/values/symbols.xml +2 −0 Original line number Diff line number Diff line Loading @@ -120,6 +120,7 @@ <java-symbol type="id" name="overlay_display_window_title" /> <java-symbol type="id" name="package_label" /> <java-symbol type="id" name="packages_list" /> <java-symbol type="id" name="parentPanel" /> <java-symbol type="id" name="pause" /> <java-symbol type="id" name="perms_list" /> <java-symbol type="id" name="perm_icon" /> Loading Loading @@ -324,6 +325,7 @@ <java-symbol type="color" name="tab_indicator_text_v4" /> <java-symbol type="dimen" name="accessibility_touch_slop" /> <java-symbol type="dimen" name="alert_dialog_round_padding"/> <java-symbol type="dimen" name="config_prefDialogWidth" /> <java-symbol type="dimen" name="config_viewConfigurationTouchSlop" /> <java-symbol type="dimen" name="config_viewMinFlingVelocity" /> Loading