use of org.telegram.ui.Cells.DividerCell in project Telegram-FOSS by Telegram-FOSS-Team.
the class ContactsAdapter method onCreateViewHolder.
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view;
switch(viewType) {
case 0:
view = new UserCell(mContext, 58, 1, false);
break;
case 1:
view = new TextCell(mContext);
break;
case 2:
view = new GraySectionCell(mContext);
break;
case 3:
view = new DividerCell(mContext);
view.setPadding(AndroidUtilities.dp(LocaleController.isRTL ? 28 : 72), AndroidUtilities.dp(8), AndroidUtilities.dp(LocaleController.isRTL ? 72 : 28), AndroidUtilities.dp(8));
break;
case 4:
FrameLayout frameLayout = new FrameLayout(mContext) {
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int height;
height = MeasureSpec.getSize(heightMeasureSpec);
if (height == 0) {
height = parent.getMeasuredHeight();
}
if (height == 0) {
height = AndroidUtilities.displaySize.y - ActionBar.getCurrentActionBarHeight() - (Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0);
}
int cellHeight = AndroidUtilities.dp(50);
int totalHeight = onlyUsers != 0 ? 0 : cellHeight + AndroidUtilities.dp(30);
if (hasGps) {
totalHeight += cellHeight;
}
if (!isAdmin && !needPhonebook) {
totalHeight += cellHeight;
}
if (totalHeight < height) {
height = height - totalHeight;
} else {
height = 0;
}
super.onMeasure(MeasureSpec.makeMeasureSpec(MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY));
}
};
ContactsEmptyView emptyView = new ContactsEmptyView(mContext);
frameLayout.addView(emptyView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER));
view = frameLayout;
break;
case 5:
default:
view = new ShadowSectionCell(mContext);
Drawable drawable = Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow);
CombinedDrawable combinedDrawable = new CombinedDrawable(new ColorDrawable(Theme.getColor(Theme.key_windowBackgroundGray)), drawable);
combinedDrawable.setFullsize(true);
view.setBackgroundDrawable(combinedDrawable);
break;
}
return new RecyclerListView.Holder(view);
}
use of org.telegram.ui.Cells.DividerCell in project Telegram-FOSS by Telegram-FOSS-Team.
the class DrawerLayoutAdapter method onCreateViewHolder.
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view;
switch(viewType) {
case 0:
view = profileCell = new DrawerProfileCell(mContext);
break;
case 2:
view = new DividerCell(mContext);
break;
case 3:
view = new DrawerActionCell(mContext);
break;
case 4:
view = new DrawerUserCell(mContext);
break;
case 5:
view = new DrawerAddCell(mContext);
break;
case 1:
default:
view = new EmptyCell(mContext, AndroidUtilities.dp(8));
break;
}
view.setLayoutParams(new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
return new RecyclerListView.Holder(view);
}
Aggregations