Kashipara.com is a community of ONE million programmers and students, Just like you, Helping each other.Join them. It only takes a minute: Sign Up
Job Resume TemplateIn this page Ecommerce App project is a mobile application which is developed in Android platform. This Android project with tutorial and guide for developing a code. Ecommerce App is a open source you can Download zip and edit as per you need. If you want more latest Android projects here. This is simple and basic level small project for learning purpose. Also you can modified this system as per your requriments and develop a perfect advance level project. Zip file containing the source code that can be extracted and then imported into Android studio. Here Project Source code for BE, BTech, MCA, BCA, Engineering, Bs.CS, IT, Software Engineering, Computer Science students and Devloper. Student can submit in college for final year project. This script developed by nirbhay singh. This mobile application 100% working smooth without any bug. It is developed using Java and Database Mysql. This software code helpful in academic projects and research paper for final year computer science. You can explore great collection of other Android projects.
Becuase of kashipara is provide a best Ecommerce App project solution for beginners, intermdetate and skilled developers. We provide a document file with project Synopsis, Reports, and various diagrams. Also Abstract in PDF, PPT file inside zip so that document link below the page. UML diagrams for Ecommerce App. Class diagrams, Use Case diagrams, Entity–relationship(ER) diagrams, Data flow diagram(DFD), Sequence diagram and software requirements specification (SRS) in report file. Download code of Ecommerce App project in Android. You can find Top Downloaded Android projects here.
project Name | Ecommerce App |
Project Complexity | advanced |
Duration | 15 Days |
project ID | 2162 |
Developer Name | nirbhay singh |
Publish Date | April 6, 2018 |
project Platform | Android |
Programming Language | Java |
Front End | |
Back End | |
IDE Tool | Android studio |
Database Integration | Mysql |
project Type | mobile Application |
No of project Download | 796 |
project Total View | 14185 |
Today Trends | 2 |
Current Month Trends | 132 |
Last Month Trends | 128 |
You have any error or you don't understand project follow or any other problem.You can ask question. you know any answer or solution then give a answer and help other student.Complete they project perfectly.
package com.mrpizza.worldnet.mrpizza.fragments;
import android.app.AlertDialog;
import android.app.DatePickerDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.app.Fragment;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.app.TimePickerDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.Typeface;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.List;
import android.text.format.DateFormat;
import android.widget.ArrayAdapter;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.Spinner;
import android.widget.TimePicker;
import android.widget.ImageView;
import android.widget.PopupMenu;
import android.widget.TextView;
import android.widget.Toast;
import com.mrpizza.worldnet.mrpizza.AppControlls;
import com.mrpizza.worldnet.mrpizza.MainActivity;
import com.mrpizza.worldnet.mrpizza.R;
import com.sdsmdg.tastytoast.TastyToast;
import com.squareup.picasso.Picasso;
/**
* Created by Nirbhay on 4/17/2017.
*/
public class AddCartFragment extends Fragment implements View.OnClickListener{
// protected CharSequence[] colours = { "Red", "Green", "Blue", "Yellow", "Orange", "Purple" };
protected ArrayList<CharSequence> selectedColours = new ArrayList<CharSequence>();
protected ArrayList<CharSequence> selectedColours1 = new ArrayList<CharSequence>();
protected ArrayList<CharSequence> selectedColours2 = new ArrayList<CharSequence>();
protected ArrayList<CharSequence> selectedColours3 = new ArrayList<CharSequence>();
protected ArrayList<CharSequence> selectedColours4 = new ArrayList<CharSequence>();
String[] choice1 = { "Choice pizza","Magherita", "Quattro 4 maggi", "Country special", "spicy soho pizza", "Formhouse"};
String[] choice2 = { "COCA-COLA", "SPRITE", "FANTA", "DIET COKE", "COCA-COLA ZERO" };
String[] choice3 = { "7UP", "Aquafina", "Gatorade", "Mirinda", "Mountain Dew"};
String[] coleArr = { "Coke can", "Coke zero can","Coke 1.25"};
String[] PepsiArr = { "Light coke can", "Nestea can", "Sprite can","Pepsi 1.25"};
String[] SaladArr = { "Rocket Man", "Ceasar Salad", "Mixed green salad", "Greek salad", "Caprese salad","Antipasto salad"};
String[] AppetizersArr = { "Mozzarella sticks", "Calamari Fritti", "Prawn fritti", "Fried chicken wings", "Garlic bread","French fries","Onion rings","Spring roll","Fish fingers"};
String[] PastasArr = { "Penne arrabiata", "Penne veggies", "Spaghetti carbonara", "Spaghetti chicken", "Spaghetti pesto","Spaghetti bolognese"};
Spinner caokepepsi;
RadioButton cokeradio;
RadioButton pepsiradio,pastaradio,pizzaradio,saladradio;
SQLiteDatabase db;
TextView simplemenubtn,cakemenubtn;
MainActivity manual_child;
TextView number_edit_text;
MainActivity addcartqtyObje;
TextView addcartqtytxt;
AppControlls gObject;
TextView textvalu;
TextView plusbtn,minusbtn;
int total=0;
ImageView proimg;
TextView prdestxt;
double pricevalue=1;
TextView pricetxt;
EditText msgcake,mobtxt,dadres;
TextView adcarrtbtn;
EditText dttm;
int selectedWeight=1;
String proName;
String disperStr;
String saleprice;
String MRPPrice="";
LinearLayout layoutl;
String weightSelect="";
Typeface sonictonicfonts;
ArrayAdapter cokepepadt,pepsiAdt;
String choiceItems="";
StringBuilder apendChoiceStr;
//['dis_per']/100*$rowInfo['item_price'];
//pricetxt.getText().toString(), MRPPrice, disperStr)
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.detail_product, null);
gObject=(AppControlls)getActivity().getApplicationContext();
apendChoiceStr=new StringBuilder();
sonictonicfonts = Typeface.createFromAsset(getActivity().getAssets(), "fonts/avenir-light.ttf");
dttm=(EditText)view.findViewById(R.id.dttm);
caokepepsi=(Spinner)view.findViewById(R.id.caokepepsi);
cokeradio=(RadioButton)view.findViewById(R.id.cokeradio);
pepsiradio=(RadioButton)view.findViewById(R.id.pepsiradio);
pastaradio=(RadioButton)view.findViewById(R.id.pastaradio);
pizzaradio=(RadioButton)view.findViewById(R.id.pizzaradio);
saladradio=(RadioButton)view.findViewById(R.id.saladradio);
layoutl=(LinearLayout)view.findViewById(R.id.layoutl);
// if(gObject.getCatID().equals("3"))
// {
layoutl.setVisibility(View.GONE);
// }
// else
// {
// layoutl.setVisibility(View.VISIBLE);
// }
manual_child = new MainActivity();
number_edit_text = (TextView)getActivity().findViewById(R.id.headername);
number_edit_text.setText("Add Cart");
addcartqtyObje = new MainActivity();
addcartqtytxt = (TextView)getActivity().findViewById(R.id.cartqtytxt);
// addcartqtytxt.setText("1");
prdestxt=(TextView)view.findViewById(R.id.prdestxt);
msgcake=(EditText)view.findViewById(R.id.msgcake);
dttm=(EditText)view.findViewById(R.id.dttm);
dttm.setOnClickListener(this);
mobtxt=(EditText)view.findViewById(R.id.mobtxt);
dadres=(EditText)view.findViewById(R.id.dadres);
adcarrtbtn=(TextView)view.findViewById(R.id.adcarrtbtn);
adcarrtbtn.setOnClickListener(this);
String destr=gObject.getProductDes();
proName=gObject.getProductnam();
prdestxt.setText(destr);
String catID=gObject.getCatID();
String extraSelected=gObject.getSelectedItemComboWithPizza();
if(catID.equals("Combo Pizza"))
{
prdestxt.setText(destr+extraSelected);
}
disperStr=gObject.getDisPriceValue();
saleprice=gObject.getSalePriceValue();
MRPPrice=gObject.getProductprice();
pricevalue=Double.parseDouble(saleprice);
pricetxt=(TextView)view.findViewById(R.id.pricetxt);
pricetxt.setText(""+pricevalue);
proimg=(ImageView)view.findViewById(R.id.proimg);
String imgstr=gObject.getProductImge();
Picasso.with(getActivity())
.load(imgstr)
.placeholder(R.drawable.logopizza) //this is optional the image to display while the url image is downloading
.error(R.drawable.logopizza) //this is also optional if some error has occurred in downloading the image this image would be displayed
.into(proimg);
simplemenubtn=(TextView)view.findViewById(R.id.simplemenubtn);
simplemenubtn.setText("1");
/* if(gObject.getCatID().equals("2"))
{
simplemenubtn.setText("2");
weightSelect="2";
pricetxt.setText(""+pricevalue*Double.parseDouble(weightSelect));
}
else
{
// layoutl.setVisibility(View.VISIBLE);
simplemenubtn.setText("1");
}*/
cakemenubtn=(TextView)view.findViewById(R.id.cakemenubtn);
cakemenubtn.setText("Simple");
textvalu=(TextView)view.findViewById(R.id.textvalu);
plusbtn=(TextView)view.findViewById(R.id.plusbtn);
minusbtn=(TextView)view.findViewById(R.id.minusbtbn);
plusbtn.setOnClickListener(this);
minusbtn.setOnClickListener(this);
cakemenubtn.setOnClickListener(this);
simplemenubtn.setOnClickListener(this);
if(proName.equals("Deals A")) {
pizzaradio.setVisibility(View.VISIBLE);
cokeradio.setVisibility(View.VISIBLE);
pepsiradio.setVisibility(View.VISIBLE);
}
if(proName.equals("Deals B")) {
pizzaradio.setVisibility(View.VISIBLE);
cokeradio.setVisibility(View.VISIBLE);
pepsiradio.setVisibility(View.VISIBLE);
saladradio.setVisibility(View.VISIBLE);
}
if(proName.equals("Deals C")) {
pizzaradio.setVisibility(View.VISIBLE);
cokeradio.setVisibility(View.VISIBLE);
pepsiradio.setVisibility(View.VISIBLE);
saladradio.setVisibility(View.VISIBLE);
pastaradio.setVisibility(View.VISIBLE);
}
if(proName.equals("Deals D")) {
pizzaradio.setVisibility(View.VISIBLE);
cokeradio.setVisibility(View.VISIBLE);
pepsiradio.setVisibility(View.VISIBLE);
}
if(proName.equals("A dinner Couples Combo")) {
pizzaradio.setVisibility(View.VISIBLE);
cokeradio.setVisibility(View.VISIBLE);
pepsiradio.setVisibility(View.VISIBLE);
}
if(proName.equals("Deals A")) {
pizzaradio.setVisibility(View.VISIBLE);
cokeradio.setVisibility(View.VISIBLE);
pepsiradio.setVisibility(View.VISIBLE);
}
if(proName.equals("Deals A")) {
pizzaradio.setVisibility(View.VISIBLE);
cokeradio.setVisibility(View.VISIBLE);
pepsiradio.setVisibility(View.VISIBLE);
}
if(proName.equals("Deals A")) {
pizzaradio.setVisibility(View.VISIBLE);
cokeradio.setVisibility(View.VISIBLE);
pepsiradio.setVisibility(View.VISIBLE);
}
if(proName.equals("Deals A")) {
pizzaradio.setVisibility(View.VISIBLE);
cokeradio.setVisibility(View.VISIBLE);
pepsiradio.setVisibility(View.VISIBLE);
}
if(proName.equals("Deals A")) {
pizzaradio.setVisibility(View.VISIBLE);
cokeradio.setVisibility(View.VISIBLE);
pepsiradio.setVisibility(View.VISIBLE);
}
pepsiradio.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showSelectColoursDialog1();
cokeradio.setText("Coke");
// apendChoiceStr.append(cokeradio.getText().toString()+"#");
//choiceItems="#"+cokeradio.getText().toString();
}
});
cokeradio.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showSelectColoursDialog();
//pepsiradio.setText("pepsi");
apendChoiceStr.append(pepsiradio.getText().toString()+"#");
}
});
pastaradio.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showSelectColoursDialog2();
// pastaradio.setText("Pasta");
apendChoiceStr.append(pastaradio.getText().toString()+"#");
}
});
pizzaradio.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showSelectColoursDialog3();
// pizzaradio.setText("Pizza");
apendChoiceStr.append(pizzaradio.getText().toString()+"#");
}
});
saladradio.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showSelectColoursDialog4();
// saladradio.setText("Salad");
apendChoiceStr.append(saladradio.getText().toString());
}
});
CreateDB();
return view;
}
@Override
public void onClick(View v) {
if(v.getId()==R.id.cakemenubtn)
{
PopupMenu popup = new PopupMenu(getActivity(), cakemenubtn);
//Inflating the Popup using xml file
popup.getMenuInflater().inflate(R.menu.cakemenu, popup.getMenu());
//registering popup with OnMenuItemClickListener
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
public boolean onMenuItemClick(MenuItem item) {
cakemenubtn.setText(item.getTitle());
// Toast.makeText(getActivity(),"You Clicked : " + item.getTitle(),Toast.LENGTH_SHORT).show();
return true;
}
});
popup.show();//showing popup menu
}else if(v.getId()==R.id.simplemenubtn)
{
PopupMenu popup = new PopupMenu(getActivity(), simplemenubtn);
//Inflating the Popup using xml file
popup.getMenuInflater().inflate(R.menu.cake_weight, popup.getMenu());
//registering popup with OnMenuItemClickListener
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
public boolean onMenuItemClick(MenuItem item) {
Toast.makeText(getActivity(),"You Clicked : " + item.getTitle(),Toast.LENGTH_SHORT).show();
selectedWeight=Integer.parseInt(""+item.getTitle());
weightSelect=""+item.getTitle();
// temvale=pricevalue*selectedWeight*Integer.parseInt(textvalu.getText().toString());
pricetxt.setText(""+pricevalue*selectedWeight*Integer.parseInt(textvalu.getText().toString()));
//pricetxt.getText().toString()-dis;
simplemenubtn.setText(item.getTitle()+" Kg");
return true;
}
});
popup.show();//showing popup menu
}
else if(v.getId()==R.id.minusbtbn)
{
double temvale=0;
if(total>0)
{
total=total-1;
textvalu.setText(""+total);
temvale=pricevalue*selectedWeight*Integer.parseInt(textvalu.getText().toString());
pricetxt.setText(""+temvale);
Toast.makeText(getActivity(),"minus value",Toast.LENGTH_LONG).show();
}
else if(total==0)
{
addcartqtytxt.setVisibility(View.GONE);
}
}else if(v.getId()==R.id.plusbtn)
{
double temvale=0;
if(total==0||total>0)
{
total=total+1;
textvalu.setText(""+total);
//addcartqtytxt.setVisibility(View.VISIBLE);
// addcartqtytxt.setText("1");
temvale=pricevalue*selectedWeight*Integer.parseInt(textvalu.getText().toString());
pricetxt.setText(""+temvale);
Toast.makeText(getActivity(),"plus value",Toast.LENGTH_LONG).show();
}
}
else if(v.getId()==R.id.adcarrtbtn)
{
// if(gObject.getCatID().equals("3"))
// {
/* if(disperStr.equals("0"))
{
MRPPrice=pricetxt.getText().toString();
}
else
{
try {
double tempdata = 0;
double temtotl = 0;
double pst=Double.parseDouble(disperStr);
double pr=Double.parseDouble(pricetxt.getText().toString());
tempdata = pst/100*pr ;
temtotl = pr - tempdata;
MRPPrice = "" + pr;
pricetxt.setText(""+temtotl);
}
catch (Exception e)
{
e.printStackTrace();
}
}*/
try {
double tempdata = 0;
double temtotl = 0;
double pst=Double.parseDouble(disperStr);
double pr=Double.parseDouble(pricetxt.getText().toString());
tempdata = pst/100*pr ;
temtotl = pr - tempdata;
MRPPrice = "" + pr;
pricetxt.setText(""+temtotl);
}
catch (Exception e)
{
e.printStackTrace();
}
AddCartValue(gObject.getUserID(), gObject.getCatID(), gObject.getvID(), gObject.getProductId(), gObject.getProductImge(), proName, gObject.getProductDes()+apendChoiceStr.toString(), dadres.getText().toString(), mobtxt.getText().toString(), dttm.getText().toString(), msgcake.getText().toString(), textvalu.getText().toString(), cakemenubtn.getText().toString(), simplemenubtn.getText().toString(), pricetxt.getText().toString(), MRPPrice, disperStr);
Fragment orderFrg = new OrderPlaceFragment();
oprnList(orderFrg);
// }
if(dadres.getText().toString().equalsIgnoreCase(""))
{
dadres.setError("Delivery Address mandatory ");
}
else if(mobtxt.getText().toString().equalsIgnoreCase(""))
{
mobtxt.setError("Mobile mandatory ");
}
else if(msgcake.getText().toString().equalsIgnoreCase(""))
{
msgcake.setError("Message mandatory ");
}
else if(dttm.getText().toString().equalsIgnoreCase(""))
{
dttm.setError("Date time mandatory ");
}
else if(pricetxt.getText().toString().equals("0.0"))
{
// Toast.makeText(getActivity(), "Price not Acceptabl Rs 0.0", Toast.LENGTH_LONG).show();
TastyToast.makeText(getActivity(), "Price not Acceptabl ", TastyToast.LENGTH_LONG,
TastyToast.INFO);
}
else {
if (disperStr.equals("0")) {
MRPPrice = pricetxt.getText().toString();
} else {
try {
double tempdata = 0;
double temtotl = 0;
double pst = Double.parseDouble(disperStr);
double pr = Double.parseDouble(pricetxt.getText().toString());
tempdata = pst / 100 * pr;
temtotl = pr - tempdata;
MRPPrice = "" + pr;
pricetxt.setText("" + temtotl);
} catch (Exception e) {
e.printStackTrace();
}
}
AddCartValue(gObject.getUserID(), gObject.getCatID(), gObject.getvID(), gObject.getProductId(), gObject.getProductImge(), proName, gObject.getProductDes(), dadres.getText().toString(), mobtxt.getText().toString(), dttm.getText().toString(), msgcake.getText().toString(), textvalu.getText().toString(), cakemenubtn.getText().toString(), simplemenubtn.getText().toString(), pricetxt.getText().toString(), MRPPrice, disperStr);
Fragment orderFrg1 = new OrderPlaceFragment();
oprnList(orderFrg1);
}
}
else if(v.getId()==R.id.dttm)
{
showTruitonTimePickerDialog(v);
showTruitonDatePickerDialog(v);
}
}
public void oprnList(Fragment callFrag)
{
FragmentManager req_mnt=getFragmentManager();
FragmentTransaction req_transion=req_mnt.beginTransaction().addToBackStack("category");
req_transion.replace(R.id.content_frame, callFrag);
req_transion.commit();
}
// Create SQLite Database
public void CreateDB()
{
db=getActivity().openOrCreateDatabase("cake", Context.MODE_PRIVATE, null);
createTableCart();
}
// Create Table for cart
public void createTableCart()
{
db.execSQL("CREATE TABLE IF NOT EXISTS cartAdd(id INTEGER PRIMARY KEY AUTOINCREMENT,uid VARCHAR,catid VARCHAR,vid VARCHAR,proid VARCHAR,proimg VARCHAR,proname VARCHAR,prodes VARCHAR,deliveryaddress VARCHAR,mobileno VARCHAR,dttime VARCHAR,msg VARCHAR,qty VARCHAR,cakecust VARCHAR,weightcake VARCHAR,pricecake VARCHAR,mrpprice VARCHAR,disper VARCHAR);");
}
//String uid,String catId,String proId,String proimg,String prodes,String deliveryAddress,String mobile,String dttm,String msg,String qtycake,String cakecustom,String weightcake,String pricecake
public void AddCartValue(String uid,String catId,String vId,String proId,String proimg,String proName,String proDes,String deliveryAddress,String mobile,String dttm,String msg,String qtycake,String cakecustom,String weightcake,String pricecake,String mrp,String disp)
{
try {
db.execSQL("INSERT INTO cartAdd (uid,catid,vid,proid,proimg,proname,prodes,deliveryaddress,mobileno,dttime,msg,qty,cakecust,weightcake,pricecake,mrpprice,disper) VALUES('" + uid + "','" + catId + "','" + vId + "','" + proId + "','" + proimg + "','"+proName+"','" + proDes + "','" + deliveryAddress + "','" + mobile + "','" + dttm + "','" + msg + "','" + qtycake + "','" + cakecustom + "','" + weightcake + "','" + pricecake + "','"+mrp+"','"+disp+"');");
Toast.makeText(getActivity(),"Add Card Successfully!",Toast.LENGTH_LONG).show();
}
catch (Exception e)
{
e.printStackTrace();
Toast.makeText(getActivity(),"Try again!",Toast.LENGTH_LONG).show();
}
}
public void showTruitonDatePickerDialog(View v) {
DialogFragment newFragment = new DatePickerFragment();
newFragment.show(getFragmentManager(), "datePicker");
}
public class DatePickerFragment extends DialogFragment implements
DatePickerDialog.OnDateSetListener {
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
// Use the current date as the default date in the picker
final Calendar c = Calendar.getInstance();
int year = c.get(Calendar.YEAR);
int month = c.get(Calendar.MONTH);
int day = c.get(Calendar.DAY_OF_MONTH);
// Create a new instance of DatePickerDialog and return it
return new DatePickerDialog(getActivity(), this, year, month, day);
}
public void onDateSet(DatePicker view, int year, int month, int day) {
// Do something with the date chosen by the user
dttm.setText(day + "/" + (month + 1) + "/" + year);
}
}
public void showTruitonTimePickerDialog(View v) {
DialogFragment newFragment = new TimePickerFragment();
newFragment.show(getFragmentManager(), "timePicker");
}
public class TimePickerFragment extends DialogFragment implements
TimePickerDialog.OnTimeSetListener {
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
// Use the current time as the default values for the picker
final Calendar c = Calendar.getInstance();
int hour = c.get(Calendar.HOUR_OF_DAY);
int minute = c.get(Calendar.MINUTE);
// Create a new instance of TimePickerDialog and return it
return new TimePickerDialog(getActivity(), this, hour, minute,
DateFormat.is24HourFormat(getActivity()));
}
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
// Do something with the time chosen by the user
dttm.setText(dttm.getText() + " -" + hourOfDay + ":" + minute);
}
}
protected void showSelectColoursDialog() {
boolean[] checkedColours = new boolean[coleArr.length];
int count = coleArr.length;
for(int i = 0; i < count; i++)
checkedColours[i] = selectedColours.contains(coleArr[i]);
DialogInterface.OnMultiChoiceClickListener coloursDialogListener = new DialogInterface.OnMultiChoiceClickListener() {
@Override
public void onClick(DialogInterface dialog, int which, boolean isChecked) {
if(isChecked)
selectedColours.add(coleArr[which]);
else
selectedColours.remove(coleArr[which]);
onChangeSelectedColours();
}
};
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle("Choice");
builder.setMultiChoiceItems(coleArr, checkedColours, coloursDialogListener);
AlertDialog dialog = builder.create();
dialog.show();
}
protected void showSelectColoursDialog1() {
boolean[] checkedColours = new boolean[PepsiArr.length];
int count = PepsiArr.length;
for(int i = 0; i < count; i++)
checkedColours[i] = selectedColours1.contains(PepsiArr[i]);
DialogInterface.OnMultiChoiceClickListener coloursDialogListener = new DialogInterface.OnMultiChoiceClickListener() {
@Override
public void onClick(DialogInterface dialog, int which, boolean isChecked) {
if(isChecked)
selectedColours1.add(PepsiArr[which]);
else
selectedColours1.remove(PepsiArr[which]);
onChangeSelectedColours1();
}
};
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle("Choice");
builder.setMultiChoiceItems(PepsiArr, checkedColours, coloursDialogListener);
AlertDialog dialog = builder.create();
dialog.show();
}
protected void onChangeSelectedColours() {
StringBuilder stringBuilder = new StringBuilder();
for(CharSequence colour : selectedColours)
stringBuilder.append(colour + ",");
cokeradio.setText(stringBuilder.toString());
}
protected void onChangeSelectedColours1() {
StringBuilder stringBuilder = new StringBuilder();
for(CharSequence colour : selectedColours1)
stringBuilder.append(colour + ",");
pepsiradio.setText(stringBuilder.toString());
}
protected void showSelectColoursDialog2() {
boolean[] checkedColours = new boolean[PastasArr.length];
int count = PastasArr.length;
for(int i = 0; i < count; i++)
checkedColours[i] = selectedColours2.contains(PastasArr[i]);
DialogInterface.OnMultiChoiceClickListener coloursDialogListener = new DialogInterface.OnMultiChoiceClickListener() {
@Override
public void onClick(DialogInterface dialog, int which, boolean isChecked) {
if(isChecked)
selectedColours2.add(PastasArr[which]);
else
selectedColours2.remove(PastasArr[which]);
onChangeSelectedColours2();
}
};
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle("Choice");
builder.setMultiChoiceItems(PastasArr, checkedColours, coloursDialogListener);
AlertDialog dialog = builder.create();
dialog.show();
}
protected void onChangeSelectedColours2() {
StringBuilder stringBuilder = new StringBuilder();
for(CharSequence colour : selectedColours2)
stringBuilder.append(colour + ",");
pastaradio.setText(stringBuilder.toString());
}
protected void onChangeSelectedColours3() {
StringBuilder stringBuilder = new StringBuilder();
for(CharSequence colour : selectedColours3)
stringBuilder.append(colour + ",");
pizzaradio.setText(stringBuilder.toString());
}
protected void showSelectColoursDialog3() {
final ArrayList<String>pizzatemp=gObject.getPizzaLs();
final String[] pizzaArr = pizzatemp.toArray(new String[pizzatemp.size()]);
boolean[] checkedColours = new boolean[pizzaArr.length];
int count = pizzaArr.length;
for(int i = 0; i < count; i++)
checkedColours[i] = selectedColours3.contains(pizzaArr[i]);
DialogInterface.OnMultiChoiceClickListener coloursDialogListener = new DialogInterface.OnMultiChoiceClickListener() {
@Override
public void onClick(DialogInterface dialog, int which, boolean isChecked) {
if(isChecked)
selectedColours3.add(pizzaArr[which]);
else
selectedColours3.remove(pizzaArr[which]);
onChangeSelectedColours3();
}
};
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle("Choice");
builder.setMultiChoiceItems(pizzaArr, checkedColours, coloursDialogListener);
AlertDialog dialog = builder.create();
dialog.show();
}
protected void showSelectColoursDialog4() {
boolean[] checkedColours = new boolean[SaladArr.length];
int count = SaladArr.length;
for(int i = 0; i < count; i++)
checkedColours[i] = selectedColours4.contains(SaladArr[i]);
DialogInterface.OnMultiChoiceClickListener coloursDialogListener = new DialogInterface.OnMultiChoiceClickListener() {
@Override
public void onClick(DialogInterface dialog, int which, boolean isChecked) {
if(isChecked)
selectedColours4.add(SaladArr[which]);
else
selectedColours4.remove(SaladArr[which]);
onChangeSelectedColours4();
}
};
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle("Choice");
builder.setMultiChoiceItems(SaladArr, checkedColours, coloursDialogListener);
AlertDialog dialog = builder.create();
dialog.show();
}
protected void onChangeSelectedColours4() {
StringBuilder stringBuilder = new StringBuilder();
for(CharSequence colour : selectedColours4)
stringBuilder.append(colour + ",");
saladradio.setText(stringBuilder.toString());
}
}
package com.mrpizza.worldnet.mrpizza.fragments;
import android.app.AlertDialog;
import android.app.DatePickerDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.app.Fragment;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.app.TimePickerDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.Typeface;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.List;
import android.text.format.DateFormat;
import android.widget.ArrayAdapter;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.Spinner;
import android.widget.TimePicker;
import android.widget.ImageView;
import android.widget.PopupMenu;
import android.widget.TextView;
import android.widget.Toast;
import com.mrpizza.worldnet.mrpizza.AppControlls;
import com.mrpizza.worldnet.mrpizza.MainActivity;
import com.mrpizza.worldnet.mrpizza.R;
import com.sdsmdg.tastytoast.TastyToast;
import com.squareup.picasso.Picasso;
/**
* Created by Nirbhay on 4/17/2017.
*/
public class AddCartFragment extends Fragment implements View.OnClickListener{
// protected CharSequence[] colours = { "Red", "Green", "Blue", "Yellow", "Orange", "Purple" };
protected ArrayList<CharSequence> selectedColours = new ArrayList<CharSequence>();
protected ArrayList<CharSequence> selectedColours1 = new ArrayList<CharSequence>();
protected ArrayList<CharSequence> selectedColours2 = new ArrayList<CharSequence>();
protected ArrayList<CharSequence> selectedColours3 = new ArrayList<CharSequence>();
protected ArrayList<CharSequence> selectedColours4 = new ArrayList<CharSequence>();
String[] choice1 = { "Choice pizza","Magherita", "Quattro 4 maggi", "Country special", "spicy soho pizza", "Formhouse"};
String[] choice2 = { "COCA-COLA", "SPRITE", "FANTA", "DIET COKE", "COCA-COLA ZERO" };
String[] choice3 = { "7UP", "Aquafina", "Gatorade", "Mirinda", "Mountain Dew"};
String[] coleArr = { "Coke can", "Coke zero can","Coke 1.25"};
String[] PepsiArr = { "Light coke can", "Nestea can", "Sprite can","Pepsi 1.25"};
String[] SaladArr = { "Rocket Man", "Ceasar Salad", "Mixed green salad", "Greek salad", "Caprese salad","Antipasto salad"};
String[] AppetizersArr = { "Mozzarella sticks", "Calamari Fritti", "Prawn fritti", "Fried chicken wings", "Garlic bread","French fries","Onion rings","Spring roll","Fish fingers"};
String[] PastasArr = { "Penne arrabiata", "Penne veggies", "Spaghetti carbonara", "Spaghetti chicken", "Spaghetti pesto","Spaghetti bolognese"};
Spinner caokepepsi;
RadioButton cokeradio;
RadioButton pepsiradio,pastaradio,pizzaradio,saladradio;
SQLiteDatabase db;
TextView simplemenubtn,cakemenubtn;
MainActivity manual_child;
TextView number_edit_text;
MainActivity addcartqtyObje;
TextView addcartqtytxt;
AppControlls gObject;
TextView textvalu;
TextView plusbtn,minusbtn;
int total=0;
ImageView proimg;
TextView prdestxt;
double pricevalue=1;
TextView pricetxt;
EditText msgcake,mobtxt,dadres;
TextView adcarrtbtn;
EditText dttm;
int selectedWeight=1;
String proName;
String disperStr;
String saleprice;
String MRPPrice="";
LinearLayout layoutl;
String weightSelect="";
Typeface sonictonicfonts;
ArrayAdapter cokepepadt,pepsiAdt;
String choiceItems="";
StringBuilder apendChoiceStr;
//['dis_per']/100*$rowInfo['item_price'];
//pricetxt.getText().toString(), MRPPrice, disperStr)
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.detail_product, null);
gObject=(AppControlls)getActivity().getApplicationContext();
apendChoiceStr=new StringBuilder();
sonictonicfonts = Typeface.createFromAsset(getActivity().getAssets(), "fonts/avenir-light.ttf");
dttm=(EditText)view.findViewById(R.id.dttm);
caokepepsi=(Spinner)view.findViewById(R.id.caokepepsi);
cokeradio=(RadioButton)view.findViewById(R.id.cokeradio);
pepsiradio=(RadioButton)view.findViewById(R.id.pepsiradio);
pastaradio=(RadioButton)view.findViewById(R.id.pastaradio);
pizzaradio=(RadioButton)view.findViewById(R.id.pizzaradio);
saladradio=(RadioButton)view.findViewById(R.id.saladradio);
layoutl=(LinearLayout)view.findViewById(R.id.layoutl);
// if(gObject.getCatID().equals("3"))
// {
layoutl.setVisibility(View.GONE);
// }
// else
// {
// layoutl.setVisibility(View.VISIBLE);
// }
manual_child = new MainActivity();
number_edit_text = (TextView)getActivity().findViewById(R.id.headername);
number_edit_text.setText("Add Cart");
addcartqtyObje = new MainActivity();
addcartqtytxt = (TextView)getActivity().findViewById(R.id.cartqtytxt);
// addcartqtytxt.setText("1");
prdestxt=(TextView)view.findViewById(R.id.prdestxt);
msgcake=(EditText)view.findViewById(R.id.msgcake);
dttm=(EditText)view.findViewById(R.id.dttm);
dttm.setOnClickListener(this);
mobtxt=(EditText)view.findViewById(R.id.mobtxt);
dadres=(EditText)view.findViewById(R.id.dadres);
adcarrtbtn=(TextView)view.findViewById(R.id.adcarrtbtn);
adcarrtbtn.setOnClickListener(this);
String destr=gObject.getProductDes();
proName=gObject.getProductnam();
prdestxt.setText(destr);
String catID=gObject.getCatID();
String extraSelected=gObject.getSelectedItemComboWithPizza();
if(catID.equals("Combo Pizza"))
{
prdestxt.setText(destr+extraSelected);
}
disperStr=gObject.getDisPriceValue();
saleprice=gObject.getSalePriceValue();
MRPPrice=gObject.getProductprice();
pricevalue=Double.parseDouble(saleprice);
pricetxt=(TextView)view.findViewById(R.id.pricetxt);
pricetxt.setText(""+pricevalue);
proimg=(ImageView)view.findViewById(R.id.proimg);
String imgstr=gObject.getProductImge();
Picasso.with(getActivity())
.load(imgstr)
.placeholder(R.drawable.logopizza) //this is optional the image to display while the url image is downloading
.error(R.drawable.logopizza) //this is also optional if some error has occurred in downloading the image this image would be displayed
.into(proimg);
simplemenubtn=(TextView)view.findViewById(R.id.simplemenubtn);
simplemenubtn.setText("1");
/* if(gObject.getCatID().equals("2"))
{
simplemenubtn.setText("2");
weightSelect="2";
pricetxt.setText(""+pricevalue*Double.parseDouble(weightSelect));
}
else
{
// layoutl.setVisibility(View.VISIBLE);
simplemenubtn.setText("1");
}*/
cakemenubtn=(TextView)view.findViewById(R.id.cakemenubtn);
cakemenubtn.setText("Simple");
textvalu=(TextView)view.findViewById(R.id.textvalu);
plusbtn=(TextView)view.findViewById(R.id.plusbtn);
minusbtn=(TextView)view.findViewById(R.id.minusbtbn);
plusbtn.setOnClickListener(this);
minusbtn.setOnClickListener(this);
cakemenubtn.setOnClickListener(this);
simplemenubtn.setOnClickListener(this);
if(proName.equals("Deals A")) {
pizzaradio.setVisibility(View.VISIBLE);
cokeradio.setVisibility(View.VISIBLE);
pepsiradio.setVisibility(View.VISIBLE);
}
if(proName.equals("Deals B")) {
pizzaradio.setVisibility(View.VISIBLE);
cokeradio.setVisibility(View.VISIBLE);
pepsiradio.setVisibility(View.VISIBLE);
saladradio.setVisibility(View.VISIBLE);
}
if(proName.equals("Deals C")) {
pizzaradio.setVisibility(View.VISIBLE);
cokeradio.setVisibility(View.VISIBLE);
pepsiradio.setVisibility(View.VISIBLE);
saladradio.setVisibility(View.VISIBLE);
pastaradio.setVisibility(View.VISIBLE);
}
if(proName.equals("Deals D")) {
pizzaradio.setVisibility(View.VISIBLE);
cokeradio.setVisibility(View.VISIBLE);
pepsiradio.setVisibility(View.VISIBLE);
}
if(proName.equals("A dinner Couples Combo")) {
pizzaradio.setVisibility(View.VISIBLE);
cokeradio.setVisibility(View.VISIBLE);
pepsiradio.setVisibility(View.VISIBLE);
}
if(proName.equals("Deals A")) {
pizzaradio.setVisibility(View.VISIBLE);
cokeradio.setVisibility(View.VISIBLE);
pepsiradio.setVisibility(View.VISIBLE);
}
if(proName.equals("Deals A")) {
pizzaradio.setVisibility(View.VISIBLE);
cokeradio.setVisibility(View.VISIBLE);
pepsiradio.setVisibility(View.VISIBLE);
}
if(proName.equals("Deals A")) {
pizzaradio.setVisibility(View.VISIBLE);
cokeradio.setVisibility(View.VISIBLE);
pepsiradio.setVisibility(View.VISIBLE);
}
if(proName.equals("Deals A")) {
pizzaradio.setVisibility(View.VISIBLE);
cokeradio.setVisibility(View.VISIBLE);
pepsiradio.setVisibility(View.VISIBLE);
}
if(proName.equals("Deals A")) {
pizzaradio.setVisibility(View.VISIBLE);
cokeradio.setVisibility(View.VISIBLE);
pepsiradio.setVisibility(View.VISIBLE);
}
pepsiradio.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showSelectColoursDialog1();
cokeradio.setText("Coke");
// apendChoiceStr.append(cokeradio.getText().toString()+"#");
//choiceItems="#"+cokeradio.getText().toString();
}
});
cokeradio.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showSelectColoursDialog();
//pepsiradio.setText("pepsi");
apendChoiceStr.append(pepsiradio.getText().toString()+"#");
}
});
pastaradio.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showSelectColoursDialog2();
// pastaradio.setText("Pasta");
apendChoiceStr.append(pastaradio.getText().toString()+"#");
}
});
pizzaradio.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showSelectColoursDialog3();
// pizzaradio.setText("Pizza");
apendChoiceStr.append(pizzaradio.getText().toString()+"#");
}
});
saladradio.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showSelectColoursDialog4();
// saladradio.setText("Salad");
apendChoiceStr.append(saladradio.getText().toString());
}
});
CreateDB();
return view;
}
@Override
public void onClick(View v) {
if(v.getId()==R.id.cakemenubtn)
{
PopupMenu popup = new PopupMenu(getActivity(), cakemenubtn);
//Inflating the Popup using xml file
popup.getMenuInflater().inflate(R.menu.cakemenu, popup.getMenu());
//registering popup with OnMenuItemClickListener
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
public boolean onMenuItemClick(MenuItem item) {
cakemenubtn.setText(item.getTitle());
// Toast.makeText(getActivity(),"You Clicked : " + item.getTitle(),Toast.LENGTH_SHORT).show();
return true;
}
});
popup.show();//showing popup menu
}else if(v.getId()==R.id.simplemenubtn)
{
PopupMenu popup = new PopupMenu(getActivity(), simplemenubtn);
//Inflating the Popup using xml file
popup.getMenuInflater().inflate(R.menu.cake_weight, popup.getMenu());
//registering popup with OnMenuItemClickListener
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
public boolean onMenuItemClick(MenuItem item) {
Toast.makeText(getActivity(),"You Clicked : " + item.getTitle(),Toast.LENGTH_SHORT).show();
selectedWeight=Integer.parseInt(""+item.getTitle());
weightSelect=""+item.getTitle();
// temvale=pricevalue*selectedWeight*Integer.parseInt(textvalu.getText().toString());
pricetxt.setText(""+pricevalue*selectedWeight*Integer.parseInt(textvalu.getText().toString()));
//pricetxt.getText().toString()-dis;
simplemenubtn.setText(item.getTitle()+" Kg");
return true;
}
});
popup.show();//showing popup menu
}
else if(v.getId()==R.id.minusbtbn)
{
double temvale=0;
if(total>0)
{
total=total-1;
textvalu.setText(""+total);
temvale=pricevalue*selectedWeight*Integer.parseInt(textvalu.getText().toString());
pricetxt.setText(""+temvale);
Toast.makeText(getActivity(),"minus value",Toast.LENGTH_LONG).show();
}
else if(total==0)
{
addcartqtytxt.setVisibility(View.GONE);
}
}else if(v.getId()==R.id.plusbtn)
{
double temvale=0;
if(total==0||total>0)
{
total=total+1;
textvalu.setText(""+total);
//addcartqtytxt.setVisibility(View.VISIBLE);
// addcartqtytxt.setText("1");
temvale=pricevalue*selectedWeight*Integer.parseInt(textvalu.getText().toString());
pricetxt.setText(""+temvale);
Toast.makeText(getActivity(),"plus value",Toast.LENGTH_LONG).show();
}
}
else if(v.getId()==R.id.adcarrtbtn)
{
// if(gObject.getCatID().equals("3"))
// {
/* if(disperStr.equals("0"))
{
MRPPrice=pricetxt.getText().toString();
}
else
{
try {
double tempdata = 0;
double temtotl = 0;
double pst=Double.parseDouble(disperStr);
double pr=Double.parseDouble(pricetxt.getText().toString());
tempdata = pst/100*pr ;
temtotl = pr - tempdata;
MRPPrice = "" + pr;
pricetxt.setText(""+temtotl);
}
catch (Exception e)
{
e.printStackTrace();
}
}*/
try {
double tempdata = 0;
double temtotl = 0;
double pst=Double.parseDouble(disperStr);
double pr=Double.parseDouble(pricetxt.getText().toString());
tempdata = pst/100*pr ;
temtotl = pr - tempdata;
MRPPrice = "" + pr;
pricetxt.setText(""+temtotl);
}
catch (Exception e)
{
e.printStackTrace();
}
AddCartValue(gObject.getUserID(), gObject.getCatID(), gObject.getvID(), gObject.getProductId(), gObject.getProductImge(), proName, gObject.getProductDes()+apendChoiceStr.toString(), dadres.getText().toString(), mobtxt.getText().toString(), dttm.getText().toString(), msgcake.getText().toString(), textvalu.getText().toString(), cakemenubtn.getText().toString(), simplemenubtn.getText().toString(), pricetxt.getText().toString(), MRPPrice, disperStr);
Fragment orderFrg = new OrderPlaceFragment();
oprnList(orderFrg);
// }
if(dadres.getText().toString().equalsIgnoreCase(""))
{
dadres.setError("Delivery Address mandatory ");
}
else if(mobtxt.getText().toString().equalsIgnoreCase(""))
{
mobtxt.setError("Mobile mandatory ");
}
else if(msgcake.getText().toString().equalsIgnoreCase(""))
{
msgcake.setError("Message mandatory ");
}
else if(dttm.getText().toString().equalsIgnoreCase(""))
{
dttm.setError("Date time mandatory ");
}
else if(pricetxt.getText().toString().equals("0.0"))
{
// Toast.makeText(getActivity(), "Price not Acceptabl Rs 0.0", Toast.LENGTH_LONG).show();
TastyToast.makeText(getActivity(), "Price not Acceptabl ", TastyToast.LENGTH_LONG,
TastyToast.INFO);
}
else {
if (disperStr.equals("0")) {
MRPPrice = pricetxt.getText().toString();
} else {
try {
double tempdata = 0;
double temtotl = 0;
double pst = Double.parseDouble(disperStr);
double pr = Double.parseDouble(pricetxt.getText().toString());
tempdata = pst / 100 * pr;
temtotl = pr - tempdata;
MRPPrice = "" + pr;
pricetxt.setText("" + temtotl);
} catch (Exception e) {
e.printStackTrace();
}
}
AddCartValue(gObject.getUserID(), gObject.getCatID(), gObject.getvID(), gObject.getProductId(), gObject.getProductImge(), proName, gObject.getProductDes(), dadres.getText().toString(), mobtxt.getText().toString(), dttm.getText().toString(), msgcake.getText().toString(), textvalu.getText().toString(), cakemenubtn.getText().toString(), simplemenubtn.getText().toString(), pricetxt.getText().toString(), MRPPrice, disperStr);
Fragment orderFrg1 = new OrderPlaceFragment();
oprnList(orderFrg1);
}
}
else if(v.getId()==R.id.dttm)
{
showTruitonTimePickerDialog(v);
showTruitonDatePickerDialog(v);
}
}
public void oprnList(Fragment callFrag)
{
FragmentManager req_mnt=getFragmentManager();
FragmentTransaction req_transion=req_mnt.beginTransaction().addToBackStack("category");
req_transion.replace(R.id.content_frame, callFrag);
req_transion.commit();
}
// Create SQLite Database
public void CreateDB()
{
db=getActivity().openOrCreateDatabase("cake", Context.MODE_PRIVATE, null);
createTableCart();
}
// Create Table for cart
public void createTableCart()
{
db.execSQL("CREATE TABLE IF NOT EXISTS cartAdd(id INTEGER PRIMARY KEY AUTOINCREMENT,uid VARCHAR,catid VARCHAR,vid VARCHAR,proid VARCHAR,proimg VARCHAR,proname VARCHAR,prodes VARCHAR,deliveryaddress VARCHAR,mobileno VARCHAR,dttime VARCHAR,msg VARCHAR,qty VARCHAR,cakecust VARCHAR,weightcake VARCHAR,pricecake VARCHAR,mrpprice VARCHAR,disper VARCHAR);");
}
//String uid,String catId,String proId,String proimg,String prodes,String deliveryAddress,String mobile,String dttm,String msg,String qtycake,String cakecustom,String weightcake,String pricecake
public void AddCartValue(String uid,String catId,String vId,String proId,String proimg,String proName,String proDes,String deliveryAddress,String mobile,String dttm,String msg,String qtycake,String cakecustom,String weightcake,String pricecake,String mrp,String disp)
{
try {
db.execSQL("INSERT INTO cartAdd (uid,catid,vid,proid,proimg,proname,prodes,deliveryaddress,mobileno,dttime,msg,qty,cakecust,weightcake,pricecake,mrpprice,disper) VALUES('" + uid + "','" + catId + "','" + vId + "','" + proId + "','" + proimg + "','"+proName+"','" + proDes + "','" + deliveryAddress + "','" + mobile + "','" + dttm + "','" + msg + "','" + qtycake + "','" + cakecustom + "','" + weightcake + "','" + pricecake + "','"+mrp+"','"+disp+"');");
Toast.makeText(getActivity(),"Add Card Successfully!",Toast.LENGTH_LONG).show();
}
catch (Exception e)
{
e.printStackTrace();
Toast.makeText(getActivity(),"Try again!",Toast.LENGTH_LONG).show();
}
}
public void showTruitonDatePickerDialog(View v) {
DialogFragment newFragment = new DatePickerFragment();
newFragment.show(getFragmentManager(), "datePicker");
}
public class DatePickerFragment extends DialogFragment implements
DatePickerDialog.OnDateSetListener {
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
// Use the current date as the default date in the picker
final Calendar c = Calendar.getInstance();
int year = c.get(Calendar.YEAR);
int month = c.get(Calendar.MONTH);
int day = c.get(Calendar.DAY_OF_MONTH);
// Create a new instance of DatePickerDialog and return it
return new DatePickerDialog(getActivity(), this, year, month, day);
}
public void onDateSet(DatePicker view, int year, int month, int day) {
// Do something with the date chosen by the user
dttm.setText(day + "/" + (month + 1) + "/" + year);
}
}
public void showTruitonTimePickerDialog(View v) {
DialogFragment newFragment = new TimePickerFragment();
newFragment.show(getFragmentManager(), "timePicker");
}
public class TimePickerFragment extends DialogFragment implements
TimePickerDialog.OnTimeSetListener {
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
// Use the current time as the default values for the picker
final Calendar c = Calendar.getInstance();
int hour = c.get(Calendar.HOUR_OF_DAY);
int minute = c.get(Calendar.MINUTE);
// Create a new instance of TimePickerDialog and return it
return new TimePickerDialog(getActivity(), this, hour, minute,
DateFormat.is24HourFormat(getActivity()));
}
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
// Do something with the time chosen by the user
dttm.setText(dttm.getText() + " -" + hourOfDay + ":" + minute);
}
}
protected void showSelectColoursDialog() {
boolean[] checkedColours = new boolean[coleArr.length];
int count = coleArr.length;
for(int i = 0; i < count; i++)
checkedColours[i] = selectedColours.contains(coleArr[i]);
DialogInterface.OnMultiChoiceClickListener coloursDialogListener = new DialogInterface.OnMultiChoiceClickListener() {
@Override
public void onClick(DialogInterface dialog, int which, boolean isChecked) {
if(isChecked)
selectedColours.add(coleArr[which]);
else
selectedColours.remove(coleArr[which]);
onChangeSelectedColours();
}
};
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle("Choice");
builder.setMultiChoiceItems(coleArr, checkedColours, coloursDialogListener);
AlertDialog dialog = builder.create();
dialog.show();
}
protected void showSelectColoursDialog1() {
boolean[] checkedColours = new boolean[PepsiArr.length];
int count = PepsiArr.length;
for(int i = 0; i < count; i++)
checkedColours[i] = selectedColours1.contains(PepsiArr[i]);
DialogInterface.OnMultiChoiceClickListener coloursDialogListener = new DialogInterface.OnMultiChoiceClickListener() {
@Override
public void onClick(DialogInterface dialog, int which, boolean isChecked) {
if(isChecked)
selectedColours1.add(PepsiArr[which]);
else
selectedColours1.remove(PepsiArr[which]);
onChangeSelectedColours1();
}
};
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle("Choice");
builder.setMultiChoiceItems(PepsiArr, checkedColours, coloursDialogListener);
AlertDialog dialog = builder.create();
dialog.show();
}
protected void onChangeSelectedColours() {
StringBuilder stringBuilder = new StringBuilder();
for(CharSequence colour : selectedColours)
stringBuilder.append(colour + ",");
cokeradio.setText(stringBuilder.toString());
}
protected void onChangeSelectedColours1() {
StringBuilder stringBuilder = new StringBuilder();
for(CharSequence colour : selectedColours1)
stringBuilder.append(colour + ",");
pepsiradio.setText(stringBuilder.toString());
}
protected void showSelectColoursDialog2() {
boolean[] checkedColours = new boolean[PastasArr.length];
int count = PastasArr.length;
for(int i = 0; i < count; i++)
checkedColours[i] = selectedColours2.contains(PastasArr[i]);
DialogInterface.OnMultiChoiceClickListener coloursDialogListener = new DialogInterface.OnMultiChoiceClickListener() {
@Override
public void onClick(DialogInterface dialog, int which, boolean isChecked) {
if(isChecked)
selectedColours2.add(PastasArr[which]);
else
selectedColours2.remove(PastasArr[which]);
onChangeSelectedColours2();
}
};
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle("Choice");
builder.setMultiChoiceItems(PastasArr, checkedColours, coloursDialogListener);
AlertDialog dialog = builder.create();
dialog.show();
}
protected void onChangeSelectedColours2() {
StringBuilder stringBuilder = new StringBuilder();
for(CharSequence colour : selectedColours2)
stringBuilder.append(colour + ",");
pastaradio.setText(stringBuilder.toString());
}
protected void onChangeSelectedColours3() {
StringBuilder stringBuilder = new StringBuilder();
for(CharSequence colour : selectedColours3)
stringBuilder.append(colour + ",");
pizzaradio.setText(stringBuilder.toString());
}
protected void showSelectColoursDialog3() {
final ArrayList<String>pizzatemp=gObject.getPizzaLs();
final String[] pizzaArr = pizzatemp.toArray(new String[pizzatemp.size()]);
boolean[] checkedColours = new boolean[pizzaArr.length];
int count = pizzaArr.length;
for(int i = 0; i < count; i++)
checkedColours[i] = selectedColours3.contains(pizzaArr[i]);
DialogInterface.OnMultiChoiceClickListener coloursDialogListener = new DialogInterface.OnMultiChoiceClickListener() {
@Override
public void onClick(DialogInterface dialog, int which, boolean isChecked) {
if(isChecked)
selectedColours3.add(pizzaArr[which]);
else
selectedColours3.remove(pizzaArr[which]);
onChangeSelectedColours3();
}
};
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle("Choice");
builder.setMultiChoiceItems(pizzaArr, checkedColours, coloursDialogListener);
AlertDialog dialog = builder.create();
dialog.show();
}
protected void showSelectColoursDialog4() {
boolean[] checkedColours = new boolean[SaladArr.length];
int count = SaladArr.length;
for(int i = 0; i < count; i++)
checkedColours[i] = selectedColours4.contains(SaladArr[i]);
DialogInterface.OnMultiChoiceClickListener coloursDialogListener = new DialogInterface.OnMultiChoiceClickListener() {
@Override
public void onClick(DialogInterface dialog, int which, boolean isChecked) {
if(isChecked)
selectedColours4.add(SaladArr[which]);
else
selectedColours4.remove(SaladArr[which]);
onChangeSelectedColours4();
}
};
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle("Choice");
builder.setMultiChoiceItems(SaladArr, checkedColours, coloursDialogListener);
AlertDialog dialog = builder.create();
dialog.show();
}
protected void onChangeSelectedColours4() {
StringBuilder stringBuilder = new StringBuilder();
for(CharSequence colour : selectedColours4)
stringBuilder.append(colour + ",");
saladradio.setText(stringBuilder.toString());
}
}
Here list of key benifits to download a Ecommerce App from kashipara.com.
Download Ecommerce App source code at free of cost. Download link provide below.
Download CodeWhat our programmer says about project
restaurant management system source code in android project download restaurant management application in this project many features. search restaurant by place. customer info save.order listing in apps. today menu listing. this project final year major projects. many feature in this project. like google map api using for display restaurant. user c ... [ Download Source Code ]
In this Big Attendance Management System Project. we have to take attendance of student in various branches and various classes. also there are two logins one for admin which are total control and another is faculty which takes students attendance. ... [ Download Source Code ]
Manage Patients and assign the doctors also have very high functionalities to view like articles etc ... [ Download Source Code ]
It is a quiz with four options with timer and sound. 10 question will appear one by one and save your high score. online quiz application that organization exams. This application taken MCQ type exam. ... [ Download Source Code ]
In this project manage student attendance. Manage students information. Add new students. Generate reports like class vise. also student vise weekly, monthly report generates. ... [ Download Source Code ]
In this page Voting System project is a mobile application which is developed in Android platform. This Android project with tutorial and guide for developing a code. Android Based Voting System is a open source you can Download zip and edit as per you need. If you want more latest Android projects here. This is simple and basic level small project ... [ Download Source Code ]