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);
}
}
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;
}
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;
}
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);
}
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;
}
Aggregations