/**设置列表适配器 * @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(); } } }); } }
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(); }
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(); }
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(); }
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(); } }); } }
@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; }
@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); }
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); } }; }
/** * 设置适配器 * * @param adapter */ public void setAdapter(BaseAdapter adapter) { if (mAdapter != null) { mAdapter.unregisterDataSetObserver(mDataSetObserver); } mAdapter = adapter; if (adapter != null) { adapter.registerDataSetObserver(mDataSetObserver); } bindData(); }
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()); }
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(); } }
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(); } }
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)); }
/** * 设置适配器 * * @param adapter */ public void setAdapter(BaseAdapter adapter) { if (null == adapter) { return; } mAdapter = adapter; }
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; } }
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(); }
public void notifyDataSetChanged(boolean isLeft) { updateFirstPostion(isLeft); try { ((BaseAdapter) ((HeaderViewListAdapter) this.mAdapter).getWrappedAdapter()).notifyDataSetChanged(); } catch (Exception e) { } }
/** * 返回纵向表头的适配器 * * @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; }
/** * 返回纵向表头的适配器 * * @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; }
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(); }
public void setAdapter(@NonNull BaseAdapter baseAdapter) { if (adapter != null) adapter.unregisterDataSetObserver(dataSetObserver); adapter = baseAdapter; adapter.registerDataSetObserver(dataSetObserver); }
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); } } }
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()); } }
@Override public void onClose(User user) { getFragmentManager().popBackStackImmediate(); if(user != null) { if(!bartour.getUsers().contains(user)){ bartour.addUser(user); } ((BaseAdapter)listView.getAdapter()).notifyDataSetChanged(); } }
public EaseChatRowRecSendMoney(Context context, EMMessage message, int position, BaseAdapter adapter) { super(context, message, position, adapter); }
@Override public View getDropDownView(int position, View convertView, ViewGroup parent) { return ((BaseAdapter) mDelegate).getDropDownView(position, convertView, parent); }
@Override public void notifyDataSetChanged() { ((BaseAdapter) mDelegate).notifyDataSetChanged(); }
@Override public void notifyDataSetInvalidated() { ((BaseAdapter) mDelegate).notifyDataSetInvalidated(); }
@Override public BaseAdapter getLVAdapter() { return mAdapter; }
@Override public BaseAdapter getLVAdapter() { return mListView != null ? mListView.getLVAdapter() : null; }
public void onChange(boolean selfChange) { Log.d(THIS_FILE, "Accounts status.onChange( " + selfChange + ")"); ((BaseAdapter) getListAdapter()).notifyDataSetChanged(); }
public void setAdapter(BaseAdapter adapter) { if (mContentView != null) { mContentView.setAdapter(adapter); } }
public ChatRowVoiceCall(Context context, EMMessage message, int position, BaseAdapter adapter) { super(context, message, position, adapter); }