List of usage examples for android.app DatePickerDialog DatePickerDialog
public DatePickerDialog(@NonNull Context context, @Nullable OnDateSetListener listener, int year, int month, int dayOfMonth)
From source file:com.rsmsa.accapp.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main_drawer); // enable ActionBar app icon to behave as action to toggle nav drawer getActionBar().setDisplayHomeAsUpEnabled(true); getActionBar().setHomeButtonEnabled(true); mDrawer = (DrawerLayout) findViewById(R.id.drawer_layout); gridView = (ListView) findViewById(R.id.headergridview); /**//from w ww . j ava 2 s . c o m * Temporary header */ if (!hasheader) { tempHeader = (View) getLayoutInflater().inflate(R.layout.temp, null); gridView.addHeaderView(tempHeader); gridView.setAdapter(new gridViewAdapter(MainActivity.this)); hasheader = true; tempFlag = true; } imgPreview = (ImageView) tempHeader.findViewById(R.id.imgPreview); videoPreview = (VideoView) tempHeader.findViewById(R.id.videoPreview); btnCapturePicture = (ImageButton) tempHeader.findViewById(R.id.btnCapturePicture); btnRecordVideo = (ImageButton) tempHeader.findViewById(R.id.btnCaptureVideo); /** * Capture image button click event */ btnCapturePicture.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // capture picture captureImage(); } }); /** * Record video button click event */ btnRecordVideo.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // record video recordVideo(); } }); // Checking camera availability if (!isDeviceSupportCamera()) { Toast.makeText(getApplicationContext(), "Sorry! Your device doesn't support camera", Toast.LENGTH_LONG) .show(); // will close the app if the device does't have camera finish(); } //get GPS location SetLocation = (Button) tempHeader.findViewById(R.id.btnLoc); SetLocation.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { // create class object gps = new GPSTracker(MainActivity.this); // check if GPS enabled if (gps.canGetLocation()) { double latitude = gps.getLatitude(); double longitude = gps.getLongitude(); //location text view TextView location = (TextView) tempHeader.findViewById(R.id.loc); location.setText("Lat: " + latitude + "Long: " + longitude); } else { // can't get location // GPS or Network is not enabled // Ask user to enable GPS/network in settings gps.showSettingsAlert(); } } }); /** * header instance */ header = (View) getLayoutInflater().inflate(R.layout.activity_accident, null); /** * Defining all layout items **/ inputReg = (EditText) header.findViewById(R.id.reg_ref); inputFatal = (EditText) header.findViewById(R.id.fatal_edit); inputInjuries = (EditText) header.findViewById(R.id.injury_edit); inputSimple = (EditText) header.findViewById(R.id.simple_edit); damage = (EditText) header.findViewById(R.id.not_injured_edit); area_name = (EditText) header.findViewById(R.id.name); district = (EditText) header.findViewById(R.id.district); region = (EditText) header.findViewById(R.id.city); road_name = (EditText) header.findViewById(R.id.road_name); road_no = (EditText) header.findViewById(R.id.road_number); road_mark = (EditText) header.findViewById(R.id.road_mark); intersection_name = (EditText) header.findViewById(R.id.intersection_name); intersection_no = (EditText) header.findViewById(R.id.intersection_number); intersection_mark = (EditText) header.findViewById(R.id.intersection_mark); mDate = (EditText) header.findViewById(R.id.date); mTime = (EditText) header.findViewById(R.id.time); //Textchanges inputReg.addTextChangedListener(new EditTextWatcher(inputReg)); inputFatal.addTextChangedListener(new EditTextWatcher(inputFatal)); inputInjuries.addTextChangedListener(new EditTextWatcher(inputInjuries)); inputSimple.addTextChangedListener(new EditTextWatcher(inputSimple)); damage.addTextChangedListener(new EditTextWatcher(damage)); area_name.addTextChangedListener(new EditTextWatcher(area_name)); district.addTextChangedListener(new EditTextWatcher(district)); region.addTextChangedListener(new EditTextWatcher(region)); mDate.addTextChangedListener(new EditTextWatcher(mDate)); mTime.addTextChangedListener(new EditTextWatcher(mTime)); road_name.addTextChangedListener(new EditTextWatcher(road_name)); road_no.addTextChangedListener(new EditTextWatcher(road_no)); road_mark.addTextChangedListener(new EditTextWatcher(road_mark)); intersection_name.addTextChangedListener(new EditTextWatcher(intersection_name)); intersection_no.addTextChangedListener(new EditTextWatcher(intersection_no)); intersection_mark.addTextChangedListener(new EditTextWatcher(intersection_mark)); cal = Calendar.getInstance(); day = cal.get(Calendar.DAY_OF_MONTH); month = cal.get(Calendar.MONTH); year = cal.get(Calendar.YEAR); hour = cal.get(Calendar.HOUR_OF_DAY); min = cal.get(Calendar.MINUTE); datePicker = (Button) header.findViewById(R.id.date_picker); datePicker.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { DatePickerDialog datePickerDialog = new DatePickerDialog(MainActivity.this, datePickerListener, year, month, day); datePickerDialog.show(); } }); timePicker = (Button) header.findViewById(R.id.time_picker); timePicker.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { TimePickerDialog timePickerDialog = new TimePickerDialog(MainActivity.this, timePickerListener, hour, min, true); timePickerDialog.show(); } }); // set a custom shadow that overlays the main content when the drawer // opens mDrawer.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); _initMenu(); mDrawerToggle = new CustomActionBarDrawerToggle(this, mDrawer); nextButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent passenger = new Intent(MainActivity.this, Passenger.class); startActivity(passenger); } }); mDrawer.setDrawerListener(mDrawerToggle); /** * instantiate ViewPager */ mPager = (AutoScrollViewPager) header.findViewById(R.id.pager); mPagerAdapter = new ScreenSlidePagerAdapter(getSupportFragmentManager()); mPager.setPageTransformer(true, new DepthPageTransformer()); mPager.setAdapter(mPagerAdapter); PageListener pageListener = new PageListener(); mPager.setOnPageChangeListener(pageListener); }
From source file:tinygsn.gui.android.ActivityViewDataNew.java
private void addTableViewModeCustomize() { table_view_mode = (TableLayout) findViewById(R.id.table_view_mode); table_view_mode.removeAllViews();/*from www . j a v a2s. com*/ // Row From TableRow row = new TableRow(this); TextView txt = new TextView(this); txt.setText("From: "); txt.setTextColor(Color.parseColor("#000000")); row.addView(txt); // Date time = new Date(); startTime = new Date(); startTime.setMinutes(startTime.getMinutes() - 1); endTime = new Date(); // Start Time SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss"); txtStartTime = new TextView(this); txtStartTime.setText(formatter.format(startTime) + ""); txtStartTime.setTextColor(Color.parseColor("#000000")); txtStartTime.setBackgroundColor(Color.parseColor("#8dc63f")); row.addView(txtStartTime); txtStartTime.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { new TimePickerDialog(context, startTimeSetListener, dateAndTime.get(Calendar.HOUR_OF_DAY) - 1, dateAndTime.get(Calendar.MINUTE), true).show(); } }); // Add space txt = new TextView(this); txt.setText(" "); row.addView(txt); // Start Date formatter = new SimpleDateFormat("dd/MM/yyyy"); // txtStartDate, txtStartTime txtStartDate = new TextView(this); txtStartDate.setText(formatter.format(startTime) + ""); txtStartDate.setTextColor(Color.parseColor("#000000")); txtStartDate.setBackgroundColor(Color.parseColor("#8dc63f")); row.addView(txtStartDate); txtStartDate.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { new DatePickerDialog(context, startDateSetListener, dateAndTime.get(Calendar.YEAR), dateAndTime.get(Calendar.MONTH), dateAndTime.get(Calendar.DAY_OF_MONTH)).show(); } }); table_view_mode.addView(row); // Add a space row row = new TableRow(this); txt = new TextView(this); txt.setText("-"); row.addView(txt); table_view_mode.addView(row); // Row To row = new TableRow(this); txt = new TextView(this); txt.setText("To"); txt.setTextColor(Color.parseColor("#000000")); row.addView(txt); // End Time formatter = new SimpleDateFormat("HH:mm:ss"); txtEndTime = new TextView(this); txtEndTime.setText(formatter.format(endTime) + ""); txtEndTime.setTextColor(Color.parseColor("#000000")); txtEndTime.setBackgroundColor(Color.parseColor("#8dc63f")); row.addView(txtEndTime); txtEndTime.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { new TimePickerDialog(context, endTimeSetListener, dateAndTime.get(Calendar.HOUR_OF_DAY), dateAndTime.get(Calendar.MINUTE), true).show(); } }); // Add space txt = new TextView(this); txt.setText(" "); row.addView(txt); // End Date formatter = new SimpleDateFormat("dd/MM/yyyy"); // txtStartDate, txtStartTime txtEndDate = new TextView(this); txtEndDate.setText(formatter.format(endTime) + ""); txtEndDate.setTextColor(Color.parseColor("#000000")); txtEndDate.setBackgroundColor(Color.parseColor("#8dc63f")); row.addView(txtEndDate); txtEndDate.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { new DatePickerDialog(context, endDateSetListener, dateAndTime.get(Calendar.YEAR), dateAndTime.get(Calendar.MONTH), dateAndTime.get(Calendar.DAY_OF_MONTH)).show(); } }); table_view_mode.addView(row); // Row row = new TableRow(this); Button detailBtn = new Button(this); detailBtn.setTextSize(TEXT_SIZE + 2); detailBtn.setText("Detail"); detailBtn.setTextColor(Color.parseColor("#000000")); detailBtn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { } }); Button plotDataBtn = new Button(this); plotDataBtn.setTextSize(TEXT_SIZE + 2); plotDataBtn.setText("Plot data"); plotDataBtn.setTextColor(Color.parseColor("#000000")); plotDataBtn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { viewChart(); } }); TableRow.LayoutParams params = new TableRow.LayoutParams(); // params.addRule(TableRow.LayoutParams.FILL_PARENT); params.span = 2; row.addView(detailBtn, params); row.addView(plotDataBtn, params); row.setLayoutParams(new TableLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); table_view_mode.addView(row); }
From source file:com.adithya321.sharesanalysis.fragments.PurchaseShareFragment.java
@Override public void onClick(final View view) { switch (view.getId()) { case R.id.select_date: Dialog dialog = new DatePickerDialog(getActivity(), onDateSetListener, year_start, month_start - 1, day_start);//from www . j a v a 2 s. c o m dialog.setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { ((TextView) view).setText(new StringBuilder().append(day_start).append("/").append(month_start) .append("/").append(year_start)); } }); dialog.show(); break; } }
From source file:com.prevas.redmine.NewIssueActivity.java
protected Dialog onCreateDialog(int id) { switch (id) { case STARTDATE_DIALOG_ID: return new DatePickerDialog(this, mStartDateSetListener, mStartYear, mStartMonth, mStartDay); case DUEDATE_DIALOG_ID: return new DatePickerDialog(this, mDueDateSetListener, mDueYear, mDueMonth, mDueDay); }//from w ww .j a v a 2s . c om return null; }
From source file:com.ranglerz.tlc.tlc.com.ranglerz.tlc.tlc.Summons.NewSummon.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_new_summon); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); if (toolbar != null) { setSupportActionBar(toolbar);/*from www.j a v a2 s. c o m*/ getSupportActionBar().setDisplayHomeAsUpEnabled(true); } createNetErrorDialog(); checkWriteExternalPermission(); checkReadExternalStoragePermission(); setupIds(); // // permission for Marshmallow // checkWriteExternalPermission(); // checkReadExternalStoragePermission(); // // getRespondentSignature.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // showSignatureDialog(); // } // }); // setup Spinner id spinnerSummonType = (Spinner) findViewById(R.id.spinnerNewSummon); SpinnerBaseSummon = (Spinner) findViewById(R.id.basesummoncar); SpinnerBaseSummon.setVisibility(View.GONE); summonno.setVisibility(View.GONE); summondate.setVisibility(View.GONE); TlcLicenseHack.setVisibility(View.GONE); PlateNumber.setVisibility(View.GONE); ShlPermitHolder.setVisibility(View.GONE); BaseNumber.setVisibility(View.GONE); DiamondNo.setVisibility(View.GONE); MedallionNo.setVisibility(View.GONE); MedallionOwner.setVisibility(View.GONE); FleetMedallion.setVisibility(View.GONE); ShlPermit.setVisibility(View.GONE); HearingLocation.setVisibility(View.GONE); takePictureNewSummonImageView.setVisibility(View.GONE); takePictureComplianceImageView.setVisibility(View.GONE); addcomment.setVisibility(View.GONE); ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.spinner_item, stringSummonType); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinnerSummonType.setAdapter(adapter); ArrayAdapter<String> adapterbasesummon = new ArrayAdapter<String>(this, R.layout.spinner_item, baseSummons); adapterbasesummon.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); SpinnerBaseSummon.setAdapter(adapterbasesummon); spinnerSummonType.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) { switch (arg2) { case 0: SpinnerBaseSummon.setVisibility(View.GONE); summonno.setVisibility(View.GONE); summondate.setVisibility(View.GONE); TlcLicenseHack.setVisibility(View.GONE); PlateNumber.setVisibility(View.GONE); ShlPermitHolder.setVisibility(View.GONE); BaseNumber.setVisibility(View.GONE); DiamondNo.setVisibility(View.GONE); MedallionNo.setVisibility(View.GONE); MedallionOwner.setVisibility(View.GONE); FleetMedallion.setVisibility(View.GONE); ShlPermit.setVisibility(View.GONE); HearingLocation.setVisibility(View.GONE); addcomment.setVisibility(View.GONE); break; case 1: SpinnerBaseSummon.setVisibility(View.GONE); summonno.setVisibility(View.VISIBLE); summondate.setVisibility(View.VISIBLE); TlcLicenseHack.setVisibility(View.VISIBLE); PlateNumber.setVisibility(View.VISIBLE); ShlPermitHolder.setVisibility(View.GONE); BaseNumber.setVisibility(View.GONE); DiamondNo.setVisibility(View.GONE); MedallionNo.setVisibility(View.GONE); MedallionOwner.setVisibility(View.GONE); FleetMedallion.setVisibility(View.GONE); ShlPermit.setVisibility(View.GONE); HearingLocation.setVisibility(View.VISIBLE); addcomment.setVisibility(View.VISIBLE); break; case 2: SpinnerBaseSummon.setVisibility(View.VISIBLE); summonno.setVisibility(View.VISIBLE); summondate.setVisibility(View.VISIBLE); TlcLicenseHack.setVisibility(View.VISIBLE); PlateNumber.setVisibility(View.VISIBLE); ShlPermitHolder.setVisibility(View.VISIBLE); BaseNumber.setVisibility(View.VISIBLE); DiamondNo.setVisibility(View.VISIBLE); MedallionNo.setVisibility(View.GONE); MedallionOwner.setVisibility(View.GONE); FleetMedallion.setVisibility(View.GONE); ShlPermit.setVisibility(View.GONE); HearingLocation.setVisibility(View.VISIBLE); addcomment.setVisibility(View.VISIBLE); break; case 3: SpinnerBaseSummon.setVisibility(View.GONE); summonno.setVisibility(View.VISIBLE); summondate.setVisibility(View.VISIBLE); TlcLicenseHack.setVisibility(View.VISIBLE); PlateNumber.setVisibility(View.VISIBLE); ShlPermitHolder.setVisibility(View.VISIBLE); BaseNumber.setVisibility(View.GONE); DiamondNo.setVisibility(View.VISIBLE); MedallionNo.setVisibility(View.GONE); MedallionOwner.setVisibility(View.GONE); FleetMedallion.setVisibility(View.GONE); ShlPermit.setVisibility(View.VISIBLE); HearingLocation.setVisibility(View.VISIBLE); addcomment.setVisibility(View.VISIBLE); break; case 4: SpinnerBaseSummon.setVisibility(View.GONE); summonno.setVisibility(View.VISIBLE); summondate.setVisibility(View.VISIBLE); TlcLicenseHack.setVisibility(View.VISIBLE); PlateNumber.setVisibility(View.VISIBLE); ShlPermitHolder.setVisibility(View.GONE); BaseNumber.setVisibility(View.GONE); DiamondNo.setVisibility(View.GONE); MedallionNo.setVisibility(View.GONE); MedallionOwner.setVisibility(View.GONE); FleetMedallion.setVisibility(View.GONE); ShlPermit.setVisibility(View.GONE); HearingLocation.setVisibility(View.VISIBLE); addcomment.setVisibility(View.VISIBLE); break; case 5: SpinnerBaseSummon.setVisibility(View.GONE); summonno.setVisibility(View.VISIBLE); summondate.setVisibility(View.VISIBLE); TlcLicenseHack.setVisibility(View.VISIBLE); PlateNumber.setVisibility(View.GONE); ShlPermitHolder.setVisibility(View.GONE); BaseNumber.setVisibility(View.GONE); DiamondNo.setVisibility(View.GONE); MedallionNo.setVisibility(View.VISIBLE); MedallionOwner.setVisibility(View.VISIBLE); FleetMedallion.setVisibility(View.VISIBLE); ShlPermit.setVisibility(View.GONE); HearingLocation.setVisibility(View.VISIBLE); addcomment.setVisibility(View.VISIBLE); break; case 6: SpinnerBaseSummon.setVisibility(View.GONE); summonno.setVisibility(View.VISIBLE); summondate.setVisibility(View.VISIBLE); TlcLicenseHack.setVisibility(View.VISIBLE); PlateNumber.setVisibility(View.VISIBLE); ShlPermitHolder.setVisibility(View.GONE); BaseNumber.setVisibility(View.GONE); DiamondNo.setVisibility(View.GONE); MedallionNo.setVisibility(View.VISIBLE); MedallionOwner.setVisibility(View.GONE); FleetMedallion.setVisibility(View.GONE); ShlPermit.setVisibility(View.VISIBLE); HearingLocation.setVisibility(View.VISIBLE); addcomment.setVisibility(View.VISIBLE); break; default: break; } } public void onNothingSelected(AdapterView<?> arg0) { // TODO Auto-generated method stub } }); final DatePickerDialog.OnDateSetListener date = new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { // TODO Auto-generated method stub myCalendar.set(Calendar.YEAR, year); myCalendar.set(Calendar.MONTH, monthOfYear); myCalendar.set(Calendar.DAY_OF_MONTH, dayOfMonth); updateLabel(); } }; summondate.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { new DatePickerDialog(NewSummon.this, date, myCalendar.get(Calendar.YEAR), myCalendar.get(Calendar.MONTH), myCalendar.get(Calendar.DAY_OF_MONTH)).show(); } }); AppearanceRequired.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.apperanceradiogroupyes) { } else { } } }); seizedCarSelectionNewSummon.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.carSeizedYesNewSummon) { } else { } } }); submit.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { strspinnerSummonType = spinnerSummonType.getSelectedItem().toString(); strSpinnerBaseSummon = SpinnerBaseSummon.getSelectedItem().toString(); strsummonno = summonno.getText().toString(); strsummondate = summondate.getText().toString(); strTlcLicenseHack = TlcLicenseHack.getText().toString(); strPlateNumber = PlateNumber.getText().toString(); strShlPermitHolder = ShlPermitHolder.getText().toString(); strBaseNumber = BaseNumber.getText().toString(); strDiamondNo = DiamondNo.getText().toString(); strMedallionNo = MedallionNo.getText().toString(); strMedallionOwner = MedallionOwner.getText().toString(); strFleetMedallion = FleetMedallion.getText().toString(); strShlPermit = ShlPermit.getText().toString(); strHearingLocation = HearingLocation.getText().toString(); straddcoment = addcomment.getText().toString(); intseizedCar = seizedCarSelectionNewSummon.getCheckedRadioButtonId(); intAppearance = AppearanceRequired.getCheckedRadioButtonId(); seizedRadioButton = (RadioButton) findViewById(intseizedCar); AppearanceButton = (RadioButton) findViewById(intAppearance); if (strspinnerSummonType.equals("Select Your Summon")) { Toast.makeText(NewSummon.this, "Please Select Your Summons", Toast.LENGTH_SHORT).show(); } else if (strspinnerSummonType.equals("Driver Summon")) { if (strsummonno.equals("")) { summonno.setError("Please Enter Summon Number"); } else if (strsummondate.equals("")) { summondate.setError("Please Enter Summon Date"); } else if (strTlcLicenseHack.equals("")) { TlcLicenseHack.setError("Please Enter TLC License Number "); } else if (strPlateNumber.equals("")) { PlateNumber.setError("Please Enter Plate Number"); } else if (strHearingLocation.equals("")) { HearingLocation.setError("Please Enter Hearing Location"); } else if (AppearanceRequired.getCheckedRadioButtonId() == -1) { Toast.makeText(NewSummon.this, "Please Select (Appearance Required) Radio Button", Toast.LENGTH_SHORT).show(); } else if (seizedCarSelectionNewSummon.getCheckedRadioButtonId() == -1) { Toast.makeText(NewSummon.this, "Please Select (Car Seized) Radio Button", Toast.LENGTH_SHORT).show(); } else if (takePictureNewSummonImageView.getDrawable() == null) { Toast.makeText(getApplicationContext(), "Please Upload Summon Image", Toast.LENGTH_SHORT) .show(); } else if (takePictureComplianceImageView.getDrawable() == null) { Toast.makeText(getApplicationContext(), "Please Upload Compliance Image", Toast.LENGTH_SHORT).show(); } else { getTextSeized = seizedRadioButton.getText().toString(); getTextAppearance = seizedRadioButton.getText().toString(); sharedPreferences = getSharedPreferences("email", 1); sharedPreferences = getSharedPreferences("getuserid", 2); String email = sharedPreferences.getString(emailkey, null); String Userid = sharedPreferences.getString(userID, null); Log.d("", "email " + email); Log.d("", "userid " + Userid); message = "User Email: " + email + "\n \nSelected Summon: " + strspinnerSummonType + "\nSummon Number: " + strsummonno + "\nDate of Summon: " + strsummondate + "\nTLC License No: " + strTlcLicenseHack + "\nPlate Number / Medallion: " + strPlateNumber + "\nCar Seized: " + getTextSeized; //new SendEmail().execute(); new driversummon().execute(); // UploadImage ui1 = new UploadImage(); // ui1.execute(bitmap1); Log.d("abc", "onClick: 1"); } } else if (strspinnerSummonType.equals("Base Summon")) { if (strSpinnerBaseSummon.equals("Select Your Base Car")) { Toast.makeText(NewSummon.this, "Please Select Your Base Car", Toast.LENGTH_SHORT).show(); } else if (strsummonno.equals("")) { summonno.setError("Please Enter Summon Number"); } else if (strsummondate.equals("")) { summondate.setError("Please Enter Summon Date"); } else if (strTlcLicenseHack.equals("")) { TlcLicenseHack.setError("Please Enter TLC License Number "); } else if (strPlateNumber.equals("")) { PlateNumber.setError("Please Enter Plate Number"); } else if (strShlPermitHolder.equals("")) { ShlPermitHolder.setError("Please Enter SHL Permit Holder"); } else if (strBaseNumber.equals("")) { BaseNumber.setError("Please Enter Base Number"); } else if (strDiamondNo.equals("")) { DiamondNo.setError("Please Enter Diamond Number"); } else if (strHearingLocation.equals("")) { HearingLocation.setError("Please Enter Hearing Location"); } else if (AppearanceRequired.getCheckedRadioButtonId() == -1) { Toast.makeText(NewSummon.this, "Please Select (Appearance Required) Radio Button", Toast.LENGTH_SHORT).show(); } else if (seizedCarSelectionNewSummon.getCheckedRadioButtonId() == -1) { Toast.makeText(NewSummon.this, "Please Select (Car Seized) Radio Button", Toast.LENGTH_SHORT).show(); } else if (takePictureNewSummonImageView.getDrawable() == null) { Toast.makeText(getApplicationContext(), "Please Upload Summon Image", Toast.LENGTH_SHORT) .show(); } else if (takePictureComplianceImageView.getDrawable() == null) { Toast.makeText(getApplicationContext(), "Please Upload Compliance Image", Toast.LENGTH_SHORT).show(); } else { getTextSeized = seizedRadioButton.getText().toString(); getTextAppearance = seizedRadioButton.getText().toString(); sharedPreferences = getSharedPreferences("email", 1); String email = sharedPreferences.getString(emailkey, null); message = "User Email: " + email + "\n\nSelected Summon: " + strspinnerSummonType + "\nSelected Base Summon: " + strSpinnerBaseSummon + "\nSummon Number: " + strsummonno + "\nDate of Summon: " + strsummondate + "\nTLC License No: " + strTlcLicenseHack + "\nPlate Number / Medallion: " + strPlateNumber + "\nSHL Permit Holder: " + strShlPermitHolder + "\nBase Number: " + strBaseNumber + "\nDiamond Number: " + strDiamondNo + "\nHearing Location: " + strHearingLocation + "\nCar Seized: " + getTextSeized; //new SendEmail().execute(); new basesummon().execute(); Log.d("abc", "onClick: 2"); } } else if (strspinnerSummonType.equals("SHL Summon")) { if (strsummonno.equals("")) { summonno.setError("Please Enter Summon Number"); } else if (strsummondate.equals("")) { summondate.setError("Please Enter Summon Date"); } else if (strTlcLicenseHack.equals("")) { TlcLicenseHack.setError("Please Enter TLC License Number "); } else if (strPlateNumber.equals("")) { PlateNumber.setError("Please Enter Plate Number"); } else if (strShlPermitHolder.equals("")) { ShlPermitHolder.setError("Please Enter SHL Permit Holder"); } else if (strDiamondNo.equals("")) { DiamondNo.setError("Please Enter Diamond Number"); } else if (strShlPermit.equals("")) { ShlPermit.setError("Please Enter SHL Permit"); } else if (strHearingLocation.equals("")) { HearingLocation.setError("Please Enter Hearing Location"); } else if (AppearanceRequired.getCheckedRadioButtonId() == -1) { Toast.makeText(NewSummon.this, "Please Select (Appearance Required) Radio Button", Toast.LENGTH_SHORT).show(); } else if (seizedCarSelectionNewSummon.getCheckedRadioButtonId() == -1) { Toast.makeText(NewSummon.this, "Please Select (Car Seized) Radio Button", Toast.LENGTH_SHORT).show(); } else if (takePictureNewSummonImageView.getDrawable() == null) { Toast.makeText(getApplicationContext(), "Please Upload Summon Image", Toast.LENGTH_SHORT) .show(); } else if (takePictureComplianceImageView.getDrawable() == null) { Toast.makeText(getApplicationContext(), "Please Upload Compliance Image", Toast.LENGTH_SHORT).show(); } else { getTextSeized = seizedRadioButton.getText().toString(); getTextAppearance = seizedRadioButton.getText().toString(); sharedPreferences = getSharedPreferences("email", 1); String email = sharedPreferences.getString(emailkey, null); message = "User Email: " + email + "\n\nSelected Summon: " + strspinnerSummonType + "\nSelected Base Summon: " + strsummonno + "\nDate of Summon: " + strsummondate + "\nTLC License No: " + strTlcLicenseHack + "\nPlate Number / Medallion: " + strPlateNumber + "\nSHL Permit Holder: " + strShlPermitHolder + "\nDiamond Number: " + strDiamondNo + "\nSHL Permit: " + strShlPermit + "\nHearing Location: " + strHearingLocation + "\nCar Seized: " + getTextSeized; //new SendEmail().execute(); new shlsummon().execute(); } } else if (strspinnerSummonType.equals("FHV Summon")) { if (strsummonno.equals("")) { summonno.setError("Please Enter Summon Number"); } else if (strsummondate.equals("")) { summondate.setError("Please Enter Summon Date"); } else if (strTlcLicenseHack.equals("")) { TlcLicenseHack.setError("Please Enter TLC License Number "); } else if (strPlateNumber.equals("")) { PlateNumber.setError("Please Enter Plate Number"); } else if (strHearingLocation.equals("")) { HearingLocation.setError("Please Enter Hearing Location"); } else if (AppearanceRequired.getCheckedRadioButtonId() == -1) { Toast.makeText(NewSummon.this, "Please Select (Appearance Required) Radio Button", Toast.LENGTH_SHORT).show(); } else if (seizedCarSelectionNewSummon.getCheckedRadioButtonId() == -1) { Toast.makeText(NewSummon.this, "Please Select (Car Seized) Radio Button", Toast.LENGTH_SHORT).show(); } else if (takePictureNewSummonImageView.getDrawable() == null) { Toast.makeText(getApplicationContext(), "Please Upload Summon Image", Toast.LENGTH_SHORT) .show(); } else if (takePictureComplianceImageView.getDrawable() == null) { Toast.makeText(getApplicationContext(), "Please Upload Compliance Image", Toast.LENGTH_SHORT).show(); } else { getTextSeized = seizedRadioButton.getText().toString(); getTextAppearance = seizedRadioButton.getText().toString(); sharedPreferences = getSharedPreferences("email", 1); String email = sharedPreferences.getString(emailkey, null); message = "User Email: " + email + "\n\nSelected Summon: " + strspinnerSummonType + "\nSummon Number: " + strsummonno + "\nDate of Summon: " + strsummondate + "\nTLC License No: " + strTlcLicenseHack + "\nPlate Number / Medallion: " + strPlateNumber + "\nHearing Location: " + strHearingLocation + "\nCar Seized: " + getTextSeized; //new SendEmail().execute(); new fhvsummon().execute(); } } else if (strspinnerSummonType.equals("Medallion/Yellow Cab")) { if (strsummonno.equals("")) { summonno.setError("Please Enter Summon Number"); } else if (strsummondate.equals("")) { summondate.setError("Please Enter Summon Date"); } else if (strTlcLicenseHack.equals("")) { TlcLicenseHack.setError("Please Enter TLC License Number "); } else if (strMedallionNo.equals("")) { MedallionNo.setError("Please Enter Medallion Number"); } else if (strMedallionOwner.equals("")) { MedallionOwner.setError("Please Enter Medallion Owner Name"); } else if (strFleetMedallion.equals("")) { FleetMedallion.setError("Please Enter Fleet / Medallion Name"); } else if (strHearingLocation.equals("")) { HearingLocation.setError("Please Enter Hearing Location"); } else if (AppearanceRequired.getCheckedRadioButtonId() == -1) { Toast.makeText(NewSummon.this, "Please Select (Appearance Required) Radio Button", Toast.LENGTH_SHORT).show(); } else if (seizedCarSelectionNewSummon.getCheckedRadioButtonId() == -1) { Toast.makeText(NewSummon.this, "Please Select (Car Seized) Radio Button", Toast.LENGTH_SHORT).show(); } else if (takePictureNewSummonImageView.getDrawable() == null) { Toast.makeText(getApplicationContext(), "Please Upload Summon Image", Toast.LENGTH_SHORT) .show(); } else if (takePictureComplianceImageView.getDrawable() == null) { Toast.makeText(getApplicationContext(), "Please Upload Compliance Image", Toast.LENGTH_SHORT).show(); } else { getTextSeized = seizedRadioButton.getText().toString(); getTextAppearance = seizedRadioButton.getText().toString(); sharedPreferences = getSharedPreferences("email", 1); String email = sharedPreferences.getString(emailkey, null); message = "User Email: " + email + "\n\nSelected Summon: " + strspinnerSummonType + "\nSummon Number: " + strsummonno + "\nDate of Summon: " + strsummondate + "\nTLC License No: " + strTlcLicenseHack + "\nMedallion Number: " + strMedallionNo + "\nMedallion Owner: " + strMedallionOwner + "\nFleet Medallion : " + strFleetMedallion + "\nHearing Location: " + strHearingLocation + "\nCar Seized: " + getTextSeized; //new SendEmail().execute(); new medallionyellowcab().execute(); Log.d("abc", "onClick: 5"); } } else if (strspinnerSummonType.equals("Corporation")) { if (strsummonno.equals("")) { summonno.setError("Please Enter Summon Number"); } else if (strsummondate.equals("")) { summondate.setError("Please Enter Summon Date"); } else if (strTlcLicenseHack.equals("")) { TlcLicenseHack.setError("Please Enter TLC License Number "); } else if (strPlateNumber.equals("")) { PlateNumber.setError("Please Enter Plate Number"); } else if (strMedallionNo.equals("")) { MedallionNo.setError("Please Enter Medallion Number"); } else if (strShlPermit.equals("")) { ShlPermit.setError("Please Enter SHL Permit"); } else if (strHearingLocation.equals("")) { HearingLocation.setError("Please Enter Hearing Location"); } else if (AppearanceRequired.getCheckedRadioButtonId() == -1) { Toast.makeText(NewSummon.this, "Please Select (Appearance Required) Radio Button", Toast.LENGTH_SHORT).show(); } else if (seizedCarSelectionNewSummon.getCheckedRadioButtonId() == -1) { Toast.makeText(NewSummon.this, "Please Select (Car Seized) Radio Button", Toast.LENGTH_SHORT).show(); } else if (takePictureNewSummonImageView.getDrawable() == null) { Toast.makeText(getApplicationContext(), "Please Upload Summon Image", Toast.LENGTH_SHORT) .show(); } else if (takePictureComplianceImageView.getDrawable() == null) { Toast.makeText(getApplicationContext(), "Please Upload Compliance Image", Toast.LENGTH_SHORT).show(); } else { getTextSeized = seizedRadioButton.getText().toString(); getTextAppearance = seizedRadioButton.getText().toString(); sharedPreferences = getSharedPreferences("email", 1); String email = sharedPreferences.getString(emailkey, null); message = "User Email: " + email + "\n\nSelected Summon: " + strspinnerSummonType + "\nSummon Number: " + strsummonno + "\nDate of Summon: " + strsummondate + "\nTLC License No: " + strTlcLicenseHack + "\nPlate Number / Medallion: " + strPlateNumber + "\nMedallion Number: " + strMedallionNo + "\nSHL Permit: " + strShlPermit + "\nHearing Location: " + strHearingLocation + "\nCar Seized: " + getTextSeized; //new SendEmail().execute(); new corporation().execute(); Log.d("abc", "onClick: 6"); } } /*else { getTextSeized = seizedRadioButton.getText().toString(); sharedPreferences = getSharedPreferences("email" , 1); String email = sharedPreferences.getString(emailkey , null); if(!email.equals(null)) { message = "User Email: " +email + "\n\nSelected Summon: " + strspinnerSummonType+ "\nSelected Base Summon: " + strSpinnerBaseSummon + "\nSummon Number: " + strsummonno + "\nDate of Summon: " + strsummondate + "\nTLC License No: " + strTlcLicenseHack + "\nPlate Number / Medallion: " + strPlateNumber + "\nSHL Permit Holder: " + strShlPermitHolder + "Base Number: " + strBaseNumber+ "\nDiamond Number: " + strDiamondNo + "\nMedallion Number: " + strMedallionNo + "\nMedallion Owner: " + strMedallionOwner + "\nFleet Medallion : " + strFleetMedallion + "\nSHL Permit: " + strShlPermit + "\nHearing Location: " + strHearingLocation + "\nCar Seized: " + getTextSeized; new SendEmail().execute(); } //Toast.makeText(NewSummon.this, "" +message, Toast.LENGTH_SHORT).show(); // Intent intent = new Intent(NewSummon.this , ThankYouScreen.class); // startActivity(intent); }*/ } }); }
From source file:oss.ridendivideapp.TakeRideActivity.java
@Override protected Dialog onCreateDialog(int id) { switch (id) { case DIALOG_DATE: return new DatePickerDialog(this, new OnDateSetListener() { @Override//from www . j a va 2 s.c om public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { dateTime.set(year, monthOfYear, dayOfMonth); datePicker.setText(dateFormatter.format(dateTime.getTime())); } }, dateTime.get(Calendar.YEAR), dateTime.get(Calendar.MONTH), dateTime.get(Calendar.DAY_OF_MONTH)); case DIALOG_TIME: return new TimePickerDialog(this, new OnTimeSetListener() { @Override public void onTimeSet(TimePicker view, int hourOfDay, int minute) { dateTime.set(Calendar.HOUR_OF_DAY, hourOfDay); dateTime.set(Calendar.MINUTE, minute); timePicker.setText(timeFormatter.format(dateTime.getTime())); } }, dateTime.get(Calendar.HOUR_OF_DAY), dateTime.get(Calendar.MINUTE), false); } return null; }
From source file:com.zira.registration.BackgroundCheckActivity.java
@Override public void onClick(View v) { switch (v.getId()) { case R.id.dob: int mYear, mMonth, mDay; // Process to get Current Date final Calendar c = Calendar.getInstance(); mYear = c.get(Calendar.YEAR); mMonth = c.get(Calendar.MONTH); mDay = c.get(Calendar.DAY_OF_MONTH); // Launch Date Picker Dialog DatePickerDialog dpd = new DatePickerDialog(BackgroundCheckActivity.this, new DatePickerDialog.OnDateSetListener() { @Override/*from w w w. j ava 2 s . c o m*/ public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { c.set(year, monthOfYear, dayOfMonth); String selectedDate = mDateFormat.format(c.getTime()); String dateTosend = dateFormatToSend.format(c.getTime()); System.err.println("selectdate" + dateTosend); DOB = dateTosend;//+String.valueOf(hours)+String.valueOf(minute)+String.valueOf(00); dobTextView.setText(selectedDate); /* editor.putString("dob", selectedDate); editor.commit();*/ } }, mYear, mMonth, mDay); dpd.show(); break; case R.id.licenceExpiration: int Year, Month, Day; // Process to get Current Date final Calendar c1 = Calendar.getInstance(); Year = c1.get(Calendar.YEAR); Month = c1.get(Calendar.MONTH); Day = c1.get(Calendar.DAY_OF_MONTH); // Launch Date Picker Dialog DatePickerDialog dpd1 = new DatePickerDialog(BackgroundCheckActivity.this, new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { c1.set(year, monthOfYear, dayOfMonth); String selectedDate = mDateFormat.format(c1.getTime()); String dateTosend = dateFormatToSend.format(c1.getTime()); System.err.println("selectdate" + dateTosend); licenceExpirationDate = dateTosend;//+String.valueOf(hours)+String.valueOf(minute)+String.valueOf(00); licenceExpirationTextView.setText(selectedDate); /*editor.putString("licenceExpirationDate", selectedDate); editor.commit();*/ } }, Year, Month, Day); dpd1.show(); break; case R.id.SaveAndCuntinue: emptyFieldCheck(); //forwardToNextScreen(); break; default: break; } }
From source file:com.owncloud.android.ui.fragment.contactsbackup.ContactsBackupFragment.java
public void openDate(@Nullable Date savedDate) { final ContactsPreferenceActivity contactsPreferenceActivity = (ContactsPreferenceActivity) getActivity(); String backupFolderString = getResources().getString(R.string.contacts_backup_folder) + OCFile.PATH_SEPARATOR;/* w ww . j a v a 2 s . c o m*/ OCFile backupFolder = contactsPreferenceActivity.getStorageManager().getFileByPath(backupFolderString); Vector<OCFile> backupFiles = contactsPreferenceActivity.getStorageManager().getFolderContent(backupFolder, false); Collections.sort(backupFiles, new Comparator<OCFile>() { @Override public int compare(OCFile o1, OCFile o2) { if (o1.getModificationTimestamp() == o2.getModificationTimestamp()) { return 0; } if (o1.getModificationTimestamp() > o2.getModificationTimestamp()) { return 1; } else { return -1; } } }); Calendar cal = Calendar.getInstance(); int year; int month; int day; if (savedDate == null) { year = cal.get(Calendar.YEAR); month = cal.get(Calendar.MONTH) + 1; day = cal.get(Calendar.DAY_OF_MONTH); } else { year = savedDate.getYear(); month = savedDate.getMonth(); day = savedDate.getDay(); } if (backupFiles.size() > 0 && backupFiles.lastElement() != null) { datePickerDialog = new DatePickerDialog(contactsPreferenceActivity, this, year, month, day); datePickerDialog.getDatePicker().setMaxDate(backupFiles.lastElement().getModificationTimestamp()); datePickerDialog.getDatePicker().setMinDate(backupFiles.firstElement().getModificationTimestamp()); datePickerDialog.setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { selectedDate = null; } }); datePickerDialog.show(); } else { Toast.makeText(contactsPreferenceActivity, R.string.contacts_preferences_something_strange_happened, Toast.LENGTH_SHORT).show(); } }
From source file:oss.ridendivideapp.PlacesAutoCompleteActivity.java
@Override protected Dialog onCreateDialog(int id) { switch (id) { case DIALOG_DATE: return new DatePickerDialog(this, new OnDateSetListener() { /* Code to set/get date in a dialog box */ @Override/* w w w . ja va2 s . co m*/ public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { dateTime.set(year, monthOfYear, dayOfMonth); datePicker.setText(dateFormatter.format(dateTime.getTime())); } }, dateTime.get(Calendar.YEAR), dateTime.get(Calendar.MONTH), dateTime.get(Calendar.DAY_OF_MONTH)); case DIALOG_TIME: return new TimePickerDialog(this, new OnTimeSetListener() { /* Code to set/get time in a dialog box */ @Override public void onTimeSet(TimePicker view, int hourOfDay, int minute) { dateTime.set(Calendar.HOUR_OF_DAY, hourOfDay); dateTime.set(Calendar.MINUTE, minute); timePicker.setText(timeFormatter.format(dateTime.getTime())); } }, dateTime.get(Calendar.HOUR_OF_DAY), dateTime.get(Calendar.MINUTE), false); } return null; }
From source file:com.example.nezarsaleh.shareknitest.RegisterNewTest.java
@Override protected Dialog onCreateDialog(int id) { if (id == DILOG_ID) { return new DatePickerDialog(this, dPickerListener, year_x, month_x, day_x); }//from w ww .j a va2 s . c om return null; }