/** * Begin a load with Glide that will tied to the give * {@link android.support.v4.app.FragmentActivity}'s lifecycle and that uses the given * {@link android.support.v4.app.FragmentActivity}'s default options. * * @param activity The activity to use. * @return A RequestManager for the given FragmentActivity that can be used to start a load. */ @NonNull public static RequestManager with(@NonNull FragmentActivity activity) { return getRetriever(activity).get(activity); }
/** * Begin a load with Glide that will be tied to the given {@link android.app.Activity}'s lifecycle * and that uses the given {@link Activity}'s default options. * * @param activity The activity to use. * @return A RequestManager for the given activity that can be used to start a load. */ @NonNull public static RequestManager with(@NonNull Activity activity) { return getRetriever(activity).get(activity); }
/** * Begin a load with Glide that will be tied to the given * {@link android.support.v4.app.Fragment}'s lifecycle and that uses the given * {@link android.support.v4.app.Fragment}'s default options. * * @param fragment The fragment to use. * @return A RequestManager for the given Fragment that can be used to start a load. */ @NonNull public static RequestManager with(@NonNull Fragment fragment) { return getRetriever(fragment.getActivity()).get(fragment); }
/** * Begin a load with Glide by passing in a context. * * <p> Any requests started using a context will only have the application level options applied * and will not be started or stopped based on lifecycle events. In general, loads should be * started at the level the result will be used in. If the resource will be used in a view in a * child fragment, the load should be started with {@link #with(android.app.Fragment)}} using that * child fragment. Similarly, if the resource will be used in a view in the parent fragment, the * load should be started with {@link #with(android.app.Fragment)} using the parent fragment. In * the same vein, if the resource will be used in a view in an activity, the load should be * started with {@link #with(android.app.Activity)}}. </p> * * <p> This method is appropriate for resources that will be used outside of the normal fragment * or activity lifecycle (For example in services, or for notification thumbnails). </p> * * @param context Any context, will not be retained. * @return A RequestManager for the top level application that can be used to start a load. * @see #with(android.app.Activity) * @see #with(android.app.Fragment) * @see #with(android.support.v4.app.Fragment) * @see #with(android.support.v4.app.FragmentActivity) */ @NonNull public static RequestManager with(@NonNull Context context) { return getRetriever(context).get(context); }
/** * Begin a load with Glide that will be tied to the given {@link android.app.Fragment}'s lifecycle * and that uses the given {@link android.app.Fragment}'s default options. * * @param fragment The fragment to use. * @return A RequestManager for the given Fragment that can be used to start a load. * @deprecated Prefer support Fragments and {@link #with(Fragment)} instead, * {@link android.app.Fragment} will be deprecated. See * https://github.com/android/android-ktx/pull/161#issuecomment-363270555. */ @SuppressWarnings("deprecation") @Deprecated @NonNull public static RequestManager with(@NonNull android.app.Fragment fragment) { return getRetriever(fragment.getActivity()).get(fragment); }
/** * Begin a load with Glide that will be tied to the lifecycle of the {@link Fragment}, * {@link android.app.Fragment}, or {@link Activity} that contains the View. * * <p>A {@link Fragment} or {@link android.app.Fragment} is assumed to contain a View if the View * is a child of the View returned by the {@link Fragment#getView()}} method. * * <p>This method will not work if the View is not attached. Prefer the Activity and Fragment * variants unless you're loading in a View subclass. * * <p>This method may be inefficient aways and is definitely inefficient for large hierarchies. * Consider memoizing the result after the View is attached or again, prefer the Activity and * Fragment variants whenever possible. * * <p>When used in Applications that use the non-support {@link android.app.Fragment} classes, * calling this method will produce noisy logs from {@link android.app.FragmentManager}. Consider * avoiding entirely or using the {@link Fragment}s from the support library instead. * * <p>If the support {@link FragmentActivity} class is used, this method will only attempt to * discover support {@link Fragment}s. Any non-support {@link android.app.Fragment}s attached * to the {@link FragmentActivity} will be ignored. * * @param view The view to search for a containing Fragment or Activity from. * @return A RequestManager that can be used to start a load. */ @NonNull public static RequestManager with(@NonNull View view) { return getRetriever(view.getContext()).get(view); }
/** * Begin a load with Glide that will tied to the give * {@link android.support.v4.app.FragmentActivity}'s lifecycle and that uses the given * {@link android.support.v4.app.FragmentActivity}'s default options. * * @param activity The activity to use. * @return A RequestManager for the given FragmentActivity that can be used to start a load. */ public static RequestManager with(FragmentActivity activity) { return getRetriever(activity).get(activity); }
/** * Begin a load with Glide that will be tied to the given {@link android.app.Activity}'s lifecycle * and that uses the given {@link Activity}'s default options. * * @param activity The activity to use. * @return A RequestManager for the given activity that can be used to start a load. */ public static RequestManager with(Activity activity) { return getRetriever(activity).get(activity); }
/** * Begin a load with Glide by passing in a context. * * <p> Any requests started using a context will only have the application level options applied * and will not be started or stopped based on lifecycle events. In general, loads should be * started at the level the result will be used in. If the resource will be used in a view in a * child fragment, the load should be started with {@link #with(android.app.Fragment)}} using that * child fragment. Similarly, if the resource will be used in a view in the parent fragment, the * load should be started with {@link #with(android.app.Fragment)} using the parent fragment. In * the same vein, if the resource will be used in a view in an activity, the load should be * started with {@link #with(android.app.Activity)}}. </p> * * <p> This method is appropriate for resources that will be used outside of the normal fragment * or activity lifecycle (For example in services, or for notification thumbnails). </p> * * @param context Any context, will not be retained. * @return A RequestManager for the top level application that can be used to start a load. * @see #with(android.app.Activity) * @see #with(android.app.Fragment) * @see #with(android.support.v4.app.Fragment) * @see #with(android.support.v4.app.FragmentActivity) */ public static RequestManager with(Context context) { return getRetriever(context).get(context); }
/** * Begin a load with Glide that will be tied to the lifecycle of the {@link Fragment}, * {@link android.app.Fragment}, or {@link Activity} that contains the View. * * <p>A {@link Fragment} or {@link android.app.Fragment} is assumed to contain a View if the View * is a child of the View returned by the {@link Fragment#getView()}} method. * * <p>This method will not work if the View is not attached. Prefer the Activity and Fragment * variants unless you're loading in a View subclass. * * <p>This method may be inefficient aways and is definitely inefficient for large hierarchies. * Consider memoizing the result after the View is attached or again, prefer the Activity and * Fragment variants whenever possible. * * <p>When used in Applications that use the non-support {@link android.app.Fragment} classes, * calling this method will produce noisy logs from {@link android.app.FragmentManager}. Consider * avoiding entirely or using the {@link Fragment}s from the support library instead. * * <p>If the support {@link FragmentActivity} class is used, this method will only attempt to * discover support {@link Fragment}s. Any non-support {@link android.app.Fragment}s attached * to the {@link FragmentActivity} will be ignored. * * @param view The view to search for a containing Fragment or Activity from. * @return A RequestManager that can be used to start a load. */ public static RequestManager with(View view) { return getRetriever(view.getContext()).get(view); }
/** * Begin a load with Glide that will be tied to the given * {@link android.support.v4.app.Fragment}'s lifecycle and that uses the given * {@link android.support.v4.app.Fragment}'s default options. * * @param fragment The fragment to use. * @return A RequestManager for the given Fragment that can be used to start a load. */ public static RequestManager with(Fragment fragment) { return getRetriever(fragment.getActivity()).get(fragment); }
/** * Begin a load with Glide that will be tied to the given {@link android.app.Fragment}'s lifecycle * and that uses the given {@link android.app.Fragment}'s default options. * * @param fragment The fragment to use. * @return A RequestManager for the given Fragment that can be used to start a load. */ public static RequestManager with(android.app.Fragment fragment) { return getRetriever(fragment.getActivity()).get(fragment); }