本文整理匯總了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;
}