Skip to content

Commit

Permalink
添加编码参数方法addEncode
Browse files Browse the repository at this point in the history
  • Loading branch information
威威君” committed Jun 4, 2020
1 parent f04ffb7 commit 4b62899
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 5 deletions.
5 changes: 4 additions & 1 deletion app/src/main/java/com/ldw/test/ui/default/DefaultFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProvider
import com.bhttp.wrapper.generator.BHttp
import com.ldw.bhttp.callback.Observer
import com.ldw.test.ApiService
Expand All @@ -16,7 +17,7 @@ import okhttp3.Response


class DefaultFragment : Fragment() {

private lateinit var defaultViewModel: DefaultViewModel

override fun onCreateView(
inflater: LayoutInflater,
Expand All @@ -30,6 +31,8 @@ class DefaultFragment : Fragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
// BHttp.setDefaultDomain("http://192.168.1.2:8022/")
defaultViewModel = ViewModelProvider(this).get(DefaultViewModel::class.java)
// defaultViewModel.mediatorLiveData.addSource()
BHttp.setDebug(true)
get.setOnClickListener {
get()
Expand Down
15 changes: 15 additions & 0 deletions app/src/main/java/com/ldw/test/ui/default/DefaultViewModel.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.ldw.test.ui.default

import androidx.lifecycle.MediatorLiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel

/**
* @date 2020/6/3 23:43
* @user 威威君
*/
class DefaultViewModel : ViewModel() {
var mutableLiveData = MutableLiveData<String>()
var mediatorLiveData = MediatorLiveData<String>()

}
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ class KotlinProcessor : AbstractProcessor() {
}
var ss = """
package com.ldw.bhttp;
import android.app.Activity;
Expand Down Expand Up @@ -448,7 +447,6 @@ public class BaseBHttp<T> {
Type returnType = method.getGenericReturnType();
BaseBHttp<?> result = serviceMethodCache.get(method);
if (result != null) {
LogUtils.logd("缓存读取");
result.reLoadParam(method, args);
return result;
}
Expand Down Expand Up @@ -708,7 +706,9 @@ public class BaseBHttp<T> {
});
}
""".trimIndent()
}

Expand Down
1 change: 0 additions & 1 deletion bhttp-core/src/main/java/com/ldw/bhttp/BaseBHttp.java
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,6 @@ public static <T> T create(final Class<T> service) {
Type returnType = method.getGenericReturnType();
BaseBHttp<?> result = serviceMethodCache.get(method);
if (result != null) {
LogUtils.logd("缓存读取");
result.reLoadParam(method, args);
return result;
}
Expand Down

0 comments on commit 4b62899

Please sign in to comment.