gank,干货

依赖:
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
compile 'com.android.support:recyclerview-v7:26.1.0'
//注意版本
compile 'com.squareup.retrofit2:retrofit:2.0.1'
// Okhttp库
compile 'com.squareup.okhttp3:okhttp:3.1.2'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
// Retrofit库
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
compile 'com.squareup.retrofit2:converter-gson:2.4.0'
compile 'com.squareup.retrofit2:adapter-rxjava2:2.4.0'
// rxjava+rxandroid+retrofit2+okhttp
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
implementation 'io.reactivex.rxjava2:rxjava:2.1.12'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.squareup.okhttp3:logging-interceptor:3.4.1'
compile 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
compile 'org.greenrobot:eventbus:3.0.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.facebook.fresco:fresco:0.12.0'
compile 'com.scwang.smartrefresh:SmartRefreshLayout:1.0.4'
compile 'com.scwang.smartrefresh:SmartRefreshHeader:1.0.4'//没有使用特殊Header,可以不加这行

implementation 'com.afollestad.material-dialogs:commons:0.9.6.0'
implementation 'com.afollestad.material-dialogs:core:0.9.6.0'
 
自定义LeftBean: 
public class LeftBean {
    private int img;
    private String name;

    public LeftBean(int img, String name) {
        this.img = img;
        this.name = name;
    }

    public int getImg() {
        return img;
    }

    public void setImg(int img) {
        this.img = img;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
主Bean:MessageBean:
public class MessageBean {

    /**
     * error : false
     * results : [{"_id":"5a967b41421aa91071b838f7","createdAt":"2018-02-28T17:49:53.265Z","desc":"MusicLibrary-一个丰富的音频播放SDK","publishedAt":"2018-03-12T08:44:50.326Z","source":"web","type":"Android","url":"https://github.com/lizixian18/MusicLibrary","used":true,"who":"lizixian"},{"_id":"5a9cf1f5421aa9103fff20b1","createdAt":"2018-03-05T15:29:57.435Z","desc":"DirectSelect Dropdown is a selection widget with an ethereal, full-screen modal popup displaying the available choices when the widget is interact with.","images":["http://img.gank.io/90db2f35-2e9d-4d75-b5a9-53ee1719b57b"],"publishedAt":"2018-03-12T08:44:50.326Z","source":"web","type":"Android","url":"https://github.com/Ramotion/direct-select-android","used":true,"who":"Alex Mikhnev"},{"_id":"5a9f4968421aa910426a1890","createdAt":"2018-03-07T10:07:36.87Z","desc":"TextPathView是一个把文字转化为路径动画然后展现出来的自定义控件","images":["http://img.gank.io/bc3987dc-eb33-451f-a901-3e65bd7b666b"],"publishedAt":"2018-03-12T08:44:50.326Z","source":"chrome","type":"Android","url":"https://github.com/totond/TextPathView","used":true,"who":"Jason"},{"_id":"5aa24192421aa9103fff20c3","createdAt":"2018-03-09T16:10:58.75Z","desc":"VirtualXposed:不用 Root,不解锁 BootLoader 也不用刷机就使用 Xposed 模块的APP","publishedAt":"2018-03-12T08:44:50.326Z","source":"web","type":"Android","url":"https://github.com/android-hacker/VirtualXposed","used":true,"who":"weishu"},{"_id":"5a7c42c8421aa90d24a065d4","createdAt":"2018-02-08T20:30:00.798Z","desc":"一个动画效果的播放控件,播放,暂停,停止之间的动画切换","images":["http://img.gank.io/c1ee3231-648d-4449-a455-04a13731b2e1"],"publishedAt":"2018-02-22T08:24:35.209Z","source":"web","type":"Android","url":"https://github.com/SwiftyWang/AnimatePlayButton","used":true,"who":null},{"_id":"5a7c6094421aa90d21aa114a","createdAt":"2018-02-08T22:37:08.833Z","desc":"漂亮的本地多媒体选择器","publishedAt":"2018-02-22T08:24:35.209Z","source":"web","type":"Android","url":"https://github.com/TonnyL/Charles","used":true,"who":"黎赵太郎"},{"_id":"5a7cf9e7421aa90d21aa114b","createdAt":"2018-02-09T09:31:19.687Z","desc":"开源的 markdown 编辑器","images":["http://img.gank.io/760970ea-daae-4b98-9f87-deecdd3fe1f7","http://img.gank.io/ea49dc41-3435-4126-ab5b-d7b3357ab517"],"publishedAt":"2018-02-22T08:24:35.209Z","source":"chrome","type":"Android","url":"https://github.com/zeleven/mua","used":true,"who":"蒋朋"},{"_id":"5a81333c421aa90d264d0eba","createdAt":"2018-02-12T14:25:00.318Z","desc":"A slider widget with a popup bubble displaying the precise value selected.","images":["http://img.gank.io/fe3c723f-643d-4466-91d5-86d9ed4ca88e"],"publishedAt":"2018-02-22T08:24:35.209Z","source":"web","type":"Android","url":"https://github.com/Ramotion/fluid-slider-android","used":true,"who":"Alex Mikhnev"},{"_id":"5a685120421aa911548992ab","createdAt":"2018-01-24T17:25:52.341Z","desc":"Android 下的音乐可视化","images":["http://img.gank.io/e0d29181-282e-4465-9965-1da81e0557d9"],"publishedAt":"2018-01-29T07:53:57.676Z","source":"web","type":"Android","url":"https://github.com/nekocode/MusicVisualization","used":true,"who":"nekocode"},{"_id":"5a69608a421aa9115b9306a2","createdAt":"2018-01-25T12:43:54.642Z","desc":"插件化理解与实现 \u2014\u2014 加载 Activity「类加载篇」","images":["http://img.gank.io/a861c69f-02d2-46e8-b120-58ba4b3d97bf"],"publishedAt":"2018-01-29T07:53:57.676Z","source":"web","type":"Android","url":"https://fashare2015.github.io/2018/01/24/dynamic-load-learning-load-activity/","used":true,"who":"梁山boy"}]
     */

    private boolean error;
    private List<ResultsBean> results;

    public boolean isError() {
        return error;
    }

    public void setError(boolean error) {
        this.error = error;
    }

    public List<ResultsBean> getResults() {
        return results;
    }

    public void setResults(List<ResultsBean> results) {
        this.results = results;
    }

    public static class ResultsBean {
        /**
         * _id : 5a967b41421aa91071b838f7
         * createdAt : 2018-02-28T17:49:53.265Z
         * desc : MusicLibrary-一个丰富的音频播放SDK
         * publishedAt : 2018-03-12T08:44:50.326Z
         * source : web
         * type : Android
         * url : https://github.com/lizixian18/MusicLibrary
         * used : true
         * who : lizixian
         * images : ["http://img.gank.io/90db2f35-2e9d-4d75-b5a9-53ee1719b57b"]
         */

        private String _id;
        private String createdAt;
        private String desc;
        private String publishedAt;
        private String source;
        private String type;
        private String url;
        private boolean used;
        private String who;
        private List<String> images;

        public String get_id() {
            return _id;
        }

        public void set_id(String _id) {
            this._id = _id;
        }

        public String getCreatedAt() {
            return createdAt;
        }

        public void setCreatedAt(String createdAt) {
            this.createdAt = createdAt;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }

        public String getPublishedAt() {
            return publishedAt;
        }

        public void setPublishedAt(String publishedAt) {
            this.publishedAt = publishedAt;
        }

        public String getSource() {
            return source;
        }

        public void setSource(String source) {
            this.source = source;
        }

        public String getType() {
            return type;
        }

        public void setType(String type) {
            this.type = type;
        }

        public String getUrl() {
            return url;
        }

        public void setUrl(String url) {
            this.url = url;
        }

        public boolean isUsed() {
            return used;
        }

        public void setUsed(boolean used) {
            this.used = used;
        }

        public String getWho() {
            return who;
        }

        public void setWho(String who) {
            this.who = who;
        }

        public List<String> getImages() {
            return images;
        }

        public void setImages(List<String> images) {
            this.images = images;
        }
    }
}

inter类:

ServiceUrl:
public class ServiceUrl {
    public static final String BASE_URL="http://gank.io/";
}
ApiService:
public interface ApiService {
   @GET("api/data/{type}/{num}/1")
    Observable<MessageBean>  getdata(@Path("type") String type, @Path("num") String num);

}
IPresenter:
public interface IPresenter<T> {
    void OnReceiver(T t);
}
IView:
public interface IView<T> {
    void OnSuccess(T t);
}
OnReceiveritem:
public interface OnReceiveritem {
    void OnitemCilck(int position);
}
 

model层:

DataModel:
public class DataModel {
    IPresenter iPresenter;
    public DataModel(IPresenter iPresenter){
        this.iPresenter=iPresenter;
    }
    public void getData(String type,String num){
        HttpUtils.getInstance().getService()
                .getdata(type,num)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Observer<MessageBean>() {
                    @Override
                    public void onSubscribe(Disposable d) {

                    }

                    @Override
                    public void onNext(MessageBean messageBean) {

                        iPresenter.OnReceiver(messageBean);
                    }

                    @Override
                    public void onError(Throwable e) {

                    }

                    @Override
                    public void onComplete() {

                    }
                });

    }
}
presenter层:
DataPresenter:
public class DataPresenter implements IPresenter<MessageBean> {
    IView iView;
    private DataPresenter dataPresenter;
    private DataModel dataModel;

    public DataPresenter(IView iView){
       this.iView=iView;
    }
    public void getData(String type ,String num){
        dataModel = new DataModel(this);
        dataModel.getData(type,num);
    }
    @Override
    public void OnReceiver(MessageBean messageBean) {

        iView.OnSuccess(messageBean);
    }
}
 
utlis类:
public class HttpUtils {
    private static volatile HttpUtils instance;
    private Retrofit retrofit;
    private HttpUtils(){
        //日志拦截器
        HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
        interceptor.setLevel(HttpLoggingInterceptor.Level.BASIC);
        OkHttpClient client = new OkHttpClient.Builder()
                .addInterceptor(interceptor)
                .build();

        retrofit = new Retrofit.Builder()
                .baseUrl(ServiceUrl.BASE_URL)
                .client(client)
                .addConverterFactory(GsonConverterFactory.create())
                .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
                .build();
    }
    public static HttpUtils getInstance() {
        if (instance == null) {
            synchronized (HttpUtils.class) {
                if (null == instance) {
                    instance = new HttpUtils();
                }
            }
        }
        return instance;
    }

    public ApiService getService() {
        return retrofit.create(ApiService.class);
    }
}
 
搜索
ResideLayout类:(1484行代码)

view层:

App类(上下拉加载条目):

public class App extends Application {
    static {//static 代码段可以防止内存泄露
        //设置全局的Header构建器
        SmartRefreshLayout.setDefaultRefreshHeaderCreater(new DefaultRefreshHeaderCreater() {
            @Override
            public RefreshHeader createRefreshHeader(Context context, RefreshLayout layout) {
                layout.setPrimaryColorsId(R.color.colorPrimary, android.R.color.white);//全局设置主题颜色
                return new ClassicsHeader(context).setSpinnerStyle(SpinnerStyle.Translate);//指定为经典Header,默认是 贝塞尔雷达Header
            }
        });
        //设置全局的Footer构建器
        SmartRefreshLayout.setDefaultRefreshFooterCreater(new DefaultRefreshFooterCreater() {
            @Override
            public RefreshFooter createRefreshFooter(Context context, RefreshLayout layout) {
                //指定为经典Footer,默认是 BallPulseFooter
                return new ClassicsFooter(context).setSpinnerStyle(SpinnerStyle.Translate);
            }
        });
    }
}
MainActivity:
public class MainActivity extends AppCompatActivity implements IView<MessageBean>,ColorChooserDialog.ColorCallback{


    @BindView(R.id.textname)
    TextView textname;
    @BindView(R.id.left_rlv)
    RecyclerView leftRlv;
    @BindView(R.id.ll)
    LinearLayout ll;
    @BindView(R.id.fl_left)
    FrameLayout flLeft;
    @BindView(R.id.right_rlv)
    RecyclerView rightRlv;
    @BindView(R.id.refreshLayout)
    SmartRefreshLayout refreshLayout;
    @BindView(R.id.about)
    TextView about;
    @BindView(R.id.neum)
    TextView neum;
    @BindView(R.id.fl_right)
    RelativeLayout flRight;
    @BindView(R.id.texttheum)
    TextView texttheum;
    @BindView(R.id.reside)
    ResideLayout reside;
    private LeftAbapter leftAbapter;
    private RightAbapter rightAbapter;
    int num = 10;
    String type = "all";
    List<MessageBean.ResultsBean> list_right = new ArrayList<MessageBean.ResultsBean>();
    private DataPresenter dataPresenter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        EventBus.getDefault().register(this);
        ButterKnife.bind(this);

        dataPresenter = new DataPresenter(this);
        dataPresenter.getData(type, num + "");
        final List<LeftBean> list = new ArrayList<>();

        list.add(new LeftBean(R.drawable.app, "全部"));
        list.add(new LeftBean(R.drawable.lian, "福利"));
        list.add(new LeftBean(R.drawable.android, "Android"));
        list.add(new LeftBean(R.drawable.ios, "iOS"));
        list.add(new LeftBean(R.drawable.video, "休息视频"));
        list.add(new LeftBean(R.drawable.js, "前端"));
        list.add(new LeftBean(R.drawable.ziyuan, "拓展资源"));
        list.add(new LeftBean(R.drawable.app, "App"));
        list.add(new LeftBean(R.drawable.gengduo, "瞎推荐"));

        leftRlv.setLayoutManager(new LinearLayoutManager(MainActivity.this, LinearLayoutManager.VERTICAL, false));
        leftAbapter = new LeftAbapter(MainActivity.this, list);
        leftRlv.setAdapter(leftAbapter);


        leftAbapter.setonclick(new OnReceiveritem() {
            @Override
            public void OnitemCilck(int position) {

                reside.closePane();
                String name = list.get(position).getName();
                texttheum.setText(name);
                EventBus.getDefault().post(name);

            }
        });


        rightRlv.setLayoutManager(new LinearLayoutManager(this));
        refreshLayout.setOnRefreshListener(new OnRefreshListener() {
            @Override
            public void onRefresh(RefreshLayout refreshlayout) {
                refreshlayout.finishRefresh(2000);
            }
        });
        refreshLayout.setOnLoadmoreListener(new OnLoadmoreListener() {
            @Override
            public void onLoadmore(RefreshLayout refreshlayout) {

                num += 10;

                dataPresenter.getData(type, num + "");

                refreshlayout.finishLoadmore(2000);
            }
        });

        texttheum.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                reside.openPane();

            }
        });

    }

    @Subscribe(threadMode = ThreadMode.MAIN)
    public void getType(String type) {
        Log.d("--", "getType: " + type);

        if (type.equals("全部")) {
            type = "all";
        }

        if (!this.type.equals(type)) {
            num = 10;
        }

        this.type = type;

        dataPresenter.getData(type, num + "");
    }

    @Override
    public void OnSuccess(MessageBean messageBean) {
        if (messageBean != null) {
            List<MessageBean.ResultsBean> results = messageBean.getResults();
            if (results != null) {
                list_right.clear();
                list_right.addAll(results);
                Log.d("--", "OnSuccess: " + list_right.size());
                rightAbapter = new RightAbapter(MainActivity.this, list_right);
                rightRlv.setAdapter(rightAbapter);
                rightAbapter.SetRightonitemclick(new OnReceiveritem() {
                    @Override
                    public void OnitemCilck(int position) {
                        String url = list_right.get(position).getUrl();
                        Intent intent = new Intent(MainActivity.this, Webview.class);

                        startActivity(intent);
                        EventBus.getDefault().postSticky(url);

                    }
                });
            }

        }

    }

    @Override
    protected void onDestroy() {
        EventBus.getDefault().unregister(this);
        super.onDestroy();
    }

    @OnClick({R.id.about, R.id.neum})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.about:
                View view1 = View.inflate(MainActivity.this, R.layout.alsert_item, null);
                new AlertDialog.Builder(this)
                        .setIcon(R.drawable.a_o)
                        .setTitle("关于我")
                        .setView(view1)
                        .setNegativeButton("关闭", null).show();
                TextView alerttextone = view1.findViewById(R.id.alerttextone);
                TextView alerttexttwo = view1.findViewById(R.id.alerttexttwo);
                alerttextone.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {

                        Intent intent = new Intent(MainActivity.this, Webviewtwo.class);

                        startActivity(intent);

                    }
                });
                alerttexttwo.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        Intent intent = new Intent(MainActivity.this, Webviewtwo.class);

                        startActivity(intent);
                    }
                });

                break;
            case R.id.neum:

                //颜色的数组
                int[] primary = new int[] {
                        Color.parseColor("#F44336"),
                        Color.parseColor("#FF0000"),
                        Color.parseColor("#FFFF00"),
                        Color.parseColor("#00FF00"),
                        Color.parseColor("#0000FF"),
                        Color.parseColor("#00FFFF"),
                        Color.parseColor("#FF00FF")
                };
                //有些按钮是系统默认的
                new ColorChooserDialog.Builder(MainActivity.this, R.string.color_palette)
                        .accentMode(true)//
                        .customColors(primary, null)//两个颜色数组
                        .dynamicButtonColor(false)//动态按钮颜色
                        .customButton(0)//设置颜色不显示
                        .cancelButton(R.string.cancle)
                        .doneButton(R.string.done)
                        .show(MainActivity.this);//传入上下文



                break;
        }
    }


    @Override
    public void onColorSelection(@NonNull ColorChooserDialog dialog, int selectedColor) {

        flLeft.setBackgroundColor(selectedColor);

        texttheum.setBackgroundColor(selectedColor);

        rightAbapter.getColor(selectedColor);

        rightAbapter.notifyDataSetChanged();

    }

    @Override
    public void onColorChooserDismissed(@NonNull ColorChooserDialog dialog) {

    }
}

适配器:

LeftAbapter:

public class LeftAbapter extends RecyclerView.Adapter{
    Context context;
    List<LeftBean> list;
    OnReceiveritem onReceiveritem;
    public LeftAbapter(Context context, List<LeftBean> list) {
        this.context=context;
        this.list=list;
    }
    public void setonclick(OnReceiveritem onReceiveritem){
        this.onReceiveritem=onReceiveritem;
    }

    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = View.inflate(context, R.layout.left_item, null);
        ViewHolder viewHolder = new ViewHolder(view);
        return viewHolder;
    }

    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, final int position) {
        ViewHolder viewHolder = (ViewHolder) holder;
        viewHolder.text.setText(list.get(position).getName());
        Glide.with(context).load(list.get(position).getImg()).into(viewHolder.img);
        viewHolder.itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                onReceiveritem.OnitemCilck(position);
            }
        });
    }

    @Override
    public int getItemCount() {
        return list.size();
    }
    class ViewHolder extends RecyclerView.ViewHolder{

        private final ImageView img;
        private final TextView text;

        public ViewHolder(View itemView) {
            super(itemView);
            img = itemView.findViewById(R.id.left_img);
            text = itemView.findViewById(R.id.left_text);

        }
    }

}

RightAbapter:
public class RightAbapter extends RecyclerView.Adapter{
    Context context;
    List<MessageBean.ResultsBean> list_right;
    public static final int TYPE_PULL_IMAGE = 0;
    public static final int TYPE_RIGHT_IMAGE = 1;
    private View view;
    OnReceiveritem onReceiveritem;
    private int color = -121345;


    public RightAbapter(Context context, List<MessageBean.ResultsBean> list_right) {
        this.context=context;
        this.list_right=list_right;
    }
    public void SetRightonitemclick(OnReceiveritem onReceiveritem){
        this.onReceiveritem=onReceiveritem;
    }

    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {


        if(viewType==TYPE_PULL_IMAGE){

            view = View.inflate(context, R.layout.itemone, null);


        }else{
            view = View.inflate(context, R.layout.itemtwo, null);

        }

        ViewHolder viewHolder = new ViewHolder(view);

        return  viewHolder;


    }

    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, final int position) {

        ViewHolder viewHolder = (ViewHolder) holder;
        viewHolder.itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                onReceiveritem.OnitemCilck(position);
            }
        });
        int itemViewType = getItemViewType(position);

        if(itemViewType==TYPE_PULL_IMAGE){
            if(list_right.get(position).getUrl()!=null){
                Glide.with(context).load(list_right.get(position).getUrl()).into(viewHolder.img);
            }
        }else{
            viewHolder.textone.setText(list_right.get(position).getType()+":"+list_right.get(position).getWho());
            viewHolder.textone.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG);
            viewHolder.textone.setTextColor(color);
        }



    }

    @Override
    public int getItemViewType(int position) {

        String url = list_right.get(position).getUrl();
        boolean contains = url.contains(".jpg");
        boolean contains1 = url.contains(".jpeg");

        if(contains||contains1){
            return 0;
        }else{
            return 1;
        }
    }

    @Override
    public int getItemCount() {
        return list_right.size();
    }
    class ViewHolder extends RecyclerView.ViewHolder{

        private ImageView img;
        private TextView textone;

        public ViewHolder(View itemView) {
            super(itemView);
            img = itemView.findViewById(R.id.oneimg);
            textone = itemView.findViewById(R.id.onetext);


        }
    }

    public void getColor(int color){
        this.color = color;
    }


}
条目点击跳转页面:
条目点击
public class Webview extends AppCompatActivity {

    @BindView(R.id.webview)
    WebView webview;
    private String url="";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_webview);
        ButterKnife.bind(this);
        EventBus.getDefault().register(this);
        //声明WebSettings子类
        WebSettings webSettings = webview.getSettings();

//如果访问的页面中要与Javascript交互,则webview必须设置支持Javascript
        webSettings.setJavaScriptEnabled(true);


//设置自适应屏幕,两者合用
        webSettings.setUseWideViewPort(true); //将图片调整到适合webview的大小
        webSettings.setLoadWithOverviewMode(true); // 缩放至屏幕的大小

//缩放操作
        webSettings.setSupportZoom(true); //支持缩放,默认为true。是下面那个的前提。
        webSettings.setBuiltInZoomControls(true); //设置内置的缩放控件。若为false,则该WebView不可缩放
        webSettings.setDisplayZoomControls(false); //隐藏原生的缩放控件

//其他细节操作
        webSettings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); //关闭webview中缓存
        webSettings.setAllowFileAccess(true); //设置可以访问文件
        webSettings.setJavaScriptCanOpenWindowsAutomatically(true); //支持通过JS打开新窗口
        webSettings.setLoadsImagesAutomatically(true); //支持自动加载图片
        webSettings.setDefaultTextEncodingName("utf-8");//设置编码格式
        webview.loadUrl(url);
    }

    @Subscribe(threadMode = ThreadMode.MAIN,sticky = true)
    public void getUrl(String url){
        this.url=url;
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        EventBus.getDefault().unregister(this);
    }
}

activity_main布局:

<com.wode.gank.ResideLayout
    android:id="@+id/reside"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"

    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <FrameLayout
        android:id="@+id/fl_left"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <LinearLayout
            android:id="@+id/ll"
            android:layout_marginLeft="20dp"
            android:orientation="vertical"
            android:layout_width="match_parent"
            android:layout_height="match_parent">


        <ImageView
           android:layout_marginTop="20dp"
            android:layout_marginLeft="20dp"
            android:background="@drawable/root"
            android:layout_width="60dp"
            android:layout_height="60dp" />
        <TextView
            android:layout_marginTop="10dp"
            android:id="@+id/textname"
            android:layout_marginLeft="20dp"
            android:text="我妈要我告诉你"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

        <android.support.v7.widget.RecyclerView
            android:id="@+id/left_rlv"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

        </android.support.v7.widget.RecyclerView>

            <LinearLayout
                android:layout_marginTop="100dp"
                android:orientation="horizontal"
                android:layout_width="match_parent"
                android:layout_height="30dp">
                <ImageView
                    android:layout_marginLeft="30dp"
                    android:layout_width="30dp"
                    android:background="@drawable/a_o"
                    android:layout_height="30dp" />
                <TextView
                    android:id="@+id/about"
                    android:text="关于"
                    android:layout_gravity="center"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" />
                <ImageView
                    android:background="@drawable/a_4"
                    android:layout_marginLeft="30dp"
                    android:layout_width="30dp"
                    android:layout_height="30dp" />
                <TextView
                    android:id="@+id/neum"
                    android:text="主题"
                    android:layout_gravity="center"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" />

            </LinearLayout>
        </LinearLayout>
    </FrameLayout>

    <RelativeLayout
        android:id="@+id/fl_right"
        android:background="@drawable/ooow"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        <TextView
            android:id="@+id/texttheum"
            android:gravity="center"
            android:textColor="#ffffff"
            android:textSize="40dp"
            android:text="全部"
            android:background="#1b1b1a"
            android:layout_width="match_parent"
            android:layout_height="50dp" />
        <com.scwang.smartrefresh.layout.SmartRefreshLayout
            android:layout_below="@id/texttheum"
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/refreshLayout"
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <com.scwang.smartrefresh.layout.header.ClassicsHeader

                android:layout_width="match_parent"
                android:layout_height="wrap_content"/>
        <android.support.v7.widget.RecyclerView
            android:layout_marginTop="50dp"
            android:id="@+id/right_rlv"
            android:layout_width="match_parent"
            android:layout_height="match_parent">

        </android.support.v7.widget.RecyclerView>
            <com.scwang.smartrefresh.layout.footer.ClassicsFooter
                android:layout_width="match_parent"
                android:layout_height="wrap_content"/>
        </com.scwang.smartrefresh.layout.SmartRefreshLayout>
    </RelativeLayout>

</com.wode.gank.ResideLayout>




1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。 6、可私信博主看论文后选择购买源代码。 1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。 6、可私信博主看论文后选择购买源代码。 1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。 6、可私信博主看论文后选择购买源代码。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值