布局====================================================================
main_layout---------------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.example.recyclerview.View.activity.MainActivity"> <android.support.v7.widget.RecyclerView android:id="@+id/recyclerView" android:layout_width="match_parent" android:layout_height="wrap_content" /> </android.support.constraint.ConstraintLayout>
item_activity--------------------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?> <LinearLayout android:orientation="vertical" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content"> <!--上半部--> <LinearLayout android:id="@+id/shang" android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="wrap_content"> <LinearLayout android:orientation="vertical" android:layout_width="0dp" android:layout_weight="1" android:layout_height="wrap_content"> <TextView android:singleLine="true" android:textSize="20dp" android:id="@+id/title" android:text="标题" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <TextView android:singleLine="true" android:textSize="20dp" android:id="@+id/title1" android:text="副标题" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <LinearLayout android:orientation="horizontal" android:layout_width="match_parent" android:layout_weight="1" android:layout_height="wrap_content"> <View android:layout_width="0dp" android:layout_height="0.1dp" android:layout_weight="1"/> <TextView android:id="@+id/pinglun" android:text="评论" android:layout_gravity="right" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <TextView android:id="@+id/zan" android:text="赞" android:layout_gravity="right" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </LinearLayout> </LinearLayout> <ImageView android:src="@mipmap/ic_launcher" android:id="@+id/pic" android:layout_width="60dp" android:layout_height="60dp" /> </LinearLayout> <!--下半部--> <LinearLayout android:id="@+id/xia" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content"> <TextView android:singleLine="true" android:textSize="20sp" android:id="@+id/xia_title" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="标题" /> <TextView android:singleLine="true" android:textSize="20sp" android:id="@+id/xia_title2" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="副标题" /> <LinearLayout android:layout_width="match_parent" android:layout_height="60dp" android:orientation="horizontal"> <ImageView android:id="@+id/xia_pic1" android:layout_width="60dp" android:layout_height="60dp" android:layout_weight="1" android:src="@mipmap/ic_launcher" /> <ImageView android:id="@+id/xia_pic2" android:layout_width="60dp" android:layout_height="60dp" android:layout_weight="1" android:src="@mipmap/ic_launcher" /> <ImageView android:id="@+id/xia_pic3" android:layout_width="60dp" android:layout_height="60dp" android:layout_weight="1" android:src="@mipmap/ic_launcher" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" android:orientation="horizontal"> <View android:layout_width="0dp" android:layout_height="0.1dp" android:layout_weight="1" /> <TextView android:id="@+id/xian_pinglun" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="right" android:text="评论" /> <TextView android:id="@+id/xia_zan" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="right" android:text="赞" /> </LinearLayout> </LinearLayout> </LinearLayout>
View层=====================================================================
activity==============================================
MianActivity--------------------------------------------------------------------------------------------------------------
package com.example.recyclerview.View.activity; import android.content.DialogInterface; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.View; import com.example.recyclerview.Module.Bean.NewsBean; import com.example.recyclerview.Module.ModelImpl; import com.example.recyclerview.Persenter.PresenterImpl; import com.example.recyclerview.R; import com.example.recyclerview.View.adapter.MyAdapter; import java.util.List; public class MainActivity extends AppCompatActivity implements IMainView{ private static final String TAG = "MianActivity----------"; private RecyclerView recyclerView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); initViews(); initDtats(); } private void initViews() { recyclerView = findViewById(R.id.recyclerView); recyclerView.setLayoutManager(new LinearLayoutManager(this)); } private void initDtats() { PresenterImpl presenter = new PresenterImpl(); presenter.showNewsToView(new ModelImpl(),this); } @Override public void showNews(final List<NewsBean.DataBeanX.DataBean> list) { Log.d(TAG,"showNews:"+list); final MyAdapter myAdapter = new MyAdapter(MainActivity.this, list); recyclerView.setAdapter(myAdapter); myAdapter.setOnLongItemClick(new MyAdapter.MyLongIitemClick() { @Override public void onItemLongClick(View view, final int postion) { AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this); builder.setTitle("删除"); builder.setMessage("确定删除吗"); builder.setNegativeButton("取消", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }); builder.setPositiveButton("确定", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { list.remove(postion); dialog.dismiss(); myAdapter.notifyDataSetChanged(); } }); AlertDialog alertDialog = builder.create(); alertDialog.show(); } }); } }
IMian接口--------------------------------------------------------------------------------------------------------------
package com.example.recyclerview.View.activity; import com.example.recyclerview.Module.Bean.NewsBean; import java.util.List; /** * Created by 你家大林哥 on 2018/4/28. */ public interface IMainView { void showNews(List<NewsBean.DataBeanX.DataBean> list); }
adapter=================================
MyAdapter-----------------------------------------------------------------------------------------------------------------
package com.example.recyclerview.View.adapter; import android.animation.ObjectAnimator; import android.content.Context; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import com.bumptech.glide.Glide; import com.example.recyclerview.HttpUtile.HttpConfig; import com.example.recyclerview.Module.Bean.NewsBean; import com.example.recyclerview.R; import java.util.List; /** * Created by 你家大林哥 on 2018/4/28. */ public class MyAdapter extends RecyclerView.Adapter<MyAdapter.MyViewHolder> { private static final String TAG = "MyAdapter----"; private final int NEWS1 = 1; private final int NEWS2 = 2; private final Context context; private final List<NewsBean.DataBeanX.DataBean> list; private MyLongIitemClick myLongIitemClick; public MyAdapter(Context context, List<NewsBean.DataBeanX.DataBean> list){ this.context = context; this.list = list; } @Override public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view = LayoutInflater.from(context).inflate(R.layout.item_layout,parent,false); MyViewHolder myViewHolder = new MyViewHolder(view); return myViewHolder; } @Override public void onBindViewHolder(final MyViewHolder holder, final int position) { holder.itemView.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { myLongIitemClick.onItemLongClick(v,position); return true; } }); //开始使用 int type = getItemViewType(position); //根据类型判断 switch (type){ case NEWS1: //隐藏上面,显示下面 LinearLayout shang = holder.getShang(); LinearLayout xia = holder.getXia(); xia.setVisibility(View.VISIBLE); shang.setVisibility(View.GONE); //给下面赋值 holder.getXia_title().setText(list.get(position).getTitle()); holder.getXia_title1().setText(list.get(position).getTitle()); List<String> pics = list.get(position).getPics(); Glide.with(context).load(HttpConfig.pic_url+pics.get(0)).into(holder.getXia_pic1()); Glide.with(context).load(HttpConfig.pic_url+pics.get(1)).into(holder.getXia_pic2()); Glide.with(context).load(HttpConfig.pic_url+pics.get(2)).into(holder.getXia_pic3()); holder.getXia_pic1().setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Log.d(TAG, "点击----"); ObjectAnimator alpha = ObjectAnimator.ofFloat(holder.getXia_pic1(), "alpha", 1, 0, 1); alpha.setDuration(2000); alpha.start(); } }); holder.getXia_pic2().setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Log.d(TAG, "点击----"); ObjectAnimator alpha = ObjectAnimator.ofFloat(holder.getXia_pic2(), "alpha", 1, 0, 1); alpha.setDuration(2000); alpha.start(); } }); holder.getXia_pic3().setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Log.d(TAG, "点击----"); ObjectAnimator alpha = ObjectAnimator.ofFloat(holder.getXia_pic3(), "alpha", 1, 0, 1); alpha.setDuration(2000); alpha.start(); } }); holder.getXia_pinglun().setText(list.get(position).getComment_amount()+"评论"); holder.getXia_zan().setText(list.get(position).getViews()+"赞"); break; case NEWS2: //隐藏下面 ,显示上面 LinearLayout shang1 = holder.getShang(); LinearLayout xia2 = holder.getXia(); shang1.setVisibility(View.VISIBLE); xia2.setVisibility(View.GONE); Log.d(TAG, "onBindViewHolder: "+holder.getTitle()+"--"+list); Log.d(TAG, "onBindViewHolder: "+holder.getTitle()+"--"+list+"--"+list.get(position)); Log.d(TAG, "onBindViewHolder: "+holder.getTitle()+"--"+list+"--"+list.get(position)+"--"+list.get(position).getTitle()); //赋值 holder.getTitle().setText(list.get(position).getTitle()); holder.getTitle1().setText(list.get(position).getTitle()); List<String> pics1 = list.get(position).getPics(); Log.d(TAG, "图片---: "+holder.getPic()); Glide.with(context).load(HttpConfig.pic_url+pics1.get(0)).into(holder.getPic()); holder.getPinglun().setText(list.get(position).getViews()+"评论"); holder.getZan().setText(list.get(position).getViews()+"赞"); holder.getPic().setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ObjectAnimator alpha = ObjectAnimator.ofFloat(holder.getPic(), "alpha", 1, 0, 1); alpha.setDuration(2000); alpha.start(); } }); break; } } @Override public int getItemCount() { return list.size(); } @Override public int getItemViewType(int position) { //根据数据里面图片多少,确定显示布局 NewsBean.DataBeanX.DataBean dataBean = list.get(position); int pic_amount = dataBean.getPic_amount(); if (pic_amount >= 3){ return NEWS1; }else{ return NEWS2; } } class MyViewHolder extends RecyclerView.ViewHolder{ public MyViewHolder(View itemView, TextView title, TextView title1, TextView xia_title, TextView xia_title1, TextView zan, TextView xia_zan, TextView pinglun, TextView xia_pinglun, ImageView pic, ImageView xia_pic1, ImageView xia_pic2, ImageView xia_pic3, LinearLayout shang, LinearLayout xia) { super(itemView); this.title = title; this.title1 = title1; this.xia_title = xia_title; this.xia_title2 = xia_title2; this.zan = zan; this.xia_zan = xia_zan; this.pinglun = pinglun; this.xia_pinglun = xia_pinglun; this.pic = pic; this.xia_pic1 = xia_pic1; this.xia_pic2 = xia_pic2; this.xia_pic3 = xia_pic3; this.shang = shang; this.xia = xia; } public TextView getTitle() { return title; } public void setTitle(TextView title) { this.title = title; } public TextView getTitle1() { return title1; } public void setTitle1(TextView title1) { this.title1 = title1; } public TextView getXia_title() { return xia_title; } public void setXia_title(TextView xia_title) { this.xia_title = xia_title; } public TextView getXia_title1() { return xia_title2; } public void setXia_title1(TextView xia_title1) { this.xia_title2 = xia_title1; } public TextView getZan() { return zan; } public void setZan(TextView zan) { this.zan = zan; } public TextView getXia_zan() { return xia_zan; } public void setXia_zan(TextView xia_zan) { this.xia_zan = xia_zan; } public TextView getPinglun() { return pinglun; } public void setPinglun(TextView pinglun) { this.pinglun = pinglun; } public TextView getXia_pinglun() { return xia_pinglun; } public void setXia_pinglun(TextView xia_pinglun) { this.xia_pinglun = xia_pinglun; } public ImageView getPic() { return pic; } public void setPic(ImageView pic) { this.pic = pic; } public ImageView getXia_pic1() { return xia_pic1; } public void setXia_pic1(ImageView xia_pic1) { this.xia_pic1 = xia_pic1; } public ImageView getXia_pic2() { return xia_pic2; } public void setXia_pic2(ImageView xia_pic2) { this.xia_pic2 = xia_pic2; } public ImageView getXia_pic3() { return xia_pic3; } public void setXia_pic3(ImageView xia_pic3) { this.xia_pic3 = xia_pic3; } public LinearLayout getShang() { return shang; } public void setShang(LinearLayout shang) { this.shang = shang; } public LinearLayout getXia() { return xia; } public void setXia(LinearLayout xia) { this.xia = xia; } private TextView title, title1, xia_title, xia_title2, zan, xia_zan, pinglun, xia_pinglun; private ImageView pic, xia_pic1, xia_pic2, xia_pic3; private LinearLayout shang,xia; public MyViewHolder(View itemView) { super(itemView); pic =itemView.findViewById(R.id.pic); xia_pic1=itemView.findViewById(R.id.xia_pic1); xia_pic2=itemView.findViewById(R.id.xia_pic2); xia_pic3=itemView.findViewById(R.id.xia_pic3); title = itemView.findViewById(R.id.title); title1 = itemView.findViewById(R.id.title1); xia_title = itemView.findViewById(R.id.xia_title); xia_title2 = itemView.findViewById(R.id.xia_title2); zan = itemView.findViewById(R.id.zan); xia_zan = itemView.findViewById(R.id.xia_zan); pinglun = itemView.findViewById(R.id.pinglun); xia_pinglun = itemView.findViewById(R.id.xian_pinglun); //上下的布局 shang=itemView.findViewById(R.id.shang); xia=itemView.findViewById(R.id.xia); } } public interface MyLongIitemClick{ void onItemLongClick(View view,int postion); } public void setOnLongItemClick(MyLongIitemClick myLongIitemClick){ this.myLongIitemClick = myLongIitemClick; } }
Presenter层====================================================================
presenterImpl------------------------------------------------------------------------------------------------------------
package com.example.recyclerview.Persenter; import android.util.Log; import com.example.recyclerview.HttpUtile.HttpConfig; import com.example.recyclerview.Module.Bean.NewsBean; import com.example.recyclerview.Module.GetNewsListener; import com.example.recyclerview.Module.IModle; import com.example.recyclerview.View.activity.IMainView; import com.google.gson.Gson; import java.util.HashMap; import java.util.List; import java.util.Map; /** * Created by 你家大林哥 on 2018/4/28. */ public class PresenterImpl implements IPresenter { private static final String TAG ="--------PresenterImpl" ; @Override public void showNewsToView(IModle iModle, final IMainView iMainView) { Map<String,String> map = new HashMap<>(); String url = HttpConfig.news_url+"?page=1"; iModle.getNewsData(url, map, new GetNewsListener() { @Override public void getSuccess(String json) { Log.d(TAG,"成功:"+json); Gson gson = new Gson(); NewsBean newsBean = gson.fromJson(json,NewsBean.class); List<NewsBean.DataBeanX.DataBean> list = newsBean.getData().getData(); iMainView.showNews(list); } @Override public void getError(String error) { Log.d(TAG,"失败:"+error); } }); } }
IPresenter接口-----------------------------------------------------------------------------------------------------
package com.example.recyclerview.Persenter; import com.example.recyclerview.Module.IModle; import com.example.recyclerview.View.activity.IMainView; /** * Created by 你家大林哥 on 2018/4/28. */ public interface IPresenter { void showNewsToView(IModle iModle, IMainView iMainView); }Modle层====================================================================
Bean-----------------------------------------------------------------------------------------------------------------
package com.example.recyclerview.Module.Bean; import java.util.List; /** * Created by 你家大林哥 on 2018/4/28. */ public class NewsBean { /** * httpStatusCode : 200 * code : 0 * data : {"page":1,"perpage":20,"max_page":37,"total":722,"data":[{"id":3527004,"title":"今年合肥再出实招提升百姓民生福祉 涉及教育、卫生、交通、菜篮子\u2026\u2026","link":"lsapp://cn.ahurls.news/news?id=3527004","pics":["appletrecommend/201804/5ae3ae73a6aae.jpg"],"t":"url","type":"normal","alias":"headline","pic_amount":0,"style":"single_right","comment_amount":1,"source":"","type_sign":"","inner_news":1,"views":829,"comment_amount_label":"1","views_label":"829"},{"id":3527081,"title":"合肥出台办法保护被欺凌学生 防止二次伤害","link":"lsapp://cn.ahurls.news/news?id=3527081","pics":["appletrecommend/201804/5ae3d5ab8d5d4.jpg"],"t":"url","type":"normal","alias":"headline","pic_amount":0,"style":"single_right","comment_amount":1,"source":"","type_sign":"","inner_news":1,"views":246,"comment_amount_label":"1","views_label":"246"},{"id":3526986,"title":"合肥再现黑科技!行人过斑马线红光自动闪亮 系安徽首次尝试","link":"lsapp://cn.ahurls.news/news?id=3526986","pics":["appletrecommend/201804/5ae3a729d0da2.jpg"],"t":"url","type":"normal","alias":"headline","pic_amount":0,"style":"single_right","comment_amount":4,"source":"","type_sign":"","inner_news":1,"views":1816,"comment_amount_label":"4","views_label":"1816"},{"id":3525995,"title":"《钱途》第112期:共享轮椅现身合肥9点前被抢空 聚焦合肥共享出行新生活","link":"lsapp://cn.ahurls.news/image_news?id=3525995","pics":["special/tuku/201804/5ae19d70e2c0578014.jpg","special/tuku/201804/5ae19d5a6f80941646.jpg","special/tuku/201804/5ae19d5a89dd619830.jpg"],"t":"url","type":"images","alias":"headline","pic_amount":3,"style":"multi","comment_amount":1,"source":"","type_sign":"","inner_news":1,"views":619,"comment_amount_label":"1","views_label":"619","pics_new":["special/tuku/201804/5ae19d70e2c0578014.jpg"]},{"id":3526962,"title":"调查:安徽中小学教师参加校外培训或取消教师资格,你怎么看?","link":"lsapp://cn.ahurls.news/news?id=3526962","pics":["appletrecommend/201804/5adbc9336ad61.jpg"],"t":"url","type":"vote","alias":"headline","pic_amount":0,"style":"single_right","comment_amount":2,"source":"","type_sign":"投票","inner_news":1,"views":936,"comment_amount_label":"2","views_label":"936","pics_new":["appletrecommend/201804/5adbc9336ad61.jpg"]},{"id":3526931,"title":"秒懂!别让装饰公司赚\u201c黑金\u201d了 半包装修水有多深看完就知道","link":"lsapp://cn.ahurls.news/news?id=3526931","pics":["appletrecommend/201804/5ae3ac0f59a1c.jpg"],"t":"url","type":"normal","alias":"headline","pic_amount":0,"style":"single_right","comment_amount":7,"source":"","type_sign":"","inner_news":1,"views":1235,"comment_amount_label":"7","views_label":"1235"},{"id":3527094,"title":"合肥一自行车主走机动车道被罚五元 车主拍照发朋友圈质疑","link":"lsapp://cn.ahurls.news/news?id=3527094","pics":["appletrecommend/201804/5ae3d6ca3e77a.jpg"],"t":"url","type":"normal","alias":"headline","pic_amount":0,"style":"single_right","comment_amount":2,"source":"","type_sign":"","inner_news":1,"views":308,"comment_amount_label":"2","views_label":"308"},{"id":3526956,"title":"【专题】陕西榆林恶性砍人事件已致9人死亡 嫌疑人微信名为\u201c要么忍 要么狠\u201d","link":"lsapp://cn.ahurls.news/special?id=3526956","pics":["18/0427/5ae3225a77a36.jpg"],"t":"url","type":"special","alias":"headline","pic_amount":0,"style":"single_fill","comment_amount":3,"source":"","type_sign":"专题","inner_news":1,"views":1893,"comment_amount_label":"3","views_label":"1893","pics_new":["18/0427/5ae3225a77a36.jpg"]},{"id":3527012,"title":"六安一家三口一天之内全死亡:儿子自杀 父母落水溺亡","link":"lsapp://cn.ahurls.news/news?id=3527012","pics":["appletrecommend/201804/5ae3b15a11415.jpg"],"t":"url","type":"normal","alias":"headline","pic_amount":0,"style":"single_right","comment_amount":1,"source":"","type_sign":"","inner_news":1,"views":1384,"comment_amount_label":"1","views_label":"1384"},{"id":3527156,"title":"合肥老城区一批小街巷将提升改造 打造有温度的\u201c百年街巷\u201d","link":"lsapp://cn.ahurls.news/news?id=3527156","pics":["appletrecommend/201804/5ae3d83ab03f8.jpg"],"t":"url","type":"normal","alias":"headline","pic_amount":0,"style":"single_right","comment_amount":0,"source":"","type_sign":"","inner_news":1,"views":131,"comment_amount_label":"0","views_label":"131"},{"id":3527140,"title":"71岁退休教师毛坦厂\u201c代陪读\u201d 每天睡5小时洗衣30斤","link":"lsapp://cn.ahurls.news/news?id=3527140","pics":["appletrecommend/201804/5ae3d8cc7c68f.jpg"],"t":"url","type":"normal","alias":"headline","pic_amount":0,"style":"single_right","comment_amount":0,"source":"","type_sign":"","inner_news":1,"views":137,"comment_amount_label":"0","views_label":"137"},{"id":3526932,"title":"实探合肥经开区多宗闲置空地 超500亩超大地块紧邻优质学校规划用途成迷","link":"lsapp://cn.ahurls.news/image_news?id=3526932","pics":["special/tuku/201804/5ae33cbc5ec4c60226.jpg","special/tuku/201804/5ae33caae4eb614350.jpg","special/tuku/201804/5ae33c9b4443a51181.jpg"],"t":"url","type":"images","alias":"headline","pic_amount":3,"style":"multi","comment_amount":1,"source":"","type_sign":"","inner_news":1,"views":931,"comment_amount_label":"1","views_label":"931","pics_new":["special/tuku/201804/5ae33cbc5ec4c60226.jpg"]},{"id":3527062,"title":"今年合肥每个县区确保开工1个租赁住房项目 租金比照保障房租赁价格执行","link":"lsapp://cn.ahurls.news/news?id=3527062","pics":["appletrecommend/201804/5ae3da731cd46.jpg"],"t":"url","type":"normal","alias":"headline","pic_amount":0,"style":"single_right","comment_amount":1,"source":"","type_sign":"","inner_news":1,"views":325,"comment_amount_label":"1","views_label":"325"},{"id":3527093,"title":"合肥金寨南路等今年启动升级 刘铭传纪念馆有望明年开放","link":"lsapp://cn.ahurls.news/news?id=3527093","pics":["appletrecommend/201804/5ae3db8d29b4f.jpg"],"t":"url","type":"normal","alias":"headline","pic_amount":0,"style":"single_right","comment_amount":1,"source":"","type_sign":"","inner_news":1,"views":260,"comment_amount_label":"1","views_label":"260"},{"id":3527207,"title":"看得肉痛!男子从桥上跳下 被竹子插进屁股 插入多深不得而知","link":"lsapp://cn.ahurls.news/news?id=3527207","pics":["appletrecommend/201804/5ae3dca27374b.jpg"],"t":"url","type":"normal","alias":"headline","pic_amount":0,"style":"single_right","comment_amount":0,"source":"","type_sign":"","inner_news":1,"views":60,"comment_amount_label":"0","views_label":"60"},{"id":3526938,"title":"交了27300只退3000元不到? 合肥美联英语退费流程引网友质疑","link":"lsapp://cn.ahurls.news/news?id=3526938","pics":["appletrecommend/201804/5ae3ad0cd793d.jpg"],"t":"url","type":"normal","alias":"headline","pic_amount":0,"style":"single_right","comment_amount":1,"source":"","type_sign":"","inner_news":1,"views":3684,"comment_amount_label":"1","views_label":"3684"},{"id":3527005,"title":"合肥不少小商贩占道经营 影响周边居民生活和出行方便","link":"lsapp://cn.ahurls.news/news?id=3527005","pics":["appletrecommend/201804/5ae3b2b12c17c.jpg"],"t":"url","type":"normal","alias":"headline","pic_amount":0,"style":"single_right","comment_amount":1,"source":"","type_sign":"","inner_news":1,"views":524,"comment_amount_label":"1","views_label":"524"},{"id":3526921,"title":"激战金三银四:合肥九区三县41盘加推 5175套房源入市均价15750元/㎡","link":"lsapp://cn.ahurls.news/news?id=3526921","pics":["appletrecommend/201804/5ae3b65c04cae.jpg"],"t":"url","type":"normal","alias":"headline","pic_amount":0,"style":"single_right","comment_amount":0,"source":"","type_sign":"","inner_news":1,"views":715,"comment_amount_label":"0","views_label":"715"},{"id":3527019,"title":"杭州一小店靠卖烧饼赚7套房?老板笑称:不多不多","link":"lsapp://cn.ahurls.news/news?id=3527019","pics":["appletrecommend/201804/5ae3b801144f8.jpg"],"t":"url","type":"normal","alias":"headline","pic_amount":0,"style":"single_right","comment_amount":1,"source":"","type_sign":"","inner_news":1,"views":604,"comment_amount_label":"1","views_label":"604"},{"id":3526987,"title":"2018五一小长假凤阳狼巷迷谷景区旅游攻略 现在就开启探奇之旅吧","link":"lsapp://cn.ahurls.news/news?id=3526987","pics":["appletrecommend/201804/5ae3b3982f033.jpg"],"t":"url","type":"normal","alias":"headline","pic_amount":0,"style":"single_right","comment_amount":0,"source":"","type_sign":"","inner_news":1,"views":536,"comment_amount_label":"0","views_label":"536"},{"id":3527011,"title":"8省市上调2018年最低工资标准 你所在的省份涨了多少?","link":"lsapp://cn.ahurls.news/news?id=3527011","pics":["appletrecommend/201804/5ae3b1a3ac37a.jpg"],"t":"url","type":"normal","alias":"headline","pic_amount":0,"style":"single_right","comment_amount":1,"source":"","type_sign":"","inner_news":1,"views":726,"comment_amount_label":"1","views_label":"726"},{"id":3527024,"title":"小心了!你购买的减肥产品可能是咖啡掺禁药","link":"lsapp://cn.ahurls.news/news?id=3527024","pics":["appletrecommend/201804/5ae3bc52a4a80.jpg"],"t":"url","type":"normal","alias":"headline","pic_amount":0,"style":"single_right","comment_amount":1,"source":"","type_sign":"","inner_news":1,"views":420,"comment_amount_label":"1","views_label":"420"},{"id":3527017,"title":"7岁弟弟救8岁血癌哥哥 美女妈妈剃光头鼓励哥俩","link":"lsapp://cn.ahurls.news/image_news?id=3527017","pics":["special/tuku/201804/5ae3b37917ee164666.jpg","special/tuku/201804/5ae3b378e408683198.jpg","special/tuku/201804/5ae3b378cb22310509.jpg"],"t":"url","type":"images","alias":"headline","pic_amount":3,"style":"multi","comment_amount":0,"source":"","type_sign":"","inner_news":1,"views":801,"comment_amount_label":"0","views_label":"801","pics_new":["special/tuku/201804/5ae3b37917ee164666.jpg"]},{"id":3526417,"title":"安徽将集中整治校外培训机构 中小学教师参加校外培训或取消教师资格","link":"lsapp://cn.ahurls.news/news?id=3526417","pics":["appletrecommend/201804/5ae290d38d909.jpg"],"t":"url","type":"normal","alias":"headline","pic_amount":0,"style":"single_right","comment_amount":12,"source":"","type_sign":"","inner_news":1,"views":5419,"comment_amount_label":"12","views_label":"5419"},{"id":3526377,"title":"芜湖一老人多次在电梯里做这事 全楼居民大倒苦水!","link":"lsapp://cn.ahurls.news/news?id=3526377","pics":["appletrecommend/201804/5ae2bc988ccc3.jpg"],"t":"url","type":"normal","alias":"headline","pic_amount":0,"style":"single_right","comment_amount":5,"source":"","type_sign":"","inner_news":1,"views":4341,"comment_amount_label":"5","views_label":"4341"},{"id":3526179,"title":"合肥市区到机场多一条便捷通道 望江西路延伸段有望6月放行通车","link":"lsapp://cn.ahurls.news/news?id=3526179","pics":["appletrecommend/201804/5ae2602324c7c.jpg"],"t":"url","type":"normal","alias":"headline","pic_amount":0,"style":"single_right","comment_amount":6,"source":"","type_sign":"","inner_news":1,"views":5313,"comment_amount_label":"6","views_label":"5313"},{"id":3526798,"title":"女子怀二胎老公彻夜不回还约炮 竟是病要治!","link":"lsapp://cn.ahurls.news/news?id=3526798","pics":["appletrecommend/201804/5ae2c9bc7dedd.jpg"],"t":"url","type":"normal","alias":"headline","pic_amount":0,"style":"single_right","comment_amount":6,"source":"","type_sign":"","inner_news":1,"views":3664,"comment_amount_label":"6","views_label":"3664"},{"id":3526106,"title":"映像第65期:蓬莱仙洞9米\u201c金钟\u201d震撼游人 五一出游开启\u201c躲雨\u201d计划","link":"lsapp://cn.ahurls.news/image_news?id=3526106","pics":["special/tuku/201804/5ae1c280ceae926314.jpg","special/tuku/201804/5ae1baad59f1d65946.jpg","special/tuku/201804/5ae1baadab00a12875.jpg"],"t":"url","type":"images","alias":"headline","pic_amount":3,"style":"multi","comment_amount":4,"source":"","type_sign":"","inner_news":1,"views":4381,"comment_amount_label":"4","views_label":"4381","pics_new":["special/tuku/201804/5ae1c280ceae926314.jpg"]},{"id":3526206,"title":"合肥人的\u201c五一\u201d假期可能要\u201c泡汤\u201d 一放假就下雨天气的小船说翻就翻","link":"lsapp://cn.ahurls.news/news?id=3526206","pics":["appletrecommend/201804/5ae26c8da4dd9.jpg"],"t":"url","type":"normal","alias":"headline","pic_amount":0,"style":"single_right","comment_amount":4,"source":"","type_sign":"","inner_news":1,"views":5320,"comment_amount_label":"4","views_label":"5320"},{"id":3526368,"title":"2018年\u201c新一线\u201d城市排行榜发布 城市分级完整名单如下","link":"lsapp://cn.ahurls.news/news?id=3526368","pics":["appletrecommend/201804/5ae291c20550c.jpg"],"t":"url","type":"normal","alias":"headline","pic_amount":0,"style":"single_right","comment_amount":5,"source":"","type_sign":"","inner_news":1,"views":9425,"comment_amount_label":"5","views_label":"9425"}],"extras":{"slider":[{"id":3527013,"pic":"18/0428/5ae3d3c0425d6.jpg","link":"lsapp://cn.ahurls.news/news?id=3527013","t":"url","inner_news":1,"title":"守护碧水蓝天合肥去年开出3002万罚单","type":"nomal","type_sign":""},{"id":3527020,"pic":"18/0428/5ae3d24eac0ce.jpg","link":"lsapp://cn.ahurls.news/news?id=3527020","t":"url","inner_news":1,"title":"合肥将废止5件地方性法规","type":"nomal","type_sign":""},{"id":3526858,"pic":"18/0427/5ae31546ec92d.jpg","link":"lsapp://cn.ahurls.news/news?id=3526858","t":"url","inner_news":1,"title":"紫蓬山将打造房车露营基地","type":"nomal","type_sign":""},{"id":3526459,"pic":"18/0427/5ae2bbb7f0f06.jpg","link":"lsapp://cn.ahurls.news/news?id=3526459","t":"url","inner_news":1,"title":"合肥个人出租住房每平米奖励12元","type":"nomal","type_sign":""},{"id":3526920,"pic":"18/0428/5ae3b7297c14f.jpg","link":"lsapp://cn.ahurls.news/news?id=3526920","t":"url","inner_news":1,"title":"2018庐阳欢乐购五一篇躁动整座城","type":"nomal","type_sign":""}]},"bindtips":""} */ private int httpStatusCode; private int code; private DataBeanX data; public int getHttpStatusCode() { return httpStatusCode; } public void setHttpStatusCode(int httpStatusCode) { this.httpStatusCode = httpStatusCode; } public int getCode() { return code; } public void setCode(int code) { this.code = code; } public DataBeanX getData() { return data; } public void setData(DataBeanX data) { this.data = data; } public static class DataBeanX { /** * page : 1 * perpage : 20 * max_page : 37 * total : 722 * data : [{"id":3527004,"title":"今年合肥再出实招提升百姓民生福祉 涉及教育、卫生、交通、菜篮子\u2026\u2026","link":"lsapp://cn.ahurls.news/news?id=3527004","pics":["appletrecommend/201804/5ae3ae73a6aae.jpg"],"t":"url","type":"normal","alias":"headline","pic_amount":0,"style":"single_right","comment_amount":1,"source":"","type_sign":"","inner_news":1,"views":829,"comment_amount_label":"1","views_label":"829"},{"id":3527081,"title":"合肥出台办法保护被欺凌学生 防止二次伤害","link":"lsapp://cn.ahurls.news/news?id=3527081","pics":["appletrecommend/201804/5ae3d5ab8d5d4.jpg"],"t":"url","type":"normal","alias":"headline","pic_amount":0,"style":"single_right","comment_amount":1,"source":"","type_sign":"","inner_news":1,"views":246,"comment_amount_label":"1","views_label":"246"},{"id":3526986,"title":"合肥再现黑科技!行人过斑马线红光自动闪亮 系安徽首次尝试","link":"lsapp://cn.ahurls.news/news?id=3526986","pics":["appletrecommend/201804/5ae3a729d0da2.jpg"],"t":"url","type":"normal","alias":"headline","pic_amount":0,"style":"single_right","comment_amount":4,"source":"","type_sign":"","inner_news":1,"views":1816,"comment_amount_label":"4","views_label":"1816"},{"id":3525995,"title":"《钱途》第112期:共享轮椅现身合肥9点前被抢空 聚焦合肥共享出行新生活","link":"lsapp://cn.ahurls.news/image_news?id=3525995","pics":["special/tuku/201804/5ae19d70e2c0578014.jpg","special/tuku/201804/5ae19d5a6f80941646.jpg","special/tuku/201804/5ae19d5a89dd619830.jpg"],"t":"url","type":"images","alias":"headline","pic_amount":3,"style":"multi","comment_amount":1,"source":"","type_sign":"","inner_news":1,"views":619,"comment_amount_label":"1","views_label":"619","pics_new":["special/tuku/201804/5ae19d70e2c0578014.jpg"]},{"id":3526962,"title":"调查:安徽中小学教师参加校外培训或取消教师资格,你怎么看?","link":"lsapp://cn.ahurls.news/news?id=3526962","pics":["appletrecommend/201804/5adbc9336ad61.jpg"],"t":"url","type":"vote","alias":"headline","pic_amount":0,"style":"single_right","comment_amount":2,"source":"","type_sign":"投票","inner_news":1,"views":936,"comment_amount_label":"2","views_label":"936","pics_new":["appletrecommend/201804/5adbc9336ad61.jpg"]},{"id":3526931,"title":"秒懂!别让装饰公司赚\u201c黑金\u201d了 半包装修水有多深看完就知道","link":"lsapp://cn.ahurls.news/news?id=3526931","pics":["appletrecommend/201804/5ae3ac0f59a1c.jpg"],"t":"url","type":"normal","alias":"headline","pic_amount":0,"style":"single_right","comment_amount":7,"source":"","type_sign":"","inner_news":1,"views":1235,"comment_amount_label":"7","views_label":"1235"},{"id":3527094,"title":"合肥一自行车主走机动车道被罚五元 车主拍照发朋友圈质疑","link":"lsapp://cn.ahurls.news/news?id=3527094","pics":["appletrecommend/201804/5ae3d6ca3e77a.jpg"],"t":"url","type":"normal","alias":"headline","pic_amount":0,"style":"single_right","comment_amount":2,"source":"","type_sign":"","inner_news":1,"views":308,"comment_amount_label":"2","views_label":"308"},{"id":3526956,"title":"【专题】陕西榆林恶性砍人事件已致9人死亡 嫌疑人微信名为\u201c要么忍 要么狠\u201d","link":"lsapp://cn.ahurls.news/special?id=3526956","pics":["18/0427/5ae3225a77a36.jpg"],"t":"url","type":"special","alias":"headline","pic_amount":0,"style":"single_fill","comment_amount":3,"source":"","type_sign":"专题","inner_news":1,"views":1893,"comment_amount_label":"3","views_label":"1893","pics_new":["18/0427/5ae3225a77a36.jpg"]},{"id":3527012,"title":"六安一家三口一天之内全死亡:儿子自杀 父母落水溺亡","link":"lsapp://cn.ahurls.news/news?id=3527012","pics":["appletrecommend/201804/5ae3b15a11415.jpg"],"t":"url","type":"normal","alias":"headline","pic_amount":0,"style":"single_right","comment_amount":1,"source":"","type_sign":"","inner_news":1,"views":1384,"comment_amount_label":"1","views_label":"1384"},{"id":3527156,"title":"合肥老城区一批小街巷将提升改造 打造有温度的\u201c百年街巷\u201d","link":"lsapp://cn.ahurls.news/news?id=3527156","pics":["appletrecommend/201804/5ae3d83ab03f8.jpg"],"t":"url","type":"normal","alias":"headline","pic_amount":0,"style":"single_right","comment_amount":0,"source":"","type_sign":"","inner_news":1,"views":131,"comment_amount_label":"0","views_label":"131"},{"id":3527140,"title":"71岁退休教师毛坦厂\u201c代陪读\u201d 每天睡5小时洗衣30斤","link":"lsapp://cn.ahurls.news/news?id=3527140","pics":["appletrecommend/201804/5ae3d8cc7c68f.jpg"],"t":"url","type":"normal","alias":"headline","pic_amount":0,"style":"single_right","comment_amount":0,"source":"","type_sign":"","inner_news":1,"views":137,"comment_amount_label":"0","views_label":"137"},{"id":3526932,"title":"实探合肥经开区多宗闲置空地 超500亩超大地块紧邻优质学校规划用途成迷","link":"lsapp://cn.ahurls.news/image_news?id=3526932","pics":["special/tuku/201804/5ae33cbc5ec4c60226.jpg","special/tuku/201804/5ae33caae4eb614350.jpg","special/tuku/201804/5ae33c9b4443a51181.jpg"],"t":"url","type":"images","alias":"headline","pic_amount":3,"style":"multi","comment_amount":1,"source":"","type_sign":"","inner_news":1,"views":931,"comment_amount_label":"1","views_label":"931","pics_new":["special/tuku/201804/5ae33cbc5ec4c60226.jpg"]},{"id":3527062,"title":"今年合肥每个县区确保开工1个租赁住房项目 租金比照保障房租赁价格执行","link":"lsapp://cn.ahurls.news/news?id=3527062","pics":["appletrecommend/201804/5ae3da731cd46.jpg"],"t":"url","type":"normal","alias":"headline","pic_amount":0,"style":"single_right","comment_amount":1,"source":"","type_sign":"","inner_news":1,"views":325,"comment_amount_label":"1","views_label":"325"},{"id":3527093,"title":"合肥金寨南路等今年启动升级 刘铭传纪念馆有望明年开放","link":"lsapp://cn.ahurls.news/news?id=3527093","pics":["appletrecommend/201804/5ae3db8d29b4f.jpg"],"t":"url","type":"normal","alias":"headline","pic_amount":0,"style":"single_right","comment_amount":1,"source":"","type_sign":"","inner_news":1,"views":260,"comment_amount_label":"1","views_label":"260"},{"id":3527207,"title":"看得肉痛!男子从桥上跳下 被竹子插进屁股 插入多深不得而知","link":"lsapp://cn.ahurls.news/news?id=3527207","pics":["appletrecommend/201804/5ae3dca27374b.jpg"],"t":"url","type":"normal","alias":"headline","pic_amount":0,"style":"single_right","comment_amount":0,"source":"","type_sign":"","inner_news":1,"views":60,"comment_amount_label":"0","views_label":"60"},{"id":3526938,"title":"交了27300只退3000元不到? 合肥美联英语退费流程引网友质疑","link":"lsapp://cn.ahurls.news/news?id=3526938","pics":["appletrecommend/201804/5ae3ad0cd793d.jpg"],"t":"url","type":"normal","alias":"headline","pic_amount":0,"style":"single_right","comment_amount":1,"source":"","type_sign":"","inner_news":1,"views":3684,"comment_amount_label":"1","views_label":"3684"},{"id":3527005,"title":"合肥不少小商贩占道经营 影响周边居民生活和出行方便","link":"lsapp://cn.ahurls.news/news?id=3527005","pics":["appletrecommend/201804/5ae3b2b12c17c.jpg"],"t":"url","type":"normal","alias":"headline","pic_amount":0,"style":"single_right","comment_amount":1,"source":"","type_sign":"","inner_news":1,"views":524,"comment_amount_label":"1","views_label":"524"},{"id":3526921,"title":"激战金三银四:合肥九区三县41盘加推 5175套房源入市均价15750元/㎡","link":"lsapp://cn.ahurls.news/news?id=3526921","pics":["appletrecommend/201804/5ae3b65c04cae.jpg"],"t":"url","type":"normal","alias":"headline","pic_amount":0,"style":"single_right","comment_amount":0,"source":"","type_sign":"","inner_news":1,"views":715,"comment_amount_label":"0","views_label":"715"},{"id":3527019,"title":"杭州一小店靠卖烧饼赚7套房?老板笑称:不多不多","link":"lsapp://cn.ahurls.news/news?id=3527019","pics":["appletrecommend/201804/5ae3b801144f8.jpg"],"t":"url","type":"normal","alias":"headline","pic_amount":0,"style":"single_right","comment_amount":1,"source":"","type_sign":"","inner_news":1,"views":604,"comment_amount_label":"1","views_label":"604"},{"id":3526987,"title":"2018五一小长假凤阳狼巷迷谷景区旅游攻略 现在就开启探奇之旅吧","link":"lsapp://cn.ahurls.news/news?id=3526987","pics":["appletrecommend/201804/5ae3b3982f033.jpg"],"t":"url","type":"normal","alias":"headline","pic_amount":0,"style":"single_right","comment_amount":0,"source":"","type_sign":"","inner_news":1,"views":536,"comment_amount_label":"0","views_label":"536"},{"id":3527011,"title":"8省市上调2018年最低工资标准 你所在的省份涨了多少?","link":"lsapp://cn.ahurls.news/news?id=3527011","pics":["appletrecommend/201804/5ae3b1a3ac37a.jpg"],"t":"url","type":"normal","alias":"headline","pic_amount":0,"style":"single_right","comment_amount":1,"source":"","type_sign":"","inner_news":1,"views":726,"comment_amount_label":"1","views_label":"726"},{"id":3527024,"title":"小心了!你购买的减肥产品可能是咖啡掺禁药","link":"lsapp://cn.ahurls.news/news?id=3527024","pics":["appletrecommend/201804/5ae3bc52a4a80.jpg"],"t":"url","type":"normal","alias":"headline","pic_amount":0,"style":"single_right","comment_amount":1,"source":"","type_sign":"","inner_news":1,"views":420,"comment_amount_label":"1","views_label":"420"},{"id":3527017,"title":"7岁弟弟救8岁血癌哥哥 美女妈妈剃光头鼓励哥俩","link":"lsapp://cn.ahurls.news/image_news?id=3527017","pics":["special/tuku/201804/5ae3b37917ee164666.jpg","special/tuku/201804/5ae3b378e408683198.jpg","special/tuku/201804/5ae3b378cb22310509.jpg"],"t":"url","type":"images","alias":"headline","pic_amount":3,"style":"multi","comment_amount":0,"source":"","type_sign":"","inner_news":1,"views":801,"comment_amount_label":"0","views_label":"801","pics_new":["special/tuku/201804/5ae3b37917ee164666.jpg"]},{"id":3526417,"title":"安徽将集中整治校外培训机构 中小学教师参加校外培训或取消教师资格","link":"lsapp://cn.ahurls.news/news?id=3526417","pics":["appletrecommend/201804/5ae290d38d909.jpg"],"t":"url","type":"normal","alias":"headline","pic_amount":0,"style":"single_right","comment_amount":12,"source":"","type_sign":"","inner_news":1,"views":5419,"comment_amount_label":"12","views_label":"5419"},{"id":3526377,"title":"芜湖一老人多次在电梯里做这事 全楼居民大倒苦水!","link":"lsapp://cn.ahurls.news/news?id=3526377","pics":["appletrecommend/201804/5ae2bc988ccc3.jpg"],"t":"url","type":"normal","alias":"headline","pic_amount":0,"style":"single_right","comment_amount":5,"source":"","type_sign":"","inner_news":1,"views":4341,"comment_amount_label":"5","views_label":"4341"},{"id":3526179,"title":"合肥市区到机场多一条便捷通道 望江西路延伸段有望6月放行通车","link":"lsapp://cn.ahurls.news/news?id=3526179","pics":["appletrecommend/201804/5ae2602324c7c.jpg"],"t":"url","type":"normal","alias":"headline","pic_amount":0,"style":"single_right","comment_amount":6,"source":"","type_sign":"","inner_news":1,"views":5313,"comment_amount_label":"6","views_label":"5313"},{"id":3526798,"title":"女子怀二胎老公彻夜不回还约炮 竟是病要治!","link":"lsapp://cn.ahurls.news/news?id=3526798","pics":["appletrecommend/201804/5ae2c9bc7dedd.jpg"],"t":"url","type":"normal","alias":"headline","pic_amount":0,"style":"single_right","comment_amount":6,"source":"","type_sign":"","inner_news":1,"views":3664,"comment_amount_label":"6","views_label":"3664"},{"id":3526106,"title":"映像第65期:蓬莱仙洞9米\u201c金钟\u201d震撼游人 五一出游开启\u201c躲雨\u201d计划","link":"lsapp://cn.ahurls.news/image_news?id=3526106","pics":["special/tuku/201804/5ae1c280ceae926314.jpg","special/tuku/201804/5ae1baad59f1d65946.jpg","special/tuku/201804/5ae1baadab00a12875.jpg"],"t":"url","type":"images","alias":"headline","pic_amount":3,"style":"multi","comment_amount":4,"source":"","type_sign":"","inner_news":1,"views":4381,"comment_amount_label":"4","views_label":"4381","pics_new":["special/tuku/201804/5ae1c280ceae926314.jpg"]},{"id":3526206,"title":"合肥人的\u201c五一\u201d假期可能要\u201c泡汤\u201d 一放假就下雨天气的小船说翻就翻","link":"lsapp://cn.ahurls.news/news?id=3526206","pics":["appletrecommend/201804/5ae26c8da4dd9.jpg"],"t":"url","type":"normal","alias":"headline","pic_amount":0,"style":"single_right","comment_amount":4,"source":"","type_sign":"","inner_news":1,"views":5320,"comment_amount_label":"4","views_label":"5320"},{"id":3526368,"title":"2018年\u201c新一线\u201d城市排行榜发布 城市分级完整名单如下","link":"lsapp://cn.ahurls.news/news?id=3526368","pics":["appletrecommend/201804/5ae291c20550c.jpg"],"t":"url","type":"normal","alias":"headline","pic_amount":0,"style":"single_right","comment_amount":5,"source":"","type_sign":"","inner_news":1,"views":9425,"comment_amount_label":"5","views_label":"9425"}] * extras : {"slider":[{"id":3527013,"pic":"18/0428/5ae3d3c0425d6.jpg","link":"lsapp://cn.ahurls.news/news?id=3527013","t":"url","inner_news":1,"title":"守护碧水蓝天合肥去年开出3002万罚单","type":"nomal","type_sign":""},{"id":3527020,"pic":"18/0428/5ae3d24eac0ce.jpg","link":"lsapp://cn.ahurls.news/news?id=3527020","t":"url","inner_news":1,"title":"合肥将废止5件地方性法规","type":"nomal","type_sign":""},{"id":3526858,"pic":"18/0427/5ae31546ec92d.jpg","link":"lsapp://cn.ahurls.news/news?id=3526858","t":"url","inner_news":1,"title":"紫蓬山将打造房车露营基地","type":"nomal","type_sign":""},{"id":3526459,"pic":"18/0427/5ae2bbb7f0f06.jpg","link":"lsapp://cn.ahurls.news/news?id=3526459","t":"url","inner_news":1,"title":"合肥个人出租住房每平米奖励12元","type":"nomal","type_sign":""},{"id":3526920,"pic":"18/0428/5ae3b7297c14f.jpg","link":"lsapp://cn.ahurls.news/news?id=3526920","t":"url","inner_news":1,"title":"2018庐阳欢乐购五一篇躁动整座城","type":"nomal","type_sign":""}]} * bindtips : */ private int page; private int perpage; private int max_page; private int total; private ExtrasBean extras; private String bindtips; private List<DataBean> data; public int getPage() { return page; } public void setPage(int page) { this.page = page; } public int getPerpage() { return perpage; } public void setPerpage(int perpage) { this.perpage = perpage; } public int getMax_page() { return max_page; } public void setMax_page(int max_page) { this.max_page = max_page; } public int getTotal() { return total; } public void setTotal(int total) { this.total = total; } public ExtrasBean getExtras() { return extras; } public void setExtras(ExtrasBean extras) { this.extras = extras; } public String getBindtips() { return bindtips; } public void setBindtips(String bindtips) { this.bindtips = bindtips; } public List<DataBean> getData() { return data; } public void setData(List<DataBean> data) { this.data = data; } public static class ExtrasBean { private List<SliderBean> slider; public List<SliderBean> getSlider() { return slider; } public void setSlider(List<SliderBean> slider) { this.slider = slider; } public static class SliderBean { /** * id : 3527013 * pic : 18/0428/5ae3d3c0425d6.jpg * link : lsapp://cn.ahurls.news/news?id=3527013 * t : url * inner_news : 1 * title : 守护碧水蓝天合肥去年开出3002万罚单 * type : nomal * type_sign : */ private int id; private String pic; private String link; private String t; private int inner_news; private String title; private String type; private String type_sign; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getPic() { return pic; } public void setPic(String pic) { this.pic = pic; } public String getLink() { return link; } public void setLink(String link) { this.link = link; } public String getT() { return t; } public void setT(String t) { this.t = t; } public int getInner_news() { return inner_news; } public void setInner_news(int inner_news) { this.inner_news = inner_news; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getType() { return type; } public void setType(String type) { this.type = type; } public String getType_sign() { return type_sign; } public void setType_sign(String type_sign) { this.type_sign = type_sign; } } } public static class DataBean { /** * id : 3527004 * title : 今年合肥再出实招提升百姓民生福祉 涉及教育、卫生、交通、菜篮子…… * link : lsapp://cn.ahurls.news/news?id=3527004 * pics : ["appletrecommend/201804/5ae3ae73a6aae.jpg"] * t : url * type : normal * alias : headline * pic_amount : 0 * style : single_right * comment_amount : 1 * source : * type_sign : * inner_news : 1 * views : 829 * comment_amount_label : 1 * views_label : 829 * pics_new : ["special/tuku/201804/5ae19d70e2c0578014.jpg"] */ private int id; private String title; private String link; private String t; private String type; private String alias; private int pic_amount; private String style; private int comment_amount; private String source; private String type_sign; private int inner_news; private int views; private String comment_amount_label; private String views_label; private List<String> pics; private List<String> pics_new; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getLink() { return link; } public void setLink(String link) { this.link = link; } public String getT() { return t; } public void setT(String t) { this.t = t; } public String getType() { return type; } public void setType(String type) { this.type = type; } public String getAlias() { return alias; } public void setAlias(String alias) { this.alias = alias; } public int getPic_amount() { return pic_amount; } public void setPic_amount(int pic_amount) { this.pic_amount = pic_amount; } public String getStyle() { return style; } public void setStyle(String style) { this.style = style; } public int getComment_amount() { return comment_amount; } public void setComment_amount(int comment_amount) { this.comment_amount = comment_amount; } public String getSource() { return source; } public void setSource(String source) { this.source = source; } public String getType_sign() { return type_sign; } public void setType_sign(String type_sign) { this.type_sign = type_sign; } public int getInner_news() { return inner_news; } public void setInner_news(int inner_news) { this.inner_news = inner_news; } public int getViews() { return views; } public void setViews(int views) { this.views = views; } public String getComment_amount_label() { return comment_amount_label; } public void setComment_amount_label(String comment_amount_label) { this.comment_amount_label = comment_amount_label; } public String getViews_label() { return views_label; } public void setViews_label(String views_label) { this.views_label = views_label; } public List<String> getPics() { return pics; } public void setPics(List<String> pics) { this.pics = pics; } public List<String> getPics_new() { return pics_new; } public void setPics_new(List<String> pics_new) { this.pics_new = pics_new; } } } }
ModleImpl-------------------------------------------------------------------------------------------------------------
package com.example.recyclerview.Module; import com.example.recyclerview.HttpUtile.HttpUtils; import com.example.recyclerview.HttpUtile.OkLoadListener; import java.util.Map; /** * Created by 你家大林哥 on 2018/4/28. */ public class ModelImpl implements IModle { @Override public void getNewsData(String url, Map<String, String> map, final GetNewsListener getNewsListener) { HttpUtils httpUtils = HttpUtils.getHttpUtils(); httpUtils.okGet(url); httpUtils.setOkLoadListener(new OkLoadListener() { @Override public void okLoadSuccess(String json) { getNewsListener.getSuccess(json); } @Override public void okLoadError(String error) { getNewsListener.getError(error); } }); } }
GetNewsListenter接口---------------------------------------------------------------------------------------------------
package com.example.recyclerview.Module; /** * Created by 你家大林哥 on 2018/4/28. */ public interface GetNewsListener { void getSuccess(String json); void getError(String error); }
IModle-------------------------------------------------------------------------------------------------------------------------
package com.example.recyclerview.Module; import java.util.Map; /** * Created by 你家大林哥 on 2018/4/28. */ public interface IModle { void getNewsData(String url, Map<String,String> map,GetNewsListener getNewsListener); }
HttpUtiles====================================================================
HttpConfig-----------------------------------------------------------------------------------------------------------------
package com.example.recyclerview.HttpUtile; /** * Created by 你家大林哥 on 2018/4/28. */ public class HttpConfig { public static String pic_url = "http://365jia.cn/uploads/"; public static String news_url = "http://365jia.cn/news/api3/365jia/news/headline"; }
HttpUtiles--------------------------------------------------------------------------------------------------------------
package com.example.recyclerview.HttpUtile; import android.os.Handler; import android.os.Message; import android.util.Log; import java.io.File; import java.io.IOException; import java.util.Map; import java.util.Set; import okhttp3.Call; import okhttp3.Callback; import okhttp3.FormBody; import okhttp3.Interceptor; import okhttp3.MediaType; import okhttp3.MultipartBody; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.RequestBody; import okhttp3.Response; /** * Created by gjl on 2018/4/18. */ public class HttpUtils { private static final String TAG = "HttpUtils-----"; private static HttpUtils httpUtils; private final int SUCCESS = 0; private final int ERROR = 1; private MyHandler myHandler = new MyHandler(); private OkLoadListener okLoadListener; public static HttpUtils getHttpUtils() { if (httpUtils == null) { httpUtils = new HttpUtils(); } return httpUtils; } class MyHandler extends Handler { @Override public void handleMessage(Message msg) { switch (msg.what) { case SUCCESS: //成功 String json = (String) msg.obj; okLoadListener.okLoadSuccess(json); break; case ERROR: //失败 String error = (String) msg.obj; okLoadListener.okLoadError(error); break; } } } //get public void okGet(String url) { OkHttpClient okHttpClient = new OkHttpClient.Builder().build(); Request request = new Request.Builder().url(url).build(); Call call = okHttpClient.newCall(request); call.enqueue(new Callback() { @Override public void onFailure(Call call, IOException e) { Message message = myHandler.obtainMessage(); message.what = ERROR; message.obj = e.getMessage(); myHandler.sendMessage(message); } @Override public void onResponse(Call call, Response response) throws IOException { Message message = myHandler.obtainMessage(); message.what = SUCCESS; message.obj = response.body().string(); myHandler.sendMessage(message); } }); } public void setOkLoadListener(OkLoadListener okLoadListener) { this.okLoadListener = okLoadListener; } //post public void okPost(String url, Map<String, String> params) { OkHttpClient okHttpClient = new OkHttpClient.Builder().build(); FormBody.Builder builder = new FormBody.Builder(); Set<String> keySet = params.keySet(); for (String key : keySet) { String value = params.get(key); builder.add(key, value); } FormBody formBody = builder.build(); Request request = new Request.Builder().url(url).post(formBody).build(); Call call = okHttpClient.newCall(request); call.enqueue(new Callback() { @Override public void onFailure(Call call, IOException e) { Message message = myHandler.obtainMessage(); message.what = ERROR; message.obj = e.getMessage(); myHandler.sendMessage(message); } @Override public void onResponse(Call call, Response response) throws IOException { Message message = myHandler.obtainMessage(); message.what = SUCCESS; message.obj = response.body().string(); myHandler.sendMessage(message); } }); } //拦截器 class MyIntercepter implements Interceptor { //intercept 拦截 @Override public Response intercept(Chain chain) throws IOException { //添加公共参数 //post 取出原来所有的参数,将之加到新的请求体里面。然后让请求去执行 Request request = chain.request(); //获取请求方法 String method = request.method(); if (method.equals("GET")) {//---------------------------GET 拦截 //取出url地址 String url = request.url().toString(); //拼接公共参数 boolean contains = url.contains("?"); if (contains) { url = url + "&source=android"; } else { url = url + "?source=android"; } Request request1 = request.newBuilder().url(url).build(); Response response = chain.proceed(request1); return response; } else if (method.equals("POST")) {//---------------------POST 拦截 RequestBody body = request.body();//请求体 if (body instanceof FormBody) { //创建新的请求体 FormBody.Builder newBuilder = new FormBody.Builder(); for (int i = 0; i < ((FormBody) body).size(); i++) { String key = ((FormBody) body).name(i); String value = ((FormBody) body).value(i); newBuilder.add(key, value); } //添加公共参数 newBuilder.add("source", "android"); FormBody newBody = newBuilder.build(); //创建新的请求体 Request request1 = request.newBuilder().post(newBody).build(); //去请求 Response response = chain.proceed(request1); return response; } } return null; } } //上传文件(图片) public void upLoadImage(String url, String path) {//url 要上传的地址。path 要上传的文件路径 //媒体类型 MediaType mediaType = MediaType.parse("image/*"); //multipartbody MultipartBody.Builder builder = new MultipartBody.Builder().setType(MultipartBody.FORM); File file = new File(path); MultipartBody multipartBody = builder.addFormDataPart("file", file.getName(), RequestBody.create(mediaType, file)).build(); OkHttpClient okHttpClient = new OkHttpClient(); Request request = new Request.Builder().url(url).post(multipartBody).build(); Call call = okHttpClient.newCall(request); call.enqueue(new Callback() { @Override public void onFailure(Call call, IOException e) { Log.d(TAG, "上传失败0----: "); } @Override public void onResponse(Call call, Response response) throws IOException { Log.d(TAG, "上传成功: "); } }); } }
OkLoadListenter接口--------------------------------------------------------------------------------------------------------
package com.example.recyclerview.HttpUtile; /** * Created by 你家大林哥 on 2018/4/28. */ public interface OkLoadListener { void okLoadSuccess(String json); void okLoadError(String error ); }
权限=======================================================================
<uses-permission android:name="android.permission.INTERNET"/>
依赖========================================================================
compile 'com.android.support:recyclerview-v7:26.1.0' compile 'com.squareup.okhttp3:okhttp:3.6.0' compile 'com.squareup.okio:okio:1.11.0' implementation 'com.google.code.gson:gson:2.2.4' compile 'com.github.bumptech.glide:glide:3.7.0'