Android Open Source - androidui Place Record






From Project

Back to project page androidui.

License

The source code is released under:

MIT License

If you think the Android project androidui listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package course.labs.placebadges;
/*from   w ww .j av  a  2s . com*/
import android.content.Intent;
import android.graphics.Bitmap;
import android.location.Location;
import android.location.LocationManager;

import java.text.DateFormat;
import java.util.Date;

public class PlaceRecord {

    private String mFlagUrl;
    private String mCountryName;
    private String mPlaceName;
    private Bitmap mFlagBitmap;
    private Location mLocation;
    private String mDate;

    public final static String COUNTRY_NAME_EXTRA = "countryName";
    public final static String PLACE_NAME_EXTRA = "placeName";
    public final static String DATE_STRING_EXTRA = "dateString";
    public final static String FLAG_BITMAP_EXTRA = "flagBitmap";
    public final static String LNG_EXTRA = "longitude";
    public final static String LAT_EXTRA = "latitude";

    public PlaceRecord(String flagUrl, String country, String place) {
        mFlagUrl = flagUrl;
        mCountryName = country;
        mPlaceName = place;
        mDate = DateFormat.getDateTimeInstance().format(new Date());
    }

    public PlaceRecord(Location location) {
        mLocation = location;
        mDate = DateFormat.getDateTimeInstance().format(new Date());
    }

    public PlaceRecord(Intent intent) {
        setCountryName(intent.getStringExtra(COUNTRY_NAME_EXTRA));
        setFlagBitmap((Bitmap) intent.getParcelableExtra(FLAG_BITMAP_EXTRA));
        setPlace(intent.getStringExtra(PLACE_NAME_EXTRA));
        setDate(intent.getStringExtra(DATE_STRING_EXTRA));
        Location tmpLocation = new Location(LocationManager.NETWORK_PROVIDER);
        tmpLocation.setLatitude(intent.getDoubleExtra(LAT_EXTRA, 0.0));
        tmpLocation.setLongitude(intent.getDoubleExtra(LNG_EXTRA, 0.0));
        setLocation(tmpLocation);
    }

    public String getFlagUrl() {
        return mFlagUrl;
    }

    public void setFlagUrl(String flagUrl) {
        mFlagUrl = flagUrl;
    }

    public String getCountryName() {
        return mCountryName;
    }

    public void setCountryName(String country) {
        mCountryName = country;
    }

    public String getPlace() {
        return mPlaceName;
    }

    public void setPlace(String place) {
        this.mPlaceName = place;
    }

    public Bitmap getFlagBitmap() {
        return mFlagBitmap;
    }

    public void setFlagBitmap(Bitmap flagBitmap) {
        mFlagBitmap = flagBitmap;
    }

    public String getDate() {
        return mDate;
    }

    public void setDate(String date) {
        mDate = date;
    }

    public boolean intersects(Location location) {

        double tolerance = 1000;
        return (mLocation.distanceTo(location) <= tolerance);

    }

    public void setLocation(Location location) {
        mLocation = location;
    }

    public Location getLocation() {
        return mLocation;
    }

    @Override
    public String toString() {
        return "Place: " + mPlaceName + " Country: " + mCountryName;
    }

    public Intent packageIntent() {

        Intent data = new Intent();
        data.putExtra(COUNTRY_NAME_EXTRA, mCountryName);
        data.putExtra(PLACE_NAME_EXTRA, mPlaceName);
        data.putExtra(DATE_STRING_EXTRA, mDate);
        data.putExtra(LAT_EXTRA, mLocation.getLatitude());
        data.putExtra(LNG_EXTRA, mLocation.getLongitude());
        data.putExtra(FLAG_BITMAP_EXTRA, mFlagBitmap);

        return data;
    }
}




Java Source Code List

com.example.aporter.helloandroidwithimageview.HelloAndroidWithImageViewActivity.java
course.examples.Fragments.DynamicLayout.QuoteViewerActivity.java
course.examples.Fragments.DynamicLayout.QuotesFragment.java
course.examples.Fragments.DynamicLayout.TitlesFragment.java
course.examples.Notification.StatusBarWithCustomView.NotificationSpecialActivity.java
course.examples.Notification.StatusBarWithCustomView.NotificationStatusBarWithExpandedViewActivity.java
course.examples.Notification.Toast.NotificationToastActivity.java
course.examples.Notification.ToastWithCustomView.NotificationToastActivity.java
course.examples.UI.AlertDialog.AlertDialogActivity.java
course.examples.UI.AutoComplete.AutoCompleteActivity.java
course.examples.UI.Button.ButtonActivity.java
course.examples.UI.CheckBox.CheckBoxActivity.java
course.examples.UI.GridView.GridLayoutActivity.java
course.examples.UI.GridView.ImageAdapter.java
course.examples.UI.GridView.ImageViewActivity.java
course.examples.UI.LinearLayout.LinearLayoutActivity.java
course.examples.UI.ListLayout.ListViewActivity.java
course.examples.UI.ListLayout.ListViewAdapter.java
course.examples.UI.MapView.GoogleMapActivity.java
course.examples.UI.RadioGroup.RadioGroupActivity.java
course.examples.UI.RatingsBar.RatingsBarActivity.java
course.examples.UI.RecyclerView.MyRecyclerViewAdapter.java
course.examples.UI.RecyclerView.RecyclerViewActivity.java
course.examples.UI.RelativeLayout.RelativeLayoutActivity.java
course.examples.UI.Spinner.SpinnerActivity.java
course.examples.UI.TabLayout.GridFragment.java
course.examples.UI.TabLayout.ImageAdapter.java
course.examples.UI.TabLayout.ImageViewActivity.java
course.examples.UI.TabLayout.TabLayoutActivity.java
course.examples.UI.TableLayout.TableLayoutActivity.java
course.examples.UI.ViewPager.GalleryWithViewPagerActivity.java
course.examples.UI.ViewPager.ImageAdapter.java
course.examples.UI.ViewPager.ImageHolderFragment.java
course.examples.UI.WebView.WebViewActivity.java
course.examples.UI.datepicker.DatePickerFragmentActivity.java
course.examples.UI.timepicker.TimePickerFragmentActivity.java
course.examples.UI.togglebutton.ToggleButtonActivity.java
course.examples.colorpalettewithnavdrawer.ApplicationTest.java
course.examples.colorpalettewithnavdrawer.DisplayColorActivity.java
course.examples.colorpalettewithnavdrawer.DisplaySingleColorActivity.java
course.examples.colorpalettewithnavdrawer.PaletteNameAdapter.java
course.examples.colorpalettewithswipe.ApplicationTest.java
course.examples.colorpalettewithswipe.DisplayColorPaletteActivity.java
course.examples.colorpalettewithswipe.DisplaySingleColorActivity.java
course.examples.colorpalettewithswipe.PaletteAdapter.java
course.examples.fragments.StaticLayout.QuoteViewerActivity.java
course.examples.fragments.StaticLayout.QuotesFragment.java
course.examples.fragments.StaticLayout.TitlesFragment.java
course.examples.fragments.staticconfiglayout.QuoteViewerActivity.java
course.examples.fragments.staticconfiglayout.QuotesFragment.java
course.examples.fragments.staticconfiglayout.TitlesFragment.java
course.examples.helloandroidwithlogin.ApplicationTest.java
course.examples.helloandroidwithlogin.HelloAndroidWithImageViewActivity.java
course.examples.helloandroidwithlogin.LoginActivity.java
course.examples.modernartpiano.MainActivity.java
course.examples.modernartui.MainActivity.java
course.examples.notification.StatusBar.NotificationStatusBarActivity.java
course.examples.notification.StatusBar.NotificationSubActivity.java
course.examples.quoteviewer.QuoteListActivity.java
course.examples.quoteviewer.TitlesListActivity.java
course.examples.ui.fragmentactionbar.QuoteFragment.java
course.examples.ui.fragmentactionbar.QuoteViewerActivity.java
course.examples.ui.fragmentactionbar.TitlesFragment.java
course.examples.ui.helloworldwithmenus.HelloAndroidWithMenuActivity.java
course.labs.multipane.MainActivity.java
course.labs.multipane.QuoteFragment.java
course.labs.multipane.TitlesFragment.java
course.labs.placebadges.MockLocationProvider.java
course.labs.placebadges.PlaceDownloaderTask.java
course.labs.placebadges.PlaceRecord.java
course.labs.placebadges.PlaceViewActivity.java
course.labs.placebadges.PlaceViewAdapter.java
course.labs.placebadges.PlaceViewDetailActivity.java
course.labs.placebadges_prel.MockLocationProvider.java
course.labs.placebadges_prel.PlaceDownloaderTask.java
course.labs.placebadges_prel.PlaceRecord.java
course.labs.placebadges_prel.PlaceViewActivity.java
course.labs.placebadges_prel.PlaceViewAdapter.java
course.labs.placebadges_prel.PlaceViewDetailActivity.java
examples.course.basiccolorpalette.ApplicationTest.java
examples.course.basiccolorpalette.DisplayColorActivity.java
examples.course.basiccolorpalette.DisplayColorNames.java
examples.course.basiccolorpalette.DisplaySingleColorActivity.java
examples.course.basiccolorpalette.PaletteAdapter.java
examples.course.basiccolorpaletteupnav.ApplicationTest.java
examples.course.basiccolorpaletteupnav.DisplayColorActivity.java
examples.course.basiccolorpaletteupnav.DisplayColorNamesActivity.java
examples.course.basiccolorpaletteupnav.DisplaySingleColorActivity.java
examples.course.basiccolorpaletteupnav.PaletteAdapter.java
examples.course.ticker.TickerDisplayActivity.java
examples.course.uicardview.ApplicationTest.java
examples.course.uicardview.CardViewActivity.java