use of me.drakeet.meizhi.data.entity.Gank in project Meizhi by drakeet.
the class GankListAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
Gank gank = mGankList.get(position);
if (position == 0) {
showCategory(holder);
} else {
boolean theCategoryOfLastEqualsToThis = mGankList.get(position - 1).type.equals(mGankList.get(position).type);
if (!theCategoryOfLastEqualsToThis) {
showCategory(holder);
} else {
hideCategory(holder);
}
}
holder.category.setText(gank.type);
SpannableStringBuilder builder = new SpannableStringBuilder(gank.desc).append(StringStyles.format(holder.gank.getContext(), " (via. " + gank.who + ")", R.style.ViaTextAppearance));
CharSequence gankText = builder.subSequence(0, builder.length());
holder.gank.setText(gankText);
showItemAnim(holder.gank, position);
}
use of me.drakeet.meizhi.data.entity.Gank in project Meizhi by drakeet.
the class GankFragment method onOptionsItemSelected.
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
switch(id) {
case R.id.action_share:
if (mGankList.size() != 0) {
Gank gank = mGankList.get(0);
String shareText = gank.desc + gank.url + getString(R.string.share_from);
Shares.share(getActivity(), shareText);
} else {
Shares.share(getContext(), R.string.share_text);
}
return true;
case R.id.action_subject:
openTodaySubject();
return true;
}
return super.onOptionsItemSelected(item);
}
use of me.drakeet.meizhi.data.entity.Gank in project Meizhi by drakeet.
the class MainActivity method getFirstVideoDesc.
private String getFirstVideoDesc(Date publishedAt, List<Gank> results) {
String videoDesc = "";
for (int i = mLastVideoIndex; i < results.size(); i++) {
Gank video = results.get(i);
if (video.publishedAt == null)
video.publishedAt = video.createdAt;
if (Dates.isTheSameDay(publishedAt, video.publishedAt)) {
videoDesc = video.desc;
mLastVideoIndex = i;
break;
}
}
return videoDesc;
}
Aggregations