RestTestAdapter.java 文件源码

java
阅读 33 收藏 0 点赞 0 评论 0

项目:RestClient 作者:
@Override
public void onBindViewHolder(MyViewHolder holder, int position) {
    RestTest restTest = datas.get(position);
    RoundRectShape shape = new RoundRectShape(new float[]{8, 8, 8, 8, 8, 8, 8, 8}, null, null);
    ShapeDrawable drawable = new ShapeDrawable(shape);

    String color = "6bbd5b";
    switch (restTest.getMethod().toUpperCase()) {
        case "GET":
            break;
        case "POST":
            color = "248fb2";
            break;
        case "DELETE":
            color = "e27a7a";
            break;
        case "PUT":
            color = "9b708b";
            break;
    }
    drawable.getPaint().setColor(Color.parseColor("#" + color));
    holder.tv.setBackground(drawable);
    holder.tv.setText(restTest.getMethod().toUpperCase());

    holder.spec.setText(restTest.getUrl());
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号