update 优化下写法
This commit is contained in:
@@ -5,6 +5,7 @@ import androidx.appcompat.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.yutou.netlibs.http.HttpBody;
|
||||
import com.yutou.netlibs.http.HttpCallback;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -21,25 +22,25 @@ public class MainActivity extends AppCompatActivity {
|
||||
findViewById(R.id.button)
|
||||
.setOnClickListener(v -> {
|
||||
Api.getInstance().getList("")
|
||||
.enqueue(new Callback<HttpBody<List<Password>>>() {
|
||||
.enqueue(new HttpCallback<List<Password>>() {
|
||||
@Override
|
||||
public void onResponse(Call<HttpBody<List<Password>>> call, Response<HttpBody<List<Password>>> response) {
|
||||
System.out.println("response = " + response.body().getData());
|
||||
public void onResponse(int code, String status, List<Password> response) {
|
||||
System.out.println("code = " + code + ", status = " + status + ", response = " + response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<HttpBody<List<Password>>> call, Throwable t) {
|
||||
public void onFailure(Throwable throwable) {
|
||||
|
||||
}
|
||||
});
|
||||
Api.getInstance().getVersion().enqueue(new Callback<HttpBody<Bean>>() {
|
||||
Api.getInstance().getVersion().enqueue(new HttpCallback<Bean>() {
|
||||
@Override
|
||||
public void onResponse(Call<HttpBody<Bean>> call, Response<HttpBody<Bean>> response) {
|
||||
System.out.println("response = " + response.body().getData());
|
||||
public void onResponse(int code, String status, Bean response) {
|
||||
System.out.println("code = " + code + ", status = " + status + ", response = " + response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<HttpBody<Bean>> call, Throwable t) {
|
||||
public void onFailure(Throwable throwable) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user