Java Code Examples for android.widget.ListView#getContext()

The following examples show how to use android.widget.ListView#getContext() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ThreadshotPerformer.java    From Dashchan with Apache License 2.0 6 votes vote down vote up
public ThreadshotPerformer(ListView listView, UiManager uiManager, String chanName, String boardName,
		String threadNumber, String threadTitle, List<PostItem> postItems) {
	this.listView = listView;
	this.uiManager = uiManager;
	this.chanName = chanName;
	this.boardName = boardName;
	this.threadNumber = threadNumber;
	this.threadTitle = threadTitle;
	this.postItems = postItems;
	dialog = new ProgressDialog(listView.getContext());
	dialog.setMessage(listView.getContext().getString(R.string.message_processing_data));
	dialog.setCanceledOnTouchOutside(false);
	dialog.setOnCancelListener(this);
	dialog.show();
	// isBusy == true, because I must prevent view handling in main thread
	demandSet.isBusy = true;
	demandSet.selectionMode = UiManager.SELECTION_THREADSHOT;
	asyncTask.executeOnExecutor(ConcurrentUtils.SEPARATE_EXECUTOR);
}
 
Example 2
Source File: FadingActionBarHelperBase.java    From ALLGO with Apache License 2.0 6 votes vote down vote up
private View createListView(ListView listView) {
    mContentContainer = (ViewGroup) mInflater.inflate(R.layout.fab__listview_container, null);
    mContentContainer.addView(mContentView);

    mHeaderContainer = (FrameLayout) mContentContainer.findViewById(R.id.fab__header_container);
    initializeGradient(mHeaderContainer);
    mHeaderContainer.addView(mHeaderView, 0);

    mMarginView = new FrameLayout(listView.getContext());
    mMarginView.setLayoutParams(new AbsListView.LayoutParams(LayoutParams.MATCH_PARENT, 0));
    listView.addHeaderView(mMarginView, null, false);

    // Make the background as high as the screen so that it fills regardless of the amount of scroll. 
    mListViewBackgroundView = mContentContainer.findViewById(R.id.fab__listview_background);
    FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) mListViewBackgroundView.getLayoutParams();
    params.height = Utils.getDisplayHeight(listView.getContext());
    mListViewBackgroundView.setLayoutParams(params);

    listView.setOnScrollListener(mOnScrollListener);
    return mContentContainer;
}
 
Example 3
Source File: FadingActionBarHelperBase.java    From UltimateAndroid with Apache License 2.0 6 votes vote down vote up
private View createListView(ListView listView) {
    ViewGroup contentContainer = (ViewGroup) mInflater.inflate(R.layout.fab__listview_container, null);
    contentContainer.addView(mContentView);

    mHeaderContainer = (FrameLayout) contentContainer.findViewById(R.id.fab__header_container);
    initializeGradient(mHeaderContainer);
    mHeaderContainer.addView(mHeaderView, 0);

    mMarginView = new FrameLayout(listView.getContext());
    mMarginView.setLayoutParams(new AbsListView.LayoutParams(LayoutParams.MATCH_PARENT, 0));
    listView.addHeaderView(mMarginView, null, false);

    // Make the background as high as the screen so that it fills regardless of the amount of scroll. 
    mListViewBackgroundView = contentContainer.findViewById(R.id.fab__listview_background);
    FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) mListViewBackgroundView.getLayoutParams();
    params.height = Utils.getDisplayHeight(listView.getContext());
    mListViewBackgroundView.setLayoutParams(params);

    listView.setOnScrollListener(mOnScrollListener);
    return contentContainer;
}
 
Example 4
Source File: FadingActionBarHelperBase.java    From UltimateAndroid with Apache License 2.0 6 votes vote down vote up
private View createListView(ListView listView) {
    ViewGroup contentContainer = (ViewGroup) mInflater.inflate(R.layout.fab__listview_container, null);
    contentContainer.addView(mContentView);

    mHeaderContainer = (FrameLayout) contentContainer.findViewById(R.id.fab__header_container);
    initializeGradient(mHeaderContainer);
    mHeaderContainer.addView(mHeaderView, 0);

    mMarginView = new FrameLayout(listView.getContext());
    mMarginView.setLayoutParams(new AbsListView.LayoutParams(LayoutParams.MATCH_PARENT, 0));
    listView.addHeaderView(mMarginView, null, false);

    // Make the background as high as the screen so that it fills regardless of the amount of scroll. 
    mListViewBackgroundView = contentContainer.findViewById(R.id.fab__listview_background);
    FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) mListViewBackgroundView.getLayoutParams();
    params.height = Utils.getDisplayHeight(listView.getContext());
    mListViewBackgroundView.setLayoutParams(params);

    listView.setOnScrollListener(mOnScrollListener);
    return contentContainer;
}
 
Example 5
Source File: FadingActionBarHelperBase.java    From Favorite-Android-Client with Apache License 2.0 6 votes vote down vote up
private View createListView(ListView listView) {
    ViewGroup contentContainer = (ViewGroup) mInflater.inflate(R.layout.fab__listview_container, null);
    contentContainer.addView(mContentView);

    mHeaderContainer = (FrameLayout) contentContainer.findViewById(R.id.fab__header_container);
    initializeGradient(mHeaderContainer);
    mHeaderContainer.addView(mHeaderView, 0);

    mMarginView = new FrameLayout(listView.getContext());
    mMarginView.setLayoutParams(new AbsListView.LayoutParams(LayoutParams.MATCH_PARENT, 0));
    listView.addHeaderView(mMarginView, null, false);

    // Make the background as high as the screen so that it fills regardless of the amount of scroll. 
    mListViewBackgroundView = contentContainer.findViewById(R.id.fab__listview_background);
    FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) mListViewBackgroundView.getLayoutParams();
    params.height = Utils.getDisplayHeight(listView.getContext());
    mListViewBackgroundView.setLayoutParams(params);

    listView.setOnScrollListener(mOnScrollListener);
    return contentContainer;
}
 
Example 6
Source File: FadingActionBarHelperBase.java    From FadingActionBar with Apache License 2.0 6 votes vote down vote up
private View createListView(ListView listView) {
    ViewGroup contentContainer = (ViewGroup) mInflater.inflate(R.layout.fab__listview_container, null);
    contentContainer.addView(mContentView);

    mHeaderContainer = (FrameLayout) contentContainer.findViewById(R.id.fab__header_container);
    initializeGradient(mHeaderContainer);
    mHeaderContainer.addView(mHeaderView, 0);

    mMarginView = new FrameLayout(listView.getContext());
    mMarginView.setLayoutParams(new AbsListView.LayoutParams(LayoutParams.MATCH_PARENT, 0));
    listView.addHeaderView(mMarginView, null, false);

    // Make the background as high as the screen so that it fills regardless of the amount of scroll. 
    mListViewBackgroundView = contentContainer.findViewById(R.id.fab__listview_background);
    FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) mListViewBackgroundView.getLayoutParams();
    params.height = Utils.getDisplayHeight(listView.getContext());
    mListViewBackgroundView.setLayoutParams(params);

    listView.setOnScrollListener(mOnScrollListener);
    return contentContainer;
}
 
Example 7
Source File: TileOrderActivity.java    From GravityBox with Apache License 2.0 5 votes vote down vote up
void showMenu(final ListView listView, final View anchorView) {
    final PopupMenu menu = new PopupMenu(listView.getContext(), anchorView);
    menu.inflate(R.menu.tile_menu);
    menu.setOnMenuItemClickListener(new OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem item) {
            switch (item.getItemId()) {
                case R.id.tile_dual:
                    dual = !dual;
                    break;
                case R.id.tile_locked:
                    locked = !locked;
                    if (locked) {
                        secured = true;
                        lockedOnly = false;
                    }
                    break;
                case R.id.tile_locked_only:
                    lockedOnly = !lockedOnly;
                    break;
                case R.id.tile_secured:
                    secured = !secured;
                    break;
            }
            updateMenu(menu.getMenu());
            listView.invalidateViews();
            return true;
        }
    });
    updateMenu(menu.getMenu());
    menu.show();
}