1.For using Luban module in sample application,include the below library dependency to generate hap/library.har.
Modify entry build.gradle as below :
dependencies {
implementation project(path: ':library')
}
2.For using Luban in separate application, make sure to add "library.har" in libs folder of "entry" module.
Modify entry build.gradle as below :
dependencies {
implementation fileTree(dir: 'libs', include: ['*.har'])
}
3.For using Luban from remote repository in separate application, add the below dependency in "entry" build.gradle.
Modify entry build.gradle as below :
dependencies {
implementation 'io.openharmony.tpc.thirdlib:luban:1.0.0'
}
1.Luban internally uses the IO thread to perform image compression, implementations only need to specify what happens when the process finishes successfully.
Luban.with(this)
.setTargetDir(/*PATH*/) // pass target data directory path
.ignoreBy(/*SIZE*/) // pass least compress size
.load(/*FILE*/) // pass image to be compressed
.setCompressListener(new OnCompressListener() { // Set up return
@Override
public void onStart() {
// TODO Called when compression starts, display loading UI here
}
@Override
public void onSuccess(File file) {
// TODO Called when compression finishes successfully, provides compressed image
}
@Override
public void onError(Throwable throwable) {
// TODO Called if an error has been encountered while compressing
}
}).launch(); // Start compression
CodeCheck pass
CloudTest pass
Virus security detection pass
The demo function of the current version is basically the same as that of the original component
Copyright 2016 Zheng Zibin
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Вы можете оставить комментарий после Вход в систему
Неприемлемый контент может быть отображен здесь и не будет показан на странице. Вы можете проверить и изменить его с помощью соответствующей функции редактирования.
Если вы подтверждаете, что содержание не содержит непристойной лексики/перенаправления на рекламу/насилия/вульгарной порнографии/нарушений/пиратства/ложного/незначительного или незаконного контента, связанного с национальными законами и предписаниями, вы можете нажать «Отправить» для подачи апелляции, и мы обработаем ее как можно скорее.
Опубликовать ( 0 )