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


Java PullToRefreshListView.setMode方法代码示例

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


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

示例1: initTitleBar

import com.handmark.pulltorefresh.library.PullToRefreshListView; //导入方法依赖的package包/类
protected void initTitleBar() {

		ptrListView = (PullToRefreshListView) this
				.findViewById(R.id.book_source_list);
		tv_current_booksource = (TextView) this
				.findViewById(R.id.tv_current_booksource);
		booksource_line = (View) this.findViewById(R.id.booksource_line);
		tv_other_booksource = (TextView) this
				.findViewById(R.id.tv_other_booksource);
		ptrListView.setMode(Mode.DISABLED);
		ptrListView.setOnItemClickListener(this);
		mTitleBar = (BookTitleBar) this.findViewById(R.id.book_titleBar);
		mTitleBar.setBackgroundColor(BookTheme.THEME_COLOR);
		mTitleBar.setTitle("书籍换源");
		mTitleBar.setRightLogoGone();
		mTitleBar.setLeftDrawable(R.drawable.book_details_close);
		mTitleBar.getLeftTextView().setOnClickListener(this);
	}
 
开发者ID:justingboy,项目名称:CouldBooks,代码行数:19,代码来源:ChangeSourceActivity.java

示例2: onCreateView

import com.handmark.pulltorefresh.library.PullToRefreshListView; //导入方法依赖的package包/类
@SuppressLint("InflateParams")
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
	View view = inflater.inflate(R.layout.fragment_select, null);
	lv_select = (PullToRefreshListView) view.findViewById(R.id.lv_select);
	lv_select.setMode(Mode.BOTH);

	lv_select.setOnRefreshListener(new OnRefreshListener<ListView>() {

		@Override
		public void onRefresh(PullToRefreshBase<ListView> refreshView) {
			if (refreshView.isHeaderShown()) {
				lv_select.getLoadingLayoutProxy(false, true).setPullLabel("下拉可以刷新...");
				lv_select.getLoadingLayoutProxy(false, true).setRefreshingLabel("正在刷新...");
				lv_select.getLoadingLayoutProxy(false, true).setReleaseLabel("松开之后更新数据...");
				getData();
			} else {
				lv_select.getLoadingLayoutProxy(false, true).setPullLabel("上拉加载更多...");
				lv_select.getLoadingLayoutProxy(false, true).setRefreshingLabel("正在加载...");
				lv_select.getLoadingLayoutProxy(false, true).setReleaseLabel("松开之后更新数据...");
				getNextPage();
			}

		}
	});
	getData();
	return view;
}
 
开发者ID:Grrsun,项目名称:colorread,代码行数:29,代码来源:FragmentSelect.java

示例3: initView

import com.handmark.pulltorefresh.library.PullToRefreshListView; //导入方法依赖的package包/类
public void initView(View rootView) {
	rootView.findViewById(R.id.back).setVisibility(View.GONE);
	tvTitle = (TextView) rootView.findViewById(R.id.title);
	tvTitle.setText("资讯中心");

	emptyView = rootView.findViewById(R.id.empty);

	newsList = (PullToRefreshListView) rootView.findViewById(R.id.newslist);
	newsList.setOnItemClickListener(this);
	newsList.setMode(Mode.BOTH);
	newsList.setScrollingWhileRefreshingEnabled(false);
	newsList.setOnRefreshListener(this);
	newsList.setOnLastItemVisibleListener(this);
	newsList.setEmptyView(emptyView);
}
 
开发者ID:tincent,项目名称:libtincent,代码行数:16,代码来源:NewsFragment.java

示例4: onCreateView

import com.handmark.pulltorefresh.library.PullToRefreshListView; //导入方法依赖的package包/类
/**
 * 在onCreate之后调用
 * @param inflater
 * @param container
 * @param savedInstanceState
 * @return
 */
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    view = inflater.inflate(R.layout.fragment_main, container, false);
    mPullRefreshListView = (PullToRefreshListView)view.findViewById(R.id.messageList);
    // 设置刷新模式
    mPullRefreshListView.setMode(PullToRefreshBase.Mode.PULL_FROM_START);
    // 设置列表内容
    ListView actualListView = mPullRefreshListView.getRefreshableView();
    //生成动态数组,并且转入数据
    itemsData = getMessages();
    mAdapter= new SimpleAdapter(MainTabFragment.this.getActivity(), //没什么解释
            itemsData,//数据来源
            R.layout.item_list_fragment_main,//XML实现
            new String[]{"Avatar", "UserName", "Message", "Time", "Number"}, //动态数据KEY
            new int[]{R.id.avatar, R.id.userName, R.id.message, R.id.time, R.id.number});
    actualListView.setAdapter(mAdapter);
    /*定义事件*/
    mPullRefreshListView.setOnItemClickListener(new CustomOnItemClickListener());
    mPullRefreshListView.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener<ListView>() {
        @Override
        public void onRefresh(PullToRefreshBase<ListView> refreshView) {
            // 异步获取消息任务
            new GetMessagesTask().execute();
        }
    });
    return view;
}
 
开发者ID:ccliu2015,项目名称:love,代码行数:35,代码来源:MainTabFragment.java

示例5: onCreateView

import com.handmark.pulltorefresh.library.PullToRefreshListView; //导入方法依赖的package包/类
@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;
}
 
开发者ID:lacolaco,项目名称:SmileEssence,代码行数:16,代码来源:UserListFragment.java

示例6: onCreateView

import com.handmark.pulltorefresh.library.PullToRefreshListView; //导入方法依赖的package包/类
@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;
}
 
开发者ID:lacolaco,项目名称:SmileEssence,代码行数:14,代码来源:CustomListFragment.java

示例7: onCreate

import com.handmark.pulltorefresh.library.PullToRefreshListView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle bundle) {
    super.onCreate(bundle);

    setContentView(R.layout.activity_fav);

    mBottomPanelHeight = getResources().getDimensionPixelSize(R.dimen.bottom_panel_height);

    mFooterView = new View(this);
    mFooterView.setLayoutParams(new AbsListView.LayoutParams(AbsListView.LayoutParams.MATCH_PARENT,
            mBottomPanelHeight));

    mFavList = (PullToRefreshListView) findViewById(R.id.fav_list);
    mFavList.setMode(Mode.DISABLED);

    mFavAdapter = new FavAdapter();
    mFavList.setAdapter(mFavAdapter);

    mBottomPanel = findViewById(R.id.bottom_panel);

    mSelectAll = findViewById(R.id.select_all);
    mSelectAll.setOnClickListener(mSelectAllClickListener);
    mConfirmDelete = findViewById(R.id.confirm_delete);
    mConfirmDelete.setOnClickListener(mConfirmDeleteClickListener);

    getFav();
}
 
开发者ID:jiangerji,项目名称:danmaku-project,代码行数:28,代码来源:FavActivity.java

示例8: onCreate

import com.handmark.pulltorefresh.library.PullToRefreshListView; //导入方法依赖的package包/类
@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);
}
 
开发者ID:android-opensource-library-56,项目名称:android-opensource-library-56,代码行数:33,代码来源:AndroidPullToRefreshSampleActivity.java

示例9: initP2RLvAndThread

import com.handmark.pulltorefresh.library.PullToRefreshListView; //导入方法依赖的package包/类
void initP2RLvAndThread() {
	// init p2r
	p2r_lv = (PullToRefreshListView) this.findViewById(R.id.p2r_lv);
	ListView listview = p2r_lv.getRefreshableView();
	listview.setVerticalFadingEdgeEnabled(false);
	p2r_lv.setMode(Mode.PULL_FROM_END);
	p2r_lv.setShowIndicator(false);
	p2r_lv.setOnItemClickListener(this);
	p2r_lv.setOnRefreshListener(this);
	p2r_lv.setAdapter(getAdapter());

	// init msgHandler
	Looper looper = Looper.myLooper();
	msgHandler = new MessageHandler(looper);
}
 
开发者ID:wugian,项目名称:doubanbook4android,代码行数:16,代码来源:BaseP2RActivity.java

示例10: onCreateView

import com.handmark.pulltorefresh.library.PullToRefreshListView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
		Bundle savedInstanceState) {
	view = inflater.inflate(R.layout.whu_zheng_wen, container,false);
	
	refreshView = (PullToRefreshListView)view.findViewById(R.id.whu_zheng_wen_list);
	refreshView.setMode(Mode.BOTH);
	actuallListView = refreshView.getRefreshableView();
	registerForContextMenu(actuallListView);
	new MyAsyncTask().execute(0);
	initListView();
	setListener();
	return view;
}
 
开发者ID:flsf,项目名称:WHUMap,代码行数:15,代码来源:WHUZhengWenFragment.java

示例11: onCreateView

import com.handmark.pulltorefresh.library.PullToRefreshListView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
	View view = inflater.inflate(R.layout.fragment_news_list, null);
	// 注册ListView
	listView = (PullToRefreshListView) view.findViewById(R.id.newslist);
	textView = (TextView) view.findViewById(R.id.textView_newslist_title);
	// 获取传入的新闻地址和频道
	Bundle bundle = getArguments();
	path = bundle.getString("path");
	chnnel = bundle.getString("chnnel");
	textView.setText(chnnel);

	listView.setMode(Mode.PULL_FROM_START);
	helper = new DataBaseHelper(getActivity());
	// 把查询总页数放到这里,每次进入该Fragment时查询一次。
	getTotalPage();
	// 如果数据库能够获取数据,直接加载
	list.clear();
	list = getDataFromDatabase(chnnel, currentPage);
	// 先设置一个空的adapter,防止adapter.notifyDataChanged空指针异常.
	adapter = new XMLNewsAdapter(getActivity(), list);
	listView.setAdapter(adapter);

	// 初始化进度条,首次进入没有新闻的时候显示一个进度条
	dialog = new ProgressDialog(getActivity());
	dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
	dialog.setTitle("正在加载");
	dialog.setMessage("第一次加载较慢,请稍等一下");
	if (list.isEmpty()) {
		// 从网络加载数据,并在本方法里设置Adapter;
		getDataFromVolley();
		dialog.show();
	}
	// 设置Item点击监听
	ItemListener();
	// 设置滑动监听
	NextPage();
	// 设置刷新监听
	refreshListener();
	return view;
}
 
开发者ID:Grrsun,项目名称:colorread,代码行数:42,代码来源:FragmentNewsList.java

示例12: init

import com.handmark.pulltorefresh.library.PullToRefreshListView; //导入方法依赖的package包/类
void init() {
    lv0 = (PullToRefreshListView) findViewById(R.id.every_day_push_list);
    lv0.setMode(PullToRefreshBase.Mode.PULL_FROM_END);
    lv0.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener<ListView>() {
        @Override
        public void onRefresh(PullToRefreshBase<ListView> refreshView) {
            Log.v("DEBUG list size", "" + listResource.size());

            new LoadingTask().execute();
        }
    });

    cr = getContentResolver();
    cursor = cr.query(DataProviderMetaData.DataTableMetaData.CONTENT_URI, new String[]{"created", "modified", "title", "value", "begin",
                    "end", "finish", "kind", "call"}, "kind = " + KIND_ADVERTISE,
            null, "begin DESC");
    for(int i = 0;i < 6*5;i++)
        if(cursor.moveToNext()) {
            Bundle map = new Bundle();
            long created, modified, begin, end, finish, kind, call;
            String title, value;

            created = cursor.getLong(cursor.getColumnIndex("created"));
            modified = cursor.getLong(cursor.getColumnIndex("modified"));
            title = cursor.getString(cursor.getColumnIndex("title"));
            value = cursor.getString(cursor.getColumnIndex("value"));
            begin = cursor.getLong(cursor.getColumnIndex("begin"));
            end = cursor.getLong(cursor.getColumnIndex("end"));
            finish = cursor.getLong(cursor.getColumnIndex("finish"));
            kind = cursor.getLong(cursor.getColumnIndex("kind"));
            call = cursor.getLong(cursor.getColumnIndex("call"));

            map.putLong("created", created);
            map.putLong("modified", modified);
            map.putString("title", title);
            map.putString("value", value);

            map.putLong("begin", begin);
            map.putLong("end", end);
            map.putLong("finish", finish);
            map.putLong("kind", kind);
            map.putLong("call", call);
            listResource.add(map);

            Log.v("Debug", "in update" + listResource.size());

        }
    sa = new EveryDayPushListItemAdapter(this, listResource, R.layout.every_day_push_view_pager, null, null);
    lv0.setAdapter(sa);
}
 
开发者ID:UtopiaGroup,项目名称:Utopia,代码行数:51,代码来源:EveryDayPushListActivity.java

示例13: onCreate

import com.handmark.pulltorefresh.library.PullToRefreshListView; //导入方法依赖的package包/类
/** 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);
}
 
开发者ID:TechBooster,项目名称:effective_android_sample,代码行数:59,代码来源:PullToRefreshCustomActivity.java


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