Kotlin Retrofit MySQL MVVM Full CRUD with Disk Caching(Java also available) – Camposha

INSANE PREMIUM COURSES OFFER. Access more than 26000 courses for FREE for 2 Months at  Skillshare, an online course platform. No hidden contract.  REGISTER NOW.

Press ESC to close

Sale!
 

Kotlin Retrofit MySQL MVVM Full CRUD with Disk Caching(Java also available)

$10.00 $4.99

Do you want to learn how to create an offline first Retrofit Full CRUD app with disk caching? Do you want to learn how to use Model View ViewModel design pattern in a full app with Retrofit? Do you want to learn how to perform CRUD operations against MySQL database from an android app using Java?

ABOUT THIS PROJECT

This project is designed for students to help them learn create a full android app based on Retrofit as the HTTP Client and MySQL  as the database. We use Java  as the programming language. PHP is our server side language and data will be transmitted in JSON format via HTTP. GSON will be used to parse the JSON but this will be done automatically via Retrofit.

Here are the operations this project teaches you to perform:

(a). POSTING DATA

Say you have a BigThinker/Product/Person etc object that you want to post to database. Well we teach you how to do so via Retrofit. The item will be saved in a mysql database. The advantage of this as opposed to saving locally in SQLite is that that object now becomes available to all users who download the app.

(b). UPDATING DATA

What is the essence of posting data if you can’t update it? Well you can update the database directly at the backend but this isn’t suitable. A better solution is to allow for updating the database directly from the app. We include this capability in this app. The already posted data can be safely edited and updated via a nice UI in the app.

(c). RETRIEVING DATA

Of course retrieving data is a must. Normally when you learn Retrofit using those online courses or projects by other instructors, they always only include this capability. For example fetching data from a movie api allows you to only retrieve content. That isn’t a complete solution especially if you want to master creating a full app. Our data is coming from mysql database and we include other capabilities as well.

(d). DELETING DATA

We also have the ability to delete data. Users can delete data directly from the app. You select the item you want to delete from a recyclerview. You will first be taken to the detail page. From the editing page you can navigate to the delete page where you can easily delete an item.

(e). SEARCHING DATA

We include the capability to search data. We implement the toolbar search pattern. As user types the search term we filter data and highlight search results. You can easily change the highlight color in our adapter class. Searches occur in a dialog fragment this you don’t need to take users to a different page just to search. If the user clicks the result then he/she is taken to the detail page.

(f). PAGINATING DATA

If your app starts getting thousands of people per day and you have thousands of products or items in your database. We don’t your app to crash your database causing you downtime. Pagination can always be tricky so we have implemented one for you. All you need to do is change the number of items you want to be rendered per page. We use the most common technique called Load more pagination.

(g). HARD DISK CACHING

One of the main motivations for creating this project has been to teach how to design an offline first app. Data in this case is to be stored in Hard Disk temporarily and only get downloaded when a change has occured. This is super important as you will probably paying for some hosting resources if you were to release your app to users. Moreover your users probably prefer to save their precious bandwidth. Data will be cached in the disk and users can view already downloaded data without having to redownload them every time they open your app. However if a user adds new item or updates or deletes an existing item, the next time a user visits the listing page we will automatically connect to the server and redownload fresh data to update our cache. Users can also pull on the recyclerview to refresh data.

(h). CREATING BEAUTIFUL REUSABLE PAGES

For example here are the pages we create in this app:

  1. Splash Screen – We animate a logo and textviews to show your app brand.
  2. Dashboard Screen – Is like the central navigation activity in the project. You can change the color of the cards, the images,the texts  etc, You can even add more cards.
  3. About-Us Screen – Use it to show info about you like email and other contact info.
  4. CRUD Screen – Will be intelligently re-used for three important operations: Posting data, Updating data and deleting data. Saves us from creating a lot of pages.
  5. Listing Screen – Very important. Will host three fragments. The first two will be shown in tabs and can be swiped left and right via ViewPager. The other one will be a dialog fragment used to allow us search filter data.
  6. Search Screen – To be used to search filter data with highlights shown.
  7. Detail Screen – To be used to show details of a single item. Will have a beautiful collapsing toolbar with a banner image that can be changed.

We use a combination of activities, fragments and dialog fragments to create those pages.

Well the app has a lot of features and techiniques you will need to create a full app. You can use it as a template.

 

HTTP CLIENT

Our HTTP Client is Retrofit, the most popular HTTP library for android. It is simple, clean and scalable and beginner friendly yet powerful.

SERVER

We will store our data in MySQL database, the most popular RDBMS solution. We use PHP as our server side language. PHP is also the most popular server side language and that’s why we chose it.

LANGUAGE

We have two projects: one written in Kotlin and another in Java.

 

ASYNCHRONOUS REQUESTS

HTTP Requests will be made asynchronously thus freeing up our UI thread. We will handle different states of our response like the progress state, error state and success state cleanly.

REDBEAN PHP

After much research, we’ve chosen to use RedbeanPHP as it’s one of the best PHP ORMs. It is extremely simple, encourages Object Oriented programming and can even generate for us our database and table just based on the design our classes.

ACTIVITIES AND FRAGMENTS

We use activities as our pages. We also have fragments in our listing page. These activities are easy to customize and very independent. All of them share one base class. That base class includes properties and methods common to most or all the other activities. Those properties get derived via Inheritance.

SWIPE TABS

The listings page will include wipe tabs. We achieve this using viewpager. We show our tabs in a tablayout. The first tab will show data only from our hard disk cache. The other tab will show data from our cache as well but it also allows us to refresh our data.

PULL TO REFRESH

If you pull the recyclerview in the second tab in our listings page. Data will be automatically refreshed. This is courtesy of the SwipeRefreshLayout which we wrap around our recyclerview.

LOAD MORE PAGINATION

Our data is downloaded in chunks from the server. Only around 7-10 items get downloaded at a time. This makes the app super fast and efficient. Data is downloaded as the user scrolls. All downlaoded data are added to the cache so that we won’t have to re-download them again.

SEARCH FILTER

Users can search filter. We include a dialog fragment to provide a complete search experience with highlighted searh results.

SUPPORT

In case of any problem, we are available to provide you with full support. Just contact us via the Contacts Form or through my email: oclemmi@gmail.com.

CONTACT US
Weekly Student ProjectsLet us inform you of our new projects,apps,tutorials, courses and updates directly into your email.

Every week we are creating new programming projects, tutorials, courses and udates and informing our subscribers. Subscribe we inform you also.

X