This file contains hidden or 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
service.getRepo("123") | |
.subscribeOn(Schedulers.io()) | |
.observeOn(AndroidSchedulers.mainThread()) | |
.subscribe( | |
repo -> | |
repoView.setText(repo.getName()), | |
e -> { /* show some error message */ } | |
); | |
This file contains hidden or 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
TestSub<Repo> testSub = new TestSub(); | |
when(service.getRepo(anyString())) | |
.thenReturn(Observable.onCreate(testSub)); | |
activity.onCreate(null); | |
testSub.onNext(new Repo("RxAndroid")); | |
assertThat(repoView).hasText("RxAndroid"); |
This file contains hidden or 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
public class TestSub<T> | |
implements Observable.OnSubscribe<T> { | |
Subscriber<T> sub; | |
public void call(Subscriber<T> sub) { | |
this.sub = sub; | |
} | |
public void onNext(T data) { | |
sub.onNext(data); | |
} | |
... |
This file contains hidden or 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
E/LayerSDK: LayerClientImpl : Exception | |
E/LayerSDK: com.layer.sdk.exceptions.LayerException: DEVICE_PERSISTENCE_FAILURE (9001) - Uncaught Task exception | |
E/LayerSDK: at com.layer.sdk.internal.syncrecon.SyncRecon$a.a(SyncRecon.java:467) | |
E/LayerSDK: at com.layer.sdk.internal.syncrecon.SyncRecon$a.run(SyncRecon.java:599) | |
E/LayerSDK: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076) | |
E/LayerSDK: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569) | |
E/LayerSDK: at java.lang.Thread.run(Thread.java:856) | |
E/LayerSDK: Caused by: android.database.sqlite.SQLiteConstraintException: column stream_id is not unique (code 19) | |
E/LayerSDK: at android.database.sqlite.SQLiteConnection.nativeExecuteForChangedRowCount(Native Method) | |
E/LayerSDK: at android.database.sqlite.SQLiteConnection.executeForChangedRowCount(SQLiteConnection.java:727) |
This file contains hidden or 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
public class TimeZoneRule implements TestRule { | |
private final String timeZoneId; | |
public TimeZoneRule(String timeZoneId) { | |
this.timeZoneId = timeZoneId; | |
} | |
@Override | |
public Statement apply(final Statement base, Description description) { | |
return new Statement() { |
This file contains hidden or 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
# Built application files | |
*.apk | |
*.ap_ | |
# Files for the Dalvik VM | |
*.dex | |
# Java class files | |
*.class |
This file contains hidden or 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
package com.playdraft.hexigonimageview; | |
import android.content.Context; | |
import android.graphics.Bitmap; | |
import android.graphics.Canvas; | |
import android.graphics.Color; | |
import android.graphics.CornerPathEffect; | |
import android.graphics.Paint; | |
import android.graphics.Path; | |
import android.graphics.PorterDuff; |
This file contains hidden or 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
keytool -genkey -v -keystore keystore.keystore -alias alias -storepass password -keypass password -keyalg RSA -validity 36500 |
This file contains hidden or 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
/* | |
* copied from: http://stackoverflow.com/questions/8501920/how-to-mock-a-builder-with-mockito | |
*/ | |
import static org.mockito.Mockito.RETURNS_DEFAULTS; | |
import org.mockito.invocation.InvocationOnMock; | |
import org.mockito.stubbing.Answer; | |
public class SelfReturningAnswer implements Answer<Object>{ |
This file contains hidden or 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
Intent intent = new Intent(this, NextActivity.class); | |
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); | |
startActivity(intent); | |
finish(); |