Search in sources :

Example 1 with OSCBlogAdapter

use of org.kymjs.blog.adapter.OSCBlogAdapter in project KJFrameForAndroid by kymjs.

the class OSCBlogListFragment method fillUI.

private void fillUI() {
    cache = kjh.getStringCache(OSCBLOG_HOST + BLOGLIST_ID);
    if (!StringUtils.isEmpty(cache)) {
        OSCBlogList dataRes = Parser.xmlToBean(OSCBlogList.class, cache);
        mDatas.addAll(dataRes.getBloglist());
        if (adapter == null) {
            adapter = new OSCBlogAdapter(mListView, mDatas, R.layout.item_list_blog);
            mListView.setAdapter(adapter);
        } else {
            adapter.refresh(mDatas);
        }
        mEmptyLayout.dismiss();
    }
    refresh();
}
Also used : OSCBlogAdapter(org.kymjs.blog.adapter.OSCBlogAdapter) OSCBlogList(org.kymjs.blog.domain.OSCBlogList)

Example 2 with OSCBlogAdapter

use of org.kymjs.blog.adapter.OSCBlogAdapter in project KJFrameForAndroid by kymjs.

the class OSCBlogListFragment method initWidget.

@Override
protected void initWidget(View parentView) {
    super.initWidget(parentView);
    mEmptyLayout.setOnLayoutClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            mEmptyLayout.setErrorType(EmptyLayout.NETWORK_LOADING);
            refresh();
        }
    });
    mListView = mRefreshLayout.getRefreshView();
    mListView.setDivider(new ColorDrawable(android.R.color.transparent));
    mListView.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            if (parent.getAdapter() instanceof OSCBlogAdapter) {
                Bundle bundle = new Bundle();
                bundle.putInt("oscblog_id", ((OSCBlog) parent.getAdapter().getItem(position)).getId());
                SimpleBackActivity.postShowWith(outsideAty, SimpleBackPage.OSC_BLOG_DETAIL, bundle);
            }
        }
    });
    mRefreshLayout.setPullLoadEnabled(true);
    ((FooterLoadingLayout) mRefreshLayout.getFooterLoadingLayout()).setNoMoreDataText("已经没有更多了~");
    mRefreshLayout.setOnRefreshListener(new OnRefreshListener<ListView>() {

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

        @Override
        public void onPullUpToRefresh(PullToRefreshBase<ListView> refreshView) {
            refresh(mDatas.size() / 20);
        }
    });
    fillUI();
}
Also used : OnItemClickListener(android.widget.AdapterView.OnItemClickListener) Bundle(android.os.Bundle) OSCBlogAdapter(org.kymjs.blog.adapter.OSCBlogAdapter) View(android.view.View) BindView(org.kymjs.kjframe.ui.BindView) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) FooterLoadingLayout(org.kymjs.blog.ui.widget.listview.FooterLoadingLayout) ListView(android.widget.ListView) ColorDrawable(android.graphics.drawable.ColorDrawable) OnClickListener(android.view.View.OnClickListener) OSCBlog(org.kymjs.blog.domain.OSCBlog)

Aggregations

OSCBlogAdapter (org.kymjs.blog.adapter.OSCBlogAdapter)2 ColorDrawable (android.graphics.drawable.ColorDrawable)1 Bundle (android.os.Bundle)1 View (android.view.View)1 OnClickListener (android.view.View.OnClickListener)1 AdapterView (android.widget.AdapterView)1 OnItemClickListener (android.widget.AdapterView.OnItemClickListener)1 ListView (android.widget.ListView)1 OSCBlog (org.kymjs.blog.domain.OSCBlog)1 OSCBlogList (org.kymjs.blog.domain.OSCBlogList)1 FooterLoadingLayout (org.kymjs.blog.ui.widget.listview.FooterLoadingLayout)1 BindView (org.kymjs.kjframe.ui.BindView)1