Java 类android.widget.BaseAdapter 实例源码
项目:GitHub
文件:BaseHttpListActivity.java
/**设置列表适配器
* @param callBack
*/
@SuppressWarnings("unchecked")
@Override
public void setList(AdapterCallBack<BA> callBack) {
super.setList(callBack);
boolean empty = adapter == null || adapter.isEmpty();
Log.d(TAG, "setList adapter empty = " + empty);
lvBaseList.showFooter(! empty);//放setAdapter中不行,adapter!=null时没有调用setAdapter
if (adapter != null && adapter instanceof zuo.biao.library.base.BaseAdapter) {
((zuo.biao.library.base.BaseAdapter<T>) adapter).setOnReachViewBorderListener(
empty || lvBaseList.isFooterShowing() == false ? null : new OnReachViewBorderListener(){
@Override
public void onReach(int type, View v) {
if (type == TYPE_BOTTOM) {
lvBaseList.onLoadMore();
}
}
});
}
}
项目:GitHub
文件:BaseHttpListFragment.java
/**设置列表适配器
* @param callBack
*/
@SuppressWarnings("unchecked")
@Override
public void setList(AdapterCallBack<BA> callBack) {
super.setList(callBack);
boolean empty = adapter == null || adapter.isEmpty();
Log.d(TAG, "setList adapter empty = " + empty);
lvBaseList.showFooter(! empty);//放setAdapter中不行,adapter!=null时没有调用setAdapter
if (adapter != null && adapter instanceof zuo.biao.library.base.BaseAdapter) {
((zuo.biao.library.base.BaseAdapter<T>) adapter).setOnReachViewBorderListener(
empty || lvBaseList.isFooterShowing() == false ? null : new OnReachViewBorderListener(){
@Override
public void onReach(int type, View v) {
if (type == TYPE_BOTTOM) {
lvBaseList.onLoadMore();
}
}
});
}
}
项目:searchablespinner
文件:SearchableSpinner.java
public void setSelectedItem(int position) {
Adapter adapter = mSpinnerListView.getAdapter();
if (adapter instanceof ISpinnerSelectedView) {
View selectedView = ((ISpinnerSelectedView) adapter).getSelectedView(position);
mCurrSelectedView = new SelectedView(selectedView, position, selectedView.getId());
mSpinnerListView.setSelection(position);
} else {
TextView textView = new TextView(mContext);
textView.setText(mRevealEmptyText);
mCurrSelectedView = new SelectedView(textView, -1, 0);
mRevealItem.addView(textView);
}
if (mCurrSelectedView == null) {
if (mOnItemSelected != null)
mOnItemSelected.onNothingSelected();
} else if (mCurrSelectedView != null) {
mRevealItem.removeAllViews();
mSpinnerListView.removeViewInLayout(mCurrSelectedView.getView());
mRevealItem.addView(mCurrSelectedView.getView());
((BaseAdapter) mSpinnerListView.getAdapter()).notifyDataSetChanged();
if (mOnItemSelected != null)
mOnItemSelected.onItemSelected(mCurrSelectedView.getView(), mCurrSelectedView.getPosition(), mCurrSelectedView.getId());
}
hideEdit();
}
项目:APIJSON-Android-RxJava
文件:BaseHttpListFragment.java
/**设置列表适配器
* @param callBack
*/
@SuppressWarnings("unchecked")
@Override
public void setList(AdapterCallBack<BA> callBack) {
super.setList(callBack);
boolean empty = adapter == null || adapter.isEmpty();
Log.d(TAG, "setList adapter empty = " + empty);
lvBaseList.showFooter(! empty);//放setAdapter中不行,adapter!=null时没有调用setAdapter
if (adapter != null && adapter instanceof zuo.biao.library.base.BaseAdapter) {
((zuo.biao.library.base.BaseAdapter<T>) adapter).setOnReachViewBorderListener(
empty || lvBaseList.isFooterShowing() == false ? null : new OnReachViewBorderListener(){
@Override
public void onReach(int type, View v) {
if (type == TYPE_BOTTOM) {
lvBaseList.onLoadMore();
}
}
});
}
}
项目:APIJSON-Android-RxJava
文件:BaseHttpListActivity.java
/**设置列表适配器
* @param callBack
*/
@SuppressWarnings("unchecked")
@Override
public void setList(AdapterCallBack<BA> callBack) {
super.setList(callBack);
boolean empty = adapter == null || adapter.isEmpty();
Log.d(TAG, "setList adapter empty = " + empty);
lvBaseList.showFooter(! empty);//放setAdapter中不行,adapter!=null时没有调用setAdapter
if (adapter != null && adapter instanceof zuo.biao.library.base.BaseAdapter) {
((zuo.biao.library.base.BaseAdapter<T>) adapter).setOnReachViewBorderListener(
empty || lvBaseList.isFooterShowing() == false ? null : new OnReachViewBorderListener(){
@Override
public void onReach(int type, View v) {
if (type == TYPE_BOTTOM) {
lvBaseList.onLoadMore();
}
}
});
}
}
项目:NoteCrypt
文件:SelectDatabaseActivity.java
private void updateRecentList(String item, boolean isDelete) {
if (setRecent == null) {
setRecent = new HashSet<>();
}
if (isDelete) {
setRecent.remove(item);
} else {
setRecent.add(item);
}
final SharedPreferences.Editor editor = getPreferences(MODE_PRIVATE).edit();
editor.putStringSet("recent", null);
editor.apply();
editor.putStringSet("recent", setRecent);
editor.apply();
//remove and add for avoid double times the same item in list
listRecent.remove(item);
if (isDelete) {
File file = new File(StringMethods.getInstance().fixPath(item));
file.delete();
} else {
listRecent.add(item);
}
((BaseAdapter) listView.getAdapter()).notifyDataSetChanged();
}
项目:NoteCrypt
文件:SelectDatabaseActivity.java
private void updateDBDefaultFolder() {
String path = Environment.getExternalStorageDirectory().toString() + "/" + StringMethods.DEFAULT_FOLDER;
File f = new File(path);
File file[] = f.listFiles();
listRecent.clear();
if (file != null) {
for (File aFile : file) {
if (!aFile.getName().startsWith(".")) {
listRecent.add(aFile.getName());
}
}
}
if (setRecent != null) {
listRecent.removeAll(setRecent); //avoid double entries
listRecent.addAll(setRecent);
}
((BaseAdapter) listView.getAdapter()).notifyDataSetChanged();
}
项目:habpanelviewer
文件:ApplicationStatus.java
public synchronized void set(String key, String value) {
StatusItem item = mIndices.get(key);
if (item == null) {
item = new StatusItem(key, value);
mValues.add(item);
mIndices.put(key, item);
} else {
item.setValue(value);
}
if (mAdapter != null) {
final BaseAdapter adapter = mAdapter;
mContext.runOnUiThread(new Runnable() {
@Override
public void run() {
adapter.notifyDataSetChanged();
}
});
}
}
项目:dialog
文件:FDialogMenu.java
@Override
public FDialogMenu setAdapter(BaseAdapter adapter)
{
lv_content.setAdapter(adapter);
lv_content.setOnItemClickListener(new OnItemClickListener()
{
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id)
{
if (mCallback != null)
{
mCallback.onClickItem(view, (int) id, FDialogMenu.this);
}
dismissAfterClickIfNeed();
}
});
return this;
}
项目:Treebolic
文件:ProvidersActivity.java
@Override
protected void onCreate(final Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
// layout
setContentView(R.layout.activity_providers);
// toolbar
final Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
// set up the action bar
final ActionBar actionBar = getSupportActionBar();
if (actionBar != null)
{
actionBar.setDisplayOptions(ActionBar.DISPLAY_USE_LOGO | ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_HOME_AS_UP);
}
// adapter
final BaseAdapter adapter = Providers.makeAdapter(this, R.layout.item_providers, from, to, true);
final ListView listView = findViewById(R.id.providers);
listView.setAdapter(adapter);
}
项目:decoy
文件:CustomAlertDialog.java
public void setAdapter(final BaseAdapter adapter, final OnClickListener listener) {
listAdapter = adapter;
listListener = listener;
itemListener = new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
dismiss();
listListener.onClick(CustomAlertDialog.this, position);
}
};
}
项目:gridlayout
文件:FGridLayout.java
/**
* 设置适配器
*
* @param adapter
*/
public void setAdapter(BaseAdapter adapter)
{
if (mAdapter != null)
{
mAdapter.unregisterDataSetObserver(mDataSetObserver);
}
mAdapter = adapter;
if (adapter != null)
{
adapter.registerDataSetObserver(mDataSetObserver);
}
bindData();
}
项目:GitHub
文件:ColorChooserDialog.java
private void invalidate() {
if (grid.getAdapter() == null) {
grid.setAdapter(new ColorGridAdapter());
grid.setSelector(ResourcesCompat.getDrawable(getResources(), R.drawable.md_transparent, null));
} else ((BaseAdapter) grid.getAdapter()).notifyDataSetChanged();
if (getDialog() != null)
getDialog().setTitle(getTitle());
}
项目:yyox
文件:ImageReceiveHolder.java
public void bindData(final IMMessage message, int position, IMMessage previousMessage, final BaseAdapter baseAdapter) {
try {
loadImageData(position, message, maskImage);
loadImage(imageView, R.drawable.kf5_agent);
ImageLoaderManager.getInstance(context).displayImage(R.drawable.kf5_agent, imageView);
dealDate(position, tvDate, message, previousMessage);
} catch (Exception e) {
e.printStackTrace();
}
}
项目:yyox
文件:ImageSendHolder.java
public void bindData(final IMMessage message, int position, IMMessage previousMessage, final BaseAdapter baseAdapter) {
try {
loadImageData(position, message, maskImage);
loadImage(imageView, R.drawable.kf5_end_user);
dealMessageStatus(message, previousMessage, position, tvDate, progressBar, relativeLayout);
} catch (Exception e) {
e.printStackTrace();
}
}
项目:yyox
文件:RefreshListView.java
public void setAdapter(BaseAdapter adapter) {
super.setAdapter(adapter);
SimpleDateFormat format = new SimpleDateFormat("yyyy年MM月dd日 HH:mm");
String date = format.format(new Date());
lastUpdatedTextView.setText(getContext().getString(R.string.kf5_up_update_date, date));
}
项目:musicplayer
文件:CommolySearchView.java
/**
* 设置适配器
*
* @param adapter
*/
public void setAdapter(BaseAdapter adapter) {
if (null == adapter) {
return;
}
mAdapter = adapter;
}
项目:StickyNavigationBar
文件:NavBean.java
public NavBean(@TYPE int type, BaseAdapter adapter) {
this.type = type;
this.adapter = adapter;
switch (type) {
case TYPE_REPOST:
title = "转发";
break;
case TYPE_COMMENT:
title = "评论";
break;
case TYPE_LIKE:
title = "赞";
break;
}
}
项目:GCSApp
文件:EaseChatRowVoicePlayClickListener.java
public EaseChatRowVoicePlayClickListener(EMMessage message, ImageView v, ImageView iv_read_status, BaseAdapter adapter, Activity context) {
this.message = message;
voiceBody = (EMVoiceMessageBody) message.getBody();
this.iv_read_status = iv_read_status;
this.adapter = adapter;
voiceIconView = v;
this.activity = context;
this.chatType = message.getChatType();
}
项目:letv
文件:HListView.java
public void notifyDataSetChanged(boolean isLeft) {
updateFirstPostion(isLeft);
try {
((BaseAdapter) ((HeaderViewListAdapter) this.mAdapter).getWrappedAdapter()).notifyDataSetChanged();
} catch (Exception e) {
}
}
项目:FanChat
文件:EaseChatRowVoicePlayClickListener.java
public EaseChatRowVoicePlayClickListener(EMMessage message, ImageView v, ImageView iv_read_status, BaseAdapter adapter, Activity context) {
this.message = message;
voiceBody = (EMVoiceMessageBody) message.getBody();
this.iv_read_status = iv_read_status;
this.adapter = adapter;
voiceIconView = v;
this.activity = context;
this.chatType = message.getChatType();
}
项目:SmartChart
文件:PanelListAdapter.java
/**
* 返回纵向表头的适配器
*
* @return adapter of column ListView
*/
private BaseAdapter getColumnAdapter() {
if (columnAdapter == null) {
columnAdapter = new ColumnAdapter(context, android.R.layout.simple_list_item_1, getColumnDataList());
}
return columnAdapter;
}
项目:SmartChart
文件:PanelListAdapter.java
/**
* 返回纵向表头的适配器
*
* @return adapter of column ListView
*/
private BaseAdapter getColumnTwoAdapter() {
if (columnTwoAdapter == null) {
columnTwoAdapter = new ColumnAdapter(context, android.R.layout.simple_list_item_1, getColumnDataList());
}
return columnAdapter;
}
项目:KTalk
文件:EaseChatRow.java
public EaseChatRow(Context context, EMMessage message, int position, BaseAdapter adapter) {
super(context);
this.context = context;
this.activity = (Activity) context;
this.message = message;
this.position = position;
this.adapter = adapter;
inflater = LayoutInflater.from(context);
initView();
}
项目:target-layout
文件:TargetLayout.java
public void setAdapter(@NonNull BaseAdapter baseAdapter) {
if (adapter != null)
adapter.unregisterDataSetObserver(dataSetObserver);
adapter = baseAdapter;
adapter.registerDataSetObserver(dataSetObserver);
}
项目:GCSApp
文件:EaseChatRow.java
public EaseChatRow(Context context, EMMessage message, int position, BaseAdapter adapter) {
super(context);
this.context = context;
this.activity = (Activity) context;
this.message = message;
this.position = position;
this.adapter = adapter;
inflater = LayoutInflater.from(context);
initView();
}
项目:Android-TV-FocusLayout
文件:HLayoutContainer.java
public void setAdapter(BaseAdapter adapter, ArrayList<Rect> childLocationInfo) {
this.childLocationInfo = childLocationInfo;
setChildRectPadding();
removeAllViews();
int count = adapter.getCount();
for (int i = 0; i < count; i++) {
AnimContainer view = (AnimContainer) adapter.getView(i, null, this);
if (view != null) {
final int index = i;
// 将position设置到id,方便以后查询用,如果有用到setId的请注意
view.setId(i);
// 看各位喜欢事件是否放到view还是adapter
view.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (onItemClickedListener != null) {
onItemClickedListener.onItemClicked(v, index);
}
}
});
// 防止最左边tab按左键移动时,焦点跑出layout
if (isFirstColumn(childLocationInfo.get(i))) {
view.setNextFocusLeftId(view.getId());
}
this.addView(view);
}
}
}
项目:Tribe
文件:EaseChatRow.java
public EaseChatRow(Context context, EMMessage message, int position, BaseAdapter adapter) {
super(context);
this.context = context;
this.activity = (Activity) context;
this.message = message;
this.position = position;
this.adapter = adapter;
inflater = LayoutInflater.from(context);
initView();
}
项目:Tribe
文件:EaseChatRowVoicePlayClickListener.java
public EaseChatRowVoicePlayClickListener(EMMessage message, ImageView v, ImageView iv_read_status, BaseAdapter adapter, Activity context) {
this.message = message;
voiceBody = (EMVoiceMessageBody) message.getBody();
this.iv_read_status = iv_read_status;
this.adapter = adapter;
voiceIconView = v;
this.activity = context;
this.chatType = message.getChatType();
}
项目:OpenHub
文件:ColorChooserDialog.java
private void invalidate() {
if (grid.getAdapter() == null) {
grid.setAdapter(new ColorGridAdapter());
grid.setSelector(
ResourcesCompat.getDrawable(getResources(), R.drawable.md_transparent, null));
} else {
((BaseAdapter) grid.getAdapter()).notifyDataSetChanged();
}
if (getDialog() != null) {
getDialog().setTitle(getTitle());
}
}
项目:Bartout
文件:BartourActivity.java
@Override
public void onClose(User user) {
getFragmentManager().popBackStackImmediate();
if(user != null) {
if(!bartour.getUsers().contains(user)){
bartour.addUser(user);
}
((BaseAdapter)listView.getAdapter()).notifyDataSetChanged();
}
}
项目:GCSApp
文件:EaseChatRowRecSendMoney.java
public EaseChatRowRecSendMoney(Context context, EMMessage message, int position, BaseAdapter adapter) {
super(context, message, position, adapter);
}
项目:Swface
文件:AdapterWrapper.java
@Override
public View getDropDownView(int position, View convertView, ViewGroup parent) {
return ((BaseAdapter) mDelegate).getDropDownView(position, convertView, parent);
}
项目:Swface
文件:AdapterWrapper.java
@Override
public void notifyDataSetChanged() {
((BaseAdapter) mDelegate).notifyDataSetChanged();
}
项目:Swface
文件:AdapterWrapper.java
@Override
public void notifyDataSetInvalidated() {
((BaseAdapter) mDelegate).notifyDataSetInvalidated();
}
项目:LuaViewPlayground
文件:LVListView.java
@Override
public BaseAdapter getLVAdapter() {
return mAdapter;
}
项目:LuaViewPlayground
文件:LVRefreshListView.java
@Override
public BaseAdapter getLVAdapter() {
return mListView != null ? mListView.getLVAdapter() : null;
}
项目:CSipSimple
文件:AccountsEditListFragment.java
public void onChange(boolean selfChange) {
Log.d(THIS_FILE, "Accounts status.onChange( " + selfChange + ")");
((BaseAdapter) getListAdapter()).notifyDataSetChanged();
}
项目:LQRWeChat
文件:FriendRefreshView.java
public void setAdapter(BaseAdapter adapter) {
if (mContentView != null) {
mContentView.setAdapter(adapter);
}
}
项目:GCSApp
文件:ChatRowVoiceCall.java
public ChatRowVoiceCall(Context context, EMMessage message, int position, BaseAdapter adapter) {
super(context, message, position, adapter);
}