Example usage for java.lang.ref WeakReference WeakReference

List of usage examples for java.lang.ref WeakReference WeakReference

Introduction

In this page you can find the example usage for java.lang.ref WeakReference WeakReference.

Prototype

public WeakReference(T referent) 

Source Link

Document

Creates a new weak reference that refers to the given object.

Usage

From source file:co.com.parsoniisolutions.custombottomsheetbehavior.lib.BackdropBottomSheetBehavior.java

/**
 * Look into the CoordiantorLayout for the {@link BottomSheetBehaviorGoogleMapsLike}
 * @param coordinatorLayout with app:layout_behavior= {@link BottomSheetBehaviorGoogleMapsLike}
 *///from  w  w  w. j av a 2  s . co  m
private void getBottomSheetBehavior(@NonNull CoordinatorLayout coordinatorLayout) {

    for (int i = 0; i < coordinatorLayout.getChildCount(); i++) {
        View child = coordinatorLayout.getChildAt(i);

        if (child instanceof NestedScrollView) {

            try {
                BottomSheetBehaviorGoogleMapsLike temp = BottomSheetBehaviorGoogleMapsLike.from(child);
                mBottomSheetBehaviorRef = new WeakReference<>(temp);
                break;
            } catch (IllegalArgumentException e) {
            }
        }
    }
}

From source file:de.devmil.muzei.bingimageofthedayartsource.cache.BingImageCache.java

public BingImageCache(Context context) {
    _Context = new WeakReference<Context>(context);
    _ImageDownloader = new ImageDownloader(context, this);
    loadMetadata();/*from w  ww.  j a v  a2 s.c  om*/
}

From source file:com.aikidonord.fragments.FragmentDate.java

/**
 * Das subtilit pour faire de l'async dans des fragments
 *//*ww w  .j  av  a2s  . c o  m*/
private void lancementAsync() {
    QueryForDateTask asyncTask = new QueryForDateTask(this);
    this.asyncTaskWeakRef = new WeakReference<QueryForDateTask>(asyncTask);
    asyncTask.execute(this);
}

From source file:com.aikidonord.fragments.FragmentLieu.java

/**
 * Das subtilit pour faire de l'async dans des fragments
 *//*w w  w  .j  ava2s  . c  om*/
private void lancementAsync() {
    QueryForLieuTask asyncTask = new QueryForLieuTask(this);
    this.asyncTaskWeakRef = new WeakReference<QueryForLieuTask>(asyncTask);
    asyncTask.execute(this);
}

From source file:com.aikidonord.fragments.FragmentType.java

/**
 * Das subtilit pour faire de l'async dans des fragments
 *///w  w w .j  a  v  a 2s .co  m
private void lancementAsync() {
    QueryForTypeTask asyncTask = new QueryForTypeTask(this);
    this.asyncTaskWeakRef = new WeakReference<QueryForTypeTask>(asyncTask);
    asyncTask.execute(this);
}

From source file:br.com.anteros.social.google.AnterosGoogleSession.java

public void setActivity(Activity activity) {
    this.activity = new WeakReference<Activity>(activity);
    if (clientGoogle == null) {
        GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
                .requestEmail().requestScopes(new Scope(Scopes.PLUS_LOGIN)).build();

        clientGoogle = new GoogleApiClient.Builder(this.activity.get())
                .enableAutoManage((FragmentActivity) this.activity.get() /* FragmentActivity */,
                        this /* OnConnectionFailedListener */)
                .addApi(Plus.API).addApi(Auth.GOOGLE_SIGN_IN_API, gso).build();
    }/*ww w  .j av a2s  .  c  o  m*/
}

From source file:com.facebook.getrecommendations.AppPagerAdapter.java

@Override
public Object instantiateItem(ViewGroup container, int position) {
    AppCardFragment cardFragment = (AppCardFragment) super.instantiateItem(container, position);
    mLoadedFragments.put(position, new WeakReference<AppCardFragment>(cardFragment));
    return cardFragment;
}

From source file:es.ugr.swad.swadroid.modules.Module.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    // Check if debug mode is enabled

    try {/*from  w  w w  . j a v a 2s .  c  o m*/
        getPackageManager().getApplicationInfo(getPackageName(), 0);
        isDebuggable = (ApplicationInfo.FLAG_DEBUGGABLE != 0);
    } catch (NameNotFoundException e1) {
        e1.printStackTrace();
    }

    // Initialize webservices client
    webserviceClient = null;

    super.onCreate(savedInstanceState);

    // Recover the launched async task if the activity is re-created
    connect = (Connect) getLastNonConfigurationInstance();
    if (connect != null) {
        connect.activity = new WeakReference<Module>(this);
    }
}

From source file:com.aikidonord.fragments.FragmentProchainsStages.java

/**
 * Das subtilit pour faire de l'async dans des fragments
 *//* w  w w. j av a 2s .co m*/
public void lancementAsync(String type, String data, boolean MAJ) {

    // dans le cas d'un rechargement par un autre fragment
    // on remet le loading...
    if (MAJ) {
        if (this.rlLoading != null) {
            this.rlLoading.setVisibility(View.VISIBLE);
            this.viewPager.setVisibility(View.GONE);
        }
    }

    QueryForProchainStageTask asyncTask = new QueryForProchainStageTask(this);
    this.asyncTaskWeakRef = new WeakReference<QueryForProchainStageTask>(asyncTask);
    asyncTask.execute(this, type, data);

}

From source file:com.example.carlitos.swipeitemrecycler.view.animation.swipe_item.swipeable.ItemSlidingAnimator.java

private void scheduleViewHolderDeferredSlideProcess(RecyclerView.ViewHolder holder,
        ViewHolderDeferredProcess deferredProcess) {
    mDeferredProcesses.add(new WeakReference<>(deferredProcess));
    holder.itemView.post(deferredProcess);
}