當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。