Java Code Examples for com.handmark.pulltorefresh.library.PullToRefreshListView#setMode()

The following examples show how to use com.handmark.pulltorefresh.library.PullToRefreshListView#setMode() . 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: DailyNoteListActivity.java    From imsdk-android with MIT License 6 votes vote down vote up
private void initView() {
    actionBar = (QtNewActionBar) this.findViewById(R.id.my_action_bar);
    setNewActionBar(actionBar);
    setActionBarTitle(R.string.atom_ui_note_title_notebook);
    setActionBarRightText(R.string.atom_ui_btn_note_new);
    setActionBarRightTextClick(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            showNoteDialogDialog();
        }
    });

    notelist_listview = (PullToRefreshListView) findViewById(R.id.note_listview);
    adapter = new DailyNoteListAdapter(this, dailyMindMains, R.layout.atom_ui_item_note);
    notelist_listview.getRefreshableView().setAdapter(adapter);
    notelist_listview.getRefreshableView().setOnItemClickListener(this);
    notelist_listview.setMode(PullToRefreshBase.Mode.PULL_FROM_END);
    notelist_listview.getRefreshableView().setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
        @Override
        public boolean onItemLongClick(AdapterView<?> adapterView, View view, int i, long l) {
            showEditDialog(adapter.getItem(i-1));
            return true;
        }
    });
}
 
Example 2
Source File: AllChatRankFragment.java    From Social with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.all_chat_rank_fragment_lalyout, container, false);

    handler = new Handler(){
        @Override
        public void handleMessage(Message msg) {
            switch (msg.what){
                case OkhttpUtil.MESSAGE_CHAT_RANK:
                    handleCharRank(msg);
                    break;
            }
        }
    };

    listView = (PullToRefreshListView)view.findViewById(R.id.id_all_chat_rank_fg_listview);

    listView.setMode(PullToRefreshBase.Mode.BOTH);
    listView.getLoadingLayoutProxy(false, true).setPullLabel(
            getString(R.string.pull_to_load));
    listView.getLoadingLayoutProxy(false, true).setRefreshingLabel(
            getString(R.string.loading));
    listView.getLoadingLayoutProxy(false, true).setReleaseLabel(
            getString(R.string.release_to_load));
    listView.setOnRefreshListener(this);
    listView.setOnItemClickListener(this);

    list_chat_rank_item = new ArrayList<>();

    listView.setVisibility(View.GONE);

    return view;
}
 
Example 3
Source File: UserListFragment.java    From SmileEssence with MIT License 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View page = inflater.inflate(R.layout.fragment_userlist, container, false);
    PullToRefreshListView listView = getListView(page);
    UserListListAdapter adapter = getListAdapter((MainActivity) getActivity());
    listView.setAdapter(adapter);
    listView.setOnScrollListener(this);
    listView.setOnRefreshListener(this);
    listView.setMode(getRefreshMode());
    ImageButton buttonUserLists = getUserListsButton(page);
    buttonUserLists.setOnClickListener(this);
    textListName = getTextListName(page);
    textListName.setText(adapter.getListFullName());
    return page;
}
 
Example 4
Source File: CustomListFragment.java    From SmileEssence with MIT License 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View page = inflater.inflate(R.layout.fragment_list, container, false);
    Bundle args = getArguments();
    int fragmentIndex = args.getInt(ADAPTER_INDEX);
    PullToRefreshListView listView = getListView(page);
    ListAdapter adapter = getListAdapter(fragmentIndex);
    listView.setAdapter(adapter);
    listView.setOnScrollListener(this);
    listView.setOnRefreshListener(this);
    listView.setMode(getRefreshMode());
    return page;
}
 
Example 5
Source File: AndroidPullToRefreshSampleActivity.java    From android-opensource-library-56 with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_android_pull_to_refresh_sample);
    final PullToRefreshListView listView = (PullToRefreshListView) findViewById(R.id.list_view);
    listView.setMode(Mode.PULL_FROM_START);
    final List<String> items = new ArrayList<String>() {
        private static final long serialVersionUID = 1L;
        {
            this.add("red");
            this.add("yellow");
            this.add("green");
        }
    };
    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
            android.R.layout.simple_list_item_1, android.R.id.text1, items);
    listView.setOnRefreshListener(new OnRefreshListener<ListView>() {
        @Override
        public void onRefresh(final PullToRefreshBase<ListView> refreshView) {
            // リスト更新処理。一般的には通信処理や、データベースアクセスをする為別スレッドで実行する。
            // ここではHandlerを使って1秒後にリストを更新する様にしている。
            new Handler().postDelayed(new Runnable() {
                @Override
                public void run() {
                    items.add("No." + (items.size() + 1));
                    refreshView.onRefreshComplete();
                }
            }, 1000);
        }
    });
    listView.setAdapter(adapter);
}
 
Example 6
Source File: ShareRankFragment.java    From Social with Apache License 2.0 4 votes vote down vote up
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.share_rank_fragment_lalyout, container, false);

    handler = new Handler(){
        @Override
        public void handleMessage(Message msg) {
            switch (msg.what){
                case OkhttpUtil.MESSAGE_SHARE_RANK:
                    handleShareRank(msg);
                    break;
                case OkhttpUtil.MESSAGE_ADD_SHARE_RECORD:
                    handleAddShareRecord(msg);
                    break;
                case OkhttpUtil.MESSAGE_GET_SHARE_INFO:
                    handleGetShareInfo(msg);
                    break;
            }
        }
    };

    listView = (PullToRefreshListView)view.findViewById(R.id.id_share_rank_fg_listview);

    listView.setMode(PullToRefreshBase.Mode.BOTH);
    listView.getLoadingLayoutProxy(false, true).setPullLabel(
            getString(R.string.pull_to_load));
    listView.getLoadingLayoutProxy(false, true).setRefreshingLabel(
            getString(R.string.loading));
    listView.getLoadingLayoutProxy(false, true).setReleaseLabel(
            getString(R.string.release_to_load));
    listView.setOnRefreshListener(this);
    listView.setOnItemClickListener(this);

    list_share_rank_item = new ArrayList<>();

    rv_invite_user = (RippleView)view.findViewById(R.id.id_share_rank_fg_rv_invite_member);
    rv_invite_user.setOnRippleCompleteListener(new RippleView.OnRippleCompleteListener() {
        @Override
        public void onComplete(RippleView rippleView) {
            //showShare();
            getShareInfo();
        }
    });

    getShareRank();//不显示数据

    return view;
}
 
Example 7
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);
}