Home | History | Annotate | Download | only in core
      1 /*
      2  * Copyright (C) 2011 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 package com.example.android.voicemail.common.core;
     18 
     19 import android.net.Uri;
     20 
     21 /**
     22  * Represents a single voicemail stored in the voicemail content provider.
     23  * <p>
     24  * The presence of a field is indicated by a corresponding 'has' method.
     25  */
     26 public interface Voicemail {
     27     /**
     28      * The identifier of the voicemail in the content provider.
     29      * <p>
     30      * This may be missing in the case of a new {@link Voicemail} that we plan to insert into the
     31      * content provider, since until it has been inserted we don't know what id it should have. If
     32      * none is specified, we return -1.
     33      */
     34     public long getId();
     35 
     36     public boolean hasId();
     37 
     38     /** The number of the person leaving the voicemail, empty string if unknown, null if not set. */
     39     public String getNumber();
     40 
     41     public boolean hasNumber();
     42 
     43     /** The timestamp the voicemail was received, in millis since the epoch, zero if not set. */
     44     public long getTimestampMillis();
     45 
     46     public boolean hasTimestampMillis();
     47 
     48     /** Gets the duration of the voicemail in millis, or zero if the field is not set. */
     49     public long getDuration();
     50 
     51     public boolean hasDuration();
     52 
     53     /**
     54      * Returns the package name of the source that added this voicemail, or null if this field is
     55      * not set.
     56      */
     57     public String getSourcePackage();
     58 
     59     public boolean hasSourcePackage();
     60 
     61     /**
     62      * Returns the application-specific data type stored with the voicemail, or null if this field
     63      * is not set.
     64      * <p>
     65      * Source data is typically used as an identifier to uniquely identify the voicemail against
     66      * the voicemail server. This is likely to be something like the IMAP UID, or some other
     67      * server-generated identifying string.
     68      */
     69     public String getSourceData();
     70 
     71     public boolean hasSourceData();
     72 
     73     /**
     74      * Gets the Uri that can be used to refer to this voicemail, and to make it play.
     75      * <p>
     76      * Returns null if we don't know the Uri.
     77      */
     78     public Uri getUri();
     79 
     80     public boolean hasUri();
     81 
     82     /**
     83      * Tells us if the voicemail message has been marked as read.
     84      * <p>
     85      * Always returns false if this field has not been set, i.e. if hasRead() returns false.
     86      */
     87     public boolean isRead();
     88 
     89     public boolean hasRead();
     90 
     91     /**
     92      * Tells us if there is content stored at the Uri.
     93      */
     94     public boolean hasContent();
     95 }
     96