slowikj / quotable-android-app Goto Github PK
View Code? Open in Web Editor NEWAndroid consumer of Quotable API
License: Apache License 2.0
Android consumer of Quotable API
License: Apache License 2.0
It is worth considering putting lastUpdated
field (that is present in both AuthorsDao
and QuotesDao
) into the origin entity rather than the remote key entity.
Why?
Some of the origins are not related to remote keys such as those that are present in the dashboard.
Currently, in order to handle the aforementioned case, a fake key is put into the database.
It must be emphasized that such an approach is error-prone, as a programmer can easily forget to write this extra line of code.
Result.runCatching
has two major flaws:
Throwables
(also Errors
, such as OutOfMemoryException
).CancellationException
.The following article shows how to avert the above problems:
https://proandroiddev.com/resilient-use-cases-with-kotlin-result-coroutines-and-annotations-511df10e2e16
In short, it recommends to use own, specialized implementation that replaces runCatching
.
Possible paths to consider
The issue occurs when in the local database there exists cached quotes of a particular author
and there is no internet connection.
Then, both quotes view and error and retry view are shown.
Fix: error and retry view should be invisible in this particular case.
The app consists of quotes that are presented in different contexts:
All of the above types should be stored in the local database.
ViewModel should be as reusable as possible, thus, it should not know anything
about specific screen navigation logic, since
it is not always the case that the current Fragment will be totally replaced by a new one.
For example, if we have a tablet, then it is possible that a new Fragment will be shown next to the current one.
In conclusion, we should leave specific navigation logic for UI layer and ViewModel should not be tainted by it.
Sometimes database of authors' images happens to return no response.
In order to handle this corner case and improve UX
the app should show a default placeholder (for example a default image that depicts a single person).
Change names of data source classes in order to be compliant with the latest Android App Architecture Guide.
In particular, change *Service -> *RemoteService
Room
entity to store info about likesQuote
model to store whether a particular quote has been likedOneQuoteRepository
Fragment
ViewModel
getLikedQuotes(): Flow<PagingData<Int, Quote>>
in AllQuotesRepository
LikedQuotesFragment
LikedQuotesViewModel
The main reason beyond this idea is to remove the necessity of manually passing an object of type QuoteOriginParams
.
After having introduced the DataSource
layer, a programmer can call specialized methods,
for instance quotesLocalDataSource.getRandomQuoteFlow
.
seeMore
seeMore
in the ViewModelsee more
layoutsee more
entry in ViewHolder
onClick
listener that navigates to a separate screen containing all items of a particular typeUse ViewPager
:
The first tag related to quotes and the second on to the bio
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.