diff --git a/.classpath b/.classpath
index a4f1e40..a141629 100755
--- a/.classpath
+++ b/.classpath
@@ -1,8 +1,10 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
diff --git a/.project b/.project
index 25a5ec7..b0f619a 100755
--- a/.project
+++ b/.project
@@ -1,6 +1,6 @@
- AppTemplate
+ SwipeBack
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 4f5ab4a..fc2d112 100755
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -1,8 +1,8 @@
+ android:versionCode="6"
+ android:versionName="2.0.0" >
+ android:name=".ui.SwipeBackPerApp">
@@ -24,8 +24,7 @@
+ android:name=".ui.SwipeBackSettings">
diff --git a/ext/XposedBridgeApi.jar b/ext/XposedBridgeApi.jar
new file mode 100644
index 0000000..8f7767e
Binary files /dev/null and b/ext/XposedBridgeApi.jar differ
diff --git a/libs/ShowcaseView/.classpath b/libs/ShowcaseView/.classpath
new file mode 100644
index 0000000..7bc01d9
--- /dev/null
+++ b/libs/ShowcaseView/.classpath
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/libs/ShowcaseView/.project b/libs/ShowcaseView/.project
new file mode 100644
index 0000000..786b51f
--- /dev/null
+++ b/libs/ShowcaseView/.project
@@ -0,0 +1,33 @@
+
+
+ ShowcaseView
+
+
+
+
+
+ com.android.ide.eclipse.adt.ResourceManagerBuilder
+
+
+
+
+ com.android.ide.eclipse.adt.PreCompilerBuilder
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ com.android.ide.eclipse.adt.ApkBuilder
+
+
+
+
+
+ com.android.ide.eclipse.adt.AndroidNature
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/libs/ShowcaseView/AndroidManifest.xml b/libs/ShowcaseView/AndroidManifest.xml
deleted file mode 100755
index c29c294..0000000
--- a/libs/ShowcaseView/AndroidManifest.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
diff --git a/libs/ShowcaseView/build.gradle b/libs/ShowcaseView/build.gradle
deleted file mode 100755
index b35bddc..0000000
--- a/libs/ShowcaseView/build.gradle
+++ /dev/null
@@ -1,32 +0,0 @@
-buildscript {
- repositories {
- mavenCentral()
- }
-
- dependencies {
- classpath 'com.android.tools.build:gradle:0.6.+'
- }
-}
-
-apply plugin: 'android-library'
-
-dependencies {
- repositories {
- mavenCentral()
- }
- compile 'com.android.support:support-v4:19.0.+'
- compile 'com.nineoldandroids:library:2.4.0+'
-}
-
-android {
- compileSdkVersion 19
- buildToolsVersion "19.0.0"
-
- sourceSets {
- main {
- manifest.srcFile 'AndroidManifest.xml'
- java.srcDirs = ['src']
- res.srcDirs = ['res']
- }
- }
-}
diff --git a/libs/ShowcaseView/libs/mockito-all-1.9.5.jar b/libs/ShowcaseView/libs/mockito-all-1.9.5.jar
deleted file mode 100755
index 00416eb..0000000
Binary files a/libs/ShowcaseView/libs/mockito-all-1.9.5.jar and /dev/null differ
diff --git a/libs/ShowcaseView/libs/nineoldandroids-2.4.0.jar b/libs/ShowcaseView/libs/nineoldandroids-2.4.0.jar
deleted file mode 100755
index 43ee45f..0000000
Binary files a/libs/ShowcaseView/libs/nineoldandroids-2.4.0.jar and /dev/null differ
diff --git a/libs/ShowcaseView/project.properties b/libs/ShowcaseView/project.properties
deleted file mode 100755
index 61afc8f..0000000
--- a/libs/ShowcaseView/project.properties
+++ /dev/null
@@ -1,15 +0,0 @@
-# This file is automatically generated by Android Tools.
-# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
-#
-# This file must be checked in Version Control Systems.
-#
-# To customize properties used by the Ant build system edit
-# "ant.properties", and override values to adapt the script to your
-# project structure.
-#
-# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
-#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
-
-android.library=true
-# Project target.
-target=android-19
diff --git a/libs/ShowcaseView/res/drawable-hdpi/btn_cling_normal.9.png b/libs/ShowcaseView/res/drawable-hdpi/btn_cling_normal.9.png
deleted file mode 100755
index aea8beb..0000000
Binary files a/libs/ShowcaseView/res/drawable-hdpi/btn_cling_normal.9.png and /dev/null differ
diff --git a/libs/ShowcaseView/res/drawable-hdpi/btn_cling_pressed.9.png b/libs/ShowcaseView/res/drawable-hdpi/btn_cling_pressed.9.png
deleted file mode 100755
index ebefd20..0000000
Binary files a/libs/ShowcaseView/res/drawable-hdpi/btn_cling_pressed.9.png and /dev/null differ
diff --git a/libs/ShowcaseView/res/drawable-hdpi/cling.png b/libs/ShowcaseView/res/drawable-hdpi/cling.png
deleted file mode 100755
index d605799..0000000
Binary files a/libs/ShowcaseView/res/drawable-hdpi/cling.png and /dev/null differ
diff --git a/libs/ShowcaseView/res/drawable-hdpi/hand.png b/libs/ShowcaseView/res/drawable-hdpi/hand.png
deleted file mode 100755
index bd4f6df..0000000
Binary files a/libs/ShowcaseView/res/drawable-hdpi/hand.png and /dev/null differ
diff --git a/libs/ShowcaseView/res/drawable-mdpi/btn_cling_normal.9.png b/libs/ShowcaseView/res/drawable-mdpi/btn_cling_normal.9.png
deleted file mode 100755
index 43a407e..0000000
Binary files a/libs/ShowcaseView/res/drawable-mdpi/btn_cling_normal.9.png and /dev/null differ
diff --git a/libs/ShowcaseView/res/drawable-mdpi/btn_cling_pressed.9.png b/libs/ShowcaseView/res/drawable-mdpi/btn_cling_pressed.9.png
deleted file mode 100755
index bf0c8cb..0000000
Binary files a/libs/ShowcaseView/res/drawable-mdpi/btn_cling_pressed.9.png and /dev/null differ
diff --git a/libs/ShowcaseView/res/drawable-mdpi/cling.png b/libs/ShowcaseView/res/drawable-mdpi/cling.png
deleted file mode 100755
index fba3a07..0000000
Binary files a/libs/ShowcaseView/res/drawable-mdpi/cling.png and /dev/null differ
diff --git a/libs/ShowcaseView/res/drawable-mdpi/hand.png b/libs/ShowcaseView/res/drawable-mdpi/hand.png
deleted file mode 100755
index fe5a035..0000000
Binary files a/libs/ShowcaseView/res/drawable-mdpi/hand.png and /dev/null differ
diff --git a/libs/ShowcaseView/res/drawable-xhdpi/btn_cling_normal.9.png b/libs/ShowcaseView/res/drawable-xhdpi/btn_cling_normal.9.png
deleted file mode 100755
index 35511d6..0000000
Binary files a/libs/ShowcaseView/res/drawable-xhdpi/btn_cling_normal.9.png and /dev/null differ
diff --git a/libs/ShowcaseView/res/drawable-xhdpi/btn_cling_pressed.9.png b/libs/ShowcaseView/res/drawable-xhdpi/btn_cling_pressed.9.png
deleted file mode 100755
index a38b40f..0000000
Binary files a/libs/ShowcaseView/res/drawable-xhdpi/btn_cling_pressed.9.png and /dev/null differ
diff --git a/libs/ShowcaseView/res/drawable-xhdpi/cling.png b/libs/ShowcaseView/res/drawable-xhdpi/cling.png
deleted file mode 100755
index 1cee1de..0000000
Binary files a/libs/ShowcaseView/res/drawable-xhdpi/cling.png and /dev/null differ
diff --git a/libs/ShowcaseView/res/drawable-xhdpi/cling_bleached.png b/libs/ShowcaseView/res/drawable-xhdpi/cling_bleached.png
deleted file mode 100755
index 9dfecfd..0000000
Binary files a/libs/ShowcaseView/res/drawable-xhdpi/cling_bleached.png and /dev/null differ
diff --git a/libs/ShowcaseView/res/drawable-xhdpi/hand.png b/libs/ShowcaseView/res/drawable-xhdpi/hand.png
deleted file mode 100755
index 35b678c..0000000
Binary files a/libs/ShowcaseView/res/drawable-xhdpi/hand.png and /dev/null differ
diff --git a/libs/ShowcaseView/res/drawable/cling_button_bg.xml b/libs/ShowcaseView/res/drawable/cling_button_bg.xml
deleted file mode 100755
index 7fd5d37..0000000
--- a/libs/ShowcaseView/res/drawable/cling_button_bg.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
-
-
diff --git a/libs/ShowcaseView/res/layout/handy.xml b/libs/ShowcaseView/res/layout/handy.xml
deleted file mode 100755
index 04ff21e..0000000
--- a/libs/ShowcaseView/res/layout/handy.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
\ No newline at end of file
diff --git a/libs/ShowcaseView/res/layout/showcase_button.xml b/libs/ShowcaseView/res/layout/showcase_button.xml
deleted file mode 100755
index d4c3eea..0000000
--- a/libs/ShowcaseView/res/layout/showcase_button.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
\ No newline at end of file
diff --git a/libs/ShowcaseView/res/values/attrs.xml b/libs/ShowcaseView/res/values/attrs.xml
deleted file mode 100755
index fa0558a..0000000
--- a/libs/ShowcaseView/res/values/attrs.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/libs/ShowcaseView/res/values/ids.xml b/libs/ShowcaseView/res/values/ids.xml
deleted file mode 100755
index 2284ce4..0000000
--- a/libs/ShowcaseView/res/values/ids.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/libs/ShowcaseView/res/values/strings.xml b/libs/ShowcaseView/res/values/strings.xml
deleted file mode 100755
index 3678bf6..0000000
--- a/libs/ShowcaseView/res/values/strings.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
- OK
-
diff --git a/libs/ShowcaseView/res/values/styles.xml b/libs/ShowcaseView/res/values/styles.xml
deleted file mode 100755
index 11cb85c..0000000
--- a/libs/ShowcaseView/res/values/styles.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/libs/ShowcaseView/src/com/espian/showcaseview/OnShowcaseEventListener.java b/libs/ShowcaseView/src/com/espian/showcaseview/OnShowcaseEventListener.java
deleted file mode 100755
index e92c2aa..0000000
--- a/libs/ShowcaseView/src/com/espian/showcaseview/OnShowcaseEventListener.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.espian.showcaseview;
-
-/**
-* @author Alex
-*/
-public interface OnShowcaseEventListener {
-
- public void onShowcaseViewHide(ShowcaseView showcaseView);
-
- public void onShowcaseViewDidHide(ShowcaseView showcaseView);
-
- public void onShowcaseViewShow(ShowcaseView showcaseView);
-
- /**
- * Empty implementation of OnShowcaseViewEventListener such that null
- * checks aren't needed
- */
- public static final OnShowcaseEventListener NONE = new OnShowcaseEventListener() {
- @Override
- public void onShowcaseViewHide(ShowcaseView showcaseView) {
-
- }
-
- @Override
- public void onShowcaseViewDidHide(ShowcaseView showcaseView) {
-
- }
-
- @Override
- public void onShowcaseViewShow(ShowcaseView showcaseView) {
-
- }
- };
-
-}
diff --git a/libs/ShowcaseView/src/com/espian/showcaseview/ShowcaseView.java b/libs/ShowcaseView/src/com/espian/showcaseview/ShowcaseView.java
deleted file mode 100755
index 372590c..0000000
--- a/libs/ShowcaseView/src/com/espian/showcaseview/ShowcaseView.java
+++ /dev/null
@@ -1,913 +0,0 @@
-package com.espian.showcaseview;
-
-import android.app.Activity;
-import android.content.Context;
-import android.content.SharedPreferences;
-import android.content.res.TypedArray;
-import android.graphics.Canvas;
-import android.graphics.Color;
-import android.graphics.Path;
-import android.graphics.Paint;
-import android.graphics.Point;
-import android.graphics.PorterDuff;
-import android.graphics.PorterDuffXfermode;
-import android.graphics.Region.Op;
-import android.os.Build;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.ViewParent;
-import android.view.animation.AccelerateDecelerateInterpolator;
-import android.view.animation.Interpolator;
-import android.widget.Button;
-import android.widget.RelativeLayout;
-
-import com.espian.showcaseview.actionbar.ActionBarViewWrapper;
-import com.espian.showcaseview.actionbar.reflection.BaseReflector;
-import com.espian.showcaseview.anim.AnimationUtils;
-import com.espian.showcaseview.drawing.ClingDrawer;
-import com.espian.showcaseview.drawing.ClingDrawerImpl;
-import com.espian.showcaseview.drawing.TextDrawer;
-import com.espian.showcaseview.drawing.TextDrawerImpl;
-import com.espian.showcaseview.targets.Target;
-import com.espian.showcaseview.utils.Calculator;
-import com.espian.showcaseview.utils.PointAnimator;
-import com.github.espiandev.showcaseview.R;
-import com.nineoldandroids.animation.Animator;
-
-import static com.espian.showcaseview.anim.AnimationUtils.AnimationEndListener;
-import static com.espian.showcaseview.anim.AnimationUtils.AnimationStartListener;
-
-/**
- * A view which allows you to showcase areas of your app with an explanation.
- */
-public class ShowcaseView extends RelativeLayout
- implements View.OnClickListener, View.OnTouchListener {
-
- public static final int TYPE_NO_LIMIT = 0;
- public static final int TYPE_ONE_SHOT = 1;
-
- public static final int INSERT_TO_DECOR = 0;
- public static final int INSERT_TO_VIEW = 1;
-
- public static final int ITEM_ACTION_HOME = 0;
- public static final int ITEM_TITLE = 1;
- public static final int ITEM_SPINNER = 2;
- public static final int ITEM_ACTION_ITEM = 3;
- public static final int ITEM_ACTION_OVERFLOW = 6;
-
- protected static final String PREFS_SHOWCASE_INTERNAL = "showcase_internal";
- public static final int INNER_CIRCLE_RADIUS = 94;
- private static final Interpolator INTERPOLATOR = new AccelerateDecelerateInterpolator();
-
- private int showcaseX = -1;
- private int showcaseY = -1;
- private float showcaseRadius = -1;
- private float metricScale = 1.0f;
- private float legacyShowcaseX = -1;
- private float legacyShowcaseY = -1;
- private boolean isRedundant = false;
- private boolean hasCustomClickListener = false;
- private ConfigOptions mOptions;
- private int mBackgroundColor;
- private View mHandy;
- private final Button mEndButton;
- OnShowcaseEventListener mEventListener = OnShowcaseEventListener.NONE;
- private boolean mAlteredText = false;
-
- private final String buttonText;
-
- private float scaleMultiplier = 1f;
- private TextDrawer mTextDrawer;
- private ClingDrawer mShowcaseDrawer;
-
- public static final Target NONE = new Target() {
- @Override
- public Point getPoint() {
- return null;
- }
- };
-
- private boolean mHasNoTarget = false;
-
- protected ShowcaseView(Context context) {
- this(context, null, R.styleable.CustomTheme_showcaseViewStyle);
- }
-
- protected ShowcaseView(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
-
- // Get the attributes for the ShowcaseView
- final TypedArray styled = context.getTheme()
- .obtainStyledAttributes(attrs, R.styleable.ShowcaseView, R.attr.showcaseViewStyle,
- R.style.ShowcaseView);
- mBackgroundColor = styled
- .getInt(R.styleable.ShowcaseView_sv_backgroundColor, Color.argb(128, 80, 80, 80));
- int showcaseColor = styled
- .getColor(R.styleable.ShowcaseView_sv_showcaseColor, Color.parseColor("#33B5E5"));
-
- int titleTextAppearance = styled
- .getResourceId(R.styleable.ShowcaseView_sv_titleTextAppearance,
- R.style.TextAppearance_ShowcaseView_Title);
- int detailTextAppearance = styled
- .getResourceId(R.styleable.ShowcaseView_sv_detailTextAppearance,
- R.style.TextAppearance_ShowcaseView_Detail);
-
- buttonText = styled.getString(R.styleable.ShowcaseView_sv_buttonText);
- styled.recycle();
-
- metricScale = getContext().getResources().getDisplayMetrics().density;
- mEndButton = (Button) LayoutInflater.from(context).inflate(R.layout.showcase_button, null);
-
- mShowcaseDrawer = new ClingDrawerImpl(getResources(), showcaseColor);
-
- // TODO: This isn't ideal, ClingDrawer and Calculator interfaces should be separate
- mTextDrawer = new TextDrawerImpl(metricScale, mShowcaseDrawer);
- mTextDrawer.setTitleStyling(context, titleTextAppearance);
- mTextDrawer.setDetailStyling(context, detailTextAppearance);
-
- ConfigOptions options = new ConfigOptions();
- options.showcaseId = getId();
- setConfigOptions(options);
-
- init();
- }
-
- private void init() {
- setHardwareAccelerated(true);
-
- boolean hasShot = getContext()
- .getSharedPreferences(PREFS_SHOWCASE_INTERNAL, Context.MODE_PRIVATE)
- .getBoolean("hasShot" + getConfigOptions().showcaseId, false);
- if (hasShot && mOptions.shotType == TYPE_ONE_SHOT) {
- // The showcase has already been shot once, so we don't need to do anything
- setVisibility(View.GONE);
- isRedundant = true;
- return;
- }
-
- showcaseRadius = metricScale * INNER_CIRCLE_RADIUS;
- setOnTouchListener(this);
-
- if (!mOptions.noButton && mEndButton.getParent() == null) {
- RelativeLayout.LayoutParams lps = getConfigOptions().buttonLayoutParams;
- if (lps == null) {
- lps = (LayoutParams) generateDefaultLayoutParams();
- lps.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
- lps.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
- int margin = ((Number) (metricScale * 12)).intValue();
- lps.setMargins(margin, margin, margin, margin);
- }
- mEndButton.setLayoutParams(lps);
- mEndButton.setText(
- buttonText != null ? buttonText : getResources().getString(R.string.ok));
- if (!hasCustomClickListener) {
- mEndButton.setOnClickListener(this);
- }
- addView(mEndButton);
- }
-
- }
-
- /**
- * @deprecated Use setShowcase() with the target ShowcaseView.NONE
- */
- @Deprecated
- public void setShowcaseNoView() {
- setShowcasePosition(1000000, 1000000);
- }
-
- /**
- * Set the view to showcase
- *
- * @param view The {@link View} to showcase.
- * @deprecated Use setShowcase with a {@link com.espian.showcaseview.targets.ViewTarget}
- */
- @Deprecated
- public void setShowcaseView(final View view) {
- if (isRedundant || view == null) {
- isRedundant = true;
- return;
- }
- isRedundant = false;
-
- view.post(new Runnable() {
- @Override
- public void run() {
- //init();
- Point viewPoint = Calculator.getShowcasePointFromView(view, getConfigOptions());
- setShowcasePosition(viewPoint);
- invalidate();
- }
- });
- }
-
- /**
- * @deprecated This will soon become private. Use setShowcase with a {@link com.espian.showcaseview.targets.PointTarget}
- */
- @Deprecated
- public void setShowcasePosition(Point point) {
- setShowcasePosition(point.x, point.y);
- }
-
- /**
- * Set a specific position to showcase
- *
- * @param x X co-ordinate
- * @param y Y co-ordinate
- * @deprecated use setShowcase with a PointTarget
- */
- @Deprecated
- public void setShowcasePosition(int x, int y) {
- if (isRedundant) {
- return;
- }
- showcaseX = x;
- showcaseY = y;
- //init();
- invalidate();
- }
-
- public void setShowcase(final Target target) {
- setShowcase(target, false);
- }
-
- public void setShowcase(final Target target, final boolean animate) {
- postDelayed(new Runnable() {
- @Override
- public void run() {
- Point targetPoint = target.getPoint();
- if (targetPoint != null) {
- mHasNoTarget = false;
- if (animate) {
- Animator animator = PointAnimator.ofPoints(ShowcaseView.this, targetPoint);
- animator.setDuration(getConfigOptions().fadeInDuration);
- animator.setInterpolator(INTERPOLATOR);
- animator.start();
- } else {
- setShowcasePosition(targetPoint);
- }
- } else {
- mHasNoTarget = true;
- invalidate();
- }
- }
- }, 100);
- }
-
- public boolean hasShowcaseView() {
- return (showcaseX != 1000000 && showcaseY != 1000000) || !mHasNoTarget;
- }
-
- public void setShowcaseX(int x) {
- setShowcasePosition(x, showcaseY);
- }
-
- public void setShowcaseY(int y) {
- setShowcasePosition(showcaseX, y);
- }
-
- public int getShowcaseX() {
- return showcaseX;
- }
-
- public int getShowcaseY() {
- return showcaseY;
- }
-
- @Deprecated
- public void setShowcaseItem(final int itemType, final int actionItemId,
- final Activity activity) {
- post(new Runnable() {
- @Override
- public void run() {
- BaseReflector reflector = BaseReflector.getReflectorForActivity(activity);
- ViewParent p = reflector.getActionBarView(); //ActionBarView
- ActionBarViewWrapper wrapper = new ActionBarViewWrapper(p);
-
- switch (itemType) {
- case ITEM_ACTION_HOME:
- setShowcaseView(reflector.getHomeButton());
- break;
- case ITEM_SPINNER:
- setShowcaseView(wrapper.getSpinnerView());
- break;
- case ITEM_TITLE:
- setShowcaseView(wrapper.getTitleView());
- break;
- case ITEM_ACTION_ITEM:
- setShowcaseView(wrapper.getActionItem(actionItemId));
- break;
- case ITEM_ACTION_OVERFLOW:
- View overflow = wrapper.getOverflowView();
- // This check essentially checks if we are on a device with a legacy menu key
- if (overflow != null) {
- setShowcaseView(wrapper.getOverflowView());
- } else {
- setShowcasePosition(getLegacyOverflowPoint());
- }
- break;
- default:
- Log.e("TAG", "Unknown item type");
- }
- }
- });
-
- }
-
- /**
- * Gets the bottom centre of the screen, where a legacy menu would pop up
- */
- private Point getLegacyOverflowPoint() {
- return new Point(getLeft() + getWidth() / 2, getBottom());
- }
-
- /**
- * Override the standard button click event
- *
- * @param listener Listener to listen to on click events
- */
- public void overrideButtonClick(OnClickListener listener) {
- if (isRedundant) {
- return;
- }
- if (mEndButton != null) {
- mEndButton.setOnClickListener(listener != null ? listener : this);
- }
- hasCustomClickListener = true;
- }
-
- protected void performButtonClick() {
- mEndButton.performClick();
- }
-
- public void setOnShowcaseEventListener(OnShowcaseEventListener listener) {
- if (listener != null) {
- mEventListener = listener;
- } else {
- mEventListener = OnShowcaseEventListener.NONE;
- }
- }
-
- public void setButtonText(CharSequence text) {
- if (mEndButton != null) {
- mEndButton.setText(text);
- }
- }
-
- public void setHardwareAccelerated(boolean accelerated) {
- if (accelerated) {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
- if (isHardwareAccelerated()) {
- Paint hardwarePaint = new Paint();
- hardwarePaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.OVERLAY));
- setLayerType(LAYER_TYPE_HARDWARE, hardwarePaint);
- } else {
- setLayerType(LAYER_TYPE_SOFTWARE, null);
- }
- } else {
- setDrawingCacheEnabled(true);
- }
- } else {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
- setLayerType(LAYER_TYPE_SOFTWARE, null);
- } else {
- setDrawingCacheEnabled(true);
- }
- }
- }
-
- @Override
- protected void dispatchDraw(Canvas canvas) {
- if (showcaseX < 0 || showcaseY < 0 || isRedundant) {
- super.dispatchDraw(canvas);
- return;
- }
-
- boolean recalculatedCling = mShowcaseDrawer.calculateShowcaseRect(showcaseX, showcaseY);
- boolean recalculateText = recalculatedCling || mAlteredText;
- mAlteredText = false;
-
- if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.HONEYCOMB && !mHasNoTarget) {
- Path path = new Path();
- path.addCircle(showcaseX, showcaseY, showcaseRadius, Path.Direction.CW);
- canvas.clipPath(path, Op.DIFFERENCE);
- }
-
- //Draw background color
- canvas.drawColor(mBackgroundColor);
-
- // Draw the showcase drawable
- if (!mHasNoTarget) {
- mShowcaseDrawer.drawShowcase(canvas, showcaseX, showcaseY, scaleMultiplier, showcaseRadius);
- }
-
- // Draw the text on the screen, recalculating its position if necessary
- if (recalculateText) {
- mTextDrawer.calculateTextPosition(canvas.getWidth(), canvas.getHeight(), this);
- }
- mTextDrawer.draw(canvas, recalculateText);
-
- super.dispatchDraw(canvas);
-
- }
-
- /**
- * Adds an animated hand performing a gesture.
- * All parameters passed to this method are relative to the center of the showcased view.
- * @param offsetStartX x-offset of the start position
- * @param offsetStartY y-offset of the start position
- * @param offsetEndX x-offset of the end position
- * @param offsetEndY y-offset of the end position
- * @see com.espian.showcaseview.ShowcaseView#animateGesture(float, float, float, float, boolean)
- */
- public void animateGesture(float offsetStartX, float offsetStartY, float offsetEndX,
- float offsetEndY) {
- animateGesture(offsetStartX, offsetStartY, offsetEndX, offsetEndY, false);
- }
-
- /**
- * Adds an animated hand performing a gesture.
- * @param startX x-coordinate or x-offset of the start position
- * @param startY y-coordinate or x-offset of the start position
- * @param endX x-coordinate or x-offset of the end position
- * @param endY y-coordinate or x-offset of the end position
- * @param absoluteCoordinates If true, this will use absolute coordinates instead of coordinates relative to the center of the showcased view
- */
- public void animateGesture(float startX, float startY, float endX,
- float endY, boolean absoluteCoordinates) {
- mHandy = ((LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE))
- .inflate(R.layout.handy, null);
- addView(mHandy);
- moveHand(startX, startY, endX, endY, absoluteCoordinates, new AnimationEndListener() {
- @Override
- public void onAnimationEnd() {
- removeView(mHandy);
- }
- });
- }
-
- private void moveHand(float startX, float startY, float endX,
- float endY, boolean absoluteCoordinates, AnimationEndListener listener) {
- AnimationUtils.createMovementAnimation(mHandy, absoluteCoordinates?0:showcaseX,
- absoluteCoordinates?0:showcaseY,
- startX, startY,
- endX, endY,
- listener).start();
- }
-
- @Override
- public void onClick(View view) {
- // If the type is set to one-shot, store that it has shot
- if (mOptions.shotType == TYPE_ONE_SHOT) {
- SharedPreferences internal = getContext()
- .getSharedPreferences(PREFS_SHOWCASE_INTERNAL, Context.MODE_PRIVATE);
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
- internal.edit().putBoolean("hasShot" + getConfigOptions().showcaseId, true).apply();
- } else {
- internal.edit().putBoolean("hasShot" + getConfigOptions().showcaseId, true)
- .commit();
- }
- }
- hide();
- }
-
- public void hide() {
- mEventListener.onShowcaseViewHide(this);
-
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB
- && getConfigOptions().fadeOutDuration > 0) {
- fadeOutShowcase();
- } else {
- setVisibility(View.GONE);
- mEventListener.onShowcaseViewDidHide(this);
- }
- }
-
- private void fadeOutShowcase() {
- AnimationUtils.createFadeOutAnimation(this, new AnimationEndListener() {
- @Override
- public void onAnimationEnd() {
- setVisibility(View.GONE);
- mEventListener.onShowcaseViewDidHide(ShowcaseView.this);
- }
- }).start();
- }
-
- public void show() {
- mEventListener.onShowcaseViewShow(this);
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB
- && getConfigOptions().fadeInDuration > 0) {
- fadeInShowcase();
- } else {
- setVisibility(View.VISIBLE);
- }
- }
-
- private void fadeInShowcase() {
- AnimationUtils.createFadeInAnimation(this, getConfigOptions().fadeInDuration,
- new AnimationStartListener() {
- @Override
- public void onAnimationStart() {
- setVisibility(View.VISIBLE);
- }
- }).start();
- }
-
- @Override
- public boolean onTouch(View view, MotionEvent motionEvent) {
-
- float xDelta = Math.abs(motionEvent.getRawX() - showcaseX);
- float yDelta = Math.abs(motionEvent.getRawY() - showcaseY);
- double distanceFromFocus = Math.sqrt(Math.pow(xDelta, 2) + Math.pow(yDelta, 2));
-
- if (MotionEvent.ACTION_UP == motionEvent.getAction() &&
- mOptions.hideOnClickOutside && distanceFromFocus > showcaseRadius) {
- this.hide();
- return true;
- }
-
- return mOptions.block && distanceFromFocus > showcaseRadius;
- }
-
- /**
- * @deprecated Use setScaleMultiplier
- */
- @Deprecated
- public void setShowcaseIndicatorScale(float scaleMultiplier) {
- setScaleMultiplier(scaleMultiplier);
- }
-
- public void setText(int titleTextResId, int subTextResId) {
- String titleText = getContext().getResources().getString(titleTextResId);
- String subText = getContext().getResources().getString(subTextResId);
- setText(titleText, subText);
- }
-
- public void setText(String titleText, String subText) {
- mTextDrawer.setTitle(titleText);
- mTextDrawer.setDetails(subText);
- mAlteredText = true;
- invalidate();
- }
-
- /**
- * Get the ghostly gesture hand for custom gestures
- *
- * @return a View representing the ghostly hand
- */
- public View getHand() {
- final View mHandy = ((LayoutInflater) getContext()
- .getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.handy, null);
- addView(mHandy);
- AnimationUtils.hide(mHandy);
-
- return mHandy;
- }
-
- /**
- * Point to a specific view
- * @param view The {@link View} to Showcase
- * @deprecated use pointTo(Target)
- */
- @Deprecated
- public void pointTo(View view) {
- float x = AnimationUtils.getX(view) + view.getWidth() / 2;
- float y = AnimationUtils.getY(view) + view.getHeight() / 2;
- pointTo(x, y);
- }
-
- /**
- * Point to a specific point on the screen
- *
- * @param x X-coordinate to point to
- * @param y Y-coordinate to point to
- * @deprecated use pointTo(Target)
- */
- @Deprecated
- public void pointTo(float x, float y) {
- mHandy = getHand();
- AnimationUtils.createMovementAnimation(mHandy, x, y).start();
- }
-
- /**
- * Point to a specific point on the screen
- * @param target The target to point to
- * @deprecated use pointTo(Target)
- */
- public void pointTo(final Target target) {
- post(new Runnable() {
- @Override
- public void run() {
- mHandy = getHand();
- Point targetPoint = target.getPoint();
- AnimationUtils.createMovementAnimation(mHandy, targetPoint.x,
- targetPoint.y).start();
- }
- });
- }
-
- protected void setConfigOptions(ConfigOptions options) {
- mOptions = options;
- }
-
- public ConfigOptions getConfigOptions() {
- // Make sure that this method never returns null
- if (mOptions == null) {
- return mOptions = new ConfigOptions();
- }
- return mOptions;
- }
-
- /**
- * Quick method to insert a ShowcaseView into an Activity
- *
- * @param viewToShowcase View to showcase
- * @param activity Activity to insert into
- * @param title Text to show as a title. Can be null.
- * @param detailText More detailed text. Can be null.
- * @param options A set of options to customise the ShowcaseView
- * @return the created ShowcaseView instance
- * @deprecated use insertShowcaseView with {@link Target}
- */
- @Deprecated
- public static ShowcaseView insertShowcaseView(View viewToShowcase, Activity activity,
- String title,
- String detailText, ConfigOptions options) {
- ShowcaseView sv = new ShowcaseView(activity);
- if (options != null) {
- sv.setConfigOptions(options);
- }
- if (sv.getConfigOptions().insert == INSERT_TO_DECOR) {
- ((ViewGroup) activity.getWindow().getDecorView()).addView(sv);
- } else {
- ((ViewGroup) activity.findViewById(android.R.id.content)).addView(sv);
- }
- sv.setShowcaseView(viewToShowcase);
- sv.setText(title, detailText);
- return sv;
- }
-
- /**
- * Quick method to insert a ShowcaseView into an Activity
- *
- * @param viewToShowcase View to showcase
- * @param activity Activity to insert into
- * @param title Text to show as a title. Can be null.
- * @param detailText More detailed text. Can be null.
- * @param options A set of options to customise the ShowcaseView
- * @return the created ShowcaseView instance
- * @deprecated use insertShowcaseView with {@link Target}
- */
- @Deprecated
- public static ShowcaseView insertShowcaseView(View viewToShowcase, Activity activity, int title,
- int detailText, ConfigOptions options) {
- ShowcaseView sv = new ShowcaseView(activity);
- if (options != null) {
- sv.setConfigOptions(options);
- }
- if (sv.getConfigOptions().insert == INSERT_TO_DECOR) {
- ((ViewGroup) activity.getWindow().getDecorView()).addView(sv);
- } else {
- ((ViewGroup) activity.findViewById(android.R.id.content)).addView(sv);
- }
- sv.setShowcaseView(viewToShowcase);
- sv.setText(title, detailText);
- return sv;
- }
-
- /**
- * @deprecated use insertShowcaseView with {@link Target}
- */
- @Deprecated
- public static ShowcaseView insertShowcaseView(int showcaseViewId, Activity activity,
- String title, String detailText, ConfigOptions options) {
- View v = activity.findViewById(showcaseViewId);
- if (v != null) {
- return insertShowcaseView(v, activity, title, detailText, options);
- }
- return null;
- }
-
- /**
- * @deprecated use insertShowcaseView with {@link Target}
- */
- @Deprecated
- public static ShowcaseView insertShowcaseView(int showcaseViewId, Activity activity, int title,
- int detailText, ConfigOptions options) {
- View v = activity.findViewById(showcaseViewId);
- if (v != null) {
- return insertShowcaseView(v, activity, title, detailText, options);
- }
- return null;
- }
-
- /**
- * @deprecated use insertShowcaseView with {@link Target}
- */
- @Deprecated
- public static ShowcaseView insertShowcaseView(int x, int y, Activity activity, String title,
- String detailText, ConfigOptions options) {
- ShowcaseView sv = new ShowcaseView(activity);
- if (options != null) {
- sv.setConfigOptions(options);
- }
- if (sv.getConfigOptions().insert == INSERT_TO_DECOR) {
- ((ViewGroup) activity.getWindow().getDecorView()).addView(sv);
- } else {
- ((ViewGroup) activity.findViewById(android.R.id.content)).addView(sv);
- }
- sv.setShowcasePosition(x, y);
- sv.setText(title, detailText);
- return sv;
- }
-
- /**
- * @deprecated use insertShowcaseView with {@link Target}
- */
- @Deprecated
- public static ShowcaseView insertShowcaseView(int x, int y, Activity activity, int title,
- int detailText, ConfigOptions options) {
- ShowcaseView sv = new ShowcaseView(activity);
- if (options != null) {
- sv.setConfigOptions(options);
- }
- if (sv.getConfigOptions().insert == INSERT_TO_DECOR) {
- ((ViewGroup) activity.getWindow().getDecorView()).addView(sv);
- } else {
- ((ViewGroup) activity.findViewById(android.R.id.content)).addView(sv);
- }
- sv.setShowcasePosition(x, y);
- sv.setText(title, detailText);
- return sv;
- }
-
- /**
- * @deprecated use insertShowcaseView with {@link Target}
- */
- @Deprecated
- public static ShowcaseView insertShowcaseView(View showcase, Activity activity) {
- return insertShowcaseView(showcase, activity, null, null, null);
- }
-
- /**
- * Quickly insert a ShowcaseView into an Activity, highlighting an item.
- *
- * @param type the type of item to showcase (can be ITEM_ACTION_HOME,
- * ITEM_TITLE_OR_SPINNER, ITEM_ACTION_ITEM or ITEM_ACTION_OVERFLOW)
- * @param itemId the ID of an Action item to showcase (only required for ITEM_ACTION_ITEM
- * @param activity Activity to insert the ShowcaseView into
- * @param title Text to show as a title. Can be null.
- * @param detailText More detailed text. Can be null.
- * @param options A set of options to customise the ShowcaseView
- * @return the created ShowcaseView instance
- * @deprecated use insertShowcaseView with {@link Target}
- */
- @Deprecated
- public static ShowcaseView insertShowcaseViewWithType(int type, int itemId, Activity activity,
- String title, String detailText, ConfigOptions options) {
- ShowcaseView sv = new ShowcaseView(activity);
- if (options != null) {
- sv.setConfigOptions(options);
- }
- if (sv.getConfigOptions().insert == INSERT_TO_DECOR) {
- ((ViewGroup) activity.getWindow().getDecorView()).addView(sv);
- } else {
- ((ViewGroup) activity.findViewById(android.R.id.content)).addView(sv);
- }
- sv.setShowcaseItem(type, itemId, activity);
- sv.setText(title, detailText);
- return sv;
- }
-
- /**
- * Quickly insert a ShowcaseView into an Activity, highlighting an item.
- *
- * @param type the type of item to showcase (can be ITEM_ACTION_HOME,
- * ITEM_TITLE_OR_SPINNER, ITEM_ACTION_ITEM or ITEM_ACTION_OVERFLOW)
- * @param itemId the ID of an Action item to showcase (only required for ITEM_ACTION_ITEM
- * @param activity Activity to insert the ShowcaseView into
- * @param title Text to show as a title. Can be null.
- * @param detailText More detailed text. Can be null.
- * @param options A set of options to customise the ShowcaseView
- * @return the created ShowcaseView instance
- */
- @Deprecated
- public static ShowcaseView insertShowcaseViewWithType(int type, int itemId, Activity activity,
- int title, int detailText, ConfigOptions options) {
- ShowcaseView sv = new ShowcaseView(activity);
- if (options != null) {
- sv.setConfigOptions(options);
- }
- if (sv.getConfigOptions().insert == INSERT_TO_DECOR) {
- ((ViewGroup) activity.getWindow().getDecorView()).addView(sv);
- } else {
- ((ViewGroup) activity.findViewById(android.R.id.content)).addView(sv);
- }
- sv.setShowcaseItem(type, itemId, activity);
- sv.setText(title, detailText);
- return sv;
- }
-
- @Deprecated
- public static ShowcaseView insertShowcaseView(int x, int y, Activity activity) {
- return insertShowcaseView(x, y, activity, null, null, null);
- }
-
- /**
- * Internal insert method so all inserts are routed through one method
- */
- private static ShowcaseView insertShowcaseViewInternal(Target target, Activity activity, String title,
- String detail, ConfigOptions options) {
- ShowcaseView sv = new ShowcaseView(activity);
- sv.setConfigOptions(options);
- if (sv.getConfigOptions().insert == INSERT_TO_DECOR) {
- ((ViewGroup) activity.getWindow().getDecorView()).addView(sv);
- } else {
- ((ViewGroup) activity.findViewById(android.R.id.content)).addView(sv);
- }
- sv.setShowcase(target);
- sv.setText(title, detail);
- return sv;
- }
-
- public static ShowcaseView insertShowcaseView(Target target, Activity activity) {
- return insertShowcaseViewInternal(target, activity, null, null, null);
- }
-
- public static ShowcaseView insertShowcaseView(Target target, Activity activity, String title, String detail) {
- return insertShowcaseViewInternal(target, activity, title, detail, null);
- }
-
- public static ShowcaseView insertShowcaseView(Target target, Activity activity, int title, int detail) {
- return insertShowcaseViewInternal(target, activity, activity.getString(title), activity.getString(detail), null);
- }
-
- public static ShowcaseView insertShowcaseView(Target target, Activity activity, String title, String detail, ConfigOptions options) {
- return insertShowcaseViewInternal(target, activity, title, detail, options);
- }
-
- public static ShowcaseView insertShowcaseView(Target target, Activity activity, int title, int detail, ConfigOptions options) {
- return insertShowcaseViewInternal(target, activity, activity.getString(title), activity.getString(detail), options);
- }
-
- public static class ConfigOptions {
-
- public boolean block = true, noButton = false;
- public boolean hideOnClickOutside = false;
-
- /**
- * Does not work with the {@link ShowcaseViews} class as it does not make sense (only with
- * {@link ShowcaseView}).
- * @deprecated not compatible with Target API
- */
- @Deprecated
- public int insert = INSERT_TO_DECOR;
-
- /**
- * If you want to use more than one Showcase with the {@link ConfigOptions#shotType} {@link
- * ShowcaseView#TYPE_ONE_SHOT} in one Activity, set a unique value for every different
- * Showcase you want to use.
- */
- public int showcaseId = 0;
-
- /**
- * If you want to use more than one Showcase with {@link ShowcaseView#TYPE_ONE_SHOT} in one
- * Activity, set a unique {@link ConfigOptions#showcaseId} value for every different
- * Showcase you want to use. If you want to use this in the {@link ShowcaseViews} class, you
- * need to set a custom showcaseId for each {@link ShowcaseView}.
- */
- public int shotType = TYPE_NO_LIMIT;
-
- /**
- * Default duration for fade in animation. Set to 0 to disable.
- */
- public int fadeInDuration = AnimationUtils.DEFAULT_DURATION;
-
- /**
- * Default duration for fade out animation. Set to 0 to disable.
- */
- public int fadeOutDuration = AnimationUtils.DEFAULT_DURATION;
- /**
- * Allow custom positioning of the button within the showcase view.
- */
- public LayoutParams buttonLayoutParams = null;
-
- /**
- * Whether the text should be centered or stretched in the available space
- */
- public boolean centerText = false;
- }
-
- public float getScaleMultiplier() {
- return scaleMultiplier;
- }
-
- public void setScaleMultiplier(float scaleMultiplier) {
- this.scaleMultiplier = scaleMultiplier;
- }
-
-}
diff --git a/libs/ShowcaseView/src/com/espian/showcaseview/ShowcaseViewBuilder.java b/libs/ShowcaseView/src/com/espian/showcaseview/ShowcaseViewBuilder.java
deleted file mode 100755
index 2bf0e50..0000000
--- a/libs/ShowcaseView/src/com/espian/showcaseview/ShowcaseViewBuilder.java
+++ /dev/null
@@ -1,90 +0,0 @@
-package com.espian.showcaseview;
-
-import android.app.Activity;
-import android.view.View;
-
-public class ShowcaseViewBuilder {
-
- private final ShowcaseView showcaseView;
-
- public ShowcaseViewBuilder(Activity activity) {
- this.showcaseView = new ShowcaseView(activity);
- }
-
- public ShowcaseViewBuilder(ShowcaseView showcaseView) {
- this.showcaseView = showcaseView;
- }
-
- public ShowcaseViewBuilder(Activity activity, int showcaseLayoutViewId) {
- this.showcaseView = (ShowcaseView) activity.getLayoutInflater().inflate(showcaseLayoutViewId, null);
- }
-
- public ShowcaseViewBuilder setShowcaseNoView() {
- showcaseView.setShowcaseNoView();
- return this;
- }
-
- public ShowcaseViewBuilder setShowcaseView(View view) {
- showcaseView.setShowcaseView(view);
- return this;
- }
-
- public ShowcaseViewBuilder setShowcasePosition(int x, int y) {
- showcaseView.setShowcasePosition(x, y);
- return this;
- }
-
- public ShowcaseViewBuilder setShowcaseItem(int itemType, int actionItemId, Activity activity) {
- showcaseView.setShowcaseItem(itemType, actionItemId, activity);
- return this;
- }
-
- public ShowcaseViewBuilder setShowcaseIndicatorScale(float scale) {
- showcaseView.setShowcaseIndicatorScale(scale);
- return this;
- }
-
- public ShowcaseViewBuilder overrideButtonClick(View.OnClickListener listener) {
- showcaseView.overrideButtonClick(listener);
- return this;
- }
-
- public ShowcaseViewBuilder animateGesture(float offsetStartX, float offsetStartY, float offsetEndX, float offsetEndY) {
- showcaseView.animateGesture(offsetStartX, offsetStartY, offsetEndX, offsetEndY);
- return this;
- }
-
-// public ShowcaseViewBuilder setTextColors(int titleTextColor, int detailTextColor) {
-// showcaseView.setTextColors(titleTextColor, detailTextColor);
-// return this;
-// }
-
- public ShowcaseViewBuilder setText(String titleText, String subText) {
- showcaseView.setText(titleText, subText);
- return this;
- }
-
- public ShowcaseViewBuilder setText(int titleText, int subText) {
- showcaseView.setText(titleText, subText);
- return this;
- }
-
- public ShowcaseViewBuilder pointTo(View view) {
- showcaseView.pointTo(view);
- return this;
- }
-
- public ShowcaseViewBuilder pointTo(float x, float y) {
- showcaseView.pointTo(x, y);
- return this;
- }
-
- public ShowcaseViewBuilder setConfigOptions(ShowcaseView.ConfigOptions configOptions) {
- showcaseView.setConfigOptions(configOptions);
- return this;
- }
-
- public ShowcaseView build(){
- return showcaseView;
- }
-}
diff --git a/libs/ShowcaseView/src/com/espian/showcaseview/ShowcaseViews.java b/libs/ShowcaseView/src/com/espian/showcaseview/ShowcaseViews.java
deleted file mode 100755
index 43745b9..0000000
--- a/libs/ShowcaseView/src/com/espian/showcaseview/ShowcaseViews.java
+++ /dev/null
@@ -1,220 +0,0 @@
-package com.espian.showcaseview;
-
-import android.app.Activity;
-import android.content.Context;
-import android.os.Handler;
-import android.view.View;
-import android.view.ViewGroup;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class ShowcaseViews {
-
- private final List views = new ArrayList();
- private final List animations = new ArrayList();
- private final Activity activity;
- private OnShowcaseAcknowledged showcaseAcknowledgedListener = new OnShowcaseAcknowledged() {
- @Override
- public void onShowCaseAcknowledged(ShowcaseView showcaseView) {
- //DEFAULT LISTENER - DOESN'T DO ANYTHING!
- }
- };
-
- private static final int ABSOLUTE_COORDINATES = 0;
- private static final int RELATIVE_COORDINATES = 1;
-
- public interface OnShowcaseAcknowledged {
- void onShowCaseAcknowledged(ShowcaseView showcaseView);
- }
-
- public ShowcaseViews(Activity activity) {
- this.activity = activity;
- }
-
- public ShowcaseViews(Activity activity, OnShowcaseAcknowledged acknowledgedListener) {
- this(activity);
- this.showcaseAcknowledgedListener = acknowledgedListener;
- }
-
- public ShowcaseViews addView(ItemViewProperties properties) {
- ShowcaseViewBuilder builder = new ShowcaseViewBuilder(activity)
- .setText(properties.titleResId, properties.messageResId)
- .setShowcaseIndicatorScale(properties.scale)
- .setConfigOptions(properties.configOptions);
-
- if(showcaseActionBar(properties)) {
- builder.setShowcaseItem(properties.itemType, properties.id, activity);
- } else if (properties.id == ItemViewProperties.ID_NO_SHOWCASE) {
- builder.setShowcaseNoView();
- } else {
- builder.setShowcaseView(activity.findViewById(properties.id));
- }
-
- ShowcaseView showcaseView = builder.build();
- showcaseView.overrideButtonClick(createShowcaseViewDismissListener(showcaseView));
- views.add(showcaseView);
-
- animations.add(null);
-
- return this;
- }
-
- /**
- * Add an animated gesture to the view at position viewIndex.
- * @param viewIndex The position of the view the gesture should be added to (beginning with 0 for the view which had been added as the first one)
- * @param offsetStartX x-offset of the start position
- * @param offsetStartY y-offset of the start position
- * @param offsetEndX x-offset of the end position
- * @param offsetEndY y-offset of the end position
- * @see com.espian.showcaseview.ShowcaseView#animateGesture(float, float, float, float)
- * @see com.espian.showcaseview.ShowcaseViews#addAnimatedGestureToView(int, float, float, float, float, boolean)
- */
- public void addAnimatedGestureToView(int viewIndex, float offsetStartX, float offsetStartY, float offsetEndX, float offsetEndY) throws IndexOutOfBoundsException {
- addAnimatedGestureToView(viewIndex, offsetStartX, offsetStartY, offsetEndX, offsetEndY, false);
- }
-
- /**
- * Add an animated gesture to the view at position viewIndex.
- * @param viewIndex The position of the view the gesture should be added to (beginning with 0 for the view which had been added as the first one)
- * @param startX x-coordinate or x-offset of the start position
- * @param startY y-coordinate or x-offset of the start position
- * @param endX x-coordinate or x-offset of the end position
- * @param endY y-coordinate or x-offset of the end position
- * @param absoluteCoordinates If true, this will use absolute coordinates instead of coordinates relative to the center of the showcased view
- */
- public void addAnimatedGestureToView(int viewIndex, float startX, float startY, float endX, float endY, boolean absoluteCoordinates) throws IndexOutOfBoundsException {
- animations.remove(viewIndex);
- animations.add(viewIndex, new float[]{absoluteCoordinates?ABSOLUTE_COORDINATES:RELATIVE_COORDINATES, startX, startY, endX, endY});
- }
-
- private boolean showcaseActionBar(ItemViewProperties properties) {
- return properties.itemType > ItemViewProperties.ID_NOT_IN_ACTIONBAR;
- }
-
- private View.OnClickListener createShowcaseViewDismissListener(final ShowcaseView showcaseView) {
- return new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- showcaseView.onClick(showcaseView); //Needed for TYPE_ONE_SHOT
- int fadeOutTime = showcaseView.getConfigOptions().fadeOutDuration;
- if (fadeOutTime > 0) {
- final Handler handler = new Handler();
- handler.postDelayed(new Runnable() {
- @Override
- public void run() {
- showNextView(showcaseView);
- }
- }, fadeOutTime);
- } else {
- showNextView(showcaseView);
- }
- }
- };
- }
-
- private void showNextView(ShowcaseView showcaseView) {
- if (views.isEmpty()) {
- showcaseAcknowledgedListener.onShowCaseAcknowledged(showcaseView);
- } else {
- show();
- }
- }
-
- public void show() {
- if (views.isEmpty()) {
- return;
- }
- final ShowcaseView view = views.get(0);
-
- boolean hasShot = activity.getSharedPreferences(ShowcaseView.PREFS_SHOWCASE_INTERNAL, Context.MODE_PRIVATE)
- .getBoolean("hasShot" + view.getConfigOptions().showcaseId, false);
- if (hasShot && view.getConfigOptions().shotType == ShowcaseView.TYPE_ONE_SHOT) {
- // The showcase has already been shot once, so we don't need to do show it again.
- view.setVisibility(View.GONE);
- views.remove(0);
- animations.remove(0);
- view.getConfigOptions().fadeOutDuration = 0;
- view.performButtonClick();
- return;
- }
-
- view.setVisibility(View.INVISIBLE);
- ((ViewGroup) activity.getWindow().getDecorView()).addView(view);
- view.show();
-
- float[] animation = animations.get(0);
- if (animation != null) {
- view.animateGesture(animation[1], animation[2], animation[3], animation[4], animation[0] == ABSOLUTE_COORDINATES);
- }
-
- views.remove(0);
- animations.remove(0);
- }
-
- public boolean hasViews(){
- return !views.isEmpty();
- }
-
- public static class ItemViewProperties {
-
- public static final int ID_NO_SHOWCASE = -2202;
- public static final int ID_NOT_IN_ACTIONBAR = -1;
- public static final int ID_SPINNER = 0;
- public static final int ID_TITLE = 1;
- public static final int ID_OVERFLOW = 2;
- private static final float DEFAULT_SCALE = 1f;
-
- protected final int titleResId;
- protected final int messageResId;
- protected final int id;
- protected final int itemType;
- protected final float scale;
- protected final ShowcaseView.ConfigOptions configOptions;
-
- public ItemViewProperties(int titleResId, int messageResId) {
- this(ID_NO_SHOWCASE, titleResId, messageResId, ID_NOT_IN_ACTIONBAR, DEFAULT_SCALE, null);
- }
-
- public ItemViewProperties(int id, int titleResId, int messageResId) {
- this(id, titleResId, messageResId, ID_NOT_IN_ACTIONBAR, DEFAULT_SCALE, null);
- }
-
- public ItemViewProperties(int id, int titleResId, int messageResId, float scale) {
- this(id, titleResId, messageResId, ID_NOT_IN_ACTIONBAR, scale, null);
- }
-
- public ItemViewProperties(int id, int titleResId, int messageResId, int itemType) {
- this(id, titleResId, messageResId, itemType, DEFAULT_SCALE, null);
- }
-
- public ItemViewProperties(int id, int titleResId, int messageResId, int itemType, float scale) {
- this(id, titleResId, messageResId, itemType, scale, null);
- }
-
- public ItemViewProperties(int titleResId, int messageResId, ShowcaseView.ConfigOptions configOptions) {
- this(ID_NO_SHOWCASE, titleResId, messageResId, ID_NOT_IN_ACTIONBAR, DEFAULT_SCALE, configOptions);
- }
-
- public ItemViewProperties(int id, int titleResId, int messageResId, ShowcaseView.ConfigOptions configOptions) {
- this(id, titleResId, messageResId, ID_NOT_IN_ACTIONBAR, DEFAULT_SCALE, configOptions);
- }
-
- public ItemViewProperties(int id, int titleResId, int messageResId, float scale, ShowcaseView.ConfigOptions configOptions) {
- this(id, titleResId, messageResId, ID_NOT_IN_ACTIONBAR, scale, configOptions);
- }
-
- public ItemViewProperties(int id, int titleResId, int messageResId, int itemType, ShowcaseView.ConfigOptions configOptions) {
- this(id, titleResId, messageResId, itemType, DEFAULT_SCALE, configOptions);
- }
-
- public ItemViewProperties(int id, int titleResId, int messageResId, int itemType, float scale, ShowcaseView.ConfigOptions configOptions) {
- this.id = id;
- this.titleResId = titleResId;
- this.messageResId = messageResId;
- this.itemType = itemType;
- this.scale = scale;
- this.configOptions = configOptions;
- }
- }
-}
diff --git a/libs/ShowcaseView/src/com/espian/showcaseview/actionbar/ActionBarViewWrapper.java b/libs/ShowcaseView/src/com/espian/showcaseview/actionbar/ActionBarViewWrapper.java
deleted file mode 100755
index c1c9774..0000000
--- a/libs/ShowcaseView/src/com/espian/showcaseview/actionbar/ActionBarViewWrapper.java
+++ /dev/null
@@ -1,126 +0,0 @@
-package com.espian.showcaseview.actionbar;
-
-import android.util.Log;
-import android.view.View;
-import android.view.ViewParent;
-
-import java.lang.reflect.Field;
-
-/**
- * Class which wraps round the many implementations of ActionBarView and allows finding of Action
- * items
- */
-public class ActionBarViewWrapper {
-
- private ViewParent mActionBarView;
- private Class mActionBarViewClass;
- private Class mAbsActionBarViewClass;
-
- public ActionBarViewWrapper(ViewParent actionBarView) {
- if (!actionBarView.getClass().getName().contains("ActionBarView")) {
- String previousP = actionBarView.getClass().getName();
- actionBarView = actionBarView.getParent();
- String throwP = actionBarView.getClass().getName();
- if (!actionBarView.getClass().getName().contains("ActionBarView")) {
- throw new IllegalStateException("Cannot find ActionBarView for " +
- "Activity, instead found " + previousP + " and " + throwP);
- }
- }
- mActionBarView = actionBarView;
- mActionBarViewClass = actionBarView.getClass();
- mAbsActionBarViewClass = actionBarView.getClass().getSuperclass();
- }
-
- /**
- * Return the view which represents the spinner on the ActionBar, or null if there isn't one
- */
- public View getSpinnerView() {
- try {
- Field spinnerField = mActionBarViewClass.getDeclaredField("mSpinner");
- spinnerField.setAccessible(true);
- return (View) spinnerField.get(mActionBarView);
- } catch (NoSuchFieldException e) {
- Log.e("TAG", "Failed to find actionbar spinner", e);
- } catch (IllegalAccessException e) {
- Log.e("TAG", "Failed to access actionbar spinner", e);
- }
- return null;
- }
-
- /**
- * Return the view which represents the title on the ActionBar, or null if there isn't one
- */
- public View getTitleView() {
- try {
- Field mTitleViewField = mActionBarViewClass.getDeclaredField("mTitleView");
- mTitleViewField.setAccessible(true);
- return (View) mTitleViewField.get(mActionBarView);
- } catch (NoSuchFieldException e) {
- Log.e("TAG", "Failed to find actionbar title", e);
- } catch (IllegalAccessException e) {
- Log.e("TAG", "Failed to access actionbar title", e);
- }
- return null;
- }
-
- /**
- * Return the view which represents the overflow action item on the ActionBar, or null if there isn't one
- */
- public View getOverflowView() {
- try {
- Field actionMenuPresenterField = mAbsActionBarViewClass.getDeclaredField("mActionMenuPresenter");
- actionMenuPresenterField.setAccessible(true);
- Object actionMenuPresenter = actionMenuPresenterField.get(mActionBarView);
- Field overflowButtonField = actionMenuPresenter.getClass().getDeclaredField("mOverflowButton");
- overflowButtonField.setAccessible(true);
- return (View) overflowButtonField.get(actionMenuPresenter);
- } catch (IllegalAccessException e) {
- e.printStackTrace();
- } catch (NoSuchFieldException e) {
- e.printStackTrace();
- }
- return null;
- }
-
- public View getActionItem(int actionItemId) {
- try {
- Field actionMenuPresenterField = mAbsActionBarViewClass.getDeclaredField("mActionMenuPresenter");
- actionMenuPresenterField.setAccessible(true);
- Object actionMenuPresenter = actionMenuPresenterField.get(mActionBarView);
-
- Field menuViewField = actionMenuPresenter.getClass().getSuperclass().getDeclaredField("mMenuView");
- menuViewField.setAccessible(true);
- Object menuView = menuViewField.get(actionMenuPresenter);
-
- Field mChField;
- if (menuView.getClass().toString().contains("com.actionbarsherlock")) {
- // There are thousands of superclasses to traverse up
- // Have to get superclasses because mChildren is private
- mChField = menuView.getClass().getSuperclass().getSuperclass()
- .getSuperclass().getSuperclass().getDeclaredField("mChildren");
- } else if (menuView.getClass().toString().contains("android.support.v7")) {
- mChField = menuView.getClass().getSuperclass().getSuperclass()
- .getSuperclass().getDeclaredField("mChildren");
- } else {
- mChField = menuView.getClass().getSuperclass().getSuperclass()
- .getDeclaredField("mChildren");
- }
- mChField.setAccessible(true);
- Object[] mChs = (Object[]) mChField.get(menuView);
- for (Object mCh : mChs) {
- if (mCh != null) {
- View v = (View) mCh;
- if (v.getId() == actionItemId) {
- return v;
- }
- }
- }
- } catch (IllegalAccessException e) {
- e.printStackTrace();
- } catch (NoSuchFieldException e) {
- e.printStackTrace();
- }
- return null;
- }
-
-}
diff --git a/libs/ShowcaseView/src/com/espian/showcaseview/actionbar/reflection/ActionBarReflector.java b/libs/ShowcaseView/src/com/espian/showcaseview/actionbar/reflection/ActionBarReflector.java
deleted file mode 100755
index ec92f99..0000000
--- a/libs/ShowcaseView/src/com/espian/showcaseview/actionbar/reflection/ActionBarReflector.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package com.espian.showcaseview.actionbar.reflection;
-
-import android.app.Activity;
-import android.view.View;
-
-/**
- * Reflector which finds action items in the standard API 11 ActionBar implementation
- */
-public class ActionBarReflector extends BaseReflector {
-
- private Activity mActivity;
-
- public ActionBarReflector(Activity activity) {
- mActivity = activity;
- }
-
- @Override
- public View getHomeButton() {
- View homeButton = mActivity.findViewById(android.R.id.home);
- if (homeButton == null) {
- throw new RuntimeException(
- "insertShowcaseViewWithType cannot be used when the theme " +
- "has no ActionBar");
- }
- return homeButton;
- }
-
- @Override
- public void showcaseActionItem(int itemId) {
-
- }
-}
diff --git a/libs/ShowcaseView/src/com/espian/showcaseview/actionbar/reflection/AppCompatReflector.java b/libs/ShowcaseView/src/com/espian/showcaseview/actionbar/reflection/AppCompatReflector.java
deleted file mode 100755
index b53135d..0000000
--- a/libs/ShowcaseView/src/com/espian/showcaseview/actionbar/reflection/AppCompatReflector.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package com.espian.showcaseview.actionbar.reflection;
-
-import android.app.Activity;
-import android.view.View;
-
-/**
- * Created by Alex on 27/10/13.
- */
-public class AppCompatReflector extends BaseReflector {
-
- private Activity mActivity;
-
- public AppCompatReflector(Activity activity) {
- mActivity = activity;
- }
-
- @Override
- public View getHomeButton() {
- View homeButton = mActivity.findViewById(android.R.id.home);
- if (homeButton != null) {
- return homeButton;
- }
- int homeId = mActivity.getResources().getIdentifier("home", "id", mActivity.getPackageName());
- homeButton = mActivity.findViewById(homeId);
- if (homeButton == null) {
- throw new RuntimeException(
- "insertShowcaseViewWithType cannot be used when the theme " +
- "has no ActionBar");
- }
- return homeButton;
- }
-
- @Override
- public void showcaseActionItem(int itemId) {
-
- }
-}
diff --git a/libs/ShowcaseView/src/com/espian/showcaseview/actionbar/reflection/BaseReflector.java b/libs/ShowcaseView/src/com/espian/showcaseview/actionbar/reflection/BaseReflector.java
deleted file mode 100755
index 50c35b1..0000000
--- a/libs/ShowcaseView/src/com/espian/showcaseview/actionbar/reflection/BaseReflector.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package com.espian.showcaseview.actionbar.reflection;
-
-import android.app.Activity;
-import android.view.View;
-import android.view.ViewParent;
-
-/**
- * Base class which uses reflection to determine how to showcase Action Items and Action Views.
- */
-public abstract class BaseReflector {
-
- public abstract View getHomeButton();
-
- public abstract void showcaseActionItem(int itemId);
-
- public ViewParent getActionBarView() {
- return getHomeButton().getParent().getParent();
- }
-
- public static BaseReflector getReflectorForActivity(Activity activity) {
- switch (searchForActivitySuperClass(activity)) {
- case STANDARD:
- return new ActionBarReflector(activity);
- case APP_COMPAT:
- return new AppCompatReflector(activity);
- case ACTIONBAR_SHERLOCK:
- return new SherlockReflector(activity);
- }
- return null;
- }
-
- private static ActionBarType searchForActivitySuperClass(Activity activity) {
- Class currentLevel = activity.getClass();
- while (currentLevel != Activity.class) {
- if (currentLevel.getSimpleName().equals("SherlockActivity")) {
- return ActionBarType.ACTIONBAR_SHERLOCK;
- }
- if (currentLevel.getSimpleName().equals("ActionBarActivity")) {
- return ActionBarType.APP_COMPAT;
- }
- currentLevel = currentLevel.getSuperclass();
- }
- return ActionBarType.STANDARD;
- }
-
- private enum ActionBarType {
- STANDARD, APP_COMPAT, ACTIONBAR_SHERLOCK
- }
-
-}
diff --git a/libs/ShowcaseView/src/com/espian/showcaseview/actionbar/reflection/SherlockReflector.java b/libs/ShowcaseView/src/com/espian/showcaseview/actionbar/reflection/SherlockReflector.java
deleted file mode 100755
index e8b20ed..0000000
--- a/libs/ShowcaseView/src/com/espian/showcaseview/actionbar/reflection/SherlockReflector.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package com.espian.showcaseview.actionbar.reflection;
-
-import android.app.Activity;
-import android.view.View;
-
-/**
- * Created by Alex on 27/10/13.
- */
-public class SherlockReflector extends BaseReflector {
-
- private Activity mActivity;
-
- public SherlockReflector(Activity activity) {
- mActivity = activity;
- }
-
- @Override
- public View getHomeButton() {
- View homeButton = mActivity.findViewById(android.R.id.home);
- if (homeButton != null) {
- return homeButton;
- }
- int homeId = mActivity.getResources().getIdentifier("abs__home", "id", mActivity.getPackageName());
- homeButton = mActivity.findViewById(homeId);
- if (homeButton == null) {
- throw new RuntimeException(
- "insertShowcaseViewWithType cannot be used when the theme " +
- "has no ActionBar");
- }
- return homeButton;
- }
-
- @Override
- public void showcaseActionItem(int itemId) {
-
- }
-}
diff --git a/libs/ShowcaseView/src/com/espian/showcaseview/anim/AnimationUtils.java b/libs/ShowcaseView/src/com/espian/showcaseview/anim/AnimationUtils.java
deleted file mode 100755
index ed8fd74..0000000
--- a/libs/ShowcaseView/src/com/espian/showcaseview/anim/AnimationUtils.java
+++ /dev/null
@@ -1,140 +0,0 @@
-package com.espian.showcaseview.anim;
-
-import android.os.Handler;
-import android.view.View;
-
-import com.nineoldandroids.animation.Animator;
-import com.nineoldandroids.animation.AnimatorSet;
-import com.nineoldandroids.animation.ObjectAnimator;
-import com.nineoldandroids.view.ViewHelper;
-
-public class AnimationUtils {
-
- public static final int DEFAULT_DURATION = 300;
-
- private static final String ALPHA = "alpha";
- private static final float INVISIBLE = 0f;
- private static final float VISIBLE = 1f;
- private static final String COORD_X = "x";
- private static final String COORD_Y = "y";
- private static final int INSTANT = 0;
-
- public interface AnimationStartListener {
- void onAnimationStart();
- }
-
- public interface AnimationEndListener {
- void onAnimationEnd();
- }
-
- public static float getX(View view) {
- return ViewHelper.getX(view);
- }
-
- public static float getY(View view) {
- return ViewHelper.getY(view);
- }
-
- public static void hide(View view) {
- ViewHelper.setAlpha(view, INVISIBLE);
- }
-
- public static ObjectAnimator createFadeInAnimation(Object target, final AnimationStartListener listener) {
- return createFadeInAnimation(target, DEFAULT_DURATION, listener);
- }
-
- public static ObjectAnimator createFadeInAnimation(Object target, int duration, final AnimationStartListener listener) {
- ObjectAnimator oa = ObjectAnimator.ofFloat(target, ALPHA, INVISIBLE, VISIBLE);
- oa.setDuration(duration).addListener(new Animator.AnimatorListener() {
- @Override
- public void onAnimationStart(Animator animator) {
- listener.onAnimationStart();
- }
-
- @Override
- public void onAnimationEnd(Animator animator) {
- }
-
- @Override
- public void onAnimationCancel(Animator animator) {
- }
-
- @Override
- public void onAnimationRepeat(Animator animator) {
- }
- });
- return oa;
- }
-
- public static ObjectAnimator createFadeOutAnimation(Object target, final AnimationEndListener listener) {
- return createFadeOutAnimation(target, DEFAULT_DURATION, listener);
- }
-
- public static ObjectAnimator createFadeOutAnimation(Object target, int duration, final AnimationEndListener listener) {
- ObjectAnimator oa = ObjectAnimator.ofFloat(target, ALPHA, INVISIBLE);
- oa.setDuration(duration).addListener(new Animator.AnimatorListener() {
- @Override
- public void onAnimationStart(Animator animator) {
- }
-
- @Override
- public void onAnimationEnd(Animator animator) {
- listener.onAnimationEnd();
- }
-
- @Override
- public void onAnimationCancel(Animator animator) {
- }
-
- @Override
- public void onAnimationRepeat(Animator animator) {
- }
- });
- return oa;
- }
-
- public static AnimatorSet createMovementAnimation(View view, float canvasX, float canvasY,
- float offsetStartX, float offsetStartY,
- float offsetEndX, float offsetEndY,
- final AnimationEndListener listener) {
- ViewHelper.setAlpha(view, INVISIBLE);
-
- ObjectAnimator alphaIn = ObjectAnimator.ofFloat(view, ALPHA, INVISIBLE, VISIBLE).setDuration(500);
-
- ObjectAnimator setUpX = ObjectAnimator.ofFloat(view, COORD_X, canvasX + offsetStartX).setDuration(INSTANT);
- ObjectAnimator setUpY = ObjectAnimator.ofFloat(view, COORD_Y, canvasY + offsetStartY).setDuration(INSTANT);
-
- ObjectAnimator moveX = ObjectAnimator.ofFloat(view, COORD_X, canvasX + offsetEndX).setDuration(1000);
- ObjectAnimator moveY = ObjectAnimator.ofFloat(view, COORD_Y, canvasY + offsetEndY).setDuration(1000);
- moveX.setStartDelay(1000);
- moveY.setStartDelay(1000);
-
- ObjectAnimator alphaOut = ObjectAnimator.ofFloat(view, ALPHA, INVISIBLE).setDuration(500);
- alphaOut.setStartDelay(2500);
-
- AnimatorSet as = new AnimatorSet();
- as.play(setUpX).with(setUpY).before(alphaIn).before(moveX).with(moveY).before(alphaOut);
-
- Handler handler = new Handler();
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- listener.onAnimationEnd();
- }
- };
- handler.postDelayed(runnable, 3000);
-
- return as;
- }
-
- public static AnimatorSet createMovementAnimation(View view, float x, float y) {
- ObjectAnimator alphaIn = ObjectAnimator.ofFloat(view, ALPHA, INVISIBLE, VISIBLE).setDuration(500);
-
- ObjectAnimator setUpX = ObjectAnimator.ofFloat(view, COORD_X, x).setDuration(INSTANT);
- ObjectAnimator setUpY = ObjectAnimator.ofFloat(view, COORD_Y, y).setDuration(INSTANT);
-
- AnimatorSet as = new AnimatorSet();
- as.play(setUpX).with(setUpY).before(alphaIn);
- return as;
- }
-}
diff --git a/libs/ShowcaseView/src/com/espian/showcaseview/drawing/ClingDrawer.java b/libs/ShowcaseView/src/com/espian/showcaseview/drawing/ClingDrawer.java
deleted file mode 100755
index 11e9c4f..0000000
--- a/libs/ShowcaseView/src/com/espian/showcaseview/drawing/ClingDrawer.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.espian.showcaseview.drawing;
-
-import com.espian.showcaseview.utils.ShowcaseAreaCalculator;
-
-import android.graphics.Canvas;
-
-/**
- * Created by curraa01 on 13/10/2013.
- */
-public interface ClingDrawer extends ShowcaseAreaCalculator {
-
- void drawShowcase(Canvas canvas, float x, float y, float scaleMultiplier, float radius);
-
- int getShowcaseWidth();
-
- int getShowcaseHeight();
-
-}
diff --git a/libs/ShowcaseView/src/com/espian/showcaseview/drawing/ClingDrawerImpl.java b/libs/ShowcaseView/src/com/espian/showcaseview/drawing/ClingDrawerImpl.java
deleted file mode 100755
index 5ab8631..0000000
--- a/libs/ShowcaseView/src/com/espian/showcaseview/drawing/ClingDrawerImpl.java
+++ /dev/null
@@ -1,99 +0,0 @@
-package com.espian.showcaseview.drawing;
-
-import android.os.Build;
-import android.content.res.Resources;
-import android.graphics.Canvas;
-import android.graphics.Matrix;
-import android.graphics.Paint;
-import android.graphics.PorterDuff;
-import android.graphics.PorterDuffXfermode;
-import android.graphics.Rect;
-import android.graphics.drawable.Drawable;
-import android.util.Log;
-
-import com.github.espiandev.showcaseview.R;
-
-/**
- * Created by curraa01 on 13/10/2013.
- */
-public class ClingDrawerImpl implements ClingDrawer {
-
- private Paint mEraser;
- private Drawable mShowcaseDrawable;
- private Rect mShowcaseRect;
-
- public ClingDrawerImpl(Resources resources, int showcaseColor) {
- PorterDuffXfermode mBlender = new PorterDuffXfermode(PorterDuff.Mode.CLEAR);
- mEraser = new Paint();
- mEraser.setColor(0xFFFFFF);
- mEraser.setAlpha(0);
- mEraser.setXfermode(mBlender);
- mEraser.setAntiAlias(true);
-
- mShowcaseDrawable = resources.getDrawable(R.drawable.cling_bleached);
- mShowcaseDrawable.setColorFilter(showcaseColor, PorterDuff.Mode.MULTIPLY);
- }
-
- @Override
- public void drawShowcase(Canvas canvas, float x, float y, float scaleMultiplier, float radius) {
- Matrix mm = new Matrix();
- mm.postScale(scaleMultiplier, scaleMultiplier, x, y);
- canvas.setMatrix(mm);
-
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
- canvas.drawCircle(x, y, radius, mEraser);
- }
-
- mShowcaseDrawable.setBounds(mShowcaseRect);
- mShowcaseDrawable.draw(canvas);
-
- canvas.setMatrix(new Matrix());
- }
-
- @Override
- public int getShowcaseWidth() {
- return mShowcaseDrawable.getIntrinsicWidth();
- }
-
- @Override
- public int getShowcaseHeight() {
- return mShowcaseDrawable.getIntrinsicHeight();
- }
-
- /**
- * Creates a {@link android.graphics.Rect} which represents the area the showcase covers. Used
- * to calculate where best to place the text
- *
- * @return true if voidedArea has changed, false otherwise.
- */
- public boolean calculateShowcaseRect(float x, float y) {
-
- if (mShowcaseRect == null) {
- mShowcaseRect = new Rect();
- }
-
- int cx = (int) x, cy = (int) y;
- int dw = getShowcaseWidth();
- int dh = getShowcaseHeight();
-
- if (mShowcaseRect.left == cx - dw / 2) {
- return false;
- }
-
- Log.d("ShowcaseView", "Recalculated");
-
- mShowcaseRect.left = cx - dw / 2;
- mShowcaseRect.top = cy - dh / 2;
- mShowcaseRect.right = cx + dw / 2;
- mShowcaseRect.bottom = cy + dh / 2;
-
- return true;
-
- }
-
- @Override
- public Rect getShowcaseRect() {
- return mShowcaseRect;
- }
-
-}
diff --git a/libs/ShowcaseView/src/com/espian/showcaseview/drawing/TextDrawer.java b/libs/ShowcaseView/src/com/espian/showcaseview/drawing/TextDrawer.java
deleted file mode 100755
index 9c1aaea..0000000
--- a/libs/ShowcaseView/src/com/espian/showcaseview/drawing/TextDrawer.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.espian.showcaseview.drawing;
-
-import com.espian.showcaseview.ShowcaseView;
-
-import android.content.Context;
-import android.graphics.Canvas;
-
-/**
- * Created by curraa01 on 13/10/2013.
- */
-public interface TextDrawer {
-
- void draw(Canvas canvas, boolean hasPositionChanged);
-
- void setDetails(CharSequence details);
-
- void setTitle(CharSequence title);
-
- void calculateTextPosition(int canvasW, int canvasH, ShowcaseView showcaseView);
-
- void setTitleStyling(Context context, int styleId);
-
- void setDetailStyling(Context context, int styleId);
-}
diff --git a/libs/ShowcaseView/src/com/espian/showcaseview/drawing/TextDrawerImpl.java b/libs/ShowcaseView/src/com/espian/showcaseview/drawing/TextDrawerImpl.java
deleted file mode 100755
index bb8b028..0000000
--- a/libs/ShowcaseView/src/com/espian/showcaseview/drawing/TextDrawerImpl.java
+++ /dev/null
@@ -1,187 +0,0 @@
-package com.espian.showcaseview.drawing;
-
-import com.espian.showcaseview.ShowcaseView;
-import com.espian.showcaseview.utils.ShowcaseAreaCalculator;
-
-import android.content.Context;
-import android.graphics.Canvas;
-import android.graphics.Rect;
-import android.text.DynamicLayout;
-import android.text.Layout;
-import android.text.SpannableString;
-import android.text.TextPaint;
-import android.text.TextUtils;
-import android.text.style.TextAppearanceSpan;
-
-/**
- * Draws the text as required by the ShowcaseView
- */
-public class TextDrawerImpl implements TextDrawer {
-
- private static final int PADDING = 24;
- private static final int ACTIONBAR_PADDING = 66;
-
- private final TextPaint mPaintTitle;
- private final TextPaint mPaintDetail;
-
- private CharSequence mTitle, mDetails;
- private float mDensityScale;
- private ShowcaseAreaCalculator mCalculator;
- private float[] mBestTextPosition = new float[3];
- private DynamicLayout mDynamicTitleLayout;
- private DynamicLayout mDynamicDetailLayout;
- private TextAppearanceSpan mTitleSpan;
- private TextAppearanceSpan mDetailSpan;
-
- public TextDrawerImpl(float densityScale, ShowcaseAreaCalculator calculator) {
- mDensityScale = densityScale;
- mCalculator = calculator;
-
- mPaintTitle = new TextPaint();
- mPaintTitle.setAntiAlias(true);
-
- mPaintDetail = new TextPaint();
- mPaintDetail.setAntiAlias(true);
- }
-
- @Override
- public void draw(Canvas canvas, boolean hasPositionChanged) {
- if (shouldDrawText()) {
- float[] textPosition = getBestTextPosition();
-
- if (!TextUtils.isEmpty(mTitle)) {
- canvas.save();
- if (hasPositionChanged) {
- mDynamicTitleLayout = new DynamicLayout(mTitle, mPaintTitle,
- (int) textPosition[2], Layout.Alignment.ALIGN_NORMAL,
- 1.0f, 1.0f, true);
- }
- canvas.translate(textPosition[0], textPosition[1]);
- mDynamicTitleLayout.draw(canvas);
- canvas.restore();
- }
-
- if (!TextUtils.isEmpty(mDetails)) {
- canvas.save();
- if (hasPositionChanged) {
- mDynamicDetailLayout = new DynamicLayout(mDetails, mPaintDetail,
- (int) textPosition[2],
- Layout.Alignment.ALIGN_NORMAL,
- 1.2f, 1.0f, true);
- }
- canvas.translate(textPosition[0], textPosition[1] + mDynamicTitleLayout.getHeight());
- mDynamicDetailLayout.draw(canvas);
- canvas.restore();
-
- }
- }
- }
-
- @Override
- public void setDetails(CharSequence details) {
- if (details != null) {
- SpannableString ssbDetail = new SpannableString(details);
- ssbDetail.setSpan(mDetailSpan, 0, ssbDetail.length(), 0);
- mDetails = ssbDetail;
- }
- }
-
- @Override
- public void setTitle(CharSequence title) {
- if (title != null) {
- SpannableString ssbTitle = new SpannableString(title);
- ssbTitle.setSpan(mTitleSpan, 0, ssbTitle.length(), 0);
- mTitle = ssbTitle;
- }
- }
-
- /**
- * Calculates the best place to position text
- *
- * @param canvasW width of the screen
- * @param canvasH height of the screen
- */
- @Override
- public void calculateTextPosition(int canvasW, int canvasH, ShowcaseView showcaseView) {
-
- Rect showcase = showcaseView.hasShowcaseView() ?
- mCalculator.getShowcaseRect() :
- new Rect();
-
- int[] areas = new int[4]; //left, top, right, bottom
- areas[0] = showcase.left * canvasH;
- areas[1] = showcase.top * canvasW;
- areas[2] = (canvasW - showcase.right) * canvasH;
- areas[3] = (canvasH - showcase.bottom) * canvasW;
-
- int largest = 0;
- for(int i = 1; i < areas.length; i++) {
- if(areas[i] > areas[largest])
- largest = i;
- }
-
- // Position text in largest area
- switch(largest) {
- case 0:
- mBestTextPosition[0] = PADDING * mDensityScale;
- mBestTextPosition[1] = PADDING * mDensityScale;
- mBestTextPosition[2] = showcase.left - 2 * PADDING * mDensityScale;
- break;
- case 1:
- mBestTextPosition[0] = PADDING * mDensityScale;
- mBestTextPosition[1] = (PADDING + ACTIONBAR_PADDING) * mDensityScale;
- mBestTextPosition[2] = canvasW - 2 * PADDING * mDensityScale;
- break;
- case 2:
- mBestTextPosition[0] = showcase.right + PADDING * mDensityScale;
- mBestTextPosition[1] = PADDING * mDensityScale;
- mBestTextPosition[2] = (canvasW - showcase.right) - 2 * PADDING * mDensityScale;
- break;
- case 3:
- mBestTextPosition[0] = PADDING * mDensityScale;
- mBestTextPosition[1] = showcase.bottom + PADDING * mDensityScale;
- mBestTextPosition[2] = canvasW - 2 * PADDING * mDensityScale;
- break;
- }
- if(showcaseView.getConfigOptions().centerText) {
- // Center text vertically or horizontally
- switch(largest) {
- case 0:
- case 2:
- mBestTextPosition[1] += canvasH / 4;
- break;
- case 1:
- case 3:
- mBestTextPosition[2] /= 2;
- mBestTextPosition[0] += canvasW / 4;
- break;
- }
- } else {
- // As text is not centered add actionbar padding if the text is left or right
- switch(largest) {
- case 0:
- case 2:
- mBestTextPosition[1] += ACTIONBAR_PADDING * mDensityScale;
- break;
- }
- }
- }
-
- @Override
- public void setTitleStyling(Context context, int styleId) {
- mTitleSpan = new TextAppearanceSpan(context, styleId);
- }
-
- @Override
- public void setDetailStyling(Context context, int styleId) {
- mDetailSpan = new TextAppearanceSpan(context, styleId);
- }
-
- public float[] getBestTextPosition() {
- return mBestTextPosition;
- }
-
- public boolean shouldDrawText() {
- return !TextUtils.isEmpty(mTitle) || !TextUtils.isEmpty(mDetails);
- }
-}
diff --git a/libs/ShowcaseView/src/com/espian/showcaseview/targets/ActionItemTarget.java b/libs/ShowcaseView/src/com/espian/showcaseview/targets/ActionItemTarget.java
deleted file mode 100755
index c32cdb5..0000000
--- a/libs/ShowcaseView/src/com/espian/showcaseview/targets/ActionItemTarget.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.espian.showcaseview.targets;
-
-import android.app.Activity;
-import android.graphics.Point;
-import android.view.ViewParent;
-
-import com.espian.showcaseview.actionbar.ActionBarViewWrapper;
-import com.espian.showcaseview.actionbar.reflection.BaseReflector;
-
-public class ActionItemTarget implements Target {
-
- private final Activity mActivity;
- private final int mItemId;
-
- ActionBarViewWrapper mActionBarWrapper;
-
- public ActionItemTarget(Activity activity, int itemId) {
- mActivity = activity;
- mItemId = itemId;
- }
-
- @Override
- public Point getPoint() {
- setUp();
- return new ViewTarget(mActionBarWrapper.getActionItem(mItemId)).getPoint();
- }
-
- protected void setUp() {
- BaseReflector reflector = BaseReflector.getReflectorForActivity(mActivity);
- ViewParent p = reflector.getActionBarView(); //ActionBarView
- mActionBarWrapper = new ActionBarViewWrapper(p);
- }
-
-}
diff --git a/libs/ShowcaseView/src/com/espian/showcaseview/targets/ActionViewTarget.java b/libs/ShowcaseView/src/com/espian/showcaseview/targets/ActionViewTarget.java
deleted file mode 100755
index 89ba81e..0000000
--- a/libs/ShowcaseView/src/com/espian/showcaseview/targets/ActionViewTarget.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package com.espian.showcaseview.targets;
-
-import android.app.Activity;
-import android.graphics.Point;
-import android.view.ViewParent;
-
-import com.espian.showcaseview.actionbar.ActionBarViewWrapper;
-import com.espian.showcaseview.actionbar.reflection.BaseReflector;
-
-public class ActionViewTarget implements Target {
-
- private final Activity mActivity;
- private final Type mType;
-
- ActionBarViewWrapper mActionBarWrapper;
- BaseReflector mReflector;
-
- public ActionViewTarget(Activity activity, Type type) {
- mActivity = activity;
- mType = type;
- }
-
- protected void setUp() {
- mReflector = BaseReflector.getReflectorForActivity(mActivity);
- ViewParent p = mReflector.getActionBarView(); //ActionBarView
- mActionBarWrapper = new ActionBarViewWrapper(p);
- }
-
- @Override
- public Point getPoint() {
- Target internal = null;
- setUp();
- switch (mType) {
-
- case SPINNER:
- internal = new ViewTarget(mActionBarWrapper.getSpinnerView());
- break;
-
- case HOME:
- internal = new ViewTarget(mReflector.getHomeButton());
- break;
-
- case OVERFLOW:
- internal = new ViewTarget(mActionBarWrapper.getOverflowView());
- break;
-
- case TITLE:
- internal = new ViewTarget(mActionBarWrapper.getTitleView());
- break;
-
- }
- return internal.getPoint();
- }
-
- public enum Type {
- SPINNER, HOME, TITLE, OVERFLOW
- }
-}
diff --git a/libs/ShowcaseView/src/com/espian/showcaseview/targets/PointTarget.java b/libs/ShowcaseView/src/com/espian/showcaseview/targets/PointTarget.java
deleted file mode 100755
index cd9a500..0000000
--- a/libs/ShowcaseView/src/com/espian/showcaseview/targets/PointTarget.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package com.espian.showcaseview.targets;
-
-import android.graphics.Point;
-
-public class PointTarget implements Target {
-
- private final Point mPoint;
-
- public PointTarget(Point point) {
- mPoint = point;
- }
-
- public PointTarget(int xValue, int yValue) {
- mPoint = new Point(xValue, yValue);
- }
-
- @Override
- public Point getPoint() {
- return mPoint;
- }
-}
diff --git a/libs/ShowcaseView/src/com/espian/showcaseview/targets/Target.java b/libs/ShowcaseView/src/com/espian/showcaseview/targets/Target.java
deleted file mode 100755
index 15d28cd..0000000
--- a/libs/ShowcaseView/src/com/espian/showcaseview/targets/Target.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package com.espian.showcaseview.targets;
-
-import android.graphics.Point;
-
-public interface Target {
- public Point getPoint();
-}
diff --git a/libs/ShowcaseView/src/com/espian/showcaseview/targets/ViewTarget.java b/libs/ShowcaseView/src/com/espian/showcaseview/targets/ViewTarget.java
deleted file mode 100755
index 6fcad82..0000000
--- a/libs/ShowcaseView/src/com/espian/showcaseview/targets/ViewTarget.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package com.espian.showcaseview.targets;
-
-import android.app.Activity;
-import android.graphics.Point;
-import android.view.View;
-
-public class ViewTarget implements Target {
-
- private final View mView;
-
- public ViewTarget(View view) {
- mView = view;
- }
-
- public ViewTarget(int viewId, Activity activity) {
- mView = activity.findViewById(viewId);
- }
-
- @Override
- public Point getPoint() {
- int[] location = new int[2];
- mView.getLocationInWindow(location);
- int x = location[0] + mView.getWidth() / 2;
- int y = location[1] + mView.getHeight() / 2;
- return new Point(x, y);
- }
-}
diff --git a/libs/ShowcaseView/src/com/espian/showcaseview/utils/Calculator.java b/libs/ShowcaseView/src/com/espian/showcaseview/utils/Calculator.java
deleted file mode 100755
index c7b1c83..0000000
--- a/libs/ShowcaseView/src/com/espian/showcaseview/utils/Calculator.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package com.espian.showcaseview.utils;
-
-import android.graphics.Point;
-import android.view.View;
-
-import com.espian.showcaseview.ShowcaseView;
-
-/**
- * Calculates various items for use with ShowcaseView
- */
-public class Calculator {
-
- public static final Point getShowcasePointFromView(View view, ShowcaseView.ConfigOptions options) {
- Point result = new Point();
- if (options.insert == ShowcaseView.INSERT_TO_VIEW) {
- result.x = view.getLeft() + view.getWidth() / 2;
- result.y = view.getTop() + view.getHeight() / 2;
- } else {
- int[] coordinates = new int[2];
- view.getLocationInWindow(coordinates);
- result.x = coordinates[0] + view.getWidth() / 2;
- result.y = coordinates[1] + view.getHeight() / 2;
- }
- return result;
- }
-
-}
diff --git a/libs/ShowcaseView/src/com/espian/showcaseview/utils/PointAnimator.java b/libs/ShowcaseView/src/com/espian/showcaseview/utils/PointAnimator.java
deleted file mode 100755
index 8570085..0000000
--- a/libs/ShowcaseView/src/com/espian/showcaseview/utils/PointAnimator.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package com.espian.showcaseview.utils;
-
-import android.graphics.Point;
-
-import com.espian.showcaseview.ShowcaseView;
-import com.nineoldandroids.animation.Animator;
-import com.nineoldandroids.animation.AnimatorSet;
-import com.nineoldandroids.animation.ObjectAnimator;
-
-public class PointAnimator {
-
- public static Animator ofPoints(Object object, String xMethod, String yMethod, Point... values) {
- AnimatorSet set = new AnimatorSet();
- int[] xValues = new int[values.length];
- int[] yValues = new int[values.length];
- for (int i = 0; i < values.length; i++) {
- xValues[i] = values[i].x;
- yValues[i] = values[i].y;
- }
- ObjectAnimator xAnimator = ObjectAnimator.ofInt(object, xMethod, xValues);
- ObjectAnimator yAnimator = ObjectAnimator.ofInt(object, yMethod, yValues);
- set.playTogether(xAnimator, yAnimator);
- return set;
- }
-
- public static Animator ofPoints(ShowcaseView showcaseView, Point... values) {
- return ofPoints(showcaseView, "showcaseX", "showcaseY", values);
- }
-
-}
diff --git a/libs/ShowcaseView/src/com/espian/showcaseview/utils/ShowcaseAreaCalculator.java b/libs/ShowcaseView/src/com/espian/showcaseview/utils/ShowcaseAreaCalculator.java
deleted file mode 100755
index 201c4be..0000000
--- a/libs/ShowcaseView/src/com/espian/showcaseview/utils/ShowcaseAreaCalculator.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.espian.showcaseview.utils;
-
-import android.graphics.Rect;
-
-/**
- * Class responsible for calculating where the Showcase should position itself
- */
-public interface ShowcaseAreaCalculator {
-
- boolean calculateShowcaseRect(float showcaseX, float showcaseY);
-
- Rect getShowcaseRect();
-}
diff --git a/libs/XposedBridgeApi.jar b/libs/XposedBridgeApi.jar
deleted file mode 100755
index 4262412..0000000
Binary files a/libs/XposedBridgeApi.jar and /dev/null differ
diff --git a/project.properties b/project.properties
index 183f993..afc4669 100755
--- a/project.properties
+++ b/project.properties
@@ -9,4 +9,5 @@
# Project target.
target=android-19
+android.library=false
android.library.reference.1=libs/ShowcaseView
diff --git a/res/drawable-hdpi/arrow_down.png b/res/drawable-hdpi/arrow_down.png
new file mode 100755
index 0000000..9155151
Binary files /dev/null and b/res/drawable-hdpi/arrow_down.png differ
diff --git a/res/drawable-hdpi/arrow_up.png b/res/drawable-hdpi/arrow_up.png
new file mode 100755
index 0000000..3222d92
Binary files /dev/null and b/res/drawable-hdpi/arrow_up.png differ
diff --git a/res/drawable-xhdpi/arrow_down.png b/res/drawable-xhdpi/arrow_down.png
new file mode 100755
index 0000000..1f6fd44
Binary files /dev/null and b/res/drawable-xhdpi/arrow_down.png differ
diff --git a/res/drawable-xhdpi/arrow_up.png b/res/drawable-xhdpi/arrow_up.png
new file mode 100755
index 0000000..1615240
Binary files /dev/null and b/res/drawable-xhdpi/arrow_up.png differ
diff --git a/res/layout/item_listview_blacklist.xml b/res/layout/item_listview_perapp.xml
similarity index 59%
rename from res/layout/item_listview_blacklist.xml
rename to res/layout/item_listview_perapp.xml
index d0f2484..6cd78e4 100755
--- a/res/layout/item_listview_blacklist.xml
+++ b/res/layout/item_listview_perapp.xml
@@ -3,14 +3,14 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:gravity="center"
+ android:gravity="start"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp">
@@ -19,25 +19,13 @@
android:layout_height="40dp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_width="wrap_content"
- android:id="@+id/blacklist_app_name"
- android:layout_toRightOf="@id/blacklist_app_icon"
+ android:id="@+id/per_app_name"
+ android:layout_toRightOf="@id/per_app_icon"
android:layout_gravity="center_vertical"
android:gravity="center_vertical"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:layout_marginLeft="5dp"/>
-
-
diff --git a/res/layout/slider_preference.xml b/res/layout/slider_preference.xml
new file mode 100755
index 0000000..a1829e9
--- /dev/null
+++ b/res/layout/slider_preference.xml
@@ -0,0 +1,108 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/res/menu/blacklist.xml b/res/menu/perapp.xml
similarity index 58%
rename from res/menu/blacklist.xml
rename to res/menu/perapp.xml
index 1208fe9..bf7836e 100755
--- a/res/menu/blacklist.xml
+++ b/res/menu/perapp.xml
@@ -1,8 +1,8 @@
diff --git a/res/menu/settings.xml b/res/menu/settings.xml
new file mode 100755
index 0000000..14c59a6
--- /dev/null
+++ b/res/menu/settings.xml
@@ -0,0 +1,8 @@
+
diff --git a/res/values-de/strings.xml b/res/values-de/strings.xml
new file mode 100755
index 0000000..8d262c5
--- /dev/null
+++ b/res/values-de/strings.xml
@@ -0,0 +1,41 @@
+
+
+
+ SwipeBack
+ Aktiviert eine allumfassende Geste zum Zurückwischen.
+
+
+ Bitte warten...
+
+
+ Swipe Back
+ Seite
+ Links
+ Rechts
+ Unten
+ Größe der Kante
+ Empfindlichkeit
+
+
+ Oberfläche wieder aufbereiten
+ Deaktivieren hiervon repariert womöglich Abstürze. \nNUR FÜR FORTGESCHRITTENE NUTZER. \n VERLANGT NEUSTART
+
+
+ Über
+ SwipeBack Version
+ Entwickler
+ \@PeterCxy \n\@Issacw0ng
+ Community
+ Besuche die Seite unserer Community
+ http://forum.xda-developers.com/showthread.php?t=2592116
+ Homepage
+ Besuche unsere Website
+ http://losp.info
+
+
+ Allumfassende Einstellungen (Werden von den unteren Einstellungen überschrieben)
+
+
+ Zurücksetzen
+
+
diff --git a/res/values-hu/strings.xml b/res/values-hu/strings.xml
new file mode 100755
index 0000000..dd6a912
--- /dev/null
+++ b/res/values-hu/strings.xml
@@ -0,0 +1,26 @@
+
+
+ OKÉ
+ SwipeBack
+ Lehetővé teszi a globális visszahúzást.
+ Kérem várjon...
+ Visszahúzás
+ Húzás kezdési oldal
+ Bal
+ Jobb
+ Alul
+ Oldal mérete
+ Névjegy
+ SwipeBack Verzió
+ Fejlesztők
+ "\@PeterCxy
+@Issacw0ng"
+ Közösség
+ Elérhetőség
+ http://forum.xda-developers.com/showthread.php?t=2592116
+ Húzás érzékenység
+ Újrahasznositott felület
+ "Ha kikapcsolja, néhány javitás összeomolhat.
+ CSAK HALADÓ FELHASZNÁLÓKNAK.
+ ÚJRAINDITÁS SZÜKSÉGES"
+
diff --git a/res/values-zh-rCN/strings.xml b/res/values-zh-rCN/strings.xml
index 81b4b80..75056de 100755
--- a/res/values-zh-rCN/strings.xml
+++ b/res/values-zh-rCN/strings.xml
@@ -2,19 +2,7 @@
滑动返回
- 开启全局滑动返回支持
-
-
- 继续
- 完成
- 欢迎
- 欢迎使用滑动返回. \n滑动返回将带给您全新的Android体验. \n按 "继续" 进入向导.
- 启用
- 在Xposed框架中激活后,勾选这里的“启用”,滑动返回才会工作. \n开启和关闭滑动返回需要重启正在运行的程序才能生效.
- 边缘
- 你可以自定义滑动边缘. \n例如. "左边" 代表您可以从一个Activity的左边划到右边来结束它.
- 结束
- 向导结束. \n好好享受吧!
+ 开启滑动返回支持
请稍候...
@@ -26,15 +14,11 @@
右边
底边
边缘大小
+ 滑动灵敏度
-
- 黑/白名单
- 在选择的app上禁用
- 黑
-
-
- 只在选择的app上启用
- 白
+
+ 回收Surface
+ 禁用本选项可能修复部分FC现象. \n仅供高级用户. \n重启生效
关于
@@ -43,5 +27,14 @@
\@喝雪碧的虾 \n\@碎星iKe
社区
访问我们的讨论链接
+ 主页
+ 浏览我们的网站
+ http://shandian.us
+
+
+ 全局设置(可被以下设置覆盖)
+
+
+ 重置
diff --git a/res/values-zh-rTW/strings.xml b/res/values-zh-rTW/strings.xml
new file mode 100644
index 0000000..4650a21
--- /dev/null
+++ b/res/values-zh-rTW/strings.xml
@@ -0,0 +1,37 @@
+
+
+
+ 滑動返回
+ 開啟滑動返回支援
+
+
+ 請稍候...
+
+
+ 滑動返回手勢
+ 滑動邊緣
+ 左邊
+ 右邊
+ 下面
+ 邊緣大小
+ 滑動敏感度
+
+
+ 回收Surface
+ 停用本選項可能修正部分FC現象. \n僅供進階使用者. \n重開機後生效
+
+
+ 關於
+ 滑動返回 修訂版本
+ 開發人員
+ \@喝雪碧的虾 \n\@碎星iKe
+ 社群
+ 訪問我們的討論連結
+
+
+ 全局設定(可被以下設定覆蓋)
+
+
+ 重設
+
+
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 1c6df4f..9a5a953 100755
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -4,20 +4,8 @@
SwipeBack
Enables global swipe back gesture.
-
- Next
- Finish
- Welcome
- Welcome to SwipeBack. \nSwipeBack will greatly improve your Android experience. \nPress "Next" to continue.
- Enable
- After enabling SwipeBack in Xposed Framework, tick the checkbox, then SwipeBack will work for you. \nEnabing/Disabling this needs restart of each running app.
- Edges
- You can choose swipe edges to use. \ne.g. "Left" means you can swipe from the left of each activity to the right to finish it.
- Over
- Tutorial finished. \nEnjoy!
-
- Plese wait...
+ Please wait...
Swipe Back
@@ -26,15 +14,11 @@
Right
Bottom
Edge Size
+ Swipe Sensitivity
-
- Black/Whitelist
- Disable on selected apps
- Black
-
-
- Enable only on selected apps
- White
+
+ Recycle surface
+ Disabling this may fix some crashes. \nONLY FOR ADVANCED USERS. \n NEEDS REBOOT
About
@@ -44,5 +28,14 @@
Community
Access our community url
http://forum.xda-developers.com/showthread.php?t=2592116
+ Home Page
+ Visit our website
+ http://losp.info
+
+
+ Global Settings (Can be overridden by the following)
+
+
+ Reset
diff --git a/res/xml/swipeback_about.xml b/res/xml/swipeback_about.xml
index 91001e8..3659d30 100755
--- a/res/xml/swipeback_about.xml
+++ b/res/xml/swipeback_about.xml
@@ -17,4 +17,11 @@
android:title="@string/swipe_community_title"
android:summary="@string/swipe_community_summary">
+
+
+
+
diff --git a/res/xml/swipeback_settings.xml b/res/xml/swipeback_settings.xml
index 6609ef6..fad8e03 100755
--- a/res/xml/swipeback_settings.xml
+++ b/res/xml/swipeback_settings.xml
@@ -7,6 +7,13 @@
android:title="@string/swipe_enable"
android:defaultValue="true"/>
+
+
-
-
-
-
-
-
+
diff --git a/src/us/shandian/mod/swipeback/adapter/ApplicationAdapter.java b/src/us/shandian/mod/swipeback/adapter/ApplicationAdapter.java
index 255e640..477779f 100755
--- a/src/us/shandian/mod/swipeback/adapter/ApplicationAdapter.java
+++ b/src/us/shandian/mod/swipeback/adapter/ApplicationAdapter.java
@@ -14,7 +14,6 @@
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
-import android.widget.CheckBox;
import android.widget.TextView;
import android.widget.ImageView;
@@ -23,7 +22,6 @@
public class ApplicationAdapter extends ArrayAdapter
{
private List mAppsList = null;
- private List mCheckBoxes = new ArrayList();
private List mViews = new ArrayList();
private Context mContext;
private PackageManager mPackageManager;
@@ -49,21 +47,26 @@ public int compare(ApplicationInfo p1, ApplicationInfo p2)
});
+ // Add "Global"
+ ApplicationInfo info = new ApplicationInfo();
+ info.packageName = mContext.getResources().getString(R.string.swipe_global);
+ mAppsList.add(0, info);
+
for (int i = 0; i < mAppsList.size(); i++) {
LayoutInflater layoutInflater = (LayoutInflater) mContext
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- View view = layoutInflater.inflate(R.layout.item_listview_blacklist, null);
+ View view = layoutInflater.inflate(R.layout.item_listview_perapp, null);
ApplicationInfo data = mAppsList.get(i);
if (null != data) {
- TextView appName = (TextView) view.findViewById(R.id.blacklist_app_name);
- ImageView iconview = (ImageView) view.findViewById(R.id.blacklist_app_icon);
- CheckBox checkBox = (CheckBox) view.findViewById(R.id.blacklist_checkbox);
-
- checkBox.setChecked(true);
- appName.setText(data.loadLabel(mPackageManager));
- iconview.setImageDrawable(data.loadIcon(mPackageManager));
-
- mCheckBoxes.add(checkBox);
+ TextView appName = (TextView) view.findViewById(R.id.per_app_name);
+ ImageView iconview = (ImageView) view.findViewById(R.id.per_app_icon);
+
+ if (i > 0) {
+ appName.setText(data.loadLabel(mPackageManager));
+ iconview.setImageDrawable(data.loadIcon(mPackageManager));
+ } else {
+ appName.setText(data.packageName);
+ }
}
mViews.add(view);
}
@@ -93,36 +96,4 @@ public View getView(int position, View convertView, ViewGroup parent) {
return view;
}
-
- public ArrayList getCheckedItems() {
- ArrayList retApps = new ArrayList();
- if (null != mAppsList) {
- ApplicationInfo info;
- CheckBox checkBox;
- for (int i = 0; i < mAppsList.size(); i++) {
- info = mAppsList.get(i);
- checkBox = mCheckBoxes.get(i);
- if (null != checkBox) {
- if (checkBox.isChecked()) {
- retApps.add(info);
- }
- }
- }
- }
- return retApps;
- }
-
- public void invertSeletion() {
- for (int i = 0; i < mCheckBoxes.size(); i++) {
- mCheckBoxes.get(i).setChecked(!mCheckBoxes.get(i).isChecked());
- }
- }
-
- public void setChecked(int position, boolean checked) {
- mCheckBoxes.get(position).setChecked(checked);
- }
-
- public boolean isChecked(int position) {
- return mCheckBoxes.get(position).isChecked();
- }
}
diff --git a/src/us/shandian/mod/swipeback/app/SwipeBackActivityHelper.java b/src/us/shandian/mod/swipeback/app/SwipeBackActivityHelper.java
index fc169ba..f0c3fbf 100755
--- a/src/us/shandian/mod/swipeback/app/SwipeBackActivityHelper.java
+++ b/src/us/shandian/mod/swipeback/app/SwipeBackActivityHelper.java
@@ -15,12 +15,14 @@
import de.robv.android.xposed.XposedHelpers;
import us.shandian.mod.swipeback.widget.SwipeBackLayout;
-import us.shandian.mod.swipeback.hook.ModSwipeBack;
+import us.shandian.mod.swipeback.provider.SettingsProvider;
/**
* @author Yrom
*/
public class SwipeBackActivityHelper {
+ private boolean recycle = true;
+
private Activity mActivity;
private Context mGbContext;
private boolean mIsTranslucent;
@@ -30,7 +32,7 @@ public class SwipeBackActivityHelper {
public SwipeBackActivityHelper(Activity activity) {
mActivity = activity;
try {
- mGbContext = mActivity.createPackageContext(ModSwipeBack.PACKAGE_NAME, Context.CONTEXT_IGNORE_SECURITY);
+ mGbContext = mActivity.createPackageContext(SettingsProvider.PACKAGE_NAME, Context.CONTEXT_IGNORE_SECURITY);
} catch (Throwable t) {
XposedBridge.log(t);
}
@@ -47,14 +49,14 @@ public void onActivityCreate() {
mSwipeBackLayout.addSwipeListener(new SwipeBackLayout.SwipeListener() {
@Override
public void onScrollStateChange(int state, float scrollPercent) {
- if (!mIsTranslucent && state == SwipeBackLayout.STATE_IDLE && scrollPercent == 0) {
+ if (recycle && !mIsTranslucent && state == SwipeBackLayout.STATE_IDLE && scrollPercent == 0) {
convertActivityFromTranslucent();
}
}
@Override
public void onEdgeTouch(int edgeFlag) {
- if (!mIsTranslucent) {
+ if (recycle && !mIsTranslucent) {
convertActivityToTranslucent();
}
}
@@ -69,7 +71,7 @@ public void onScrollOverThreshold() {
public void onPostCreate() {
mSwipeBackLayout.attachToActivity(mActivity);
mIsTranslucent = isTranslucent();
- if (!mIsTranslucent) {
+ if (recycle && !mIsTranslucent) {
convertActivityFromTranslucent();
}
mActivity.getWindow().setBackgroundDrawable(new ColorDrawable(0));
@@ -87,13 +89,22 @@ public SwipeBackLayout getSwipeBackLayout() {
return mSwipeBackLayout;
}
+ public void setSensitivity(float sensitivity) {
+ mSwipeBackLayout.setSensitivity(mActivity, sensitivity);
+ }
+
public boolean isTranslucent() {
+ if (!recycle) return false;
try {
return ((ColorDrawable) mActivity.getWindow().getDecorView().getBackground()).getColor() == mActivity.getResources().getColor(android.R.color.transparent);
} catch (Throwable t) {
return false;
}
}
+
+ public void setSurfaceRecycleEnabled(boolean enabled) {
+ recycle = enabled;
+ }
/**
* Convert a translucent themed Activity
diff --git a/src/us/shandian/mod/swipeback/hook/ModSwipeBack.java b/src/us/shandian/mod/swipeback/hook/ModSwipeBack.java
index 9242cac..8ba55cd 100755
--- a/src/us/shandian/mod/swipeback/hook/ModSwipeBack.java
+++ b/src/us/shandian/mod/swipeback/hook/ModSwipeBack.java
@@ -28,41 +28,21 @@
import us.shandian.mod.swipeback.app.SwipeBackActivityHelper;
import us.shandian.mod.swipeback.widget.SwipeBackLayout;
+import us.shandian.mod.swipeback.provider.SettingsProvider;
import java.util.ArrayList;
public class ModSwipeBack implements IXposedHookZygoteInit, IXposedHookLoadPackage
{
-
- public static final String PACKAGE_NAME = "us.shandian.mod.swipeback";
- public static final String PREFS = "SwipeBackSettings";
- public static final String BLACKLIST = "SwipeBackBlacklist";
-
- public static final String SWIPEBACK_ENABLE = "swipeback_enable";
- public static final String SWIPEBACK_EDGE = "swipeback_edge";
- public static final String SWIPEBACK_EDGE_SIZE = "swipeback_edge_size";
- public static final String SWIPEBACK_BLACKLIST = "swipeback_blacklist";
-
- public static final int SWIPEBACK_EDGE_LEFT = 1;
- public static final int SWIPEBACK_EDGE_RIGHT = 2;
- public static final int SWIPEBACK_EDGE_BOTTOM = 4;
-
private ArrayList mBannedPackages = new ArrayList();
- private static XSharedPreferences prefs;
- private static XSharedPreferences blacklist;
-
@Override
public void initZygote(StartupParam param) throws Throwable
{
try {
- loadBannedApps();
-
- prefs = new XSharedPreferences(PACKAGE_NAME, PREFS);
- prefs.makeWorldReadable();
+ SettingsProvider.initZygote();
- blacklist = new XSharedPreferences(PACKAGE_NAME, BLACKLIST);
- blacklist.makeWorldReadable();
+ loadBannedApps();
XposedHelpers.findAndHookMethod(Activity.class, "onCreate", Bundle.class, new XC_MethodHook() {
@Override
@@ -70,41 +50,52 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
Activity activity = (Activity) param.thisObject;
banLaunchers(activity);
+ // Prefix
+ String packageName = activity.getApplication().getApplicationInfo().packageName;
+
// Try to ignore dialogs
Class> styleable = XposedHelpers.findClass("com.android.internal.R.styleable", null);
int Window_windowIsFloating = XposedHelpers.getStaticIntField(styleable, "Window_windowIsFloating");
boolean windowIsFloating = activity.getWindow().getWindowStyle().getBoolean(Window_windowIsFloating, false);
- if (windowIsFloating || isAppBanned(activity.getApplication().getApplicationInfo().packageName) ||
+ if (windowIsFloating || isAppBanned(packageName) ||
// Ignore InCall* activities
activity.getComponentName().getClassName().contains("InCall")) {
return;
}
// Do this only when enabled
- prefs.reload();
- if (prefs.getBoolean(SWIPEBACK_ENABLE, true)) {
+ SettingsProvider.reload();
+ if (SettingsProvider.getBoolean(packageName, SettingsProvider.SWIPEBACK_ENABLE, true)) {
SwipeBackActivityHelper helper = new SwipeBackActivityHelper(activity);
+
+ // Surface Recycling
+ helper.setSurfaceRecycleEnabled(SettingsProvider.getBoolean(packageName, SettingsProvider.SWIPEBACK_RECYCLE_SURFACE, true));
+
helper.onActivityCreate();
helper.getSwipeBackLayout().setEnableGesture(true);
+
// Get the egde
- int edge = prefs.getInt(SWIPEBACK_EDGE, 0 | SWIPEBACK_EDGE_LEFT);
+ int edge = SettingsProvider.getInt(packageName, SettingsProvider.SWIPEBACK_EDGE, 0 | SettingsProvider.SWIPEBACK_EDGE_LEFT);
int trackEdge = 0;
- if ((edge & SWIPEBACK_EDGE_LEFT) != 0) {
+ if ((edge & SettingsProvider.SWIPEBACK_EDGE_LEFT) != 0) {
trackEdge |= SwipeBackLayout.EDGE_LEFT;
}
- if ((edge & SWIPEBACK_EDGE_RIGHT) != 0) {
+ if ((edge & SettingsProvider.SWIPEBACK_EDGE_RIGHT) != 0) {
trackEdge |= SwipeBackLayout.EDGE_RIGHT;
}
- if ((edge & SWIPEBACK_EDGE_BOTTOM) != 0) {
+ if ((edge & SettingsProvider.SWIPEBACK_EDGE_BOTTOM) != 0) {
trackEdge |= SwipeBackLayout.EDGE_BOTTOM;
}
helper.getSwipeBackLayout().setEdgeTrackingEnabled(trackEdge);
// Set the size
- int size = prefs.getInt(SWIPEBACK_EDGE_SIZE, 50);
+ int size = SettingsProvider.getInt(packageName, SettingsProvider.SWIPEBACK_EDGE_SIZE, 50);
helper.getSwipeBackLayout().setEdgeSize(size);
+ // Sensitivity
+ helper.setSensitivity(SettingsProvider.getFloat(packageName, SettingsProvider.SWIPEBACK_SENSITIVITY, 1.0f));
+
XposedHelpers.setAdditionalInstanceField(activity, "mSwipeHelper", helper);
// Request for rotation
@@ -166,11 +157,12 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable
XposedBridge.hookAllConstructors(activityRecord, new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
+ String packageName = (String) XposedHelpers.getObjectField(param.thisObject, "packageName");
+
// If not enabled, ignore
- prefs.reload();
- if (!prefs.getBoolean(SWIPEBACK_ENABLE, true)) return;
+ SettingsProvider.reload();
+ if (!SettingsProvider.getBoolean(packageName, SettingsProvider.SWIPEBACK_ENABLE, true)) return;
- String packageName = (String) XposedHelpers.getObjectField(param.thisObject, "packageName");
boolean isHomeActivity = false;
// Try to ignore home activities
@@ -234,12 +226,6 @@ public void handleLoadPackage(LoadPackageParam param) throws Throwable {
}
private boolean isAppBanned(String packageName) {
- blacklist.reload();
- prefs.reload();
- if (!prefs.getBoolean(SWIPEBACK_BLACKLIST, false) == blacklist.getBoolean(packageName, false)) {
- return true;
- }
-
for (String name : mBannedPackages) {
if (name.equals(packageName)) {
return true;
diff --git a/src/us/shandian/mod/swipeback/provider/SettingsProvider.java b/src/us/shandian/mod/swipeback/provider/SettingsProvider.java
new file mode 100755
index 0000000..77b1021
--- /dev/null
+++ b/src/us/shandian/mod/swipeback/provider/SettingsProvider.java
@@ -0,0 +1,103 @@
+package us.shandian.mod.swipeback.provider;
+
+import android.content.Context;
+import android.content.SharedPreferences;
+
+import de.robv.android.xposed.XSharedPreferences;
+
+public class SettingsProvider
+{
+ public static final String PACKAGE_NAME = "us.shandian.mod.swipeback";
+
+ public static final String PREFS = "preferences";
+
+ public static final String PREFIX_GLOBAL = "global";
+
+ public static final String SWIPEBACK_ENABLE = "swipeback_enable";
+ public static final String SWIPEBACK_EDGE = "swipeback_edge";
+ public static final String SWIPEBACK_EDGE_SIZE = "swipeback_edge_size";
+ public static final String SWIPEBACK_RECYCLE_SURFACE = "swipeback_recycle_surface";
+ public static final String SWIPEBACK_SENSITIVITY = "swipeback_sensitivity";
+
+ public static final int SWIPEBACK_EDGE_LEFT = 1;
+ public static final int SWIPEBACK_EDGE_RIGHT = 2;
+ public static final int SWIPEBACK_EDGE_BOTTOM = 4;
+
+ private static XSharedPreferences mPrefs;
+
+ public static void initZygote() {
+ mPrefs = new XSharedPreferences(PACKAGE_NAME, PREFS);
+ mPrefs.makeWorldReadable();
+ }
+
+ public static int getInt(Context context, String prefix, String key, int defValue) {
+ SharedPreferences prefs = context.getSharedPreferences(PREFS, Context.MODE_WORLD_READABLE);
+ if (!prefix.equals(PREFIX_GLOBAL) && !prefs.contains(prefix + ":" + key)) {
+ return getInt(context, PREFIX_GLOBAL, key, defValue);
+ } else {
+ return prefs.getInt(prefix + ":" + key, defValue);
+ }
+ }
+
+ public static int getInt(String prefix, String key, int defValue) {
+ if (!prefix.equals(PREFIX_GLOBAL) && !mPrefs.contains(prefix + ":" + key)) {
+ return getInt(PREFIX_GLOBAL, key, defValue);
+ } else {
+ return mPrefs.getInt(prefix + ":" + key, defValue);
+ }
+ }
+
+ public static float getFloat(Context context, String prefix, String key, float defValue) {
+ SharedPreferences prefs = context.getSharedPreferences(PREFS, Context.MODE_WORLD_READABLE);
+ if (!prefix.equals(PREFIX_GLOBAL) && !prefs.contains(prefix + ":" + key)) {
+ return getFloat(context, PREFIX_GLOBAL, key, defValue);
+ } else {
+ return prefs.getFloat(prefix + ":" + key, defValue);
+ }
+ }
+
+ public static float getFloat(String prefix, String key, float defValue) {
+ if (!prefix.equals(PREFIX_GLOBAL) && !mPrefs.contains(prefix + ":" + key)) {
+ return getFloat(PREFIX_GLOBAL, key, defValue);
+ } else {
+ return mPrefs.getFloat(prefix + ":" + key, defValue);
+ }
+ }
+
+ public static boolean getBoolean(Context context, String prefix, String key, boolean defValue) {
+ SharedPreferences prefs = context.getSharedPreferences(PREFS, Context.MODE_WORLD_READABLE);
+ if (!prefix.equals(PREFIX_GLOBAL) && !prefs.contains(prefix + ":" + key)) {
+ return getBoolean(context, PREFIX_GLOBAL, key, defValue);
+ } else {
+ return prefs.getBoolean(prefix + ":" + key, defValue);
+ }
+ }
+
+ public static boolean getBoolean(String prefix, String key, boolean defValue) {
+ if (!prefix.equals(PREFIX_GLOBAL) && !mPrefs.contains(prefix + ":" + key)) {
+ return getBoolean(PREFIX_GLOBAL, key, defValue);
+ } else {
+ return mPrefs.getBoolean(prefix + ":" + key, defValue);
+ }
+ }
+
+ public static void putInt(Context context, String prefix, String key, int value) {
+ context.getSharedPreferences(PREFS, Context.MODE_WORLD_READABLE).edit().putInt(prefix + ":" + key, value).commit();
+ }
+
+ public static void putFloat(Context context, String prefix, String key, float value) {
+ context.getSharedPreferences(PREFS, Context.MODE_WORLD_READABLE).edit().putFloat(prefix + ":" + key, value).commit();
+ }
+
+ public static void putBoolean(Context context, String prefix, String key, boolean value) {
+ context.getSharedPreferences(PREFS, Context.MODE_WORLD_READABLE).edit().putBoolean(prefix + ":" + key, value).commit();
+ }
+
+ public static void remove(Context context, String prefix, String key) {
+ context.getSharedPreferences(PREFS, Context.MODE_WORLD_READABLE).edit().remove(prefix + ":" + key).commit();
+ }
+
+ public static void reload() {
+ mPrefs.reload();
+ }
+}
diff --git a/src/us/shandian/mod/swipeback/ui/SwipeBackAbout.java b/src/us/shandian/mod/swipeback/ui/SwipeBackAbout.java
index dd48766..eb3e56b 100755
--- a/src/us/shandian/mod/swipeback/ui/SwipeBackAbout.java
+++ b/src/us/shandian/mod/swipeback/ui/SwipeBackAbout.java
@@ -14,9 +14,11 @@ public class SwipeBackAbout extends PreferenceActivity implements OnPreferenceCl
{
private final String SWIPE_VERSION = "swipe_version";
private final String SWIPE_COMMUNITY = "swipe_community";
+ private final String SWIPE_WEBSITE = "swipe_homepage";
private Preference mVersion;
private Preference mCommunity;
+ private Preference mWebsite;
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -38,6 +40,9 @@ public void onCreate(Bundle savedInstanceState) {
mCommunity = findPreference(SWIPE_COMMUNITY);
mCommunity.setOnPreferenceClickListener(this);
+
+ mWebsite = findPreference(SWIPE_WEBSITE);
+ mWebsite.setOnPreferenceClickListener(this);
}
@Override
@@ -57,6 +62,11 @@ public boolean onPreferenceClick(Preference preference)
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(getResources().getString(R.string.swipe_community_url)));
startActivity(intent);
return true;
+ } else if (preference == mWebsite) {
+ // Access the website
+ Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(getResources().getString(R.string.swipe_website_url)));
+ startActivity(intent);
+ return true;
} else {
return false;
}
diff --git a/src/us/shandian/mod/swipeback/ui/SwipeBackBlacklist.java b/src/us/shandian/mod/swipeback/ui/SwipeBackPerApp.java
similarity index 60%
rename from src/us/shandian/mod/swipeback/ui/SwipeBackBlacklist.java
rename to src/us/shandian/mod/swipeback/ui/SwipeBackPerApp.java
index 2cd8642..37f3427 100755
--- a/src/us/shandian/mod/swipeback/ui/SwipeBackBlacklist.java
+++ b/src/us/shandian/mod/swipeback/ui/SwipeBackPerApp.java
@@ -3,7 +3,7 @@
import android.app.ListActivity;
import android.app.ProgressDialog;
import android.content.Context;
-import android.content.SharedPreferences;
+import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ApplicationInfo;
import android.os.Bundle;
@@ -12,15 +12,19 @@
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.Menu;
+import android.view.View;
+import android.widget.TextView;
+import android.widget.AdapterView;
+import android.widget.AdapterView.OnItemClickListener;
import java.util.List;
import java.util.ArrayList;
import us.shandian.mod.swipeback.R;
-import us.shandian.mod.swipeback.hook.ModSwipeBack;
+import us.shandian.mod.swipeback.provider.SettingsProvider;
import us.shandian.mod.swipeback.adapter.ApplicationAdapter;
-public class SwipeBackBlacklist extends ListActivity
+public class SwipeBackPerApp extends ListActivity implements OnItemClickListener
{
private Context mContext;
private ApplicationAdapter mAdapter;
@@ -37,17 +41,12 @@ public void handleMessage(Message msg)
}
};
- private SharedPreferences blacklist;
-
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- // Enable the "back" option
- getActionBar().setDisplayHomeAsUpEnabled(true);
-
- // Init the blacklist
- blacklist = getSharedPreferences(ModSwipeBack.BLACKLIST, Context.MODE_WORLD_READABLE);
+ // Listener
+ getListView().setOnItemClickListener(this);
// Init the list
mContext = this;
@@ -55,31 +54,27 @@ public void onCreate(Bundle savedInstanceState) {
new Thread(new Runnable() {
@Override
public void run() {
- mAdapter = new ApplicationAdapter(mContext, R.id.save_blacklist, getAppList());
- readFromBlacklist();
+ mAdapter = new ApplicationAdapter(mContext, 0, getAppList());
mHandler.sendEmptyMessage(0);
}
}).start();
}
-
+
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
- inflater.inflate(R.menu.blacklist, menu);
+ inflater.inflate(R.menu.perapp, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item)
{
- switch (item.getItemId()) {
- case R.id.save_blacklist:
- writeToBlacklist();
- finish();
- break;
- case android.R.id.home:
- finish();
- break;
+ if (item.getItemId() == R.id.about) {
+ Intent i = new Intent();
+ i.setAction(Intent.ACTION_DEFAULT);
+ i.setClass(this, SwipeBackAbout.class);
+ startActivity(i);
}
return super.onOptionsItemSelected(item);
}
@@ -100,19 +95,22 @@ private ArrayList getAppList() {
}
return applist;
}
-
- private void readFromBlacklist() {
- for (int i = 0; i < mAdapter.getCount(); i++) {
- boolean isBanned = blacklist.getBoolean(mAdapter.getItem(i).packageName, false);
- mAdapter.setChecked(i, isBanned);
- }
- }
-
- private void writeToBlacklist() {
- SharedPreferences.Editor edit = blacklist.edit();
- for (int i = 0; i < mAdapter.getCount(); i++) {
- edit.putBoolean(mAdapter.getItem(i).packageName, mAdapter.isChecked(i));
+
+ @Override
+ public void onItemClick(AdapterView> parent, View view, int position, long id)
+ {
+ Bundle bundle = new Bundle();
+ if (position == 0) {
+ bundle.putString("us.shandian.mod.swipeback.PREFIX", SettingsProvider.PREFIX_GLOBAL);
+ } else {
+ bundle.putString("us.shandian.mod.swipeback.PREFIX", mAdapter.getItem(position).packageName);
}
- edit.commit();
+ bundle.putString("us.shandian.mod.swipeback.TITLE", ((TextView) view.findViewById(R.id.per_app_name)).getText().toString());
+
+ Intent intent = new Intent();
+ intent.setAction(Intent.ACTION_DEFAULT);
+ intent.setClass(mContext, SwipeBackSettings.class);
+ intent.putExtras(bundle);
+ startActivity(intent);
}
}
diff --git a/src/us/shandian/mod/swipeback/ui/SwipeBackSettings.java b/src/us/shandian/mod/swipeback/ui/SwipeBackSettings.java
index 601378f..e177d4d 100755
--- a/src/us/shandian/mod/swipeback/ui/SwipeBackSettings.java
+++ b/src/us/shandian/mod/swipeback/ui/SwipeBackSettings.java
@@ -8,7 +8,9 @@
import android.preference.Preference;
import android.preference.Preference.OnPreferenceChangeListener;
import android.preference.Preference.OnPreferenceClickListener;
-import android.content.SharedPreferences;
+import android.view.MenuItem;
+import android.view.MenuInflater;
+import android.view.Menu;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
@@ -16,151 +18,104 @@
import java.util.Set;
import java.util.HashSet;
-import com.espian.showcaseview.ShowcaseView;
-import com.espian.showcaseview.ShowcaseView.ConfigOptions;
-import com.espian.showcaseview.OnShowcaseEventListener;
-import com.espian.showcaseview.targets.ViewTarget;
-import com.espian.showcaseview.targets.PointTarget;
-import com.espian.showcaseview.targets.ActionViewTarget;
-import com.espian.showcaseview.targets.Target;
-
import us.shandian.mod.swipeback.R;
-import us.shandian.mod.swipeback.hook.ModSwipeBack;
-import us.shandian.mod.swipeback.ui.SwipeBackBlacklist;
+import us.shandian.mod.swipeback.provider.SettingsProvider;
+import us.shandian.mod.swipeback.ui.SwipeBackPerApp;
+import us.shandian.mod.swipeback.ui.preference.SeekBarPreference;
public class SwipeBackSettings extends PreferenceActivity implements OnPreferenceChangeListener, OnPreferenceClickListener
{
- private final String FIRST_RUN = "first_run";
-
- private SharedPreferences prefs;
-
private SwitchPreference mSwipeEnable;
+ private SwitchPreference mRecycleSurface;
private MultiSelectListPreference mSwipeEdge;
private EditTextPreference mSwipeEdgeSize;
- private SwitchPreference mSwipeBlacklist;
+ private SeekBarPreference mSwipeSensitivity;
- private ConfigOptions mConfig;
+ private String prefix;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- addPreferencesFromResource(R.xml.swipeback_settings);
- prefs = getSharedPreferences(ModSwipeBack.PREFS, Context.MODE_WORLD_READABLE);
+ getActionBar().setDisplayHomeAsUpEnabled(true);
+
+ Bundle extras = getIntent().getExtras();
+ getActionBar().setTitle(extras.getString("us.shandian.mod.swipeback.TITLE"));
+ prefix = extras.getString("us.shandian.mod.swipeback.PREFIX");
+
+ addPreferencesFromResource(R.xml.swipeback_settings);
- mSwipeEnable = (SwitchPreference) findPreference(ModSwipeBack.SWIPEBACK_ENABLE);
- mSwipeEnable.setChecked(prefs.getBoolean(ModSwipeBack.SWIPEBACK_ENABLE, true));
+ loadSettings();
+ }
+
+ private void loadSettings() {
+ mSwipeEnable = (SwitchPreference) findPreference(SettingsProvider.SWIPEBACK_ENABLE);
+ mSwipeEnable.setChecked(SettingsProvider.getBoolean(this, prefix, SettingsProvider.SWIPEBACK_ENABLE, true));
mSwipeEnable.setOnPreferenceClickListener(this);
mSwipeEnable.setOnPreferenceChangeListener(this);
-
- mSwipeEdge = (MultiSelectListPreference) findPreference(ModSwipeBack.SWIPEBACK_EDGE);
- int edge = prefs.getInt(ModSwipeBack.SWIPEBACK_EDGE, 0 | ModSwipeBack.SWIPEBACK_EDGE_LEFT);
+
+ mRecycleSurface = (SwitchPreference) findPreference(SettingsProvider.SWIPEBACK_RECYCLE_SURFACE);
+ mRecycleSurface.setChecked(SettingsProvider.getBoolean(this, prefix, SettingsProvider.SWIPEBACK_RECYCLE_SURFACE, true));
+ mRecycleSurface.setOnPreferenceClickListener(this);
+ mRecycleSurface.setOnPreferenceChangeListener(this);
+
+ mSwipeEdge = (MultiSelectListPreference) findPreference(SettingsProvider.SWIPEBACK_EDGE);
+ int edge = SettingsProvider.getInt(this, prefix, SettingsProvider.SWIPEBACK_EDGE, 0 | SettingsProvider.SWIPEBACK_EDGE_LEFT);
Set edges = new HashSet();
StringBuilder summary = new StringBuilder();
- if ((edge & ModSwipeBack.SWIPEBACK_EDGE_LEFT) != 0) {
- edges.add(String.valueOf(ModSwipeBack.SWIPEBACK_EDGE_LEFT));
+ if ((edge & SettingsProvider.SWIPEBACK_EDGE_LEFT) != 0) {
+ edges.add(String.valueOf(SettingsProvider.SWIPEBACK_EDGE_LEFT));
summary.append(getResources().getString(R.string.swipe_edge_left)).append(" ");
}
- if ((edge & ModSwipeBack.SWIPEBACK_EDGE_RIGHT) != 0) {
- edges.add(String.valueOf(ModSwipeBack.SWIPEBACK_EDGE_RIGHT));
+ if ((edge & SettingsProvider.SWIPEBACK_EDGE_RIGHT) != 0) {
+ edges.add(String.valueOf(SettingsProvider.SWIPEBACK_EDGE_RIGHT));
summary.append(getResources().getString(R.string.swipe_edge_right)).append(" ");
}
- if ((edge & ModSwipeBack.SWIPEBACK_EDGE_BOTTOM) != 0) {
- edges.add(String.valueOf(ModSwipeBack.SWIPEBACK_EDGE_BOTTOM));
+ if ((edge & SettingsProvider.SWIPEBACK_EDGE_BOTTOM) != 0) {
+ edges.add(String.valueOf(SettingsProvider.SWIPEBACK_EDGE_BOTTOM));
summary.append(getResources().getString(R.string.swipe_edge_bottom)).append(" ");
}
mSwipeEdge.setValues(edges);
mSwipeEdge.setSummary(summary.toString());
mSwipeEdge.setOnPreferenceChangeListener(this);
-
- mSwipeEdgeSize = (EditTextPreference) findPreference(ModSwipeBack.SWIPEBACK_EDGE_SIZE);
- int size = prefs.getInt(ModSwipeBack.SWIPEBACK_EDGE_SIZE, 50);
+
+ mSwipeEdgeSize = (EditTextPreference) findPreference(SettingsProvider.SWIPEBACK_EDGE_SIZE);
+ int size = SettingsProvider.getInt(this, prefix, SettingsProvider.SWIPEBACK_EDGE_SIZE, 50);
mSwipeEdgeSize.setDefaultValue(String.valueOf(size));
mSwipeEdgeSize.setSummary(size + " dip");
mSwipeEdgeSize.setOnPreferenceChangeListener(this);
-
- mSwipeBlacklist = (SwitchPreference) findPreference(ModSwipeBack.SWIPEBACK_BLACKLIST);
- mSwipeBlacklist.setChecked(prefs.getBoolean(ModSwipeBack.SWIPEBACK_BLACKLIST, false));
- mSwipeBlacklist.setOnPreferenceClickListener(this);
- mSwipeBlacklist.setOnPreferenceChangeListener(this);
-
- // First-run tutorial
- if (!prefs.getBoolean(FIRST_RUN, true)) return;
-
- mConfig = new ConfigOptions();
- mConfig.insert = ShowcaseView.INSERT_TO_VIEW;
- ShowcaseView showcase = ShowcaseView.insertShowcaseView(new PointTarget(0, 0), this, R.string.tutorial_welcome_title, R.string.tutorial_welcome_content, mConfig);
- showcase.setButtonText(getResources().getString(R.string.tutorial_next));
- showcase.setOnShowcaseEventListener(new OnShowcaseEventListener() {
-
- @Override
- public void onShowcaseViewHide(ShowcaseView showcaseView)
- {
- ShowcaseView showcase = ShowcaseView.insertShowcaseView(new PointTarget(0, 0), SwipeBackSettings.this, R.string.tutorial_enable_title, R.string.tutorial_enable_content, mConfig);
- showcase.setButtonText(getResources().getString(R.string.tutorial_next));
- showcase.setOnShowcaseEventListener(new OnShowcaseEventListener() {
-
- @Override
- public void onShowcaseViewHide(ShowcaseView showcaseView)
- {
- ShowcaseView showcase = ShowcaseView.insertShowcaseView(new PointTarget(0, 100), SwipeBackSettings.this, R.string.tutorial_edge_title, R.string.tutorial_edge_content, mConfig);
- showcase.setButtonText(getResources().getString(R.string.tutorial_next));
- showcase.setOnShowcaseEventListener(new OnShowcaseEventListener() {
-
- @Override
- public void onShowcaseViewHide(ShowcaseView showcaseView)
- {
- ShowcaseView showcase = ShowcaseView.insertShowcaseView(new PointTarget(0, 0), SwipeBackSettings.this, R.string.tutorial_over_title, R.string.tutorial_over_content, mConfig);
- showcase.setButtonText(getResources().getString(R.string.tutorial_finish));
- prefs.edit().putBoolean(FIRST_RUN, false).commit();
- }
-
- @Override
- public void onShowcaseViewDidHide(ShowcaseView showcaseView)
- {
-
- }
-
- @Override
- public void onShowcaseViewShow(ShowcaseView showcaseView)
- {
- }
+ mSwipeSensitivity = (SeekBarPreference) findPreference(SettingsProvider.SWIPEBACK_SENSITIVITY);
+ float sensitivity = SettingsProvider.getFloat(this, prefix, SettingsProvider.SWIPEBACK_SENSITIVITY, 1.0f);
+ mSwipeSensitivity.setValue((int) (sensitivity * 100));
-
- });
- }
-
- @Override
- public void onShowcaseViewDidHide(ShowcaseView showcaseView)
- {
-
- }
-
- @Override
- public void onShowcaseViewShow(ShowcaseView showcaseView)
- {
-
- }
-
-
- });
- }
-
- @Override
- public void onShowcaseViewDidHide(ShowcaseView showcaseView)
- {
-
- }
-
- @Override
- public void onShowcaseViewShow(ShowcaseView showcaseView)
- {
-
- }
-
-
- });
+ mSwipeSensitivity.setOnPreferenceChangeListener(this);
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ MenuInflater inflater = getMenuInflater();
+ inflater.inflate(R.menu.settings, menu);
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item)
+ {
+ switch (item.getItemId()) {
+ case android.R.id.home:
+ finish();
+ return true;
+ case R.id.reset:
+ SettingsProvider.remove(this, prefix, SettingsProvider.SWIPEBACK_ENABLE);
+ SettingsProvider.remove(this, prefix, SettingsProvider.SWIPEBACK_EDGE);
+ SettingsProvider.remove(this, prefix, SettingsProvider.SWIPEBACK_EDGE_SIZE);
+ SettingsProvider.remove(this, prefix, SettingsProvider.SWIPEBACK_SENSITIVITY);
+ SettingsProvider.remove(this, prefix, SettingsProvider.SWIPEBACK_RECYCLE_SURFACE);
+ loadSettings();
+ return true;
+ }
+ return super.onOptionsItemSelected(item);
}
@Override
@@ -172,33 +127,35 @@ public boolean onPreferenceChange(Preference preference, Object newValue)
StringBuilder summary = new StringBuilder();
for (String value : newValues) {
switch (Integer.parseInt(value)) {
- case ModSwipeBack.SWIPEBACK_EDGE_LEFT:
- edge |= ModSwipeBack.SWIPEBACK_EDGE_LEFT;
+ case SettingsProvider.SWIPEBACK_EDGE_LEFT:
+ edge |= SettingsProvider.SWIPEBACK_EDGE_LEFT;
summary.append(getResources().getString(R.string.swipe_edge_left)).append(" ");
break;
- case ModSwipeBack.SWIPEBACK_EDGE_RIGHT:
- edge |= ModSwipeBack.SWIPEBACK_EDGE_RIGHT;
+ case SettingsProvider.SWIPEBACK_EDGE_RIGHT:
+ edge |= SettingsProvider.SWIPEBACK_EDGE_RIGHT;
summary.append(getResources().getString(R.string.swipe_edge_right)).append(" ");
break;
- case ModSwipeBack.SWIPEBACK_EDGE_BOTTOM:
- edge |= ModSwipeBack.SWIPEBACK_EDGE_BOTTOM;
+ case SettingsProvider.SWIPEBACK_EDGE_BOTTOM:
+ edge |= SettingsProvider.SWIPEBACK_EDGE_BOTTOM;
summary.append(getResources().getString(R.string.swipe_edge_bottom)).append(" ");
break;
}
}
- prefs.edit().putInt(ModSwipeBack.SWIPEBACK_EDGE, edge).commit();
+ SettingsProvider.putInt(this, prefix, SettingsProvider.SWIPEBACK_EDGE, edge);
mSwipeEdge.setSummary(summary.toString());
} else if (preference == mSwipeEdgeSize) {
int size = Integer.parseInt((String) newValue);;
if (size <= 0) {
size = 50;
}
- prefs.edit().putInt(ModSwipeBack.SWIPEBACK_EDGE_SIZE, size).commit();
+ SettingsProvider.putInt(this, prefix, SettingsProvider.SWIPEBACK_EDGE_SIZE, size);
mSwipeEdgeSize.setSummary(size + " dip");
} else if (preference == mSwipeEnable) {
- prefs.edit().putBoolean(ModSwipeBack.SWIPEBACK_ENABLE, (Boolean) newValue).commit();
- } else if (preference == mSwipeBlacklist) {
- prefs.edit().putBoolean(ModSwipeBack.SWIPEBACK_BLACKLIST, (Boolean) newValue).commit();
+ SettingsProvider.putBoolean(this, prefix, SettingsProvider.SWIPEBACK_ENABLE, (Boolean) newValue);
+ } else if (preference == mRecycleSurface) {
+ SettingsProvider.putBoolean(this, prefix, SettingsProvider.SWIPEBACK_RECYCLE_SURFACE, (Boolean) newValue);
+ } else if (preference == mSwipeSensitivity) {
+ SettingsProvider.putFloat(this, prefix, SettingsProvider.SWIPEBACK_SENSITIVITY, (Integer) newValue / 100.0f);
}
return true;
}
@@ -207,11 +164,9 @@ public boolean onPreferenceChange(Preference preference, Object newValue)
public boolean onPreferenceClick(Preference preference)
{
if (preference == mSwipeEnable) {
- prefs.edit().putBoolean(ModSwipeBack.SWIPEBACK_ENABLE, mSwipeEnable.isChecked()).commit();
- } else if(preference == mSwipeBlacklist) {
- Intent i = new Intent();
- i.setClass(this, SwipeBackBlacklist.class);
- startActivity(i);
+ SettingsProvider.putBoolean(this, prefix, SettingsProvider.SWIPEBACK_ENABLE, mSwipeEnable.isChecked());
+ } else if (preference == mRecycleSurface) {
+ SettingsProvider.putBoolean(this, prefix, SettingsProvider.SWIPEBACK_RECYCLE_SURFACE, mRecycleSurface.isChecked());
}
return true;
}
diff --git a/src/us/shandian/mod/swipeback/ui/preference/SeekBarPreference.java b/src/us/shandian/mod/swipeback/ui/preference/SeekBarPreference.java
new file mode 100755
index 0000000..407cb75
--- /dev/null
+++ b/src/us/shandian/mod/swipeback/ui/preference/SeekBarPreference.java
@@ -0,0 +1,184 @@
+/*
+ * Copyright (C) 2013 Peter Gregus for GravityBox Project (C3C076@xda)
+ * Copyright (C) 2014 The Light OpenSource Project
+ * Not a contribution
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package us.shandian.mod.swipeback.ui.preference;
+
+import us.shandian.mod.swipeback.R;
+
+import android.content.Context;
+import android.content.res.TypedArray;
+import android.os.Handler;
+import android.preference.Preference;
+import android.util.AttributeSet;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ImageButton;
+import android.widget.SeekBar;
+import android.widget.SeekBar.OnSeekBarChangeListener;
+import android.widget.TextView;
+
+public class SeekBarPreference extends Preference
+ implements OnSeekBarChangeListener, View.OnClickListener {
+
+ private static final int RAPID_PRESS_TIMEOUT = 600;
+
+ private int mMinimum = 0;
+ private int mMaximum = 100;
+ private int mInterval = 1;
+ private int mDefaultValue = mMinimum;
+ private boolean mMonitorBoxEnabled = false;
+ private String mMonitorBoxUnit = null;
+
+ private TextView mMonitorBox;
+ private SeekBar mBar;
+ private ImageButton mBtnPlus;
+ private ImageButton mBtnMinus;
+
+ private int mValue;
+ private int mTmpValue;
+ private boolean mTracking = false;
+ private boolean mRapidlyPressing = false;
+ private Handler mHandler;
+
+ private Runnable mRapidPressTimeout = new Runnable() {
+ @Override
+ public void run() {
+ mRapidlyPressing = false;
+ setValue(mTmpValue);
+ }
+ };
+
+ public SeekBarPreference(Context context, AttributeSet attrs) {
+ super(context, attrs);
+
+ if (attrs != null) {
+ mMinimum = attrs.getAttributeIntValue(null, "minimum", 0);
+ mMaximum = attrs.getAttributeIntValue(null, "maximum", 100);
+ mInterval = attrs.getAttributeIntValue(null, "interval", 1);
+ mDefaultValue = mMinimum;
+ mMonitorBoxEnabled = attrs.getAttributeBooleanValue(null, "monitorBoxEnabled", false);
+ mMonitorBoxUnit = attrs.getAttributeValue(null, "monitorBoxUnit");
+ }
+
+ mHandler = new Handler();
+ }
+
+ @Override
+ protected View onCreateView(ViewGroup parent) {
+
+ View layout = View.inflate(getContext(), R.layout.slider_preference, null);
+
+ mMonitorBox = (TextView) layout.findViewById(R.id.monitor_box);
+ mMonitorBox.setVisibility(mMonitorBoxEnabled ? View.VISIBLE : View.GONE);
+ mBar = (SeekBar) layout.findViewById(R.id.seek_bar);
+ mBar.setMax(mMaximum - mMinimum);
+ mBar.setOnSeekBarChangeListener(this);
+ mBar.setProgress(mValue - mMinimum);
+ mBtnPlus = (ImageButton) layout.findViewById(R.id.btnPlus);
+ mBtnPlus.setOnClickListener(this);
+ mBtnMinus = (ImageButton) layout.findViewById(R.id.btnMinus);
+ mBtnMinus.setOnClickListener(this);
+ setMonitorBoxText();
+ return layout;
+ }
+
+ @Override
+ protected Object onGetDefaultValue(TypedArray a, int index) {
+ return a.getInt(index, mDefaultValue);
+ }
+
+ @Override
+ protected void onSetInitialValue(boolean restoreValue, Object defaultValue) {
+ setValue(restoreValue ? getPersistedInt(mValue) : (Integer) defaultValue);
+ }
+
+ @Override
+ public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
+ if (!fromUser) return;
+
+ progress = Math.round(((float) progress) / mInterval) * mInterval + mMinimum;
+ if (mTracking) {
+ setMonitorBoxText(progress);
+ } else {
+ setValue(progress);
+ if (getOnPreferenceChangeListener() != null) {
+ getOnPreferenceChangeListener().onPreferenceChange(this, mValue);
+ }
+ }
+ }
+
+ public void setMinimum(int minimum) {
+ mMinimum = minimum >= mMaximum ? mMaximum - 1 : minimum;
+ }
+
+ public void setValue(int progress){
+ mValue = progress;
+ persistInt(mValue);
+ if (mBar != null)
+ {
+ mBar.setProgress(mValue - mMinimum);
+ setMonitorBoxText();
+ }
+ }
+
+ private void setMonitorBoxText() {
+ setMonitorBoxText(mValue);
+ }
+
+ private void setMonitorBoxText(int value) {
+ if (mMonitorBoxEnabled) {
+ String text = String.valueOf(value);
+ if (mMonitorBoxUnit != null) text += mMonitorBoxUnit;
+ mMonitorBox.setText(text);
+ }
+ }
+
+ @Override
+ public void onStartTrackingTouch(SeekBar seekBar) {
+ mTracking = true;
+ }
+
+ @Override
+ public void onStopTrackingTouch(SeekBar seekBar) {
+ mTracking = false;
+ onProgressChanged(seekBar, seekBar.getProgress(), true);
+ }
+
+ @Override
+ public void onClick(View v) {
+ if (mRapidlyPressing) {
+ mHandler.removeCallbacks(mRapidPressTimeout);
+ } else {
+ mRapidlyPressing = true;
+ mTmpValue = mValue;
+ }
+ mHandler.postDelayed(mRapidPressTimeout, RAPID_PRESS_TIMEOUT);
+
+ if (v == mBtnPlus && ((mTmpValue+mInterval) <= mMaximum)) {
+ mTmpValue += mInterval;
+ } else if (v == mBtnMinus && ((mTmpValue-mInterval) >= mMinimum)) {
+ mTmpValue -= mInterval;
+ }
+
+ mBar.setProgress(mTmpValue - mMinimum);
+ setMonitorBoxText(mTmpValue);
+
+ if (getOnPreferenceChangeListener() != null) {
+ getOnPreferenceChangeListener().onPreferenceChange(this, mTmpValue);
+ }
+ }
+}
diff --git a/src/us/shandian/mod/swipeback/widget/SwipeBackLayout.java b/src/us/shandian/mod/swipeback/widget/SwipeBackLayout.java
index f84ebce..bd03072 100755
--- a/src/us/shandian/mod/swipeback/widget/SwipeBackLayout.java
+++ b/src/us/shandian/mod/swipeback/widget/SwipeBackLayout.java
@@ -172,6 +172,17 @@ private void setContentView(View view) {
mContentView = view;
}
+ /**
+ * Sets the sensitivity of the NavigationLayout.
+ *
+ * @param context The application context.
+ * @param sensitivity value between 0 and 1, the final value for touchSlop =
+ * ViewConfiguration.getScaledTouchSlop * (1 / s);
+ */
+ public void setSensitivity(Context context, float sensitivity) {
+ mDragHelper.setSensitivity(context, sensitivity);
+ }
+
public void setEnableGesture(boolean enable) {
mEnable = enable;
}
diff --git a/src/us/shandian/mod/swipeback/widget/ViewDragHelper.java b/src/us/shandian/mod/swipeback/widget/ViewDragHelper.java
index 35c2765..8912d18 100755
--- a/src/us/shandian/mod/swipeback/widget/ViewDragHelper.java
+++ b/src/us/shandian/mod/swipeback/widget/ViewDragHelper.java
@@ -425,6 +425,19 @@ private ViewDragHelper(Context context, ViewGroup forParent, Callback cb) {
mScroller = new Scroller(context, sInterpolator);
}
+ /**
+ * Sets the sensitivity of the dragger.
+ *
+ * @param context The application context.
+ * @param sensitivity value between 0 and 1, the final value for touchSlop =
+ * ViewConfiguration.getScaledTouchSlop * (1 / s);
+ */
+ public void setSensitivity(Context context, float sensitivity) {
+ float s = Math.max(0f, Math.min(1.0f, sensitivity));
+ ViewConfiguration viewConfiguration = ViewConfiguration.get(context);
+ mTouchSlop = (int) (viewConfiguration.getScaledTouchSlop() * (1 / s));
+ }
+
/**
* Set the minimum velocity that will be detected as having a magnitude
* greater than zero in pixels per second. Callback methods accepting a