当前位置: 首页>>代码示例>>Java>>正文


Java BaseAdapter类代码示例

本文整理汇总了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();
						}
					}
				});
	}
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:25,代码来源:BaseHttpListActivity.java

示例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();
}
 
开发者ID:michaelprimez,项目名称:searchablespinner,代码行数:26,代码来源:SearchableSpinner.java

示例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();
}
 
开发者ID:RyuzakiKK,项目名称:NoteCrypt,代码行数:25,代码来源:SelectDatabaseActivity.java

示例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();
}
 
开发者ID:RyuzakiKK,项目名称:NoteCrypt,代码行数:19,代码来源:SelectDatabaseActivity.java

示例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();
            }
        });
    }
}
 
开发者ID:vbier,项目名称:habpanelviewer,代码行数:21,代码来源:ApplicationStatus.java

示例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;
}
 
开发者ID:zj565061763,项目名称:dialog,代码行数:19,代码来源:FDialogMenu.java

示例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);
}
 
开发者ID:1313ou,项目名称:Treebolic,代码行数:25,代码来源:ProvidersActivity.java

示例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);
		}
	};
}
 
开发者ID:newDeepLearing,项目名称:decoy,代码行数:13,代码来源:CustomAlertDialog.java

示例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();
}
 
开发者ID:zj565061763,项目名称:gridlayout,代码行数:19,代码来源:FGridLayout.java

示例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());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:9,代码来源:ColorChooserDialog.java

示例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();
        }

    }
 
开发者ID:Zyj163,项目名称:yyox,代码行数:13,代码来源:ImageReceiveHolder.java

示例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();
    }

}
 
开发者ID:Zyj163,项目名称:yyox,代码行数:11,代码来源:ImageSendHolder.java

示例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));

}
 
开发者ID:Zyj163,项目名称:yyox,代码行数:8,代码来源:RefreshListView.java

示例14: setAdapter

import android.widget.BaseAdapter; //导入依赖的package包/类
/**
 * 设置适配器
 *
 * @param adapter
 */
public void setAdapter(BaseAdapter adapter) {
    if (null == adapter) {
        return;
    }
    mAdapter = adapter;
}
 
开发者ID:fikyair,项目名称:musicplayer,代码行数:12,代码来源:CommolySearchView.java

示例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;
    }
}
 
开发者ID:qizhenghao,项目名称:StickyNavigationBar,代码行数:16,代码来源:NavBean.java


注:本文中的android.widget.BaseAdapter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。