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

Replace PhotoView with SubsamplingScaleImageView for better performance. #241

Open
wants to merge 7 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
20 changes: 11 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,25 @@ buildscript {
repositories {
jcenter()
mavenCentral()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
classpath 'me.tatarka:gradle-retrolambda:3.2.5'
classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.5.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7'
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'me.tatarka:gradle-retrolambda:3.7.0'
classpath 'com.novoda:bintray-release:0.8.0'
}


// Exclude the version that the android plugin depends on.
configurations.classpath.exclude group: 'com.android.tools.external.lombok'
}

allprojects {
repositories {
jcenter()
mavenCentral()
google()
maven { url "https://jitpack.io" }
}
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
options.addStringOption('encoding', 'UTF-8')
}
}

Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#AT
#Mon May 21 14:29:30 CST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
126 changes: 23 additions & 103 deletions library/build.gradle
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
apply plugin: 'com.android.library'
apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: "com.jfrog.bintray"

version = "1.1.3"

apply plugin: 'com.novoda.bintray-release'
publish {
userOrg = 'donald'
groupId = 'acom.github.DonaldDu'
artifactId = 'RxGalleryFinal'
publishVersion = '1.1.3.4'
artifacts
}
android {
compileSdkVersion 25
buildToolsVersion '25.0.3'

// compileSdkVersion 24
// buildToolsVersion '24'

compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
minSdkVersion 14
targetSdkVersion 25
// targetSdkVersion 24
targetSdkVersion 27
versionCode 3
versionName version

Expand All @@ -33,96 +31,18 @@ android {
resourcePrefix "gallery_"
}



dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
compile 'io.reactivex.rxjava2:rxjava:2.1.0'
compile 'com.yalantis:ucrop:2.2.0'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:appcompat-v7:25.3.1'
compile "com.android.support:exifinterface:25.3.1"
/* compile 'com.android.support:recyclerview-v7:24.2.0'
compile 'com.android.support:appcompat-v7:24.2.0'
compile "com.android.support:exifinterface:25.1.0"*/
provided 'com.squareup.picasso:picasso:2.5.2'
provided 'com.facebook.fresco:fresco:1.3.0'
provided 'com.facebook.fresco:animated-gif:1.3.0'
provided 'com.github.bumptech.glide:glide:3.7.0'
provided 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
}

//===================================upload jcenter=================================================
def siteUrl = 'https://github.com/FinalTeam/RxGalleryFinal'
def gitUrl = 'https://github.com/FinalTeam/RxGalleryFinal.git'
group = "cn.finalteam.rxgalleryfinal"

install {
repositories.mavenInstaller {
pom {
project {
packaging 'aar'

// Add your description here
name 'RxGalleryFinal'
description = 'dujinyang desc'
url siteUrl

// Set your license
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id 'dujinyang'
name 'dujinyang'
email '309933706@qq.com'
}
}
scm {
connection gitUrl
developerConnection gitUrl
url siteUrl

}
}
}
}
}

task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}

artifacts {
archives sourcesJar
}

Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())

bintray {
user = properties.getProperty("bintray.user")
key = properties.getProperty("bintray.apikey")

configurations = ['archives']
pkg {
repo = "maven"
name = "RxGalleryFinal"
websiteUrl = siteUrl
vcsUrl = gitUrl
licenses = ["Apache-2.0"]
publish = true
version {
gpg {
passphrase = properties.getProperty("bintray.gpg.password")
}
}
}
}
implementation 'com.davemorrissey.labs:subsampling-scale-image-view:3.9.0'
api 'io.reactivex.rxjava2:rxandroid:2.0.2'
api 'com.github.yalantis:ucrop:2.2.2'
compileOnly 'com.android.support:appcompat-v7:27.1.1'
compileOnly 'com.android.support:recyclerview-v7:27.1.1'
compileOnly 'com.android.support:exifinterface:27.1.1'
compileOnly 'com.squareup.picasso:picasso:2.5.2'
compileOnly 'com.facebook.fresco:fresco:1.9.0'
compileOnly 'com.facebook.fresco:animated-gif:1.9.0'
compileOnly 'com.github.bumptech.glide:glide:3.7.0'
compileOnly 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public Configuration[] newArray(int size) {
//等比缩放值表,默认1:1,3:4,原图比例,3:2,16:9
private AspectRatio[] aspectRatio;
//是否允许改变裁剪大小
private boolean freestyleCropEnabled = OverlayView.DEFAULT_FREESTYLE_CROP_ENABLED;
private boolean freestyleCropEnabled = false;
//是否显示裁剪框半透明椭圆浮层
private boolean ovalDimmedLayer = OverlayView.DEFAULT_CIRCLE_DIMMED_LAYER;//DEFAULT_OVAL_DIMMED_LAYER
private int maxResultWidth;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
package cn.finalteam.rxgalleryfinal.ui.adapter;

import android.graphics.drawable.Drawable;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;

import com.davemorrissey.labs.subscaleview.ImageSource;
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView;

import java.util.List;

import cn.finalteam.rxgalleryfinal.Configuration;
import cn.finalteam.rxgalleryfinal.R;
import cn.finalteam.rxgalleryfinal.bean.MediaBean;
import uk.co.senab.photoview.PhotoView;

/**
* Desction:
Expand Down Expand Up @@ -46,17 +47,9 @@ public View getView(int position, View convertView, ViewGroup container) {
if (convertView == null) {
convertView = View.inflate(container.getContext(), R.layout.gallery_media_image_preview_item, null);
}
PhotoView ivImage = (PhotoView) convertView.findViewById(R.id.iv_media_image);
String path = null;
if (mediaBean.getWidth() > 1200 || mediaBean.getHeight() > 1200) {
path = mediaBean.getThumbnailBigPath();
}
if (TextUtils.isEmpty(path)) {
path = mediaBean.getOriginalPath();
}
SubsamplingScaleImageView ivImage = (SubsamplingScaleImageView) convertView;
ivImage.setBackgroundColor(mPageColor);
mConfiguration.getImageLoader().displayImage(container.getContext(), path, ivImage, mDefaultImage, mConfiguration.getImageConfig(),
false, mConfiguration.isPlayGif(), mScreenWidth, mScreenHeight, mediaBean.getOrientation());
ivImage.setImage(ImageSource.uri(mediaBean.getOriginalPath()));
return convertView;
}

Expand Down
56 changes: 0 additions & 56 deletions library/src/main/java/uk/co/senab/photoview/Compat.java

This file was deleted.

This file was deleted.

Loading