diff --git a/.idea/encodings.xml b/.idea/encodings.xml
index e206d70..f758959 100644
--- a/.idea/encodings.xml
+++ b/.idea/encodings.xml
@@ -1,5 +1,6 @@
-
-
-
+
+
+
+
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
index 8c3735b..f89905d 100644
--- a/.idea/gradle.xml
+++ b/.idea/gradle.xml
@@ -3,8 +3,10 @@
-
-
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 4ae8d54..9f1e1ea 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -3,6 +3,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -22,5 +46,4 @@
-
-
+
\ No newline at end of file
diff --git a/README.md b/README.md
index 9b9606f..b50d85d 100644
--- a/README.md
+++ b/README.md
@@ -13,7 +13,7 @@ The default toasts are ugly and don't really provide much more than a short mess
#### Gradle
```groovy
dependencies {
- compile 'net.steamcrafted:load-toast:1.0.8'
+ compile 'net.steamcrafted:load-toast:1.0.9'
}
```
diff --git a/app/app.iml b/app/app.iml
index b79496f..b532a34 100644
--- a/app/app.iml
+++ b/app/app.iml
@@ -1,5 +1,5 @@
-
+
@@ -13,8 +13,11 @@
-
-
+
+
+ generateDebugAndroidTestSources
+ generateDebugSources
+
@@ -23,7 +26,7 @@
-
+
@@ -68,6 +71,8 @@
+
+
@@ -88,7 +93,9 @@
-
+
+
+
+
-
-
+
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index 58668cf..a9ff438 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion 22
- buildToolsVersion "21.1.1"
+ buildToolsVersion "22.0.1"
lintOptions {
abortOnError false
@@ -31,5 +31,6 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
- compile 'net.steamcrafted:load-toast:1.0.8'
+ compile project(':loadtoast')
+ compile 'com.android.support:appcompat-v7:22.+'
}
diff --git a/app/src/main/java/net/steamcrafted/loadtoastlib/MainActivity.java b/app/src/main/java/net/steamcrafted/loadtoastlib/MainActivity.java
index 6ba173c..871e2d0 100644
--- a/app/src/main/java/net/steamcrafted/loadtoastlib/MainActivity.java
+++ b/app/src/main/java/net/steamcrafted/loadtoastlib/MainActivity.java
@@ -5,18 +5,17 @@
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
+import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.ViewGroup;
import net.steamcrafted.loadtoast.LoadToast;
-public class MainActivity extends Activity {
+public class MainActivity extends AppCompatActivity {
// Example activity
- int delay = 0;
-
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index c58ed25..f70fbf0 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -1,7 +1,7 @@
-
diff --git a/build.gradle b/build.gradle
index f935f4c..96ed4d6 100644
--- a/build.gradle
+++ b/build.gradle
@@ -6,7 +6,7 @@ buildscript {
}
dependencies {
- classpath 'com.android.tools.build:gradle:1.1.1'
+ classpath 'com.android.tools.build:gradle:1.2+'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
diff --git a/gestureTrackerLib.iml b/gestureTrackerLib.iml
index 0bb6048..6c2c469 100644
--- a/gestureTrackerLib.iml
+++ b/gestureTrackerLib.iml
@@ -1,13 +1,14 @@
-
+
+
-
+
@@ -15,5 +16,4 @@
-
-
+
\ No newline at end of file
diff --git a/loadtoast/build.gradle b/loadtoast/build.gradle
index bbe110b..840a665 100644
--- a/loadtoast/build.gradle
+++ b/loadtoast/build.gradle
@@ -3,12 +3,12 @@ apply plugin: 'com.android.library'
ext {
PUBLISH_GROUP_ID = 'net.steamcrafted'
PUBLISH_ARTIFACT_ID = 'load-toast'
- PUBLISH_VERSION = '1.0.8'
+ PUBLISH_VERSION = '1.0.9'
}
android {
compileSdkVersion 22
- buildToolsVersion "21.1.1"
+ buildToolsVersion "22.0.1"
defaultConfig {
minSdkVersion 8
diff --git a/loadtoast/loadtoast.iml b/loadtoast/loadtoast.iml
index d207d12..e52530d 100644
--- a/loadtoast/loadtoast.iml
+++ b/loadtoast/loadtoast.iml
@@ -1,5 +1,5 @@
-
+
@@ -13,8 +13,11 @@
-
-
+
+
+ generateDebugAndroidTestSources
+ generateDebugSources
+
@@ -24,7 +27,7 @@
-
+
@@ -94,5 +97,4 @@
-
-
+
\ No newline at end of file
diff --git a/loadtoast/src/main/java/net/steamcrafted/loadtoast/LoadToast.java b/loadtoast/src/main/java/net/steamcrafted/loadtoast/LoadToast.java
index c7c9abe..868f531 100644
--- a/loadtoast/src/main/java/net/steamcrafted/loadtoast/LoadToast.java
+++ b/loadtoast/src/main/java/net/steamcrafted/loadtoast/LoadToast.java
@@ -9,6 +9,7 @@
import android.view.animation.AccelerateInterpolator;
import android.view.animation.DecelerateInterpolator;
+import com.nineoldandroids.animation.Animator;
import com.nineoldandroids.view.ViewHelper;
import com.nineoldandroids.view.ViewPropertyAnimator;
@@ -24,6 +25,8 @@ public class LoadToast {
private boolean mShowCalled = false;
private boolean mToastCanceled = false;
private boolean mInflated = false;
+ private boolean mVisible = false;
+
public LoadToast(Context context){
mView = new LoadToastView(context);
@@ -87,6 +90,10 @@ public LoadToast show(){
ViewPropertyAnimator.animate(mView).alpha(1f).translationY(25 + mTranslationY)
.setInterpolator(new DecelerateInterpolator())
.setDuration(300).setStartDelay(0).start();
+
+ mVisible = true;
+ checkZPosition();
+
return this;
}
@@ -109,10 +116,13 @@ public void error(){
}
private void checkZPosition(){
+ // If the toast isn't visible, no point in updating all the views
+ if(!mVisible) return;
+
int pos = mParentView.indexOfChild(mView);
int count = mParentView.getChildCount();
if(pos != count-1){
- mParentView.removeView(mView);
+ ((ViewGroup) mView.getParent()).removeView(mView);
mParentView.requestLayout();
mParentView.addView(mView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT));
@@ -123,6 +133,9 @@ private void slideUp(){
ViewPropertyAnimator.animate(mView).setStartDelay(1000).alpha(0f)
.translationY(-mView.getHeight() + mTranslationY)
.setInterpolator(new AccelerateInterpolator())
- .setDuration(300).start();
+ .setDuration(300)
+ .start();
+
+ mVisible = false;
}
}