Skip to content

Commit

Permalink
Merge pull request #2 from igreenwood/release/0.6.0
Browse files Browse the repository at this point in the history
Release/0.6.0
  • Loading branch information
igreenwood authored Mar 16, 2020
2 parents 1c6df1a + 3a3ea6c commit 5ae64f5
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.3.50'
ext.kotlin_version = '1.3.61'
repositories {
google()
jcenter()
Expand Down
4 changes: 2 additions & 2 deletions loupe-library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ publish {
userOrg = 'isseiaoki'
groupId = 'com.igreenwood'
artifactId = 'loupe'
publishVersion = '0.5.0'
desc = 'ImageView Helper for Android that supports zooming and swipe-to-dismiss action.'
publishVersion = '0.6.0'
desc = 'ImageView Helper for Android that supports pinch-to-zoom and swipe-to-dismiss gesture.'
website = 'https://github.com/igreenwood/loupe'
}

Expand Down
19 changes: 10 additions & 9 deletions loupe-library/src/main/java/com/igreenwood/loupe/Loupe.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import android.view.MotionEvent
import android.view.ScaleGestureDetector
import android.view.View
import android.view.animation.AccelerateDecelerateInterpolator
import android.view.animation.DecelerateInterpolator
import android.view.animation.AccelerateInterpolator
import android.view.animation.Interpolator
import android.widget.ImageView
import android.widget.OverScroller
import androidx.core.view.ViewCompat
Expand All @@ -23,11 +24,11 @@ class Loupe(var imageView: ImageView) : View.OnTouchListener, View.OnLayoutChang

companion object {
const val DEFAULT_MAX_ZOOM = 5.0f
const val DEFAULT_ANIM_DURATION = 250L
const val DEFAULT_ANIM_DURATION = 200L
const val DEFAULT_VIEW_DRAG_FRICTION = 1f
const val DEFAULT_DRAG_DISMISS_DISTANCE_IN_VIEW_HEIGHT_RATIO = 0.25f
const val DEFAULT_FLING_DISMISS_ACTION_THRESHOLD_IN_DP = 96
val DEFAULT_INTERPOLATOR = DecelerateInterpolator()
val DEFAULT_INTERPOLATOR = AccelerateInterpolator()
}

interface OnViewTranslateListener {
Expand Down Expand Up @@ -62,17 +63,17 @@ class Loupe(var imageView: ImageView) : View.OnTouchListener, View.OnLayoutChang
// on view translate listener
var onViewTranslateListener: OnViewTranslateListener? = null

var dismissAnimationInterpolator = DEFAULT_INTERPOLATOR
var dismissAnimationInterpolator: Interpolator = DEFAULT_INTERPOLATOR

var restoreAnimationInterpolator = DEFAULT_INTERPOLATOR
var restoreAnimationInterpolator: Interpolator = DEFAULT_INTERPOLATOR

var flingAnimationInterpolator = DEFAULT_INTERPOLATOR
var flingAnimationInterpolator: Interpolator = DEFAULT_INTERPOLATOR

var doubleTapScaleAnimationInterpolator = DEFAULT_INTERPOLATOR
var doubleTapScaleAnimationInterpolator: Interpolator = DEFAULT_INTERPOLATOR

var overScaleAnimationInterpolator = DEFAULT_INTERPOLATOR
var overScaleAnimationInterpolator: Interpolator = DEFAULT_INTERPOLATOR

var overScrollAnimationInterpolator = DEFAULT_INTERPOLATOR
var overScrollAnimationInterpolator: Interpolator = DEFAULT_INTERPOLATOR

// bitmap matrix
private var transfrom = Matrix()
Expand Down
3 changes: 2 additions & 1 deletion loupe-sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ android {

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(':loupe-library')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.2.0'
Expand All @@ -42,5 +43,5 @@ dependencies {
implementation 'com.xwray:groupie:2.7.0'
implementation 'com.xwray:groupie-databinding:2.7.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.igreenwood:loupe:0.5.0'
// implementation 'com.igreenwood:loupe:0.6.0'
}
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ class DetailActivity : AppCompatActivity() {
image.transitionName =
context.getString(R.string.shared_image_transition, position)
val loupe = Loupe(image).apply {

useDismissAnimation = !Pref.useSharedElements
maxZoom = Pref.maxZoom
flingAnimationDuration = Pref.flingAnimationDuration
Expand Down Expand Up @@ -256,7 +255,6 @@ class DetailActivity : AppCompatActivity() {
isFirstResource: Boolean
): Boolean {
val loupe = Loupe(image).apply {

useDismissAnimation = !Pref.useSharedElements
maxZoom = Pref.maxZoom
flingAnimationDuration = Pref.flingAnimationDuration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package com.igreenwood.loupesample.util
object Pref {
var useSharedElements = true
var maxZoom = 8.0f
var flingAnimationDuration = 250L
var scaleAnimationDuration = 250L
var overScaleAnimationDuration = 250L
var overScrollAnimationDuration = 250L
var dismissAnimationDuration = 250L
var restoreAnimationDuration = 250L
var flingAnimationDuration = 200L
var scaleAnimationDuration = 200L
var overScaleAnimationDuration = 200L
var overScrollAnimationDuration = 200L
var dismissAnimationDuration = 200L
var restoreAnimationDuration = 200L
var viewDragFriction = 1f
}

0 comments on commit 5ae64f5

Please sign in to comment.