本文整理汇总了Java中android.widget.BaseAdapter类的典型用法代码示例。如果您正苦于以下问题:Java BaseAdapter类的具体用法?Java BaseAdapter怎么用?Java BaseAdapter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BaseAdapter类属于android.widget包,在下文中一共展示了BaseAdapter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setList
import android.widget.BaseAdapter; //导入依赖的package包/类
/**设置列表适配器
* @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();
}
}
});
}
}
示例2: setSelectedItem
import android.widget.BaseAdapter; //导入依赖的package包/类
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();
}
示例3: updateRecentList
import android.widget.BaseAdapter; //导入依赖的package包/类
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();
}
示例4: updateDBDefaultFolder
import android.widget.BaseAdapter; //导入依赖的package包/类
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();
}
示例5: set
import android.widget.BaseAdapter; //导入依赖的package包/类
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();
}
});
}
}
示例6: setAdapter
import android.widget.BaseAdapter; //导入依赖的package包/类
@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;
}
示例7: onCreate
import android.widget.BaseAdapter; //导入依赖的package包/类
@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);
}
示例8: setAdapter
import android.widget.BaseAdapter; //导入依赖的package包/类
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);
}
};
}
示例9: setAdapter
import android.widget.BaseAdapter; //导入依赖的package包/类
/**
* 设置适配器
*
* @param adapter
*/
public void setAdapter(BaseAdapter adapter)
{
if (mAdapter != null)
{
mAdapter.unregisterDataSetObserver(mDataSetObserver);
}
mAdapter = adapter;
if (adapter != null)
{
adapter.registerDataSetObserver(mDataSetObserver);
}
bindData();
}
示例10: invalidate
import android.widget.BaseAdapter; //导入依赖的package包/类
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());
}
示例11: bindData
import android.widget.BaseAdapter; //导入依赖的package包/类
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();
}
}
示例12: bindData
import android.widget.BaseAdapter; //导入依赖的package包/类
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();
}
}
示例13: setAdapter
import android.widget.BaseAdapter; //导入依赖的package包/类
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));
}
示例14: setAdapter
import android.widget.BaseAdapter; //导入依赖的package包/类
/**
* 设置适配器
*
* @param adapter
*/
public void setAdapter(BaseAdapter adapter) {
if (null == adapter) {
return;
}
mAdapter = adapter;
}
示例15: NavBean
import android.widget.BaseAdapter; //导入依赖的package包/类
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;
}
}