use of android.view.ViewGroup.LayoutParams in project UltimateAndroid by cymcsg.
the class UnfoldAnimation method animate.
@Override
public void animate() {
final ViewGroup parentView = (ViewGroup) view.getParent();
final int positionView = parentView.indexOfChild(view);
final FoldLayout mFoldLayout = new FoldLayout(view.getContext());
mFoldLayout.setLayoutParams(new LayoutParams(view.getWidth(), view.getHeight()));
mFoldLayout.setX(view.getLeft());
mFoldLayout.setY(view.getTop());
parentView.removeView(view);
parentView.addView(mFoldLayout, positionView);
mFoldLayout.addView(view);
view.setPadding(ANTIALIAS_PADDING, ANTIALIAS_PADDING, ANTIALIAS_PADDING, ANTIALIAS_PADDING);
mFoldLayout.setNumberOfFolds(numOfFolds);
mFoldLayout.setOrientation(orientation);
mFoldLayout.setAnchorFactor(anchorFactor);
mFoldLayout.setFoldFactor(1);
mFoldLayout.setVisibility(View.INVISIBLE);
final ObjectAnimator foldInAnim = ObjectAnimator.ofFloat(mFoldLayout, "foldFactor", 1, 0);
foldInAnim.setDuration(duration);
foldInAnim.setInterpolator(interpolator);
foldInAnim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
if (getListener() != null) {
getListener().onAnimationEnd(UnfoldAnimation.this);
}
}
});
foldInAnim.start();
ObjectAnimator foldOutAnim = ObjectAnimator.ofFloat(mFoldLayout, "foldFactor", 1);
foldOutAnim.setDuration(1);
foldOutAnim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
mFoldLayout.setVisibility(View.VISIBLE);
view.setVisibility(View.VISIBLE);
foldInAnim.start();
}
});
foldOutAnim.start();
}
use of android.view.ViewGroup.LayoutParams in project UltimateAndroid by cymcsg.
the class HighlightAnimation method animate.
@Override
public void animate() {
final FrameLayout highlightFrame = new FrameLayout(view.getContext());
LayoutParams layoutParams = new LayoutParams(view.getWidth(), view.getHeight());
ImageView highlightView = new ImageView(view.getContext());
highlightView.setBackgroundColor(color);
highlightView.setAlpha(0.5f);
highlightView.setVisibility(View.VISIBLE);
final ViewGroup parentView = (ViewGroup) view.getParent();
final int positionView = parentView.indexOfChild(view);
parentView.addView(highlightFrame, positionView, layoutParams);
highlightFrame.setX(view.getLeft());
highlightFrame.setY(view.getTop());
parentView.removeView(view);
highlightFrame.addView(view);
highlightFrame.addView(highlightView);
highlightView.animate().alpha(0).setInterpolator(interpolator).setDuration(duration).setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
highlightFrame.removeAllViews();
parentView.addView(view, positionView);
view.setX(highlightFrame.getLeft());
view.setY(highlightFrame.getTop());
parentView.removeView(highlightFrame);
if (getListener() != null) {
getListener().onAnimationEnd(HighlightAnimation.this);
}
}
});
}
use of android.view.ViewGroup.LayoutParams in project UltimateAndroid by cymcsg.
the class ExpandableListItemAdapter method getView.
@Override
public View getView(final int position, final View convertView, final ViewGroup parent) {
ViewGroup view = (ViewGroup) convertView;
ViewHolder viewHolder;
if (view == null) {
view = createView(parent);
viewHolder = new ViewHolder();
viewHolder.titleParent = (ViewGroup) view.findViewById(mTitleParentResId);
viewHolder.contentParent = (ViewGroup) view.findViewById(mContentParentResId);
view.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) view.getTag();
}
View titleView = getTitleView(position, viewHolder.titleView, viewHolder.titleParent);
if (titleView != viewHolder.titleView) {
viewHolder.titleParent.removeAllViews();
viewHolder.titleParent.addView(titleView);
if (mActionViewResId == 0) {
view.setOnClickListener(new TitleViewOnClickListener(viewHolder.contentParent));
} else {
view.findViewById(mActionViewResId).setOnClickListener(new TitleViewOnClickListener(viewHolder.contentParent));
}
}
viewHolder.titleView = titleView;
View contentView = getContentView(position, viewHolder.contentView, viewHolder.contentParent);
if (contentView != viewHolder.contentView) {
viewHolder.contentParent.removeAllViews();
viewHolder.contentParent.addView(contentView);
}
viewHolder.contentView = contentView;
viewHolder.contentParent.setVisibility(mExpandedIds.contains(getItemId(position)) ? View.VISIBLE : View.GONE);
viewHolder.contentParent.setTag(getItemId(position));
LayoutParams layoutParams = viewHolder.contentParent.getLayoutParams();
layoutParams.height = LayoutParams.WRAP_CONTENT;
viewHolder.contentParent.setLayoutParams(layoutParams);
return view;
}
use of android.view.ViewGroup.LayoutParams in project UltimateAndroid by cymcsg.
the class DefaultSectionAdapter method getHeaderViewForSection.
@Override
public View getHeaderViewForSection(int section, View convertView, ViewGroup parent) {
TextView tv = null;
if (convertView != null) {
tv = (TextView) convertView;
} else {
tv = new TextView(context);
}
tv.setFocusable(false);
tv.setBackgroundColor(Color.GRAY);
tv.setLayoutParams(new LayoutParams(300, headerHeight));
tv.setText("section header" + section);
return tv;
}
use of android.view.ViewGroup.LayoutParams in project FreeFlow by Comcast.
the class DefaultSectionAdapter method getHeaderViewForSection.
@Override
public View getHeaderViewForSection(int section, View convertView, ViewGroup parent) {
TextView tv = null;
if (convertView != null) {
tv = (TextView) convertView;
} else {
tv = new TextView(context);
}
tv.setFocusable(false);
tv.setBackgroundColor(Color.GRAY);
tv.setLayoutParams(new LayoutParams(300, headerHeight));
tv.setText("section header" + section);
return tv;
}
Aggregations