本文整理汇总了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);
}
示例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);
}
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}
示例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();
}
示例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);
}
示例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;
}
示例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;
}
示例11: Builder
import android.support.v4.app.Fragment; //导入方法依赖的package包/类
public Builder(Fragment fragment) {
this.context = fragment.getContext();
}
示例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;
}
示例13: BeautyPhotosAdapter
import android.support.v4.app.Fragment; //导入方法依赖的package包/类
public BeautyPhotosAdapter(Fragment fragment) {
this(fragment.getContext());
mFragment = fragment;
}
示例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);
}
示例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;
}