Example usage for android.view ViewGroup getContext

List of usage examples for android.view ViewGroup getContext

Introduction

In this page you can find the example usage for android.view ViewGroup getContext.

Prototype

@ViewDebug.CapturedViewProperty
public final Context getContext() 

Source Link

Document

Returns the context the view is running in, through which it can access the current theme, resources, etc.

Usage

From source file:com.ysy.classpower_utils.swipe_back.OwnViewDragHelper.java

/**
 * Factory method to create a new OwnViewDragHelper.
 *
 * @param forParent Parent view to monitor
 * @param cb        Callback to provide information and receive events
 * @return a new OwnViewDragHelper instance
 *///from w w  w  . j ava 2  s .co  m
public static OwnViewDragHelper create(ViewGroup forParent, Callback cb) {
    return new OwnViewDragHelper(forParent.getContext(), forParent, cb);
}

From source file:com.gbq.library.widget.swipeback.SwipeViewDragHelper.java

/**
 * Factory method to create a new ViewDragHelper.
 *
 * @param forParent Parent view to monitor
 * @param cb        Callback to provide information and receive events
 * @return a new ViewDragHelper instance
 *//* w ww .j  a v  a2s . co  m*/
public static SwipeViewDragHelper create(ViewGroup forParent, Callback cb) {
    return new SwipeViewDragHelper(forParent.getContext(), forParent, cb);
}

From source file:com.lastsoft.plog.adapter.GameAdapter.java

@Override
public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
    // Create a new view.
    View v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.game_row_item, viewGroup, false);

    return new ViewHolder(v);
}

From source file:com.phonemetra.turbo.keyboard.emoji.EmojiPalettesAdapter.java

@Override
public Object instantiateItem(final ViewGroup container, final int position) {

    final EmojiPageKeyboardView oldKeyboardView = mActiveKeyboardViews.get(position);
    if (oldKeyboardView != null) {
        oldKeyboardView.deallocateMemory();
        // This may be redundant but wanted to be safer..
        mActiveKeyboardViews.remove(position);
    }//  w w w .  j  av a 2 s.c o m
    final Keyboard keyboard = mEmojiCategory.getKeyboardFromPagePosition(position);
    final LayoutInflater inflater = LayoutInflater.from(container.getContext());
    final EmojiPageKeyboardView keyboardView = (EmojiPageKeyboardView) inflater
            .inflate(R.layout.emoji_keyboard_page, container, false /* attachToRoot */);
    keyboardView.setKeyboard(keyboard);
    keyboardView.setOnKeyEventListener(mListener);
    container.addView(keyboardView);
    mActiveKeyboardViews.put(position, keyboardView);
    return keyboardView;
}

From source file:com.example.administrator.demo.activity.sbackapp.SwipeBackViewDragHelper.java

/**
 * Factory method to create a new ViewDragHelper.
 *
 * @param forParent Parent view to monitor
 * @param cb        Callback to provide information and receive events
 * @return a new ViewDragHelper instance
 *//*from ww  w  . ja  va2  s.c  om*/
public static SwipeBackViewDragHelper create(ViewGroup forParent, Callback cb) {
    return new SwipeBackViewDragHelper(forParent.getContext(), forParent, cb);
}

From source file:com.lloydtorres.stately.region.CommunityRecyclerAdapter.java

@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    RecyclerView.ViewHolder viewHolder = null;
    LayoutInflater inflater = LayoutInflater.from(parent.getContext());

    switch (viewType) {
    case BUTTON_CARD:
        View rmbCard = inflater.inflate(R.layout.card_button, parent, false);
        viewHolder = new MessageBoardCard(context, rmbCard);
        break;//w ww  .j  a v a2  s  .c  o m
    case POLL_CARD:
        View pollCard = inflater.inflate(R.layout.card_poll, parent, false);
        viewHolder = new PollCard(context, pollCard);
        break;
    case WA_CARD:
        View waCard = inflater.inflate(R.layout.card_region_wa, parent, false);
        viewHolder = new RegionWaCard(context, waCard);
        break;
    case OFFICER_CARD:
        View officerCard = inflater.inflate(R.layout.card_officers, parent, false);
        viewHolder = new OfficerCard(context, officerCard);
        break;
    case EMBASSY_CARD:
        View embassyCard = inflater.inflate(R.layout.card_embassies, parent, false);
        viewHolder = new EmbassyCard(context, embassyCard);
        break;
    }
    return viewHolder;
}

From source file:com.example.minhttruong.parsedemo.feature.content.MoviesTab.java

@Nullable
@Override// w w  w . j a v  a  2s. co  m
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.movies_grid, container, false);
    SwipeRefreshLayout srl = (SwipeRefreshLayout) v.findViewById(R.id.refresh_view);
    mSwipeViewRef = Utils.createRef(srl);
    srl.setOnRefreshListener(this);
    RecyclerView rv = (RecyclerView) v.findViewById(R.id.rv_content);
    GridLayoutManager glm = new GridLayoutManager(container.getContext(),
            getResources().getInteger(R.integer.num_of_columns), GridLayoutManager.VERTICAL, false);
    rv.setLayoutManager(glm);
    rv.setAdapter(mAdapter);
    mAdapter.setClickRef(mCLickRef);
    getMovies();
    return v;
}

From source file:cn.zmdx.kaka.locker.widget.ViewDragHelper.java

/**
 * Factory method to create a new ViewDragHelper.
 * //from   w w  w .j a v  a 2s.c o m
 * @param forParent Parent view to monitor
 * @param cb Callback to provide information and receive events
 * @return a new ViewDragHelper instance
 */
public static ViewDragHelper create(ViewGroup forParent, Callback cb, Interpolator interpolator) {
    return new ViewDragHelper(forParent.getContext(), forParent, cb, interpolator);
}

From source file:com.example.isse.weatherapp.adapter.MyWeatherCursorAdapter.java

@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    ViewHolder vh;/*from  w  w  w.j  a  va  2 s  . c  o m*/
    if (parent instanceof RecyclerView) {
        int layoutId = -1;
        switch (viewType) {
        case TODAY_LAYOUT: {
            layoutId = R.layout.weather_list_content_today;
            break;
        }
        case FUTURE_LAYOUT: {
            layoutId = R.layout.weather_list_content;
            break;
        }

        }
        View itemView = LayoutInflater.from(parent.getContext()).inflate(layoutId, parent, false);
        itemView.setFocusable(false);
        vh = new ViewHolder(itemView);
    } else {
        throw new RuntimeException("Not bound to RecyclerView");
    }
    return vh;
}

From source file:com.lloydtorres.stately.telegrams.TelegramsAdapter.java

@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    RecyclerView.ViewHolder viewHolder;/*from  ww w. ja v a2s  .c  om*/
    LayoutInflater inflater = LayoutInflater.from(parent.getContext());

    switch (viewType) {
    case FULL_CARD:
        View fullCard = inflater.inflate(R.layout.card_telegram, parent, false);
        viewHolder = new TelegramCard(context, fullCard);
        break;
    case PREVIEW_CARD:
        View previewCard = inflater.inflate(R.layout.card_telegram_preview, parent, false);
        viewHolder = new TelegramPreviewCard(context, previewCard);
        break;
    default:
        View emptyCard = inflater.inflate(R.layout.card_happening, parent, false);
        viewHolder = new NoTelegramsCard(context, emptyCard);
        break;
    }

    return viewHolder;
}