Skip to content

Instantly share code, notes, and snippets.

View ravidsrk's full-sized avatar
🎯
Focusing

Ravindra Kumar ravidsrk

🎯
Focusing
View GitHub Profile
@ravidsrk
ravidsrk / android-26-sources.md
Created September 12, 2017 02:38 — forked from cketti/android-26-sources.md
Build your own android-26 sources

If you are annoyed that "Sources for Android 26" are not yet available via SDK manager, this might be for you:

  1. Collect source files
mkdir android-sdk-source-build
cd android-sdk-source-build

mkdir -p frameworks/base
java.lang.IllegalStateException: classCaptor.capture() must not be null
public class DemoFragment extends BaseFragment implements DemoView {
@Override
public void displayMessageFromApi(String apiMessage) {
...
}
}
// Kotlin class
class DemoResponse {
@SerializedName("message") var message: String? = null
}
// Typecasting to String
mainView?.displayMessageFromApi(demoResponse.message as String)
public class MainActivity extends BaseActivity implements MainMvpView, ErrorView.ErrorListener {
...
private void pokemonClicked(Pokemon pokemon) {
startActivity(DetailActivity.Companion.getStartIntent(this, pokemon))
}
...
}
class DetailActivity : BaseActivity(), DetailMvpView, ErrorView.ErrorListener {
companion object {
val EXTRA_POKEMON_NAME = "EXTRA_POKEMON_NAME"
fun getStartIntent(context: Context, pokemonName: String): Intent {
val intent = Intent(context, DetailActivity::class.java)
intent.putExtra(EXTRA_POKEMON_NAME, pokemonName)
return intent
}
public class DetailActivity extends BaseActivity implements DetailMvpView, ErrorView.ErrorListener {
public static final String EXTRA_POKEMON_NAME = "EXTRA_POKEMON_NAME";
public static Intent getStartIntent(Context context, String pokemonName) {
Intent intent = new Intent(context, DetailActivity.class);
intent.putExtra(EXTRA_POKEMON_NAME, pokemonName);
return intent;
}
...
interface DemoService {
@get:GET("posts")
val demoResponse: Observable<PostResponse>
@get:GET("categories")
val demoResponse2: Observable<CategotyResponse>
}
public interface DemoService {
@GET("posts")
Observable<PostResponse> getDemoResponse();
@GET("categories")
Observable<CategoryResponse> getDemoResponse2();
}
class DataManagerTest {
@Rule @JvmField val overrideSchedulersRule = RxSchedulersOverrideRule()
@Mock lateinit var mockPokemonService: PokemonService
private lateinit var dataManager: DataManager
@Before
fun setUp() {
dataManager = DataManager(mockPokemonService)