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:org.alfresco.mobile.android.application.fragments.user.UserAdapter.java

public UserAdapter(Fragment fr, int textViewResourceId, List<Person> listItems, boolean isEditable) {
    super(fr, textViewResourceId, listItems);
    this.fragmentRef = new WeakReference<>(fr);
    this.renditionManager = RenditionManagerImpl.getInstance(fr.getActivity());
    ((RenditionManagerImpl) this.renditionManager).setCurrentActivity(fr.getActivity());
    this.isEditable = isEditable;
}

From source file:com.hiqes.andele.RequestOwnerSupportFragment.java

@Override
public boolean isParentActivity(Object obj) {
    boolean ret = false;
    Activity otherAct;/*w  ww  . j a  v  a 2  s.  c o m*/
    Fragment frag = getFragment();

    try {
        otherAct = (Activity) obj;
        if (frag != null) {
            Activity parentAct = frag.getActivity();

            if ((parentAct != null) && (parentAct == otherAct)) {
                ret = true;
            }
        }
    } catch (ClassCastException e) {
        //  Ignore
    }
    return ret;
}

From source file:com.example.levelup.core.app.ProgressDialogLoaderCallbacks.java

/**
 * @param fragment the fragment displaying the progress dialog. This will be kept using a weak
 *        reference./*  w  w  w  .j  a  v a2 s  . c o m*/
 * @param loaderId the ID of the loader that will be used with this dialog.
 * @param titleId the resource ID of the title string.
 * @param messageId the resource ID of the message string.
 * @param fragmentTag the tag of the progress dialog fragment.
 */
public ProgressDialogLoaderCallbacks(Fragment fragment, int loaderId, int titleId, int messageId,
        String fragmentTag) {
    mFragment = new WeakReference<Fragment>(fragment);
    mApplicationContext = fragment.getActivity().getApplicationContext();
    mTitleId = titleId;
    mMessageId = messageId;
    mFragmentTag = fragmentTag;
    mLoaderId = loaderId;
}

From source file:org.alfresco.mobile.android.application.managers.DataProtectionManagerImpl.java

public void executeAction(Fragment fragment, int intentAction, File f) {
    try {/*from   w  w w  . j a  va  2 s  .  co m*/
        if (intentAction == DataProtectionManager.ACTION_NONE || intentAction == 0) {
            return;
        }
        Intent i = createActionIntent(fragment.getActivity(), intentAction, f);
        if (i.resolveActivity(fragment.getActivity().getPackageManager()) == null) {
            AlfrescoNotificationManager.getInstance(fragment.getActivity())
                    .showAlertCrouton(fragment.getActivity(), fragment.getString(R.string.feature_disable));
        } else {
            fragment.startActivityForResult(i, PrivateRequestCode.DECRYPTED);
        }
    } catch (ActivityNotFoundException e) {

    }
}

From source file:com.todoroo.astrid.taskrabbit.TaskRabbitControlSet.java

public TaskRabbitControlSet(Fragment fragment, int displayViewLayout) {
    super(fragment.getActivity(), displayViewLayout);
    this.fragment = fragment;
    DependencyInjectionService.getInstance().inject(this);

    displayText = (TextView) getView().findViewById(R.id.display_row_title);
    if (displayText != null) {
        displayText.setMaxLines(2);/*from  w ww . j  a v a 2  s . c o m*/
    }

    if (getView() != null) {
        getView().setOnClickListener(getDisplayClickListener());
    }
    loadLocation();
}

From source file:org.alfresco.mobile.android.application.fragments.fileexplorer.LibraryCursorAdapter.java

public LibraryCursorAdapter(Fragment fr, Cursor c, int layoutId, List<File> selectedItems, int mediaTypeId,
        int mode) {
    super(fr.getActivity(), c, layoutId);
    this.fragmentRef = new WeakReference<Fragment>(fr);
    this.selectedItems = selectedItems;
    this.sdcardPath = Environment.getExternalStorageDirectory().getPath();
    File f = AlfrescoStorageManager.getInstance(context)
            .getDownloadFolder(((BaseActivity) fr.getActivity()).getCurrentAccount());
    this.downloadPath = (f != null) ? f.getPath() : sdcardPath;
    this.mediaTypeId = mediaTypeId;
    this.mode = mode;
    this.renditionManager = RenditionManagerImpl.getInstance(fr.getActivity());
    this.vhClassName = TwoLinesViewHolder.class.getCanonicalName();
}

From source file:org.alfresco.mobile.android.application.ui.form.adapter.AuthorityAdapter.java

public AuthorityAdapter(Fragment fr, int textViewResourceId, List<Person> listItems, String propertyId) {
    super(fr, textViewResourceId, listItems);
    this.fragmentRef = new WeakReference<Fragment>(fr);
    this.renditionManager = RenditionManagerImpl.getInstance(fr.getActivity());
    ((RenditionManagerImpl) this.renditionManager).setCurrentActivity(fr.getActivity());
    this.outputValue = propertyId;
}

From source file:net.bither.util.MonitorBitherColdUtil.java

public MonitorBitherColdUtil(Activity activity, Fragment fragment, MonitorBitherColdUtilDelegate delegate) {
    this.fragment = fragment;
    if (fragment != null && activity == null) {
        activity = fragment.getActivity();
    }// ww  w.  j  ava2  s  . co m
    this.activity = activity;
    this.delegate = delegate;
    dp = new DialogProgress(activity, R.string.please_wait);
    dp.setCancelable(false);
}

From source file:org.alfresco.mobile.android.application.fragments.user.UserAdapter.java

public UserAdapter(Fragment fr, int textViewResourceId, List<Person> listItems,
        Map<String, Person> selectedItems) {
    super(fr, textViewResourceId, listItems, selectedItems);
    this.fragmentRef = new WeakReference<>(fr);
    this.activityRef = new WeakReference<>(fr.getActivity());
    this.renditionManager = RenditionManagerImpl.getInstance(fr.getActivity());
    ((RenditionManagerImpl) this.renditionManager).setCurrentActivity(fr.getActivity());
}

From source file:com.hiqes.andele.RequestOwnerSupportFragment.java

@Override
PackageManager getPackageManager() {//from ww  w.  ja  v a2s.  c  o  m
    Fragment frag = getFragment();

    //  Do not check for null, if this fails we have a state problem and
    //  the NPE we'll get will be helpful to track it down.
    return frag.getActivity().getPackageManager();
}