Search in sources :

Example 31 with AbsListView

use of android.widget.AbsListView in project platform_frameworks_base by android.

the class ChooserActivity method onPrepareAdapterView.

@Override
public void onPrepareAdapterView(AbsListView adapterView, ResolveListAdapter adapter, boolean alwaysUseOption) {
    final ListView listView = adapterView instanceof ListView ? (ListView) adapterView : null;
    mChooserListAdapter = (ChooserListAdapter) adapter;
    if (mCallerChooserTargets != null && mCallerChooserTargets.length > 0) {
        mChooserListAdapter.addServiceResults(null, Lists.newArrayList(mCallerChooserTargets));
    }
    mChooserRowAdapter = new ChooserRowAdapter(mChooserListAdapter);
    mChooserRowAdapter.registerDataSetObserver(new OffsetDataSetObserver(adapterView));
    adapterView.setAdapter(mChooserRowAdapter);
    if (listView != null) {
        listView.setItemsCanFocus(true);
    }
}
Also used : ListView(android.widget.ListView) AbsListView(android.widget.AbsListView)

Example 32 with AbsListView

use of android.widget.AbsListView in project platform_frameworks_base by android.

the class ResolverDrawerLayout method findListChildUnder.

private View findListChildUnder(float x, float y) {
    View v = findChildUnder(x, y);
    while (v != null) {
        x -= v.getX();
        y -= v.getY();
        if (v instanceof AbsListView) {
            // One more after this.
            return findChildUnder((ViewGroup) v, x, y);
        }
        v = v instanceof ViewGroup ? findChildUnder((ViewGroup) v, x, y) : null;
    }
    return v;
}
Also used : ViewGroup(android.view.ViewGroup) AbsListView(android.widget.AbsListView) View(android.view.View) AbsListView(android.widget.AbsListView)

Example 33 with AbsListView

use of android.widget.AbsListView in project platform_frameworks_base by android.

the class ResolverDrawerLayout method getHeightUsed.

private int getHeightUsed(View child) {
    // This method exists because we're taking a fast path at measuring ListViews that
    // lets us get away with not doing the more expensive wrap_content measurement which
    // imposes double child view measurement costs. If we're looking at a ListView, we can
    // check against the lowest child view plus padding and margin instead of the actual
    // measured height of the ListView. This lets the ListView hang off the edge when
    // all of the content would fit on-screen.
    int heightUsed = child.getMeasuredHeight();
    if (child instanceof AbsListView) {
        final AbsListView lv = (AbsListView) child;
        final int lvPaddingBottom = lv.getPaddingBottom();
        int lowest = 0;
        for (int i = 0, N = lv.getChildCount(); i < N; i++) {
            final int bottom = lv.getChildAt(i).getBottom() + lvPaddingBottom;
            if (bottom > lowest) {
                lowest = bottom;
            }
        }
        if (lowest < heightUsed) {
            heightUsed = lowest;
        }
    }
    final LayoutParams lp = (LayoutParams) child.getLayoutParams();
    return lp.topMargin + heightUsed + lp.bottomMargin;
}
Also used : AbsListView(android.widget.AbsListView)

Example 34 with AbsListView

use of android.widget.AbsListView in project frostwire by frostwire.

the class VerticalScrollListener method onScroll.

/**
 * {@inheritDoc}
 */
@Override
public void onScroll(final AbsListView view, final int firstVisibleItem, final int visibleItemCount, final int totalItemCount) {
    view.setVerticalScrollBarEnabled(firstVisibleItem > 0);
    if (mTabCarousel == null || mTabCarousel.isTabCarouselIsAnimating()) {
        return;
    }
    final View top = view.getChildAt(firstVisibleItem);
    if (top == null) {
        return;
    }
    if (firstVisibleItem > 0) {
        mTabCarousel.moveToYCoordinate(mPageIndex, -mTabCarousel.getAllowedVerticalScrollLength());
        return;
    }
    float y = view.getChildAt(firstVisibleItem).getY();
    final float amtToScroll = Math.max(y, -mTabCarousel.getAllowedVerticalScrollLength());
    mTabCarousel.moveToYCoordinate(mPageIndex, amtToScroll);
}
Also used : View(android.view.View) AbsListView(android.widget.AbsListView)

Example 35 with AbsListView

use of android.widget.AbsListView in project android by nextcloud.

the class LocalFileListAdapter method getView.

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    View view = convertView;
    File file = null;
    boolean isGridView = true;
    ImageView checkBoxV = view.findViewById(R.id.custom_checkbox);
    TextView fileSizeV = view.findViewById(R.id.file_size);
    TextView fileSizeSeparatorV = view.findViewById(R.id.file_separator);
    if (!isGridView) {
        TextView lastModV = view.findViewById(R.id.last_mod);
        lastModV.setVisibility(View.VISIBLE);
        lastModV.setText(DisplayUtils.getRelativeTimestamp(mContext, file.lastModified()));
        view.findViewById(R.id.overflow_menu).setVisibility(View.GONE);
    }
    if (!file.isDirectory()) {
        if (!isGridView) {
            fileSizeSeparatorV.setVisibility(View.VISIBLE);
            fileSizeV.setVisibility(View.VISIBLE);
            fileSizeV.setText(DisplayUtils.bytesToHumanReadable(file.length()));
        }
        AbsListView parentList = (AbsListView) parent;
        if (parentList.getChoiceMode() == ListView.CHOICE_MODE_NONE) {
            checkBoxV.setVisibility(View.GONE);
        } else {
            if (parentList.isItemChecked(position)) {
                checkBoxV.setImageResource(R.drawable.ic_checkbox_marked);
            } else {
                checkBoxV.setImageResource(R.drawable.ic_checkbox_blank_outline);
            }
            checkBoxV.setVisibility(View.VISIBLE);
        }
    } else {
        if (!isGridView) {
            fileSizeSeparatorV.setVisibility(View.GONE);
            fileSizeV.setVisibility(View.GONE);
        }
        checkBoxV.setVisibility(View.GONE);
    }
    // not GONE; the alignment changes; ugly way to keep it
    view.findViewById(R.id.localFileIndicator).setVisibility(View.INVISIBLE);
    view.findViewById(R.id.keptOfflineIcon).setVisibility(View.GONE);
    view.findViewById(R.id.favorite_action).setVisibility(View.GONE);
    view.findViewById(R.id.sharedIcon).setVisibility(View.GONE);
    return view;
}
Also used : AbsListView(android.widget.AbsListView) TextView(android.widget.TextView) ImageView(android.widget.ImageView) ImageView(android.widget.ImageView) View(android.view.View) AbsListView(android.widget.AbsListView) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) ListView(android.widget.ListView) File(java.io.File)

Aggregations

AbsListView (android.widget.AbsListView)218 View (android.view.View)126 ListView (android.widget.ListView)80 AdapterView (android.widget.AdapterView)54 TextView (android.widget.TextView)46 ViewGroup (android.view.ViewGroup)33 ImageView (android.widget.ImageView)29 RecyclerView (android.support.v7.widget.RecyclerView)21 GridView (android.widget.GridView)21 SuppressLint (android.annotation.SuppressLint)20 ScrollView (android.widget.ScrollView)20 OnScrollListener (android.widget.AbsListView.OnScrollListener)19 Intent (android.content.Intent)17 ArrayList (java.util.ArrayList)16 Context (android.content.Context)12 Point (android.graphics.Point)12 Handler (android.os.Handler)12 ExpandableListView (android.widget.ExpandableListView)12 ArrayListLoader (com.klinker.android.twitter.adapters.ArrayListLoader)10 ItemManager (org.lucasr.smoothie.ItemManager)10