diff --git a/build.gradle b/build.gradle index 4e9ab4e4..66d8b5d3 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ buildscript { } } dependencies { - classpath 'com.android.tools.build:gradle:1.5.0' + classpath 'com.android.tools.build:gradle:2.2.3' // This does not break the build when Android Studio is missing the JRebel for Android plugin. classpath 'com.zeroturnaround.jrebel.android:jr-android-gradle:0.8.+' diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 0c71e760..90288404 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Wed Apr 10 15:27:10 PDT 2013 +#Wed Feb 22 18:36:29 KST 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip diff --git a/library/src/main/java/uk/co/deanwild/materialshowcaseview/MaterialShowcaseView.java b/library/src/main/java/uk/co/deanwild/materialshowcaseview/MaterialShowcaseView.java index 07bc982d..05809d65 100644 --- a/library/src/main/java/uk/co/deanwild/materialshowcaseview/MaterialShowcaseView.java +++ b/library/src/main/java/uk/co/deanwild/materialshowcaseview/MaterialShowcaseView.java @@ -146,8 +146,8 @@ protected void onDraw(Canvas canvas) { final int width = getMeasuredWidth(); final int height = getMeasuredHeight(); - // don't bother drawing if there is nothing to draw on - if(width <= 0 || height <= 0) return; + // don't bother drawing if there is nothing to draw on + if (width <= 0 || height <= 0) return; // build a new canvas if needed i.e first pass or new dimensions if (mBitmap == null || mCanvas == null || mOldHeight != height || mOldWidth != width) { @@ -207,8 +207,8 @@ public boolean onTouch(View v, MotionEvent event) { if (mDismissOnTouch) { hide(); } - if(mTargetTouchable && mTarget.getBounds().contains((int)event.getX(), (int)event.getY())){ - if(mDismissOnTargetTouch){ + if (mTargetTouchable && mTarget.getBounds().contains((int) event.getX(), (int) event.getY())) { + if (mDismissOnTargetTouch) { hide(); } return false; @@ -219,11 +219,11 @@ public boolean onTouch(View v, MotionEvent event) { private void notifyOnDisplayed() { - if(mListeners != null){ - for (IShowcaseListener listener : mListeners) { - listener.onShowcaseDisplayed(this); - } - } + if (mListeners != null) { + for (IShowcaseListener listener : mListeners) { + listener.onShowcaseDisplayed(this); + } + } } private void notifyOnDismissed() { @@ -337,8 +337,7 @@ private void applyLayoutParams() { /** * Only apply the layout params if we've actually changed them, otherwise we'll get stuck in a layout loop */ - if (layoutParamsChanged) - mContentBox.setLayoutParams(contentLP); + if (layoutParamsChanged) mContentBox.setLayoutParams(contentLP); } } @@ -418,25 +417,24 @@ private void setFadeDuration(long fadeDurationInMillis) { mFadeDurationInMillis = fadeDurationInMillis; } - private void setTargetTouchable(boolean targetTouchable){ + private void setTargetTouchable(boolean targetTouchable) { mTargetTouchable = targetTouchable; } - private void setDismissOnTargetTouch(boolean dismissOnTargetTouch){ + private void setDismissOnTargetTouch(boolean dismissOnTargetTouch) { mDismissOnTargetTouch = dismissOnTargetTouch; } public void addShowcaseListener(IShowcaseListener showcaseListener) { - if(mListeners != null) - mListeners.add(showcaseListener); + if (mListeners != null) mListeners.add(showcaseListener); } public void removeShowcaseListener(MaterialShowcaseSequence showcaseListener) { - if ((mListeners != null) && mListeners.contains(showcaseListener)) { - mListeners.remove(showcaseListener); - } + if ((mListeners != null) && mListeners.contains(showcaseListener)) { + mListeners.remove(showcaseListener); + } } void setDetachedListener(IDetachedListener detachedListener) { @@ -564,20 +562,20 @@ public Builder setTitleText(CharSequence text) { /** * Set whether or not the target view can be touched while the showcase is visible. - * + *
* False by default. */ - public Builder setTargetTouchable(boolean targetTouchable){ + public Builder setTargetTouchable(boolean targetTouchable) { showcaseView.setTargetTouchable(targetTouchable); return this; } /** * Set whether or not the showcase should dismiss when the target is touched. - * + *
* True by default. */ - public Builder setDismissOnTargetTouch(boolean dismissOnTargetTouch){ + public Builder setDismissOnTargetTouch(boolean dismissOnTargetTouch) { showcaseView.setDismissOnTargetTouch(dismissOnTargetTouch); return this; } @@ -716,8 +714,7 @@ public void removeFromWindow() { getViewTreeObserver().removeGlobalOnLayoutListener(mLayoutListener); mLayoutListener = null; - if (mPrefsManager != null) - mPrefsManager.close(); + if (mPrefsManager != null) mPrefsManager.close(); mPrefsManager = null; @@ -783,28 +780,35 @@ public void hide() { } public void fadeIn() { - setVisibility(INVISIBLE); + if (mAnimationFactory == null) { + setVisibility(View.VISIBLE); + notifyOnDisplayed(); + } else { + setVisibility(INVISIBLE); - mAnimationFactory.fadeInView(this, mFadeDurationInMillis, - new IAnimationFactory.AnimationStartListener() { - @Override - public void onAnimationStart() { - setVisibility(View.VISIBLE); - notifyOnDisplayed(); - } + mAnimationFactory.fadeInView(this, mFadeDurationInMillis, new IAnimationFactory.AnimationStartListener() { + @Override + public void onAnimationStart() { + setVisibility(View.VISIBLE); + notifyOnDisplayed(); } - ); + }); + } } public void fadeOut() { - - mAnimationFactory.fadeOutView(this, mFadeDurationInMillis, new IAnimationFactory.AnimationEndListener() { - @Override - public void onAnimationEnd() { - setVisibility(INVISIBLE); - removeFromWindow(); - } - }); + if (mAnimationFactory == null) { + setVisibility(INVISIBLE); + removeFromWindow(); + } else { + mAnimationFactory.fadeOutView(this, mFadeDurationInMillis, new IAnimationFactory.AnimationEndListener() { + @Override + public void onAnimationEnd() { + setVisibility(INVISIBLE); + removeFromWindow(); + } + }); + } } public void resetSingleUse() { @@ -838,10 +842,8 @@ public static int getSoftButtonsBarSizePort(Activity activity) { int usableHeight = metrics.heightPixels; activity.getWindowManager().getDefaultDisplay().getRealMetrics(metrics); int realHeight = metrics.heightPixels; - if (realHeight > usableHeight) - return realHeight - usableHeight; - else - return 0; + if (realHeight > usableHeight) return realHeight - usableHeight; + else return 0; } return 0; } diff --git a/sample/build.gradle b/sample/build.gradle index e2cdb510..68f4ea85 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -1,6 +1,4 @@ apply plugin: 'com.android.application' -// This does not break the build when Android Studio is missing the JRebel for Android plugin. -apply plugin: 'com.zeroturnaround.jrebel.android' android { compileSdkVersion 23 @@ -19,6 +17,17 @@ android { proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } + + + applicationVariants.all { variant -> + variant.outputs.each { output -> + def outputFile = output.outputFile + if (outputFile != null && outputFile.name.endsWith('.apk')) { + def fileName = outputFile.name.replace('.apk', "-${versionName}.apk") + output.outputFile = new File(outputFile.parent, fileName) + } + } + } } dependencies {