Home | History | Annotate | Download | only in exchange
      1 /*
      2  * Copyright (C) 2008-2009 Marc Blank
      3  * Licensed to The Android Open Source Project.
      4  *
      5  * Licensed under the Apache License, Version 2.0 (the "License");
      6  * you may not use this file except in compliance with the License.
      7  * You may obtain a copy of the License at
      8  *
      9  *      http://www.apache.org/licenses/LICENSE-2.0
     10  *
     11  * Unless required by applicable law or agreed to in writing, software
     12  * distributed under the License is distributed on an "AS IS" BASIS,
     13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14  * See the License for the specific language governing permissions and
     15  * limitations under the License.
     16  */
     17 
     18 package com.android.exchange;
     19 
     20 import com.android.emailcommon.provider.EmailContent.Attachment;
     21 
     22 /**
     23  * PartRequest is the EAS wrapper for attachment loading requests.  In addition to information about
     24  * the attachment to be loaded, it also contains the callback to be used for status/progress
     25  * updates to the UI.
     26  */
     27 public class PartRequest extends Request {
     28     public final Attachment mAttachment;
     29     public final String mDestination;
     30     public final String mContentUriString;
     31     public final String mLocation;
     32 
     33     public PartRequest(Attachment _att, String _destination, String _contentUriString) {
     34         super(_att.mMessageKey);
     35         mAttachment = _att;
     36         mLocation = mAttachment.mLocation;
     37         mDestination = _destination;
     38         mContentUriString = _contentUriString;
     39     }
     40 
     41     // PartRequests are unique by their attachment id (i.e. multiple attachments might be queued
     42     // for a particular message, but any individual attachment can only be loaded once)
     43     public boolean equals(Object o) {
     44         if (!(o instanceof PartRequest)) return false;
     45         return ((PartRequest)o).mAttachment.mId == mAttachment.mId;
     46     }
     47 
     48     public int hashCode() {
     49         return (int)mAttachment.mId;
     50     }
     51 }
     52