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

Added animation for Technique.HorizontalRight #91

Open
wants to merge 3 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
13 changes: 7 additions & 6 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ Properties getGradleProperties(){
}

android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
compileSdkVersion 23
buildToolsVersion "23.0.1"
def gradleProps = getGradleProperties()
defaultConfig {
applicationId "tourguide.tourguide"
Expand All @@ -49,9 +49,8 @@ android {

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
/* For navigation view (drawer) */
compile 'com.android.support:design:22.2.0'
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.android.support:design:24.0.0'
compile project(':tourguide')
// compile ('com.github.worker8:tourguide:1.0.16-SNAPSHOT@aar'){
// transitive=true
Expand All @@ -62,7 +61,9 @@ dependencies {
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3.1'

// Set this dependency to build and run Espresso tests
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2'
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2') {
exclude group: 'com.android.support', module: 'support-annotations'
}
}

task print_git_tag_command << {
Expand Down
8 changes: 4 additions & 4 deletions tourguide/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ Properties getGradleProperties(){
}

android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
compileSdkVersion 23
buildToolsVersion "23.0.1"
def gradleProps = getGradleProperties()
defaultConfig {
minSdkVersion 11
Expand All @@ -37,8 +37,8 @@ android {

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'net.i2p.android.ext:floatingactionbutton:1.9.0'
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.android.support:design:24.0.0'
}

apply from: 'https://raw.github.com/chrisbanes/gradle-mvn-push/master/gradle-mvn-push.gradle'
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import android.graphics.Point;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.text.TextPaint;
import android.util.AttributeSet;
import android.util.Log;
Expand Down Expand Up @@ -257,7 +258,7 @@ protected void onDraw(Canvas canvas) {

if (mOverlay!=null) {
mEraserCanvas.drawColor(mOverlay.mBackgroundColor);
int padding = (int) (10 * mDensity);
int padding = (int) (mOverlay.mHolePadding * mDensity);

if (mOverlay.mStyle == Overlay.Style.Rectangle) {
mEraserCanvas.drawRect(
Expand Down
50 changes: 35 additions & 15 deletions tourguide/src/main/java/tourguide/tourguide/Overlay.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* {@link Overlay} shows a tinted background to cover up the rest of the screen. A 'hole' will be made on this overlay to let users obtain focus on the targeted element.
*/
public class Overlay {
public final static int NOT_SET = -1;
public int mBackgroundColor;
public boolean mDisableClick;
public boolean mDisableClickThroughHole;
Expand All @@ -17,11 +18,8 @@ public class Overlay {
public int mHoleOffsetTop = 0;
public View.OnClickListener mOnClickListener;
public int mHoleRadius = NOT_SET;
public final static int NOT_SET = -1;

public enum Style {
Circle, Rectangle, NoHole
}
public int mHolePadding = 20;
// public int

public Overlay() {
this(true, Color.parseColor("#55000000"), Style.Circle);
Expand All @@ -35,66 +33,73 @@ public Overlay(boolean disableClick, int backgroundColor, Style style) {

/**
* Set background color
*
* @param backgroundColor
* @return return {@link Overlay} instance for chaining purpose
*/
public Overlay setBackgroundColor(int backgroundColor){
public Overlay setBackgroundColor(int backgroundColor) {
mBackgroundColor = backgroundColor;
return this;
}

/**
* Set to true if you want to block all user input to pass through this overlay, set to false if you want to allow user input under the overlay
*
* @param yesNo
* @return return {@link Overlay} instance for chaining purpose
*/
public Overlay disableClick(boolean yesNo){
public Overlay disableClick(boolean yesNo) {
mDisableClick = yesNo;
return this;
}

/**
* Set to true if you want to disallow the highlighted view to be clicked through the hole,
* set to false if you want to allow the highlighted view to be clicked through the hole
*
* @param yesNo
* @return return Overlay instance for chaining purpose
*/
public Overlay disableClickThroughHole(boolean yesNo){
public Overlay disableClickThroughHole(boolean yesNo) {
mDisableClickThroughHole = yesNo;
return this;
}

public Overlay setStyle(Style style){
public Overlay setStyle(Style style) {
mStyle = style;
return this;
}

/**
* Set enter animation
*
* @param enterAnimation
* @return return {@link Overlay} instance for chaining purpose
*/
public Overlay setEnterAnimation(Animation enterAnimation){
public Overlay setEnterAnimation(Animation enterAnimation) {
mEnterAnimation = enterAnimation;
return this;
}

/**
* Set exit animation
*
* @param exitAnimation
* @return return {@link Overlay} instance for chaining purpose
*/
public Overlay setExitAnimation(Animation exitAnimation){
public Overlay setExitAnimation(Animation exitAnimation) {
mExitAnimation = exitAnimation;
return this;
}

/**
* Set {@link Overlay#mOnClickListener} for the {@link Overlay}
*
* @param onClickListener
* @return return {@link Overlay} instance for chaining purpose
*/
public Overlay setOnClickListener(View.OnClickListener onClickListener){
mOnClickListener=onClickListener;
public Overlay setOnClickListener(View.OnClickListener onClickListener) {
mOnClickListener = onClickListener;
return this;
}

Expand All @@ -103,6 +108,7 @@ public Overlay setOnClickListener(View.OnClickListener onClickListener){
* If this is not set, the size of view hole fill follow the max(view.width, view.height)
* If this is set, it will take precedence
* It only has effect when {@link Overlay.Style#Circle} is chosen
*
* @param holeRadius the radius of the view hole, setting 0 will make the hole disappear, in pixels
* @return return {@link Overlay} instance for chaining purpose
*/
Expand All @@ -111,16 +117,30 @@ public Overlay setHoleRadius(int holeRadius) {
return this;
}


/**
* This method sets offsets to the hole's position relative the position of the targeted view.
*
* @param offsetLeft left offset, in pixels
* @param offsetTop top offset, in pixels
* @param offsetTop top offset, in pixels
* @return {@link Overlay} instance for chaining purpose
*/
public Overlay setHoleOffsets(int offsetLeft, int offsetTop) {
mHoleOffsetLeft = offsetLeft;
mHoleOffsetTop = offsetTop;
return this;
}

/**
* This method sets the padding of a rectangular hole.
* @param holePadding padding in dp
* @return {@link Overlay} instance for chaining purpose
*/
public Overlay setHolePadding(int holePadding) {
mHolePadding = holePadding;
return this;
}

public enum Style {
Circle, Rectangle, NoHole
}
}
11 changes: 11 additions & 0 deletions tourguide/src/main/java/tourguide/tourguide/Pointer.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
public class Pointer {
public int mGravity = Gravity.CENTER;
public int mColor = Color.WHITE;
public int mColorPressed = Color.BLUE;

public Pointer() {
this(Gravity.CENTER, Color.parseColor("#FFFFFF"));
Expand Down Expand Up @@ -38,4 +39,14 @@ public Pointer setGravity(int gravity){
mGravity = gravity;
return this;
}

/**
* Set colorPressed
* @param colorPressed
* @return return Pointer instance for chaining purpose
*/
public Pointer setColorPressed(int colorPressed) {
mColorPressed = colorPressed;
return this;
}
}
Loading