}
fun bindData(data: String) {
if (url_maps.size == 0) {
url_maps.put(“Hannibal”, R.mipmap.pic1);
url_maps.put(“Big Bang Theory”, R.mipmap.pic2);
url_maps.put(“House of Cards”, R.mipmap.pic3);
url_maps.put(“Game of Thrones”, R.mipmap.pic4);
for ((key, value) in url_maps) {
val textSlideView: TextSliderView = TextSliderView(context)
textSlideView.description(key).image(value)
sliderLayout.addSlider(textSlideView)
}
}
}
}
}
TakeoutService.kt是Retrofit请求的service
package com.example.takeout.model.net
import retrofit2.Call
import retrofit2.http.GET
interface TakeoutService {
//ex. @GET(“users/{user}/repos”)
//ex. fun listRepos(@Path(“user”) user: String): Call<List>
@GET(“takeout?index=0”)
fun getHomeInfo(): Call
}
ResponseInfo.kt服务器返回的数据,这里2种数据都是list类型的数据
package com.example.takeout.model.net
import com.heima.takeout.model.beans.Seller
class ResponseInfo {
//服务器开发者定义的数据结构
var code: String = “”
lateinit var nearbySellerList:List
lateinit var otherSellerList:List
}
Seller.kt数据的bean对象
package com.heima.takeout.model.beans
import android.content.pm.ActivityInfo
import java.io.Serializable
import java.util.*
data class Seller(var id: Long, var pic: String, var name: String, var score: String, var sale: String,
var ensure: String, var invoice: String, var sendPrice: String, var deliveryFee: String,
var recentVisit: String, var distance: String, var time: String, var icon: String,
var activityList: ArrayList) : Serializable{
// var id: Long = 0
// var pic: String? = null
// var name: String? = null
//
// var score: String? = null
// var sale: String? = null
// var ensure: String? = null
//
// var invoice: String? = null
// var sendPrice: String? = null
// var deliveryFee: String? = null
//
// var recentVisit: String? = null
// var distance: String? = null
// var time: String? = null
//
// var icon: String? = null
//
// var activityList: ArrayList? = null
}
Json数据takeInfors
{
“nearbySellerList”: [
{
“activityList”: “”,
“deliveryFee”: “6”,
“distance”: “996米/50分钟”,
“ensure”: “takeout/imgs/seller/3.jpg”,
“id”: 1,
“invoice”: " ",
“name”: “其他第1家分店”,
“pic”: “”,
“recentVisit”: “”,
“sale”: “月售8份”,
“score”: “4”,
“sendPrice”: “30”,
“time”: “”
},
{
“activityList”: “”,
“deliveryFee”: “6”,
“distance”: “996米/50分钟”,
“ensure”: “takeout/imgs/seller/3.jpg”,
“id”: 2,
“invoice”: " ",
“name”: “其他第2家分店”,
“pic”: “”,
“recentVisit”: “”,
“sale”: “月售8份”,
“score”: “4”,
“sendPrice”: “30”,
“time”: “”
},
{
“activityList”: “”,
“deliveryFee”: “6”,
“distance”: “996米/50分钟”,
“ensure”: “takeout/imgs/seller/3.jpg”,
“id”: 3,
“invoice”: " ",
“name”: “其他第3家分店”,
“pic”: “”,
“recentVisit”: “”,
“sale”: “月售8份”,
“score”: “4”,
“sendPrice”: “30”,
“time”: “”
},
{
“activityList”: “”,
“deliveryFee”: “6”,
“distance”: “996米/50分钟”,
“ensure”: “takeout/imgs/seller/3.jpg”,
“id”: 4,
“invoice”: " ",
“name”: “其他第4家分店”,
“pic”: “”,
“recentVisit”: “”,
“sale”: “月售8份”,
“score”: “4”,
“sendPrice”: “30”,
“time”: “”
},
{
“activityList”: “”,
“deliveryFee”: “6”,
“distance”: “996米/50分钟”,
“ensure”: “takeout/imgs/seller/3.jpg”,
“id”: 5,
“invoice”: " ",
“name”: “其他第5家分店”,
“pic”: “”,
“recentVisit”: “”,
“sale”: “月售8份”,
“score”: “4”,
“sendPrice”: “30”,
“time”: “”
},
{
“activityList”: “”,
“deliveryFee”: “6”,
“distance”: “996米/50分钟”,
“ensure”: “takeout/imgs/seller/3.jpg”,
“id”: 6,
“invoice”: " ",
“name”: “其他第6家分店”,
“pic”: “”,
“recentVisit”: “”,
“sale”: “月售8份”,
“score”: “4”,
“sendPrice”: “30”,
“time”: “”
},
{
“activityList”: “”,
“deliveryFee”: “6”,
“distance”: “996米/50分钟”,
“ensure”: “takeout/imgs/seller/3.jpg”,
“id”: 7,
“invoice”: " ",
“name”: “其他第7家分店”,
“pic”: “”,
“recentVisit”: “”,
“sale”: “月售8份”,
“score”: “4”,
“sendPrice”: “30”,
“time”: “”
},
{
“activityList”: “”,
“deliveryFee”: “6”,
“distance”: “996米/50分钟”,
“ensure”: “takeout/imgs/seller/3.jpg”,
“id”: 8,
“invoice”: " ",
“name”: “其他第8家分店”,
“pic”: “”,
“recentVisit”: “”,
“sale”: “月售8份”,
“score”: “4”,
“sendPrice”: “30”,
“time”: “”
},
{
“activityList”: “”,
“deliveryFee”: “6”,
“distance”: “996米/50分钟”,
“ensure”: “takeout/imgs/seller/3.jpg”,
“id”: 9,
“invoice”: " ",
“name”: “其他第9家分店”,
“pic”: “”,
“recentVisit”: “”,
“sale”: “月售8份”,
“score”: “4”,
“sendPrice”: “30”,
“time”: “”
},
{
“activityList”: “”,
“deliveryFee”: “6”,
“distance”: “996米/50分钟”,
“ensure”: “takeout/imgs/seller/3.jpg”,
“id”: 10,
“invoice”: " ",
“name”: “其他第10家分店”,
“pic”: “”,
“recentVisit”: “”,
“sale”: “月售8份”,
“score”: “4”,
“sendPrice”: “30”,
“time”: “”
},
{
“activityList”: “”,
“deliveryFee”: “6”,
“distance”: “996米/50分钟”,
“ensure”: “takeout/imgs/seller/3.jpg”,
“id”: 11,
“invoice”: " ",
“name”: “其他第11家分店”,
“pic”: “”,
“recentVisit”: “”,
“sale”: “月售8份”,
“score”: “4”,
“sendPrice”: “30”,
“time”: “”
},
{
“activityList”: “”,
“deliveryFee”: “6”,
“distance”: “996米/50分钟”,
“ensure”: “takeout/imgs/seller/3.jpg”,
“id”: 12,
“invoice”: " ",
“name”: “其他第12家分店”,
“pic”: “”,
“recentVisit”: “”,
“sale”: “月售8份”,
“score”: “4”,
“sendPrice”: “30”,
“time”: “”
},
{
“activityList”: “”,
“deliveryFee”: “6”,
“distance”: “996米/50分钟”,
“ensure”: “takeout/imgs/seller/3.jpg”,
“id”: 13,
“invoice”: " ",
“name”: “其他第13家分店”,
“pic”: “”,
“recentVisit”: “”,
“sale”: “月售8份”,
“score”: “4”,
“sendPrice”: “30”,
“time”: “”
}
],
“otherSellerList”: [
{
“activityList”: “”,
“deliveryFee”: “6”,
“distance”: “996米/50分钟”,
“ensure”: “takeout/imgs/seller/3.jpg”,
“id”: 1,
“invoice”: " ",
“name”: “other1家分店”,
“pic”: “”,
“recentVisit”: “”,
“sale”: “月售8份”,
“score”: “4”,
“sendPrice”: “30”,
“time”: “”
},
{
“activityList”: “”,
“deliveryFee”: “6”,
“distance”: “996米/50分钟”,
“ensure”: “takeout/imgs/seller/3.jpg”,
“id”: 2,
“invoice”: " ",
“name”: “other2家分店”,
“pic”: “”,
“recentVisit”: “”,
“sale”: “月售8份”,
“score”: “4”,
“sendPrice”: “30”,
“time”: “”
},
{
“activityList”: “”,
“deliveryFee”: “6”,
“distance”: “996米/50分钟”,
“ensure”: “takeout/imgs/seller/3.jpg”,
“id”: 3,
“invoice”: " ",
“name”: “other3家分店”,
“pic”: “”,
“recentVisit”: “”,
“sale”: “月售8份”,
“score”: “4”,
“sendPrice”: “30”,
“time”: “”
},
{
“activityList”: “”,
“deliveryFee”: “6”,
“distance”: “996米/50分钟”,
“ensure”: “takeout/imgs/seller/3.jpg”,
“id”: 4,
“invoice”: " ",
“name”: “other4家分店”,
“pic”: “”,
“recentVisit”: “”,
“sale”: “月售8份”,
“score”: “4”,
“sendPrice”: “30”,
“time”: “”
},
{
“activityList”: “”,
“deliveryFee”: “6”,
“distance”: “996米/50分钟”,
“ensure”: “takeout/imgs/seller/3.jpg”,
“id”: 5,
“invoice”: " ",
“name”: “other5家分店”,
“pic”: “”,
“recentVisit”: “”,
“sale”: “月售8份”,
“score”: “4”,
“sendPrice”: “30”,
“time”: “”
},
{
“activityList”: “”,
“deliveryFee”: “6”,
“distance”: “996米/50分钟”,
“ensure”: “takeout/imgs/seller/3.jpg”,
“id”: 6,
“invoice”: " ",
“name”: “other6家分店”,
“pic”: “”,
“recentVisit”: “”,
“sale”: “月售8份”,
“score”: “4”,
“sendPrice”: “30”,
“time”: “”
},
{
“activityList”: “”,
“deliveryFee”: “6”,
“distance”: “996米/50分钟”,
“ensure”: “takeout/imgs/seller/3.jpg”,
“id”: 7,
“invoice”: " ",
“name”: “other7家分店”,
“pic”: “”,
“recentVisit”: “”,
“sale”: “月售8份”,
“score”: “4”,
“sendPrice”: “30”,
“time”: “”
},
{
“activityList”: “”,
“deliveryFee”: “6”,
“distance”: “996米/50分钟”,
“ensure”: “takeout/imgs/seller/3.jpg”,
“id”: 8,
“invoice”: " ",
“name”: “other8家分店”,
“pic”: “”,
“recentVisit”: “”,
“sale”: “月售8份”,
“score”: “4”,
“sendPrice”: “30”,
“time”: “”
},
{
“activityList”: “”,
“deliveryFee”: “6”,
“distance”: “996米/50分钟”,
“ensure”: “takeout/imgs/seller/3.jpg”,
“id”: 9,
“invoice”: " ",
“name”: “other9家分店”,
“pic”: “”,
“recentVisit”: “”,
“sale”: “月售8份”,
“score”: “4”,
“sendPrice”: “30”,
“time”: “”
},
{
“activityList”: “”,
“deliveryFee”: “6”,
“distance”: “996米/50分钟”,
“ensure”: “takeout/imgs/seller/3.jpg”,
“id”: 10,
“invoice”: " ",
“name”: “other10家分店”,
“pic”: “”,
“recentVisit”: “”,
“sale”: “月售8份”,
“score”: “4”,
“sendPrice”: “30”,
“time”: “”
},
{
“activityList”: “”,
“deliveryFee”: “6”,
“distance”: “996米/50分钟”,
“ensure”: “takeout/imgs/seller/3.jpg”,
“id”: 11,
“invoice”: " ",
“name”: “other11家分店”,
“pic”: “”,
“recentVisit”: “”,
“sale”: “月售8份”,
“score”: “4”,
写在最后
在技术领域内,没有任何一门课程可以让你学完后一劳永逸,再好的课程也只能是“师傅领进门,修行靠个人”。“学无止境”这句话,在任何技术领域,都不只是良好的习惯,更是程序员和工程师们不被时代淘汰、获得更好机会和发展的必要前提。
如果你觉得自己学习效率低,缺乏正确的指导,可以加入资源丰富,学习氛围浓厚的技术圈一起学习交流吧!
加入我们吧!群内有许多来自一线的技术大牛,也有在小厂或外包公司奋斗的码农,我们致力打造一个平等,高质量的Android交流圈子,不一定能短期就让每个人的技术突飞猛进,但从长远来说,眼光,格局,长远发展的方向才是最重要的。
35岁中年危机大多是因为被短期的利益牵着走,过早压榨掉了价值,如果能一开始就树立一个正确的长远的职业规划。35岁后的你只会比周围的人更值钱。