use of android.view.ViewGroup in project UltimateAndroid by cymcsg.
the class SwipeLayout method open.
public void open(boolean smooth, boolean notify) {
ViewGroup surface = getSurfaceView(), bottom = getBottomView();
int dx, dy;
Rect rect = computeSurfaceLayoutArea(true);
if (smooth) {
mDragHelper.smoothSlideViewTo(getSurfaceView(), rect.left, rect.top);
} else {
dx = rect.left - surface.getLeft();
dy = rect.top - surface.getTop();
surface.layout(rect.left, rect.top, rect.right, rect.bottom);
if (getShowMode() == ShowMode.PullOut) {
Rect bRect = computeBottomLayoutAreaViaSurface(ShowMode.PullOut, rect);
bottom.layout(bRect.left, bRect.top, bRect.right, bRect.bottom);
}
if (notify) {
dispatchRevealEvent(rect.left, rect.top, rect.right, rect.bottom);
dispatchSwipeEvent(rect.left, rect.top, dx, dy);
} else {
safeBottomView();
}
}
invalidate();
}
use of android.view.ViewGroup in project GreenDroid by cyrilmottier.
the class QuickActionGrid method populateQuickActions.
@Override
protected void populateQuickActions(final List<QuickAction> quickActions) {
mGridView.setAdapter(new BaseAdapter() {
public View getView(int position, View view, ViewGroup parent) {
TextView textView = (TextView) view;
if (view == null) {
final LayoutInflater inflater = LayoutInflater.from(getContext());
textView = (TextView) inflater.inflate(R.layout.gd_quick_action_grid_item, mGridView, false);
}
QuickAction quickAction = quickActions.get(position);
textView.setText(quickAction.mTitle);
textView.setCompoundDrawablesWithIntrinsicBounds(null, quickAction.mDrawable, null, null);
return textView;
}
public long getItemId(int position) {
return position;
}
public Object getItem(int position) {
return null;
}
public int getCount() {
return quickActions.size();
}
});
mGridView.setOnItemClickListener(mInternalItemClickListener);
}
use of android.view.ViewGroup in project Libraries-for-Android-Developers by eoecn.
the class ActionBarContextView method setSplitActionBar.
@Override
public void setSplitActionBar(boolean split) {
if (mSplitActionBar != split) {
if (mActionMenuPresenter != null) {
// Mode is already active; move everything over and adjust the menu itself.
final LayoutParams layoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
if (!split) {
mMenuView = (ActionMenuView) mActionMenuPresenter.getMenuView(this);
mMenuView.setBackgroundDrawable(null);
final ViewGroup oldParent = (ViewGroup) mMenuView.getParent();
if (oldParent != null)
oldParent.removeView(mMenuView);
addView(mMenuView, layoutParams);
} else {
// Allow full screen width in split mode.
mActionMenuPresenter.setWidthLimit(getContext().getResources().getDisplayMetrics().widthPixels, true);
// No limit to the item count; use whatever will fit.
mActionMenuPresenter.setItemLimit(Integer.MAX_VALUE);
// Span the whole width
layoutParams.width = LayoutParams.MATCH_PARENT;
layoutParams.height = mContentHeight;
mMenuView = (ActionMenuView) mActionMenuPresenter.getMenuView(this);
mMenuView.setBackgroundDrawable(mSplitBackground);
final ViewGroup oldParent = (ViewGroup) mMenuView.getParent();
if (oldParent != null)
oldParent.removeView(mMenuView);
mSplitView.addView(mMenuView, layoutParams);
}
}
super.setSplitActionBar(split);
}
}
use of android.view.ViewGroup in project Libraries-for-Android-Developers by eoecn.
the class ActionBarView method onFinishInflate.
@Override
protected void onFinishInflate() {
super.onFinishInflate();
addView(mHomeLayout);
if (mCustomNavView != null && (mDisplayOptions & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) {
final ViewParent parent = mCustomNavView.getParent();
if (parent != this) {
if (parent instanceof ViewGroup) {
((ViewGroup) parent).removeView(mCustomNavView);
}
addView(mCustomNavView);
}
}
}
use of android.view.ViewGroup in project Libraries-for-Android-Developers by eoecn.
the class ActionBarView method setMenu.
public void setMenu(Menu menu, MenuPresenter.Callback cb) {
if (menu == mOptionsMenu)
return;
if (mOptionsMenu != null) {
mOptionsMenu.removeMenuPresenter(mActionMenuPresenter);
mOptionsMenu.removeMenuPresenter(mExpandedMenuPresenter);
}
MenuBuilder builder = (MenuBuilder) menu;
mOptionsMenu = builder;
if (mMenuView != null) {
final ViewGroup oldParent = (ViewGroup) mMenuView.getParent();
if (oldParent != null) {
oldParent.removeView(mMenuView);
}
}
if (mActionMenuPresenter == null) {
mActionMenuPresenter = new ActionMenuPresenter(mContext);
mActionMenuPresenter.setCallback(cb);
mActionMenuPresenter.setId(R.id.abs__action_menu_presenter);
mExpandedMenuPresenter = new ExpandedActionViewMenuPresenter();
}
ActionMenuView menuView;
final LayoutParams layoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
if (!mSplitActionBar) {
mActionMenuPresenter.setExpandedActionViewsExclusive(getResources_getBoolean(getContext(), R.bool.abs__action_bar_expanded_action_views_exclusive));
configPresenters(builder);
menuView = (ActionMenuView) mActionMenuPresenter.getMenuView(this);
final ViewGroup oldParent = (ViewGroup) menuView.getParent();
if (oldParent != null && oldParent != this) {
oldParent.removeView(menuView);
}
addView(menuView, layoutParams);
} else {
mActionMenuPresenter.setExpandedActionViewsExclusive(false);
// Allow full screen width in split mode.
mActionMenuPresenter.setWidthLimit(getContext().getResources().getDisplayMetrics().widthPixels, true);
// No limit to the item count; use whatever will fit.
mActionMenuPresenter.setItemLimit(Integer.MAX_VALUE);
// Span the whole width
layoutParams.width = LayoutParams.MATCH_PARENT;
configPresenters(builder);
menuView = (ActionMenuView) mActionMenuPresenter.getMenuView(this);
if (mSplitView != null) {
final ViewGroup oldParent = (ViewGroup) menuView.getParent();
if (oldParent != null && oldParent != mSplitView) {
oldParent.removeView(menuView);
}
menuView.setVisibility(getAnimatedVisibility());
mSplitView.addView(menuView, layoutParams);
} else {
// We'll add this later if we missed it this time.
menuView.setLayoutParams(layoutParams);
}
}
mMenuView = menuView;
}
Aggregations