项目作者: jixiangxiang

项目描述 :
android开发的基础功能集成,具有图片加载,通用列表适配器,基础mvp架构,网络请求等,可作为app新开发的初始框架
高级语言: Java
项目地址: git://github.com/jixiangxiang/basic-start-frame.git
创建时间: 2017-09-30T05:53:19Z
项目社区:https://github.com/jixiangxiang/basic-start-frame

开源协议:

下载


basic-start-frame

Android开发的基础功能集成,具有图片加载,通用列表适配器,基础mvp结构,网络请求,扫码等,可作为app新开发的初始框架,用来快速开发app


该项目具有两个类库,一个baselibrary,一个photolibrary

在你的项目root 的build.gradle 增加repositories

  1. allprojects {
  2. repositories {
  3. ...
  4. maven { url 'https://jitpack.io' }
  5. }
  6. }

  1. baselibrary

    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);

    1. final ProgressDialog progressDialog = ProgressDialogUtil.createProgressDialog(SampleListActivity.this);
    2. gitHubService.getOctokitRepos()
    3. .subscribeOn(Schedulers.io())
    4. .observeOn(AndroidSchedulers.mainThread())
    5. .doOnSubscribe(new Action0() {
    6. @Override
    7. public void call() {
    8. progressDialog.show();
    9. }
    10. })
    11. .subscribe(new Subscriber<JSONArray>() {
    12. @Override
    13. public void onCompleted() {
    14. progressDialog.dismiss();
    15. }
    1. @Override
    2. public void onError(Throwable throwable) {
    3. SnackbarUtil.showLong(throwable.getMessage(), netBtn);
    4. }
    5. @Override
    6. public void onNext(final JSONArray jsonArray) {
    7. AlertDialogUtil.showConfirm(SampleListActivity.this, null, jsonArray.toJSONString(), "确定", new DialogInterface.OnClickListener() {
    8. @Override
    9. public void onClick(DialogInterface dialogInterface, int i) {
    10. SnackbarUtil.showLong("====" + i, netBtn);
    11. }
    12. }, "取消", new DialogInterface.OnClickListener() {
    13. @Override
    14. public void onClick(DialogInterface dialogInterface, int i) {
    15. SnackbarUtil.showLong("====" + i, netBtn);
    16. }
    17. });
    18. }
    19. });
    使用retrofit+rxjava+okhttp 实现的网络请求

基础mvp

app项目中的MvpActivity展示了封装的mvp基础用法,整个列表页代码很简洁,只有五十几行

  1. photolibrary

    dependencies { compile ‘com.github.jixiangxiang.basic-start-frame:photolibrary:1.0.2’}

本类库主要包含图片选择包含拍照选择和相册选择,裁剪,图片加载,默认集成的glide,二维码扫描(使用的bga-qrcodecore和bga-zxing),图片显示放大缩小,

图片选择

  1. int permission = ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE);
  2. if (permission != PackageManager.PERMISSION_GRANTED) {
  3. ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, DialogUtil.PERMISSION_HEAD);
  4. } else {
  5. if (dialogUtil == null || !dialogUtil.isShowing()) {
  6. dialogUtil = DialogUtil.newInstance(this).authorities("com.eric.self.selfapplication.fileprovider");
  7. dialogUtil.showDialog(DialogUtil.CHOOSE_PHOTO_DIALOG);
  8. }
包含了动态权限申请的代码,封装了dialogUtil来使用图片选择功能

二维码扫描

参考app项目中的ScanActivity类中的实现

图片加载显示

参考ListImageActivity的实现,图片加载使用的glide