Example usage for android.support.v4.app Fragment getActivity

List of usage examples for android.support.v4.app Fragment getActivity

Introduction

In this page you can find the example usage for android.support.v4.app Fragment getActivity.

Prototype

public Activity getActivity() 

Source Link

Usage

From source file:net.granoeste.scaffold.util.TrackerToLog.java

@Override
public void trackOperation(final Fragment fragment, final MenuItem item) {
    if (fragment == null) {
        return;/*  ww  w .  j  a va2 s  . com*/
    }
    if (fragment.getActivity() == null) {
        return;
    }
    if (item.getTitle() == null) {
        return;
    }
    track(fragment.getActivity(), makeLogTag(((Object) fragment).getClass()), item.getTitle().toString());
}

From source file:org.alfresco.mobile.android.application.fragments.actions.NodeIdActions.java

public NodeIdActions(Fragment f, List<String> selectedNodes) {
    this.fragmentRef = new WeakReference<>(f);
    this.activityRef = new WeakReference<>(f.getActivity());
    this.selectedItems = selectedNodes;
    for (String nodeId : selectedNodes) {
        addNode(nodeId);//from  w ww . j a v  a 2 s . c o  m
    }
}

From source file:com.learnncode.mediachooser.async.VideoLoadAsync.java

public VideoLoadAsync(Fragment fragment, ImageView imageView, boolean isScrolling, int width) {
    mImageView = imageView;/*from  w w w .j a  va 2  s .  c o  m*/
    this.fragment = fragment;
    mIsScrolling = isScrolling;

    final int memClass = ((ActivityManager) fragment.getActivity().getSystemService(Context.ACTIVITY_SERVICE))
            .getMemoryClass();
    final int size = 1024 * 1024 * memClass / 8;

    // Handle orientation change.
    GalleryRetainCache c = GalleryRetainCache.getOrCreateRetainableCache();
    mCache = c.mRetainedCache;

    if (mCache == null) {
        // The maximum bitmap pixels allowed in respective direction.
        // If exceeding, the cache will automatically scale the
        // bitmaps.
        /*   final int MAX_PIXELS_WIDTH  = 100;
        final int MAX_PIXELS_HEIGHT = 100;*/
        mCache = new GalleryCache(size, width, width);
        c.mRetainedCache = mCache;
    }
}

From source file:net.granoeste.scaffold.util.TrackerToLog.java

@Override
public void trackOperation(final Fragment fragment, final View view) {
    if (fragment == null) {
        return;/*  w  w  w .jav  a2s . c  o  m*/
    }
    if (fragment.getActivity() == null) {
        return;
    }
    CharSequence operation = null;
    if (view == null) {
        return;
    } else if (view instanceof Button) {
        operation = ((Button) view).getText();
    } else if (view instanceof TextView) {
        operation = ((TextView) view).getText();
    } else if (view instanceof ImageView) {
        operation = String.valueOf(((ImageView) view).getId());
    } else {
        return;
    }
    track(fragment.getActivity(), makeLogTag(((Object) fragment).getClass()),
            operation != null ? operation.toString() : null);
}

From source file:com.github.pockethub.android.ui.FragmentPagerAdapter.java

public FragmentPagerAdapter(Fragment fragment) {
    super(fragment.getChildFragmentManager());

    fragmentManager = fragment.getChildFragmentManager();
    this.activity = (AppCompatActivity) fragment.getActivity();
}

From source file:com.grottworkshop.gwsviewmodellibrary.viewmodel.ViewModelHelper.java

public void onDestroyView(@NonNull Fragment fragment) {
    if (mViewModel == null) {
        //no viewmodel for this fragment
        return;//from w  w  w  .ja va  2  s.c  o  m
    }
    mViewModel.clearView();
    if (fragment.getActivity() != null && fragment.getActivity().isFinishing()) {
        removeViewModel(fragment.getActivity());
    }
}

From source file:com.dazone.crewchat.libGallery.async.VideoLoadAsync.java

public VideoLoadAsync(Fragment fragment, ImageView imageView, boolean isScrolling, int width) {
    mImageView = imageView;/*w  ww  . j a v a 2  s. co  m*/
    this.fragment = fragment;
    mWidth = width;
    mIsScrolling = isScrolling;

    final int memClass = ((ActivityManager) fragment.getActivity().getSystemService(Context.ACTIVITY_SERVICE))
            .getMemoryClass();
    final int size = 1024 * 1024 * memClass / 8;

    // Handle orientation change.
    GalleryRetainCache c = GalleryRetainCache.getOrCreateRetainableCache();
    mCache = c.mRetainedCache;

    if (mCache == null) {
        // The maximum bitmap pixels allowed in respective direction.
        // If exceeding, the cache will automatically scale the
        // bitmaps.
        /*   final int MAX_PIXELS_WIDTH  = 100;
        final int MAX_PIXELS_HEIGHT = 100;*/
        mCache = new GalleryCache(size, mWidth, mWidth);
        c.mRetainedCache = mCache;
    }
}

From source file:com.media.VideoLoadAsync.java

public VideoLoadAsync(Fragment fragment, ImageView imageView, boolean isScrolling, int width) {
    mImageView = imageView;/*from  w w  w  . j ava  2  s.co m*/
    this.fragment = fragment;
    mWidth = width;
    mIsScrolling = isScrolling;

    final int memClass = ((ActivityManager) fragment.getActivity().getSystemService(Context.ACTIVITY_SERVICE))
            .getMemoryClass();
    final int size = 1024 * 1024 * memClass / 8;

    // Handle orientation change.
    GalleryRetainCache c = GalleryRetainCache.getOrCreateRetainableCache();
    mCache = c.mRetainedCache;

    if (mCache == null) {
        // The maximum bitmap pixels allowed in respective direction.
        // If exceeding, the cache will automatically scale the
        // bitmaps.
        /*
         * final int MAX_PIXELS_WIDTH = 100; final int MAX_PIXELS_HEIGHT =
         * 100;
         */
        mCache = new GalleryCache(size, mWidth, mWidth);
        c.mRetainedCache = mCache;
    }
}

From source file:com.hellofyc.base.app.AppSupportDelegate.java

private AppSupportDelegate(Fragment fragment) {
    mActivity = fragment.getActivity();
}

From source file:org.alfresco.mobile.android.application.fragments.activitystream.ActivityFeedAdapter.java

public ActivityFeedAdapter(Fragment fr, int textViewResourceId, List<ActivityEntry> listItems,
        List<ActivityEntry> selectedItems) {
    super(fr, textViewResourceId, listItems, selectedItems);
    this.renditionManager = RenditionManagerImpl.getInstance(fr.getActivity());
    this.fr = fr;
}