Skip to content

Commit c5796a1

Browse files
committed
1.0.9 - Fixed AppCompatActivity related crash
1 parent 428d2b9 commit c5796a1

File tree

13 files changed

+84
-37
lines changed

13 files changed

+84
-37
lines changed

.idea/encodings.xml

+4-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/gradle.xml

+4-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

+25-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ The default toasts are ugly and don't really provide much more than a short mess
1313
#### Gradle
1414
```groovy
1515
dependencies {
16-
compile 'net.steamcrafted:load-toast:1.0.8'
16+
compile 'net.steamcrafted:load-toast:1.0.9'
1717
}
1818
```
1919

app/app.iml

+14-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="gestureTrackerLib" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
2+
<module external.linked.project.id=":app" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="gestureTrackerLib" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
33
<component name="FacetManager">
44
<facet type="android-gradle" name="Android-Gradle">
55
<configuration>
@@ -13,8 +13,11 @@
1313
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
1414
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
1515
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugAndroidTest" />
16-
<option name="SOURCE_GEN_TASK_NAME" value="generateDebugSources" />
17-
<option name="TEST_SOURCE_GEN_TASK_NAME" value="generateDebugAndroidTestSources" />
16+
<option name="COMPILE_JAVA_TEST_TASK_NAME" value="compileDebugAndroidTestSources" />
17+
<afterSyncTasks>
18+
<task>generateDebugAndroidTestSources</task>
19+
<task>generateDebugSources</task>
20+
</afterSyncTasks>
1821
<option name="ALLOW_USER_CONFIGURATION" value="false" />
1922
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
2023
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
@@ -23,7 +26,7 @@
2326
</configuration>
2427
</facet>
2528
</component>
26-
<component name="NewModuleRootManager" inherit-compiler-output="false">
29+
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_6" inherit-compiler-output="false">
2730
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
2831
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/androidTest/debug" />
2932
<exclude-output />
@@ -68,6 +71,8 @@
6871
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
6972
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
7073
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
74+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/22.2.1/jars" />
75+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/22.2.1/jars" />
7176
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
7277
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
7378
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" />
@@ -88,7 +93,9 @@
8893
<orderEntry type="jdk" jdkName="Android API 22 Platform" jdkType="Android SDK" />
8994
<orderEntry type="sourceFolder" forTests="false" />
9095
<orderEntry type="library" exported="" name="library-2.4.0" level="project" />
91-
<orderEntry type="library" exported="" name="load-toast-1.0.8" level="project" />
96+
<orderEntry type="library" exported="" name="support-v4-22.2.1" level="project" />
97+
<orderEntry type="library" exported="" name="support-annotations-22.2.1" level="project" />
98+
<orderEntry type="library" exported="" name="appcompat-v7-22.2.1" level="project" />
99+
<orderEntry type="module" module-name="loadtoast" exported="" />
92100
</component>
93-
</module>
94-
101+
</module>

app/build.gradle

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
22

33
android {
44
compileSdkVersion 22
5-
buildToolsVersion "21.1.1"
5+
buildToolsVersion "22.0.1"
66

77
lintOptions {
88
abortOnError false
@@ -31,5 +31,6 @@ android {
3131

3232
dependencies {
3333
compile fileTree(dir: 'libs', include: ['*.jar'])
34-
compile 'net.steamcrafted:load-toast:1.0.8'
34+
compile project(':loadtoast')
35+
compile 'com.android.support:appcompat-v7:22.+'
3536
}

app/src/main/java/net/steamcrafted/loadtoastlib/MainActivity.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,17 @@
55
import android.graphics.Color;
66
import android.os.Bundle;
77
import android.os.Handler;
8+
import android.support.v7.app.AppCompatActivity;
89
import android.view.View;
910
import android.view.ViewGroup;
1011

1112
import net.steamcrafted.loadtoast.LoadToast;
1213

1314

14-
public class MainActivity extends Activity {
15+
public class MainActivity extends AppCompatActivity {
1516

1617
// Example activity
1718

18-
int delay = 0;
19-
2019
@Override
2120
public void onCreate(Bundle savedInstanceState) {
2221
super.onCreate(savedInstanceState);

app/src/main/res/values/styles.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<resources>
22

33
<!-- Base application theme. -->
4-
<style name="AppTheme" parent="android:Theme.DeviceDefault">
4+
<style name="AppTheme" parent="Theme.AppCompat.Light">
55
<item name="android:colorAccent">@color/color_accent</item>
66
<!-- Customize your theme here. -->
77
</style>

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ buildscript {
66
}
77

88
dependencies {
9-
classpath 'com.android.tools.build:gradle:1.1.1'
9+
classpath 'com.android.tools.build:gradle:1.2+'
1010

1111
// NOTE: Do not place your application dependencies here; they belong
1212
// in the individual module build.gradle files

gestureTrackerLib.iml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
2+
<module external.linked.project.id="gestureTrackerLib" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
33
<component name="FacetManager">
44
<facet type="java-gradle" name="Java-Gradle">
55
<configuration>
66
<option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
7+
<option name="BUILDABLE" value="false" />
78
</configuration>
89
</facet>
910
</component>
10-
<component name="NewModuleRootManager" inherit-compiler-output="true">
11+
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_6" inherit-compiler-output="true">
1112
<exclude-output />
1213
<content url="file://$MODULE_DIR$">
1314
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
1415
</content>
1516
<orderEntry type="inheritedJdk" />
1617
<orderEntry type="sourceFolder" forTests="false" />
1718
</component>
18-
</module>
19-
19+
</module>

loadtoast/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ apply plugin: 'com.android.library'
33
ext {
44
PUBLISH_GROUP_ID = 'net.steamcrafted'
55
PUBLISH_ARTIFACT_ID = 'load-toast'
6-
PUBLISH_VERSION = '1.0.8'
6+
PUBLISH_VERSION = '1.0.9'
77
}
88

99
android {
1010
compileSdkVersion 22
11-
buildToolsVersion "21.1.1"
11+
buildToolsVersion "22.0.1"
1212

1313
defaultConfig {
1414
minSdkVersion 8

loadtoast/loadtoast.iml

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="gestureTrackerLib" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
2+
<module external.linked.project.id=":loadtoast" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="gestureTrackerLib" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
33
<component name="FacetManager">
44
<facet type="android-gradle" name="Android-Gradle">
55
<configuration>
@@ -13,8 +13,11 @@
1313
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
1414
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
1515
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugAndroidTest" />
16-
<option name="SOURCE_GEN_TASK_NAME" value="generateDebugSources" />
17-
<option name="TEST_SOURCE_GEN_TASK_NAME" value="generateDebugAndroidTestSources" />
16+
<option name="COMPILE_JAVA_TEST_TASK_NAME" value="compileDebugAndroidTestSources" />
17+
<afterSyncTasks>
18+
<task>generateDebugAndroidTestSources</task>
19+
<task>generateDebugSources</task>
20+
</afterSyncTasks>
1821
<option name="ALLOW_USER_CONFIGURATION" value="false" />
1922
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
2023
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
@@ -24,7 +27,7 @@
2427
</configuration>
2528
</facet>
2629
</component>
27-
<component name="NewModuleRootManager" inherit-compiler-output="false">
30+
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false">
2831
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
2932
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/androidTest/debug" />
3033
<exclude-output />
@@ -94,5 +97,4 @@
9497
<orderEntry type="sourceFolder" forTests="false" />
9598
<orderEntry type="library" exported="" name="library-2.4.0" level="project" />
9699
</component>
97-
</module>
98-
100+
</module>

loadtoast/src/main/java/net/steamcrafted/loadtoast/LoadToast.java

+15-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import android.view.animation.AccelerateInterpolator;
1010
import android.view.animation.DecelerateInterpolator;
1111

12+
import com.nineoldandroids.animation.Animator;
1213
import com.nineoldandroids.view.ViewHelper;
1314
import com.nineoldandroids.view.ViewPropertyAnimator;
1415

@@ -24,6 +25,8 @@ public class LoadToast {
2425
private boolean mShowCalled = false;
2526
private boolean mToastCanceled = false;
2627
private boolean mInflated = false;
28+
private boolean mVisible = false;
29+
2730

2831
public LoadToast(Context context){
2932
mView = new LoadToastView(context);
@@ -87,6 +90,10 @@ public LoadToast show(){
8790
ViewPropertyAnimator.animate(mView).alpha(1f).translationY(25 + mTranslationY)
8891
.setInterpolator(new DecelerateInterpolator())
8992
.setDuration(300).setStartDelay(0).start();
93+
94+
mVisible = true;
95+
checkZPosition();
96+
9097
return this;
9198
}
9299

@@ -109,10 +116,13 @@ public void error(){
109116
}
110117

111118
private void checkZPosition(){
119+
// If the toast isn't visible, no point in updating all the views
120+
if(!mVisible) return;
121+
112122
int pos = mParentView.indexOfChild(mView);
113123
int count = mParentView.getChildCount();
114124
if(pos != count-1){
115-
mParentView.removeView(mView);
125+
((ViewGroup) mView.getParent()).removeView(mView);
116126
mParentView.requestLayout();
117127
mParentView.addView(mView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
118128
ViewGroup.LayoutParams.WRAP_CONTENT));
@@ -123,6 +133,9 @@ private void slideUp(){
123133
ViewPropertyAnimator.animate(mView).setStartDelay(1000).alpha(0f)
124134
.translationY(-mView.getHeight() + mTranslationY)
125135
.setInterpolator(new AccelerateInterpolator())
126-
.setDuration(300).start();
136+
.setDuration(300)
137+
.start();
138+
139+
mVisible = false;
127140
}
128141
}

0 commit comments

Comments
 (0)