Skip to content

Commit 80528fe

Browse files
KirkBushmanPiasy
authored andcommitted
updated deps and minor fixes, pre animation works (#172)
* updated deps and minor fixes, pre animation works * minSdk to 14, fixed deps availability, deleted app and moved functions on Utils file.
1 parent bac642c commit 80528fe

File tree

22 files changed

+207
-180
lines changed

22 files changed

+207
-180
lines changed

BigImageViewer/src/main/java/com/github/piasy/biv/metadata/ImageInfoExtractor.java

+1
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ public static int getImageType(File file) {
7171

7272
inputStream.close();
7373
} catch (IOException e) {
74+
e.printStackTrace();
7475
}
7576

7677
return type;

BigImageViewer/src/main/java/com/github/piasy/biv/view/BigImageView.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public class BigImageView extends FrameLayout implements ImageLoader.Callback {
106106

107107
private OnClickListener mOnClickListener;
108108
private OnLongClickListener mOnLongClickListener;
109-
private OnClickListener mFailureImageClickListener = new OnClickListener() {
109+
private final OnClickListener mFailureImageClickListener = new OnClickListener() {
110110
@Override
111111
public void onClick(final View v) {
112112
// Retry loading when failure image is clicked

FrescoImageLoader/build.gradle

+2-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ android {
4747
}
4848

4949
dependencies {
50-
api project(':BigImageViewer')
50+
implementation project(':BigImageViewer')
5151

5252
api "com.facebook.fresco:fresco:$rootProject.ext.frescoVersion"
53+
implementation "androidx.annotation:annotation:$rootProject.ext.annotationVersion"
5354
}

FrescoImageLoader/src/main/java/com/github/piasy/biv/loader/fresco/FrescoImageLoader.java

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
package com.github.piasy.biv.loader.fresco;
2626

27+
import android.annotation.SuppressLint;
2728
import android.content.Context;
2829
import android.net.Uri;
2930
import com.facebook.binaryresource.FileBinaryResource;
@@ -77,6 +78,7 @@ public static FrescoImageLoader with(Context appContext,
7778
return new FrescoImageLoader(appContext);
7879
}
7980

81+
@SuppressLint("WrongThread")
8082
@Override
8183
public void loadImage(int requestId, Uri uri, final Callback callback) {
8284
ImageRequest request = ImageRequest.fromUri(uri);

FrescoImageViewFactory/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ android {
4747
}
4848

4949
dependencies {
50-
api project(':BigImageViewer')
50+
implementation project(':BigImageViewer')
5151

5252
api "com.facebook.fresco:fresco:$rootProject.ext.frescoVersion"
5353
api "com.facebook.fresco:animated-gif:$rootProject.ext.frescoVersion"

GlideImageLoader/build.gradle

+5-2
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,12 @@ android {
4747
}
4848

4949
dependencies {
50-
api project(':BigImageViewer')
50+
implementation project(':BigImageViewer')
5151

5252
api "com.github.bumptech.glide:glide:$rootProject.ext.glideVersion"
5353
api "com.github.bumptech.glide:okhttp3-integration:$rootProject.ext.glideVersion"
54-
api 'com.squareup.okhttp3:okhttp:3.11.0'
54+
annotationProcessor "com.github.bumptech.glide:compiler:$rootProject.ext.glideVersion"
55+
implementation "com.squareup.okhttp3:okhttp:$okhttpVersion"
56+
57+
implementation "androidx.annotation:annotation:$rootProject.ext.annotationVersion"
5558
}

GlideImageViewFactory/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ android {
4747
}
4848

4949
dependencies {
50-
api project(':BigImageViewer')
50+
implementation project(':BigImageViewer')
5151

5252
api "com.github.bumptech.glide:glide:$rootProject.ext.glideVersion"
53-
api 'pl.droidsonroids.gif:android-gif-drawable:1.2.15'
53+
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.15'
5454
}

ProgressPieIndicator/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ android {
4545
}
4646

4747
dependencies {
48-
api project(':BigImageViewer')
48+
implementation project(':BigImageViewer')
4949

50-
api('com.github.filippudak.progresspieview:library:1.0.4')
50+
api 'com.github.filippudak.progresspieview:library:1.0.4'
5151
}

app/build.gradle

+13-12
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ android {
3838
applicationId "com.github.piasy.biv.example"
3939

4040
vectorDrawables.useSupportLibrary = true
41+
multiDexEnabled true
4142
}
4243

4344
signingConfigs {
@@ -71,27 +72,27 @@ android {
7172
}
7273

7374
dependencies {
74-
api "androidx.appcompat:appcompat:$rootProject.ext.androidXVersion"
75-
api "androidx.recyclerview:recyclerview:$rootProject.ext.androidXVersion"
76-
annotationProcessor "androidx.annotation:annotation:$rootProject.ext.androidXVersion"
77-
78-
implementation('com.afollestad.material-dialogs:core:0.9.6.0')
75+
implementation "androidx.appcompat:appcompat:1.1.0"
76+
implementation "androidx.recyclerview:recyclerview:1.0.0"
77+
implementation "com.google.android.material:material:$materialVersion"
7978

8079
implementation('com.tbruyelle.rxpermissions2:rxpermissions:0.9.5') {
8180
exclude module: 'rxjava'
8281
}
83-
implementation 'io.reactivex.rxjava2:rxjava:2.2.2'
84-
implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
85-
implementation 'com.github.akarnokd:rxjava2-interop:0.13.2'
86-
implementation('com.github.piasy:RxQrCode:1.3.0')
87-
implementation 'com.squareup.leakcanary:leakcanary-android:1.6.2'
82+
implementation('com.github.akarnokd:rxjava2-interop:0.13.7') {
83+
exclude module: 'rxjava'
84+
}
85+
86+
implementation 'io.reactivex.rxjava2:rxjava:2.2.13'
87+
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
88+
implementation 'com.github.piasy:RxQrCode:1.3.0'
89+
90+
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.0-beta-3'
8891

8992
implementation project(':BigImageViewer')
9093
implementation project(':FrescoImageLoader')
9194
implementation project(':GlideImageLoader')
9295
implementation project(':FrescoImageViewFactory')
9396
implementation project(':GlideImageViewFactory')
94-
annotationProcessor "com.github.bumptech.glide:compiler:$rootProject.ext.glideVersion"
95-
9697
implementation project(':ProgressPieIndicator')
9798
}

app/src/main/AndroidManifest.xml

+1-3
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,11 @@
2424
-->
2525
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2626
xmlns:tools="http://schemas.android.com/tools"
27-
package="com.github.piasy.biv.example"
28-
>
27+
package="com.github.piasy.biv.example">
2928

3029
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
3130

3231
<application
33-
android:name=".App"
3432
android:allowBackup="true"
3533
android:icon="@mipmap/ic_launcher"
3634
android:label="@string/app_name"

app/src/main/java/com/github/piasy/biv/example/App.java

-100
This file was deleted.

app/src/main/java/com/github/piasy/biv/example/GlideLoaderActivity.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public void onClick(View v) {
5151
bigImageView.setProgressIndicator(new ProgressPieIndicator());
5252
bigImageView.showImage(
5353
Uri.parse("http://img1.imgtn.bdimg.com/it/u=1520386803,778399414&fm=21&gp=0.jpg"),
54-
Uri.parse("http://youimg1.c-ctrip.com/target/tg/773/732/734/7ca19416b8cd423f8f6ef2d08366b7dc.jpg")
54+
Uri.parse("https://youimg1.c-ctrip.com/target/tg/773/732/734/7ca19416b8cd423f8f6ef2d08366b7dc.jpg")
5555
);
5656
}
5757
});
@@ -62,9 +62,9 @@ protected void onDestroy() {
6262
super.onDestroy();
6363

6464
long start = System.nanoTime();
65-
App.fixLeakCanary696(getApplicationContext());
65+
Utils.fixLeakCanary696(getApplicationContext());
6666
long end = System.nanoTime();
67-
Log.w(App.TAG, "fixLeakCanary696: " + (end - start));
67+
Log.w(Utils.TAG, "fixLeakCanary696: " + (end - start));
6868

6969
BigImageViewer.imageLoader().cancelAll();
7070
}

app/src/main/java/com/github/piasy/biv/example/LongImageActivity.java

+39-19
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,16 @@
2525
package com.github.piasy.biv.example;
2626

2727
import android.Manifest;
28+
import android.app.Dialog;
2829
import android.net.Uri;
2930
import android.os.Bundle;
30-
import android.text.TextUtils;
3131
import android.view.View;
32+
import android.view.WindowManager;
33+
import android.widget.TextView;
3234
import android.widget.Toast;
35+
3336
import androidx.appcompat.app.AppCompatActivity;
34-
import com.afollestad.materialdialogs.MaterialDialog;
37+
3538
import com.github.piasy.biv.BigImageViewer;
3639
import com.github.piasy.biv.indicator.progresspie.ProgressPieIndicator;
3740
import com.github.piasy.biv.loader.fresco.FrescoImageLoader;
@@ -52,6 +55,8 @@ public class LongImageActivity extends AppCompatActivity {
5255
private Disposable mPermissionRequest;
5356
private Disposable mQrCodeDecode;
5457

58+
private Dialog dialog;
59+
5560
@Override
5661
protected void onCreate(Bundle savedInstanceState) {
5762
super.onCreate(savedInstanceState);
@@ -68,24 +73,36 @@ public void onClick(View v) {
6873
}
6974
});
7075

76+
dialog = new Dialog(this);
77+
dialog.setTitle(R.string.long_click_actions);
78+
dialog.setContentView(R.layout.dialog_long_image);
79+
80+
final WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
81+
lp.copyFrom(dialog.getWindow().getAttributes());
82+
lp.width = WindowManager.LayoutParams.MATCH_PARENT;
83+
dialog.getWindow().setAttributes(lp);
84+
85+
final TextView textScan = dialog.findViewById(R.id.action_scan_qr);
86+
final TextView textSave = dialog.findViewById(R.id.action_save_image);
87+
88+
textScan.setOnClickListener(new View.OnClickListener() {
89+
@Override
90+
public void onClick(View v) {
91+
decodeQrCode();
92+
}
93+
});
94+
95+
textSave.setOnClickListener(new View.OnClickListener() {
96+
@Override
97+
public void onClick(View v) {
98+
saveImage();
99+
}
100+
});
101+
71102
mBigImageView.setOnLongClickListener(new View.OnLongClickListener() {
72103
@Override
73104
public boolean onLongClick(View v) {
74-
new MaterialDialog.Builder(LongImageActivity.this)
75-
.items(R.array.big_image_ops)
76-
.itemsCallback(new MaterialDialog.ListCallback() {
77-
@Override
78-
public void onSelection(MaterialDialog dialog, View itemView,
79-
int position, CharSequence text) {
80-
if (TextUtils.equals(text, getString(R.string.save_image))) {
81-
saveImage();
82-
} else if (TextUtils.equals(text,
83-
getString(R.string.scan_qr_code))) {
84-
decodeQrCode();
85-
}
86-
}
87-
})
88-
.show();
105+
dialog.show();
89106
return true;
90107
}
91108
});
@@ -112,8 +129,7 @@ public void onFail(Throwable t) {
112129
findViewById(R.id.mBtnLoad).setOnClickListener(new View.OnClickListener() {
113130
@Override
114131
public void onClick(View v) {
115-
mBigImageView.showImage(Uri.parse(
116-
"http://ww1.sinaimg.cn/mw690/005Fj2RDgw1f9mvl4pivvj30c82ougw3.jpg"));
132+
mBigImageView.showImage(Uri.parse("https://ww1.sinaimg.cn/mw690/005Fj2RDgw1f9mvl4pivvj30c82ougw3.jpg"));
117133
}
118134
});
119135
}
@@ -125,6 +141,10 @@ protected void onDestroy() {
125141
disposePermissionRequest();
126142
disposeQrCodeDecode();
127143

144+
if (dialog.isShowing()) {
145+
dialog.dismiss();
146+
}
147+
128148
BigImageViewer.imageLoader().cancelAll();
129149
}
130150

0 commit comments

Comments
 (0)