SwipeToRefresh

A simple swipe to refresh helper library to replicate the swipe to refresh pattern first seen in GMail

Лицензия

Лицензия

Категории

Категории

Сеть
Группа

Группа

net.callumtaylor
Идентификатор

Идентификатор

swipetorefresh
Последняя версия

Последняя версия

1.1
Дата

Дата

Тип

Тип

aar
Описание

Описание

SwipeToRefresh
A simple swipe to refresh helper library to replicate the swipe to refresh pattern first seen in GMail
Ссылка на сайт

Ссылка на сайт

https://github.com/scruffyfox/SwipeToRefresh
Система контроля версий

Система контроля версий

https://github.com/scruffyfox/SwipeToRefresh

Скачать swipetorefresh

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/net.callumtaylor/swipetorefresh/ -->
<dependency>
    <groupId>net.callumtaylor</groupId>
    <artifactId>swipetorefresh</artifactId>
    <version>1.1</version>
    <type>aar</type>
</dependency>
// https://jarcasting.com/artifacts/net.callumtaylor/swipetorefresh/
implementation 'net.callumtaylor:swipetorefresh:1.1'
// https://jarcasting.com/artifacts/net.callumtaylor/swipetorefresh/
implementation ("net.callumtaylor:swipetorefresh:1.1")
'net.callumtaylor:swipetorefresh:aar:1.1'
<dependency org="net.callumtaylor" name="swipetorefresh" rev="1.1">
  <artifact name="swipetorefresh" type="aar" />
</dependency>
@Grapes(
@Grab(group='net.callumtaylor', module='swipetorefresh', version='1.1')
)
libraryDependencies += "net.callumtaylor" % "swipetorefresh" % "1.1"
[net.callumtaylor/swipetorefresh "1.1"]

Зависимости

Библиотека не имеет зависимостей. Это самодостаточное приложение, которое не зависит ни от каких других библиотек.

Модули Проекта

Данный проект не имеет модулей.

#README

##Usage

Simply import the gradle file into Android Studio and reference the dependancy in your settings.gradle and project's build.gradle

Alternatively you can add the maven dependancy net.callumtaylor:swipetorefresh:1.1

###To use the library

In your XML, include the RefreshableListView

<net.callumtaylor.swipetorefresh.view.RefreshableListView
	android:layout_width="match_parent"
	android:layout_height="match_parent"
	android:id="@android:id/list"
	android:divider="?attr/storm_list_view_divider_color"
	android:scrollbarStyle="outsideOverlay"
/>

Implement OnRefreshListener in your fragment

And in your fragment, in onActivityCreated add

refreshHelper = RefreshHelper.wrapRefreshable(getActivity(), (RefreshableListView)getListView(), this);

Now, when the list is refreshed, onRefresh() will be called.

You can then call ListView.onRefreshComplete(); to stop the inderterminate refreshable.

There is also a time where you would use a single fragment which gets replaced, you may end up with multiple zombie pull to refresh views in your action bar. To fix this, in your base activity simple call RefreshHelper.reset(getActivity());

##Style

You can customise the style of the PTR by overriding ptr_text_style, ptr_progress_style, and ptr_progress_inderteminate_style in your theme.

###Example styles

@style/ptr_text_style

<style name="RefreshProgressText">
	<item name="android:textColor">#ffffffff</item>
</style>

@style/ptr_progress_style

<style name="RefreshProgressInderterminateThemeLight">
	<item name="android:indeterminateDrawable">@drawable/progress_indeterminate_horizontal_holo_light</item>
	<item name="android:minHeight">3dip</item>
	<item name="android:maxHeight">3dip</item>
	<item name="android:indeterminateOnly">true</item>
</style>

@style/ptr_progress_inderteminate_style

<style name="RefreshProgressInderterminateThemeLight" parent="android:Widget.ProgressBar.Horizontal">
	<item name="android:indeterminateDrawable">@drawable/progress_indeterminate_horizontal_holo_light</item>
	<item name="android:minHeight">4dip</item>
	<item name="android:maxHeight">4dip</item>
	<item name="android:indeterminateOnly">true</item>
</style>

#LICENSE

Copyright 2013 Callum Taylor

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Версии библиотеки

Версия
1.1