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 TestFragment extends AirFragment { | |
private static final int REQUEST_MANAGER_ID = 1; | |
@Inject RequestManager mRequestManager; | |
private RequestListener mListener = new RequestListener() { | |
@Override | |
public void onErrorResponse(VolleyError error) { | |
} |
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
require 'time' | |
require 'json' | |
require "rexml/document" | |
# Get the secret from monorail's encrypted databag | |
# (e.g. /srv/airbnb/on/config/configatron/secure.yml) | |
# under `api_private_translate`, `secret`. | |
SECRET = ARGV[0] | |
URL = 'https://www.airbnb.com' |
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.airbnb.epoxy | |
import android.content.Context | |
import android.graphics.Bitmap | |
import android.support.annotation.IdRes | |
import android.support.annotation.Px | |
import android.support.v7.widget.RecyclerView | |
import android.view.View | |
import com.bumptech.glide.Glide | |
import com.bumptech.glide.RequestBuilder |
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 android.support.v7.widget.RecyclerView; | |
import android.support.v7.widget.RecyclerView.Adapter; | |
import android.support.v7.widget.RecyclerView.AdapterDataObserver; | |
import android.support.v7.widget.RecyclerView.ViewHolder; | |
import android.view.ViewGroup; | |
import java.util.List; | |
/** | |
* This Adapter class wraps another Adapter in order to support cyclical scrolling. |
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
/** | |
* Edit the contents of a File with a [FileEditor]. The new contents will override the old. | |
* | |
* @param lineTransform Called with each line of the file in order. | |
* Return the new value you would like written in the file, or null to delete the line. | |
* You can also call [FileEditor.insertNext] to insert a line immediately above the given line, or | |
* [FileEditor.insertPrevious] to insert a line immediately after the given line. | |
*/ | |
fun File.edit(lineTransform: FileEditor.(line: String) -> String) { | |
FileEditor(this).edit(lineTransform) |
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
// MvRx setup | |
data class MyState( | |
val text: String? = null | |
) | |
class MyViewModel : MvRxViewModel() { | |
fun setText(newText: String) { | |
setState { | |
copy(text = newText) |
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
data class MyState(val text: String = "Hello World") : MvRxState | |
class MyViewModel(state: MyState) : BaseMvRxViewModel<MyState>(state) | |
class MyFragment : MvRxFragment() { | |
val viewModel: MyViewModel by fragmentViewModel() | |
fun epoxyController() = simpleController(viewModel) { state -> | |
textRow { |
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
class DadJokeFragment : MvRxFragment() { | |
val viewModel: DadJokeViewModel by fragmentViewModel() | |
override fun provideMocks() = mockSingleViewModel( | |
viewModelReference = DadJokeFragment::viewModel, | |
defaultState = mockDadJokeState | |
) | |
} |
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
val mockDadJokeState = DadJokeState( | |
jokes = Success( | |
value = JokesResponse( | |
nextPage = 3, | |
results = listOf( | |
Joke( | |
id = "0LuXvkq4Muc", | |
joke = "I'm tired of following my dreams. I'm just going to ask them where they are going and meet up with them later." | |
), | |
Joke( |
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
override fun provideMocks() = mockSingleViewModel( | |
viewModelReference = DadJokeFragment::viewModel, | |
defaultState = mockDadJokeState | |
) { | |
state("Loading") { | |
copy(jokes = Loading()) | |
} | |
state("Empty results") { | |
copy(jokes = Success(jokes.copy(results = emptyList()))) |
OlderNewer