Search in sources :

Example 6 with Glide

use of com.bumptech.glide.Glide in project Rocket by mozilla-tw.

the class RequestManagerRetriever method supportFragmentGet.

private RequestManager supportFragmentGet(Context context, FragmentManager fm, Fragment parentHint) {
    SupportRequestManagerFragment current = getSupportRequestManagerFragment(fm, parentHint);
    RequestManager requestManager = current.getRequestManager();
    if (requestManager == null) {
        // TODO(b/27524013): Factor out this Glide.get() call.
        Glide glide = Glide.get(context);
        requestManager = factory.build(glide, current.getGlideLifecycle(), current.getRequestManagerTreeNode());
        current.setRequestManager(requestManager);
    }
    return requestManager;
}
Also used : RequestManager(com.bumptech.glide.RequestManager) Glide(com.bumptech.glide.Glide)

Example 7 with Glide

use of com.bumptech.glide.Glide in project Rocket by mozilla-tw.

the class RequestManagerRetriever method getApplicationManager.

private RequestManager getApplicationManager(Context context) {
    // Either an application context or we're on a background thread.
    if (applicationManager == null) {
        synchronized (this) {
            if (applicationManager == null) {
                // Normally pause/resume is taken care of by the fragment we add to the fragment or
                // activity. However, in this case since the manager attached to the application will not
                // receive lifecycle events, we must force the manager to start resumed using
                // ApplicationLifecycle.
                // TODO(b/27524013): Factor out this Glide.get() call.
                Glide glide = Glide.get(context);
                applicationManager = factory.build(glide, new ApplicationLifecycle(), new EmptyRequestManagerTreeNode());
            }
        }
    }
    return applicationManager;
}
Also used : Glide(com.bumptech.glide.Glide)

Example 8 with Glide

use of com.bumptech.glide.Glide in project Rocket by mozilla-tw.

the class RequestManagerRetriever method fragmentGet.

private RequestManager fragmentGet(Context context, android.app.FragmentManager fm, android.app.Fragment parentHint) {
    RequestManagerFragment current = getRequestManagerFragment(fm, parentHint);
    RequestManager requestManager = current.getRequestManager();
    if (requestManager == null) {
        // TODO(b/27524013): Factor out this Glide.get() call.
        Glide glide = Glide.get(context);
        requestManager = factory.build(glide, current.getGlideLifecycle(), current.getRequestManagerTreeNode());
        current.setRequestManager(requestManager);
    }
    return requestManager;
}
Also used : RequestManager(com.bumptech.glide.RequestManager) Glide(com.bumptech.glide.Glide)

Example 9 with Glide

use of com.bumptech.glide.Glide in project FastHub by k0shk0sh.

the class SettingsCategoryFragment method addBehaviour.

private void addBehaviour() {
    addPreferencesFromResource(R.xml.behaviour_settings);
    findPreference("clear_search").setOnPreferenceClickListener(preference -> {
        callback.showMessage(R.string.success, R.string.deleted);
        SearchHistory.deleteAll();
        return true;
    });
    findPreference("clear_image_cache").setOnPreferenceClickListener(preference -> {
        final Glide glide = Glide.get(App.getInstance());
        disposable.add(RxHelper.getObservable(Observable.fromCallable(() -> {
            glide.clearDiskCache();
            return true;
        })).subscribe(aBoolean -> {
            glide.clearMemory();
            Toasty.info(App.getInstance(), getString(R.string.restart_app_message), Toast.LENGTH_LONG).show();
        }));
        return true;
    });
}
Also used : Context(android.content.Context) Toasty(es.dmoral.toasty.Toasty) Bundle(android.os.Bundle) TypeToken(com.google.gson.reflect.TypeToken) PackageManager(android.content.pm.PackageManager) PreferenceFragmentCompat(android.support.v7.preference.PreferenceFragmentCompat) Environment(android.os.Environment) Date(java.util.Date) RESULT_OK(android.app.Activity.RESULT_OK) Uri(android.net.Uri) App(com.fastaccess.App) InputHelper(com.fastaccess.helper.InputHelper) SimpleDateFormat(java.text.SimpleDateFormat) Intent(android.content.Intent) NonNull(android.support.annotation.NonNull) RxHelper(com.fastaccess.helper.RxHelper) Manifest(android.Manifest) NotificationSchedulerJobTask(com.fastaccess.provider.tasks.notification.NotificationSchedulerJobTask) Gson(com.google.gson.Gson) Locale(java.util.Locale) Toast(android.widget.Toast) Map(java.util.Map) OutputStreamWriter(java.io.OutputStreamWriter) Observable(io.reactivex.Observable) Log(android.util.Log) PrefHelper(com.fastaccess.helper.PrefHelper) FileHelper(com.fastaccess.helper.FileHelper) SettingsModel(com.fastaccess.data.dao.SettingsModel) BaseMvp(com.fastaccess.ui.base.mvp.BaseMvp) ContextCompat(android.support.v4.content.ContextCompat) NotificationSoundBottomSheet(com.fastaccess.ui.modules.settings.sound.NotificationSoundBottomSheet) FileOutputStream(java.io.FileOutputStream) IOException(java.io.IOException) NotificationSoundMvp(com.fastaccess.ui.modules.settings.sound.NotificationSoundMvp) InputStreamReader(java.io.InputStreamReader) File(java.io.File) SpannableBuilder(com.fastaccess.ui.widgets.SpannableBuilder) Preference(android.support.v7.preference.Preference) CompositeDisposable(io.reactivex.disposables.CompositeDisposable) Glide(com.bumptech.glide.Glide) PrefGetter(com.fastaccess.helper.PrefGetter) R(com.fastaccess.R) Type(java.lang.reflect.Type) RingtoneManager(android.media.RingtoneManager) SearchHistory(com.fastaccess.data.dao.model.SearchHistory) BufferedReader(java.io.BufferedReader) InputStream(java.io.InputStream) Glide(com.bumptech.glide.Glide)

Example 10 with Glide

use of com.bumptech.glide.Glide in project glide by bumptech.

the class RequestManagerRetriever method getApplicationManager.

@NonNull
private RequestManager getApplicationManager(@NonNull Context context) {
    // Either an application context or we're on a background thread.
    if (applicationManager == null) {
        synchronized (this) {
            if (applicationManager == null) {
                // Normally pause/resume is taken care of by the fragment we add to the fragment or
                // activity. However, in this case since the manager attached to the application will not
                // receive lifecycle events, we must force the manager to start resumed using
                // ApplicationLifecycle.
                // TODO(b/27524013): Factor out this Glide.get() call.
                Glide glide = Glide.get(context.getApplicationContext());
                applicationManager = factory.build(glide, new ApplicationLifecycle(), new EmptyRequestManagerTreeNode(), context.getApplicationContext());
            }
        }
    }
    return applicationManager;
}
Also used : Glide(com.bumptech.glide.Glide) NonNull(android.support.annotation.NonNull)

Aggregations

Glide (com.bumptech.glide.Glide)11 NonNull (android.support.annotation.NonNull)6 RequestManager (com.bumptech.glide.RequestManager)6 Context (android.content.Context)2 Intent (android.content.Intent)2 Bundle (android.os.Bundle)2 Toast (android.widget.Toast)2 App (com.fastaccess.App)2 R (com.fastaccess.R)2 InputHelper (com.fastaccess.helper.InputHelper)2 Manifest (android.Manifest)1 TargetApi (android.annotation.TargetApi)1 RESULT_OK (android.app.Activity.RESULT_OK)1 ActivityManager (android.app.ActivityManager)1 PackageManager (android.content.pm.PackageManager)1 RingtoneManager (android.media.RingtoneManager)1 Uri (android.net.Uri)1 Environment (android.os.Environment)1 DrawableRes (android.support.annotation.DrawableRes)1 IdRes (android.support.annotation.IdRes)1