From 3993cb4779d100b61e69bd3b0893c070422c11a6 Mon Sep 17 00:00:00 2001 From: Alex O'Ree Date: Sat, 7 Jan 2017 19:32:12 -0500 Subject: [PATCH] fixed on api 10 --- .travis.yml | 2 +- .../checkstyle/checkstyle-noframes-sorted.xsl | 180 ++++++++++++ config/checkstyle/checkstyle.xml | 99 +++++++ config/findbugs/findbugs-filter.xml | 28 ++ config/javancss/javancss2html.xsl | 254 ++++++++++++++++ config/jdepend/jdepend-report.xslt | 277 ++++++++++++++++++ config/pmd/pmd-ruleset.xml | 29 ++ .../supertooltips/ToolTipView.java | 37 ++- .../src/main/AndroidManifest.xml | 1 + .../src/main/res/values/strings.xml | 2 +- 10 files changed, 898 insertions(+), 11 deletions(-) create mode 100644 config/checkstyle/checkstyle-noframes-sorted.xsl create mode 100644 config/checkstyle/checkstyle.xml create mode 100644 config/findbugs/findbugs-filter.xml create mode 100644 config/javancss/javancss2html.xsl create mode 100644 config/jdepend/jdepend-report.xslt create mode 100644 config/pmd/pmd-ruleset.xml diff --git a/.travis.yml b/.travis.yml index 0d4f0a2..b8b509a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -71,7 +71,7 @@ script: #build using gradle # travis_wait 30 https://docs.travis-ci.com/user/common-build-problems/#My-builds-are-timing-out - ./gradlew -version - - travis_wait 60 ./gradlew clean connectedCheck + - travis_wait 60 ./gradlew clean install connectedCheck -Pprofile=ci # fun fact, maven runs android tests concurrently for all connected devices, gradle does not # since we're using build matrix, each build target compiles the source, fires up it's specific vm, runs the tests, then exits. # --stacktrace diff --git a/config/checkstyle/checkstyle-noframes-sorted.xsl b/config/checkstyle/checkstyle-noframes-sorted.xsl new file mode 100644 index 0000000..67ee9fe --- /dev/null +++ b/config/checkstyle/checkstyle-noframes-sorted.xsl @@ -0,0 +1,180 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

CheckStyle Audit

Designed for use with CheckStyle and Ant.
+
+ + + +
+ + + +
+ + + + +
+ + + + +
+ + + + +

Files

+ + + + + + + + + + + + + + + +
NameErrors
+
+ + + + +

File

+ + + + + + + + + + + + + + +
Error DescriptionLine
+ Back to top +
+ + + +

Summary

+ + + + + + + + + + + + +
FilesErrors
+
+ + + + a + b + + +
+ + diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml new file mode 100644 index 0000000..35ab063 --- /dev/null +++ b/config/checkstyle/checkstyle.xml @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/config/findbugs/findbugs-filter.xml b/config/findbugs/findbugs-filter.xml new file mode 100644 index 0000000..be43362 --- /dev/null +++ b/config/findbugs/findbugs-filter.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/config/javancss/javancss2html.xsl b/config/javancss/javancss2html.xsl new file mode 100644 index 0000000..55f1d83 --- /dev/null +++ b/config/javancss/javancss2html.xsl @@ -0,0 +1,254 @@ + + + + + + + JavaNCSS Analysis + + + +

+ JavaNCSS Analysis +

+

Designed for use with JavaNCSS and Ant.

+
+ + + +
+ +

Packages

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Nr.ClassesFunctionsNCSSJavadocsPackage
      
 Total
+

+ + + + + + + + + + + + + + + + + +
+

+ + + + + + + + + + + + + + + + + + | + +   + + + + + + | + +   + + + + + + +

Objects

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Nr.NCSSFunctionsClassesJavadocsClass
Average Object NCSS:
Average Object Functions:
Average Object Inner Classes:
Average Object Javadoc Comments:
Program NCSS:
+

+ + + + + + + + + + + + + + +

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + +
Nr.NCSSCCNJavadocFunction
Average Function NCSS:
Average Function CCN:
Average Function Javadocs:
Program NCSS:
+

+ + + + + + #ff0000 + #000000 + + + + + #ff0000 + #000000 + + + + + + + + + + + + + + diff --git a/config/jdepend/jdepend-report.xslt b/config/jdepend/jdepend-report.xslt new file mode 100644 index 0000000..171b636 --- /dev/null +++ b/config/jdepend/jdepend-report.xslt @@ -0,0 +1,277 @@ + + + + + + + + + + + + JDepend Analysis + + + + + + + + +

JDepend Analysis

+

Designed for use with JDepend and Ant.

+
+ +
+

Summary

+
+ [summary] + [packages] + [cycles] + [explanations] +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
PackageTotal ClassesAbstract ClassesConcrete ClassesAfferent CouplingsEfferent CouplingsAbstractnessInstabilityDistance
+ + #PK + + + +
+ +
+ +
+

Packages

+
+ [summary] + [packages] + [cycles] + [explanations] +
+ + + +

PK +

+ + + + + + + +
Afferent Couplings: Efferent Couplings: Abstractness: Instability: Distance:
+ + + + + + + + + + + + + + +
Abstract ClassesConcrete ClassesUsed by PackagesUses Packages
+ + None + + +
+
+
+ + None + + +
+
+
+ + None + + + + #PK + +
+
+
+ + None + + + + #PK + +
+
+
+
+
+ +
+

Cycles

+
+ [summary] + [packages] + [cycles] + [explanations] +
+ + +

There are no cyclic dependancies.

+
+ +

+ +
+

+
+ +
+

Explanations

+
+ [summary] + [packages] + [cycles] + [explanations] +
+ +

The following explanations are for quick reference and are lifted directly from the original JDepend documentation.

+ +

Number of Classes

+

The number of concrete and abstract classes (and interfaces) in the package is an indicator of the extensibility of the package.

+

Afferent Couplings

+

The number of other packages that depend upon classes within the package is an indicator of the package's responsibility.

+

Efferent Couplings

+

The number of other packages that the classes in the package depend upon is an indicator of the package's independence.

+

Abstractness

+

The ratio of the number of abstract classes (and interfaces) in the analyzed package to the total number of classes in the analyzed package.

+

The range for this metric is 0 to 1, with A=0 indicating a completely concrete package and A=1 indicating a completely abstract package.

+

Instability

+

The ratio of efferent coupling (Ce) to total coupling (Ce / (Ce + Ca)). This metric is an indicator of the package's resilience to change.

+

The range for this metric is 0 to 1, with I=0 indicating a completely stable package and I=1 indicating a completely instable package.

+

Distance

+

The perpendicular distance of a package from the idealized line A + I = 1. This metric is an indicator of the package's balance between abstractness and stability.

+

A package squarely on the main sequence is optimally balanced with respect to its abstractness and stability. Ideal packages are either completely abstract and stable (x=0, y=1) or completely concrete and instable (x=1, y=0).

+

The range for this metric is 0 to 1, with D=0 indicating a package that is coincident with the main sequence and D=1 indicating a package that is as far from the main sequence as possible.

+ + + +
+ +
diff --git a/config/pmd/pmd-ruleset.xml b/config/pmd/pmd-ruleset.xml new file mode 100644 index 0000000..6997c59 --- /dev/null +++ b/config/pmd/pmd-ruleset.xml @@ -0,0 +1,29 @@ + + + + Custom ruleset for Android application + + .*/R.java + .*/gen/.* + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/super-tooltip-aar/src/main/java/com/spyhunter99/supertooltips/ToolTipView.java b/super-tooltip-aar/src/main/java/com/spyhunter99/supertooltips/ToolTipView.java index a33e355..61fa0d3 100644 --- a/super-tooltip-aar/src/main/java/com/spyhunter99/supertooltips/ToolTipView.java +++ b/super-tooltip-aar/src/main/java/com/spyhunter99/supertooltips/ToolTipView.java @@ -20,12 +20,14 @@ import android.graphics.PorterDuff; import android.graphics.Rect; import android.os.Build; +import android.util.Log; import android.util.TypedValue; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.ViewManager; import android.view.ViewTreeObserver; +import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.RelativeLayout; @@ -48,6 +50,7 @@ */ public class ToolTipView extends LinearLayout implements ViewTreeObserver.OnPreDrawListener, View.OnClickListener { + static final String TAG = "ToolTipView"; public static final String TRANSLATION_Y_COMPAT = "translationY"; public static final String TRANSLATION_X_COMPAT = "translationX"; public static final String SCALE_X_COMPAT = "scaleX"; @@ -120,8 +123,9 @@ public boolean onPreDraw() { ViewGroup.LayoutParams layoutParams = getLayoutParams(); layoutParams.width = width; - setLayoutParams((ViewGroup.LayoutParams) layoutParams); - + setLayoutParams(layoutParams); + if (getParent()==null) + return false; if (toolTip != null) { applyToolTipPosition(toolTip.getPosition()); } @@ -178,7 +182,9 @@ private void applyToolTipPosition(ToolTip.Position position) { view.getWindowVisibleDisplayFrame(viewDisplayFrame); final int[] parentViewScreenPosition = new int[2]; - ((View) getParent()).getLocationOnScreen(parentViewScreenPosition); + if (getParent()!=null){ + ((View) getParent()).getLocationOnScreen(parentViewScreenPosition); + } final int masterViewWidth = view.getWidth(); final int masterViewHeight = view.getHeight(); @@ -300,6 +306,15 @@ public void remove() { setY(params.topMargin); params.leftMargin = 0; params.topMargin = 0; + } else if (getLayoutParams() instanceof android.widget.FrameLayout.LayoutParams){ + android.widget.FrameLayout.LayoutParams p = (FrameLayout.LayoutParams) getLayoutParams(); + setX(p.leftMargin); + setY(p.topMargin); + p.leftMargin = 0; + p.topMargin = 0; + } else { + //crap, happens on api10 + Log.d(TAG, "Remove layouts params was of type " + getLayoutParams().getClass().toString()); } setLayoutParams(getLayoutParams()); } @@ -372,7 +387,7 @@ public void destroy() { * Convenience method for getting X. */ @SuppressLint("NewApi") - @Override + //@Override public float getX() { float result; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { @@ -387,7 +402,7 @@ public float getX() { * Convenience method for setting X. */ @SuppressLint("NewApi") - @Override + //@Override public void setX(final float x) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { super.setX(x); @@ -400,7 +415,7 @@ public void setX(final float x) { * Convenience method for getting Y. */ @SuppressLint("NewApi") - @Override + //@Override public float getY() { float result; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { @@ -415,7 +430,7 @@ public float getY() { * Convenience method for setting Y. */ @SuppressLint("NewApi") - @Override + //@Override public void setY(final float y) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { super.setY(y); @@ -461,9 +476,13 @@ public void onAnimationEnd(final Animator animation) { RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) getLayoutParams(); params.leftMargin = (int) toolTipViewX; params.topMargin = (int) toolTipViewY; + } else if (getLayoutParams() instanceof android.widget.FrameLayout.LayoutParams){ + android.widget.FrameLayout.LayoutParams p = (FrameLayout.LayoutParams) getLayoutParams(); + p.leftMargin = (int) toolTipViewX; + p.topMargin = (int) toolTipViewY; + } else { + Log.d(TAG, "onAnimationEnd layout was type " + getLayoutParams().getClass().toString()); } - setX(0); - setY(0); setLayoutParams(getLayoutParams()); } diff --git a/super-tooltip-demo/src/main/AndroidManifest.xml b/super-tooltip-demo/src/main/AndroidManifest.xml index 4ab55ab..7c9c25f 100644 --- a/super-tooltip-demo/src/main/AndroidManifest.xml +++ b/super-tooltip-demo/src/main/AndroidManifest.xml @@ -3,6 +3,7 @@ package="com.spyhunter99.supertooltips.demo" > diff --git a/super-tooltip-demo/src/main/res/values/strings.xml b/super-tooltip-demo/src/main/res/values/strings.xml index 4053009..5aac759 100644 --- a/super-tooltip-demo/src/main/res/values/strings.xml +++ b/super-tooltip-demo/src/main/res/values/strings.xml @@ -13,7 +13,7 @@ Settings ToolTip Examples Tracker Examples - Listview Examples (broken) + Listview Examples ListActivity Default Text TRACKER_LIST