allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
-
dependencies {compile 'com.github.jixiangxiang.basic-start-frame:baselibrary:1.0.2'}
本类库主要包含app开发的基础功能,基础的mvp框架的封装,基础的弹框,加载框封装,列表的数据适配器,通用的holder封装,retrofit+okhttp+rxjava的封装,和一些通用的工具类的封装等。
GitHubService gitHubService = RetrofitManager.newInstance(SampleListActivity.this).getService(GitHubService.class);
final ProgressDialog progressDialog = ProgressDialogUtil.createProgressDialog(SampleListActivity.this);
gitHubService.getOctokitRepos()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.doOnSubscribe(new Action0() {
@Override
public void call() {
progressDialog.show();
}
})
.subscribe(new Subscriber<JSONArray>() {
@Override
public void onCompleted() {
progressDialog.dismiss();
}
@Override
public void onError(Throwable throwable) {
SnackbarUtil.showLong(throwable.getMessage(), netBtn);
}
@Override
public void onNext(final JSONArray jsonArray) {
AlertDialogUtil.showConfirm(SampleListActivity.this, null, jsonArray.toJSONString(), "确定", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
SnackbarUtil.showLong("====" + i, netBtn);
}
}, "取消", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
SnackbarUtil.showLong("====" + i, netBtn);
}
});
}
});
-
dependencies { compile 'com.github.jixiangxiang.basic-start-frame:photolibrary:1.0.2'}
int permission = ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE);
if (permission != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, DialogUtil.PERMISSION_HEAD);
} else {
if (dialogUtil == null || !dialogUtil.isShowing()) {
dialogUtil = DialogUtil.newInstance(this).authorities("com.eric.self.selfapplication.fileprovider");
dialogUtil.showDialog(DialogUtil.CHOOSE_PHOTO_DIALOG);
}