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
package com.germanautolabs.chris.utils | |
import android.content.Context | |
import android.graphics.Canvas | |
import android.graphics.Rect | |
import android.graphics.drawable.Drawable | |
import android.support.v7.widget.LinearLayoutManager | |
import android.support.v7.widget.RecyclerView | |
import android.util.Log | |
import android.view.View |
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
// building PhoneNumber objects | |
val phoneHome = AddressBookProtos.Person.PhoneNumber.newBuilder() | |
.setNumber("+49123456") | |
.setType(AddressBookProtos.Person.PhoneType.HOME) | |
.build() | |
val phoneMobile = AddressBookProtos.Person.PhoneNumber.newBuilder() | |
.setNumber("+49654321") | |
.setType(AddressBookProtos.Person.PhoneType.MOBILE) | |
.build() |
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
syntax = "proto2"; | |
package tutorial; | |
option java_package = "com.mohsenoid.protobuftest"; | |
option java_outer_classname = "AddressBookProtos"; | |
message Person { | |
required string name = 1; | |
required int32 id = 2; |
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
apply plugin: 'java-library' | |
apply plugin: 'com.google.protobuf' | |
sourceSets { | |
main.java.srcDirs += "${protobuf.generatedFilesBaseDir}/main/javalite" | |
} | |
dependencies { | |
implementation fileTree(dir: 'libs', include: ['*.jar']) | |
implementation 'com.google.protobuf:protobuf-lite:3.0.0' |
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
// Top-level build file where you can add configuration options common to all sub-projects/modules. | |
buildscript { | |
ext.kotlin_version = '1.2.10' | |
ext.protobufVersion = '0.8.3' | |
repositories { | |
google() | |
jcenter() | |
} |
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
package com.mirhoseini.marvel.activity; | |
/*...*/ | |
@RunWith(AndroidJUnit4.class) | |
public class MainActivityTest { | |
private static final String TEST_CHARACTER_NAME = "Test Name"; | |
private static final String TEST_CHARACTER_DESCRIPTION = "Test Description"; | |
private static final String TEST_CHARACTER_THUMBNAIL_PATH = "Test Thumbnail"; |
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
package com.mirhoseini.marvel; | |
/*...*/ | |
public class MarvelTestApplication extends MarvelApplicationImpl { | |
@Override | |
public ApplicationTestComponent createComponent() { | |
return DaggerApplicationTestComponent | |
.builder() |
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
package com.mirhoseini.marvel; | |
/*...*/ | |
public class MarvelTestRunner extends AndroidJUnitRunner { | |
@Override | |
public Application newApplication(ClassLoader classLoader, String className, Context context) | |
throws InstantiationException, IllegalAccessException, ClassNotFoundException { | |
// replace Application class with mock one |
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
package com.mirhoseini.marvel.activity; | |
/*...*/ | |
@RunWith(RobolectricTestRunner.class) | |
@Config(constants = BuildConfig.class, sdk = 21, shadows = {ShadowSnackbar.class}) | |
public class MainActivityRobolectricTest { | |
private final static String TEST_TEXT = "This is a test text."; | |
private MainActivity activity; |
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
package com.mirhoseini.marvel.character.search; | |
/*...*/ | |
import org.junit.Before; | |
import org.junit.Test; | |
import java.util.Collections; | |
import rx.Observable; |