Skip to content

Commit

Permalink
1.0.9 - Fixed AppCompatActivity related crash
Browse files Browse the repository at this point in the history
  • Loading branch information
code-mc committed Sep 28, 2015
1 parent 428d2b9 commit c5796a1
Show file tree
Hide file tree
Showing 13 changed files with 84 additions and 37 deletions.
7 changes: 4 additions & 3 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 25 additions & 2 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
```

Expand Down
21 changes: 14 additions & 7 deletions app/app.iml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<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">
<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">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
Expand All @@ -13,8 +13,11 @@
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugAndroidTest" />
<option name="SOURCE_GEN_TASK_NAME" value="generateDebugSources" />
<option name="TEST_SOURCE_GEN_TASK_NAME" value="generateDebugAndroidTestSources" />
<option name="COMPILE_JAVA_TEST_TASK_NAME" value="compileDebugAndroidTestSources" />
<afterSyncTasks>
<task>generateDebugAndroidTestSources</task>
<task>generateDebugSources</task>
</afterSyncTasks>
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
Expand All @@ -23,7 +26,7 @@
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="false">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_6" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/androidTest/debug" />
<exclude-output />
Expand Down Expand Up @@ -68,6 +71,8 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/22.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/22.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" />
Expand All @@ -88,7 +93,9 @@
<orderEntry type="jdk" jdkName="Android API 22 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="library-2.4.0" level="project" />
<orderEntry type="library" exported="" name="load-toast-1.0.8" level="project" />
<orderEntry type="library" exported="" name="support-v4-22.2.1" level="project" />
<orderEntry type="library" exported="" name="support-annotations-22.2.1" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-22.2.1" level="project" />
<orderEntry type="module" module-name="loadtoast" exported="" />
</component>
</module>

</module>
5 changes: 3 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apply plugin: 'com.android.application'

android {
compileSdkVersion 22
buildToolsVersion "21.1.1"
buildToolsVersion "22.0.1"

lintOptions {
abortOnError false
Expand Down Expand Up @@ -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.+'
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="android:Theme.DeviceDefault">
<style name="AppTheme" parent="Theme.AppCompat.Light">
<item name="android:colorAccent">@color/color_accent</item>
<!-- Customize your theme here. -->
</style>
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions gestureTrackerLib.iml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<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">
<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">
<component name="FacetManager">
<facet type="java-gradle" name="Java-Gradle">
<configuration>
<option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
<option name="BUILDABLE" value="false" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="true">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_6" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

</module>
4 changes: 2 additions & 2 deletions loadtoast/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 8 additions & 6 deletions loadtoast/loadtoast.iml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<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">
<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">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
Expand All @@ -13,8 +13,11 @@
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugAndroidTest" />
<option name="SOURCE_GEN_TASK_NAME" value="generateDebugSources" />
<option name="TEST_SOURCE_GEN_TASK_NAME" value="generateDebugAndroidTestSources" />
<option name="COMPILE_JAVA_TEST_TASK_NAME" value="compileDebugAndroidTestSources" />
<afterSyncTasks>
<task>generateDebugAndroidTestSources</task>
<task>generateDebugSources</task>
</afterSyncTasks>
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
Expand All @@ -24,7 +27,7 @@
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="false">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/androidTest/debug" />
<exclude-output />
Expand Down Expand Up @@ -94,5 +97,4 @@
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="library-2.4.0" level="project" />
</component>
</module>

</module>
17 changes: 15 additions & 2 deletions loadtoast/src/main/java/net/steamcrafted/loadtoast/LoadToast.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);
Expand Down Expand Up @@ -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;
}

Expand All @@ -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));
Expand All @@ -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;
}
}

0 comments on commit c5796a1

Please sign in to comment.