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


Java PtrDefaultHandler类代码示例

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


PtrDefaultHandler类属于in.srain.cube.views.ptr包,在下文中一共展示了PtrDefaultHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initRefresh

import in.srain.cube.views.ptr.PtrDefaultHandler; //导入依赖的package包/类
private void initRefresh() {
    mPtrClassicFrameLayout.disableWhenHorizontalMove(true);
    mPtrClassicFrameLayout.setPtrHandler(new PtrDefaultHandler() {
        @Override
        public void onRefreshBegin(final PtrFrameLayout frame) {
            frame.postDelayed(new Runnable() {
                @Override
                public void run() {
                    frame.refreshComplete();
                }
            }, DELAY_MILLS);
        }
    });
    mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
    mRecyclerView.setAdapter(new MyFocusAdapter(getContext(), MyFocusData.getSampleData()));
}
 
开发者ID:NullUsera,项目名称:meipai-Android,代码行数:17,代码来源:MyFocusFragment.java

示例2: initView

import in.srain.cube.views.ptr.PtrDefaultHandler; //导入依赖的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

示例3: initView

import in.srain.cube.views.ptr.PtrDefaultHandler; //导入依赖的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

示例4: initView

import in.srain.cube.views.ptr.PtrDefaultHandler; //导入依赖的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

示例5: initView

import in.srain.cube.views.ptr.PtrDefaultHandler; //导入依赖的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

示例6: onCreate

import in.srain.cube.views.ptr.PtrDefaultHandler; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    ptrFrameLayout = (PtrFrameLayout) findViewById(R.id.main_ptr);

    RecyclerView recyclerView = (RecyclerView) findViewById(R.id.main_recycler_view);
    //noinspection ConstantConditions
    recyclerView.setLayoutManager(new LinearLayoutManager(this));

    List<HeaderDisplay> displayList = createHeaderDisplayList();
    recyclerView.setAdapter(new HeaderAdapter(displayList));

    //emulate data request
    ptrFrameLayout.setPtrHandler(new PtrDefaultHandler() {
        @Override
        public void onRefreshBegin(PtrFrameLayout frame) {
            ptrFrameLayout.postDelayed(mCompleteRefresh, 3000);
        }
    });

}
 
开发者ID:Muyangmin,项目名称:UltraPtrHeaderCollection,代码行数:23,代码来源:MainActivity.java

示例7: initView

import in.srain.cube.views.ptr.PtrDefaultHandler; //导入依赖的package包/类
@Override
protected void initView(View rootView) {
    mPtrFrameLayout = (PtrFrameLayout) rootView.findViewById(R.id.ptr_frame_ultra);

    PtrClassicDefaultHeader header = new PtrClassicDefaultHeader(getContext());
    mPtrFrameLayout.addPtrUIHandler(header);
    mPtrFrameLayout.setHeaderView(header);
    mPtrFrameLayout.setPtrHandler(new PtrDefaultHandler() {
        @Override
        public void onRefreshBegin(PtrFrameLayout frame) {
            frame.postDelayed(new Runnable() {
                @Override
                public void run() {
                    mPtrFrameLayout.refreshComplete();
                }
            }, 2000);
        }
    });
}
 
开发者ID:kylingo,项目名称:MeUI,代码行数:20,代码来源:RefreshUltraTextFragment.java

示例8: initView

import in.srain.cube.views.ptr.PtrDefaultHandler; //导入依赖的package包/类
@Override
protected void initView(View rootView) {
    mPtrFrameLayout = (PtrFrameLayout) rootView.findViewById(R.id.ptr_frame_ultra);

    ListView listView = (ListView) rootView.findViewById(R.id.lv_ultra);
    mArrayAdapter = new ArrayAdapter<>(getActivity(), android.R.layout.simple_list_item_1, getData());
    listView.setAdapter(mArrayAdapter);

    PtrClassicDefaultHeader header = new PtrClassicDefaultHeader(getContext());
    mPtrFrameLayout.addPtrUIHandler(header);
    mPtrFrameLayout.setHeaderView(header);
    mPtrFrameLayout.setPtrHandler(new PtrDefaultHandler() {
        @Override
        public void onRefreshBegin(PtrFrameLayout frame) {
            frame.postDelayed(new Runnable() {
                @Override
                public void run() {
                    mPtrFrameLayout.refreshComplete();
                }
            }, 2000);
        }
    });
}
 
开发者ID:kylingo,项目名称:MeUI,代码行数:24,代码来源:RefreshUltraFragment.java

示例9: onCreate

import in.srain.cube.views.ptr.PtrDefaultHandler; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_tmall);
    // findView
    mPullUpTmly = (TmallRefreshLayout) findViewById(R.id.tmly_pull_up);
    // 设置刷新监听
    mPullUpTmly.setPtrHandler(new PtrDefaultHandler() {
        @Override
        public void onRefreshBegin(PtrFrameLayout frame) {
            // 刷新操作
            if (mHandler != null)
                mHandler.postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        // 刷新完毕
                        if (mPullUpTmly != null)
                            mPullUpTmly.refreshComplete();
                    }
                }, 1500);
        }
    });
}
 
开发者ID:leibing8912,项目名称:LbaizxfPulltoRefresh,代码行数:24,代码来源:TmallActivity.java

示例10: onCreate

import in.srain.cube.views.ptr.PtrDefaultHandler; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_jd);
    // findView
    mPullUpJdly = (JdRefreshLayout) findViewById(R.id.jdly_pull_up);
    // 设置刷新监听
    mPullUpJdly.setPtrHandler(new PtrDefaultHandler() {
        @Override
        public void onRefreshBegin(PtrFrameLayout frame) {
            // 刷新操作
            if (mHandler != null)
                mHandler.postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        // 刷新完毕
                        if (mPullUpJdly != null)
                            mPullUpJdly.refreshComplete();
                    }
                }, 1500);
        }
    });
}
 
开发者ID:leibing8912,项目名称:LbaizxfPulltoRefresh,代码行数:24,代码来源:JdActivity.java

示例11: onCreateView

import in.srain.cube.views.ptr.PtrDefaultHandler; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.currency_list_fragment, container, false);
    ButterKnife.inject(this, view);

    new DbListLoader().execute();

    mPullToRefresh.setPtrHandler(new PtrDefaultHandler() {
        @Override
        public void onRefreshBegin(PtrFrameLayout ptrFrameLayout) {
            fetchNewSupportedCurrencies();
        }
    });


    mListView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
    mListView.setOnItemClickListener(this);

    return view;
}
 
开发者ID:romankl,项目名称:bc-tracker-android,代码行数:21,代码来源:CurrencyListFragment.java

示例12: initView

import in.srain.cube.views.ptr.PtrDefaultHandler; //导入依赖的package包/类
private void initView() {
    initData();
    linearLayoutManager = new LinearLayoutManager(this);
    recyclerViewAdapter = new RecyclerViewAdapter();
    recyclerView.setLayoutManager(linearLayoutManager);
    recyclerView.setAdapter(recyclerViewAdapter);

    ptrFrame.setPtrHandler(new PtrDefaultHandler() {
        @Override
        public void onRefreshBegin(PtrFrameLayout frame) {
            ptrFrame.refreshComplete();
        }
    });

    recyclerView.addOnScrollListener(new EndlessRecyclerOnScrollListener() {
        @Override
        public void onLoadMore() {
            recyclerViewAdapter.setLoadMore(true);

            new Timer().schedule(new TimerTask() {
                @Override
                public void run() {
                    runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            initData();
                            recyclerViewAdapter.setLoadMore(false);
                        }
                    });
                }
            }, 1000);
        }
    });
}
 
开发者ID:alidili,项目名称:TestDemo,代码行数:35,代码来源:RecyclerViewActivity.java

示例13: onCreate

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

    mPtrFrame = findViewById(R.id.arad_content);
    mRecycleView = findViewById(R.id.recycle_view);

    items.add(new DemoHeader(mPresenter.getTopImageList()));
    items.addAll(mPresenter.getList());
    mAdapter = new MultiTypeAdapter(items);
    mAdapter.register(DemoHeader.class, new HeaderViewBinder());
    mAdapter.register(News.class, new NewsViewBinder());
    LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
    mRecycleView.setLayoutManager(linearLayoutManager);
    mRecycleView.setAdapter(new LoadMoreAdapterWrapper(this, mAdapter, mPresenter));

    mPresenter.loadDataFirst();

    mRecycleView.addOnScrollListener(new EndlessRecyclerOnScrollListener(linearLayoutManager, mPresenter) {
        @Override
        public void onLoadMore() {
            mPresenter.loadDataNext();
        }
    });


    mPtrFrame.setPtrHandler(new PtrDefaultHandler() {
        @Override
        public void onRefreshBegin(PtrFrameLayout frame) {
            mPresenter.loadDataFirst();
        }
    });
}
 
开发者ID:beanu,项目名称:smart-farmer-android,代码行数:35,代码来源:DemoHeaderLoadMoreActivity.java

示例14: onCreate

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

    //初始化view
    mPtrFrame = findViewById(R.id.arad_content);
    mRecycleView = findViewById(R.id.recycle_view);

    //定义recycle view 样式
    mAdapter = new MultiTypeAdapter(mPresenter.getList());
    mAdapter.register(News.class, new NewsViewBinder());
    LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
    mRecycleView.setLayoutManager(linearLayoutManager);
    mRecycleView.setAdapter(new LoadMoreAdapterWrapper(this, mAdapter, mPresenter));

    //上拉监听
    mRecycleView.addOnScrollListener(new EndlessRecyclerOnScrollListener(linearLayoutManager, mPresenter) {
        @Override
        public void onLoadMore() {
            mPresenter.loadDataNext();
        }
    });

    //下拉刷新监听
    mPtrFrame.setPtrHandler(new PtrDefaultHandler() {
        @Override
        public void onRefreshBegin(PtrFrameLayout frame) {
            mPresenter.loadDataFirst();
        }
    });

    mPresenter.loadDataFirst();
}
 
开发者ID:beanu,项目名称:smart-farmer-android,代码行数:35,代码来源:DemoLoadMoreActivity.java

示例15: initView

import in.srain.cube.views.ptr.PtrDefaultHandler; //导入依赖的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


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