use of com.litingzhe.justandroid.netdb.net.model.NewslistBean in project JustAndroid by chinaltz.
the class NewsAdapter method getView.
@Override
public View getView(int position, View convertView, ViewGroup viewGroup) {
final ViewHolder holder;
if (convertView == null) {
convertView = LayoutInflater.from(mContext).inflate(R.layout.list_item_news, null);
holder = new ViewHolder(convertView);
convertView.setTag(holder);
AutoUtils.autoSize(convertView);
} else {
holder = (ViewHolder) convertView.getTag();
}
NewslistBean news = (NewslistBean) data.get(position);
holder.title.setText(news.getTitle());
holder.content.setText(news.getDescription());
Glide.with(mContext).load(news.getPicUrl()).into(holder.imageView);
return convertView;
}
use of com.litingzhe.justandroid.netdb.net.model.NewslistBean in project JustAndroid by chinaltz.
the class NetDemoActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_news);
ButterKnife.bind(this);
navTitle.setText("科技新闻");
navBack.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
newsArrayList = new ArrayList();
newsAdapter = new NewsAdapter(newsArrayList, mContext);
newsListView.setAdapter(newsAdapter);
newsListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
NewslistBean news = (NewslistBean) newsAdapter.getItem(position);
Intent intent = new Intent();
intent.setClass(mContext, WebViewActivity.class);
intent.putExtra("title", news.getDescription());
intent.putExtra("url", news.getUrl());
startActivity(intent);
}
});
getData();
PullToRefreshView.setPullRefreshEnable(true);
PullToRefreshView.setLoadMoreEnable(false);
PullToRefreshView.setOnHeaderRefreshListener(new AbPullToRefreshView.OnHeaderRefreshListener() {
@Override
public void onHeaderRefresh(AbPullToRefreshView view) {
getData();
}
});
}
Aggregations