@@ -0,0 +1,2678 @@
+/*%0A* Copyright 2014 Qianqian Zhu %3Czhuqianqian.299@gmail.com%3E All rights reserved.%0A*%0A* Licensed under the Apache License, Version 2.0 (the %22License%22);%0A* you may not use this file except in compliance with the License.%0A* You may obtain a copy of the License at%0A*%0A* http://www.apache.org/licenses/LICENSE-2.0%0A*%0A* Unless required by applicable law or agreed to in writing, software%0A* distributed under the License is distributed on an %22AS IS%22 BASIS,%0A* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A* See the License for the specific language governing permissions and%0A* limitations under the License.%0A*/%0A%0Apackage com.z299studio.pb;%0A%0Aimport android.content.Context;%0Aimport android.graphics.drawable.Drawable;%0Aimport android.view.View;%0Aimport android.view.ViewGroup;%0Aimport android.widget.BaseAdapter;%0Aimport android.widget.ImageButton;%0Aimport android.widget.TextView;%0A%0Aimport java.util.ArrayList;%0A%0Apublic class MainListAdapter extends BaseAdapter %7B%0A%0A    public interface OnListItemCheckListener%7B%0A        public void onCheck(int count);%0A    %7D%0A%0A    private static class ViewHolder %7B%0A        public ImageButton mIconView;%0A        public TextView mTextView;%0A        public boolean mInflate;%0A    %7D%0A%0A    private ArrayList%3CAccountManager.Account%3E mEntries;%0A    private ArrayList%3CInteger%3E mIcons;%0A    private ArrayList%3CBoolean%3E mChecked;%0A    private ArrayList%3CBoolean%3E mDeleted;%0A    private int mCheckCount = 0;%0A    private Context mContext;%0A    private OnListItemCheckListener mListener;%0A    private int mDefaultDrawableId;%0A%0A    public MainListAdapter(Context context, ArrayList%3CAccountManager.Account%3E accounts,%0A                           int%5B%5D drawableResIds, int defaultDrawableResId) %7B%0A        mDefaultDrawableId = defaultDrawableResId;%0A    %7D%0A%0A    @Override%0A    public View getView(final int position, View convertView, ViewGroup parent) %7B%0A        return null;%0A    %7D%0A%0A    @Override%0A    public int getCount() %7B  return mEntries.size();  %7D%0A%0A    @Override%0A    public Object getItem(int position) %7B return mEntries.get(position); %7D%0A%0A    @Override%0A    public long getItemId(int position) %7B return position;  %7D%0A%0A    public void addList(ArrayList%3CAccountManager.Account%3E itemList, boolean reset) %7B%0A        if(reset) %7B%0A            setList(itemList, null);%0A            notifyDataSetChanged();%0A        %7D%0A        else %7B%0A            for(AccountManager.Account a : itemList) %7B%0A                mEntries.add(a);%0A                mChecked.add(Boolean.FALSE);%0A                mDeleted.add(Boolean.FALSE);%0A                mIcons.add(mDefaultDrawableId);%0A            %7D%0A        %7D%0A    %7D%0A%0A    private void setList(ArrayList%3CAccountManager.Account%3E accounts, int%5B%5D icons) %7B%0A%0A    %7D%0A%7D%0A

build main list