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:com.j1024.mcommon.support.McAbsCallback.java

private void init(Fragment fragment, LoadingLayout loadingLayout) {
    if (fragment == null)
        throw new RuntimeException("fragment should not be null when init ReqCallback");

    mFragmentRef = new WeakReference<Fragment>(fragment);
    init(fragment.getActivity(), loadingLayout);
}

From source file:com.core.base.js.UploadHandler.java

public UploadHandler(Fragment fragment) {
    this.fragment = fragment;
    this.activity = fragment.getActivity();

}

From source file:com.svpino.longhorn.artifacts.StockTileProcessor.java

public static void create(Fragment fragment, TableLayout tableLayout, List<Stock> stocks,
        SparseArray<View> tiles, boolean restart) {

    if (restart) {
        tableLayout.removeAllViews();/*from   w  w w. j a  va 2s  . co  m*/
        if (tiles != null) {
            tiles.clear();
        }
    }

    tableLayout.setStretchAllColumns(true);
    tableLayout.setShrinkAllColumns(true);

    int margin = Extensions.dpToPixels(fragment.getResources(), 3);
    int height = Extensions.dpToPixels(fragment.getResources(), 90);

    int index = createFixedHeaderRow(fragment, tableLayout, stocks, tiles, height, margin);

    int row = index == 3 ? 1 : 0;

    while (index < stocks.size()) {
        index = createStandardRow(fragment, tableLayout, stocks, tiles, height, margin, index, row);
        row++;
    }

    while (tableLayout.getChildCount() > row) {
        tableLayout.removeViewAt(tableLayout.getChildCount() - 1);
    }

    if (stocks.size() % 2 != 0) {
        TableRow tableRow = new TableRow(fragment.getActivity());

        View addNewStockTile = createTileForAddingNewStock(fragment);
        tableRow.addView(addNewStockTile, getSpannedLayoutParams(row, margin, height));

        tableLayout.addView(tableRow);
    } else {
        TableRow tableRow = (TableRow) tableLayout.getChildAt(tableLayout.getChildCount() - 1);
        LayoutParams layoutParams = (TableRow.LayoutParams) tableRow.getChildAt(0).getLayoutParams();
        layoutParams.bottomMargin = margin;
        layoutParams.height = height;
    }
}

From source file:itkach.aard2.SettingsListAdapter.java

SettingsListAdapter(Fragment fragment) {
    this.fragment = fragment;
    this.context = fragment.getActivity();

    this.userStylePrefs = context.getSharedPreferences("userStyles", Activity.MODE_PRIVATE);
    this.userStylePrefs.registerOnSharedPreferenceChangeListener(this);

    this.onDeleteUserStyle = new View.OnClickListener() {
        @Override/*from  w  w  w .  j  a  v  a 2 s.  c o m*/
        public void onClick(View view) {
            String name = (String) view.getTag();
            deleteUserStyle(name);
        }
    };
}

From source file:org.immopoly.android.adapter.FlatsPagerAdapter.java

public FlatsPagerAdapter(ArrayList<Flat> flats, Fragment context, boolean inPortfolio) {
    this.mContext = context;
    this.flats = flats;
    this.views = new View[flats.size()];
    this.inPortfolio = inPortfolio;
    this.imageDownloader = Settings.getExposeImageDownloader(context.getActivity());
}

From source file:com.facebook.internal.FacebookDialogBase.java

protected FacebookDialogBase(final Fragment fragment, int requestCode) {
    Validate.notNull(fragment, "fragment");
    this.fragment = fragment;
    this.activity = null;
    this.requestCode = requestCode;

    if (fragment.getActivity() == null) {
        throw new IllegalArgumentException("Cannot use a fragment that is not attached to an activity");
    }/* w w w .j  a v  a 2 s. c  o m*/
}

From source file:yepeer.le.adapters.FilmHeaderRecyclerAdapter.java

public FilmHeaderRecyclerAdapter(Fragment fragment, ArrayList<FilmModel> items, View headerView,
        EditAtPositionCallback editAtPositionCallback) {
    mInflater = LayoutInflater.from(fragment.getActivity());
    this.editAtPositionCallback = editAtPositionCallback;
    mItems = items;/*  w  w w . j a  va  2s  . c  o m*/
    mHeaderView = headerView;
    this.fragment = fragment;
}

From source file:com.amytech.android.library.views.imagechooser.api.BChooser.java

public BChooser(Fragment fragment, int type, boolean shouldCreateThumbnails) {
    this.fragment = fragment;
    this.type = type;
    this.shouldCreateThumbnails = shouldCreateThumbnails;
    initDirector(fragment.getActivity().getApplicationContext());
}

From source file:com.amytech.android.library.views.imagechooser.api.BChooser.java

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public BChooser(android.app.Fragment fragment, int type, boolean shouldCreateThumbnails) {
    this.appFragment = fragment;
    this.type = type;
    this.shouldCreateThumbnails = shouldCreateThumbnails;
    initDirector(fragment.getActivity().getApplicationContext());
}

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

public FileExplorerAdapter(Fragment fr, int textViewResourceId, int mode, List<File> listItems,
        List<File> selectedItems) {
    super(fr.getActivity(), textViewResourceId, listItems);
    this.fragmentRef = new WeakReference<Fragment>(fr);
    this.selectedItems = selectedItems;
    this.originalFiles = listItems;
    this.mode = mode;
    if (((BaseActivity) fr.getActivity()).getCurrentAccount() != null) {
        File f = AlfrescoStorageManager.getInstance(fr.getActivity())
                .getDownloadFolder(((BaseActivity) fr.getActivity()).getCurrentAccount());
        this.downloadPath = (f != null) ? f.getPath() : null;
    }//from   ww  w  .  j  a  v  a2  s . c o m
    this.renditionManager = RenditionManagerImpl.getInstance(fr.getActivity());
    this.vhClassName = TwoLinesProgressViewHolder.class.getCanonicalName();
}