com.handmark.pulltorefresh.library.ILoadingLayout Java Examples

The following examples show how to use com.handmark.pulltorefresh.library.ILoadingLayout. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CloudChatRecordActivity.java    From imsdk-android with MIT License 5 votes vote down vote up
void initViews()
    {
        QtNewActionBar actionBar = (QtNewActionBar) this.findViewById(R.id.my_action_bar);
        setNewActionBar(actionBar);
        ILoadingLayout startLabels = recors_of_chat
                .getLoadingLayoutProxy();
        startLabels.setPullLabel(getText(R.string.atom_ui_tip_prelode_history));// 刚下拉时,显示的提示
        startLabels.setRefreshingLabel(getText(R.string.atom_ui_tip_loding_history));// 刷新时
        startLabels.setReleaseLabel(getText(R.string.atom_ui_tip_release_load));// 下来达到一定距离时,显示的提示
        if(adapter == null)
        {
            adapter = new ExtendChatViewAdapter(this,toId,getHandler(),isFromGroup);
            adapter.setGravatarHandler(new ChatViewAdapter.GravatarHandler() {
                @Override
                public void requestGravatarEvent(String jid, String imageSrc, SimpleDraweeView view) {

                }

//                @Override
//                public void requestGravatarEvent(final String nickOrUid, final SimpleDraweeView view) {
//                    ProfileUtils.displayGravatarByFullname(nickOrUid,view);
//                }
            });
            adapter.setContextMenuRegister(new ChatViewAdapter.ContextMenuRegister() {
                @Override
                public void registerContextMenu(View v) {
                    registerForContextMenu(v);
                }
            });
            recors_of_chat.getRefreshableView().setAdapter(adapter);
            recors_of_chat.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener<ListView>() {
                @Override
                public void onRefresh(PullToRefreshBase<ListView> listViewPullToRefreshBase) {
                    loadCloudRecords();
                }
            });
        }
    }
 
Example #2
Source File: PullToRefreshCustomActivity.java    From effective_android_sample with Apache License 2.0 4 votes vote down vote up
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_ptr_list);

    mPullRefreshListView = (PullToRefreshListView) findViewById(R.id.pull_refresh_list);

    // Set a listener to be invoked when the list should be refreshed.
    mPullRefreshListView.setOnRefreshListener(new OnRefreshListener<ListView>() {
        // ひっぱりきって指をはなしたとき?
        @Override
        public void onRefresh(PullToRefreshBase<ListView> refreshView) {
            String label = DateUtils.formatDateTime(getApplicationContext(),
                    System.currentTimeMillis(),
                    DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_SHOW_DATE
                            | DateUtils.FORMAT_ABBREV_ALL);

            // Update the LastUpdatedLabel
            refreshView.getLoadingLayoutProxy().setLastUpdatedLabel(label);

            // Do work to refresh the list here.
            new GetDataTask().execute();
        }
    });

    /**
     * customize
     */
    mPullRefreshListView.setMode(Mode.BOTH);

    // LoadingLayoutに関してカスタマイズ(主に文言)
    ILoadingLayout iLoadingLayout = mPullRefreshListView.getLoadingLayoutProxy(true, true);
    iLoadingLayout.setLastUpdatedLabel("");
    iLoadingLayout.setReleaseLabel("離してください、更新します");
    iLoadingLayout.setPullLabel("さらに下に引いて下さい");
    iLoadingLayout.setRefreshingLabel("更新中です");

    // Add an end-of-list listener
    mPullRefreshListView.setOnLastItemVisibleListener(new OnLastItemVisibleListener() {

        @Override
        public void onLastItemVisible() {
            Toast.makeText(PullToRefreshCustomActivity.this, "End of List!", Toast.LENGTH_SHORT)
                    .show();
        }
    });

    /**
     *  リスト表示
     */
    mIemsList = new LinkedList<String>();
    mIemsList.addAll(Arrays.asList(INITIAL_LIST));
    mAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, mIemsList);

    ListView actualListView = mPullRefreshListView.getRefreshableView();
    actualListView.setAdapter(mAdapter);
}