# This example does an AJAX lookup and is in CoffeeScript
$('.typeahead').typeahead(
# source can be a function
source: (typeahead, query) ->
# this function receives the typeahead object and the query 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
100% — ff | |
99% — fc | |
98% — fa | |
97% — f7 | |
96% — f5 | |
95% — f2 | |
94% — f0 | |
93% — ed | |
92% — eb | |
91% — e8 |
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 2013 Chris Banes | |
* | |
* 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
import android.content.BroadcastReceiver; | |
import android.content.Context; | |
import android.content.Intent; | |
import android.content.IntentFilter; | |
import android.net.ConnectivityManager; | |
import android.net.NetworkInfo; | |
import android.os.Looper; | |
import rx.Observable; | |
import rx.Scheduler; |
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
PublishSubject<Void> viewClickedSubject = PublishSubject.create(); | |
CompositeSubscription startStopCompositeSubscription = new CompositeSubscription(); | |
protected void onStart() { | |
view.setOnClickListener(v-> viewClickedSubject.onNext(null)); | |
Subscription subscription = viewClickedSubject | |
.flatMap(aVoid-> api.getAlert()) | |
.subscribe(this::makeAlertToast, Throwable::printStackTrace); |
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
private final PublishSubject<Void> viewClickedSubject = PublishSubject.create(); | |
private final CompositeSubscription startStopCompositeSubscription = new CompositeSubscription(); | |
@Override | |
protected void onStart() { | |
super.onStart(); | |
view.setOnClickListener(v-> viewClickedSubject.onNext(null)); | |
Subscription subscription = viewClickedSubject |
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 MainActivity extends AppCompatActivity { | |
private final PublishSubject<Object> dialogDisplaySubject = PublishSubject.create(); | |
private final Disposable disposable = dialogDisplaySubject | |
.subscribe(o -> | |
new MyDialogFragment() | |
.show(getSupportFragmentManager(), "DIALOG_TAG") | |
); | |
@Override |
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 MainActivity extends AppCompatActivity { | |
private final Disposable disposable = Observable.timer(5, TimeUnit.SECONDS) | |
.subscribe(o -> | |
new MyDialogFragment() | |
.show(getSupportFragmentManager(), "DIALOG_TAG") | |
); | |
@Override | |
protected void onPause() { |
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 interface Presenter<S, V extends StateView<S>> { | |
void onStart(V view); | |
void onStop(); | |
} |
OlderNewer