You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.5 KiB
Java
48 lines
1.5 KiB
Java
package com.common.commonlibtest;
|
|
|
|
import androidx.appcompat.app.AppCompatActivity;
|
|
|
|
import android.os.Bundle;
|
|
import android.util.Log;
|
|
|
|
import com.common.commonlib.net.RequestCallBack;
|
|
import com.common.commonlibtest.bean.ArticlesResponse;
|
|
import com.common.commonlibtest.manager.InternetLoader;
|
|
import com.yinuo.commonlibtest.databinding.ActivityMainBinding;
|
|
|
|
import org.jetbrains.annotations.Nullable;
|
|
|
|
public class MainActivity extends AppCompatActivity {
|
|
private static final String TAG = MainActivity.class.getSimpleName();
|
|
ActivityMainBinding binding;
|
|
|
|
@Override
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
super.onCreate(savedInstanceState);
|
|
binding = ActivityMainBinding.inflate(getLayoutInflater());
|
|
setContentView(binding.getRoot());
|
|
initView();
|
|
}
|
|
|
|
private void initView() {
|
|
binding.tv.setOnClickListener(l -> {
|
|
InternetLoader loader = new InternetLoader();
|
|
loader.getHomeArticles(0, new RequestCallBack<ArticlesResponse>() {
|
|
@Override
|
|
public void onResult(ArticlesResponse result) {
|
|
Log.d(TAG, result.getData().toString());
|
|
}
|
|
|
|
@Override
|
|
public void onError(@Nullable String error) {
|
|
Log.d(TAG, "onError");
|
|
}
|
|
|
|
@Override
|
|
public void onComplete() {
|
|
Log.d(TAG, "onComplete");
|
|
}
|
|
});
|
|
});
|
|
}
|
|
} |