Here are the examples of the java api com.gavin.com.stickydecoration.model.City taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
2 Examples
15
Source : ExpandableActivity.java
with Apache License 2.0
from Gavin-ZYX
with Apache License 2.0
from Gavin-ZYX
/**
* 修改数据
*
* @param position
*/
private void changeExpandedState(int position) {
if (dataList.size() > position) {
City city = dataList.get(position);
city.setExpanded(!city.isExpanded());
position++;
if (dataList.size() > position) {
// 下个是当前分组
City city2 = dataList.get(position);
if (TextUtils.equals(city.getProvince(), city2.getProvince())) {
changeExpandedState(position);
}
}
}
}
12
Source : SimpleAdapter.java
with Apache License 2.0
from Gavin-ZYX
with Apache License 2.0
from Gavin-ZYX
@Override
public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, final int position) {
ViewHolder holder = (ViewHolder) viewHolder;
if (mCities.size() > position) {
City city = mCities.get(position);
if (city.isExpanded()) {
ViewGroup.LayoutParams layoutParams = holder.mLlBg.getLayoutParams();
layoutParams.height = DensityUtil.dip2px(mContext, 100);
holder.mLlBg.setLayoutParams(layoutParams);
// holder.itemView.setVisibility(View.VISIBLE);
int i = position % 5 + 1;
if (i == 1) {
holder.mIvCity.setImageResource(R.mipmap.subject1);
holder.mLlBg.setBackgroundColor(mContext.getResources().getColor(R.color.bg1));
} else if (i == 2) {
holder.mIvCity.setImageResource(R.mipmap.subject2);
holder.mLlBg.setBackgroundColor(mContext.getResources().getColor(R.color.bg2));
} else if (i == 3) {
holder.mIvCity.setImageResource(R.mipmap.subject3);
holder.mLlBg.setBackgroundColor(mContext.getResources().getColor(R.color.bg3));
} else if (i == 4) {
holder.mIvCity.setImageResource(R.mipmap.subject4);
holder.mLlBg.setBackgroundColor(mContext.getResources().getColor(R.color.bg4));
} else {
holder.mIvCity.setImageResource(R.mipmap.subject5);
holder.mLlBg.setBackgroundColor(mContext.getResources().getColor(R.color.bg5));
}
holder.mTvCity.setText(city.getName());
} else {
ViewGroup.LayoutParams layoutParams = holder.mLlBg.getLayoutParams();
layoutParams.height = DensityUtil.dip2px(mContext, 0);
holder.mLlBg.setLayoutParams(layoutParams);
// holder.itemView.setVisibility(View.GONE);
}
}
}