Skip to content

Commit 8429c86

Browse files
falhassenglide-copybara-robot
authored andcommitted
Document IllegalArgumentExceptions thrown by various Glide.with methods.
This is to address issue #5528. PiperOrigin-RevId: 771265021
1 parent b60e391 commit 8429c86

File tree

1 file changed

+7
-1
lines changed
  • library/src/main/java/com/bumptech/glide

1 file changed

+7
-1
lines changed

library/src/main/java/com/bumptech/glide/Glide.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,8 @@ public static RequestManager with(@NonNull Context context) {
554554
* @deprecated This is equivalent to calling {@link #with(Context)} using the application context.
555555
* Use the androidx Activity class instead (ie {@link FragmentActivity}, or {@link
556556
* androidx.appcompat.app.AppCompatActivity}).
557+
* @throws IllegalArgumentException if the activity associated with the Glide request is being
558+
* destroyed.
557559
*/
558560
@NonNull
559561
@Deprecated
@@ -566,8 +568,9 @@ public static RequestManager with(@NonNull Activity activity) {
566568
* androidx.fragment.app.FragmentActivity}'s lifecycle and that uses the given {@link
567569
* androidx.fragment.app.FragmentActivity}'s default options.
568570
*
569-
* @param activity The activity to use.
571+
* @param activity The activity to use. The activity must not be destroyed.
570572
* @return A RequestManager for the given FragmentActivity that can be used to start a load.
573+
* @throws IllegalArgumentException if the activity is being destroyed.
571574
*/
572575
@NonNull
573576
public static RequestManager with(@NonNull FragmentActivity activity) {
@@ -580,6 +583,7 @@ public static RequestManager with(@NonNull FragmentActivity activity) {
580583
*
581584
* @param fragment The fragment to use.
582585
* @return A RequestManager for the given Fragment that can be used to start a load.
586+
* @throws IllegalArgumentException if the activity associated with the fragment is destroyed.
583587
*/
584588
@NonNull
585589
public static RequestManager with(@NonNull Fragment fragment) {
@@ -595,6 +599,7 @@ public static RequestManager with(@NonNull Fragment fragment) {
595599
* @deprecated This method is identical to calling {@link Glide#with(Context)} using the
596600
* application context. Prefer support Fragments and {@link #with(Fragment)} instead. See
597601
* https://github.com/android/android-ktx/pull/161#issuecomment-363270555.
602+
* @throws IllegalArgumentException if the activity associated with the fragment is destroyed.
598603
*/
599604
@Deprecated
600605
@NonNull
@@ -628,6 +633,7 @@ public static RequestManager with(@NonNull android.app.Fragment fragment) {
628633
*
629634
* @param view The view to search for a containing Fragment or Activity from.
630635
* @return A RequestManager that can be used to start a load.
636+
* @throws IllegalArgumentException if the activity associated with the view is destroyed.
631637
*/
632638
@NonNull
633639
public static RequestManager with(@NonNull View view) {

0 commit comments

Comments
 (0)