NewsApp

Be informed about World Breaking News!
News App! for your disposal. 👐

Technologies I used:

  1. Retrofit + OkHttp;
  2. MVVM + Room + ViewModel;
  3. RecyclerView + Adapter;
  4. Navigation Component + Fragments;
  5. Pagination;
  6. Coroutines;
  7. LiveData;
  8. ViewBinding;
  9. Landscape option;
  10. NightMode.

👀 Look at the pictures for detalization.

What it does?

1️⃣ When you launch the App, ViewModel queries API for breaking news.
App contains one activity and tree main fragments. + one fragment to read article with WebView.
You navigate via bottom navigation bar.

2️⃣ Tap the article and read the whole content.
Tap fab to add to favorites. Appropriate toast will appear.

3️⃣ Navigate to saved articles.
Room handles local database.

4️⃣ Swipe to delete saved article.
Rest of articles smoothly fill empty spase. It’s possible with DiffUtil callback.
Sure, you can recover deleted article.

5️⃣ Search is also possible!
It happens on the background via coroutines. Beautiful loader view is shown up.
Keyboard goes away when you start scrolling.

6️⃣ My proud – pagination!
To increase speed of app, api loads only 20 results at once. When you achieve lower border of results, api calls again and returns another 20 results.
Works only in one direction. The same can be realized for the upper direction if needed.
Again, nice progress bar appears 😍

7️⃣ Custom layout for landscape. And pretty night theme! 🌒
Theme could be set manually in app, but generally it tightly coupled with system’s theme option.
In landscape mode app shows only header of article to accommodate more articles on the screen.

8️⃣ WebView supports night theme also.
It is realized separately from general theme. Because WebView needs special approach.

9️⃣ Ripple indicates touch event on article or navigation button.
For proper appearance of ripple the mask is needed to round the corners.

1️⃣0️⃣ If internet is missing you are notified.

Most challenging issues I had:

  1. To create logic when it’s needed to paginate or not. A dozen of mediator values was introduced, but no way to make it easier without third-party libraries.

  2. Day/Night modes were new for me. It took much time to sort out differences between styles, themes, colors. 😩
    But now it looks rather simple after all.
    And after my hard efforts to set up theming, it turned out WebView doesn’t support it out of box. 😭
    I solved it by defining the current theme of app in ArticleFragment and depending on it I turn on/off the ForceDark mode of WebView.

  3. It might sound weird, but much time was spent to remove SoftKeyboard when no need of it. 😕
    After all I found an elegant solution :bowtie: – to tie appearance of keyboard with lose of focus of EditText view.
    For it I wrote two extention functions for Context and Fragment classes o hide keyboard and hung focus listener in SearchFragment.
    Plus 1 pattern solution to my utils repo 😊

Thank you for attention! 🙌

💹 Let the news be only positive and motivating.

GitHub

View Github