Search in sources :

Example 1 with Feed

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");
    }
}
Also used : JsonObject(com.google.gson.JsonObject) JsonParser(com.google.gson.JsonParser) Feed(cn.edu.cqupt.nmid.headline.support.repository.headline.bean.Feed)

Example 2 with Feed

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);
}
Also used : ArrayList(java.util.ArrayList) Select(com.activeandroid.query.Select) Feed(cn.edu.cqupt.nmid.headline.support.repository.headline.bean.Feed)

Example 3 with Feed

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;
    }
}
Also used : DetailedActivity(cn.edu.cqupt.nmid.headline.ui.activity.DetailedActivity) Intent(android.content.Intent) CardView(android.support.v7.widget.CardView) ImageView(android.widget.ImageView) InjectView(butterknife.InjectView) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) View(android.view.View) Feed(cn.edu.cqupt.nmid.headline.support.repository.headline.bean.Feed)

Aggregations

Feed (cn.edu.cqupt.nmid.headline.support.repository.headline.bean.Feed)3 Intent (android.content.Intent)1 CardView (android.support.v7.widget.CardView)1 RecyclerView (android.support.v7.widget.RecyclerView)1 View (android.view.View)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1 InjectView (butterknife.InjectView)1 DetailedActivity (cn.edu.cqupt.nmid.headline.ui.activity.DetailedActivity)1 Select (com.activeandroid.query.Select)1 JsonObject (com.google.gson.JsonObject)1 JsonParser (com.google.gson.JsonParser)1 ArrayList (java.util.ArrayList)1