Skip to content

Commit

Permalink
Merge pull request #27 from ntoskrnl/feature/refactoring
Browse files Browse the repository at this point in the history
Rectangular and custom shapes support and some refactoring
  • Loading branch information
Dean Wild committed Oct 9, 2015
2 parents 29a51dc + 62c7e8a commit 15a62f0
Show file tree
Hide file tree
Showing 24 changed files with 503 additions and 124 deletions.
5 changes: 5 additions & 0 deletions build.gradle
Expand Up @@ -3,9 +3,14 @@
buildscript {
repositories {
jcenter()
maven {
url 'https://repos.zeroturnaround.com/nexus/content/repositories/zt-public-releases'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:1.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.+'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
6 changes: 3 additions & 3 deletions library/build.gradle
@@ -1,12 +1,12 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
compileSdkVersion 23
buildToolsVersion "23"

defaultConfig {
minSdkVersion 14
targetSdkVersion 22
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
Expand Down
Expand Up @@ -7,9 +7,7 @@
import android.view.View;
import android.view.animation.AccelerateDecelerateInterpolator;

/**
* Created by deanwild on 05/08/15.
*/

public class AnimationFactory implements IAnimationFactory{

private static final String ALPHA = "alpha";
Expand Down
Expand Up @@ -3,9 +3,7 @@
import android.graphics.Point;
import android.view.View;

/**
* Created by deanwild on 05/08/15.
*/

public interface IAnimationFactory {

void fadeInView(View target, long duration, AnimationStartListener listener);
Expand Down
@@ -1,9 +1,6 @@
package uk.co.deanwild.materialshowcaseview;

/**
* Created by deanwild on 24/08/15.
*/
interface IDetachedListener {
void onShowcaseDetached(MaterialShowcaseView showcaseView, boolean wasDismissed);

public interface IDetachedListener {
void onShowcaseDetached(MaterialShowcaseView showcaseView, boolean wasDismissed);
}
@@ -1,10 +1,7 @@
package uk.co.deanwild.materialshowcaseview;

/**
* Created by deanwild on 11/08/15.
*/

public interface IShowcaseListener {
void onShowcaseDisplayed(MaterialShowcaseView showcaseView);
void onShowcaseDismissed(MaterialShowcaseView showcaseView);

}
Expand Up @@ -6,9 +6,7 @@
import java.util.LinkedList;
import java.util.Queue;

/**
* Created by deanwild on 11/08/15.
*/

public class MaterialShowcaseSequence implements IDetachedListener {

PrefsManager mPrefsManager;
Expand All @@ -18,6 +16,9 @@ public class MaterialShowcaseSequence implements IDetachedListener {
private ShowcaseConfig mConfig;
private int mSequencePosition = 0;

private OnSequenceItemShownListener mOnItemShownListener = null;
private OnSequenceItemDismissedListener mOnItemDismissedListener = null;

public MaterialShowcaseSequence(Activity activity) {
mActivity = activity;
mShowcaseQueue = new LinkedList<>();
Expand Down Expand Up @@ -55,6 +56,14 @@ public MaterialShowcaseSequence singleUse(String sequenceID) {
return this;
}

public void setOnItemShownListener(OnSequenceItemShownListener listener) {
this.mOnItemShownListener = listener;
}

public void setOnItemDismissedListener(OnSequenceItemDismissedListener listener) {
this.mOnItemDismissedListener = listener;
}

public boolean hasFired() {

if (mPrefsManager.getSequenceStatus() == PrefsManager.SEQUENCE_FINISHED) {
Expand Down Expand Up @@ -99,6 +108,9 @@ private void showNextItem() {
MaterialShowcaseView sequenceItem = mShowcaseQueue.remove();
sequenceItem.setDetachedListener(this);
sequenceItem.show(mActivity);
if (mOnItemShownListener != null) {
mOnItemShownListener.onShow(sequenceItem, mSequencePosition);
}
} else {
/**
* We've reached the end of the sequence, save the fired state
Expand All @@ -120,6 +132,10 @@ public void onShowcaseDetached(MaterialShowcaseView showcaseView, boolean wasDis
*/
if (wasDismissed) {

if (mOnItemDismissedListener != null) {
mOnItemDismissedListener.onDismiss(showcaseView, mSequencePosition);
}

/**
* If so, update the prefsManager so we can potentially resume this sequence in the future
*/
Expand All @@ -136,8 +152,12 @@ public void setConfig(ShowcaseConfig config) {
this.mConfig = config;
}

public interface OnSequenceItemShownListener {
void onShow(MaterialShowcaseView itemView, int position);
}



public interface OnSequenceItemDismissedListener {
void onDismiss(MaterialShowcaseView itemView, int position);
}

}

0 comments on commit 15a62f0

Please sign in to comment.