Skip to content

Commit

Permalink
deprecate fragments
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredsburrows authored and sjudd committed Feb 12, 2018
1 parent 3a7e262 commit 29d481c
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.Fragment;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.VisibleForTesting;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.view.View;
import com.bumptech.glide.Glide;
Expand Down Expand Up @@ -115,8 +115,9 @@ public static GlideRequests with(@NonNull Fragment arg0) {
/**
* @see Glide#with(Fragment)
*/
@Deprecated
@NonNull
public static GlideRequests with(@NonNull android.support.v4.app.Fragment arg0) {
public static GlideRequests with(@NonNull android.app.Fragment arg0) {
return (GlideRequests) Glide.with(arg0);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.bumptech.glide.integration.recyclerview;

import android.app.Activity;
import android.app.Fragment;
import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v7.widget.RecyclerView;
import com.bumptech.glide.Glide;
Expand Down Expand Up @@ -52,19 +52,20 @@ public RecyclerViewPreloader(@NonNull FragmentActivity fragmentActivity,
}

/**
* Helper constructor that accepts an {@link Fragment}.
* Helper constructor that accepts an {@link android.app.Fragment}.
*/
public RecyclerViewPreloader(@NonNull Fragment fragment,
@Deprecated
public RecyclerViewPreloader(@NonNull android.app.Fragment fragment,
@NonNull PreloadModelProvider<T> preloadModelProvider,
@NonNull PreloadSizeProvider<T> preloadDimensionProvider,
int maxPreload) {
this(Glide.with(fragment), preloadModelProvider, preloadDimensionProvider, maxPreload);
}

/**
* Helper constructor that accepts an {@link android.support.v4.app.Fragment}.
* Helper constructor that accepts an {@link Fragment}.
*/
public RecyclerViewPreloader(@NonNull android.support.v4.app.Fragment fragment,
public RecyclerViewPreloader(@NonNull Fragment fragment,
@NonNull PreloadModelProvider<T> preloadModelProvider,
@NonNull PreloadSizeProvider<T> preloadDimensionProvider,
int maxPreload) {
Expand Down
15 changes: 8 additions & 7 deletions library/src/main/java/com/bumptech/glide/Glide.java
Original file line number Diff line number Diff line change
Expand Up @@ -724,27 +724,28 @@ public static RequestManager with(@NonNull FragmentActivity activity) {
}

/**
* 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.
* 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 android.app.Fragment fragment) {
public static RequestManager with(@NonNull Fragment fragment) {
return getRetriever(fragment.getActivity()).get(fragment);
}

/**
* 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.
* 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
@NonNull
public static RequestManager with(@NonNull Fragment fragment) {
public static RequestManager with(@NonNull android.app.Fragment fragment) {
return getRetriever(fragment.getActivity()).get(fragment);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
* @see com.bumptech.glide.manager.RequestManagerRetriever
* @see com.bumptech.glide.RequestManager
*/
@Deprecated
public class RequestManagerFragment extends Fragment {
private static final String TAG = "RMFragment";
private final ActivityFragmentLifecycle lifecycle;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ private Fragment findSupportFragment(@NonNull View target, @NonNull FragmentActi
return result;
}

@Deprecated
@Nullable
private android.app.Fragment findFragment(@NonNull View target, @NonNull Activity activity) {
tempViewToFragment.clear();
Expand All @@ -255,6 +256,7 @@ private android.app.Fragment findFragment(@NonNull View target, @NonNull Activit

// TODO: Consider using an accessor class in the support library package to more directly retrieve
// non-support Fragments.
@Deprecated
@TargetApi(Build.VERSION_CODES.O)
private void findAllFragmentsWithViews(
@NonNull android.app.FragmentManager fragmentManager,
Expand All @@ -271,6 +273,7 @@ private void findAllFragmentsWithViews(
}
}

@Deprecated
private void findAllFragmentsWithViewsPreO(
@NonNull android.app.FragmentManager fragmentManager,
@NonNull ArrayMap<View, android.app.Fragment> result) {
Expand Down Expand Up @@ -313,6 +316,7 @@ private static void assertNotDestroyed(@NonNull Activity activity) {
}
}

@Deprecated
@NonNull
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
public RequestManager get(@NonNull android.app.Fragment fragment) {
Expand All @@ -328,6 +332,7 @@ public RequestManager get(@NonNull android.app.Fragment fragment) {
}
}

@Deprecated
@NonNull
RequestManagerFragment getRequestManagerFragment(
@NonNull final android.app.FragmentManager fm, @Nullable android.app.Fragment parentHint) {
Expand All @@ -345,6 +350,7 @@ RequestManagerFragment getRequestManagerFragment(
return current;
}

@Deprecated
@NonNull
private RequestManager fragmentGet(@NonNull Context context,
@NonNull android.app.FragmentManager fm,
Expand Down

0 comments on commit 29d481c

Please sign in to comment.