use of cn.edu.cqupt.nmid.headline.support.repository.headline.bean.Feed in project nmid-headline by miao1007.
the class JPushReceiver method processClick.
private void processClick(Context context, Bundle bundle) {
//打开自定义的Activity
if (bundle.getString(JPushInterface.EXTRA_EXTRA).trim().length() > 3) {
JsonObject newObj = new JsonParser().parse(bundle.getString(JPushInterface.EXTRA_EXTRA)).getAsJsonObject();
Feed feed = new Feed(newObj.get(HeadlineService.ID).getAsInt(), newObj.get(HeadlineService.CATEGORY).getAsInt());
DetailedActivity.startActivity(context, feed);
} else {
Log.e(TAG, "cn.jpush.android.EXTRA IllegalFormatException");
}
}
use of cn.edu.cqupt.nmid.headline.support.repository.headline.bean.Feed in project nmid-headline by miao1007.
the class FavFeedFragment method loadNewFeeds.
@Override
void loadNewFeeds() {
List<Feed> feeds = new ArrayList<>();
feeds = new Select().from(Feed.class).orderBy("idMember desc").limit(this.feed_limit).execute();
if (feeds == null || feeds.isEmpty()) {
showErrorView(View.VISIBLE);
} else {
newsBeans.addAll(feeds);
adapter.notifyDataSetChanged();
}
mSwipeRefreshLayout.setRefreshing(false);
}
use of cn.edu.cqupt.nmid.headline.support.repository.headline.bean.Feed in project nmid-headline by miao1007.
the class NewsFeedAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(ContentViewHolder holder, int position) {
final Feed newsBean = mNewsBeans.get(position);
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//Log.d(TAG, "title" + newsBean.getTitle() + "id" + newsBean.getIdmember());
Intent intent = new Intent(v.getContext(), DetailedActivity.class);
intent.putExtra(WebViewFragment.PARCELABLE_KEY, newsBean);
v.getContext().startActivity(intent);
}
});
holder.title.setText(newsBean.getTitle());
holder.time.setText(newsBean.getTimeRelease());
holder.excerpt.setText(newsBean.getSimple_content().trim());
//what the fuck api!
boolean one = !newsBean.getImage1().trim().isEmpty();
boolean two = !newsBean.getImage2().trim().isEmpty();
boolean three = !newsBean.getImage3().trim().isEmpty();
if (!one && !two && !three) {
holder.threeBottonImages.setVisibility(View.GONE);
holder.iv_single.setVisibility(View.GONE);
return;
}
if (one && !two && !three) {
holder.iv_single.setVisibility(View.VISIBLE);
holder.threeBottonImages.setVisibility(View.GONE);
Picasso.with(holder.iv_single.getContext()).load(newsBean.getImage1()).into(holder.iv_single);
return;
}
if (one && two) {
holder.threeBottonImages.setVisibility(View.VISIBLE);
holder.iv_single.setVisibility(View.GONE);
Picasso.with(holder.iv_all_1.getContext()).load(newsBean.getImage1()).into(holder.iv_all_1);
Picasso.with(holder.iv_all_2.getContext()).load(newsBean.getImage2()).into(holder.iv_all_2);
if (three) {
//111
Picasso.with(holder.iv_all_3.getContext()).load(newsBean.getImage3()).into(holder.iv_all_3);
} else {
//110
holder.iv_all_3.setVisibility(View.GONE);
}
return;
}
}
Aggregations