當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。