1 package com.android.bluetooth.mapclient; 2 3 import java.util.Date; 4 5 /** 6 * Object representation of filters to be applied on message listing 7 * 8 * @see #getMessagesListing(String, int, MessagesFilter, int) 9 * @see #getMessagesListing(String, int, MessagesFilter, int, int, int) 10 */ 11 public final class MessagesFilter { 12 13 public static final byte MESSAGE_TYPE_ALL = 0x00; 14 public static final byte MESSAGE_TYPE_SMS_GSM = 0x01; 15 public static final byte MESSAGE_TYPE_SMS_CDMA = 0x02; 16 public static final byte MESSAGE_TYPE_EMAIL = 0x04; 17 public static final byte MESSAGE_TYPE_MMS = 0x08; 18 19 public static final byte READ_STATUS_ANY = 0x00; 20 public static final byte READ_STATUS_UNREAD = 0x01; 21 public static final byte READ_STATUS_READ = 0x02; 22 23 public static final byte PRIORITY_ANY = 0x00; 24 public static final byte PRIORITY_HIGH = 0x01; 25 public static final byte PRIORITY_NON_HIGH = 0x02; 26 27 public byte messageType = MESSAGE_TYPE_ALL; 28 29 public String periodBegin = null; 30 31 public String periodEnd = null; 32 33 public byte readStatus = READ_STATUS_ANY; 34 35 public String recipient = null; 36 37 public String originator = null; 38 39 public byte priority = PRIORITY_ANY; 40 MessagesFilter()41 public MessagesFilter() { 42 } 43 setMessageType(byte filter)44 public void setMessageType(byte filter) { 45 messageType = filter; 46 } 47 setPeriod(Date filterBegin, Date filterEnd)48 public void setPeriod(Date filterBegin, Date filterEnd) { 49 //Handle possible NPE for obexTime constructor utility 50 if (filterBegin != null) { 51 periodBegin = (new ObexTime(filterBegin)).toString(); 52 } 53 if (filterEnd != null) { 54 periodEnd = (new ObexTime(filterEnd)).toString(); 55 } 56 } 57 setReadStatus(byte readfilter)58 public void setReadStatus(byte readfilter) { 59 readStatus = readfilter; 60 } 61 setRecipient(String filter)62 public void setRecipient(String filter) { 63 if (filter != null && filter.isEmpty()) { 64 recipient = null; 65 } else { 66 recipient = filter; 67 } 68 } 69 setOriginator(String filter)70 public void setOriginator(String filter) { 71 if (filter != null && filter.isEmpty()) { 72 originator = null; 73 } else { 74 originator = filter; 75 } 76 } 77 setPriority(byte filter)78 public void setPriority(byte filter) { 79 priority = filter; 80 } 81 } 82