当前位置: 首页>>代码示例>>Java>>正文


Java PtrClassicFrameLayout.setPtrHandler方法代码示例

本文整理汇总了Java中in.srain.cube.views.ptr.PtrClassicFrameLayout.setPtrHandler方法的典型用法代码示例。如果您正苦于以下问题:Java PtrClassicFrameLayout.setPtrHandler方法的具体用法?Java PtrClassicFrameLayout.setPtrHandler怎么用?Java PtrClassicFrameLayout.setPtrHandler使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在in.srain.cube.views.ptr.PtrClassicFrameLayout的用法示例。


在下文中一共展示了PtrClassicFrameLayout.setPtrHandler方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initView

import in.srain.cube.views.ptr.PtrClassicFrameLayout; //导入方法依赖的package包/类
private void initView(View v) {

        tvAbout=(TextView)v.findViewById(R.id.tv_about);
        tvAbout.setMovementMethod(LinkMovementMethod.getInstance());
        tvAbout.setText(Html.fromHtml((getResources().getString((R.string.app_about)))));

        ptr = (PtrClassicFrameLayout) v.findViewById(R.id.ptr_main);

        ptr.setPtrHandler(new PtrDefaultHandler() {
            @Override
            public void onRefreshBegin(PtrFrameLayout ptrFrameLayout) {
                new Handler().postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        ptr.refreshComplete();
                    }
                }, 2000);
            }
        });
    }
 
开发者ID:xulailing,项目名称:android-open-project-demo-master,代码行数:21,代码来源:ContentTextViewFragment.java

示例2: initView

import in.srain.cube.views.ptr.PtrClassicFrameLayout; //导入方法依赖的package包/类
private void initView(View v) {

        ptr = (PtrClassicFrameLayout) v.findViewById(R.id.ptr_main);

        rvMain = (RecyclerView) v.findViewById(R.id.rv_main);


        rvMain.setLayoutManager(new LinearLayoutManager(getActivity()));

        ptr.setPtrHandler(new PtrDefaultHandler() {
            @Override
            public void onRefreshBegin(PtrFrameLayout ptrFrameLayout) {
                getData();
                ptr.refreshComplete();
            }
        });

        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                ptr.autoRefresh();
            }
        }, 100);

    }
 
开发者ID:xulailing,项目名称:android-open-project-demo-master,代码行数:26,代码来源:ContentRecyclerViewFragment.java

示例3: initView

import in.srain.cube.views.ptr.PtrClassicFrameLayout; //导入方法依赖的package包/类
private void initView(View v) {

        gvMain = (GridView) v.findViewById(R.id.gv_main);
        ptr = (PtrClassicFrameLayout) v.findViewById(R.id.ptr_main);
        ptr.setPtrHandler(new PtrDefaultHandler() {
            @Override
            public void onRefreshBegin(PtrFrameLayout ptrFrameLayout) {
                getData();
                ptr.refreshComplete();
            }
        });

        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                ptr.autoRefresh();
            }
        }, 100);

    }
 
开发者ID:xulailing,项目名称:android-open-project-demo-master,代码行数:21,代码来源:ContentGridViewFragment.java

示例4: initView

import in.srain.cube.views.ptr.PtrClassicFrameLayout; //导入方法依赖的package包/类
private void initView(View v) {

        lvMain = (ListView) v.findViewById(R.id.lv_main);
        ptr = (PtrClassicFrameLayout) v.findViewById(R.id.ptr_main);
        ptr.setPtrHandler(new PtrDefaultHandler() {
            @Override
            public void onRefreshBegin(PtrFrameLayout ptrFrameLayout) {
                getData();
                ptr.refreshComplete();
            }
        });

        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                ptr.autoRefresh();
            }
        }, 100);

    }
 
开发者ID:xulailing,项目名称:android-open-project-demo-master,代码行数:21,代码来源:ContentListViewFragment.java

示例5: initView

import in.srain.cube.views.ptr.PtrClassicFrameLayout; //导入方法依赖的package包/类
private void initView(View v) {
    ptr = (PtrClassicFrameLayout) v.findViewById(R.id.ptr_main);

    ptr.setPtrHandler(new PtrDefaultHandler() {
        @Override
        public void onRefreshBegin(PtrFrameLayout ptrFrameLayout) {
            new Handler().postDelayed(new Runnable() {
                @Override
                public void run() {
                    ptr.refreshComplete();
                }
            }, 2000);
        }
    });
}
 
开发者ID:xulailing,项目名称:android-open-project-demo-master,代码行数:16,代码来源:ContentScrollViewFragment.java

示例6: onCreate

import in.srain.cube.views.ptr.PtrClassicFrameLayout; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_demo_classic_ptr);


    mPtrFrame = (PtrClassicFrameLayout) findViewById(R.id.ptr_frame);
    RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recycle_view);

    //TODO TEST DATA
    Items allList = new Items();
    for (int i = 0; i < 20; i++) {
        News news = new News();
        news.setImgPath("http://ds.cdncache.org/avatar-50/532/164695.jpg");
        news.setTitle("新闻标题" + i);
        news.setDesc("新闻描述" + i);
        allList.add(news);
    }

    mAdapter = new MultiTypeAdapter(allList);
    mAdapter.register(News.class, new NewsViewBinder());
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    recyclerView.setAdapter(mAdapter);

    mPtrFrame.postDelayed(new Runnable() {
        @Override
        public void run() {
            mPtrFrame.autoRefresh();
        }
    }, 1000);

    mPtrFrame.setPtrHandler(new PtrDefaultHandler() {
        @Override
        public void onRefreshBegin(PtrFrameLayout frame) {
            ToastUtils.showShort("刷新了");

            Observable.timer(1, TimeUnit.SECONDS)
                    .subscribeOn(Schedulers.newThread())
                    .observeOn(AndroidSchedulers.mainThread())
                    .subscribe(new Consumer<Long>() {
                        @Override
                        public void accept(Long aLong) {
                            mPtrFrame.refreshComplete();
                        }
                    });
        }
    });

}
 
开发者ID:beanu,项目名称:smart-farmer-android,代码行数:50,代码来源:DemoClassicPTRActivity.java


注:本文中的in.srain.cube.views.ptr.PtrClassicFrameLayout.setPtrHandler方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。