-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from inaka/ramabit.only.task
Ramabit.variable.parameters
- Loading branch information
Showing
7 changed files
with
60 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
library/src/androidTest/java/com/inaka/killertask/VariableParametersTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.inaka.killertask; | ||
|
||
import android.test.AndroidTestCase; | ||
import android.test.UiThreadTest; | ||
|
||
/** | ||
* Created by inaka on 1/22/16. | ||
*/ | ||
public class VariableParametersTest extends AndroidTestCase { | ||
|
||
@UiThreadTest | ||
public void testLibraryWithBlocks() { | ||
new ExampleVariableParametersTasks(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
library/src/main/java/com/inaka/killertask/ExampleVariableParametersTasks.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.inaka.killertask | ||
|
||
import android.util.Log | ||
import java.util.concurrent.CountDownLatch | ||
import java.util.concurrent.TimeUnit | ||
|
||
/** | ||
* Created by inaka on 1/22/16. | ||
*/ | ||
private class ExampleVariableParametersTasks { | ||
|
||
val signal = CountDownLatch(1); | ||
|
||
init { | ||
// 1) | ||
KillerTask({ Log.wtf("LOG", "KillerTask is awesome") }).go() // only main task | ||
|
||
// 2) | ||
KillerTask( | ||
{ Log.wtf("LOG", "KillerTask is awesome") }, // main task | ||
{ Log.wtf("LOG", "Super awesome!")} // onSuccess | ||
).go() | ||
|
||
// 3) | ||
KillerTask( | ||
{ // main task | ||
Log.wtf("LOG", "KillerTask is awesome") | ||
"super" // implicit return | ||
}, | ||
{}, // onSuccess is empty | ||
{ e: Exception? -> Log.wtf("LOG", e.toString()) } // onFailed | ||
).go() | ||
|
||
signal.await(5, TimeUnit.SECONDS) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters