Post Top Ad

Post Top Ad

Sunday 1 March 2020

How to design Takeway screen in android



<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:background="@color/white"
    android:layout_height="match_parent">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="0.2"></LinearLayout>


      <!--  <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="@dimen/text_size_more_large"
            android:orientation="horizontal">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="horizontal">
                <TextView
                    android:layout_width="0dp"
                    android:layout_weight="2"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:clickable="false"
                    android:focusable="false"
                    android:fontFamily="@font/montserrat"
                    android:gravity="center"
                    android:text="Order No #"
                    android:textColor="#343434"
                    android:textSize="@dimen/text_size_medium" />
                <LinearLayout
                    android:layout_width="1dp"
                    android:layout_height="match_parent"
                    android:background="#D2D2D2"></LinearLayout>
                <TextView
                    android:layout_width="0dp"
                    android:layout_weight="1.3"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:clickable="false"
                    android:focusable="false"
                    android:fontFamily="@font/montserrat"
                    android:gravity="center"
                    android:text="Amount"
                    android:textColor="#343434"
                    android:textSize="@dimen/text_size_medium" />
                <LinearLayout
                    android:layout_width="1dp"
                    android:layout_height="match_parent"
                    android:background="#D2D2D2"></LinearLayout>
                <TextView
                    android:layout_width="0dp"
                    android:layout_weight="2.3"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:clickable="false"
                    android:focusable="false"
                    android:fontFamily="@font/montserrat"
                    android:gravity="center"
                    android:text="View details"
                    android:textSize="@dimen/text_size_medium" />

                <LinearLayout
                    android:layout_width="1dp"
                    android:layout_height="match_parent"
                    android:background="#D2D2D2"></LinearLayout>

            </LinearLayout>
        </LinearLayout>-->
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:orientation="horizontal"
            android:layout_weight="5.5">
            <LinearLayout
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="0.5"></LinearLayout>

            <LinearLayout
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:orientation="vertical"
                android:layout_weight="9">

                <!--        <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
                            android:id="@+id/simpleSwipeRefreshLayout"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content">-->

                <androidx.recyclerview.widget.RecyclerView
                    android:id="@+id/menu_listview"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:dividerHeight="@dimen/text_size_medium"
                    android:listSelector="@android:color/transparent"
                    android:divider="@android:color/transparent"
                    ></androidx.recyclerview.widget.RecyclerView>
                <!--<ListView-->
                    <!--android:id="@+id/menu_listview"-->
                    <!--android:layout_width="match_parent"-->
                    <!--android:layout_height="match_parent"-->
                    <!--android:divider="@android:color/transparent"-->
                    <!--android:dividerHeight="@dimen/text_size_medium"-->
                    <!--android:listSelector="@android:color/transparent"></ListView>-->
          <!--      </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>-->

            </LinearLayout>


            <LinearLayout
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="0.5"></LinearLayout>

        </LinearLayout>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:background="#D2D2D2">
        </LinearLayout>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:orientation="vertical"
            android:layout_weight="0.3">
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:orientation="vertical"
            android:layout_height="0dp"
            android:layout_weight="1">
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_weight="0.5"></LinearLayout>
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:orientation="horizontal"
                android:layout_weight="2">
                <LinearLayout
                    android:layout_width="0dp"
                    android:layout_weight="46.5"
                    android:layout_height="match_parent"></LinearLayout>

                <LinearLayout
                    android:layout_width="0dp"
                    android:layout_weight="2"
                    android:layout_height="match_parent"></LinearLayout>
                <LinearLayout
                    android:layout_width="0dp"
                    android:layout_weight="20"
                    android:visibility="gone"
                    android:layout_height="match_parent">
                    <androidx.cardview.widget.CardView
                        android:id="@+id/btn_place_order"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:clickable="true"
                        android:focusable="true"
                        android:clipChildren="false"
                        app:cardCornerRadius="@dimen/text_size_medium"
                        app:cardBackgroundColor="#E41749"
                        android:background="@color/black"
                        android:layout_marginBottom="2dp"
                        app:cardPreventCornerOverlap="true"
                        app:cardUseCompatPadding="false">

                        <TextView
                            android:id="@+id/Appvirsion"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center"
                            android:background="#D20638"
                            android:clickable="false"
                            android:focusable="false"
                            android:fontFamily="@font/source_sans_pro_regular"
                            android:gravity="center"
                            android:text="+ NEW ORDER"
                            android:textColor="@color/white"
                            android:textSize="@dimen/text_size_medium" />
                    </androidx.cardview.widget.CardView>

                </LinearLayout>
                <LinearLayout
                    android:layout_width="0dp"
                    android:layout_weight="3"
                    android:layout_height="match_parent"></LinearLayout>
            </LinearLayout>
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_weight="0.5"></LinearLayout>
        </LinearLayout>
    </LinearLayout>
</LinearLayout>

2.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:background="@drawable/list_border"
    android:orientation="vertical"
    android:layout_width="match_parent"

    android:layout_height="wrap_content">

    <LinearLayout
        android:id="@+id/hidedetails"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <LinearLayout

            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal">

            <LinearLayout
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="8.25">

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:orientation="vertical">

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="10dp"
                        android:layout_marginBottom="5dp"
                        android:gravity="left"
                        android:orientation="horizontal">

                        <TextView
                            android:id="@+id/orderat"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center|left"
                            android:layout_marginLeft="@dimen/text_size_medium"
                            android:fontFamily="@font/source_sans_pro_bold"
                            android:gravity="center|left"
                            android:text="Order #2543128"
                            android:textColor="#717171"
                            android:textSize="@dimen/text_size_small" />


                        <TextView
                            android:id="@+id/orderStatus"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_marginLeft="@dimen/text_size_medium_small"
                            android:clickable="false"
                            android:focusable="false"
                            android:fontFamily="@font/source_sans_pro_regular"
                            android:gravity="right"
                            android:text="View details"
                            android:textColor="#006FFF"
                            android:textSize="@dimen/text_size_small"
                            android:visibility="visible" />
                    </LinearLayout>

               <!--     <LinearLayout
                        android:background="@drawable/list_border"
                        android:layout_width="match_parent"
                        android:layout_height="0dp"
                        android:paddingBottom="1dp"
                        android:orientation="horizontal"
                        android:layout_weight="1">
                        <LinearLayout
                            android:layout_width="0dp"
                            android:layout_height="match_parent"
                            android:clickable="true"
                            android:focusable="true"
                            android:orientation="vertical"
                            android:layout_weight="3">
                        </LinearLayout>
                        <LinearLayout
                            android:layout_width="0dp"
                            android:layout_height="match_parent"
                            android:clickable="true"
                            android:focusable="true"
                            android:orientation="vertical"
                            android:layout_weight="25">
                            <TextView
                                android:clickable="true"
                                android:focusable="true"
                                android:id="@+id/cuys"
                                android:layout_width="match_parent"
                                android:layout_height="match_parent"
                                android:fontFamily="@font/montserrat"
                                android:gravity="center|left"
                                android:text="Items"
                                android:textColor="#717171"
                                android:textSize="@dimen/text_size_small"
                                android:textStyle="bold" />
                        </LinearLayout>
                        <LinearLayout
                            android:layout_width="0dp"
                            android:layout_height="match_parent"
                            android:clickable="true"
                            android:focusable="true"
                            android:orientation="vertical"
                            android:layout_weight="25">
                            <TextView
                                android:clickable="true"
                                android:focusable="true"
                                android:id="@+id/showAsdll"
                                android:layout_width="match_parent"
                                android:layout_height="match_parent"
                                android:fontFamily="@font/montserrat"
                                android:gravity="center"
                                android:text="Ordered at"
                                android:textColor="#717171"
                                android:textSize="@dimen/text_size_small"
                                android:textStyle="bold" />
                        </LinearLayout>
                        <LinearLayout
                            android:layout_width="0dp"
                            android:layout_height="match_parent"
                            android:clickable="true"
                            android:focusable="true"
                            android:orientation="vertical"
                            android:layout_weight="20">

                            <LinearLayout
                                android:layout_width="match_parent"
                                android:layout_height="0dp"
                                android:orientation="horizontal"
                                android:layout_weight="2">
                                <TextView
                                    android:id="@+id/edit_fdsrom"
                                    android:layout_width="0dp"
                                    android:layout_height="match_parent"
                                    android:layout_weight="75"
                                    android:gravity="center"
                                    android:textColor="#717171"
                                    android:textSize="@dimen/text_size_small"
                                    android:textStyle="bold"
                                    android:text="Delivery at"/>
                            </LinearLayout>

                        </LinearLayout>
                        <LinearLayout
                            android:layout_width="0dp"
                            android:layout_height="match_parent"
                            android:clickable="true"
                            android:focusable="true"
                            android:orientation="vertical"
                            android:layout_weight="2">
                        </LinearLayout>
                        <LinearLayout
                            android:layout_width="0dp"
                            android:layout_height="match_parent"
                            android:clickable="true"
                            android:focusable="true"
                            android:orientation="vertical"
                            android:layout_weight="20">
                            <LinearLayout
                                android:layout_width="match_parent"
                                android:layout_height="0dp"
                                android:orientation="horizontal"
                                android:layout_weight="2">
                                <TextView
                                    android:id="@+id/status"
                                    android:layout_width="0dp"
                                    android:layout_height="match_parent"
                                    android:layout_weight="75"
                                    android:enabled="false"
                                    android:inputType="text"
                                    android:gravity="center"
                                    android:text="Kitchen status"
                                    android:textColor="#717171"
                                    android:textSize="@dimen/text_size_small"
                                    android:textStyle="bold" />
                            </LinearLayout>
                        </LinearLayout>
                        <LinearLayout
                            android:layout_width="0dp"
                            android:layout_height="match_parent"
                            android:orientation="vertical"
                            android:layout_weight="2">
                        </LinearLayout>
                    </LinearLayout>-->

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="1dp"
                        android:background="#D2D2D2"></LinearLayout>
                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_weight="0.1"
                        android:orientation="horizontal"
                        >
                        <TextView
                            android:id="@+id/cuys"
                            android:layout_width="0dp"
                            android:layout_weight="2"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center"
                            android:clickable="false"
                            android:focusable="false"
                            android:fontFamily="@font/source_sans_pro_bold"
                            android:text="Items"
                            android:layout_marginLeft="@dimen/text_size_medium"
                            android:gravity="center|left"
                            android:textColor="#717171"
                            android:textSize="@dimen/text_size_medium_small" />
                        <LinearLayout
                            android:layout_width="1dp"
                            android:layout_height="match_parent"
                            android:background="#D2D2D2"></LinearLayout>

                        <TextView
                            android:id="@+id/showAsdll"
                            android:layout_width="0dp"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center"
                            android:layout_weight="1.5"
                            android:clickable="false"
                            android:focusable="false"
                            android:fontFamily="@font/source_sans_pro_bold"
                            android:text="Ordered at"
                            android:textColor="#717171"
                            android:layout_marginLeft="@dimen/text_size_medium"
                            android:gravity="center|left"
                            android:textSize="@dimen/text_size_medium_small" />
                        <LinearLayout
                            android:layout_width="1dp"
                            android:layout_height="match_parent"
                            android:background="#D2D2D2"></LinearLayout>

                        <TextView
                            android:id="@+id/edit_fdsrom"
                            android:layout_width="0dp"
                            android:layout_weight="1.5"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center"
                            android:clickable="false"
                            android:focusable="false"
                            android:fontFamily="@font/source_sans_pro_bold"
                            android:text="Delivery at"
                            android:textColor="#717171"
                            android:layout_marginLeft="@dimen/text_size_medium"
                            android:gravity="center|left"
                            android:textSize="@dimen/text_size_medium_small" />

                        <LinearLayout
                            android:layout_width="1dp"
                            android:layout_height="match_parent"
                            android:background="#D2D2D2"></LinearLayout>
                        <TextView
                            android:id="@+id/status"
                            android:layout_width="0dp"
                            android:layout_weight="2"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center"
                            android:clickable="false"
                            android:focusable="false"
                            android:fontFamily="@font/source_sans_pro_bold"
                            android:layout_marginLeft="@dimen/text_size_medium"
                            android:gravity="center|left"
                            android:text="Kitchen status"
                            android:textColor="#717171"
                            android:textSize="@dimen/text_size_medium_small" />
                        <LinearLayout
                            android:layout_width="1dp"
                            android:layout_height="match_parent"
                            android:background="#D2D2D2"></LinearLayout>
                        </LinearLayout>

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="1dp"
                        android:background="#D2D2D2"></LinearLayout>

                   <!-- <LinearLayout
                        android:background="@drawable/list_border"
                        android:layout_width="match_parent"
                        android:layout_height="0dp"
                        android:paddingBottom="1dp"
                        android:orientation="horizontal"
                        android:layout_weight="1">
                        <LinearLayout
                            android:layout_width="0dp"
                            android:layout_height="match_parent"
                            android:orientation="vertical"
                            android:layout_weight="3">
                        </LinearLayout>
                        <LinearLayout
                            android:layout_width="0dp"
                            android:layout_height="match_parent"
                            android:orientation="vertical"
                            android:layout_weight="30">
                            <LinearLayout
                                android:layout_width="match_parent"
                                android:layout_height="0dp"
                                android:layout_weight="0.5"></LinearLayout>
                            <LinearLayout
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:layout_weight="2">
                                <TextView
                                    android:id="@+id/customer"
                                    android:layout_width="match_parent"
                                    android:layout_height="wrap_content"
                                    android:layout_weight="2"
                                    android:text="9985536424 \nSubhankar Bhattacharya "
                                    android:maxLines="3"
                                    android:textColor="#717171"
                                    android:textSize="@dimen/text_size_small"
                               />
                            </LinearLayout>


                        </LinearLayout>
                        <LinearLayout
                            android:layout_width="0dp"
                            android:layout_height="match_parent"
                            android:orientation="vertical"
                            android:layout_weight="25">
                            <TextView
                                android:clickable="true"
                                android:focusable="true"
                                android:id="@+id/orderdate"
                                android:layout_width="match_parent"
                                android:layout_height="match_parent"
                                android:fontFamily="@font/montserrat"
                                android:gravity="center"
                                android:text="20/03/2020 \n12:00 p.m "
                                android:maxLines="3"
                                android:textColor="#717171"
                                android:textSize="@dimen/text_size_small"
                              />
                        </LinearLayout>
                        <LinearLayout
                            android:layout_width="0dp"
                            android:layout_height="match_parent"
                            android:orientation="vertical"
                            android:layout_weight="20">

                            <LinearLayout
                                android:layout_width="match_parent"
                                android:layout_height="0dp"
                                android:orientation="horizontal"
                                android:layout_weight="2">
                                <TextView
                                    android:id="@+id/timesa"
                                    android:layout_width="0dp"
                                    android:layout_height="match_parent"
                                    android:layout_weight="75"
                                    android:gravity="center"
                                    android:textColor="#717171"
                                    android:textSize="@dimen/text_size_small"
                                    android:text="20/03/2020 \n12:00 p.m "
                                    android:maxLines="3" />
                            </LinearLayout>

                        </LinearLayout>
                        <LinearLayout
                            android:layout_width="0dp"
                            android:layout_height="match_parent"
                            android:orientation="vertical"
                            android:layout_weight="2">
                        </LinearLayout>
                        <LinearLayout
                            android:layout_width="0dp"
                            android:layout_height="match_parent"
                            android:orientation="vertical"
                            android:layout_weight="20">
                            <LinearLayout
                                android:layout_width="match_parent"
                                android:layout_height="0dp"
                                android:orientation="horizontal"
                                android:layout_weight="2">
                                <TextView
                                    android:id="@+id/status1"
                                    android:layout_width="0dp"
                                    android:layout_height="match_parent"
                                    android:layout_weight="75"
                                    android:enabled="false"
                                    android:inputType="text"
                                    android:gravity="center"
                                    android:text="Sent to kitchen"
                                    android:textColor="#FF507A"
                                    android:textSize="@dimen/text_size_small"
                                    android:textStyle="bold" />
                            </LinearLayout>
                        </LinearLayout>
                        <LinearLayout
                            android:layout_width="0dp"
                            android:layout_height="match_parent"
                            android:orientation="vertical"
                            android:layout_weight="2">
                        </LinearLayout>
                    </LinearLayout>-->

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_weight="0.30"
                        android:orientation="horizontal"
                        >
                        <TextView
                            android:id="@+id/customer"
                            android:layout_width="0dp"
                            android:layout_weight="2"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center"
                            android:clickable="false"
                            android:focusable="false"
                            android:layout_marginLeft="@dimen/text_size_medium"
                            android:gravity="center|left"
                            android:fontFamily="@font/source_sans_pro_regular"
                            android:text="8548074898 \nShailendra "
                            android:textColor="#717171"

                            android:textSize="@dimen/text_size_medium_small" />
                        <LinearLayout
                            android:layout_width="1dp"
                            android:layout_height="match_parent"
                            android:background="#D2D2D2"></LinearLayout>

                        <TextView
                            android:id="@+id/orderdate"
                            android:layout_width="0dp"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center"
                            android:layout_weight="1.5"
                            android:clickable="false"
                            android:focusable="false"
                            android:fontFamily="@font/source_sans_pro_regular"
                            android:text="20/03/2020 \n12:00 p.m "
                            android:textColor="#717171"
                            android:layout_marginLeft="@dimen/text_size_medium"
                            android:gravity="center|left"
                            android:textSize="@dimen/text_size_medium_small" />
                        <LinearLayout
                            android:layout_width="1dp"
                            android:layout_height="match_parent"
                            android:background="#D2D2D2"></LinearLayout>

                        <TextView
                            android:id="@+id/timesa"
                            android:layout_width="0dp"
                            android:layout_weight="1.5"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center"
                            android:clickable="false"
                            android:focusable="false"
                            android:text="20/03/2020 \n12:00 p.m "
                            android:textColor="#717171"
                            android:layout_marginLeft="@dimen/text_size_medium"
                            android:gravity="center|left"
                            android:textSize="@dimen/text_size_medium_small" />

                        <LinearLayout
                            android:layout_width="1dp"
                            android:layout_height="match_parent"
                            android:background="#D2D2D2"></LinearLayout>
                        <TextView
                            android:id="@+id/status1"
                            android:layout_width="0dp"
                            android:layout_weight="2"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center"
                            android:clickable="false"
                            android:focusable="false"
                            android:fontFamily="@font/source_sans_pro_regular"
                            android:text="Sent to kitchen"
                            android:textColor="#E26900"
                            android:layout_marginLeft="@dimen/text_size_medium"
                            android:gravity="center|left"
                            android:textSize="@dimen/text_size_medium_small" />
                        <LinearLayout
                            android:layout_width="1dp"
                            android:layout_height="match_parent"
                            android:background="#D2D2D2"></LinearLayout>
                         </LinearLayout>


                </LinearLayout>
            </LinearLayout>

            <LinearLayout
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight=".15"></LinearLayout>

            <LinearLayout
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="2"
                android:orientation="vertical">

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical">

                    <TextView
                        android:id="@+id/DeliveryAt"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center"
                        android:layout_marginTop="10dp"
                        android:layout_marginBottom="5dp"
                        android:fontFamily="@font/source_sans_pro_bold"
                        android:gravity="center"
                        android:text="₹ 8,899.56"
                        android:textColor="#717171"
                        android:textSize="@dimen/text_size_medium_small" />


                </LinearLayout>


                <LinearLayout
                    android:id="@+id/runtimecolor"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_gravity="center"
                    android:gravity="center"
                    android:orientation="vertical">


                    <Button
                        android:id="@+id/Decline"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center"
                        android:layout_marginBottom="1dp"
                        android:fontFamily="@font/source_sans_pro_bold"
                        android:gravity="center"
                        android:text="Decline order"
                        android:textAllCaps="false"
                        android:textColor="#FF0000"
                        android:layout_marginLeft="@dimen/button_padding_top_bottom"
                        android:layout_marginRight="@dimen/button_padding_top_bottom"
                        android:background="@drawable/takeway_btn_decline"
                        android:textSize="@dimen/text_size_smaller" />

                    <Button
                        android:id="@+id/Confirm"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center"
                        android:layout_marginBottom="10dp"
                        android:fontFamily="@font/source_sans_pro_bold"
                        android:gravity="center"
                        android:text="ACCEPT ORDER"
                        android:layout_marginLeft="@dimen/button_padding_top_bottom"
                        android:layout_marginRight="@dimen/button_padding_top_bottom"
                        android:textColor="#FFFFFF"
                        android:background="@drawable/takeway_btn_border"
                        android:textSize="@dimen/text_size_smaller" />

                    <Button
                        android:id="@+id/Confirm_delivery"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center"
                        android:layout_marginBottom="10dp"
                        android:fontFamily="@font/source_sans_pro_bold"
                        android:gravity="center"
                        android:visibility="gone"
                        android:text="CONFIRM DELIVERY"
                        android:textColor="#FFFFFF"
                        android:layout_marginLeft="@dimen/button_padding_top_bottom"
                        android:layout_marginRight="@dimen/button_padding_top_bottom"
                        android:background="@drawable/takeway_btn_decline"
                        android:textSize="@dimen/text_size_smaller" />


                </LinearLayout>
            </LinearLayout>

            <LinearLayout
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="0.1"></LinearLayout>
        </LinearLayout>



    </LinearLayout>


</LinearLayout>


Sourse code:

import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.cardview.widget.CardView;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;

import com.dfoe.frimaster.CheckoutActivity;
import com.dfoe.frimaster.CommonParams;
import com.dfoe.frimaster.DashBoard;
import com.dfoe.frimaster.DataBaseServices.MasterDB;
import com.dfoe.frimaster.MainActivity;
import com.dfoe.frimaster.R;
import com.dfoe.frimaster.RetrofitServices.RetrofitInterfaceTask;
import com.dfoe.frimaster.SeatViewLayout;
import com.dfoe.frimaster.Take_Away_OrderMenuActivity;
import com.dfoe.frimaster.Take_Away_View_Details;
import com.google.android.gms.common.internal.safeparcel.SafeParcelReader;
import com.google.gson.JsonObject;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Collections;
import java.util.Date;
import java.util.LinkedList;


public class TakeAwayFragment extends Fragment {
    //    private ListView menu_listview;    private RecyclerView menu_listview;
    MasterDB db;
    //    TakeAwayFragment.OrderHistoryListAdapters orderHistoryListAdapters;    TakeAwayAdapter orderHistoryListAdapters;
    JSONArray TakeAwayDeatilss = new JSONArray();
    SwipeRefreshLayout simpleSwipeRefreshLayout;
    CardView btn_place_order;
    public static TakeAwayHandler TakeAwayHandler;
    int orderNo = 0;

    JSONArray OrderDeatilsArray, taxDeatilsArray, paymentDeatilsArray;
    JSONArray ordersDeatils = new JSONArray();
    private EditText EditTextFeedbackBody;

    public TakeAwayFragment() {


    }

    @Override    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Nullable    @Override    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View v = inflater.inflate(R.layout.fragment_takeaway, null);
        TakeAwayHandler = new TakeAwayHandler();
        db = MasterDB.getInstance(getActivity());
        menu_listview = (RecyclerView) v.findViewById(R.id.menu_listview);
        TakeAwayDeatilss = db.getOrderDetailsFromPayments();
        shuffle();

        int i = 0;
        btn_place_order = (CardView) v.findViewById(R.id.btn_place_order);


        OrderDeatilsArray = new JSONArray();
        ordersDeatils = new JSONArray();
        taxDeatilsArray = new JSONArray();
        if (orderNo != 0) {
            OrderDeatilsArray = db.getOrderDeatilsForOrderNo(orderNo);
            paymentDeatilsArray = db.getPaymentdeatils(orderNo);
            taxDeatilsArray = db.getTaxdeatils();
        }


        btn_place_order.setOnClickListener(new View.OnClickListener() {
            @Override            public void onClick(View view) {
                Intent i = new Intent(getActivity(), Take_Away_OrderMenuActivity.class);
                startActivity(i);
            }
        });


        if (TakeAwayDeatilss != null) {
            for (int count = 0; count < TakeAwayDeatilss.length(); count++)
                if (TakeAwayDeatilss.length() > 0) {
                    menu_listview.setVisibility(View.VISIBLE);
                    if (orderHistoryListAdapters == null) {
                        orderHistoryListAdapters = new TakeAwayAdapter();
                        RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(getActivity());
                        menu_listview.setLayoutManager(mLayoutManager);
                        menu_listview.setItemAnimator(new DefaultItemAnimator());
                        menu_listview.setAdapter(orderHistoryListAdapters);
                    } else {
                        orderHistoryListAdapters.notifyDataSetChanged();
                    }
                }
        }

        return v;
    }

    public class TakeAwayHandler extends Handler {
        public static final int Upate_UI = 1;
        public static final int ShowToastMessage = 2;
        public static final int Upate_UI_TAKEWAY = 3;
        public static final int Upate_UI_TAKEWAY_CONFIRM = 4;
        public static final int TAKE_AWAY_CONFIRM_DELIVERY = 5;
        public static final int TAKE_AWAY_ORDER_RECEIVED_FROM_NOTIFICATION = 6;

        @Override        public void handleMessage(@NonNull Message msg) {
            switch (msg.what) {
                case Upate_UI:
                    TakeAwayDeatilss = db.getOrderDetailsFromPayments();
                    try {
                        if (TakeAwayDeatilss != null) {
                            if (TakeAwayDeatilss.length() > 0) {
                                menu_listview.setVisibility(View.VISIBLE);
                                if (orderHistoryListAdapters == null) {
//                                    orderHistoryListAdapters = new TakeAwayFragment.OrderHistoryListAdapters(getActivity());                                    RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(getActivity());
                                    menu_listview.setLayoutManager(mLayoutManager);
                                    menu_listview.setItemAnimator(new DefaultItemAnimator());
                                    menu_listview.setAdapter(orderHistoryListAdapters);
                                } else {
                                    orderHistoryListAdapters.notifyDataSetChanged();
                                }
                            }
                        } else {
                            orderHistoryListAdapters.notifyDataSetChanged();
                        }
                        break;
                    } catch (Exception ex) {
                    }

                case ShowToastMessage:
                    Toast.makeText(getActivity(), "Order status Updated", Toast.LENGTH_LONG).show();
                    break;

                case Upate_UI_TAKEWAY:
//                    orderHistoryListAdapters.notifyDataSetChanged();                    TakeAwayDeatilss = db.getOrderDetailsFromPayments();
                    if (TakeAwayDeatilss != null) {
                        try {
                            if (TakeAwayDeatilss.length() > 0) {
                                menu_listview.setVisibility(View.VISIBLE);
                                if (orderHistoryListAdapters == null) {
//                                    orderHistoryListAdapters = new TakeAwayFragment.OrderHistoryListAdapters(getActivity());                                    RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(getActivity());
                                    menu_listview.setLayoutManager(mLayoutManager);
                                    menu_listview.setItemAnimator(new DefaultItemAnimator());
                                    menu_listview.setAdapter(orderHistoryListAdapters);
                                } else {
                                    orderHistoryListAdapters.notifyDataSetChanged();
                                }
                            } else {
                                orderHistoryListAdapters.notifyDataSetChanged();
                            }
                        } catch (Exception ex) {
                        }
                    }
                    break;


                case Upate_UI_TAKEWAY_CONFIRM:
                    TakeAwayDeatilss = db.getOrderDetailsFromPayments();
                    if (TakeAwayDeatilss != null) {
                        try {
                            if (TakeAwayDeatilss.length() > 0) {
                                menu_listview.setVisibility(View.VISIBLE);
                                if (orderHistoryListAdapters == null) {
//                                    orderHistoryListAdapters = new TakeAwayFragment.OrderHistoryListAdapters(getActivity());                                    RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(getActivity());
                                    menu_listview.setLayoutManager(mLayoutManager);
                                    menu_listview.setItemAnimator(new DefaultItemAnimator());
                                    menu_listview.setAdapter(orderHistoryListAdapters);
                                } else {
                                    orderHistoryListAdapters.notifyDataSetChanged();
                                }
                            } else {
                                orderHistoryListAdapters.notifyDataSetChanged();
                            }
                        } catch (Exception ex) {
                        }
                    }
                    break;

                case TAKE_AWAY_CONFIRM_DELIVERY:
                    int orderNo = msg.getData().getInt("order_no");
                    for (int i = 0; i < TakeAwayDeatilss.length(); i++) {
                        try {
                            JSONObject takeAwayItem = (JSONObject) TakeAwayDeatilss.get(i);
                            if (takeAwayItem.has("order_no") && takeAwayItem.getInt("order_no") == orderNo) {
                                TakeAwayDeatilss.remove(i);
                                orderHistoryListAdapters.notifyDataSetChanged();
                            }
                        } catch (JSONException e) {
                            e.printStackTrace();
                        }
                    }
                    break;


                case TAKE_AWAY_ORDER_RECEIVED_FROM_NOTIFICATION:
                    JSONObject notificationObj = (JSONObject) msg.obj;

                    try {
                        int orderNumber = notificationObj.getInt("order_no");
                        boolean idOrderExists = false;
                        for (int i = 0; i < TakeAwayDeatilss.length(); i++) {
                            if (TakeAwayDeatilss.getJSONObject(i).getInt("order_no") == orderNumber) {
                                idOrderExists = true;
                            }
                        }
                        if (!idOrderExists) {
                            if (DashBoard.dashBoardTaskHandler != null) {
                                DashBoard.dashBoardTaskHandler.sendEmptyMessage(DashBoard.DashBoardTaskHandler.GET_PENDING_ORDERS);
                            }
                        }
                    } catch (JSONException e) {
                        e.printStackTrace();
                    }

                    break;
            }

        }
    }


    private void shuffle() {
        if (TakeAwayDeatilss != null) {
            try {


//                orderHistoryListAdapters = new OrderHistoryListAdapters(getActivity());                orderHistoryListAdapters = new TakeAwayAdapter();
                RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(getActivity());
                menu_listview.setLayoutManager(mLayoutManager);
                menu_listview.setItemAnimator(new DefaultItemAnimator());
                menu_listview.setAdapter(orderHistoryListAdapters);
                LinkedList items = new LinkedList<Object>();
                final Handler handler = new Handler();
            } catch (Exception ex) {
            }
        }
    }



/*    @Override    public void onResume() {        TakeAwayHandler = new TakeAwayFragment.TakeAwayHandler();        orderHistoryListAdapters.notifyDataSetChanged();        super.onResume();
    }
    @Override    public void onDestroy() {        super.onDestroy();    }*/
    private String convertTime(String time) {

        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        SimpleDateFormat format1 = new SimpleDateFormat("dd/MM/yyyy hh:mm aa");
        java.util.Date date = null;

        try {
            try {
                date = format.parse(time);
            } catch (ParseException e) {
                e.printStackTrace();
            }
        } catch (SafeParcelReader.ParseException e) {
            e.printStackTrace();
        }

        String convertedDate = format1.format(date);

        return convertedDate;
    }


    private String convertPaymentTime(String time1) {

        SimpleDateFormat format2 = new SimpleDateFormat("HH:mm:ss");
        SimpleDateFormat format11 = new SimpleDateFormat("hh:mm aa ");
        java.util.Date date2 = null;

        try {
            date2 = format2.parse(time1);
        } catch (ParseException e) {
            e.printStackTrace();
        }

        String convertedDate2 = format11.format(date2);

        return convertedDate2;
    }


    private void showLogoutDialog(final String orderNumber) {
        final Dialog OrderQuantityDialog = new Dialog(getActivity(), android.R.style.Theme_Black_NoTitleBar);
        OrderQuantityDialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
        OrderQuantityDialog.setContentView(R.layout.dialog_removedata_layout);
        CardView cancel_button = (CardView) OrderQuantityDialog.findViewById(R.id.cancel_button);
        CardView confirm_button = (CardView) OrderQuantityDialog.findViewById(R.id.confirm_button);
        confirm_button.setOnClickListener(new View.OnClickListener() {
            @Override            public void onClick(View view) {
      /*          int id = 0;            //    db.deleteTakewaydOrders(id);                int position = 0;                TakeAwayDeatilss.remove(position);                orderHistoryListAdapters.notifyDataSetChanged();                Toast.makeText(getActivity(), "Item Deleted", Toast.LENGTH_LONG).show();                OrderQuantityDialog.dismiss();*/
                EditTextFeedbackBody = (EditText) OrderQuantityDialog.findViewById(R.id.EditTextFeedbackBody);
                String CancelMessage = EditTextFeedbackBody.getText().toString();


                if (DashBoard.socketIoClass.client.connected()) {
                    try {
                        JSONObject object = new JSONObject();
                        object.put("type", "cancel_order");
                        JSONObject messgae = new JSONObject();
                        messgae.put("SocketId", DashBoard.socketIoClass.mySocketId);
                        messgae.put("restaurant_id", DashBoard.restaurant_id);
                        messgae.put("order_no", orderNumber);
                        messgae.put("user_id", DashBoard.user_id);
                        messgae.put("message", CancelMessage);
                        object.put("message", messgae);
                        DashBoard.socketIoClass.sendMessage(object);

                        Toast.makeText(getActivity(), "Decline Order", Toast.LENGTH_LONG).show();
                        OrderQuantityDialog.dismiss();


                    } catch (Exception ex) {

                    }


                }


            }
        });
        cancel_button.setOnClickListener(new View.OnClickListener() {
            @Override            public void onClick(View view) {
                OrderQuantityDialog.dismiss();
            }
        });
        OrderQuantityDialog.setCancelable(false);
        OrderQuantityDialog.show();


    }

//Todo by Basudev Added RecyclerViewAdapter
    public class TakeAwayAdapter extends RecyclerView.Adapter<TakeAwayAdapter.MyViewHolder> {

        @NonNull        @Override        public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
            View itemView = LayoutInflater.from(parent.getContext())
                    .inflate(R.layout.takeway_complet, parent, false);

            return new MyViewHolder(itemView);
        }

        @Override        public void onBindViewHolder(@NonNull final MyViewHolder holder, int position) {
            try {
                final JSONObject object = TakeAwayDeatilss.getJSONObject(position);
                if (object.has("order_no")) {
                    holder.orderat.setText("Order #" + object.getString("order_no"));
                    holder.orderat.setTag(object.getString("order_no"));
                    orderNo = object.getInt("order_no");
                }
                if (object.has("payment_type") && object.getInt("payment_type") == 1) {
                    if (object.has("total_amount")) {
                        holder.DeliveryAt.setText(DashBoard.currency + "\t" + object.getString("total_amount") + "\t PAID");
                        holder.DeliveryAt.setTextColor(Color.parseColor("#717171"));

                    }
                } else if (object.has("payment_type") && object.getInt("payment_type") == 2) {
                    holder.DeliveryAt.setText(DashBoard.currency + "\t" + object.getString("total_amount") + "\t COD");
                    holder.DeliveryAt.setTextColor(Color.parseColor("#E43F5A"));
                }

                if (object.has("order_date")) {

                    holder.orderdate.setText(convertTime(object.getString("order_date")));

                }
                //TODo by basudev ... for showing multiple items//                if (object.has("menu_item_name")) {//                    holder.customer.setText(object.getInt("item_quantity") + "" + object.getString("menu_item_name"));//                }                if (object.has("orderItems")) {
                    JSONArray itemDetails = object.getJSONArray("orderItems");
                    int extra = itemDetails.length();
                    String valueToshow = "<font color=#717171>";
                    for (int i = 0; i < extra; i++) {
                        JSONObject item = (JSONObject) itemDetails.get(i);
                        valueToshow = valueToshow + item.getString("item_quantity") + "" + item.getString("menu_name");
                        if (i == 1) {
                            break;
                        } else if (extra > 1) {
                            valueToshow = valueToshow + "<br/>";
                        }
                    }
                    valueToshow = valueToshow + "</font> ";
                    if (extra > 2) {
                        int extraitems = extra - 2;
                        valueToshow = valueToshow + "<br/><font color=#006FFF text-size=1> +" + extraitems + " more items</font>";
                    }
                    holder.customer.setText(Html.fromHtml(valueToshow));
                }

                if (object.has("payment_time")) {
                    holder.timesa.setText(object.getString("payment_date") + "\n" + object.getString("payment_time"));
                }

                if (object.has("served_status")) {
                    int server_status = object.getInt("served_status");
                    if (object.has("order_status") && object.getInt("order_status") == 0) {
                        holder.status1.setText("NA");
                    } else if (server_status == 0) {
                        holder.status1.setText("Sent to kitchen");

                    } else if (server_status == 1) {
                        holder.status1.setText("Cooking");

                    } else if (server_status == 2) {
                        holder.status1.setText("Ready to serve");
                    } else {
                        holder.status1.setText("N/A");
                    }
                }


                //Todo by Basudev for setting status for order
//                if (object.has("payment_type") && object.getInt("payment_type") == 1) {                if (object.has("order_status") && object.getInt("order_status") == 1) {

                    holder.Decline.setVisibility(View.VISIBLE);
//                        holder.Decline.setBackgroundColor(Color.parseColor("#30A400"));                    holder.Decline.setTextColor(Color.parseColor("#FFFFFF"));
                    holder.Decline.setEnabled(false);
                    holder.Decline.setText("Order in progress");
                    holder.Confirm_delivery.setTextSize(13);
                    holder.Confirm.setVisibility(View.GONE);

                    holder.Confirm_delivery.setVisibility(View.VISIBLE);
//                        holder.Confirm_delivery.setText("CONFIRM DELIVERY");                    holder.Confirm_delivery.setTextSize(13);
//                        holder.Confirm_delivery.setTextColor(Color.parseColor("#30A400"));//                        holder.runtimecolor.setBackgroundColor(Color.parseColor("#30A400"));
                    if (object.has("payment_type") && object.getInt("payment_type") == 2) {
                        holder.Confirm_delivery.setTextColor(Color.parseColor("#E43F5A"));
                        holder.runtimecolor.setBackgroundColor(Color.parseColor("#E43F5A"));
                        holder.Decline.setBackgroundColor(Color.parseColor("#E43F5A"));
                        holder.Confirm_delivery.setText("SETTLE BILL");
                    } else {
                        holder.Confirm_delivery.setTextColor(Color.parseColor("#30A400"));
                        holder.runtimecolor.setBackgroundColor(Color.parseColor("#30A400"));
                        holder.Decline.setBackgroundColor(Color.parseColor("#30A400"));
                        holder.Confirm_delivery.setText("CONFIRM DELIVERY");
                    }

                } else {
                    holder.Decline.setVisibility(View.VISIBLE);
                    holder.Decline.setBackgroundResource(R.drawable.takeway_btn_decline);
                    holder.Decline.setTextColor(Color.parseColor("#8E8E93"));
                    holder.Decline.setText("Decline order");
                    holder.Decline.setEnabled(true);

                    holder.Confirm.setVisibility(View.VISIBLE);
                    holder.Confirm_delivery.setVisibility(View.GONE);
                    holder.runtimecolor.setBackgroundColor(Color.parseColor("#ffffff"));
                }
//                } else {//                    holder.Decline.setVisibility(View.VISIBLE);//                    holder.Decline.setBackgroundColor(Color.parseColor("#ee4b4b"));//                    holder.Decline.setTextColor(Color.parseColor("#FFFFFF"));//                    holder.Decline.setEnabled(false);//                    holder.Decline.setText("Order in progress");//                    holder.Confirm_delivery.setTextSize(13);//                    holder.Confirm.setVisibility(View.GONE);////                    holder.Confirm_delivery.setVisibility(View.VISIBLE);//                    holder.Confirm_delivery.setText("SETTLE BILL");//                    holder.Confirm_delivery.setTextSize(13);//                    holder.Confirm_delivery.setTextColor(Color.parseColor("#ee4b4b"));//                    holder.runtimecolor.setBackgroundColor(Color.parseColor("#ee4b4b"));////                }

            final MyViewHolder tempHolder = holder;
            holder.orderStatus.setOnClickListener(new View.OnClickListener() {
                @Override                public void onClick(View view) {
                    try {
                        Intent ij = new Intent(getActivity(), Take_Away_View_Details.class);
                        ij.putExtra("order_no", Integer.parseInt(tempHolder.orderat.getTag().toString()));
                        startActivity(ij);

                    } catch (Exception ex) {

                    }
                }
            });

            holder.Confirm.setOnClickListener(new View.OnClickListener() {
                @Override                public void onClick(View view) {
                    try {
                        if (DashBoard.socketIoClass.client.connected()) {
                            try {
                                JSONObject object = new JSONObject();
                                object.put("type", "accept_takeaway_order");
                                JSONObject messgae = new JSONObject();
                                messgae.put("SocketId", DashBoard.socketIoClass.mySocketId);
                                messgae.put("restaurant_id", DashBoard.restaurant_id);
                                messgae.put("order_no", Integer.parseInt(tempHolder.orderat.getTag().toString()));
                                messgae.put("user_id", DashBoard.user_id);
                                object.put("message", messgae);
                                DashBoard.socketIoClass.sendMessage(object);


//                                tempHolder.Decline.setVisibility(View.VISIBLE);//                                tempHolder.Decline.setBackgroundColor(Color.parseColor("#30A400"));//                                tempHolder.Decline.setTextColor(Color.parseColor("#FFFFFF"));//                                tempHolder.Decline.setEnabled(false);//                                tempHolder.Decline.setText("Order in progress");//                                tempHolder.Confirm_delivery.setTextSize(13);//                                tempHolder.Confirm.setVisibility(View.GONE);////                                tempHolder.Confirm_delivery.setVisibility(View.VISIBLE);//                                tempHolder.Confirm_delivery.setText("CONFIRM DELIVERY");//                                tempHolder.Confirm_delivery.setTextSize(13);//                                tempHolder.Confirm_delivery.setTextColor(Color.parseColor("#30A400"));//                                tempHolder.runtimecolor.setBackgroundColor(Color.parseColor("#30A400"));

                            } catch (Exception ex) {

                            }
                        }

                    } catch (Exception ex) {

                    }


                }
            });


            holder.Confirm_delivery.setOnClickListener(new View.OnClickListener() {
                @Override                public void onClick(View v) {
//                    JSONObject object = new JSONObject();                    try {
                        if (object.has("payment_type") && object.getInt("payment_type") == 1) {
                            if (DashBoard.socketIoClass.client.connected()) {
                                try {
                                    int order_no = 0;
                                    JSONObject object = new JSONObject();
                                    object.put("type", "confirm_delivery");
                                    JSONObject messgae = new JSONObject();
                                    messgae.put("SocketId", DashBoard.socketIoClass.mySocketId);
                                    messgae.put("user_id", DashBoard.user_id);
                                    messgae.put("restaurant_id", DashBoard.restaurant_id);
                                    messgae.put("order_no", Integer.parseInt(tempHolder.orderat.getTag().toString()));
                                    object.put("message", messgae);
                                    DashBoard.socketIoClass.sendMessage(object);

                                    Toast.makeText(getActivity(), "Confirm Order", Toast.LENGTH_LONG).show();
                                    //                            tempHolder.hidedetails.setVisibility(View.GONE);
                                    //shuffle();                                    //                                orderHistoryListAdapters = new OrderHistoryListAdapters(getActivity());                                    //                                menu_listview.setAdapter(orderHistoryListAdapters);                                    //                                orderHistoryListAdapters.notifyDataSetChanged();                                    // shuffle();                                    // orderHistoryListAdapters.notifyDataSetChanged();                                } catch (Exception ex) {

                                }

                            }


                        } else {

                            showCodDialog(Integer.parseInt(tempHolder.orderat.getTag().toString()));


                        }
                    } catch (JSONException e) {
                        e.printStackTrace();
                    }
                }
            });


            holder.Decline.setOnClickListener(new View.OnClickListener() {
                @Override                public void onClick(View v) {
                    showLogoutDialog(tempHolder.orderat.getTag().toString());
                }
            });
            } catch (Exception ex) {

            }
        }

        @Override        public int getItemCount() {
            return TakeAwayDeatilss.length();
        }

        public class MyViewHolder extends RecyclerView.ViewHolder {
            // each data item is just a string in this case            TextView Customer, orderat, DeliveryAt, orderStatus, orderdate, timesa, status1, customer;
            Button Confirm, Decline, Confirm_delivery;
            LinearLayout hidedetails, runtimecolor;

            public MyViewHolder(View view) {
                super(view);
                orderat = (TextView) view.findViewById(R.id.orderat);
                DeliveryAt = (TextView) view.findViewById(R.id.DeliveryAt);
                orderStatus = (TextView) view.findViewById(R.id.orderStatus);
                Confirm = (Button) view.findViewById(R.id.Confirm);
                orderdate = (TextView) view.findViewById(R.id.orderdate);
                timesa = (TextView) view.findViewById(R.id.timesa);
                status1 = (TextView) view.findViewById(R.id.status1);
                customer = (TextView) view.findViewById(R.id.customer);
                hidedetails = (LinearLayout) view.findViewById(R.id.hidedetails);
                runtimecolor = (LinearLayout) view.findViewById(R.id.runtimecolor);
                Decline = (Button) view.findViewById(R.id.Decline);
                Confirm_delivery = (Button) view.findViewById(R.id.Confirm_delivery);
            }
        }

    }


    private void showCodDialog(final int orderNo) {
        final Dialog OrderQuantityDialog = new Dialog(getActivity(), android.R.style.Theme_Translucent_NoTitleBar_Fullscreen);
        OrderQuantityDialog.getWindow().setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.transparent_80)));
        OrderQuantityDialog.setContentView(R.layout.dialog_cod_layout);
        TextView cod_cancel = (TextView) OrderQuantityDialog.findViewById(R.id.cod_cancel);
        CardView confirm_cod_button = (CardView) OrderQuantityDialog.findViewById(R.id.confirm_cod_button);
        confirm_cod_button.setOnClickListener(new View.OnClickListener() {
            @Override            public void onClick(View view) {

                if (DashBoard.socketIoClass.client.connected()) {
                    try {
                        int order_no = 0;
                        OrderQuantityDialog.dismiss();
                        JSONObject object = new JSONObject();
                        object.put("type", "confirm_delivery");
                        JSONObject messgae = new JSONObject();
                        messgae.put("SocketId", DashBoard.socketIoClass.mySocketId);
                        messgae.put("user_id", DashBoard.user_id);
                        messgae.put("restaurant_id", DashBoard.restaurant_id);
                        TakeAwayAdapter.MyViewHolder tempHolder = null;
                        messgae.put("order_no", orderNo);
                        object.put("message", messgae);
                        DashBoard.socketIoClass.sendMessage(object);

                        Toast.makeText(getActivity(), "Confirm Order", Toast.LENGTH_LONG).show();
                        //                            tempHolder.hidedetails.setVisibility(View.GONE);
                        //shuffle();                        //                                orderHistoryListAdapters = new OrderHistoryListAdapters(getActivity());                        //                                menu_listview.setAdapter(orderHistoryListAdapters);                        //                                orderHistoryListAdapters.notifyDataSetChanged();                        // shuffle();                        // orderHistoryListAdapters.notifyDataSetChanged();                    } catch (Exception ex) {

                    }

                }


            }
        });
        cod_cancel.setOnClickListener(new View.OnClickListener() {
            @Override            public void onClick(View view) {
                OrderQuantityDialog.dismiss();
            }
        });
        OrderQuantityDialog.setCancelable(false);
        OrderQuantityDialog.show();


    }
}

No comments:

Post a Comment