Skip to content

Commit e962fdc

Browse files
committed
glide4.1.1图片加载+largeImageView
1 parent ada7ca5 commit e962fdc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+931
-172
lines changed

.idea/gradle.xml

+2-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

+2-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

P009_Glide图片缓存/src/main/java/com/example/p009_glide/MainActivity.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
import android.widget.ImageView;
1616
import android.widget.TextView;
1717

18-
import com.example.p009_glide.glide.GlideOptions;
19-
import com.example.p009_glide.glide.GlideOptionsFactory;
20-
import com.example.p009_glide.glide.GlideUtil;
18+
import com.example.p009_glide.glide.options.GlideOptions;
19+
import com.example.p009_glide.glide.options.GlideOptionsFactory;
20+
import com.example.p009_glide.glide.options.GlideUtil;
2121
import com.example.p009_glide.thethree.WindowService;
2222
import com.example.p009_glide.util.ColorArcProgressBar;
2323

@@ -75,7 +75,7 @@ public void onClick(View v) {
7575
//1
7676
GlideUtil.display(MainActivity.this, iv1, "http://img0.bdstatic.com/img/image/touxiang01.jpg", GlideOptionsFactory.get(GlideOptionsFactory.Type.RADIUS));
7777
//2
78-
GlideOptions glideOptions = new GlideOptions(R.drawable.pic_head, R.drawable.pic_head, 300);
78+
GlideOptions glideOptions = new GlideOptions(R.drawable.pic_head, R.drawable.pic_head, 500);
7979
GlideUtil.display(MainActivity.this, iv2, "http://img0.bdstatic.com/img/image/touxiang01.jpg", glideOptions);
8080
// Glide.with(context).load(ratings.getSku_image()).skipMemoryCache(true).diskCacheStrategy(DiskCacheStrategy.NONE).into(viewHolder.iv_imgurl);
8181
//3
@@ -89,7 +89,7 @@ public void onClick(View v) {
8989
// bar4.setDiameter_r(5);//圆形大小
9090

9191
bar4.setTitleString("新鲜度");
92-
bar4.setCurrentValues(70);//最大显示值
92+
bar4.setCurrentValues(70);//最大显示值当你遇到
9393
bar4.setUnit("%");
9494

9595
bar4.setNeedTitle(false);//title

P009_Glide图片缓存/src/main/java/com/example/p009_glide/MainActivityDemo1.java

-17
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,18 @@
11
package com.example.p009_glide;
22

33

4-
import android.app.Activity;
5-
import android.content.ComponentName;
6-
import android.content.Intent;
7-
import android.content.pm.PackageManager;
8-
import android.content.pm.ResolveInfo;
9-
import android.graphics.Color;
104
import android.os.Bundle;
115
import android.support.v7.app.AppCompatActivity;
12-
import android.util.Log;
136
import android.view.View;
14-
import android.view.animation.Animation;
15-
import android.view.animation.AnimationUtils;
167
import android.widget.Button;
178
import android.widget.ImageView;
189
import android.widget.TextView;
1910
import android.widget.Toast;
2011

21-
import com.example.p009_glide.glide.GlideOptions;
22-
import com.example.p009_glide.glide.GlideOptionsFactory;
23-
import com.example.p009_glide.glide.GlideUtil;
24-
import com.example.p009_glide.thethree.WindowService;
25-
import com.example.p009_glide.util.ColorArcProgressBar;
2612
import com.nineoldandroids.animation.Animator;
2713
import com.nineoldandroids.animation.AnimatorListenerAdapter;
2814
import com.nineoldandroids.view.ViewHelper;
2915

30-
import java.util.Collections;
31-
import java.util.List;
32-
3316
import static com.nineoldandroids.view.ViewPropertyAnimator.animate;
3417

3518

P009_Glide图片缓存/src/main/java/com/example/p009_glide/glide/GlideOptions.java renamed to P009_Glide图片缓存/src/main/java/com/example/p009_glide/glide/options/GlideOptions.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.example.p009_glide.glide;
1+
package com.example.p009_glide.glide.options;
22

33
/**
44
* Created by geek on 2016/7/28.

P009_Glide图片缓存/src/main/java/com/example/p009_glide/glide/GlideOptionsFactory.java renamed to P009_Glide图片缓存/src/main/java/com/example/p009_glide/glide/options/GlideOptionsFactory.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.example.p009_glide.glide;
1+
package com.example.p009_glide.glide.options;
22

33

44

P009_Glide图片缓存/src/main/java/com/example/p009_glide/glide/GlideUtil.java renamed to P009_Glide图片缓存/src/main/java/com/example/p009_glide/glide/options/GlideUtil.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.example.p009_glide.glide;
1+
package com.example.p009_glide.glide.options;
22

33
import android.annotation.SuppressLint;
44
import android.content.Context;
@@ -14,6 +14,7 @@
1414
import com.bumptech.glide.load.resource.bitmap.BitmapTransformation;
1515
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
1616
import com.example.p009_glide.Application;
17+
import com.example.p009_glide.glide.transformer.RoundedCornersTransformation;
1718
import com.example.p009_glide.util.MyLogUtil;
1819

1920

@@ -70,7 +71,7 @@ public static void display(final DrawableRequestBuilder<?> builder, final ImageV
7071
builder.placeholder(op.getReplaceImage()).error(op.getReplaceImage());
7172
builder.dontAnimate();//.crossFade();
7273
builder.diskCacheStrategy(DiskCacheStrategy.RESULT);
73-
BitmapTransformation bt = new CenterCrop(imageView.getContext());//new TransformerFactory(imageView.getContext());
74+
BitmapTransformation bt = new CenterCrop(imageView.getContext());
7475
if (op.getRadius() == 0) {
7576
builder.bitmapTransform(bt);
7677
} else {

P009_Glide图片缓存/src/main/java/com/example/p009_glide/glide/transformer/PublicCenterCrop.java

-27
This file was deleted.

P009_Glide图片缓存/src/main/java/com/example/p009_glide/glide/transformer/PublicFitCenter.java

-27
This file was deleted.

P009_Glide图片缓存/src/main/java/com/example/p009_glide/glide/RoundedCornersTransformation.java renamed to P009_Glide图片缓存/src/main/java/com/example/p009_glide/glide/transformer/RoundedCornersTransformation.java

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.example.p009_glide.glide;
1+
package com.example.p009_glide.glide.transformer;
22

33
/**
44
* Copyright (C) 2015 Wasabeef
@@ -46,6 +46,13 @@ public enum CornerType {
4646
private int mMargin;
4747
private CornerType mCornerType;
4848

49+
50+
@Override
51+
public String getId() {
52+
return "RoundedTransformation(radius=" + mRadius + ", margin=" + mMargin + ", diameter="
53+
+ mDiameter + ", cornerType=" + mCornerType.name() + ")";
54+
}
55+
4956
public RoundedCornersTransformation(Context context, int radius, int margin) {
5057
this(context, radius, margin, CornerType.ALL);
5158
}
@@ -261,9 +268,4 @@ private void drawDiagonalFromTopRightRoundRect(Canvas canvas, Paint paint, float
261268
canvas.drawRect(new RectF(mMargin + mRadius, mMargin + mRadius, right, bottom), paint);
262269
}
263270

264-
@Override
265-
public String getId() {
266-
return "RoundedTransformation(radius=" + mRadius + ", margin=" + mMargin + ", diameter="
267-
+ mDiameter + ", cornerType=" + mCornerType.name() + ")";
268-
}
269271
}

P009_Glide图片缓存/src/main/java/com/example/p009_glide/glide/transformer/TransformerFactory.java

-51
This file was deleted.

P009_Glide图片缓存/src/main/res/layout/activity_main.xml

+26-25
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
33
xmlns:app="http://schemas.android.com/apk/res-auto"
4-
xmlns:tools="http://schemas.android.com/tools"
54
android:layout_width="match_parent"
65
android:layout_height="match_parent"
7-
android:background="@color/gray"
8-
android:paddingBottom="@dimen/activity_vertical_margin"
9-
android:paddingLeft="@dimen/activity_horizontal_margin"
10-
android:paddingRight="@dimen/activity_horizontal_margin"
11-
android:paddingTop="@dimen/activity_vertical_margin"
12-
tools:context="com.example.p009_glide.MainActivity">
6+
android:background="@color/gray">
137

148
<LinearLayout
159
android:layout_width="match_parent"
@@ -54,26 +48,33 @@
5448
android:src="@drawable/pic_head" />
5549
</FrameLayout>
5650

57-
<ImageView
58-
android:id="@+id/iv1"
59-
android:layout_width="100dp"
60-
android:layout_height="100dp"
61-
android:padding="10dp"
62-
android:src="@mipmap/ic_launcher" />
51+
<LinearLayout
52+
android:layout_width="match_parent"
53+
android:layout_height="wrap_content"
54+
android:orientation="horizontal"
55+
android:padding="5dp">
6356

64-
<ImageView
65-
android:id="@+id/iv2"
66-
android:layout_width="100dp"
67-
android:layout_height="100dp"
68-
android:padding="10dp"
69-
android:src="@mipmap/ic_launcher" />
57+
<ImageView
58+
android:id="@+id/iv1"
59+
android:layout_width="80dp"
60+
android:layout_height="80dp"
61+
android:layout_margin="5dp"
62+
android:layout_weight="1" />
7063

71-
<ImageView
72-
android:id="@+id/iv3"
73-
android:layout_width="100dp"
74-
android:layout_height="100dp"
75-
android:padding="10dp"
76-
android:src="@mipmap/ic_launcher" />
64+
<ImageView
65+
android:id="@+id/iv2"
66+
android:layout_width="80dp"
67+
android:layout_height="80dp"
68+
android:layout_margin="5dp"
69+
android:layout_weight="1" />
70+
71+
<ImageView
72+
android:id="@+id/iv3"
73+
android:layout_width="80dp"
74+
android:layout_height="80dp"
75+
android:layout_margin="5dp"
76+
android:layout_weight="1" />
77+
</LinearLayout>
7778

7879

7980
</LinearLayout>

p009_glide图片缓存411/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build
+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
apply plugin: 'com.android.application'
2+
3+
android {
4+
compileSdkVersion 26
5+
buildToolsVersion "26.0.1"
6+
7+
defaultConfig {
8+
applicationId "com.example.shining.p009_glide411"
9+
minSdkVersion 21
10+
targetSdkVersion 26
11+
versionCode 1
12+
versionName "1.0"
13+
14+
}
15+
buildTypes {
16+
release {
17+
minifyEnabled false
18+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
19+
}
20+
}
21+
}
22+
23+
dependencies {
24+
compile fileTree(dir: 'libs', include: ['*.jar'])
25+
26+
compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
27+
compile 'com.android.support.constraint:constraint-layout:1.0.2'
28+
testCompile 'junit:junit:4.12'
29+
30+
compile 'com.github.bumptech.glide:glide:4.1.1'
31+
compile 'com.github.bumptech.glide:compiler:4.1.1'
32+
compile "com.github.bumptech.glide:okhttp3-integration:4.1.1"
33+
compile 'com.nineoldandroids:library:2.4.0'
34+
}

0 commit comments

Comments
 (0)