Search in sources :

Example 1 with PullToRefreshListView

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

the class BrowserWeiboMsgFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    SwipeFrameLayout swipeFrameLayout = new SwipeFrameLayout(getActivity());
    PullToRefreshListView pullToRefreshListView = new PullToRefreshListView(getActivity());
    pullToRefreshListView.setMode(PullToRefreshBase.Mode.DISABLED);
    pullToRefreshListView.setOnLastItemVisibleListener(onLastItemVisibleListener);
    pullToRefreshListView.setOnScrollListener(listViewOnScrollListener);
    listView = pullToRefreshListView.getRefreshableView();
    View header = inflater.inflate(R.layout.browserweibomsgfragment_layout, listView, false);
    listView.addHeaderView(header);
    View switchView = inflater.inflate(R.layout.browserweibomsgfragment_switch_list_type_header, listView, false);
    listView.addHeaderView(switchView);
    switchView.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
        //empty
        }
    });
    View progressHeaderLayout = inflater.inflate(R.layout.browserweibomsgfragment_progress_header, listView, false);
    progressHeader = progressHeaderLayout.findViewById(R.id.progressbar);
    progressHeader.setVisibility(View.GONE);
    listView.addHeaderView(progressHeaderLayout);
    View emptyLayout = inflater.inflate(R.layout.browserweibomsgfragment_empty_header, listView, false);
    emptyHeader = (TextView) emptyLayout.findViewById(R.id.empty_text);
    emptyHeader.setOnClickListener(new EmptyHeaderOnClickListener());
    listView.addHeaderView(emptyLayout);
    footerView = inflater.inflate(R.layout.listview_footer_layout, null);
    listView.addFooterView(footerView);
    dismissFooterView();
    repostTab = (TextView) switchView.findViewById(R.id.repost);
    commentTab = (TextView) switchView.findViewById(R.id.comment);
    repostTab.setOnClickListener(new RepostTabOnClickListener());
    commentTab.setOnClickListener(new CommentTabOnClickListener());
    commentTab.setTextColor(getResources().getColor(R.color.orange));
    listView.setFooterDividersEnabled(false);
    listView.setChoiceMode(AbsListView.CHOICE_MODE_SINGLE);
    listView.setOnItemClickListener(commentOnItemClickListener);
    listView.setOnItemLongClickListener(commentOnItemLongClickListener);
    initView(header, savedInstanceState);
    adapter = new BrowserWeiboMsgCommentAndRepostAdapter(this, listView, commentList.getItemList(), repostList.getItemList());
    listView.setAdapter(adapter);
    adapter.notifyDataSetChanged();
    listView.setHeaderDividersEnabled(false);
    swipeFrameLayout.addView(pullToRefreshListView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    return swipeFrameLayout;
}
Also used : BrowserWeiboMsgCommentAndRepostAdapter(org.qii.weiciyuan.ui.adapter.BrowserWeiboMsgCommentAndRepostAdapter) PullToRefreshListView(org.qii.weiciyuan.support.lib.pulltorefresh.PullToRefreshListView) ViewGroup(android.view.ViewGroup) SwipeFrameLayout(org.qii.weiciyuan.support.lib.SwipeFrameLayout) ImageView(android.widget.ImageView) WeiboDetailImageView(org.qii.weiciyuan.support.lib.WeiboDetailImageView) View(android.view.View) AdapterView(android.widget.AdapterView) PullToRefreshListView(org.qii.weiciyuan.support.lib.pulltorefresh.PullToRefreshListView) TextView(android.widget.TextView) ListView(android.widget.ListView) AbsListView(android.widget.AbsListView) ProfileTopAvatarImageView(org.qii.weiciyuan.support.lib.ProfileTopAvatarImageView)

Example 2 with PullToRefreshListView

use of org.qii.weiciyuan.support.lib.pulltorefresh.PullToRefreshListView 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 3 with PullToRefreshListView

use of org.qii.weiciyuan.support.lib.pulltorefresh.PullToRefreshListView 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)

Example 4 with PullToRefreshListView

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

the class AbstractUserListFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.listview_layout, container, false);
    empty = (TextView) view.findViewById(R.id.empty);
    progressBar = (ProgressBar) view.findViewById(R.id.progressbar);
    pullToRefreshListView = (PullToRefreshListView) view.findViewById(R.id.listView);
    pullToRefreshListView.setOnRefreshListener(new UserListOnRefreshListener());
    pullToRefreshListView.setOnLastItemVisibleListener(new UserListOnLastItemVisibleListener());
    pullToRefreshListView.setOnPullEventListener(getPullEventListener());
    pullToRefreshListView.setOnScrollListener(new UserListOnScrollListener());
    pullToRefreshListView.setOnItemClickListener(new UserListOnItemClickListener());
    pullToRefreshListView.getRefreshableView().setFooterDividersEnabled(false);
    footerView = inflater.inflate(R.layout.listview_footer_layout, null);
    getListView().addFooterView(footerView);
    dismissFooterView();
    userListAdapter = new UserListAdapter(AbstractUserListFragment.this, bean.getUsers(), getListView());
    pullToRefreshListView.setAdapter(userListAdapter);
    return view;
}
Also used : 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) UserListAdapter(org.qii.weiciyuan.ui.adapter.UserListAdapter)

Aggregations

View (android.view.View)4 AdapterView (android.widget.AdapterView)4 ListView (android.widget.ListView)4 TextView (android.widget.TextView)4 PullToRefreshListView (org.qii.weiciyuan.support.lib.pulltorefresh.PullToRefreshListView)4 AbsListView (android.widget.AbsListView)3 PullToRefreshBase (org.qii.weiciyuan.support.lib.pulltorefresh.PullToRefreshBase)2 ViewGroup (android.view.ViewGroup)1 ImageButton (android.widget.ImageButton)1 ImageView (android.widget.ImageView)1 ProgressBar (android.widget.ProgressBar)1 MessageBean (org.qii.weiciyuan.bean.MessageBean)1 ProfileTopAvatarImageView (org.qii.weiciyuan.support.lib.ProfileTopAvatarImageView)1 SwipeFrameLayout (org.qii.weiciyuan.support.lib.SwipeFrameLayout)1 VelocityListView (org.qii.weiciyuan.support.lib.VelocityListView)1 WeiboDetailImageView (org.qii.weiciyuan.support.lib.WeiboDetailImageView)1 BrowserWeiboMsgCommentAndRepostAdapter (org.qii.weiciyuan.ui.adapter.BrowserWeiboMsgCommentAndRepostAdapter)1 UserListAdapter (org.qii.weiciyuan.ui.adapter.UserListAdapter)1