1/* 2 * Copyright (C) 2015 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 17package com.android.messaging.datamodel.data; 18 19import android.graphics.Rect; 20import android.net.Uri; 21 22public class MediaPickerMessagePartData extends MessagePartData { 23 private final Rect mStartRect; 24 25 public MediaPickerMessagePartData(final Rect startRect, final String contentType, 26 final Uri contentUri, final int width, final int height) { 27 this(startRect, null /* messageText */, contentType, contentUri, width, height); 28 } 29 30 public MediaPickerMessagePartData(final Rect startRect, final String messageText, 31 final String contentType, final Uri contentUri, final int width, final int height) { 32 this(startRect, messageText, contentType, contentUri, width, height, 33 false /*onlySingleAttachment*/); 34 } 35 36 public MediaPickerMessagePartData(final Rect startRect, final String contentType, 37 final Uri contentUri, final int width, final int height, 38 final boolean onlySingleAttachment) { 39 this(startRect, null /* messageText */, contentType, contentUri, width, height, 40 onlySingleAttachment); 41 } 42 43 public MediaPickerMessagePartData(final Rect startRect, final String messageText, 44 final String contentType, final Uri contentUri, final int width, final int height, 45 final boolean onlySingleAttachment) { 46 super(messageText, contentType, contentUri, width, height, onlySingleAttachment); 47 mStartRect = startRect; 48 } 49 50 /** 51 * @return The starting rect to animate the attachment preview from in order to perform a smooth 52 * transition 53 */ 54 public Rect getStartRect() { 55 return mStartRect; 56 } 57 58 /** 59 * Modify the start rect of the attachment. 60 */ 61 public void setStartRect(final Rect startRect) { 62 mStartRect.set(startRect); 63 } 64} 65