use of org.telegram.ui.Cells.LocationLoadingCell in project Telegram-FOSS by Telegram-FOSS-Team.
the class LocationActivityAdapter method onCreateViewHolder.
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view;
switch(viewType) {
case 0:
// view = emptyCell = new EmptyCell(mContext) {
// @Override
// public ViewPropertyAnimator animate() {
// ViewPropertyAnimator animator = super.animate();
// if (Build.VERSION.SDK_INT >= 19) {
// animator.setUpdateListener(animation -> {
// if (updateRunnable != null) {
// updateRunnable.run();
// }
// });
// }
// return animator;
// }
// };
view = emptyCell = new FrameLayout(mContext);
emptyCell.setLayoutParams(new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, overScrollHeight));
break;
case 1:
view = new SendLocationCell(mContext, false, resourcesProvider);
break;
case 2:
view = new HeaderCell(mContext, resourcesProvider);
break;
case 3:
LocationCell locationCell = new LocationCell(mContext, false, resourcesProvider);
view = locationCell;
break;
case 4:
view = new LocationLoadingCell(mContext, resourcesProvider);
break;
case 5:
view = new LocationPoweredCell(mContext, resourcesProvider);
break;
case 6:
{
SendLocationCell cell = new SendLocationCell(mContext, true, resourcesProvider);
cell.setDialogId(dialogId);
view = cell;
break;
}
case 7:
view = new SharingLiveLocationCell(mContext, true, locationType == LocationActivity.LOCATION_TYPE_GROUP || locationType == LocationActivity.LOCATION_TYPE_GROUP_VIEW ? 16 : 54, resourcesProvider);
break;
case 8:
{
LocationDirectionCell cell = new LocationDirectionCell(mContext, resourcesProvider);
cell.setOnButtonClick(v -> onDirectionClick());
view = cell;
break;
}
case 9:
{
view = new ShadowSectionCell(mContext);
Drawable drawable = Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow);
CombinedDrawable combinedDrawable = new CombinedDrawable(new ColorDrawable(getThemedColor(Theme.key_windowBackgroundGray)), drawable);
combinedDrawable.setFullsize(true);
view.setBackgroundDrawable(combinedDrawable);
break;
}
case 10:
default:
{
view = new View(mContext);
break;
}
}
return new RecyclerListView.Holder(view);
}
use of org.telegram.ui.Cells.LocationLoadingCell in project Telegram-FOSS by Telegram-FOSS-Team.
the class LocationActivityAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
switch(holder.getItemViewType()) {
case 0:
RecyclerView.LayoutParams lp = (RecyclerView.LayoutParams) holder.itemView.getLayoutParams();
if (lp == null) {
lp = new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, overScrollHeight);
} else {
lp.height = overScrollHeight;
}
holder.itemView.setLayoutParams(lp);
break;
case 1:
sendLocationCell = (SendLocationCell) holder.itemView;
updateCell();
break;
case 2:
{
HeaderCell cell = (HeaderCell) holder.itemView;
if (currentMessageObject != null) {
cell.setText(LocaleController.getString("LiveLocations", R.string.LiveLocations));
} else {
cell.setText(LocaleController.getString("NearbyVenue", R.string.NearbyVenue));
}
break;
}
case 3:
{
LocationCell cell = (LocationCell) holder.itemView;
if (locationType == 0) {
position -= 4;
} else {
position -= 5;
}
TLRPC.TL_messageMediaVenue place = position < 0 || position >= places.size() || !searched ? null : places.get(position);
String iconUrl = position < 0 || position >= iconUrls.size() || !searched ? null : iconUrls.get(position);
cell.setLocation(place, iconUrl, position, true);
break;
}
case 4:
((LocationLoadingCell) holder.itemView).setLoading(searching);
break;
case 6:
((SendLocationCell) holder.itemView).setHasLocation(gpsLocation != null);
break;
case 7:
SharingLiveLocationCell locationCell = (SharingLiveLocationCell) holder.itemView;
if (locationType == LocationActivity.LOCATION_TYPE_LIVE_VIEW) {
locationCell.setDialog(currentMessageObject, gpsLocation, myLocationDenied);
} else if (chatLocation != null) {
locationCell.setDialog(dialogId, chatLocation);
} else if (currentMessageObject != null && position == 1) {
locationCell.setDialog(currentMessageObject, gpsLocation, myLocationDenied);
} else {
locationCell.setDialog(currentLiveLocations.get(position - (currentMessageObject != null ? 5 : 2)), gpsLocation);
}
break;
case 10:
View emptyView = holder.itemView;
emptyView.setBackgroundColor(Theme.getColor(myLocationDenied ? Theme.key_dialogBackgroundGray : Theme.key_dialogBackground));
break;
}
}
Aggregations