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 package com.android.messaging.datamodel.media; 17 18 public class FakeImageResource extends RefCountedMediaResource { 19 private boolean mClosed = false; 20 private boolean mCached = false; 21 private final int mSize; 22 private final String mImageId; 23 24 public FakeImageResource(final int size, final String imageId) { 25 super(null); 26 mSize = size; 27 mImageId = imageId; 28 } 29 30 public boolean isClosed() { 31 return mClosed; 32 } 33 34 public String getImageId() { 35 return mImageId; 36 } 37 38 public void setCached(final boolean cached) { 39 mCached = cached; 40 } 41 42 public boolean getCached() { 43 return mCached; 44 } 45 46 @Override 47 public int getMediaSize() { 48 return mSize; 49 } 50 51 @Override 52 protected void close() { 53 mClosed = true; 54 } 55 } 56