├── .gitignore
├── LICENSE
├── ONE-Unofficial.iml
├── PullToRefresh
├── Android-PullToRefresh.iml
├── LICENSE
├── PullToRefresh.iml
├── README.md
├── build.gradle
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── handmark
│ │ └── pulltorefresh
│ │ ├── extras
│ │ ├── listfragment
│ │ │ ├── PullToRefreshBaseListFragment.java
│ │ │ ├── PullToRefreshExpandableListFragment.java
│ │ │ └── PullToRefreshListFragment.java
│ │ └── viewpager
│ │ │ └── PullToRefreshViewPager.java
│ │ └── library
│ │ ├── ILoadingLayout.java
│ │ ├── IPullToRefresh.java
│ │ ├── LoadingLayoutProxy.java
│ │ ├── OverscrollHelper.java
│ │ ├── PullToRefreshAdapterViewBase.java
│ │ ├── PullToRefreshBase.java
│ │ ├── PullToRefreshExpandableListView.java
│ │ ├── PullToRefreshGridView.java
│ │ ├── PullToRefreshHorizontalScrollView.java
│ │ ├── PullToRefreshListView.java
│ │ ├── PullToRefreshScrollView.java
│ │ ├── PullToRefreshWebView.java
│ │ ├── extras
│ │ ├── PullToRefreshWebView2.java
│ │ └── SoundPullEventListener.java
│ │ └── internal
│ │ ├── EmptyViewMethodAccessor.java
│ │ ├── FlipLoadingLayout.java
│ │ ├── IndicatorLayout.java
│ │ ├── LoadingLayout.java
│ │ ├── RotateLoadingLayout.java
│ │ ├── Utils.java
│ │ └── ViewCompat.java
│ └── res
│ ├── anim
│ ├── slide_in_from_bottom.xml
│ ├── slide_in_from_top.xml
│ ├── slide_out_to_bottom.xml
│ └── slide_out_to_top.xml
│ ├── drawable-hdpi
│ ├── default_ptr_flip.png
│ ├── default_ptr_rotate.png
│ └── indicator_arrow.png
│ ├── drawable-xhdpi
│ ├── default_ptr_flip.png
│ ├── default_ptr_rotate.png
│ └── indicator_arrow.png
│ ├── drawable
│ ├── indicator_bg_bottom.xml
│ └── indicator_bg_top.xml
│ ├── layout
│ ├── pull_to_refresh_header_horizontal.xml
│ └── pull_to_refresh_header_vertical.xml
│ ├── values-ar
│ └── pull_refresh_strings.xml
│ ├── values-cs
│ └── pull_refresh_strings.xml
│ ├── values-de
│ └── pull_refresh_strings.xml
│ ├── values-es
│ └── pull_refresh_strings.xml
│ ├── values-fi
│ └── pull_refresh_strings.xml
│ ├── values-fr
│ └── pull_refresh_strings.xml
│ ├── values-he
│ └── pull_refresh_strings.xml
│ ├── values-it
│ └── pull_refresh_strings.xml
│ ├── values-iw
│ └── pull_refresh_strings.xml
│ ├── values-ja
│ └── pull_refresh_strings.xml
│ ├── values-ko
│ └── pull_refresh_strings.xml
│ ├── values-nl
│ └── pull_refresh_strings.xml
│ ├── values-pl
│ └── pull_refresh_strings.xml
│ ├── values-pt-rBR
│ └── pull_refresh_strings.xml
│ ├── values-pt
│ └── pull_refresh_strings.xml
│ ├── values-ro
│ └── pull_refresh_strings.xml
│ ├── values-ru
│ └── pull_refresh_strings.xml
│ ├── values-zh
│ └── pull_refresh_strings.xml
│ └── values
│ ├── attrs.xml
│ ├── dimens.xml
│ ├── ids.xml
│ └── pull_refresh_strings.xml
├── README.md
├── Screenshots
├── screenshot-1.png
├── screenshot-2.png
├── screenshot-3.png
├── screenshot-4.png
├── screenshot-5.png
├── screenshot-6.png
└── screenshot-7.jpg
├── app
├── .gitignore
├── build.gradle
├── libs
│ ├── com.umeng.fb.5.4.0.jar
│ ├── fastjson-1.2.6.jar
│ └── umeng-update-v2.6.0.1.jar
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── studio
│ │ └── uphie
│ │ └── one
│ │ └── ApplicationTest.java
│ └── main
│ ├── AndroidManifest.xml
│ ├── assets
│ └── welcome.gif
│ ├── java
│ └── studio
│ │ └── uphie
│ │ └── one
│ │ ├── abs
│ │ ├── AbsBaseActivity.java
│ │ ├── AbsBaseFragment.java
│ │ └── AbsModuleFragment.java
│ │ ├── common
│ │ ├── Api.java
│ │ ├── App.java
│ │ ├── Constants.java
│ │ ├── HttpClient.java
│ │ ├── HttpData.java
│ │ └── HttpError.java
│ │ ├── interfaces
│ │ ├── IHttp.java
│ │ ├── IInit.java
│ │ ├── IShare.java
│ │ ├── OnNetConnChangeListener.java
│ │ └── ShareChannel.java
│ │ ├── ui
│ │ ├── FragmentAdapter.java
│ │ ├── MainActivity.java
│ │ ├── WelcomeActivity.java
│ │ ├── article
│ │ │ ├── Article.java
│ │ │ ├── ArticleContentFragment.java
│ │ │ └── ArticleFragment.java
│ │ ├── home
│ │ │ ├── Home.java
│ │ │ ├── HomeContentFragment.java
│ │ │ └── HomeFragment.java
│ │ ├── personal
│ │ │ ├── AboutActivity.java
│ │ │ ├── FeedbackActivity.java
│ │ │ └── PersonalFragment.java
│ │ ├── question
│ │ │ ├── Question.java
│ │ │ ├── QuestionContentFragment.java
│ │ │ └── QuestionFragment.java
│ │ └── thing
│ │ │ ├── Thing.java
│ │ │ ├── ThingContentFragment.java
│ │ │ └── ThingFragment.java
│ │ ├── utils
│ │ ├── ConfigUtil.java
│ │ ├── CrashHandler.java
│ │ ├── FileManager.java
│ │ ├── ImageUtil.java
│ │ ├── JsonUtil.java
│ │ ├── NetworkUtil.java
│ │ ├── SysUtil.java
│ │ ├── TextToast.java
│ │ └── TimeUtil.java
│ │ └── widgets
│ │ ├── ClearEditText.java
│ │ ├── LikeView.java
│ │ └── Tab.java
│ └── res
│ ├── drawable-hdpi
│ ├── bg_home_saying.9.png
│ ├── bg_msg_left_highlighted.9.png
│ ├── bg_msg_left_normal.9.png
│ ├── bg_msg_right_highlighted.9.png
│ ├── bg_msg_right_normal.9.png
│ ├── ic_answer.png
│ ├── ic_avatar_default.jpg
│ ├── ic_back.png
│ ├── ic_like.png
│ ├── ic_liked.png
│ ├── ic_more.png
│ ├── ic_question.png
│ ├── ic_title.png
│ └── ic_to.png
│ ├── drawable-xhdpi
│ ├── ic_msg_fail.png
│ ├── logo_facebook.png
│ ├── logo_google_plus.png
│ ├── logo_qq.png
│ ├── logo_qzone.png
│ ├── logo_sinaweibo.png
│ ├── logo_twitter.png
│ └── logo_wechat.png
│ ├── drawable-xxhdpi
│ ├── av_author.jpg
│ └── ic_clear.png
│ ├── drawable
│ ├── actionbar.xml
│ ├── bg_bottom_line_blue.xml
│ ├── bg_bottom_line_gray.xml
│ ├── bg_bottom_line_gray_slim.xml
│ ├── bg_frame_white.xml
│ ├── bg_top_line.xml
│ ├── checkbox_like.xml
│ ├── divider_light_gray.xml
│ ├── picture_holder.xml
│ ├── selector_edittext.xml
│ ├── selector_msg_left.xml
│ ├── selector_msg_right.xml
│ ├── selector_ok_text.xml
│ ├── selector_text_send.xml
│ ├── share_background.xml
│ ├── tab.xml
│ ├── umeng_common_gradient_orange.xml
│ └── umeng_common_gradient_red.xml
│ ├── layout
│ ├── actionbar.xml
│ ├── actionbar_main.xml
│ ├── actionbar_secondary.xml
│ ├── activity_about.xml
│ ├── activity_feedback.xml
│ ├── activity_main.xml
│ ├── activity_welcome.xml
│ ├── dialog_update.xml
│ ├── divider_gray_line.xml
│ ├── fragment_article.xml
│ ├── fragment_home.xml
│ ├── fragment_personal.xml
│ ├── fragment_question.xml
│ ├── fragment_thing.xml
│ ├── layout_article.xml
│ ├── layout_home.xml
│ ├── layout_question.xml
│ ├── layout_thing.xml
│ ├── list_item_conversion_left.xml
│ ├── list_item_conversion_right.xml
│ ├── loading_window.xml
│ ├── menu_share.xml
│ └── umeng_common_download_notification.xml
│ ├── mipmap-hdpi
│ └── ic_launcher.png
│ ├── mipmap-mdpi
│ └── ic_launcher.png
│ ├── mipmap-xhdpi
│ └── ic_launcher.png
│ ├── mipmap-xxhdpi
│ └── ic_launcher.png
│ ├── mipmap-xxxhdpi
│ └── ic_launcher.png
│ ├── values-en
│ └── strings.xml
│ ├── values-zh-rTW
│ └── strings.xml
│ └── values
│ ├── attr.xml
│ ├── color.xml
│ ├── strings.xml
│ ├── styles.xml
│ ├── tb_munion_strings.xml
│ ├── umeng_common_strings.xml
│ └── umeng_update_string.xml
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── keystore.jks
├── release
└── release-2016-2-19.apk
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | .gradle
2 | /local.properties
3 | /.idea/workspace.xml
4 | /.idea/libraries
5 | .DS_Store
6 | /build
7 | /PullToRefresh/build
8 | /captures
9 | .idea/.name
10 | .idea/copyright/profiles_settings.xml
11 | .idea/misc.xml
12 | .idea/gradle.xml
13 | app/app.iml
14 | .idea/vcs.xml
15 | .idea/encodings.xml
16 | .idea/modules.xml
17 | .idea/runConfigurations.xml
18 | .idea/compiler.xml
19 |
--------------------------------------------------------------------------------
/ONE-Unofficial.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/PullToRefresh/README.md:
--------------------------------------------------------------------------------
1 | ##Android—PullToRefresh修改项目
2 |
3 | 这是修改目录结构以满足AndroidStudio导入后的项目,
4 | 相关参考项目我稍后会上传。
5 | 配置相关参见我的博客:
6 | http://www.cnblogs.com/lhyz/p/4401911.html
7 |
8 | \n
9 |
10 | 由于未解决的错误,在sample文件夹中的项目无法上传,现改为一个单独的仓库Samples来存储示例项目,
11 |
12 | \n
13 |
14 | 这个项目的示例在这个仓库目录下:
15 | https://github.com/wylhyz/Samples/tree/master/PullrefreshLib
16 |
--------------------------------------------------------------------------------
/PullToRefresh/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:1.5.0'
9 | }
10 | }
11 |
12 | android {
13 | compileSdkVersion 22
14 | buildToolsVersion = '23.0.1'
15 | }
16 |
17 | dependencies {
18 | compile 'com.android.support:support-v4:22.0.0'
19 | }
--------------------------------------------------------------------------------
/PullToRefresh/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/PullToRefresh/src/main/java/com/handmark/pulltorefresh/extras/listfragment/PullToRefreshBaseListFragment.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright 2011, 2012 Chris Banes.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *******************************************************************************/
16 | package com.handmark.pulltorefresh.extras.listfragment;
17 |
18 | import android.os.Bundle;
19 | import android.support.v4.app.ListFragment;
20 | import android.view.LayoutInflater;
21 | import android.view.View;
22 | import android.view.ViewGroup;
23 | import android.widget.AbsListView;
24 | import android.widget.ListView;
25 |
26 | import com.handmark.pulltorefresh.library.PullToRefreshBase;
27 |
28 | abstract class PullToRefreshBaseListFragment> extends ListFragment {
29 |
30 | private T mPullToRefreshListView;
31 |
32 | @Override
33 | public final View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
34 | View layout = super.onCreateView(inflater, container, savedInstanceState);
35 |
36 | ListView lv = (ListView) layout.findViewById(android.R.id.list);
37 | ViewGroup parent = (ViewGroup) lv.getParent();
38 |
39 | // Remove ListView and add PullToRefreshListView in its place
40 | int lvIndex = parent.indexOfChild(lv);
41 | parent.removeViewAt(lvIndex);
42 | mPullToRefreshListView = onCreatePullToRefreshListView(inflater, savedInstanceState);
43 | parent.addView(mPullToRefreshListView, lvIndex, lv.getLayoutParams());
44 |
45 | return layout;
46 | }
47 |
48 | /**
49 | * @return The {@link PullToRefreshBase} attached to this ListFragment.
50 | */
51 | public final T getPullToRefreshListView() {
52 | return mPullToRefreshListView;
53 | }
54 |
55 | /**
56 | * Returns the {@link PullToRefreshBase} which will replace the ListView
57 | * created from ListFragment. You should override this method if you wish to
58 | * customise the {@link PullToRefreshBase} from the default.
59 | *
60 | * @param inflater - LayoutInflater which can be used to inflate from XML.
61 | * @param savedInstanceState - Bundle passed through from
62 | * {@link ListFragment#onCreateView(LayoutInflater, ViewGroup, Bundle)
63 | * onCreateView(...)}
64 | * @return The {@link PullToRefreshBase} which will replace the ListView.
65 | */
66 | protected abstract T onCreatePullToRefreshListView(LayoutInflater inflater, Bundle savedInstanceState);
67 |
68 | }
--------------------------------------------------------------------------------
/PullToRefresh/src/main/java/com/handmark/pulltorefresh/extras/listfragment/PullToRefreshExpandableListFragment.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright 2011, 2012 Chris Banes.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *******************************************************************************/
16 | package com.handmark.pulltorefresh.extras.listfragment;
17 |
18 | import android.os.Bundle;
19 | import android.support.v4.app.ListFragment;
20 | import android.view.LayoutInflater;
21 |
22 | import com.handmark.pulltorefresh.library.PullToRefreshExpandableListView;
23 |
24 | /**
25 | * A sample implementation of how to use {@link PullToRefreshExpandableListView}
26 | * with {@link ListFragment}. This implementation simply replaces the ListView
27 | * that {@code ListFragment} creates with a new
28 | * {@code PullToRefreshExpandableListView}. This means that ListFragment still
29 | * works 100% (e.g. setListShown(...) ).
30 | *
31 | * The new PullToRefreshListView is created in the method
32 | * {@link #onCreatePullToRefreshListView(LayoutInflater, Bundle)}. If you wish
33 | * to customise the {@code PullToRefreshExpandableListView} then override this
34 | * method and return your customised instance.
35 | *
36 | * @author Chris Banes
37 | *
38 | */
39 | public class PullToRefreshExpandableListFragment extends PullToRefreshBaseListFragment {
40 |
41 | protected PullToRefreshExpandableListView onCreatePullToRefreshListView(LayoutInflater inflater,
42 | Bundle savedInstanceState) {
43 | return new PullToRefreshExpandableListView(getActivity());
44 | }
45 |
46 | }
--------------------------------------------------------------------------------
/PullToRefresh/src/main/java/com/handmark/pulltorefresh/extras/listfragment/PullToRefreshListFragment.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright 2011, 2012 Chris Banes.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *******************************************************************************/
16 | package com.handmark.pulltorefresh.extras.listfragment;
17 |
18 | import android.os.Bundle;
19 | import android.support.v4.app.ListFragment;
20 | import android.view.LayoutInflater;
21 |
22 | import com.handmark.pulltorefresh.library.PullToRefreshListView;
23 |
24 | /**
25 | * A sample implementation of how to use {@link PullToRefreshListView} with
26 | * {@link ListFragment}. This implementation simply replaces the ListView that
27 | * {@code ListFragment} creates with a new PullToRefreshListView. This means
28 | * that ListFragment still works 100% (e.g. setListShown(...) ).
29 | *
30 | * The new PullToRefreshListView is created in the method
31 | * {@link #onCreatePullToRefreshListView(LayoutInflater, Bundle)}. If you wish
32 | * to customise the {@code PullToRefreshListView} then override this method and
33 | * return your customised instance.
34 | *
35 | * @author Chris Banes
36 | *
37 | */
38 | public class PullToRefreshListFragment extends PullToRefreshBaseListFragment {
39 |
40 | protected PullToRefreshListView onCreatePullToRefreshListView(LayoutInflater inflater, Bundle savedInstanceState) {
41 | return new PullToRefreshListView(getActivity());
42 | }
43 |
44 | }
--------------------------------------------------------------------------------
/PullToRefresh/src/main/java/com/handmark/pulltorefresh/extras/viewpager/PullToRefreshViewPager.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright 2011, 2012 Chris Banes.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *******************************************************************************/
16 | package com.handmark.pulltorefresh.extras.viewpager;
17 |
18 | import android.content.Context;
19 | import android.support.v4.view.PagerAdapter;
20 | import android.support.v4.view.ViewPager;
21 | import android.support.v4.view.ViewPager.OnPageChangeListener;
22 | import android.util.AttributeSet;
23 |
24 | import com.handmark.pulltorefresh.library.PullToRefreshBase;
25 | import com.handmark.pulltorefresh.R;
26 |
27 | public class PullToRefreshViewPager extends PullToRefreshBase {
28 |
29 | public PullToRefreshViewPager(Context context) {
30 | super(context);
31 | }
32 |
33 | public PullToRefreshViewPager(Context context, AttributeSet attrs) {
34 | super(context, attrs);
35 | }
36 |
37 | @Override
38 | public final Orientation getPullToRefreshScrollDirection() {
39 | return Orientation.HORIZONTAL;
40 | }
41 |
42 | @Override
43 | protected ViewPager createRefreshableView(Context context, AttributeSet attrs) {
44 | ViewPager viewPager = new ViewPager(context, attrs);
45 | viewPager.setId(R.id.viewpager);
46 | return viewPager;
47 | }
48 |
49 | @Override
50 | protected boolean isReadyForPullStart() {
51 | ViewPager refreshableView = getRefreshableView();
52 |
53 | PagerAdapter adapter = refreshableView.getAdapter();
54 | if (null != adapter) {
55 | return refreshableView.getCurrentItem() == 0;
56 | }
57 |
58 | return false;
59 | }
60 |
61 | @Override
62 | protected boolean isReadyForPullEnd() {
63 | ViewPager refreshableView = getRefreshableView();
64 |
65 | PagerAdapter adapter = refreshableView.getAdapter();
66 | if (null != adapter) {
67 | return refreshableView.getCurrentItem() == adapter.getCount() - 1;
68 | }
69 |
70 | return false;
71 | }
72 |
73 | public void setAdapter(PagerAdapter pagerAdapter) {
74 | getRefreshableView().setAdapter(pagerAdapter);
75 | }
76 |
77 | public void setOnPageChangeListener(OnPageChangeListener onPageChangeListener) {
78 | getRefreshableView().setOnPageChangeListener(onPageChangeListener);
79 | }
80 |
81 | public int getCurrentItem() {
82 | return getRefreshableView().getCurrentItem();
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/PullToRefresh/src/main/java/com/handmark/pulltorefresh/library/ILoadingLayout.java:
--------------------------------------------------------------------------------
1 | package com.handmark.pulltorefresh.library;
2 |
3 | import android.graphics.Typeface;
4 | import android.graphics.drawable.Drawable;
5 |
6 | public interface ILoadingLayout {
7 |
8 | /**
9 | * Set the Last Updated Text. This displayed under the main label when
10 | * Pulling
11 | *
12 | * @param label - Label to set
13 | */
14 | public void setLastUpdatedLabel(CharSequence label);
15 |
16 | /**
17 | * Set the drawable used in the loading layout. This is the same as calling
18 | * setLoadingDrawable(drawable, Mode.BOTH)
19 | *
20 | * @param drawable - Drawable to display
21 | */
22 | public void setLoadingDrawable(Drawable drawable);
23 |
24 | /**
25 | * Set Text to show when the Widget is being Pulled
26 | * setPullLabel(releaseLabel, Mode.BOTH)
27 | *
28 | * @param pullLabel - CharSequence to display
29 | */
30 | public void setPullLabel(CharSequence pullLabel);
31 |
32 | /**
33 | * Set Text to show when the Widget is refreshing
34 | * setRefreshingLabel(releaseLabel, Mode.BOTH)
35 | *
36 | * @param refreshingLabel - CharSequence to display
37 | */
38 | public void setRefreshingLabel(CharSequence refreshingLabel);
39 |
40 | /**
41 | * Set Text to show when the Widget is being pulled, and will refresh when
42 | * released. This is the same as calling
43 | * setReleaseLabel(releaseLabel, Mode.BOTH)
44 | *
45 | * @param releaseLabel - CharSequence to display
46 | */
47 | public void setReleaseLabel(CharSequence releaseLabel);
48 |
49 | /**
50 | * Set's the Sets the typeface and style in which the text should be
51 | * displayed. Please see
52 | * {@link android.widget.TextView#setTypeface(Typeface)
53 | * TextView#setTypeface(Typeface)}.
54 | */
55 | public void setTextTypeface(Typeface tf);
56 |
57 | }
58 |
--------------------------------------------------------------------------------
/PullToRefresh/src/main/java/com/handmark/pulltorefresh/library/LoadingLayoutProxy.java:
--------------------------------------------------------------------------------
1 | package com.handmark.pulltorefresh.library;
2 |
3 | import java.util.HashSet;
4 |
5 | import android.graphics.Typeface;
6 | import android.graphics.drawable.Drawable;
7 |
8 | import com.handmark.pulltorefresh.library.internal.LoadingLayout;
9 |
10 | public class LoadingLayoutProxy implements ILoadingLayout {
11 |
12 | private final HashSet mLoadingLayouts;
13 |
14 | LoadingLayoutProxy() {
15 | mLoadingLayouts = new HashSet();
16 | }
17 |
18 | /**
19 | * This allows you to add extra LoadingLayout instances to this proxy. This
20 | * is only necessary if you keep your own instances, and want to have them
21 | * included in any
22 | * {@link PullToRefreshBase#createLoadingLayoutProxy(boolean, boolean)
23 | * createLoadingLayoutProxy(...)} calls.
24 | *
25 | * @param layout - LoadingLayout to have included.
26 | */
27 | public void addLayout(LoadingLayout layout) {
28 | if (null != layout) {
29 | mLoadingLayouts.add(layout);
30 | }
31 | }
32 |
33 | @Override
34 | public void setLastUpdatedLabel(CharSequence label) {
35 | for (LoadingLayout layout : mLoadingLayouts) {
36 | layout.setLastUpdatedLabel(label);
37 | }
38 | }
39 |
40 | @Override
41 | public void setLoadingDrawable(Drawable drawable) {
42 | for (LoadingLayout layout : mLoadingLayouts) {
43 | layout.setLoadingDrawable(drawable);
44 | }
45 | }
46 |
47 | @Override
48 | public void setRefreshingLabel(CharSequence refreshingLabel) {
49 | for (LoadingLayout layout : mLoadingLayouts) {
50 | layout.setRefreshingLabel(refreshingLabel);
51 | }
52 | }
53 |
54 | @Override
55 | public void setPullLabel(CharSequence label) {
56 | for (LoadingLayout layout : mLoadingLayouts) {
57 | layout.setPullLabel(label);
58 | }
59 | }
60 |
61 | @Override
62 | public void setReleaseLabel(CharSequence label) {
63 | for (LoadingLayout layout : mLoadingLayouts) {
64 | layout.setReleaseLabel(label);
65 | }
66 | }
67 |
68 | public void setTextTypeface(Typeface tf) {
69 | for (LoadingLayout layout : mLoadingLayouts) {
70 | layout.setTextTypeface(tf);
71 | }
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/PullToRefresh/src/main/java/com/handmark/pulltorefresh/library/PullToRefreshExpandableListView.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright 2011, 2012 Chris Banes.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *******************************************************************************/
16 | package com.handmark.pulltorefresh.library;
17 |
18 | import android.annotation.TargetApi;
19 | import android.content.Context;
20 | import android.os.Build.VERSION;
21 | import android.os.Build.VERSION_CODES;
22 | import android.util.AttributeSet;
23 | import android.view.View;
24 | import android.widget.ExpandableListView;
25 |
26 | import com.handmark.pulltorefresh.library.internal.EmptyViewMethodAccessor;
27 |
28 | public class PullToRefreshExpandableListView extends PullToRefreshAdapterViewBase {
29 |
30 | public PullToRefreshExpandableListView(Context context) {
31 | super(context);
32 | }
33 |
34 | public PullToRefreshExpandableListView(Context context, AttributeSet attrs) {
35 | super(context, attrs);
36 | }
37 |
38 | public PullToRefreshExpandableListView(Context context, Mode mode) {
39 | super(context, mode);
40 | }
41 |
42 | public PullToRefreshExpandableListView(Context context, Mode mode, AnimationStyle style) {
43 | super(context, mode, style);
44 | }
45 |
46 | @Override
47 | public final Orientation getPullToRefreshScrollDirection() {
48 | return Orientation.VERTICAL;
49 | }
50 |
51 | @Override
52 | protected ExpandableListView createRefreshableView(Context context, AttributeSet attrs) {
53 | final ExpandableListView lv;
54 | if (VERSION.SDK_INT >= VERSION_CODES.GINGERBREAD) {
55 | lv = new InternalExpandableListViewSDK9(context, attrs);
56 | } else {
57 | lv = new InternalExpandableListView(context, attrs);
58 | }
59 |
60 | // Set it to this so it can be used in ListActivity/ListFragment
61 | lv.setId(android.R.id.list);
62 | return lv;
63 | }
64 |
65 | class InternalExpandableListView extends ExpandableListView implements EmptyViewMethodAccessor {
66 |
67 | public InternalExpandableListView(Context context, AttributeSet attrs) {
68 | super(context, attrs);
69 | }
70 |
71 | @Override
72 | public void setEmptyView(View emptyView) {
73 | PullToRefreshExpandableListView.this.setEmptyView(emptyView);
74 | }
75 |
76 | @Override
77 | public void setEmptyViewInternal(View emptyView) {
78 | super.setEmptyView(emptyView);
79 | }
80 | }
81 |
82 | @TargetApi(9)
83 | final class InternalExpandableListViewSDK9 extends InternalExpandableListView {
84 |
85 | public InternalExpandableListViewSDK9(Context context, AttributeSet attrs) {
86 | super(context, attrs);
87 | }
88 |
89 | @Override
90 | protected boolean overScrollBy(int deltaX, int deltaY, int scrollX, int scrollY, int scrollRangeX,
91 | int scrollRangeY, int maxOverScrollX, int maxOverScrollY, boolean isTouchEvent) {
92 |
93 | final boolean returnValue = super.overScrollBy(deltaX, deltaY, scrollX, scrollY, scrollRangeX,
94 | scrollRangeY, maxOverScrollX, maxOverScrollY, isTouchEvent);
95 |
96 | // Does all of the hard work...
97 | OverscrollHelper.overScrollBy(PullToRefreshExpandableListView.this, deltaX, scrollX, deltaY, scrollY,
98 | isTouchEvent);
99 |
100 | return returnValue;
101 | }
102 | }
103 | }
104 |
--------------------------------------------------------------------------------
/PullToRefresh/src/main/java/com/handmark/pulltorefresh/library/PullToRefreshGridView.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright 2011, 2012 Chris Banes.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *******************************************************************************/
16 | package com.handmark.pulltorefresh.library;
17 |
18 | import android.annotation.TargetApi;
19 | import android.content.Context;
20 | import android.os.Build.VERSION;
21 | import android.os.Build.VERSION_CODES;
22 | import android.util.AttributeSet;
23 | import android.view.View;
24 | import android.widget.GridView;
25 |
26 | import com.handmark.pulltorefresh.R;
27 | import com.handmark.pulltorefresh.library.internal.EmptyViewMethodAccessor;
28 |
29 | public class PullToRefreshGridView extends PullToRefreshAdapterViewBase {
30 |
31 | public PullToRefreshGridView(Context context) {
32 | super(context);
33 | }
34 |
35 | public PullToRefreshGridView(Context context, AttributeSet attrs) {
36 | super(context, attrs);
37 | }
38 |
39 | public PullToRefreshGridView(Context context, Mode mode) {
40 | super(context, mode);
41 | }
42 |
43 | public PullToRefreshGridView(Context context, Mode mode, AnimationStyle style) {
44 | super(context, mode, style);
45 | }
46 |
47 | @Override
48 | public final Orientation getPullToRefreshScrollDirection() {
49 | return Orientation.VERTICAL;
50 | }
51 |
52 | @Override
53 | protected final GridView createRefreshableView(Context context, AttributeSet attrs) {
54 | final GridView gv;
55 | if (VERSION.SDK_INT >= VERSION_CODES.GINGERBREAD) {
56 | gv = new InternalGridViewSDK9(context, attrs);
57 | } else {
58 | gv = new InternalGridView(context, attrs);
59 | }
60 |
61 | // Use Generated ID (from res/values/ids.xml)
62 | gv.setId(R.id.gridview);
63 | return gv;
64 | }
65 |
66 | class InternalGridView extends GridView implements EmptyViewMethodAccessor {
67 |
68 | public InternalGridView(Context context, AttributeSet attrs) {
69 | super(context, attrs);
70 | }
71 |
72 | @Override
73 | public void setEmptyView(View emptyView) {
74 | PullToRefreshGridView.this.setEmptyView(emptyView);
75 | }
76 |
77 | @Override
78 | public void setEmptyViewInternal(View emptyView) {
79 | super.setEmptyView(emptyView);
80 | }
81 | }
82 |
83 | @TargetApi(9)
84 | final class InternalGridViewSDK9 extends InternalGridView {
85 |
86 | public InternalGridViewSDK9(Context context, AttributeSet attrs) {
87 | super(context, attrs);
88 | }
89 |
90 | @Override
91 | protected boolean overScrollBy(int deltaX, int deltaY, int scrollX, int scrollY, int scrollRangeX,
92 | int scrollRangeY, int maxOverScrollX, int maxOverScrollY, boolean isTouchEvent) {
93 |
94 | final boolean returnValue = super.overScrollBy(deltaX, deltaY, scrollX, scrollY, scrollRangeX,
95 | scrollRangeY, maxOverScrollX, maxOverScrollY, isTouchEvent);
96 |
97 | // Does all of the hard work...
98 | OverscrollHelper.overScrollBy(PullToRefreshGridView.this, deltaX, scrollX, deltaY, scrollY, isTouchEvent);
99 |
100 | return returnValue;
101 | }
102 | }
103 | }
104 |
--------------------------------------------------------------------------------
/PullToRefresh/src/main/java/com/handmark/pulltorefresh/library/PullToRefreshHorizontalScrollView.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright 2011, 2012 Chris Banes.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *******************************************************************************/
16 | package com.handmark.pulltorefresh.library;
17 |
18 | import android.annotation.TargetApi;
19 | import android.content.Context;
20 | import android.os.Build.VERSION;
21 | import android.os.Build.VERSION_CODES;
22 | import android.util.AttributeSet;
23 | import android.view.View;
24 | import android.widget.HorizontalScrollView;
25 |
26 | import com.handmark.pulltorefresh.R;
27 |
28 | public class PullToRefreshHorizontalScrollView extends PullToRefreshBase {
29 |
30 | public PullToRefreshHorizontalScrollView(Context context) {
31 | super(context);
32 | }
33 |
34 | public PullToRefreshHorizontalScrollView(Context context, AttributeSet attrs) {
35 | super(context, attrs);
36 | }
37 |
38 | public PullToRefreshHorizontalScrollView(Context context, Mode mode) {
39 | super(context, mode);
40 | }
41 |
42 | public PullToRefreshHorizontalScrollView(Context context, Mode mode, AnimationStyle style) {
43 | super(context, mode, style);
44 | }
45 |
46 | @Override
47 | public final Orientation getPullToRefreshScrollDirection() {
48 | return Orientation.HORIZONTAL;
49 | }
50 |
51 | @Override
52 | protected HorizontalScrollView createRefreshableView(Context context, AttributeSet attrs) {
53 | HorizontalScrollView scrollView;
54 |
55 | if (VERSION.SDK_INT >= VERSION_CODES.GINGERBREAD) {
56 | scrollView = new InternalHorizontalScrollViewSDK9(context, attrs);
57 | } else {
58 | scrollView = new HorizontalScrollView(context, attrs);
59 | }
60 |
61 | scrollView.setId(R.id.scrollview);
62 | return scrollView;
63 | }
64 |
65 | @Override
66 | protected boolean isReadyForPullStart() {
67 | return mRefreshableView.getScrollX() == 0;
68 | }
69 |
70 | @Override
71 | protected boolean isReadyForPullEnd() {
72 | View scrollViewChild = mRefreshableView.getChildAt(0);
73 | if (null != scrollViewChild) {
74 | return mRefreshableView.getScrollX() >= (scrollViewChild.getWidth() - getWidth());
75 | }
76 | return false;
77 | }
78 |
79 | @TargetApi(9)
80 | final class InternalHorizontalScrollViewSDK9 extends HorizontalScrollView {
81 |
82 | public InternalHorizontalScrollViewSDK9(Context context, AttributeSet attrs) {
83 | super(context, attrs);
84 | }
85 |
86 | @Override
87 | protected boolean overScrollBy(int deltaX, int deltaY, int scrollX, int scrollY, int scrollRangeX,
88 | int scrollRangeY, int maxOverScrollX, int maxOverScrollY, boolean isTouchEvent) {
89 |
90 | final boolean returnValue = super.overScrollBy(deltaX, deltaY, scrollX, scrollY, scrollRangeX,
91 | scrollRangeY, maxOverScrollX, maxOverScrollY, isTouchEvent);
92 |
93 | // Does all of the hard work...
94 | OverscrollHelper.overScrollBy(PullToRefreshHorizontalScrollView.this, deltaX, scrollX, deltaY, scrollY,
95 | getScrollRange(), isTouchEvent);
96 |
97 | return returnValue;
98 | }
99 |
100 | /**
101 | * Taken from the AOSP ScrollView source
102 | */
103 | private int getScrollRange() {
104 | int scrollRange = 0;
105 | if (getChildCount() > 0) {
106 | View child = getChildAt(0);
107 | scrollRange = Math.max(0, child.getWidth() - (getWidth() - getPaddingLeft() - getPaddingRight()));
108 | }
109 | return scrollRange;
110 | }
111 | }
112 | }
113 |
--------------------------------------------------------------------------------
/PullToRefresh/src/main/java/com/handmark/pulltorefresh/library/PullToRefreshScrollView.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright 2011, 2012 Chris Banes.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *******************************************************************************/
16 | package com.handmark.pulltorefresh.library;
17 |
18 | import android.annotation.TargetApi;
19 | import android.content.Context;
20 | import android.os.Build.VERSION;
21 | import android.os.Build.VERSION_CODES;
22 | import android.util.AttributeSet;
23 | import android.view.View;
24 | import android.widget.ScrollView;
25 |
26 | import com.handmark.pulltorefresh.R;
27 |
28 | public class PullToRefreshScrollView extends PullToRefreshBase {
29 |
30 | public PullToRefreshScrollView(Context context) {
31 | super(context);
32 | }
33 |
34 | public PullToRefreshScrollView(Context context, AttributeSet attrs) {
35 | super(context, attrs);
36 | }
37 |
38 | public PullToRefreshScrollView(Context context, Mode mode) {
39 | super(context, mode);
40 | }
41 |
42 | public PullToRefreshScrollView(Context context, Mode mode, AnimationStyle style) {
43 | super(context, mode, style);
44 | }
45 |
46 | @Override
47 | public final Orientation getPullToRefreshScrollDirection() {
48 | return Orientation.VERTICAL;
49 | }
50 |
51 | @Override
52 | protected ScrollView createRefreshableView(Context context, AttributeSet attrs) {
53 | ScrollView scrollView;
54 | if (VERSION.SDK_INT >= VERSION_CODES.GINGERBREAD) {
55 | scrollView = new InternalScrollViewSDK9(context, attrs);
56 | } else {
57 | scrollView = new ScrollView(context, attrs);
58 | }
59 |
60 | scrollView.setId(R.id.scrollview);
61 | return scrollView;
62 | }
63 |
64 | @Override
65 | protected boolean isReadyForPullStart() {
66 | return mRefreshableView.getScrollY() == 0;
67 | }
68 |
69 | @Override
70 | protected boolean isReadyForPullEnd() {
71 | View scrollViewChild = mRefreshableView.getChildAt(0);
72 | if (null != scrollViewChild) {
73 | return mRefreshableView.getScrollY() >= (scrollViewChild.getHeight() - getHeight());
74 | }
75 | return false;
76 | }
77 |
78 | @TargetApi(9)
79 | final class InternalScrollViewSDK9 extends ScrollView {
80 |
81 | public InternalScrollViewSDK9(Context context, AttributeSet attrs) {
82 | super(context, attrs);
83 | }
84 |
85 | @Override
86 | protected boolean overScrollBy(int deltaX, int deltaY, int scrollX, int scrollY, int scrollRangeX,
87 | int scrollRangeY, int maxOverScrollX, int maxOverScrollY, boolean isTouchEvent) {
88 |
89 | final boolean returnValue = super.overScrollBy(deltaX, deltaY, scrollX, scrollY, scrollRangeX,
90 | scrollRangeY, maxOverScrollX, maxOverScrollY, isTouchEvent);
91 |
92 | // Does all of the hard work...
93 | OverscrollHelper.overScrollBy(PullToRefreshScrollView.this, deltaX, scrollX, deltaY, scrollY,
94 | getScrollRange(), isTouchEvent);
95 |
96 | return returnValue;
97 | }
98 |
99 | /**
100 | * Taken from the AOSP ScrollView source
101 | */
102 | private int getScrollRange() {
103 | int scrollRange = 0;
104 | if (getChildCount() > 0) {
105 | View child = getChildAt(0);
106 | scrollRange = Math.max(0, child.getHeight() - (getHeight() - getPaddingBottom() - getPaddingTop()));
107 | }
108 | return scrollRange;
109 | }
110 | }
111 | }
112 |
--------------------------------------------------------------------------------
/PullToRefresh/src/main/java/com/handmark/pulltorefresh/library/extras/PullToRefreshWebView2.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright 2011, 2012 Chris Banes.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *******************************************************************************/
16 | package com.handmark.pulltorefresh.library.extras;
17 |
18 | import java.util.concurrent.atomic.AtomicBoolean;
19 |
20 | import android.content.Context;
21 | import android.util.AttributeSet;
22 | import android.webkit.WebView;
23 |
24 | import com.handmark.pulltorefresh.library.PullToRefreshWebView;
25 |
26 | /**
27 | * An advanced version of {@link PullToRefreshWebView} which delegates the
28 | * triggering of the PullToRefresh gesture to the Javascript running within the
29 | * WebView. This means that you should only use this class if:
30 | *
31 | *
32 | *
{@link PullToRefreshWebView} doesn't work correctly because you're using
33 | * overflow:scroll or something else which means
34 | * {@link WebView#getScrollY()} doesn't return correct values.
35 | *
You control the web content being displayed, as you need to write some
36 | * Javascript callbacks.
37 | *
38 | *
39 | *
40 | * The way this call works is that when a PullToRefresh gesture is in action,
41 | * the following Javascript methods will be called:
42 | * isReadyForPullDown() and isReadyForPullUp(), it is
43 | * your job to calculate whether the view is in a state where a PullToRefresh
44 | * can happen, and return the result via the callback mechanism. An example can
45 | * be seen below:
46 | *
47 | *
48 | *
49 | * function isReadyForPullDown() {
50 | * var result = ... // Probably using the .scrollTop DOM attribute
51 | * ptr.isReadyForPullDownResponse(result);
52 | * }
53 | *
54 | * function isReadyForPullUp() {
55 | * var result = ... // Probably using the .scrollBottom DOM attribute
56 | * ptr.isReadyForPullUpResponse(result);
57 | * }
58 | *