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
import rx.Observable; | |
import java.util.Queue; | |
import java.util.concurrent.ConcurrentLinkedQueue; | |
import java.util.concurrent.Executors; | |
import java.util.concurrent.ScheduledExecutorService; | |
import java.util.concurrent.TimeUnit; | |
/** | |
* Created by harshitbangar on 19/08/16. |
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.drawers.myapplication; | |
import android.annotation.TargetApi; | |
import android.content.Context; | |
import android.graphics.Point; | |
import android.os.Build; | |
import android.util.AttributeSet; | |
import android.view.Display; | |
import android.view.View; | |
import android.view.ViewGroup; |
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
onView(withId(R.id.my_view)) | |
onView(allOf(withId(R.id.my_view), withText("Hello!"))) | |
onView(allOf(withId(R.id.my_view), not(withText("Unwanted")))) |
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
ConnectableObservable<String> remoteUserIdObservable = | |
mUserClient | |
.login() | |
.map(this::checkNonNull) | |
.doOnNext(this::logIn) | |
.map(UserModel::_id); | |
Observable<String> outputObservable = Observable | |
.concat(mSessionManager.getUserIdAsObservable(), remoteUserIdObservable); | |
public Observable<String> getUserIdAsObservable() { |
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 static void main(String[] args) throws InterruptedException { | |
TestSubscriber<Integer> testSubscriber = TestSubscriber.create(5); // For testing backpressure | |
TestObserver<Integer> testObserver = TestObserver.create(); // For testing observable. | |
Flowable<Integer> integerFlowable = getListOfStudentsFlowable(); | |
Observable<Integer> observable = getListOfStudents(); | |
observable.subscribe(testObserver); | |
integerFlowable.subscribe(testSubscriber); | |
testObserver.assertValueCount(100); | |
testSubscriber.assertValueCount(5); | |
} |
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 MainActivity extends AppCompatActivity { | |
private Router router; | |
@Override protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
ViewGroup container = (ViewGroup)findViewById(R.id.controller_container); | |
router = Conductor.attachRouter(this, container, savedInstanceState); |
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
import com.harshitbangar.mvpconductor.BaseController; | |
public class HomeController extends BaseController<HomeView> { | |
@Override | |
protected HomeView createView(@NonNull LayoutInflater inflater, @NonNull ViewGroup container) { | |
return (HomeView) inflater.inflate(R.layout.home, container, false); | |
} | |
public void backPress() { |
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
import com.harshitbangar.mvpconductor.BaseView; | |
class HomeView extends BaseView<HomeController> { | |
public HomeView(Context context) { | |
super(context); | |
inflate(context, R.layout.home, this); | |
Toolbar toolbar = findView(R.id.toolbar); | |
toolbar.setNavigationOnClickListener(new OnClickListener() { | |
@Override public void onClick(View v) { | |
getController().backPress(); |
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
<?xml version="1.0" encoding="utf-8"?> | |
<com.harshitbangar.conductormvp.HomeView | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:orientation="vertical" | |
> | |
<android.support.v7.widget.Toolbar | |
android:layout_width="match_parent" |
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
Observable.just(1) | |
.to(AutoDispose.with(RxLifecycleInterop.from(lifecycleProvider)).forObservable()) | |
.subscribe(...) |