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
""" | |
Copyright 2019 Jason Hu <awaregit at gmail.com> | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 | |
Unless required by applicable law or agreed to in writing, software |
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
public class AppleAppStoreServiceImplTest { | |
@Test | |
public void simpleRxJava() { | |
Observable<Integer> basicObs = Observable.create(new ObservableOnSubscribe<Integer>() { | |
@Override public void subscribe(@NonNull ObservableEmitter<Integer> emitter) | |
throws Throwable { | |
emitter.onNext(5); | |
emitter.onNext(8); | |
emitter.onNext(3); |
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.legalimpurity.asynctaskwrittenfromscratch | |
import android.support.v7.app.AppCompatActivity | |
import android.os.Bundle | |
import kotlinx.android.synthetic.main.activity_main.* | |
import java.lang.ref.WeakReference | |
class MainActivity : AppCompatActivity() { | |
override fun onCreate(savedInstanceState: Bundle?) { |
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.legalimpurity.asynctaskwrittenfromscratch | |
import android.util.Log | |
import com.legalimpurity.asynctaskwrittenfromscratch.MyAsyncTaskCode.MyAsyncTask | |
import kotlinx.android.synthetic.main.activity_main.* | |
import java.io.BufferedInputStream | |
import java.io.BufferedReader | |
import java.io.InputStreamReader | |
import java.io.Reader | |
import java.lang.ref.WeakReference |
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.legalimpurity.asynctaskwrittenfromscratch | |
import android.util.Log | |
import com.legalimpurity.asynctaskwrittenfromscratch.MyAsyncTaskCode.MyAsyncTask | |
class MyAsyncTaskImpl : MyAsyncTask<String>() | |
{ | |
val LOG_TAG = "MyAsyncTask_Logs" | |
override fun doInBackground(): String { |
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.legalimpurity.asynctaskwrittenfromscratch.MyAsyncTaskCode | |
import com.legalimpurity.asynctaskwrittenfromscratch.MyAsyncTaskCode.executors.ExecutorProvider | |
import java.util.concurrent.Callable | |
import java.util.concurrent.Future | |
abstract class MyAsyncTask<ResultTypeWeWantOnPostExecute>{ | |
// Functions to be implemented by the user. | |
abstract fun doInBackground() : ResultTypeWeWantOnPostExecute |
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.legalimpurity.asynctaskwrittenfromscratch.MyAsyncTaskCode | |
import com.legalimpurity.asynctaskwrittenfromscratch.MyAsyncTaskCode.executors.ExecutorProvider | |
import java.util.concurrent.Callable | |
import java.util.concurrent.Future | |
abstract class MyAsyncTask(){ | |
// Functions to be implemented by the user. | |
abstract fun doInBackground() |
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.legalimpurity.asynctaskwrittenfromscratch | |
import android.support.v7.app.AppCompatActivity | |
import android.os.Bundle | |
import kotlinx.android.synthetic.main.activity_main.* | |
class MainActivity : AppCompatActivity() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) |
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.legalimpurity.asynctaskwrittenfromscratch | |
import android.util.Log | |
import com.legalimpurity.asynctaskwrittenfromscratch.MyAsyncTaskCode.MyAsyncTask | |
class MyAsyncTaskImpl : MyAsyncTask() | |
{ | |
val LOG_TAG = "MyAsyncTask_Logs" | |
override fun doInBackground() { |
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.legalimpurity.asynctaskwrittenfromscratch.MyAsyncTaskCode | |
import com.legalimpurity.asynctaskwrittenfromscratch.MyAsyncTaskCode.executors.ExecutorProvider | |
abstract class MyAsyncTask(){ | |
// Functions to be implemented by the user. | |
abstract fun doInBackground() | |
abstract fun onPreExecute() | |
abstract fun onPostExecute() |
NewerOlder