use of android.widget.Adapter in project wechat by motianhuo.
the class SwipeLayout method isEnabledInAdapterView.
/**
* if working in {@link android.widget.AdapterView}, we should response
* {@link android.widget.Adapter} isEnable(int position).
*
* @return true when item is enabled, else disabled.
*/
private boolean isEnabledInAdapterView() {
AdapterView adapterView = getAdapterView();
boolean enable = true;
if (adapterView != null) {
Adapter adapter = adapterView.getAdapter();
if (adapter != null) {
int p = adapterView.getPositionForView(SwipeLayout.this);
if (adapter instanceof BaseAdapter) {
enable = ((BaseAdapter) adapter).isEnabled(p);
} else if (adapter instanceof ListAdapter) {
enable = ((ListAdapter) adapter).isEnabled(p);
}
}
}
return enable;
}
use of android.widget.Adapter in project android_frameworks_base by AOSPA.
the class AppWidgetHostView method viewDataChanged.
/**
* Process data-changed notifications for the specified view in the specified
* set of {@link RemoteViews} views.
*/
void viewDataChanged(int viewId) {
View v = findViewById(viewId);
if ((v != null) && (v instanceof AdapterView<?>)) {
AdapterView<?> adapterView = (AdapterView<?>) v;
Adapter adapter = adapterView.getAdapter();
if (adapter instanceof BaseAdapter) {
BaseAdapter baseAdapter = (BaseAdapter) adapter;
baseAdapter.notifyDataSetChanged();
} else if (adapter == null && adapterView instanceof RemoteAdapterConnectionCallback) {
// If the adapter is null, it may mean that the RemoteViewsAapter has not yet
// connected to its associated service, and hence the adapter hasn't been set.
// In this case, we need to defer the notify call until it has been set.
((RemoteAdapterConnectionCallback) adapterView).deferNotifyDataSetChanged();
}
}
}
use of android.widget.Adapter in project BarcodeEye by BarcodeEye.
the class AppPickerActivity method onListItemClick.
@Override
protected void onListItemClick(ListView l, View view, int position, long id) {
Adapter adapter = getListAdapter();
if (position >= 0 && position < adapter.getCount()) {
String packageName = ((AppInfo) adapter.getItem(position)).getPackageName();
Intent intent = new Intent();
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
intent.putExtra(Browser.BookmarkColumns.URL, "market://details?id=" + packageName);
setResult(RESULT_OK, intent);
} else {
setResult(RESULT_CANCELED);
}
finish();
}
use of android.widget.Adapter in project robolectric by robolectric.
the class ShadowAlertDialog method getItems.
/**
* Non-Android accessor.
*
* @return the items that are available to be clicked on
*/
public CharSequence[] getItems() {
Adapter adapter = getShadowAlertController().getAdapter();
int count = adapter.getCount();
CharSequence[] items = new CharSequence[count];
for (int i = 0; i < items.length; i++) {
items[i] = (CharSequence) adapter.getItem(i);
}
return items;
}
use of android.widget.Adapter in project weex-example by KalicyZhou.
the class AppPickerActivity method onListItemClick.
@Override
protected void onListItemClick(ListView l, View view, int position, long id) {
Adapter adapter = getListAdapter();
if (position >= 0 && position < adapter.getCount()) {
String packageName = ((AppInfo) adapter.getItem(position)).getPackageName();
Intent intent = new Intent();
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
intent.putExtra("url", "market://details?id=" + packageName);
setResult(RESULT_OK, intent);
} else {
setResult(RESULT_CANCELED);
}
finish();
}
Aggregations