use of android.widget.AbsListView in project android-app-common-tasks by multidots.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mContext = MainActivity.this;
//Activity mActivity = MainActivity.this;
tvText = (TextView) findViewById(R.id.text);
String[] sdkFunctionalityListValue = new String[] { "Validations", /* 0 */
"Internet availability", /* 1 */
"Date formats", /* 2 */
"Device id", /* 3 */
"Set preferences", /* 4 */
"Get preferences", /* 5 */
"Get current location", /* 6 */
"Pinchzoom image", /* 7 */
"Get application icon", /* 8 */
"Send notification", /* 9 */
"Get random character from A to Z", /* 10 */
"Screen sleep mode on off", /* 11 */
"Open image from path", /* 12 */
"Open video from path", /* 13 */
"Open url in browser", /* 14 */
"Show address on map", /* 15 */
"Create folder or directory", /* 16 */
"Download image from url", /* 17 */
"Open date picker", /* 18 */
"Open time picker", /* 19 */
"Get files count in directory", /* 20 */
"Get date difference", /* 21 */
"Convert string date to dateformat", /* 22 */
"Get device height", /* 23 */
"Get device width", /* 24 */
"Generate random number", /* 25 */
"Postfix for number", /* 26 */
"Convert comma separated string to arraylist and viseversa", /* 27 */
"Music ON OFF", /* 28 */
"Apply blur bffect on image", /* 29 */
"Drawable to bitmap and viceversa", /* 30 */
"Set device volume as app volume", /* 31 */
"Set and get image from preferences", /* 32 */
"Application version", /* 33 */
"Vertical text views", /* 34 */
"Is SDCard available?", /* 35 */
"Show share dialog", /* 36 */
"Change device profile", /* 37 */
"Change bitmap to rounded cornered", /* 38 */
"Show toast", /* 39 */
"Prevent double click", /* 40 */
"Bluetooth/wifi ON OFF", /* 41 */
"Pick/capture/preview image/video and crop image", /* 42 */
"Url validation & ripple effect", /* 43 */
"Contacts with email id & screenshot", /* 44 */
"Social integration", /* 45 */
"Pick color", /* 46 */
"Remote file size or download file" };
ListView sdkFunctionalityList = (ListView) findViewById(R.id.Md_list_company);
ArrayAdapter<String> stringArrayAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, sdkFunctionalityListValue);
sdkFunctionalityList.setAdapter(stringArrayAdapter);
sdkFunctionalityList.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
selectedListItem(position);
}
});
sdkFunctionalityList.setOnScrollListener(new AbsListView.OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
tvText.setText("");
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
}
});
}
use of android.widget.AbsListView in project Rashr by DsLNeXuS.
the class FlashFragment method optimizeLayout.
/**
* optimizeLayout checks which cards need to be added to UI. So if you device doesn't support
* kernel flashing optimizeLayout will not add it to UI.
*
* @param root RootView from Fragment
* @throws NullPointerException layout can't be inflated
*/
@SuppressLint("PrivateResource")
public void optimizeLayout(View root) throws NullPointerException {
CardUI RashrCards = (CardUI) root.findViewById(R.id.RashrCards);
if (RashrApp.DEVICE.isRecoverySupported() || RashrApp.DEVICE.isKernelSupported() || BuildConfig.DEBUG) {
/** If device is supported start setting up layout */
setupSwipeUpdater(root);
/** Avoid overlapping scroll on CardUI and SwipeRefreshLayout */
RashrCards.getListView().setOnScrollListener(new AbsListView.OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
int topRowVerticalPosition = (view == null || view.getChildCount() == 0) ? 0 : view.getChildAt(0).getTop();
if (mSwipeUpdater != null)
mSwipeUpdater.setEnabled((topRowVerticalPosition >= 0));
}
});
if (RashrApp.DEVICE.isRecoverySupported() || BuildConfig.DEBUG) {
addRecoveryCards(RashrCards);
}
if (RashrApp.DEVICE.isKernelSupported() || BuildConfig.DEBUG) {
addKernelCards(RashrCards);
}
//Device has been flashed over Rashr so you can choose previously used images
if (getHistoryFiles().size() > 0) {
final IconCard HistoryCard = new IconCard(getString(R.string.history), R.drawable.ic_history, getString(R.string.history_description));
HistoryCard.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showFlashHistory();
}
});
RashrCards.addCard(HistoryCard, true);
}
}
addRebooterCards(RashrCards);
}
use of android.widget.AbsListView in project android_frameworks_base by ResurrectionRemix.
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 android_frameworks_base by ResurrectionRemix.
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 android_frameworks_base by ResurrectionRemix.
the class RenderSessionImpl method postInflateProcess.
/**
* Post process on a view hierarchy that was just inflated.
* <p/>
* At the moment this only supports TabHost: If {@link TabHost} is detected, look for the
* {@link TabWidget}, and the corresponding {@link FrameLayout} and make new tabs automatically
* based on the content of the {@link FrameLayout}.
* @param view the root view to process.
* @param layoutlibCallback callback to the project.
* @param skip the view and it's children are not processed.
*/
// For the use of Pair
@SuppressWarnings("deprecation")
private void postInflateProcess(View view, LayoutlibCallback layoutlibCallback, View skip) throws PostInflateException {
if (view == skip) {
return;
}
if (view instanceof TabHost) {
setupTabHost((TabHost) view, layoutlibCallback);
} else if (view instanceof QuickContactBadge) {
QuickContactBadge badge = (QuickContactBadge) view;
badge.setImageToDefault();
} else if (view instanceof AdapterView<?>) {
// get the view ID.
int id = view.getId();
BridgeContext context = getContext();
// get a ResourceReference from the integer ID.
ResourceReference listRef = context.resolveId(id);
if (listRef != null) {
SessionParams params = getParams();
AdapterBinding binding = params.getAdapterBindings().get(listRef);
// if there was no adapter binding, trying to get it from the call back.
if (binding == null) {
binding = layoutlibCallback.getAdapterBinding(listRef, context.getViewKey(view), view);
}
if (binding != null) {
if (view instanceof AbsListView) {
if ((binding.getFooterCount() > 0 || binding.getHeaderCount() > 0) && view instanceof ListView) {
ListView list = (ListView) view;
boolean skipCallbackParser = false;
int count = binding.getHeaderCount();
for (int i = 0; i < count; i++) {
Pair<View, Boolean> pair = context.inflateView(binding.getHeaderAt(i), list, false, skipCallbackParser);
if (pair.getFirst() != null) {
list.addHeaderView(pair.getFirst());
}
skipCallbackParser |= pair.getSecond();
}
count = binding.getFooterCount();
for (int i = 0; i < count; i++) {
Pair<View, Boolean> pair = context.inflateView(binding.getFooterAt(i), list, false, skipCallbackParser);
if (pair.getFirst() != null) {
list.addFooterView(pair.getFirst());
}
skipCallbackParser |= pair.getSecond();
}
}
if (view instanceof ExpandableListView) {
((ExpandableListView) view).setAdapter(new FakeExpandableAdapter(listRef, binding, layoutlibCallback));
} else {
((AbsListView) view).setAdapter(new FakeAdapter(listRef, binding, layoutlibCallback));
}
} else if (view instanceof AbsSpinner) {
((AbsSpinner) view).setAdapter(new FakeAdapter(listRef, binding, layoutlibCallback));
}
}
}
} else if (view instanceof ViewGroup) {
mInflater.postInflateProcess(view);
ViewGroup group = (ViewGroup) view;
final int count = group.getChildCount();
for (int c = 0; c < count; c++) {
View child = group.getChildAt(c);
postInflateProcess(child, layoutlibCallback, skip);
}
}
}
Aggregations