Search in sources :

Example 1 with PullToRefreshBase

use of org.qii.weiciyuan.support.lib.pulltorefresh.PullToRefreshBase in project weiciyuan by qii.

the class DMConversationListFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.dmconversationlistfragment_layout, container, false);
    empty = (TextView) view.findViewById(R.id.empty);
    //dirty hack.....in other list, progressbar is used to indicate loading local data; but in this list,
    //use a progressbar to indicate loading new data first time, maybe be refactored at 0.50 version
    progressBar = new ProgressBar(getActivity());
    dmProgressBar = (ProgressBar) view.findViewById(R.id.progressbar);
    pullToRefreshListView = (PullToRefreshListView) view.findViewById(R.id.listView);
    pullToRefreshListView.setMode(PullToRefreshBase.Mode.BOTH);
    pullToRefreshListView.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener2<ListView>() {

        @Override
        public void onPullDownToRefresh(PullToRefreshBase<ListView> refreshView) {
            loadOldMsg(null);
        }

        @Override
        public void onPullUpToRefresh(PullToRefreshBase<ListView> refreshView) {
            loadNewMsg();
        }
    });
    getListView().setScrollingCacheEnabled(false);
    getListView().setHeaderDividersEnabled(false);
    getListView().setStackFromBottom(true);
    footerView = inflater.inflate(R.layout.listview_footer_layout, null);
    getListView().addFooterView(footerView);
    dismissFooterView();
    et = (EditText) view.findViewById(R.id.content);
    view.findViewById(R.id.send).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            send();
        }
    });
    ImageButton emoticon = (ImageButton) view.findViewById(R.id.emoticon);
    emoticon.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            if (smiley.isShown()) {
                hideSmileyPicker(true);
            } else {
                showSmileyPicker(SmileyPickerUtility.isKeyBoardShow(getActivity()));
            }
        }
    });
    smiley = (SmileyPicker) view.findViewById(R.id.smiley_picker);
    smiley.setEditText(getActivity(), (ViewGroup) view.findViewById(R.id.root_layout), et);
    mContainer = (LinearLayout) view.findViewById(R.id.container);
    et.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            hideSmileyPicker(true);
        }
    });
    buildListAdapter();
    return view;
}
Also used : ImageButton(android.widget.ImageButton) PullToRefreshListView(org.qii.weiciyuan.support.lib.pulltorefresh.PullToRefreshListView) ListView(android.widget.ListView) PullToRefreshBase(org.qii.weiciyuan.support.lib.pulltorefresh.PullToRefreshBase) View(android.view.View) AdapterView(android.widget.AdapterView) PullToRefreshListView(org.qii.weiciyuan.support.lib.pulltorefresh.PullToRefreshListView) TextView(android.widget.TextView) ListView(android.widget.ListView) ProgressBar(android.widget.ProgressBar)

Example 2 with PullToRefreshBase

use of org.qii.weiciyuan.support.lib.pulltorefresh.PullToRefreshBase in project weiciyuan by qii.

the class RepostsByIdTimeLineFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.repostsbyidtimelinefragment_layout, container, false);
    empty = (TextView) view.findViewById(R.id.empty);
    progressBar = (ProgressBar) view.findViewById(R.id.progressbar);
    quick_repost = (LinearLayout) view.findViewById(R.id.quick_repost);
    pullToRefreshListView = (PullToRefreshListView) view.findViewById(R.id.listView);
    pullToRefreshListView.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener<ListView>() {

        @Override
        public void onRefresh(PullToRefreshBase<ListView> refreshView) {
            loadNewMsg();
        }
    });
    pullToRefreshListView.setOnLastItemVisibleListener(new PullToRefreshBase.OnLastItemVisibleListener() {

        @Override
        public void onLastItemVisible() {
            loadOldMsg(null);
        }
    });
    getListView().setScrollingCacheEnabled(false);
    getListView().setHeaderDividersEnabled(false);
    footerView = inflater.inflate(R.layout.listview_footer_layout, null);
    getListView().addFooterView(footerView);
    dismissFooterView();
    getListView().setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            if (actionMode != null) {
                getListView().clearChoices();
                actionMode.finish();
                actionMode = null;
                return;
            }
            getListView().clearChoices();
            if (position - 1 < getList().getSize() && position - 1 >= 0) {
                listViewItemClick(parent, view, position - 1, id);
            } else if (position - 1 >= getList().getSize()) {
                loadOldMsg(view);
            }
        }
    });
    if (savedInstanceState == null && msg != null) {
        if (msg.getRetweeted_status() == null) {
            quick_repost.setVisibility(View.VISIBLE);
        }
    } else if (savedInstanceState != null) {
        msg = (MessageBean) savedInstanceState.getParcelable("msg");
        if (msg.getRetweeted_status() == null) {
            quick_repost.setVisibility(View.VISIBLE);
        }
    }
    et = (EditText) view.findViewById(R.id.content);
    view.findViewById(R.id.send).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            sendRepost();
        }
    });
    buildListAdapter();
    return view;
}
Also used : MessageBean(org.qii.weiciyuan.bean.MessageBean) VelocityListView(org.qii.weiciyuan.support.lib.VelocityListView) View(android.view.View) AdapterView(android.widget.AdapterView) PullToRefreshListView(org.qii.weiciyuan.support.lib.pulltorefresh.PullToRefreshListView) AbsListView(android.widget.AbsListView) TextView(android.widget.TextView) ListView(android.widget.ListView) VelocityListView(org.qii.weiciyuan.support.lib.VelocityListView) PullToRefreshListView(org.qii.weiciyuan.support.lib.pulltorefresh.PullToRefreshListView) AbsListView(android.widget.AbsListView) ListView(android.widget.ListView) AdapterView(android.widget.AdapterView) PullToRefreshBase(org.qii.weiciyuan.support.lib.pulltorefresh.PullToRefreshBase)

Aggregations

View (android.view.View)2 AdapterView (android.widget.AdapterView)2 ListView (android.widget.ListView)2 TextView (android.widget.TextView)2 PullToRefreshBase (org.qii.weiciyuan.support.lib.pulltorefresh.PullToRefreshBase)2 PullToRefreshListView (org.qii.weiciyuan.support.lib.pulltorefresh.PullToRefreshListView)2 AbsListView (android.widget.AbsListView)1 ImageButton (android.widget.ImageButton)1 ProgressBar (android.widget.ProgressBar)1 MessageBean (org.qii.weiciyuan.bean.MessageBean)1 VelocityListView (org.qii.weiciyuan.support.lib.VelocityListView)1