Code example for Location

Methods: getLatitudeset

0
		mToAddressTextView.setText(fromText);
		mFromAddressTextView.setText(toText);
 
		temp.set(mFromLocation);
		mFromLocation.set(mToLocation);
		mToLocation.set(temp);
 
		int t = mIconToResId;
		mIconToResId = mIconFromResId;
		mIconFromResId = t;
 
		t = mIconFromColor;
		mIconFromColor = mIconToColor;
		mIconToColor = t;
 
		notifyIconsChanged(); 
		onFormValueChange(); 
	} 
 
	private void notifyIconsChanged() { 
		setIcon(mIconFrom, mIconFromResId, mIconFromColor);
		setIcon(mIconTo, mIconToResId, mIconToColor);
	} 
 
	private void setIcon(final ImageView imageView, final int icoRes, final int color) {
		imageView.setImageResource(icoRes);
		if (color == Color.TRANSPARENT) {
			imageView.setBackgroundDrawable(null);
			imageView.setPadding(0, 0, 0, 0);
		} else { 
			imageView.setBackgroundDrawable(ColorUtils.getRoundedGradiant(color));
			imageView.setPadding(mIconPadding, mIconPadding, mIconPadding, mIconPadding);
		} 
	} 
 
	@Override 
	public void onDateSet(final DatePicker view, final int year, final int monthOfYear, final int dayOfMonth) {
		mDateTime.setYear(year);
		mDateTime.setMonthOfYear(monthOfYear + 1);
		mDateTime.setDayOfMonth(dayOfMonth);
 
		if (!mDialogLock) {
			showTimePicker(); 
			mDialogLock = true;
		} 
	} 
 
	@Override 
	public void onTimeSet(final TimePicker view, final int hourOfDay, final int minute) {
		mDateTime.setHourOfDay(hourOfDay);
		mDateTime.setMinuteOfHour(minute);
 
		mDateAndTimeLabel.setText(mDateFormat.format(mDateTime.toDate()));
 
		onFormValueChange(); 
		mDialogLock = false;
	} 
 
	private void onFormValueChange() { 
		final boolean hasLocations = mFromLocation.getLatitude() != 0 && mToLocation.getLatitude() != 0;
		if (hasLocations) {
			showProgress(); 
			sendRequest(); 
		} 
	}