|
|
|
@ -8,7 +8,8 @@ import com.common.commonlib.image.config.GlideHolderConfig;
|
|
|
|
|
import com.common.commonlib.image.config.GlideTransitionConfig;
|
|
|
|
|
import com.common.commonlib.image.loader.ImageLoader;
|
|
|
|
|
import com.common.commonlib.log.Logger;
|
|
|
|
|
import com.common.commonlib.net.RequestCallBack;
|
|
|
|
|
import com.common.commonlib.net.callback.RequestNoResultCallBack;
|
|
|
|
|
import com.common.commonlib.net.callback.RequestResultCallBack;
|
|
|
|
|
import com.common.commonlib.net.interceptor.RequestHeadInterceptor;
|
|
|
|
|
import com.common.commonlib.net.interceptor.ResponseHeadInterceptor;
|
|
|
|
|
import com.common.commonlib.utils.BaseUtils;
|
|
|
|
@ -53,7 +54,7 @@ public class DemoActivity extends AppCompatActivity {
|
|
|
|
|
|
|
|
|
|
binding.tv.setOnClickListener(l -> {
|
|
|
|
|
InternetLoader loader = new InternetLoader();
|
|
|
|
|
loader.getHomeArticles(0, new RequestCallBack<ArticlesResponse>() {
|
|
|
|
|
loader.getHomeArticles(0, new RequestResultCallBack<ArticlesResponse>() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onResult(ArticlesResponse result) {
|
|
|
|
|
Logger.INSTANCE.d(TAG, result.getData().toString());
|
|
|
|
@ -63,11 +64,6 @@ public class DemoActivity extends AppCompatActivity {
|
|
|
|
|
public void onError(@Nullable String error) {
|
|
|
|
|
Logger.INSTANCE.d(TAG, "onError");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onComplete() {
|
|
|
|
|
Logger.INSTANCE.d(TAG, "onComplete");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
@ -79,12 +75,7 @@ public class DemoActivity extends AppCompatActivity {
|
|
|
|
|
builder.addHeadParams("Cookie", "loginUserName_wanandroid_com=wang11;token_pass_wanandroid_com=6fbec4fe15d69af8b4531171798f3926;loginUserName=wang11;token_pass=6fbec4fe15d69af8b4531171798f3926");
|
|
|
|
|
interceptors.add(builder.build());
|
|
|
|
|
CollectionLoader loader = new CollectionLoader(interceptors);
|
|
|
|
|
loader.getCollections(0, new RequestCallBack<CollectionResponse>() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onResult(CollectionResponse result) {
|
|
|
|
|
Logger.INSTANCE.d(TAG, "onResult");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
loader.getCollections(0, new RequestNoResultCallBack<CollectionResponse>() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onError(@Nullable String error) {
|
|
|
|
|
Logger.INSTANCE.d(TAG, "onError");
|
|
|
|
@ -103,12 +94,7 @@ public class DemoActivity extends AppCompatActivity {
|
|
|
|
|
Headers headers = response.headers();
|
|
|
|
|
List<String> cookies = headers.values("Set-Cookie");
|
|
|
|
|
}));
|
|
|
|
|
new LoginLoader(interceptors).login("wang11", "wang456852", new RequestCallBack<LoginResponse>() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onResult(LoginResponse result) {
|
|
|
|
|
Logger.INSTANCE.d(TAG, "onResult");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
new LoginLoader(interceptors).login("wang11", "wang456852", new RequestNoResultCallBack<LoginResponse>() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onError(@Nullable String error) {
|
|
|
|
|
Logger.INSTANCE.e(TAG, "onError");
|
|
|
|
|