use of android.widget.BaseAdapter 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.BaseAdapter in project NewXmPluginSDK by MiEcosystem.
the class MenuDialog method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().requestFeature(Window.FEATURE_NO_TITLE);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
getWindow().setGravity(Gravity.TOP);
TitleBarUtil.enableWhiteTranslucentStatus(getWindow());
try {
XmPluginCommonApi.instance().setMenuDialogWindowAnimations(getWindow());
} catch (Throwable e) {
}
mLayoutInflater = LayoutInflater.from(getContext());
mRootView = mLayoutInflater.inflate(R.layout.menu_dialog, null);
getWindow().setContentView(mRootView);
TitleBarUtil.setTitleBarPadding(getContext().getResources().getDimensionPixelSize(R.dimen.title_bar_top_padding), mRootView);
if (mBackgroundColor > 0) {
mRootView.setBackgroundColor(mBackgroundColor);
}
WindowManager.LayoutParams lp = this.getWindow().getAttributes();
lp.y = 0;
lp.width = WindowManager.LayoutParams.FILL_PARENT;
lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
getWindow().setAttributes(lp);
setCancelable(true);
setCanceledOnTouchOutside(true);
mListView = (ListView) findViewById(R.id.select_dialog_listview);
mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
if (onClickListener != null) {
dismiss();
onClickListener.onClick(null, i);
}
}
});
findViewById(R.id.cancel).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
}
});
if (mListViewAdapter == null && mItems != null) {
mListViewAdapter = new BaseAdapter() {
@Override
public int getCount() {
return mItems.length;
}
@Override
public Object getItem(int i) {
return mItems[i];
}
@Override
public long getItemId(int i) {
return 0;
}
@Override
public View getView(int i, View view, ViewGroup viewGroup) {
if (view == null) {
view = mLayoutInflater.inflate(R.layout.menu_dialog_item, null);
}
TextView textView = (TextView) view.findViewById(R.id.text1);
textView.setText(mItems[i]);
return view;
}
};
}
if (mListViewAdapter != null)
mListView.setAdapter(mListViewAdapter);
}
use of android.widget.BaseAdapter 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.BaseAdapter in project wechat by motianhuo.
the class TitlePopup method populateActions.
/**
* 设置弹窗列表子项
*/
private void populateActions() {
mIsDirty = false;
// 设置列表的适配器
mListView.setAdapter(new BaseAdapter() {
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = LayoutInflater.from(mContext).inflate(R.layout.layout_item_pop, parent, false);
}
TextView textView = ViewHolder.get(convertView, R.id.txt_title);
textView.setTextColor(mContext.getResources().getColor(android.R.color.white));
textView.setTextSize(16);
// 设置文本居中
textView.setGravity(Gravity.CENTER_VERTICAL);
// // 设置文本域的范围
// textView.setPadding(0, 10, 0, 10);
// 设置文本在一行内显示(不换行)
textView.setSingleLine(true);
ActionItem item = mActionItems.get(position);
// 设置文本文字
textView.setText(item.mTitle);
if (item.mDrawable != null) {
// 设置文字与图标的间隔
textView.setCompoundDrawablePadding(10);
// 设置在文字的左边放一个图标
textView.setCompoundDrawablesWithIntrinsicBounds(item.mDrawable, null, null, null);
}
return convertView;
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public Object getItem(int position) {
return mActionItems.get(position);
}
@Override
public int getCount() {
return mActionItems.size();
}
});
}
use of android.widget.BaseAdapter in project android_frameworks_base by DirtyUnicorns.
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();
}
}
}
Aggregations