当前位置: 首页>>代码示例>>Java>>正文


Java Fragment.getContext方法代码示例

本文整理汇总了Java中android.support.v4.app.Fragment.getContext方法的典型用法代码示例。如果您正苦于以下问题:Java Fragment.getContext方法的具体用法?Java Fragment.getContext怎么用?Java Fragment.getContext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.support.v4.app.Fragment的用法示例。


在下文中一共展示了Fragment.getContext方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: launchForResult

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
public static void launchForResult(Fragment fragment, ArrayList<BeautyPhotoInfo> datas, int index) {
    Intent intent = new Intent(fragment.getContext(), BigPhotoActivity.class);
    intent.putParcelableArrayListExtra(BIG_PHOTO_KEY, datas);
    intent.putExtra(PHOTO_INDEX_KEY, index);
    intent.putExtra(FROM_LOVE_ACTIVITY, true);
    fragment.startActivityForResult(intent, CommonConstant.REQUEST_CODE);
    fragment.getActivity().overridePendingTransition(R.anim.expand_vertical_entry, R.anim.hold);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:9,代码来源:BigPhotoActivity.java

示例2: ShowCaseStepDisplayer

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
/**
 * @param scrollView scrollView to use on all {@link ShowCaseStep}'s that dictate
 *                   scrolling on activation.
 */
private ShowCaseStepDisplayer(@Nullable Activity activity, @Nullable Fragment fragment, @Nullable ScrollView scrollView) {

    this.activity = activity;
    this.fragment = fragment;
    this.scrollView = scrollView;

    //noinspection ConstantConditions
    this.context = activity != null ? activity : fragment.getContext();
    showCaseRadius = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 70,
            context.getResources().getDisplayMetrics());

    if (scrollView != null) {
        showCaseStepScroller = new ShowCaseStepScroller(scrollView);
    }
}
 
开发者ID:dimorinny,项目名称:show-case-card-view,代码行数:20,代码来源:ShowCaseStepDisplayer.java

示例3: providerView

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
/**
 * Provide the login view which will be shown on the login screen for this provider
 *
 * @param fragment   Login fragment. This is needed to inject activity result callbacks
 * @param parentView Parent view in which this view will be inflated.
 * @return Inflated view to be shown on screen
 */
public View providerView(Fragment fragment, ViewGroup parentView) {
    this.context = fragment.getContext();
    this.fragment = fragment;

    themeHelper = new ThemeHelper();

    View view = inflateView(parentView);
    View actionView = view.findViewById(getActionButtonId());
    if (actionView == null) {
        throw new RuntimeException("BaseProvider view needs a button with id R.id.login");
    }

    view.findViewById(getActionButtonId()).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            performAction();
        }
    });

    return view;
}
 
开发者ID:moldedbits,项目名称:argus-android,代码行数:29,代码来源:BaseProvider.java

示例4: show

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
public static void show(Fragment parent, ContactSourceType sourceType, boolean singleNumberMode) {
    Context context = parent.getContext();

    // check permission
    final String permission = ContactsAccessHelper.getPermission(sourceType);
    if (permission == null || Permissions.notifyIfNotGranted(context, permission)) {
        return;
    }

    // create fragment's args
    Bundle arguments = new Bundle();
    arguments.putSerializable(SOURCE_TYPE, sourceType);
    arguments.putBoolean(SINGLE_NUMBER_MODE, singleNumberMode);

    // open the dialog activity with the fragment
    CustomFragmentActivity.show(context, parent,
            getTitleId(context, sourceType),
            GetContactsFragment.class, arguments, 0);
}
 
开发者ID:kaliturin,项目名称:BlackList,代码行数:20,代码来源:GetContactsFragment.java

示例5: openPreview

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
/**
 * 照片预览
 *
 * @param fragment
 */
public void openPreview(Fragment fragment, String pathStr) {
    if (fragment == null || TextUtils.isEmpty(pathStr)) {
        return;
    }

    ArrayList<String> pathList = new ArrayList<>();
    pathList.add(pathStr);

    Context context = fragment.getContext();
    PhotoPreviewIntent previewIntent = new PhotoPreviewIntent(context);
    previewIntent.setCurrentItem(0);
    previewIntent.setPhotoPaths(pathList);
    previewIntent.setIsCanDelete(false);
    fragment.startActivityForResult(previewIntent, mRequestCode * 2);
}
 
开发者ID:Sugarya,项目名称:SugarPhotoPicker,代码行数:21,代码来源:SelectPhotoRecyclerView.java

示例6: getContext

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
public Context getContext() {
    Activity activity = getActivity();
    Fragment fragment = getFragment();
    if (activity == null && fragment == null) {
        return null;
    }
    if (activity == null) {
        return fragment.getContext();
    }
    if (fragment == null) {
        return activity;
    }
    return null;
}
 
开发者ID:Lizhny,项目名称:BigDataFortuneTelling,代码行数:15,代码来源:PermissionHelper.java

示例7: FastMainTabDelegate

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
public FastMainTabDelegate(View rootView, Fragment activity, IFastMainView iFastMainView) {
    this.mContext = activity.getContext();
    this.mObject = activity;
    this.mIFastMainView = iFastMainView;
    if (iFastMainView == null) {
        return;
    }
    getTabLayout(rootView);
    getViewPager(rootView);
    initTabLayout();
}
 
开发者ID:AriesHoo,项目名称:FastLib,代码行数:12,代码来源:FastMainTabDelegate.java

示例8: openAlbums

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
/**
 * 通过打开相册
 */
public void openAlbums(Fragment fragment) {
    if (fragment == null) {
        return;
    }
    int count = mPhotoLimitCount - mSelectPhotoAdapter.getBodyCount();
    Log.d(TAG, "openAlbums: count = " + count);
    Context context = fragment.getContext();
    PhotoPickerIntent pickIntent = new PhotoPickerIntent(context);
    pickIntent.setSelectModel(SelectModel.MULTI);
    pickIntent.setShowCarema(true); // 是否显示拍照
    pickIntent.setMaxTotal(count); // 最多选择照片数量
    fragment.startActivityForResult(pickIntent, mRequestCode);
}
 
开发者ID:Sugarya,项目名称:SugarPhotoPicker,代码行数:17,代码来源:SelectPhotoRecyclerView.java

示例9: FirstPageLoadMoreAdapter

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
public FirstPageLoadMoreAdapter(Fragment fragment, List<Stories> datas) {
    super(datas);
    this.context = fragment.getContext();
    this.fragment = fragment;
}
 
开发者ID:Mrqinlei,项目名称:ImitateZHRB,代码行数:6,代码来源:FirstPageLoadMoreAdapter.java

示例10: ThemeLoadMoreAdapter

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
public ThemeLoadMoreAdapter(Fragment fragment, List<Stories> datas) {
    super(datas);
    this.context = fragment.getContext();
    this.fragment = fragment;
}
 
开发者ID:Mrqinlei,项目名称:ImitateZHRB,代码行数:6,代码来源:ThemeLoadMoreAdapter.java

示例11: Builder

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
public Builder(Fragment fragment) {
    this.context = fragment.getContext();
}
 
开发者ID:appwise-labs,项目名称:NoInternetDialog,代码行数:4,代码来源:NoInternetDialog.java

示例12: VideoInfoAdapter

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
public VideoInfoAdapter(Fragment fragment) {
    mContext = fragment.getContext();
    float value = fragment.getResources().getDimension(R.dimen.video_type_card_height);
    image_width = (int) value;
    image_height = (int) value * 5 / 3;
}
 
开发者ID:haihaio,项目名称:AmenEye,代码行数:7,代码来源:VideoInfoAdapter.java

示例13: BeautyPhotosAdapter

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
public BeautyPhotosAdapter(Fragment fragment) {
    this(fragment.getContext());
    mFragment = fragment;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:5,代码来源:BeautyPhotosAdapter.java

示例14: startTransparentBase

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
public static void startTransparentBase(Fragment context, ArrayList<SmoothPermission> smoothPermissions, int styleRes, int requestCode, boolean buildAnyway) {
    Intent rationaleIntent = new Intent(context.getContext(), RationaleBase.class);
    initRationaleIntent(rationaleIntent, smoothPermissions, styleRes, requestCode, buildAnyway);
    context.startActivityForResult(rationaleIntent, requestCode);
}
 
开发者ID:KingsMentor,项目名称:Rationale,代码行数:6,代码来源:RationaleBase.java

示例15: VideoTopPagerAdapter

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
public VideoTopPagerAdapter(Fragment fragment, List<RetDataBean.ListBean.ChildListBean> banders) {
    mContext = fragment.getContext();
    mActivity = fragment.getActivity();
    mBanders = banders;
}
 
开发者ID:haihaio,项目名称:AmenEye,代码行数:6,代码来源:VideoTopPagerAdapter.java


注:本文中的android.support.v4.app.Fragment.getContext方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。