Next step towards development

Today, I implemented next functionality of the app. I designed the layout for Enter tables activity. Here’s how it looks like.

enter_tables

Code for this layout is given below.

activity_enter_tables:

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.reservation.restaurant.Activities.EnterTablesActivity">

    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/AppTheme.AppBarOverlay">
        <include layout="@layout/toolbar"/>
    </android.support.design.widget.AppBarLayout>

    <include layout="@layout/content_enter_tables" />

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/fabViewTable"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|end"
        app:fabSize="normal"
        app:backgroundTint="@color/colorPrimary"
        android:layout_margin="@dimen/fab_margin"
        app:srcCompat="@drawable/list" />

</android.support.design.widget.CoordinatorLayout>

content_enter_tables.xml:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
    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"
    android:orientation="vertical"
    android:id="@+id/container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    tools:context="com.reservation.restaurant.Activities.EnterTablesActivity">

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:visibility="gone"
            android:orientation="vertical"
            android:layout_marginRight="16dp"
            android:layout_marginLeft="16dp"
            android:id="@+id/llCreateTable"
            android:layout_marginBottom="50dp">

                <LinearLayout
                    android:orientation="vertical"
                    android:layout_width="match_parent"
                    android:padding="16dp"
                    android:background="@drawable/add_tables_dialog_border"
                    android:layout_height="wrap_content">

                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:gravity="center"
                        android:textStyle="bold"
                        android:text="Create a new Table entry"
                        android:textSize="20sp"/>
                    <View
                        android:layout_width="match_parent"
                        android:layout_height="1dp"
                        android:layout_marginTop="10dp"
                        android:background="@color/toggleBackground"
                        />

                    <Spinner
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:id="@+id/chooseCategory"
                        android:layout_marginTop="15dp"></Spinner>

                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:textSize="16sp"
                        android:layout_marginTop="10dp"
                        android:text="Enter Table Name"/>

                    <android.support.v7.widget.AppCompatEditText
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:inputType="text"
                        android:id="@+id/tableName"/>

                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:textSize="16sp"
                        android:layout_marginTop="10dp"
                        android:text="Enter number of Chairs"/>
                    <android.support.v7.widget.AppCompatEditText
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:inputType="number"
                        android:id="@+id/numChairs"/>

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:orientation="horizontal"
                        android:layout_marginTop="10dp"
                        android:weightSum="1">
                        <TextView
                            android:layout_width="0dp"
                            android:layout_height="wrap_content"
                            android:textSize="16sp"
                            android:text="Status Active"
                            android:layout_gravity="center_vertical"
                            android:layout_weight="0.8"/>

                        <com.suke.widget.SwitchButton
                            android:id="@+id/switch_btn_status"
                            android:layout_width="0dp"
                            android:layout_height="wrap_content"
                            android:layout_weight="0.2"
                            app:sb_shadow_color="@color/toggleBackground"
                            app:sb_checked_color="@color/colorPrimary"
                            />
                    </LinearLayout>

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:orientation="horizontal"
                        android:layout_marginTop="10dp"
                        android:weightSum="1">

                        <TextView
                            android:layout_width="0dp"
                            android:layout_height="wrap_content"
                            android:textSize="16sp"
                            android:text="Is this table mergeable?"
                            android:layout_weight="0.8"/>


                        <com.suke.widget.SwitchButton
                            android:id="@+id/switch_btn_mergeable"
                            android:layout_width="0dp"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center_horizontal"
                            app:sb_shadow_color="@color/toggleBackground"
                            app:sb_checked_color="@color/colorPrimary"
                            android:layout_weight="0.2"
                            />
                    </LinearLayout>

                    <Button
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:background="@drawable/btn_check_availability"
                        android:layout_marginTop="20dp"
                        android:textSize="16sp"
                        android:textColor="@drawable/btn_text_color"
                        android:text="Create Table"
                        android:id="@+id/btn_create_table"
                        />
                </LinearLayout>

        </LinearLayout>
    </ScrollView>
</FrameLayout>

Starting with development phase

Working on Android Studio again is happiness(moreover it’s IntelliJ 😎 ).

I started my development work with designing the layout for Categories Module.

Here’s how it looks like after feeding the static data. Will work later on server interaction.

                             create_categorieschoose_global_categories

 

For the bottom sheet of Categories, I used Fabulous Filter Github library.

Here’s how I used this library.

<pre>FragmentAddCategory dialogFrag = FragmentAddCategory.newInstance();
dialogFrag.setParentFab(fab);
fab.setOnClickListener(new View.OnClickListener() {
 @Override
 public void onClick(View v) {
 dialogFrag.show(getSupportFragmentManager(), dialogFrag.getTag());
 }
});
public class FragmentAddCategory extends AAH_FabulousFragment {

      //Rest of code

Deciding the screens of app

Today, I and my fellow who is working on the same project, decided about the screens of this android app. We decided about various modules.

They are –

  • Categories
  • Tables
  • Floormap
  • History of Reservations

We both divided the work. Tomorrow, we will proceed with development of this app. 📱

 

Testing with Postman

Today, I got familiar with Postman . It is powerful GUI platform to make API development faster & easier, from building API requests through testing, documentation and sharing.

postman

We just have to provide the URL of the file. Under Body tab -> Raw tab , we can specify any JSON input in the JSON format only.

Under Body tab -> form-data, we can pass the input in key-value pairs.

Then just hit the Send button. It shows the response in JSON, XML, HTML, Text format.  I feel JSON format is more readable.

After getting familiar with this tool, I tested my script, which worked fine at last, after lot of testing.

Implementing the algorithm

Today, we had to test the algorithm, which we designed the previous day. I already had LAMP installed in my laptop. I created database and the tables. Then, populated the tables with rough data, so that I could test the algorithm.

Then, I implemented the algorithm in PHP. It was a lot of struggle with this language. It’s terrible to struggle with syntax sometimes  🙄.  I took help from PHP manual.

It took whole day for this task. Tomorrow, it will test this written code.

Finally…algorithm got ready

Without wasting any time we just started searching about any existing app so that we can get some idea about the algorithm. We searched a lot, but couldn’t find anything which could help us.

After lot of thinking I just realised that we should first design table structures. After designing rough table structures, I digged my mind completely into pool of thoughts so that I get some idea about algorithm.  And finally, we achieved. After discussion with my fellow and sharing ideas, we made it… ✌️

Think think and think….

Today, I spent whole day brainstorming with the algorithm to allot free tables to end user. Admin can create mergers of tables. Now, I and my fellow(Gurkirat Kaur), have to design an algorithm so that tables are reserved in more optimal way. It is quite difficult task. Even after lot of struggle with ideas, at the end of the day, we were not able to design such optimal algorithm. ☹️

First day of my internship

Today, I started with my internship at Auribises Technologies. I was assigned a very unique project to work on. It is a restaurant based project. Let me explain a bit.

My task is to develop an android app which is to be used by restaurant owners. The manager or whosever will handle the app will have the control of adding the information about the categories and tables in the restaurant. The admin(restaurant owner)  can prepare a floormap of arrangement of tables of the restaurant, in the app only. He can create merge combinations of tables.

Later, a bot has to be created using chatfuel(to be integrated in Facebook messenger), using which end user can reserve table for any day, any time.

A lot has to be done. Let’s get started 😀