Android Open Source - android_retrieval_system Email






From Project

Back to project page android_retrieval_system.

License

The source code is released under:

GNU General Public License

If you think the Android project android_retrieval_system 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

/*
 * This file is part of Android retrieval system project.
 * //w  w  w.  j  a  va 2s . c  om
 * Android retrieval system is free software: you can redistribute it
 * and/or modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation, either version 3 of the License,
 * or (at your option) any later version. 
 * 
 * Android retrieval system is distributed in the hope that
 * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with Android retrieval system. If not, see <http://www.gnu.org/licenses/>.
 */

package net.deerhunter.ars.contact_structs;

import net.deerhunter.ars.R;
import net.deerhunter.ars.application.ArsApplication;
import android.content.Context;

/**
 * This class represents an email address of a contact.
 * 
 * @author DeerHunter (vityokkv73@gmail.com)
 */
public class Email {
  private String address;
  private int type;

  /**
   * Returns an address of the email.
   * @return Address of the email
   */
  public String getAddress() {
    return address;
  }

  /**
   * Sets the address of the email.
   * @param address Address of the email
   */
  public void setAddress(String address) {
    this.address = address;
    if (this.address == null)
      this.address = "";
  }

  /**
   * Returns a type of the email. See {@link net.deerhunter.ars.contact_structs.Email.Type} for more information.
   * @return Type of the email
   */
  public int getType() {
    return type;
  }

  /**
   * Sets a type of the email. See {@link net.deerhunter.ars.contact_structs.Email.Type} for more information.
   * @param type Type of the email
   */
  public void setType(int type) {
    this.type = type;
    if (this.type < 0 || this.type > 4)
      this.type = 0;
  }

  /**
   * Creates an instance of the Email class.
   * @param address Address of the email
   * @param type Type of the email. See {@link net.deerhunter.ars.contact_structs.Email.Type} for more information.
   */
  public Email(String address, int type) {
    setAddress(address);
    setType(type);
  }
  
  @Override
  public String toString() {
    if (address.isEmpty())
      return "";
    Context context = ArsApplication.getInstance().getApplicationContext();
    StringBuilder builder = new StringBuilder(address);
    String[] types = context.getResources().getStringArray(R.array.emails_type);
    builder.append(", ");
    builder.append(types[type]);
    return builder.toString();
  }

  /**
   * Class that consists of email type constants.
   * Defined constants:
   * <ul>
   * <li>{@link #HOME}</li>
   * <li>{@link #WORK}</li>
   * <li>{@link #OTHER}</li>
   * <li>{@link #MOBILE}</li>
   * <li>{@link #CUSTOM}</li>
   * </ul>
   * 
   * @author DeerHunter (vityokkv73@gmail.com)
   */
  public class Type {
    /**
     * Home email address
     */
    public static final int HOME = 1;
    /**
     * Work email address
     */
    public static final int WORK = 2;
    /**
     * Other email address
     */
    public static final int OTHER = 3;
    /**
     * Mobile email address
     */
    public static final int MOBILE = 4;
    /**
     * User-defined type of email address
     */
    public static final int CUSTOM = 0;
  }
}




Java Source Code List

net.deerhunter.ars.application.ArsApplication.java
net.deerhunter.ars.broadcast_receivers.BootReceiver.java
net.deerhunter.ars.broadcast_receivers.CallReceiver.java
net.deerhunter.ars.broadcast_receivers.SMSReceiver.java
net.deerhunter.ars.broadcast_receivers.StartLocationListeningReceiver.java
net.deerhunter.ars.broadcast_receivers.StopLocationListeningReceiver.java
net.deerhunter.ars.broadcast_receivers.WiFiStatusReceiver.java
net.deerhunter.ars.contact_structs.Address.java
net.deerhunter.ars.contact_structs.ContactList.java
net.deerhunter.ars.contact_structs.ContactsManager.java
net.deerhunter.ars.contact_structs.Email.java
net.deerhunter.ars.contact_structs.IM.java
net.deerhunter.ars.contact_structs.Organization.java
net.deerhunter.ars.contact_structs.Phone.java
net.deerhunter.ars.gps.GPSHelper.java
net.deerhunter.ars.inner_structures.ControlConstants.java
net.deerhunter.ars.inner_structures.ImageInfoPiece.java
net.deerhunter.ars.internet_utils.Network3gHelper.java
net.deerhunter.ars.internet_utils.WifiHelper.java
net.deerhunter.ars.location.ARSLocationListener.java
net.deerhunter.ars.location.LocationManager.java
net.deerhunter.ars.protocol.PacketSenderService.java
net.deerhunter.ars.protocol.Uploader.java
net.deerhunter.ars.protocol.packets.BasePacket.java
net.deerhunter.ars.protocol.packets.CallPacket.java
net.deerhunter.ars.protocol.packets.ContactPacket.java
net.deerhunter.ars.protocol.packets.DataType.java
net.deerhunter.ars.protocol.packets.ImagePacket.java
net.deerhunter.ars.protocol.packets.LocationPacket.java
net.deerhunter.ars.protocol.packets.MainPacket.java
net.deerhunter.ars.protocol.packets.SMSPacket.java
net.deerhunter.ars.providers.ActivityContract.java
net.deerhunter.ars.providers.ActivityProvider.java
net.deerhunter.ars.services.ImageStorageController.java
net.deerhunter.ars.services.SentSMSControllerService.java
net.deerhunter.ars.utils.ContactHelper.java
net.deerhunter.ars.utils.MD5Checksum.java