haolin

ARabbit is a sdk for faster android app development.

Лицензия

Лицензия

Группа

Группа

io.github.hunimeizi
Идентификатор

Идентификатор

haolin
Последняя версия

Последняя версия

1.0.0
Дата

Дата

Тип

Тип

aar
Описание

Описание

haolin
ARabbit is a sdk for faster android app development.

Скачать haolin

Имя Файла Размер
haolin-1.0.0.pom
Обзор

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/io.github.hunimeizi/haolin/ -->
<dependency>
    <groupId>io.github.hunimeizi</groupId>
    <artifactId>haolin</artifactId>
    <version>1.0.0</version>
    <type>aar</type>
</dependency>
// https://jarcasting.com/artifacts/io.github.hunimeizi/haolin/
implementation 'io.github.hunimeizi:haolin:1.0.0'
// https://jarcasting.com/artifacts/io.github.hunimeizi/haolin/
implementation ("io.github.hunimeizi:haolin:1.0.0")
'io.github.hunimeizi:haolin:aar:1.0.0'
<dependency org="io.github.hunimeizi" name="haolin" rev="1.0.0">
  <artifact name="haolin" type="aar" />
</dependency>
@Grapes(
@Grab(group='io.github.hunimeizi', module='haolin', version='1.0.0')
)
libraryDependencies += "io.github.hunimeizi" % "haolin" % "1.0.0"
[io.github.hunimeizi/haolin "1.0.0"]

Зависимости

Библиотека не имеет зависимостей. Это самодостаточное приложение, которое не зависит ни от каких других библиотек.

Модули Проекта

Данный проект не имеет модулей.

HaoLin_Compress_Sample - 图片压缩,支持自定义配置

使用方法

1.使用gradle

repositories {
  google()
  mavenCentral()
}

dependencies {
  implementation 'io.github.hunimeizi:haolinImageCompress:1.0.0'
}

2.使用配置

   
   compressConfig = CompressConfig.builder()
                   .setUnCompressMinPixel(1000) // 最小像素不压缩,默认值:1000
                   .setUnCompressNormalPixel(2000) // 标准像素不压缩,默认值:2000
                   .setMaxPixel(1000) // 长或宽不超过的最大像素 (单位px),默认值:1200
                   .setMaxSize(100 * 1024) // 压缩到的最大大小 (单位B),默认值:200 * 1024 = 200KB
                   .enablePixelCompress(true) // 是否启用像素压缩,默认值:true
                   .enableQualityCompress(true) // 是否启用质量压缩,默认值:true
                   .enableReserveRaw(true) // 是否保留源文件,默认值:true
                   .setCacheDir("") // 压缩后缓存图片路径,默认值:Constants.COMPRESS_CACHE
                   .setShowCompressDialog(true) // 是否显示压缩进度条,默认值:false
                   .create();

3.实现CompressImage.CompressListener接口

 @Override
    public void onCompressSuccess(ArrayList<Photo> images) {
        for (Photo image : images) {
            Log.e("lyb >>> ", "压缩成功 压缩后的路径为" + image.getCompressPath());
        }
        if (dialog != null && !isFinishing()) {
            dialog.dismiss();
        }
        Toast.makeText(MainActivity.this, "压缩成功", Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onCompressFailed(ArrayList<Photo> images, String error) {
        Log.e("lyb >>> ", error);
        if (dialog != null && !isFinishing()) {
            dialog.dismiss();
        }
    }

    // 准备压缩,封装图片集合
    private void preCompress(String photoPath) {
        ArrayList<Photo> photos = new ArrayList<>();
        photos.add(new Photo(photoPath));
        if (!photos.isEmpty()) compress(photos);
    }

    // 开始压缩
    private void compress(ArrayList<Photo> photos) {
        if (compressConfig.isShowCompressDialog()) {
            Log.e("lyb >>> ", "开启了加载框");
            dialog = CommonUtils.showProgressDialog(this, "压缩中……");
        }
        CompressImageManager.build(this, compressConfig, photos, this).compress();
    }

内嵌上传 Maven Central

详细请看教程 JCenter已经提桶跑路,是时候学会上传到Maven Central了

Версии библиотеки

Версия
1.0.0