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 NotificationService extends FirebaseMessagingService { | |
| @Override | |
| public void onMessageReceived(RemoteMessage remoteMessage) { | |
| super.onMessageReceived(remoteMessage); | |
| Notification notification = new NotificationCompat.Builder(this) | |
| .setContentTitle(remoteMessage.getData().get(“title”)) | |
| .setContentText(remoteMessage.getData().get(“body”)) | |
| .setSmallIcon(R.mipmap.ic_launcher) | |
| .build(); | |
| NotificationManagerCompat manager = NotificationManagerCompat.from(getApplicationContext()); |
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 NotificationService extends FirebaseMessagingService { | |
| @Override | |
| public void onMessageReceived(RemoteMessage remoteMessage) { | |
| super.onMessageReceived(remoteMessage); | |
| Notification notification = new NotificationCompat.Builder(this) | |
| .setContentTitle(remoteMessage.getNotification().getTitle()) | |
| .setContentText(remoteMessage.getNotification().getBody()) | |
| .setSmallIcon(R.mipmap.ic_launcher) | |
| .build(); | |
| NotificationManagerCompat manager = NotificationManagerCompat.from(getApplicationContext()); |
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 BooksInteractorMock implements BooksInteractor { | |
| @Override | |
| public Observable<BookSearchResult> search(String search) { | |
| return Observable.just(getMockedBookSearchResult()); | |
| } | |
| private BookSearchResult getMockedBookSearchResult() { | |
| BookSearchResult bookSearchResult = new BookSearchResult(); | |
| // bookSearchResult.setBooks(myListOfBooks); | |
| return bookSearchResult; |
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 { | |
| EditText editText; | |
| ImageButton imageButton; | |
| BooksAdapter adapter; | |
| ListView listView; | |
| TextView textNoDataFound; | |
| private CompositeSubscription subscriptions = new CompositeSubscription(); | |
| private BooksViewModel booksViewModel; |
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 BooksViewModel { | |
| private BooksInteractor interactor; | |
| private Scheduler scheduler; | |
| public BooksViewModel(BooksInteractor interactor, Scheduler scheduler) { | |
| this.interactor = interactor; | |
| this.scheduler = scheduler; | |
| } |
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 interface BooksInteractor { | |
| Observable<BookSearchResult> search(String search); | |
| } |
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 implements BooksView { | |
| EditText editText; | |
| ImageButton imageButton; | |
| BooksAdapter adapter; | |
| ListView listView; | |
| TextView textNoDataFound; | |
| private BooksPresenter presenter; | |
| @Override |
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 interface BooksView { | |
| void updateUi(List<Book> books); | |
| } |
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 BooksPresenter { | |
| BooksView view; | |
| private BooksInteractor interactor; | |
| public BooksPresenter(BooksInteractor interactor) { | |
| this.interactor = interactor; | |
| } | |
| public void bind(BooksView view) { |
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 interface BooksInteractor { | |
| Call<BookSearchResult> search(String search); | |
| } |