Showing Orders

Today, we had to complete the orders module. We were supposed to show the list of orders in the first screen. On click of any order, we have to show the details (Products ordered, total amount etc. ).

There was lot of work to do. We accomplished the task at the end, which resulted in following output :

Placing the orders from Cart

Today, I worked on the Cart Screen. We planned to show Grid View of Products added in Cart. Though we face little challenges while implementing that, at last we managed to do so which led to following output :

cart

 

We have to provide another feature to user that he can save the complete order for later ordering.

 

 

Android Action-Item Badge

To show the numbering on the cart depending on the number of products in cart, we used the library Android-ActionItemBadge.

To use this, add in the gradle file :

dependencies {
	implementation 'com.mikepenz:actionitembadge:3.3.2@aar'
	implementation 'com.mikepenz:iconics-core:{latestVersion}@aar'
	implementation "com.android.support:appcompat-v7:${supportLibVersion}"
}

 

In the menu item, add :

<menu xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      xmlns:app="http://schemas.android.com/apk/res-auto">
    <item
        android:id="@+id/item_samplebadge"
        app:actionLayout="@layout/menu_action_item_badge"
        app:showAsAction="always"
        android:title="@string/sample_1"/>
</menu>

 

In OnCreateOptionsMenu, add :


public boolean onCreateOptionsMenu(Menu menu) {getMenuInflater().inflate(R.menu.main, menu);

if (badgeCount > 0) {
ActionItemBadge.update(this, menu.findItem(R.id.item_samplebadge), FontAwesome.Icon.faw_android, ActionItemBadge.BadgeStyles.DARK_GREY, badgeCount);
} else {
ActionItemBadge.hide(menu.findItem(R.id.item_samplebadge));
}
new ActionItemBadgeAdder().act(this).menu(menu).title(R.string.sample_2).itemDetails(0, SAMPLE2_ID, 1).showAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS).add(bigStyle, 1);
return super.onCreateOptionsMenu(menu);
}

Adding the item to Cart..

Today, we were assigned the task to show a screen where user can view the details of product which he has clicked on. He can modify the package according to his requirement and add the item to the cart. This is what normally happens in every shopping application.

Here’s our work sample of today :

prodDet

Showing the Products List

Not we had to show the list of Products which belong to a particular category when that category is chosen from Categories Screen.

This was also simple and we were able to complete this very fast.

Here’s the output of today’s work :

prod

 

Tomorrow I will work on the screen where user can view the product details and order the item from there.

Displaying the Categories

We were instructed to work on Fragments, instead of activities. Why not? Fragments have own advantages though they are difficult to understand sometimes. 🤔

Today we created Categories Fragment. Here’s how it looks like :

cat

 

We created a cart in the menu along with Logout button. We have to yet work on those soon. Firstly, we need to get the Orders placed from this app.