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
@Module | |
public class MyAppModuleMock extends MyAppModule { | |
@Provides | |
@Singleton | |
@Override | |
MyAppNetworkService providesMyAppNetworkService() { | |
return new MyAppNetworkServiceMock(); | |
} |
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
@RunWith(AndroidJUnit4.class) | |
public class MainActivityTests { | |
@Rule | |
public ActivityTestRule<MainActivity> activityRule = | |
new ActivityTestRule<>(MainActivity.class); | |
@Before | |
public void init() { |
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 MyAppNetworkServiceMock extends MyAppNetworkService { | |
@Override | |
public List<Object> getUsers() { | |
List<Object> objects = new ArrayList<>(); | |
//Mocking | |
//..................... | |
objects.add(new Object()); |
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 { | |
@Inject | |
MyAppNetworkService myAppNetworkService; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); |
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
@Singleton | |
@Component(modules = { | |
MyAppModule.class}) | |
public interface MyAppComponent { | |
void inject(MainActivity activity); | |
} |
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 MyAppApplication extends Application { | |
MyAppComponent myAppComponent; | |
@Override | |
public void onCreate() { | |
super.onCreate(); | |
myAppComponent = DaggerMyAppComponent.builder() | |
.myAppModule(new MyAppModule()) |
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 { | |
ChatAdapter chatAdapter; | |
RecyclerView recyclerView; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
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
public class MainActivity extends AppCompatActivity { | |
ChatAdapter chatAdapter; | |
RecyclerView recyclerView; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); |
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 ChatAdapter extends RecyclerView.Adapter<ItemViewHolder> { | |
private final Context context; | |
public ChatAdapter(Context context) { | |
this.context = context; | |
} | |
protected List<Item> items = new ArrayList<>(); |
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 FetchingJsonActivity extends AppCompatActivity { | |
@Inject | |
UserService userService; | |
private UserView someView; | |
private CompositeSubscription compositeSubscription = new CompositeSubscription(); | |
@Override | |
protected void onCreate(@Nullable Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); |
NewerOlder