|
@@ -22,6 +22,7 @@ import com.drake.net.Get
|
|
import com.drake.net.sample.R
|
|
import com.drake.net.sample.R
|
|
import com.drake.net.sample.converter.GsonConverter
|
|
import com.drake.net.sample.converter.GsonConverter
|
|
import com.drake.net.sample.model.Model
|
|
import com.drake.net.sample.model.Model
|
|
|
|
+import com.drake.net.sample.model.UserModel
|
|
import com.drake.net.utils.scopeNetLife
|
|
import com.drake.net.utils.scopeNetLife
|
|
import kotlinx.android.synthetic.main.fragment_custom_convert.*
|
|
import kotlinx.android.synthetic.main.fragment_custom_convert.*
|
|
|
|
|
|
@@ -37,9 +38,9 @@ class GsonConvertFragment : BaseConvertFragment(R.layout.fragment_custom_convert
|
|
""".trimIndent()
|
|
""".trimIndent()
|
|
|
|
|
|
scopeNetLife {
|
|
scopeNetLife {
|
|
- tv_fragment.text = Get<Model>("api") {
|
|
|
|
- converter = GsonConverter() // 单例转换器, 此时会忽略全局转换器
|
|
|
|
- }.await().data.request_method
|
|
|
|
|
|
+ tv_fragment.text = Get<List<UserModel>>("list") {
|
|
|
|
+ converter = GsonConverter() // 单例转换器, 此时会忽略全局转换器, 在Net中可以直接解析List等嵌套泛型数据
|
|
|
|
+ }.await()[0].name
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|