Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/glide #12

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/local.properties
/.idea/workspace.xml
/.idea/libraries
.idea
.DS_Store
/build
/captures
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@

## I. 结果

![][demo_1_jpg]
![][demo_2_jpg]
||||
|:---:|:---:|:---:|
|![][demo_1_jpg]|![][demo_2_jpg]|![][demo_3_png]|

#### 1. 基本库(`library`):

Expand Down Expand Up @@ -63,6 +64,17 @@ PicassoLoader.display7Niu(imageview2, MOCK_DATA_URL)

```

#### 3. 基于[Glide](https://github.com/bumptech/glide)的封装工具库(`utils-glide`)

[![Download][qiniu_img_picasso_svg]][qiniu_img_picasso_url]

```java
GlideLoader.createLoader(image8, MOCK_DATA_URL)
.size(dp2px(250))
.addOpBlur(40, 20)
.attach();
```

## II. 使用

```
Expand All @@ -71,6 +83,8 @@ dependencies {
implementation 'com.liulishuo.qiniuimageloader:library:1.0.4'
// 可不引: 基于基本库与picasso做上层封装,可作为案例,也可直接使用
implementation 'com.liulishuo.qiniuimageloader:utils-picasso:1.0.4'
// 可不引: 基于 glide 封装
implementation 'com.liulishuo.qiniuimageloader:utils-glide:1.0.4'
}
```

Expand Down Expand Up @@ -172,6 +186,7 @@ dependencies {

> `utils-picasso`依赖与`library`,`libarry`拥有的所有参数,`utils-picasso`都有,下面是`utils-picasso`做上层封装的时候增加的

> `utils-glide` 与此类似

##### 特有全局配置
```
Expand Down Expand Up @@ -230,5 +245,6 @@ limitations under the License.
[qiniu_img_picasso_url]: https://bintray.com/jacksgong/maven/QiniuImageLoader-picassoUtils/_latestVersion
[demo_1_jpg]: https://github.com/lingochamp/QiniuImageLoader/raw/master/art/demo_1.jpg
[demo_2_jpg]: https://github.com/lingochamp/QiniuImageLoader/raw/master/art/demo_2.jpg
[demo_3_png]: ./art/demo_3.png
[build_status_svg]: https://travis-ci.org/lingochamp/QiniuImageLoader.svg?branch=master
[build_status_link]: https://travis-ci.org/lingochamp/QiniuImageLoader
Binary file added art/demo_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.3.31'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

}
}
Expand Down
1 change: 1 addition & 0 deletions demo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation project(':utils-picasso')
implementation project(':utils-glide')
implementation project(':library')
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@
import android.view.MenuItem;
import android.widget.ImageView;

import com.liulishuo.qiniuimageloader.glide.GlideLoader;
import com.liulishuo.qiniuimageloader.utils.PicassoLoader;

/**
* Created by Jacksgong on 12/13/15.
*/
public class MainActivity extends AppCompatActivity {
private static String MOCK_DATA_URL = "http://7xjww9.com1.z0.glb.clouddn.com/20130221114001385.jpg";
private static String MOCK_DATA_URL = "http://image.youcute.cn/17-7-7/50670860.jpg";

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand Down Expand Up @@ -44,7 +45,27 @@ protected void onCreate(Bundle savedInstanceState) {
.halfScreenW()
.attach();

GlideLoader.createLoader(image6, MOCK_DATA_URL)
.attach();

GlideLoader.createLoader(image7, MOCK_DATA_URL)
.centerCrop()
.wR(R.dimen.image_2_width)
.attach();

GlideLoader.createLoader(image8, MOCK_DATA_URL)
.size(dp2px(250))
.addOpBlur(40, 20)
.attach();

GlideLoader.createLoader(image9, MOCK_DATA_URL)
.w(dp2px(270))
.addOpRotate(30)
.attach();

GlideLoader.createLoader(image10, MOCK_DATA_URL)
.halfScreenW()
.attach();
}

public int dp2px(float dpValue) {
Expand All @@ -59,12 +80,23 @@ public int dp2px(float dpValue) {
private ImageView image4;
private ImageView image5;

private ImageView image6;
private ImageView image7;
private ImageView image8;
private ImageView image9;
private ImageView image10;

private void assignViews() {
image1 = (ImageView) findViewById(R.id.image_1);
image2 = (ImageView) findViewById(R.id.image_2);
image3 = (ImageView) findViewById(R.id.image_3);
image4 = (ImageView) findViewById(R.id.image_4);
image5 = (ImageView) findViewById(R.id.image_5);
image1 = findViewById(R.id.image_1);
image2 = findViewById(R.id.image_2);
image3 = findViewById(R.id.image_3);
image4 = findViewById(R.id.image_4);
image5 = findViewById(R.id.image_5);
image6 = findViewById(R.id.image_6);
image7 = findViewById(R.id.image_7);
image8 = findViewById(R.id.image_8);
image9 = findViewById(R.id.image_9);
image10 = findViewById(R.id.image_10);
}

@Override
Expand Down
146 changes: 106 additions & 40 deletions demo/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -1,49 +1,115 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<LinearLayout
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:gravity="center_horizontal"
android:orientation="vertical"
android:padding="5dp">

<ImageView
android:id="@+id/image_1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="false" />

<ImageView
android:id="@+id/image_2"
android:layout_width="@dimen/image_2_width"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:adjustViewBounds="false" />

<ImageView
android:id="@+id/image_3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:adjustViewBounds="false" />

<ImageView
android:id="@+id/image_4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:adjustViewBounds="false" />

<ImageView
android:id="@+id/image_5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:adjustViewBounds="false" />
</LinearLayout>
android:stretchColumns="*">

<TableRow>

<TextView
android:layout_width="0dp"
android:gravity="center"
android:text="Picasso" />

<TextView
android:layout_width="0dp"
android:gravity="center"
android:text="Glide" />

</TableRow>

<TableRow android:layout_marginTop="10dp">

<ImageView
android:id="@+id/image_1"
android:layout_width="0dp"
android:layout_height="100dp"
android:adjustViewBounds="false"
tools:src="@mipmap/ic_launcher" />

<ImageView
android:id="@+id/image_6"
android:layout_width="0dp"
android:layout_height="100dp"
android:adjustViewBounds="false"
tools:src="@mipmap/ic_launcher" />
</TableRow>

<TableRow android:layout_marginTop="10dp">

<ImageView
android:id="@+id/image_2"
android:layout_width="0dp"
android:layout_height="100dp"
android:adjustViewBounds="false"
tools:src="@mipmap/ic_launcher" />

<ImageView
android:id="@+id/image_7"
android:layout_width="0dp"
android:layout_height="100dp"
android:adjustViewBounds="false"
tools:src="@mipmap/ic_launcher" />
</TableRow>

<TableRow android:layout_marginTop="10dp">

<ImageView
android:id="@+id/image_3"
android:layout_width="0dp"
android:layout_height="100dp"
android:adjustViewBounds="false"
tools:src="@mipmap/ic_launcher" />

<ImageView
android:id="@+id/image_8"
android:layout_width="0dp"
android:layout_height="100dp"
android:adjustViewBounds="false"
tools:src="@mipmap/ic_launcher" />

</TableRow>

<TableRow android:layout_marginTop="10dp">

<ImageView
android:id="@+id/image_4"
android:layout_width="0dp"
android:layout_height="100dp"
android:adjustViewBounds="false"
tools:src="@mipmap/ic_launcher" />

<ImageView
android:id="@+id/image_9"
android:layout_width="0dp"
android:layout_height="100dp"
android:adjustViewBounds="false"
tools:src="@mipmap/ic_launcher" />
</TableRow>


<TableRow android:layout_marginTop="10dp">

<ImageView
android:id="@+id/image_5"
android:layout_width="0dp"
android:layout_height="100dp"
android:adjustViewBounds="false"
tools:src="@mipmap/ic_launcher" />

<ImageView
android:id="@+id/image_10"
android:layout_width="0dp"
android:layout_height="100dp"
android:adjustViewBounds="false"
tools:src="@mipmap/ic_launcher" />

</TableRow>
</TableLayout>
</ScrollView>
4 changes: 4 additions & 0 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

dependencies{
implementation "com.android.support:support-annotations:28.0.0"
}
}

apply from: rootProject.file('gradle/mvn-push.gradle')
Loading