Search in sources :

Example 1 with ThumbnailManager

use of com.android.mms.util.ThumbnailManager in project android-aosp-mms by slvn.

the class WorkingMessage method removeThumbnailsFromCache.

public static void removeThumbnailsFromCache(SlideshowModel slideshow) {
    if (slideshow != null) {
        ThumbnailManager thumbnailManager = MmsApp.getApplication().getThumbnailManager();
        boolean removedSomething = false;
        Iterator<SlideModel> iterator = slideshow.iterator();
        while (iterator.hasNext()) {
            SlideModel slideModel = iterator.next();
            if (slideModel.hasImage()) {
                thumbnailManager.removeThumbnail(slideModel.getImage().getUri());
                removedSomething = true;
            } else if (slideModel.hasVideo()) {
                thumbnailManager.removeThumbnail(slideModel.getVideo().getUri());
                removedSomething = true;
            }
        }
        if (removedSomething) {
            // HACK: the keys to the thumbnail cache are the part uris, such as mms/part/3
            // Because the part table doesn't have auto-increment ids, the part ids are reused
            // when a message or thread is deleted. For now, we're clearing the whole thumbnail
            // cache so we don't retrieve stale images when part ids are reused. This will be
            // fixed in the next release in the mms provider.
            MmsApp.getApplication().getThumbnailManager().clearBackingStore();
        }
    }
}
Also used : ThumbnailManager(com.android.mms.util.ThumbnailManager) SlideModel(com.android.mms.model.SlideModel)

Example 2 with ThumbnailManager

use of com.android.mms.util.ThumbnailManager in project android-aosp-mms by slvn.

the class ImageModel method loadThumbnailBitmap.

public ItemLoadedFuture loadThumbnailBitmap(ItemLoadedCallback callback) {
    ThumbnailManager thumbnailManager = MmsApp.getApplication().getThumbnailManager();
    mItemLoadedFuture = thumbnailManager.getThumbnail(getUri(), callback);
    return mItemLoadedFuture;
}
Also used : ThumbnailManager(com.android.mms.util.ThumbnailManager)

Example 3 with ThumbnailManager

use of com.android.mms.util.ThumbnailManager in project android-aosp-mms by slvn.

the class MmsApp method onCreate.

@Override
public void onCreate() {
    super.onCreate();
    if (Log.isLoggable(LogTag.STRICT_MODE_TAG, Log.DEBUG)) {
        // Log tag for enabling/disabling StrictMode violation log. This will dump a stack
        // in the log that shows the StrictMode violator.
        // To enable: adb shell setprop log.tag.Mms:strictmode DEBUG
        StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectAll().penaltyLog().build());
    }
    sMmsApp = this;
    // Load the default preference values
    PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
    // Figure out the country *before* loading contacts and formatting numbers
    mCountryDetector = (CountryDetector) getSystemService(Context.COUNTRY_DETECTOR);
    mCountryListener = new CountryListener() {

        @Override
        public synchronized void onCountryDetected(Country country) {
            mCountryIso = country.getCountryIso();
        }
    };
    mCountryDetector.addCountryListener(mCountryListener, getMainLooper());
    Context context = getApplicationContext();
    mPduLoaderManager = new PduLoaderManager(context);
    mThumbnailManager = new ThumbnailManager(context);
    MmsConfig.init(this);
    Contact.init(this);
    DraftCache.init(this);
    Conversation.init(this);
    DownloadManager.init(this);
    RateController.init(this);
    LayoutManager.init(this);
    MessagingNotification.init(this);
    activePendingMessages();
}
Also used : Context(android.content.Context) StrictMode(android.os.StrictMode) ThumbnailManager(com.android.mms.util.ThumbnailManager) CountryListener(android.location.CountryListener) Country(android.location.Country) PduLoaderManager(com.android.mms.util.PduLoaderManager)

Example 4 with ThumbnailManager

use of com.android.mms.util.ThumbnailManager in project android-aosp-mms by slvn.

the class VideoModel method loadThumbnailBitmap.

public ItemLoadedFuture loadThumbnailBitmap(ItemLoadedCallback callback) {
    ThumbnailManager thumbnailManager = MmsApp.getApplication().getThumbnailManager();
    mItemLoadedFuture = thumbnailManager.getVideoThumbnail(getUri(), callback);
    return mItemLoadedFuture;
}
Also used : ThumbnailManager(com.android.mms.util.ThumbnailManager)

Aggregations

ThumbnailManager (com.android.mms.util.ThumbnailManager)4 Context (android.content.Context)1 Country (android.location.Country)1 CountryListener (android.location.CountryListener)1 StrictMode (android.os.StrictMode)1 SlideModel (com.android.mms.model.SlideModel)1 PduLoaderManager (com.android.mms.util.PduLoaderManager)1