Android Open Source - WakeMeUp Custom Address






From Project

Back to project page WakeMeUp.

License

The source code is released under:

GNU General Public License

If you think the Android project WakeMeUp 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 com.smallcrafts.wakemeup;
//w ww  .  j  a va2s. c  om
import java.util.Locale;

import android.location.Address;
import android.util.Log;

public class CustomAddress extends Address{
  
  public CustomAddress(Locale locale) {
    super(locale);
  }
  
  public CustomAddress(Address a){
    super(a.getLocale());
    
    if (a.getAddressLine(0) != null)
      this.setAddressLine(0, a.getAddressLine(0));
    if (a.getAddressLine(1) != null)
      this.setAddressLine(1, a.getAddressLine(1));
    if (a.getAddressLine(2) != null)
      this.setAddressLine(2, a.getAddressLine(2));
    
    this.setAdminArea(a.getAdminArea());
    this.setCountryCode(a.getCountryCode());
    this.setCountryName(a.getCountryName());
    this.setExtras(a.getExtras());
    this.setFeatureName(a.getFeatureName());
    this.setLatitude(a.getLatitude());
    this.setLocality(a.getLocality());
    this.setLongitude(a.getLongitude());
    this.setPhone(a.getPhone());
    this.setPostalCode(a.getPostalCode());
    this.setPremises(a.getPremises());
    this.setSubAdminArea(a.getSubAdminArea());
    this.setSubLocality(a.getSubLocality());
    this.setSubThoroughfare(a.getSubThoroughfare());
    this.setThoroughfare(a.getThoroughfare());
    this.setUrl(a.getUrl());
  }
  
  @Override
  public String toString(){
    if (this.getAddressLine(0) == null){
      return this.getFeatureName() + ", " + this.getLocality()  + ", " + this.getCountryName();
    } else {
      if ( this.getFeatureName().length() < this.getAddressLine(0).length()){
        return this.getAddressLine(0) + ", " + this.getLocality() + ", " + this.getCountryName();
      } else {
        return this.getFeatureName() + ", " + this.getLocality()  + ", " + this.getCountryName();
      }
    }
  }
}




Java Source Code List

com.smallcrafts.wakemeup.AlarmActivity.java
com.smallcrafts.wakemeup.CustomAddress.java
com.smallcrafts.wakemeup.CustomArrayAdapter.java
com.smallcrafts.wakemeup.LocationActivity.java
com.smallcrafts.wakemeup.LocationDaemon.java
com.smallcrafts.wakemeup.MainMenu.java
com.smallcrafts.wakemeup.ServiceActivity.java
com.smallcrafts.wakemeup.SettingsActivity.java
com.smallcrafts.wakemeup.util.SystemUiHiderBase.java
com.smallcrafts.wakemeup.util.SystemUiHiderHoneycomb.java
com.smallcrafts.wakemeup.util.SystemUiHider.java