<?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:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:keepScreenOn="true"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:orientation="vertical"
android:background="@color/white"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="@drawable/bg_border_layout"
android:orientation="horizontal"
android:layout_weight="1">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3"></LinearLayout>
<LinearLayout
android:id="@+id/back_btn"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3">
<ImageView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:clickable="false"
android:scaleType="centerInside"
android:src="@drawable/ic_left_arrow" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_weight="88">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"></LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_weight="2"
android:gravity="center"
android:orientation="vertical"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="horizontal"
android:layout_weight="2">
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"></LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:orientation="vertical"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"></LinearLayout>
<de.hdodenhof.circleimageview.CircleImageView
android:layout_width="match_parent"
android:layout_weight="2"
android:layout_height="0dp"
android:src="@drawable/ic_menu_icon"
android:id="@+id/restuarnt_img" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"></LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="@dimen/text_size_medium_small"
android:layout_height="match_parent"></LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:orientation="horizontal"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:id="@+id/masterName"
android:gravity="center"
android:textStyle="bold"
android:fontFamily="@font/source_sans_pro_bold"
android:textSize="@dimen/text_size_large"
android:text="FruFresh "/>
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
android:fontFamily="@font/source_sans_pro_regular"
android:textSize="@dimen/text_size_large"
android:text="Master "/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"></LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"></LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:src="@drawable/ic_fri_logo"/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3"></LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:orientation="horizontal"
android:layout_weight="0.75">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:clickable="true"
android:focusable="true"
android:orientation="vertical"
android:layout_weight="1">
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:clickable="true"
android:focusable="true"
android:orientation="vertical"
android:layout_weight="20">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/OrderNo"
android:textStyle="normal"
android:fontFamily="@font/source_sans_pro_regular"
android:gravity="center|left"
android:textSize="@dimen/text_size_medium"
android:textColor="#717171"
android:text="Order #"/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:clickable="true"
android:focusable="true"
android:orientation="vertical"
android:layout_weight="45">
<TextView
android:clickable="false"
android:focusable="true"
android:visibility="visible"
android:id="@+id/orderDate"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fontFamily="@font/source_sans_pro_regular"
android:gravity="center"
android:layout_gravity="center"
android:text=""
android:lines="1"
android:layout_marginRight="@dimen/text_size_large"
android:textColor="#717171"
android:textSize="@dimen/text_size_medium_small"
android:textStyle="normal" />
</LinearLayout>
<LinearLayout
android:visibility="gone"
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:layout_weight="0.5"></LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:visibility="gone"
android:orientation="horizontal"
android:layout_weight="2">
<TextView
android:clickable="false"
android:focusable="true"
android:visibility="gone"
android:id="@+id/orderTime"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fontFamily="@font/source_sans_pro_regular"
android:gravity="center_vertical|center_horizontal"
android:text="12/02/2020"
android:layout_marginRight="@dimen/text_size_large"
android:textColor="#717171"
android:textSize="@dimen/text_size_medium_small"
android:textStyle="normal" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.5"></LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:clickable="true"
android:focusable="true"
android:orientation="vertical"
android:layout_weight="35">
<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">
<TextView
android:clickable="false"
android:focusable="true"
android:visibility="visible"
android:id="@+id/CustomerInfo"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fontFamily="@font/source_sans_pro_regular"
android:gravity="center|left"
android:text=""
android:layout_marginRight="@dimen/text_size_large"
android:textColor="#717171"
android:textSize="@dimen/text_size_medium_small"
android:textStyle="normal" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.5"></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>
</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:layout_weight="0.75"
android:orientation="horizontal"
>
<TextView
android:id="@+id/sno"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:clickable="false"
android:focusable="false"
android:fontFamily="@font/source_sans_pro_regular"
android:gravity="center"
android:text="S.no"
android:textColor="#343434"
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/orderno"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="5"
android:clickable="false"
android:focusable="false"
android:fontFamily="@font/source_sans_pro_regular"
android:gravity="center"
android:text="Item"
android:textColor="#343434"
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/customerdeatils"
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_regular"
android:gravity="center"
android:text="Quantity"
android:textColor="#343434"
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/amount"
android:layout_width="0dp"
android:layout_weight="2.5"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:clickable="false"
android:focusable="false"
android:fontFamily="@font/source_sans_pro_regular"
android:gravity="center"
android:text="Amount"
android:textColor="#343434"
android:textSize="@dimen/text_size_medium_small" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#D2D2D2"></LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="0dp"
android:layout_weight="7.5">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<ListView
android:id="@+id/order_items_listview"
android:divider="@android:color/transparent"
android:dividerHeight="0dp"
android:listSelector="@android:color/transparent"
android:layout_width="match_parent"
android:layout_height="match_parent"></ListView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:orientation="horizontal"
android:layout_weight="0.1">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_weight="88">
<LinearLayout
android:layout_width="0dp"
android:layout_weight="2"
android:gravity="center"
android:orientation="vertical"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="2"
android:gravity="center"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/MessageHide"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_menu_hegiht_width_40"
android:layout_gravity="center"
android:gravity="center">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.1"></LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="4"
android:weightSum="1">
<TextView
android:id="@+id/Message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center|left"
android:layout_marginLeft="5dp"
android:layout_weight="1"
android:fontFamily="@font/source_sans_pro_regular"
android:gravity="center|left"
android:text=""
android:textColor="#717171"
android:textSize="@dimen/text_size_medium_small" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.5">
<TextView
android:id="@+id/Confirm"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:fontFamily="@font/source_sans_pro_bold"
android:gravity="center"
android:clickable="false"
android:focusable="false"
android:text=""
android:layout_marginLeft="@dimen/button_padding_top_bottom"
android:layout_marginRight="@dimen/button_padding_top_bottom"
android:textColor="#FFFFFF"
android:textSize="@dimen/text_size_smaller" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3"></LinearLayout>
</LinearLayout>
<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:orientation="vertical"
android:layout_weight="3">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:clickable="false"
android:focusable="false"
android:id="@+id/orderType"
android:layout_marginTop="10dp"
android:layout_marginBottom="5dp"
android:layout_marginLeft="@dimen/text_size_medium_small"
android:fontFamily="@font/source_sans_pro_bold"
android:gravity="center|left"
android:text="Dine-in"
android:textColor="#343434"
android:textSize="@dimen/text_size_medium_small" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:clickable="false"
android:focusable="false"
android:id="@+id/tablenumber"
android:layout_marginLeft="@dimen/text_size_medium_small"
android:visibility="visible"
android:layout_marginTop="3dp"
android:layout_marginBottom="3dp"
android:fontFamily="@font/source_sans_pro_regular"
android:gravity="center|left"
android:textColor="#343434"
android:textSize="@dimen/text_size_small" />
<TextView
android:id="@+id/seatName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/text_size_medium_small"
android:layout_gravity="center"
android:clickable="false"
android:focusable="false"
android:visibility="visible"
android:layout_marginTop="3dp"
android:layout_marginBottom="3dp"
android:fontFamily="@font/source_sans_pro_regular"
android:gravity="center|left"
android:textColor="#343434"
android:textSize="@dimen/text_size_small" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="4.5">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:clickable="false"
android:focusable="false"
android:layout_marginTop="10dp"
android:layout_marginBottom="5dp"
android:fontFamily="@font/source_sans_pro_bold"
android:gravity="center|right"
android:text="Item total"
android:textColor="#343434"
android:textSize="@dimen/text_size_medium_small" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:clickable="false"
android:focusable="false"
android:id="@+id/discount"
android:visibility="gone"
android:layout_marginTop="3dp"
android:layout_marginBottom="3dp"
android:fontFamily="@font/source_sans_pro_regular"
android:gravity="center|right"
android:text="Discount"
android:textColor="#343434"
android:textSize="@dimen/text_size_small" />
<LinearLayout
android:visibility="gone"
android:id="@+id/tax_layout"
android:layout_width="match_parent"
android:orientation="horizontal"
android:layout_height="wrap_content">
<TextView
android:id="@+id/tax1"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:clickable="false"
android:focusable="false"
android:layout_marginTop="3dp"
android:layout_marginBottom="3dp"
android:fontFamily="@font/source_sans_pro_regular"
android:gravity="center|right"
android:text="Tax "
android:textColor="#343434"
android:textSize="@dimen/text_size_small" />
<ImageView
android:id="@+id/tax_details_btn"
android:clickable="true"
android:focusable="true"
android:layout_width="@dimen/text_size_small"
android:layout_height="@dimen/text_size_small"
android:layout_gravity="center"
android:src="@drawable/ic_info"/>
</LinearLayout>
<TextView
android:id="@+id/Total"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:clickable="false"
android:focusable="false"
android:layout_marginTop="5dp"
android:layout_marginBottom="10dp"
android:fontFamily="@font/source_sans_pro_bold"
android:gravity="center|right"
android:text="Paid"
android:textColor="#343434"
android:textSize="@dimen/text_size_medium_small" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_weight="2.5">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingRight="@dimen/bottom_menu_hegiht_width_20"
android:orientation="vertical"
>
<TextView
android:id="@+id/itemTotal_txt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:clickable="false"
android:focusable="false"
android:layout_marginTop="10dp"
android:layout_marginBottom="5dp"
android:fontFamily="@font/source_sans_pro_bold"
android:gravity="center|right"
android:text="-----"
android:textColor="#343434"
android:textSize="@dimen/text_size_medium_small" />
<TextView
android:id="@+id/discount_txt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:clickable="false"
android:visibility="gone"
android:focusable="false"
android:layout_marginTop="3dp"
android:layout_marginBottom="3dp"
android:fontFamily="@font/source_sans_pro_regular"
android:gravity="center|right"
android:text="S.no"
android:textColor="#343434"
android:textSize="@dimen/text_size_small" />
<TextView
android:id="@+id/tax1_txt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:visibility="gone"
android:clickable="false"
android:focusable="false"
android:layout_marginTop="3dp"
android:layout_marginBottom="3dp"
android:fontFamily="@font/source_sans_pro_regular"
android:gravity="center|right"
android:text="S.no"
android:textColor="#343434"
android:textSize="@dimen/text_size_small" />
<TextView
android:id="@+id/Total_txt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:clickable="false"
android:focusable="false"
android:layout_marginTop="3dp"
android:layout_marginBottom="10dp"
android:fontFamily="@font/source_sans_pro_bold"
android:gravity="center|right"
android:text="----"
android:textColor="#343434"
android:textSize="@dimen/text_size_medium_small" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
2.:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" android:layout_width="match_parent"
android:layout_margin="@dimen/text_size_more_large"
android:layout_height="wrap_content">
<TextView
android:layout_width="0dp"
android:layout_weight="6"
android:layout_height="wrap_content"
android:layout_gravity="center|right"
android:clickable="false"
android:focusable="false"
android:id="@+id/taxName"
android:layout_marginRight="@dimen/text_size_medium_small"
android:fontFamily="@font/source_sans_pro_regular"
android:gravity="center|right"
android:text="Dine-in"
android:textColor="#343434"
android:textSize="@dimen/text_size_small" />
<TextView
android:layout_width="0dp"
android:layout_weight="4"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:clickable="false"
android:focusable="false"
android:id="@+id/taxamounts"
android:layout_marginLeft="@dimen/text_size_medium_small"
android:fontFamily="@font/source_sans_pro_regular"
android:gravity="center|left"
android:text="Dine-in"
android:textColor="#343434"
android:textSize="@dimen/text_size_small" />
</LinearLayout>
Sourse Code:
package com.dfoe.frimaster; import android.app.Dialog; import android.content.Context; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.Window; import android.view.WindowManager; import android.widget.BaseAdapter; import android.widget.Button; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ListView; import android.widget.TextView; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; import com.dfoe.frimaster.DataBaseServices.MasterDB; import com.squareup.picasso.Callback; import com.squareup.picasso.Picasso; import org.json.JSONArray; import org.json.JSONObject; import de.hdodenhof.circleimageview.CircleImageView; public class OrderDeatilsActivity extends AppCompatActivity implements View.OnClickListener { public int orderNo = 0; MasterDB db; JSONArray OrderDeatilsArray,taxDeatilsArray,paymentDeatilsArray,MessageDetails; ListView order_items_listview; LinearLayout back_btn,tax_layout; public String RestaurantImage = ""; CircleImageView restuarnt_img; TextView masterName; ImageView tax_details_btn; OrderDeatilsListAdapter orderDeatilsListAdapter; TaxDeatilsListAdapter taxDeatilsListAdapter; TextView Confirm; LinearLayout MessageHide; TextView tax1_txt,discount,discount_txt,tax1,OrderNo,orderDate,orderTime,itemTotal_txt,Total_txt,seatName,tablenumber,orderType,CustomerInfo,Message; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { requestWindowFeature(Window.FEATURE_NO_TITLE); //will hide the title getSupportActionBar().hide(); // hide the title bar super.onCreate(savedInstanceState); setContentView(R.layout.activity_order_deatils_layout); order_items_listview = (ListView)findViewById(R.id.order_items_listview); back_btn = (LinearLayout)findViewById(R.id.back_btn); back_btn.setOnClickListener(this); tax1_txt = (TextView)findViewById(R.id.tax1_txt); discount = (TextView)findViewById(R.id.discount); discount_txt = (TextView)findViewById(R.id.discount_txt); tax1 = (TextView)findViewById(R.id.tax1); OrderNo = (TextView)findViewById(R.id.OrderNo); orderDate = (TextView)findViewById(R.id.orderDate); orderTime = (TextView)findViewById(R.id.orderTime); itemTotal_txt = (TextView)findViewById(R.id.itemTotal_txt); Total_txt = (TextView)findViewById(R.id.Total_txt); tablenumber = (TextView)findViewById(R.id.tablenumber); seatName = (TextView)findViewById(R.id.seatName); orderType = (TextView)findViewById(R.id.orderType); Bundle extras = getIntent().getExtras(); db = MasterDB.getInstance(OrderDeatilsActivity.this); RestaurantImage = db.getRestaurantImage(); masterName = (TextView)findViewById(R.id.masterName); masterName.setText(DashBoard.RestaurantName+" "); tax_layout = (LinearLayout)findViewById(R.id.tax_layout); restuarnt_img = (CircleImageView)findViewById(R.id.restuarnt_img); tax_details_btn = (ImageView)findViewById(R.id.tax_details_btn); CustomerInfo = (TextView)findViewById(R.id.CustomerInfo); Confirm = (TextView)findViewById(R.id.Confirm); Message = (TextView) findViewById(R.id.Message); MessageHide = (LinearLayout) findViewById(R.id.MessageHide); tax_details_btn.setOnClickListener(this); Picasso.with(OrderDeatilsActivity.this).load(RestaurantImage).error(R.drawable.ic_fri_logo).into(restuarnt_img, new Callback() { @Override public void onSuccess() { } @Override public void onError() { } }); if (extras != null) { orderNo = extras.getInt("Order_no"); } OrderDeatilsArray = new JSONArray(); taxDeatilsArray = new JSONArray(); MessageDetails = new JSONArray(); if(orderNo != 0) { OrderDeatilsArray = db.getOrderDeatilsForOrderNo(orderNo); taxDeatilsArray = db.getTaxdeatils(); paymentDeatilsArray = db.getPaymentdeatils(orderNo); MessageDetails= db.getMessagesDeatilsForOrderNo(orderNo); } if(OrderDeatilsArray != null && paymentDeatilsArray != null ) { try { OrderNo.setText("Order #"+orderNo); orderTime.setText(""+paymentDeatilsArray.getJSONObject(0).getString("time" )); // orderDate.setText(""+paymentDeatilsArray.getJSONObject(0).getString("date")); orderDate.setText("Customer detail:\t"+OrderDeatilsArray.getJSONObject(0).getString("name")); CustomerInfo.setText(""+OrderDeatilsArray.getJSONObject(0).getString("user_phone" )); // CustomerInfo.setText(object.getString("name") + "\t" + object.getString("user_phone")); Double amount = paymentDeatilsArray.getJSONObject(0).getDouble("amount"); itemTotal_txt.setText(DashBoard.currency+amount); Total_txt.setText(DashBoard.currency+paymentDeatilsArray.getJSONObject(0).getDouble("total_amount")); int seat_id = OrderDeatilsArray.getJSONObject(0).getInt("seat_id"); if(paymentDeatilsArray.getJSONObject(0).getDouble("discount_amount") > 0) { discount.setVisibility(View.VISIBLE); discount_txt.setVisibility(View.VISIBLE); discount_txt.setText(DashBoard.currency + paymentDeatilsArray.getJSONObject(0).getDouble("discount_amount")); } Double grossAmount = amount - paymentDeatilsArray.getJSONObject(0).getDouble("discount_amount"); JSONObject object = db.RestaurantTableDeatils(OrderDeatilsArray.getJSONObject(0).getInt("table_id")); if(object != null) { tablenumber.setText("Table #" + object.getString("table_name")); JSONArray array = object.getJSONArray("seat_details"); for(int i = 0; i<array.length(); i++) { JSONObject object1 = array.getJSONObject(i); if(object1.has("seat_id")) { if(object1.getInt("seat_id") == seat_id) seatName.setText("Seat "+object1.getString("seat_name")); } } } int takeway = OrderDeatilsArray.getJSONObject(0).getInt("take_away"); JSONObject object2 = OrderDeatilsArray.getJSONObject(0); /* if(object.has("take_away")) { if (object2.getInt("take_away")==takeway) { orderType.setText("Dinning"); } else { orderType.setText("Takeway"); } }*/ if(object2.has("take_away")) { int server_status = object2.getInt("take_away"); if(server_status == 0) { orderType.setText("Dine-in"); } else { orderType.setText("Take-away"); } } if (object2.has("order_status")) { if (object2.getString("order_status").equals("2")) { Confirm.setText("Declined"); Confirm.setBackgroundColor(0xFFFF0000); Confirm.setTextColor(Color.WHITE); } else if (object2.getString("order_status").equals("3")) { Confirm.setText("Cancelled"); Confirm.setBackgroundColor(0xFF0000FF); Confirm.setTextColor(Color.WHITE); } else { Confirm.setText("Completed"); Confirm.setBackgroundColor(0xFF00FF00); Confirm.setTextColor(Color.WHITE); } } if (MessageDetails != null) { try { Message.setText(MessageDetails.getJSONObject(1).getString("message")); } catch (Exception ex) { } } else { MessageHide.setVisibility(View.GONE); } /* if(object2.has("name" )) { CustomerInfo.setText(object.getString("name") + "\t" + object.getString("user_phone")); }*/ if( taxDeatilsArray != null) { if (taxDeatilsArray.length() > 0) { tax_layout.setVisibility(View.VISIBLE); tax1_txt.setVisibility(View.VISIBLE); tax1_txt.setText(DashBoard.currency + paymentDeatilsArray.getJSONObject(0).getDouble("tax_details")); } } } catch (Exception ex) { } orderDeatilsListAdapter = new OrderDeatilsListAdapter(OrderDeatilsActivity.this); order_items_listview.setAdapter(orderDeatilsListAdapter); } else { try { OrderNo.setText("Order #"+orderNo); orderTime.setText(""+paymentDeatilsArray.getJSONObject(0).getString("time" )); // orderDate.setText(""+paymentDeatilsArray.getJSONObject(0).getString("date")); /* orderDate.setText("Customer detail:\t"+OrderDeatilsArray.getJSONObject(0).getString("name")); CustomerInfo.setText(""+OrderDeatilsArray.getJSONObject(0).getString("user_phone" ));*/ // CustomerInfo.setText(object.getString("name") + "\t" + object.getString("user_phone")); Double amount = paymentDeatilsArray.getJSONObject(0).getDouble("amount"); itemTotal_txt.setText(DashBoard.currency+amount); Total_txt.setText(DashBoard.currency+paymentDeatilsArray.getJSONObject(0).getDouble("total_amount")); int seat_id = OrderDeatilsArray.getJSONObject(0).getInt("seat_id"); if(paymentDeatilsArray.getJSONObject(0).getDouble("discount_amount") > 0) { discount.setVisibility(View.VISIBLE); discount_txt.setVisibility(View.VISIBLE); discount_txt.setText(DashBoard.currency + paymentDeatilsArray.getJSONObject(0).getDouble("discount_amount")); } Double grossAmount = amount - paymentDeatilsArray.getJSONObject(0).getDouble("discount_amount"); JSONObject object = db.RestaurantTableDeatils(OrderDeatilsArray.getJSONObject(0).getInt("table_id")); if(object != null) { tablenumber.setText("Table #" + object.getString("table_name")); JSONArray array = object.getJSONArray("seat_details"); for(int i = 0; i<array.length(); i++) { JSONObject object1 = array.getJSONObject(i); if(object1.has("seat_id")) { if(object1.getInt("seat_id") == seat_id) seatName.setText("Seat "+object1.getString("seat_name")); } } } int takeway = OrderDeatilsArray.getJSONObject(0).getInt("take_away"); JSONObject object2 = OrderDeatilsArray.getJSONObject(0); /* if(object.has("take_away")) { if (object2.getInt("take_away")==takeway) { orderType.setText("Dinning"); } else { orderType.setText("Takeway"); } }*/ if(object2.has("take_away")) { int server_status = object2.getInt("take_away"); if(server_status == 0) { orderType.setText("Dine-in"); } else { orderType.setText("Take-away"); } } if (object2.has("order_status")) { if (object2.getString("order_status").equals("2")) { Confirm.setText("Declined"); Confirm.setBackgroundColor(0xFFFF0000); Confirm.setTextColor(Color.WHITE); } else if (object2.getString("order_status").equals("3")) { Confirm.setText("Cancelled"); Confirm.setBackgroundColor(0xFF0000FF); Confirm.setTextColor(Color.WHITE); } else { Confirm.setText("Completed"); Confirm.setBackgroundColor(0xFF00FF00); Confirm.setTextColor(Color.WHITE); } } if (MessageDetails != null) { try { Message.setText(MessageDetails.getJSONObject(1).getString("message")); } catch (Exception ex) { } } else { MessageHide.setVisibility(View.GONE); } /* if(object2.has("name" )) { CustomerInfo.setText(object.getString("name") + "\t" + object.getString("user_phone")); }*/ if( taxDeatilsArray != null) { if (taxDeatilsArray.length() > 0) { tax_layout.setVisibility(View.VISIBLE); tax1_txt.setVisibility(View.VISIBLE); tax1_txt.setText(DashBoard.currency + paymentDeatilsArray.getJSONObject(0).getDouble("tax_details")); } } } catch (Exception ex) { ex.printStackTrace(); } orderDeatilsListAdapter = new OrderDeatilsListAdapter(OrderDeatilsActivity.this); order_items_listview.setAdapter(orderDeatilsListAdapter); } } @Override public void onClick(View view) { switch (view.getId()) { case R.id.back_btn: finish(); break; case R.id.tax_details_btn: if(taxDeatilsArray != null) showDialogForSelstingMenuQuantityItem(); break; } } public void showDialogForSelstingMenuQuantityItem() { final Dialog OrderQuantityDialog = new Dialog(OrderDeatilsActivity.this, android.R.style.Theme_Black_NoTitleBar); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); OrderQuantityDialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT)); OrderQuantityDialog.setContentView(R.layout.dialog_for_taxes_order_details_layout); ListView tax_listview = (ListView)OrderQuantityDialog.findViewById(R.id.tax_listview); LinearLayout layout3 = (LinearLayout)OrderQuantityDialog.findViewById(R.id.layout3); LinearLayout layout2 = (LinearLayout)OrderQuantityDialog.findViewById(R.id.layout2); LinearLayout layout1 = (LinearLayout)OrderQuantityDialog.findViewById(R.id.layout1); layout1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { OrderQuantityDialog.dismiss(); } }); layout2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { OrderQuantityDialog.dismiss(); } }); layout3.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { OrderQuantityDialog.dismiss(); } }); taxDeatilsListAdapter = new TaxDeatilsListAdapter(OrderDeatilsActivity.this); tax_listview.setAdapter(taxDeatilsListAdapter); OrderQuantityDialog.setCancelable(true); OrderQuantityDialog.show(); } @Override public void onBackPressed() { // super.onBackPressed(); } public class TaxDeatilsListAdapter extends BaseAdapter { Context context; public TaxDeatilsListAdapter(Context context) { this.context = context; } @Override public int getCount() { int count = taxDeatilsArray.length(); return count; } @Override public Object getItem(int position) { try { if (taxDeatilsArray == null) return null; if (position < 0) return null; return taxDeatilsArray.get(position); } catch (Exception ex) { return null; } } @Override public long getItemId(int arg0) { return 0; } @Override public View getView(final int position, View convertView, ViewGroup parent) { TextView taxamounts,taxName; final LayoutInflater inflater = (LayoutInflater) OrderDeatilsActivity.this .getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = inflater.inflate(R.layout.listview_item_for_taxes_layout, null); taxamounts = (TextView)convertView.findViewById(R.id.taxamounts); taxName = (TextView)convertView.findViewById(R.id.taxName); try { JSONObject object = taxDeatilsArray.getJSONObject(position); if(object.has("tex_name")) { taxName.setText(object.getString("tex_name" )); } if(object.has("tax_amount")) { Double amount = paymentDeatilsArray.getJSONObject(0).getDouble("amount"); Double grossAmount = amount - paymentDeatilsArray.getJSONObject(0).getDouble("discount_amount"); double taxDeatils = object.getDouble("tax_amount"); double taxDeatil = ((taxDeatils * grossAmount)/100.00); taxamounts.setText(DashBoard.currency +taxDeatil); } } catch (Exception ex) { } convertView.setTag(position); return convertView; } } public class OrderDeatilsListAdapter extends BaseAdapter { Context context; public OrderDeatilsListAdapter(Context context) { this.context = context; } @Override public int getCount() { int count = OrderDeatilsArray.length(); return count; } @Override public Object getItem(int position) { try { if (OrderDeatilsArray == null) return null; if (position < 0) return null; return OrderDeatilsArray.get(position); } catch (Exception ex) { return null; } } @Override public long getItemId(int arg0) { return 0; } @Override public View getView(final int position, View convertView, ViewGroup parent) { TextView sno,itemData,quantity,amount; final LayoutInflater inflater = (LayoutInflater) OrderDeatilsActivity.this .getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = inflater.inflate(R.layout.listview_item_order_deatils_layout, null); sno = (TextView)convertView.findViewById(R.id.sno); itemData = (TextView)convertView.findViewById(R.id.itemData); quantity = (TextView)convertView.findViewById(R.id.quantity); amount = (TextView)convertView.findViewById(R.id.amount); int i = position + 1; sno.setText(""+i); try { JSONObject object = OrderDeatilsArray.getJSONObject(position); if(object.has("menu_name")) { itemData.setText(object.getString("menu_name" )); } if(object.has("item_quantity")) { quantity.setText(""+object.getInt("item_quantity")); } if(object.has("menu_price")) { amount.setText(DashBoard.currency +object.getDouble("menu_price")); } /* if(object.has("table_number")) { if (object.getString("table_number").equals("0")) { tablenumber.setText("Takeway"); } else { tablenumber.setText("Dinning"); } }*/ orderDate.setText("Customer detail:\t"+OrderDeatilsArray.getJSONObject(0).getString("name")); CustomerInfo.setText(""+OrderDeatilsArray.getJSONObject(0).getString("user_phone" )); if (object.has("order_status")) { if (object.getString("order_status").equals("2")) { Confirm.setText("Declined"); Confirm.setBackgroundColor(0xFFFF0000); Confirm.setTextColor(Color.WHITE); } else if (object.getString("order_status").equals("3")) { Confirm.setText("Cancelled"); Confirm.setBackgroundColor(0xFF0000FF); Confirm.setTextColor(Color.WHITE); } else { Confirm.setText("Completed"); Confirm.setBackgroundColor(0xFF00FF00); Confirm.setTextColor(Color.WHITE); } } JSONObject object3 = db.RestaurantTableDeatils(OrderDeatilsArray.getJSONObject(0).getInt("table_id")); if(object3 != null) { tablenumber.setText("Table #" + object3.getString("table_name")); } int seat_id = OrderDeatilsArray.getJSONObject(0).getInt("seat_id"); JSONArray array = object3.getJSONArray("seat_details"); for(int j = 0; j<array.length(); j++) { JSONObject object1 = array.getJSONObject(j); if(object1.has("seat_id")) { if(object1.getInt("seat_id") == seat_id) seatName.setText("Seat "+object1.getString("seat_name")); } } } catch (Exception ex) { ex.printStackTrace(); } convertView.setTag(position); return convertView; } } }
No comments:
Post a Comment