Merge "Make the widget option on the PopupContainer full width" into tm-dev
This commit is contained in:
commit
c2d37e042d
2 files changed
+17
-10
No files matched your search
@@ -62,8 +62,7 @@ public class LauncherPopupLiveUpdateHandler extends PopupLiveUpdateHandler<Launc
|
|||||||
R.layout.widget_shortcut_container,
|
R.layout.widget_shortcut_container,
|
||||||
mPopupContainerWithArrow));
|
mPopupContainerWithArrow));
|
||||||
}
|
}
|
||||||
mPopupContainerWithArrow.initializeSystemShortcut(
|
mPopupContainerWithArrow.initializeWidgetShortcut(
|
||||||
R.layout.system_shortcut,
|
|
||||||
mPopupContainerWithArrow.getWidgetContainer(),
|
mPopupContainerWithArrow.getWidgetContainer(),
|
||||||
widgetInfo);
|
widgetInfo);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ public class PopupContainerWithArrow<T extends Context & ActivityContext>
|
|||||||
private BubbleTextView mOriginalIcon;
|
private BubbleTextView mOriginalIcon;
|
||||||
private int mNumNotifications;
|
private int mNumNotifications;
|
||||||
private NotificationContainer mNotificationContainer;
|
private NotificationContainer mNotificationContainer;
|
||||||
|
private int mContainerWidth;
|
||||||
|
|
||||||
private ViewGroup mWidgetContainer;
|
private ViewGroup mWidgetContainer;
|
||||||
|
|
||||||
@@ -104,6 +105,7 @@ public class PopupContainerWithArrow<T extends Context & ActivityContext>
|
|||||||
super(context, attrs, defStyleAttr);
|
super(context, attrs, defStyleAttr);
|
||||||
mStartDragThreshold = getResources().getDimensionPixelSize(
|
mStartDragThreshold = getResources().getDimensionPixelSize(
|
||||||
R.dimen.deep_shortcuts_start_drag_threshold);
|
R.dimen.deep_shortcuts_start_drag_threshold);
|
||||||
|
mContainerWidth = getResources().getDimensionPixelSize(R.dimen.bg_popup_item_width);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PopupContainerWithArrow(Context context, AttributeSet attrs) {
|
public PopupContainerWithArrow(Context context, AttributeSet attrs) {
|
||||||
@@ -246,14 +248,15 @@ public class PopupContainerWithArrow<T extends Context & ActivityContext>
|
|||||||
mOriginalIcon = originalIcon;
|
mOriginalIcon = originalIcon;
|
||||||
|
|
||||||
boolean hasDeepShortcuts = shortcutCount > 0;
|
boolean hasDeepShortcuts = shortcutCount > 0;
|
||||||
int containerWidth = (int) getResources().getDimension(R.dimen.bg_popup_item_width);
|
mContainerWidth = getResources().getDimensionPixelSize(R.dimen.bg_popup_item_width);
|
||||||
|
|
||||||
// if there are deep shortcuts, we might want to increase the width of shortcuts to fit
|
// if there are deep shortcuts, we might want to increase the width of shortcuts to fit
|
||||||
// horizontally laid out system shortcuts.
|
// horizontally laid out system shortcuts.
|
||||||
if (hasDeepShortcuts) {
|
if (hasDeepShortcuts) {
|
||||||
containerWidth = (int) Math.max(containerWidth,
|
mContainerWidth = Math.max(mContainerWidth,
|
||||||
systemShortcuts.size() * getResources().getDimension(
|
systemShortcuts.size() * getResources()
|
||||||
R.dimen.system_shortcut_header_icon_touch_size));
|
.getDimensionPixelSize(R.dimen.system_shortcut_header_icon_touch_size)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
// Add views
|
// Add views
|
||||||
if (mNumNotifications > 0) {
|
if (mNumNotifications > 0) {
|
||||||
@@ -277,7 +280,7 @@ public class PopupContainerWithArrow<T extends Context & ActivityContext>
|
|||||||
|
|
||||||
for (int i = shortcutCount; i > 0; i--) {
|
for (int i = shortcutCount; i > 0; i--) {
|
||||||
DeepShortcutView v = inflateAndAdd(R.layout.deep_shortcut, mDeepShortcutContainer);
|
DeepShortcutView v = inflateAndAdd(R.layout.deep_shortcut, mDeepShortcutContainer);
|
||||||
v.getLayoutParams().width = containerWidth;
|
v.getLayoutParams().width = mContainerWidth;
|
||||||
mShortcuts.add(v);
|
mShortcuts.add(v);
|
||||||
}
|
}
|
||||||
updateHiddenShortcuts();
|
updateHiddenShortcuts();
|
||||||
@@ -289,8 +292,7 @@ public class PopupContainerWithArrow<T extends Context & ActivityContext>
|
|||||||
mWidgetContainer = inflateAndAdd(R.layout.widget_shortcut_container,
|
mWidgetContainer = inflateAndAdd(R.layout.widget_shortcut_container,
|
||||||
this);
|
this);
|
||||||
}
|
}
|
||||||
initializeSystemShortcut(R.layout.system_shortcut, mWidgetContainer,
|
initializeWidgetShortcut(mWidgetContainer, shortcut);
|
||||||
shortcut);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mSystemShortcutContainer = inflateAndAdd(R.layout.system_shortcut_icons, this);
|
mSystemShortcutContainer = inflateAndAdd(R.layout.system_shortcut_icons, this);
|
||||||
@@ -384,7 +386,12 @@ public class PopupContainerWithArrow<T extends Context & ActivityContext>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void initializeSystemShortcut(int resId, ViewGroup container, SystemShortcut info) {
|
protected void initializeWidgetShortcut(ViewGroup container, SystemShortcut info) {
|
||||||
|
View view = initializeSystemShortcut(R.layout.system_shortcut, container, info);
|
||||||
|
view.getLayoutParams().width = mContainerWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected View initializeSystemShortcut(int resId, ViewGroup container, SystemShortcut info) {
|
||||||
View view = inflateAndAdd(
|
View view = inflateAndAdd(
|
||||||
resId, container, getInsertIndexForSystemShortcut(container, info));
|
resId, container, getInsertIndexForSystemShortcut(container, info));
|
||||||
if (view instanceof DeepShortcutView) {
|
if (view instanceof DeepShortcutView) {
|
||||||
@@ -398,6 +405,7 @@ public class PopupContainerWithArrow<T extends Context & ActivityContext>
|
|||||||
}
|
}
|
||||||
view.setTag(info);
|
view.setTag(info);
|
||||||
view.setOnClickListener(info);
|
view.setOnClickListener(info);
|
||||||
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in new issue
Block a user