I have a class with 2 methods, but when I'm debugging I can access showLog()
method but cannot access editProductCode()
method from other class. This is my code:
class ProductCodeModel(private val mView: ProductCodeContract.View) : ProductCodeContract.Model {
fun showLog(){
Log.e("====", "Can access this method")
}
override fun editProductCode(storeId: Int?, departmentId: Int?, name: String?, code: String?, unit: String?, isDynamicReference: Int?, minimumLimit: Float?, isActive: Int?, note: String?) {
Constraint.mRetrofit?.create(MaterialService::class.java)
?.editProductCode(storeId, departmentId, name, code, unit, minimumLimit, isDynamicReference, isActive, note)
?.subscribeOn(Schedulers.io())
?.observeOn(AndroidSchedulers.mainThread())
?.subscribeWith(object : DisposableObserver<InventoryResponse>() {
override fun onComplete() {
}
override fun onNext(response: InventoryResponse) {
if (response.status == Constraint.STATUS_RIGHT)
mView.editProductCodeSuccess(response.inventory)
else {
mView.editProductCodeFailed(response.error?.desc)
}
}
override fun onError(e: Throwable) {
val msg = Resources.getSystem().getString(android.R.string.unknownName)
mView.editProductCodeFailed(msg)
}
})
}
This is my declaration:
private val mModel = ProductCodeModel(this)
mModel.showLog() //I can access this method
mModel.editProductCode(storeId, departmentId, name, code, unit, isDynamicReference, minimumLimit, isActive, note) //I cannot access this method
ProductCodeContract class
interface ProductCodeContract {
interface View {
fun getInventoryListSuccess(inventoryList: List<Inventory>?)
fun getInventoryListFailed(msg: String?)
fun createProductCodeSuccess(inventory: Inventory?)
fun createProductCodeFailed(msg: String?)
fun editProductCodeSuccess(inventory: Inventory?)
fun editProductCodeFailed(msg: String?)
}
interface Model {
fun getInventoryList(storeId: Int?, offset: Int?, limit: Int?)
fun createProductCode(storeId: Int?, departmentId: Int?, name: String?, code: String?, unit: String?, isDynamicReference: Int?,
minimumLimit: Float?, isActive: Int?, note: String?)
fun editProductCode(storeId: Int?, departmentId: Int?, name: String?, code: String?, unit: String?, isDynamicReference: Int?,
minimumLimit: Float?, isActive: Int?, note: String?)
}
}
Somebody help me...
尝试导入嵌套接口方法。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.