android.widget.ListAdapter的实例源码

项目:adyen-android    文件PaymentMethodSelectionFragment.java   
private void resizeListView(ListView listView,boolean isBottomList) {
    listadapter adapter = listView.getAdapter();
    int count = adapter.getCount();
    int itemsHeight = 0;
    // Your views have the same layout,so all of them have
    // the same height
    View oneChild = listView.getChildAt(0);
    if (oneChild == null) {
        return;
    }
    itemsHeight = oneChild.getHeight();
    // Resize your list view
    LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) listView.getLayoutParams();
    params.height = isBottomList ? itemsHeight * count + itemsHeight / 2 : itemsHeight * count;
    listView.setLayoutParams(params);
}
项目:Android-Kode-POS    文件MainActivity.java   
@Override
protected void onPostExecute(Void result) {
    super.onPostExecute(result);
    // dismiss the progress dialog
    if (pDialog.isShowing())
        pDialog.dismiss();

    // Sorting a-z
    Collections.sort(posList,new Comparator<HashMap< String,String >>() {

        @Override
        public int compare(HashMap<String,String> lhs,HashMap<String,String> rhs) {
            return lhs.get("name").compareto(rhs.get("name"));
        }
    });

    // Updating parsed JSON data into ListView
    listadapter adapter = new SimpleAdapter(
            MainActivity.this,posList,R.layout.list_daerah,new String[]{"name"},new int[]{R.id.name});

    lv.setAdapter(adapter);
}
项目:CIA    文件ViewFollowedUsersIntentTests.java   
/**
 * test to make sure all followed profiles show up in the list
 */
public void testFollowingList(){

    listadapter adapter = ((ListView)solo.getView(R.id.vfuProfilesList)).getAdapter();

    for (Profile followed : profile.getFollowing()){

        boolean found = false;
        for (int i = 0; i < adapter.getCount(); ++i){
            if (adapter.getItem(i).equals(followed)){
                found = true;
                break;
            }
        }

        assertTrue("profile not found in followed users listview",found);
    }
}
项目:CIA    文件ViewFollowedUsersIntentTests.java   
/**
 * test to make sure all followed profile's habit events show up in the list,and are in sorted order
 */
public void testFollowingEvents(){
    // switch to history view
    solo.clickOnView(solo.getView(R.id.vfuHistoryIcon));
    solo.sleep(600);

    listadapter adapter = ((ListView)solo.getView(R.id.vfuEventsList)).getAdapter();
    for (CompletedEventdisplay event : profile.getFollowedHabitHistory()){
        boolean found = false;
        for (int i = 0; i < adapter.getCount(); ++i) {
            if (adapter.getItem(i).equals(event)) {
                found = true;
                break;
            }
        }
        assertTrue("habit not found in followed user habits listview",found);
    }
}
项目:NoticeDog    文件DragSortListView.java   
/**
 * For each DragSortListView Listener interface implemented by
 * <code>adapter</code>,this method calls the appropriate
 * set*Listener method with <code>adapter</code> as the argument.
 *
 * @param adapter The listadapter providing data to back
 *                DragSortListView.
 * @see ListView#setAdapter(listadapter)
 */
@Override
public void setAdapter(listadapter adapter) {
    if (adapter != null) {
        mAdapterWrapper = new AdapterWrapper(adapter);
        adapter.registerDataSetobserver(mObserver);

        if (adapter instanceof DropListener) {
            setDropListener((DropListener) adapter);
        }
        if (adapter instanceof DragListener) {
            setDragListener((DragListener) adapter);
        }
        if (adapter instanceof RemoveListener) {
            setRemoveListener((RemoveListener) adapter);
        }
    } else {
        mAdapterWrapper = null;
    }

    super.setAdapter(mAdapterWrapper);
}
项目:youkes_browser    文件SuperListView.java   
private int measureHeight(int measureSpec) {
    int mode = MeasureSpec.getMode(measureSpec);
    if (mode == MeasureSpec.AT_MOST) {
        return MeasureSpec.makeMeasureSpec(measureSpec,mode);
    } else if (mode == MeasureSpec.EXACTLY) {
        listadapter adapter = getAdapter();
        if (adapter == null) {
            measureSpec = 0;
        } else {
            int result = 0;
            for (int i = 0; i < adapter.getCount(); i++) {
                View contentView = adapter.getView(i,null,null);
                contentView.measure(0,0);
                result += contentView.getMeasuredHeight();
            }
            measureSpec = result + getDividerHeight()
                    * (adapter.getCount() - 1);
        }
    }

    return MeasureSpec.makeMeasureSpec(measureSpec,mode);
}
项目:pius1    文件MaterialDialog.java   
private void setListViewHeightBasedOnChildren(ListView listView)
   {
       listadapter listadapter = listView.getAdapter();
       if (listadapter == null)
{
           // pre-condition
           return;
       }

       int totalHeight = 0;
       for (int i = 0; i < listadapter.getCount(); i++)
{
           View listItem = listadapter.getView(i,listView);
           listItem.measure(0,0);
           totalHeight += listItem.getMeasuredHeight();
       }

       ViewGroup.LayoutParams params = listView.getLayoutParams();
       params.height = totalHeight + (listView.getDividerHeight() * (listadapter.getCount() - 1));
       listView.setLayoutParams(params);
   }
项目:Swap    文件PLA_AbsListView.java   
/**
 * {@inheritDoc}
 */
@Override
public void addTouchables(ArrayList<View> views) {
    final int count = getChildCount();
    final int firstPosition = mFirstPosition;
    final listadapter adapter = mAdapter;

    if (adapter == null) {
        return;
    }

    for (int i = 0; i < count; i++) {
        final View child = getChildAt(i);
        if (adapter.isEnabled(firstPosition + i)) {
            views.add(child);
        }
        child.addTouchables(views);
    }
}
项目:aos-Video    文件FolderPicker.java   
@Override
public void onListingUpdate(List<? extends MetaFile2> files) {

    Resources res = getResources();
    // Get the folders only
    mListItems = new ArrayList<Item>(files.size());
    for (MetaFile2 file : files) {
        Item item = new Item();
        item.mUri = file.getUri();
        if (file.isDirectory()) {
            item.mHolder = res.getDrawable(R.drawable.filetype_music_folder);
            item.mEnabled = true; // Only the folders are enabled
        } else {
            item.mHolder = res.getDrawable(R.drawable.filetype_generic2);
            item.mEnabled = false; // Only the folders are enabled
        }
        mListItems.add(item);
    }

    listadapter la = new FolderArrayAdapter(getActivity(),android.R.layout.simple_list_item_1);
    mListView.setAdapter(la);
}
项目:weex-3d-map    文件LoadPackagesAsyncTask.java   
@Override
protected void onPostExecute(final List<AppInfo> results) {    
  listadapter listadapter = new ArrayAdapter<AppInfo>(activity,R.layout.app_picker_list_item,R.id.app_picker_list_item_label,results) {
    @Override
    public View getView(int position,View convertView,ViewGroup parent) {
      View view = super.getView(position,convertView,parent);
      Drawable icon = results.get(position).getIcon();
      if (icon != null) {
        ((ImageView) view.findViewById(R.id.app_picker_list_item_icon)).setimageDrawable(icon);
      }
      return view;
    }
  };
  activity.setlistadapter(listadapter);
}
项目:letv    文件ListFragment.java   
public void setlistadapter(listadapter adapter) {
    boolean z = false;
    boolean hadAdapter;
    if (this.mAdapter != null) {
        hadAdapter = true;
    } else {
        hadAdapter = false;
    }
    this.mAdapter = adapter;
    if (this.mList != null) {
        this.mList.setAdapter(adapter);
        if (!this.mListShown && !hadAdapter) {
            if (getView().getwindowToken() != null) {
                z = true;
            }
            setListShown(true,z);
        }
    }
}
项目:FlickLauncher    文件Utilities.java   
public static void showNotificationDialogPRO(Activity activity){
    ArrayList<Bitmap> iconsBit = new ArrayList<>();

    for(Drawable d : MyNotificationListenerService.icons){
        iconsBit.add(Utils.convertDrawabletoBitmap(d));
    }

    listadapter adapter = new ArrayAdapterWithIcon(activity,MyNotificationListenerService.names,iconsBit);

    new AlertDialog.Builder(activity).setTitle(MyNotificationListenerService.TITLE)
            .setAdapter(adapter,new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog,int item) {

                }
            }).show();
}
项目:FlickLauncher    文件Utilities.java   
private static void showIconInPack(final Activity activity,String packName,final ShortcutInfo shortcutInfo){

        String packNamePackage = null;
        for (AppInfo app : AllAppsList.data) {
            if(app.title.equals(packName)){
                packNamePackage = app.getTargetComponent().getPackageName();
            }
        }

        items.clear();
        icons.clear();
        final HashMap<String,Bitmap> map = new HashMap<>(getIconPack(packNamePackage));

        listadapter adapter = new ArrayAdapterWithIcon(activity,items,icons);

        new AlertDialog.Builder(activity).setTitle(activity.getString(R.string.alert_choose_app))
                .setAdapter(adapter,new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog,int item) {
                        saveBitmapPref(activity,shortcutInfo.getTargetComponent().getPackageName(),icons.get(item));
                        //Launcher.getLauncherAppState().reloadWorkspace();
                    }
                }).show();
    }
项目:boohee_v5.6    文件ListFragment.java   
public void setlistadapter(listadapter adapter) {
    boolean z = false;
    boolean hadAdapter;
    if (this.mAdapter != null) {
        hadAdapter = true;
    } else {
        hadAdapter = false;
    }
    this.mAdapter = adapter;
    if (this.mList != null) {
        this.mList.setAdapter(adapter);
        if (!this.mListShown && !hadAdapter) {
            if (getView().getwindowToken() != null) {
                z = true;
            }
            setListShown(true,z);
        }
    }
}
项目:FreeStreams-TVLauncher    文件Tools.java   
/**
 * @author sunglasses
 * @param listView
 * @category 计算listview高度
 */
public static void setListViewHeightBasedOnChildren(ListView listView) {
    listadapter listadapter = listView.getAdapter();
    if (listadapter == null) {
        return;
    }

    int totalHeight = 0;
    for (int i = 0; i < listadapter.getCount(); i++) {
        View listItem = listadapter.getView(i,listView);
        listItem.measure(0,0);
        totalHeight += listItem.getMeasuredHeight();
    }

    ViewGroup.LayoutParams params = listView.getLayoutParams();
    params.height = totalHeight
            + (listView.getDividerHeight() * (listadapter.getCount() - 1));
    listView.setLayoutParams(params);
}
项目:ZXingAndroidExt    文件LoadPackagesAsyncTask.java   
@Override
protected void onPostExecute(final List<AppInfo> results) {
    listadapter listadapter = new ArrayAdapter<AppInfo>(activity,results) {
        @Override
        public View getView(int position,ViewGroup parent) {
            View view = super.getView(position,parent);
            Drawable icon = results.get(position).getIcon();
            if (icon != null) {
                ((ImageView) view.findViewById(R.id.app_picker_list_item_icon)).setimageDrawable(icon);
            }
            return view;
        }
    };
    activity.setlistadapter(listadapter);
}
项目:HiBangClient    文件RegSchoolActivity.java   
/***
 * 动态设置listview的高度
 * 
 * @param listView
 */
public void setListViewHeightBasedOnChildren(ListView listView) {
    listadapter listadapter = listView.getAdapter();
    if (listadapter == null) {
        return;
    }
    int totalHeight = 0;
    for (int i = 0; i < listadapter.getCount(); i++) {
        View listItem = listadapter.getView(i,0);
        totalHeight += listItem.getMeasuredHeight();
    }
    ViewGroup.LayoutParams params = listView.getLayoutParams();
    params.height = totalHeight
            + (listView.getDividerHeight() * (listadapter.getCount() - 1));
    // params.height += 5;// if without this statement,the listview will be
    // a
    // little short
    // listView.getDividerHeight()获取子项间分隔符占用的高度
    // params.height最后得到整个ListView完整显示需要的高度
    listView.setLayoutParams(params);
}
项目:XinFramework    文件ViewFinder.java   
/**
 * 动态设置ListView的高度
 * @param listView ListView
 */
public static void setListViewHeightBasedOnChildren(ListView listView) {
    if(listView == null) return;

    listadapter listadapter = listView.getAdapter();
    if (listadapter == null) {
        // pre-condition
        return;
    }

    int totalHeight = 0;
    for (int i = 0; i < listadapter.getCount(); i++) {
        View listItem = listadapter.getView(i,0);
        totalHeight += listItem.getMeasuredHeight();
    }

    ViewGroup.LayoutParams params = listView.getLayoutParams();
    params.height = totalHeight + (listView.getDividerHeight() * (listadapter.getCount() - 1));
    listView.setLayoutParams(params);
}
项目:exciting-app    文件AbsHListView.java   
@Override
public void run() {
    // The data has changed since we posted this action in the event
    // queue,// bail out before bad things happen
    if (mDataChanged)
        return;

    final listadapter adapter = mAdapter;
    final int motionPosition = mClickMotionPosition;
    if (adapter != null && mItemCount > 0
            && motionPosition != INVALID_POSITION
            && motionPosition < adapter.getCount() && sameWindow()) {
        final View view = getChildAt(motionPosition - mFirstPosition);
        // If there is no view,something bad happened (the view
        // scrolled off the
        // screen,etc.) and we should cancel the click
        if (view != null) {
            performItemClick(view,motionPosition,adapter.getItemId(motionPosition));
        }
    }
}
项目:lrs_android    文件displayUtil.java   
/**
 * 修正listview高度
 */
public static void setListViewHeightBasedOnChildren(ListView listView) {
    // 获取ListView对应的Adapter
    listadapter listadapter = listView.getAdapter();
    if (listadapter == null) {
        return;
    }
    int totalHeight = 0;
    for (int i = 0; i < listadapter.getCount(); i++) { // listadapter.getCount()返回数据项的数目
        View listItem = listadapter.getView(i,0); // 计算子项View 的宽高
        totalHeight += listItem.getMeasuredHeight(); // 统计所有子项的总高度
    }
    LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,totalHeight
            + (listView.getDividerHeight() * (listadapter.getCount() - 1)));
    listView.setLayoutParams(lp);
}
项目:Idea-ChainSelector    文件PinnedSectionListView.java   
@Override
public void setAdapter(listadapter adapter) {

    // assert adapter in debug mode
    if (BuildConfig.DEBUG && adapter != null) {
        if (!(adapter instanceof PinnedSectionlistadapter))
            throw new IllegalArgumentException("Does your adapter implement PinnedSectionlistadapter?");
        if (adapter.getViewTypeCount() < 2)
            throw new IllegalArgumentException("Does your adapter handle at least two types" +
                    " of views in getViewTypeCount() method: items and sections?");
    }

    // unregister observer at old adapter and register on new one
    listadapter oldAdapter = getAdapter();
    if (oldAdapter != null) oldAdapter.unregisterDataSetobserver(mDataSetobserver);
    if (adapter != null) adapter.registerDataSetobserver(mDataSetobserver);

    // destroy pinned shadow,if new adapter is not same as old one
    if (oldAdapter != adapter) destroyPinnedShadow();

    super.setAdapter(adapter);
}
项目:RabbitCloud    文件SmallToolsHelper.java   
/**
 * 根据子item的高度 动态测量GridView的实际高度
 * @param gridView
 */
public static void setGridViewHeightByChildren(GridView gridView) {
    listadapter listadapter = gridView.getAdapter();
    if (listadapter == null) {
        return;
    }
    //总高度
    int totalHeight = 0;
    int lineNum = gridView.getNumColumns(); //得到布局文件中设置的一行显示几个
    View item = listadapter.getView(0,gridView);
    item.measure(0,0); //计算子item的高度
    //得到总高度
    totalHeight = item.getMeasuredHeight()*lineNum;

    ViewGroup.LayoutParams params = gridView.getLayoutParams();
    params.height = totalHeight;
    gridView.setLayoutParams(params);
}
项目:AndroidMuseumBleManager    文件MergeSpinnerAdapter.java   
public View getDropDownView(int position,ViewGroup parent) {
    for (listadapter piece : getPieces()) {
        int size = piece.getCount();

        if (position < size) {
            return (((SpinnerAdapter) piece).getDropDownView(position,parent));
        }

        position -= size;
    }

    return (null);
}
项目:qmui    文件QMUIAnimationListView.java   
public <T extends listadapter> void manipulateWithoutAnimation(final Manipulator<T> manipulator) {
    Log.i(TAG,"manipulateWithoutAnimation");
    if (!mIsAnimating) {
        manipulator.manipulate((T) mRealAdapter);
        mWrapperAdapter.notifyDataSetChanged();
    } else {
        mPendingManipulationsWithoutAnimation.add(manipulator);
    }
}
项目:NoticeDog    文件DragSortListView.java   
/**
 * As opposed to {@link ListView#getAdapter()},which returns
 * a heavily wrapped listadapter (DragSortListView wraps the
 * input listadapter {\emph and} ListView wraps the wrapped one).
 *
 * @return The listadapter set as the argument of {@link setAdapter()}
 */
public listadapter getInputAdapter() {
    if (mAdapterWrapper == null) {
        return null;
    } else {
        return mAdapterWrapper.getAdapter();
    }
}
项目:letv    文件HListView.java   
protected void onFocusChanged(boolean gainFocus,int direction,Rect prevIoUslyFocusedRect) {
    super.onFocusChanged(gainFocus,direction,prevIoUslyFocusedRect);
    listadapter adapter = this.mAdapter;
    int closetChildindex = -1;
    int closestChildLeft = 0;
    if (!(adapter == null || !gainFocus || prevIoUslyFocusedRect == null)) {
        prevIoUslyFocusedRect.offset(getScrollX(),getScrollY());
        if (adapter.getCount() < getChildCount() + this.mFirstPosition) {
            this.mLayoutMode = 0;
            layoutChildren();
        }
        Rect otherRect = this.mTempRect;
        int mindistance = Integer.MAX_VALUE;
        int childCount = getChildCount();
        int firstPosition = this.mFirstPosition;
        for (int i = 0; i < childCount; i++) {
            if (adapter.isEnabled(firstPosition + i)) {
                View other = getChildAt(i);
                other.getDrawingRect(otherRect);
                offsetDescendantRectToMyCoords(other,otherRect);
                int distance = AbsHListView.getdistance(prevIoUslyFocusedRect,otherRect,direction);
                if (distance < mindistance) {
                    mindistance = distance;
                    closetChildindex = i;
                    closestChildLeft = other.getLeft();
                }
            }
        }
    }
    if (closetChildindex >= 0) {
        setSelectionFromLeft(this.mFirstPosition + closetChildindex,closestChildLeft);
    } else {
        requestLayout();
    }
}
项目:Smarty-Streets-AutoCompleteTextView    文件SmartyStreetsAutocompleteTextView.java   
/**
 * @param adapter the adapter for displaying the list of results in the popup window,must
 *                extend {@link AbstractAddressAutocompleteAdapter} to maintain certain logic
 */
@Override
public final <T extends listadapter & Filterable> void setAdapter(@NonNull final T adapter) {
    if (!(adapter instanceof AbstractAddressAutocompleteAdapter)) {
        throw new IllegalArgumentException("Custom adapters must inherit from " + AbstractAddressAutocompleteAdapter.class.getSimpleName());
    }

    this.adapter = (AbstractAddressAutocompleteAdapter) adapter;

    historyManager = this.adapter.getHistoryManager();
    api = this.adapter.getApi();

    super.setAdapter(adapter);
}
项目:GitHub    文件XListView.java   
@Override
public void setAdapter(listadapter adapter) {
    // make sure XListViewFooter is the last footer view,and only add once.
    if (mIsFooterReady == false) {
        mIsFooterReady = true;
        addFooterView(mFooterView);
        isFooteradded = true;
    }
    super.setAdapter(adapter);
}
项目:GitHub    文件XListView.java   
public void setAdapterNoFooter(listadapter adapter) {
    // make sure XListViewFooter is the last footer view,and only add once.
    if (mIsFooterReady == false) {
        mIsFooterReady = true;

    }
    super.setAdapter(adapter);
}
项目:aos-Video    文件HeaderGridView.java   
public HeaderViewGridAdapter(ArrayList<FixedViewInfo> headerViewInfos,listadapter adapter) {
    mAdapter = adapter;
    mIsFilterable = adapter instanceof Filterable;
    if (headerViewInfos == null) {
        throw new IllegalArgumentException("headerViewInfos cannot be null");
    }
    mHeaderViewInfos = headerViewInfos;
    mAreAllFixedViewsSelectable = areAllListInfosSelectable(mHeaderViewInfos);
}
项目:Swap    文件PLA_ListView.java   
/**
 * Find a position that can be selected (i.e.,is not a separator).
 *
 * @param position The starting position to look at.
 * @param lookDown Whether to look down for other positions.
 * @return The next selectable position starting at position and then searching either up or
 *         down. Returns {@link #INVALID_POSITION} if nothing can be found.
 */
@Override
int lookForSelectablePosition(int position,boolean lookDown) {
    final listadapter adapter = mAdapter;
    if (adapter == null || isInTouchMode()) {
        return INVALID_POSITION;
    }

    final int count = adapter.getCount();
    if (!mAreAllItemsSelectable) {
        if (lookDown) {
            position = Math.max(0,position);
            while (position < count && !adapter.isEnabled(position)) {
                position++;
            }
        } else {
            position = Math.min(position,count - 1);
            while (position >= 0 && !adapter.isEnabled(position)) {
                position--;
            }
        }

        if (position < 0 || position >= count) {
            return INVALID_POSITION;
        }
        return position;
    } else {
        if (position < 0 || position >= count) {
            return INVALID_POSITION;
        }
        return position;
    }
}
项目:PlusGram    文件SectionsListView.java   
@Override
public void setAdapter(listadapter adapter) {
    if (mAdapter == adapter) {
        return;
    }
    pinnedHeader = null;
    if (adapter instanceof BaseSectionsAdapter) {
        mAdapter = (BaseSectionsAdapter) adapter;
    } else {
        mAdapter = null;
    }
    super.setAdapter(adapter);
}
项目:Virtualview-Android    文件DemoListActivity.java   
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(android.R.layout.list_content);
    List<Map<String,String>> list = new ArrayList<Map<String,String>>();
    //HashMap<String,String> main = new HashMap<String,String>();
    //main.put("name","Main(Todo)");
    //main.put("class",MainActivity.class.getName());
    //list.add(main);
    HashMap<String,String> api = new HashMap<String,String>();
    api.put("name","Components");
    api.put("class",ComponentListActivity.class.getName());
    list.add(api);
    HashMap<String,String> bizItems = new HashMap<String,String>();
    bizItems.put("name","TmallComponents");
    bizItems.put("class",TmallComponentListActivity.class.getName());
    list.add(bizItems);
    HashMap<String,String> script = new HashMap<String,String>();
    script.put("name","Scripts(Experimental)");
    script.put("class",ScriptListActivity.class.getName());
    list.add(script);
    HashMap<String,String> parse = new HashMap<String,String>();
    parse.put("name","Parse XML");
    parse.put("class",ParserDemoActivity.class.getName());
    list.add(parse);
    listadapter listadapter = new SimpleAdapter(this,list,android.R.layout.simple_list_item_1,new int[]{android.R.id.text1});
    setlistadapter(listadapter);
}
项目:GitHub    文件SwipeRefreshListFragmentFragment.java   
@Override
public void onViewCreated(View view,Bundle savedInstanceState) {
    super.onViewCreated(view,savedInstanceState);

    /**
     * Create an ArrayAdapter to contain the data for the ListView. Each item in the ListView
     * uses the system-defined simple_list_item_1 layout that contains one TextView.
     */
    listadapter adapter = new ArrayAdapter<String>(
            getActivity(),android.R.id.text1,Cheeses.randomList(LIST_ITEM_COUNT));

    // Set the adapter between the ListView and its backing data.
    setlistadapter(adapter);

    // BEGIN_INCLUDE (setup_refreshlistener)
    /**
     * Implement {@link SwipeRefreshLayout.OnRefreshListener}. When users do the "swipe to
     * refresh" gesture,SwipeRefreshLayout invokes
     * {@link SwipeRefreshLayout.OnRefreshListener#onRefresh onRefresh()}. In
     * {@link SwipeRefreshLayout.OnRefreshListener#onRefresh onRefresh()},call a method that
     * refreshes the content. Call the same method in response to the Refresh action from the
     * action bar.
     */
    setonRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            Log.i(LOG_TAG,"onRefresh called from SwipeRefreshLayout");

            initiateRefresh();
        }
    });
    // END_INCLUDE (setup_refreshlistener)
}
项目:LocationProvider    文件StartActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_start);


    setTitle(R.string.title_main);
    listadapter adapter = new CustomArrayAdapter(
            this.getApplicationContext(),demos);
    setlistadapter(adapter);
}
项目:APIJSON-Android-RxJava    文件XListView.java   
@Override
public void setAdapter(listadapter adapter) {
    // make sure XListViewFooter is the last footer view,and only add once.
    if (mIsFooterReady == false) {
        mIsFooterReady = true;
        addFooterView(mFooterView);
        isFooteradded = true;
    }
    super.setAdapter(adapter);
}
项目:letv    文件PullToRefreshExpandableListView.java   
protected void setRefreshingInternal(boolean doScroll) {
    listadapter adapter = ((ExpandableListView) this.mRefreshableView).getAdapter();
    if (adapter == null || adapter.isEmpty()) {
        super.setRefreshingInternal(doScroll);
        return;
    }
    PullToRefreshHeaderView originalLoadingLayout;
    PullToRefreshHeaderView listViewLoadingLayout;
    int selection;
    int scrollToY;
    super.setRefreshingInternal(false);
    switch (getCurrentMode()) {
        case 2:
            originalLoadingLayout = getFooterLayout();
            listViewLoadingLayout = this.mFooterLoadingView;
            selection = ((ExpandableListView) this.mRefreshableView).getCount() - 1;
            scrollToY = getScrollY() - getHeaderHeight();
            break;
        default:
            originalLoadingLayout = getHeaderLayout();
            listViewLoadingLayout = this.mHeaderLoadingView;
            selection = 0;
            scrollToY = getScrollY() + getHeaderHeight();
            break;
    }
    if (doScroll) {
        setHeaderScroll(scrollToY);
    }
    originalLoadingLayout.setVisibility(4);
    listViewLoadingLayout.setParams(this.objs);
    listViewLoadingLayout.setVisibility(0);
    listViewLoadingLayout.refreshing();
    if (doScroll) {
        ((ExpandableListView) this.mRefreshableView).setSelection(selection);
        smoothScrollTo(0);
    }
}
项目:JYTagView    文件SkillFlowTagLayout.java   
/**
 * 像ListView、GridView一样使用FlowLayout
 *
 * @param adapter
 */
public void setAdapter(listadapter adapter) {
    if (mAdapter != null && mDataSetobserver != null) {
        mAdapter.unregisterDataSetobserver(mDataSetobserver);
    }

    //清除现有的数据
    removeAllViews();
    mAdapter = adapter;

    if (mAdapter != null) {
        mDataSetobserver = new AdapterDataSetobserver();
        mAdapter.registerDataSetobserver(mDataSetobserver);
    }
}
项目:sctalk    文件PullToRefreshListViewForNoneHeaderDivider.java   
@Override
public void setAdapter(listadapter adapter) {
    // Add the Footer View at the last possible moment
    if (null != mLvFooterLoadingFrame && !mAddedLvFooter) {
        addFooterView(mLvFooterLoadingFrame,false);
        mAddedLvFooter = true;
    }

    super.setAdapter(adapter);
}
项目:ankihelper    文件Collins.java   
/**
 * @param context this
 * @param layout  support_simple_spinner_dropdown_item
 * @return
 */
public listadapter getAutoCompleteAdapter(Context context,int layout) {
    SimpleCursorAdapter adapter =
            new SimpleCursorAdapter(context,layout,new String[]{FIELD_HWD},new int[]{android.R.id.text1},0
            );
    adapter.setFilterQueryProvider(
            new FilterQueryProvider() {
                @Override
                public Cursor runQuery(CharSequence constraint) {
                    return getFilterCursor(constraint.toString());
                }
            }
    );
    adapter.setCursorToStringConverter(
            new SimpleCursorAdapter.CursorToStringConverter() {
                @Override
                public CharSequence convertToString(Cursor cursor) {
                    return cursor.getString(1);
                }
            }
    );

    return adapter;
}

相关文章

买水果
比较全面的redis工具类
gson 反序列化到多态子类
java 版本的 mb_strwidth
JAVA 反转字符串的最快方法,大概比StringBuffer.reverse()性...
com.google.gson.internal.bind.ArrayTypeAdapter的实例源码...