├── .gitignore ├── LICENSE ├── README.md ├── README_EN.md ├── app-design ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── app_design │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── app_design │ │ │ └── MainActivity.java │ └── res │ │ ├── layout │ │ └── activity_main.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ └── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── app_design │ └── ExampleUnitTest.java ├── app ├── .gitignore ├── build.gradle ├── debug.keystore ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── scwang │ │ └── refreshlayout │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── ic_launcher-web.png │ ├── java │ │ └── com │ │ │ └── scwang │ │ │ └── refreshlayout │ │ │ ├── App.java │ │ │ ├── activity │ │ │ ├── FragmentActivity.java │ │ │ ├── IndexMainActivity.java │ │ │ ├── practice │ │ │ │ ├── BannerPracticeActivity.java │ │ │ │ ├── FeedlistPracticeActivity.java │ │ │ │ ├── ProfilePracticeActivity.java │ │ │ │ ├── QQBrowserPracticeActivity.java │ │ │ │ ├── RepastPracticeActivity.java │ │ │ │ ├── WebviewPracticeActivity.java │ │ │ │ └── WeiboPracticeActivity.java │ │ │ ├── style │ │ │ │ ├── BezierStyleActivity.java │ │ │ │ ├── CircleStyleActivity.java │ │ │ │ ├── ClassicsStyleActivity.java │ │ │ │ ├── DeliveryStyleActivity.java │ │ │ │ ├── DropboxStyleActivity.java │ │ │ │ ├── FlyRefreshStyleActivity.java │ │ │ │ ├── FunGameBattleCityStyleActivity.java │ │ │ │ ├── FunGameHitBlockStyleActivity.java │ │ │ │ ├── MaterialStyleActivity.java │ │ │ │ ├── PhoenixStyleActivity.java │ │ │ │ ├── StoreHouseStyleActivity.java │ │ │ │ ├── TaurusStyleActivity.java │ │ │ │ ├── WaterDropStyleActivity.java │ │ │ │ └── WaveSwipStyleActivity.java │ │ │ └── using │ │ │ │ ├── AssignCodeUsingActivity.java │ │ │ │ ├── AssignDefaultUsingActivity.java │ │ │ │ ├── AssignXmlUsingActivity.java │ │ │ │ ├── BasicUsingActivity.java │ │ │ │ ├── CustomUsingActivity.java │ │ │ │ ├── ListenerUsingActivity.java │ │ │ │ ├── NestedLayoutUsingActivity.java │ │ │ │ ├── OverScrollUsingActivity.java │ │ │ │ └── SnapHelperUsingActivity.java │ │ │ ├── adapter │ │ │ ├── BaseRecyclerAdapter.java │ │ │ └── SmartViewHolder.java │ │ │ ├── fragment │ │ │ ├── index │ │ │ │ ├── RefreshPractiveFragment.java │ │ │ │ ├── RefreshStylesFragment.java │ │ │ │ └── RefreshUsingFragment.java │ │ │ ├── practice │ │ │ │ ├── SecondFloorPracticeFragment.java │ │ │ │ └── TwoLevelPracticeFragment.java │ │ │ └── using │ │ │ │ ├── EmptyLayoutUsingFragment.java │ │ │ │ ├── EmptyLayoutUsingFragmentInner.java │ │ │ │ ├── EmptyLayoutUsingFragmentOuter.java │ │ │ │ ├── NestedScrollUsingFragment.java │ │ │ │ ├── NestedScrollUsingFragmentIntegral.java │ │ │ │ ├── PureScrollUsingFragment.java │ │ │ │ ├── PureScrollUsingFragmentFooter.java │ │ │ │ ├── PureScrollUsingFragmentHeader.java │ │ │ │ ├── SpecifyStyleUsingFragment.java │ │ │ │ └── ViewPagerUsingFragment.java │ │ │ ├── util │ │ │ ├── DynamicTimeFormat.java │ │ │ └── StatusBarUtil.java │ │ │ └── widget │ │ │ └── TwoLevelHeader.java │ └── res │ │ ├── drawable │ │ ├── animation_loading_frame.xml │ │ ├── animation_loading_rotate.xml │ │ ├── bc_background_panel.xml │ │ ├── ic_arrow_back_dark_24dp.xml │ │ ├── ic_arrow_back_gray_24dp.xml │ │ ├── ic_arrow_back_white_24dp.xml │ │ ├── ic_chevron_right.xml │ │ ├── ic_chevron_right_gray.xml │ │ ├── ic_empty.xml │ │ ├── ic_error.xml │ │ ├── ic_feed_list_favorite.xml │ │ ├── ic_feed_list_mail.xml │ │ ├── ic_feed_list_photo.xml │ │ ├── ic_fly_refresh_folder.xml │ │ ├── ic_fly_refresh_info.xml │ │ ├── ic_fly_refresh_poll.xml │ │ ├── ic_fly_refresh_send.xml │ │ ├── ic_fly_refresh_smartphone.xml │ │ ├── ic_index_dashboard.xml │ │ ├── ic_index_home.xml │ │ ├── ic_index_notifications.xml │ │ ├── ic_list_divider.xml │ │ └── ic_progress_hojder.xml │ │ ├── layout │ │ ├── activity_experiment.xml │ │ ├── activity_fly_refresh.xml │ │ ├── activity_fly_refresh_item.xml │ │ ├── activity_index_main.xml │ │ ├── activity_practice_banner.xml │ │ ├── activity_practice_feedlist.xml │ │ ├── activity_practice_profile.xml │ │ ├── activity_practice_qqbrowser.xml │ │ ├── activity_practice_repast.xml │ │ ├── activity_practice_webview.xml │ │ ├── activity_practice_weibo.xml │ │ ├── activity_style_bezier.xml │ │ ├── activity_style_circle.xml │ │ ├── activity_style_classics.xml │ │ ├── activity_style_delivery.xml │ │ ├── activity_style_dropbox.xml │ │ ├── activity_style_fungame_battlecity.xml │ │ ├── activity_style_fungame_hitblock.xml │ │ ├── activity_style_material.xml │ │ ├── activity_style_phoenix.xml │ │ ├── activity_style_storehouse.xml │ │ ├── activity_style_taurus.xml │ │ ├── activity_style_water_drop.xml │ │ ├── activity_style_wave_swip.xml │ │ ├── activity_using_assign_code.xml │ │ ├── activity_using_assign_default.xml │ │ ├── activity_using_assign_xml.xml │ │ ├── activity_using_basic.xml │ │ ├── activity_using_custom.xml │ │ ├── activity_using_listener.xml │ │ ├── activity_using_overscroll.xml │ │ ├── activity_using_region.xml │ │ ├── activity_using_snaphelper.xml │ │ ├── common_independence_recycler.xml │ │ ├── common_loading.xml │ │ ├── fragment_practice_secondfloor.xml │ │ ├── fragment_practice_twolevel.xml │ │ ├── fragment_refresh_practive.xml │ │ ├── fragment_refresh_styles.xml │ │ ├── fragment_refresh_using.xml │ │ ├── fragment_using_emptylayout.xml │ │ ├── fragment_using_emptylayout_inner.xml │ │ ├── fragment_using_emptylayout_outer.xml │ │ ├── fragment_using_nestedscroll.xml │ │ ├── fragment_using_nestedscroll_integral.xml │ │ ├── fragment_using_purescroll.xml │ │ ├── fragment_using_purescroll_header.xml │ │ ├── fragment_using_viewpager.xml │ │ ├── listitem_movie_banner.xml │ │ ├── listitem_movie_header.xml │ │ ├── listitem_movie_item.xml │ │ ├── listitem_practive_repast.xml │ │ ├── listitem_style_delivery.xml │ │ └── listitem_using_snaphelper.xml │ │ ├── menu │ │ └── navigation.xml │ │ ├── mipmap-hdpi │ │ ├── gif_header_repast.gif │ │ ├── ic_item1.jpg │ │ ├── ic_item2.jpg │ │ ├── ic_item3.jpg │ │ ├── ic_launcher.png │ │ ├── ic_launcher_round.png │ │ ├── image_avatar_1.jpg │ │ ├── image_avatar_2.jpg │ │ ├── image_avatar_3.jpg │ │ ├── image_avatar_4.jpg │ │ ├── image_avatar_5.jpg │ │ ├── image_avatar_6.jpg │ │ ├── image_movie_header_12231501221682438.jpg │ │ ├── image_movie_header_12981501221820220.jpg │ │ ├── image_movie_header_48621499931969370.jpg │ │ ├── image_practice_repast_1.jpg │ │ ├── image_practice_repast_2.jpg │ │ ├── image_practice_repast_3.jpg │ │ ├── image_practice_repast_4.jpg │ │ ├── image_practice_repast_5.jpg │ │ └── image_practice_repast_6.jpg │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_round.png │ │ ├── image_secondfloor.jpg │ │ ├── image_secondfloor_content.jpg │ │ ├── image_taobao.jpg │ │ ├── image_weibo_home_1.png │ │ └── image_weibo_home_2.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── values-v19 │ │ └── styles.xml │ │ ├── values-v21 │ │ └── styles.xml │ │ ├── values-zh │ │ └── strings.xml │ │ └── values │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── scwang │ └── refreshlayout │ └── ExampleUnitTest.java ├── bintrayUpload.bat ├── build.gradle ├── refresh-footer ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── scwang │ │ └── smartrefresh │ │ └── footer │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ └── res │ │ └── values │ │ ├── attrs.xml │ │ └── strings.xml │ └── test │ └── java │ └── com │ └── scwang │ └── smartrefresh │ └── footer │ └── ExampleUnitTest.java ├── refresh-header ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── scwang │ │ └── smartrefresh │ │ └── header │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── scwang │ │ │ └── smartrefresh │ │ │ └── header │ │ │ ├── BezierCircleHeader.java │ │ │ ├── DeliveryHeader.java │ │ │ ├── DropboxHeader.java │ │ │ ├── FlyRefreshHeader.java │ │ │ ├── FunGameBattleCityHeader.java │ │ │ ├── FunGameHitBlockHeader.java │ │ │ ├── MaterialHeader.java │ │ │ ├── PhoenixHeader.java │ │ │ ├── StoreHouseHeader.java │ │ │ ├── TaurusHeader.java │ │ │ ├── WaterDropHeader.java │ │ │ ├── WaveSwipeHeader.java │ │ │ ├── flyrefresh │ │ │ ├── FlyView.java │ │ │ ├── MountainSceneView.java │ │ │ ├── PathInterpolatorCompat.java │ │ │ ├── PathInterpolatorCompatApi21.java │ │ │ ├── PathInterpolatorCompatBase.java │ │ │ └── PathInterpolatorGingerbread.java │ │ │ ├── fungame │ │ │ ├── FunGameBase.java │ │ │ ├── FunGameHeader.java │ │ │ └── FunGameView.java │ │ │ ├── internal │ │ │ ├── FastOutSlowInInterpolator.java │ │ │ ├── LookupTableInterpolator.java │ │ │ └── MaterialProgressDrawable.java │ │ │ ├── material │ │ │ └── CircleImageView.java │ │ │ ├── storehouse │ │ │ ├── StoreHouseBarItem.java │ │ │ └── StoreHousePath.java │ │ │ ├── util │ │ │ └── ColorUtils.java │ │ │ ├── waterdrop │ │ │ ├── Circle.java │ │ │ └── WaterDropView.java │ │ │ └── waveswipe │ │ │ ├── AnimationImageView.java │ │ │ ├── DisplayUtil.java │ │ │ ├── DropBounceInterpolator.java │ │ │ └── WaveView.java │ └── res │ │ └── values │ │ ├── attrs.xml │ │ └── strings.xml │ └── test │ └── java │ └── com │ └── scwang │ └── smartrefresh │ └── header │ └── ExampleUnitTest.java ├── refresh-layout ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── scwang │ │ └── smartrefresh │ │ └── layout │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── scwang │ │ │ └── smartrefresh │ │ │ └── layout │ │ │ ├── SmartRefreshLayout.java │ │ │ ├── api │ │ │ ├── DefaultRefreshFooterCreater.java │ │ │ ├── DefaultRefreshFooterCreator.java │ │ │ ├── DefaultRefreshHeaderCreater.java │ │ │ ├── DefaultRefreshHeaderCreator.java │ │ │ ├── OnLoadmoreListener.java │ │ │ ├── OnRefreshLoadmoreListener.java │ │ │ ├── RefreshContent.java │ │ │ ├── RefreshFooter.java │ │ │ ├── RefreshHeader.java │ │ │ ├── RefreshInternal.java │ │ │ ├── RefreshKernel.java │ │ │ ├── RefreshLayout.java │ │ │ └── ScrollBoundaryDecider.java │ │ │ ├── constant │ │ │ ├── DimensionStatus.java │ │ │ ├── RefreshState.java │ │ │ └── SpinnerStyle.java │ │ │ ├── footer │ │ │ ├── BallPulseFooter.java │ │ │ ├── ClassicsFooter.java │ │ │ ├── FalsifyFooter.java │ │ │ └── ballpulse │ │ │ │ └── BallPulseView.java │ │ │ ├── header │ │ │ ├── BezierRadarHeader.java │ │ │ ├── ClassicsHeader.java │ │ │ ├── FalsifyHeader.java │ │ │ └── bezierradar │ │ │ │ ├── RippleView.java │ │ │ │ ├── RoundDotView.java │ │ │ │ ├── RoundProgressView.java │ │ │ │ └── WaveView.java │ │ │ ├── impl │ │ │ ├── RefreshContentWrapper.java │ │ │ ├── RefreshFooterWrapper.java │ │ │ ├── RefreshHeaderWrapper.java │ │ │ ├── RefreshInternalWrapper.java │ │ │ └── ScrollBoundaryDeciderAdapter.java │ │ │ ├── internal │ │ │ ├── ProgressDrawable.java │ │ │ └── pathview │ │ │ │ ├── PathParser.java │ │ │ │ ├── PathsDrawable.java │ │ │ │ └── PathsView.java │ │ │ ├── listener │ │ │ ├── AnimationEndListener.java │ │ │ ├── OnLoadMoreListener.java │ │ │ ├── OnMultiPurposeListener.java │ │ │ ├── OnRefreshListener.java │ │ │ ├── OnRefreshLoadMoreListener.java │ │ │ ├── OnStateChangedListener.java │ │ │ └── SimpleMultiPurposeListener.java │ │ │ └── util │ │ │ ├── CoordinatorLayoutListener.java │ │ │ ├── DelayedRunnable.java │ │ │ ├── DensityUtil.java │ │ │ ├── DesignUtil.java │ │ │ ├── ScrollBoundaryUtil.java │ │ │ └── ViscousFluidInterpolator.java │ └── res │ │ ├── values-zh │ │ └── strings.xml │ │ └── values │ │ ├── attrs.xml │ │ └── strings.xml │ └── test │ └── java │ └── com │ └── scwang │ └── smartrefresh │ └── layout │ └── ExampleUnitTest.java └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | gradle 4 | /local.properties 5 | /.idea 6 | /build 7 | /gradlew 8 | /gradlew.bat 9 | /gradle.properties 10 | /bintrayUpload-key.bat 11 | -------------------------------------------------------------------------------- /app-design/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app-design/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | 5 | compileSdkVersion 25 6 | buildToolsVersion "25.0.3" 7 | 8 | defaultConfig { 9 | applicationId "com.app_design" 10 | minSdkVersion 21 11 | targetSdkVersion 25 12 | versionCode 1 13 | versionName "1.0" 14 | 15 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 16 | 17 | } 18 | buildTypes { 19 | release { 20 | minifyEnabled false 21 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 22 | } 23 | } 24 | lintOptions { 25 | abortOnError false 26 | } 27 | } 28 | 29 | dependencies { 30 | compile fileTree(include: ['*.jar'], dir: 'libs') 31 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 32 | exclude group: 'com.android.support', module: 'support-annotations' 33 | }) 34 | // compile project(':refresh-header') 35 | // compile project(':refresh-layout') 36 | compile 'com.scwang.smartrefresh:SmartRefreshLayout:1.0.5-alpha-0' 37 | compile 'com.scwang.smartrefresh:SmartRefreshHeader:1.0.5-alpha-0' 38 | // compile 'com.scwang.smartrefresh:SmartRefreshLayout:1.0.4' 39 | // compile 'com.scwang.smartrefresh:SmartRefreshHeader:1.0.4' 40 | // compile 'com.android.support:design:25.3.1' 41 | compile 'com.android.support:appcompat-v7:25.3.1' 42 | compile 'com.android.support:recyclerview-v7:25.3.1' 43 | compile 'com.android.support.constraint:constraint-layout:1.0.2' 44 | testCompile 'junit:junit:4.12' 45 | } 46 | -------------------------------------------------------------------------------- /app-design/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in E:\Android\android-sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | # Uncomment this to preserve the line number information for 20 | # debugging stack traces. 21 | #-keepattributes SourceFile,LineNumberTable 22 | 23 | # If you keep the line number information, uncomment this to 24 | # hide the original source file name. 25 | #-renamesourcefileattribute SourceFile 26 | -------------------------------------------------------------------------------- /app-design/src/androidTest/java/com/app_design/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.app_design; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.app_design", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app-design/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /app-design/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 24 | 27 | 32 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /app-design/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hongyangAndroid/SmartRefreshLayout/763da0ffe8461532f1f0444a90f8c45eb5537a1d/app-design/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app-design/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hongyangAndroid/SmartRefreshLayout/763da0ffe8461532f1f0444a90f8c45eb5537a1d/app-design/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app-design/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hongyangAndroid/SmartRefreshLayout/763da0ffe8461532f1f0444a90f8c45eb5537a1d/app-design/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app-design/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hongyangAndroid/SmartRefreshLayout/763da0ffe8461532f1f0444a90f8c45eb5537a1d/app-design/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app-design/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hongyangAndroid/SmartRefreshLayout/763da0ffe8461532f1f0444a90f8c45eb5537a1d/app-design/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app-design/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hongyangAndroid/SmartRefreshLayout/763da0ffe8461532f1f0444a90f8c45eb5537a1d/app-design/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app-design/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hongyangAndroid/SmartRefreshLayout/763da0ffe8461532f1f0444a90f8c45eb5537a1d/app-design/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app-design/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hongyangAndroid/SmartRefreshLayout/763da0ffe8461532f1f0444a90f8c45eb5537a1d/app-design/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app-design/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hongyangAndroid/SmartRefreshLayout/763da0ffe8461532f1f0444a90f8c45eb5537a1d/app-design/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app-design/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hongyangAndroid/SmartRefreshLayout/763da0ffe8461532f1f0444a90f8c45eb5537a1d/app-design/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app-design/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /app-design/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | App-Design 3 | 4 | -------------------------------------------------------------------------------- /app-design/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app-design/src/test/java/com/app_design/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.app_design; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/debug.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hongyangAndroid/SmartRefreshLayout/763da0ffe8461532f1f0444a90f8c45eb5537a1d/app/debug.keystore -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in E:\Android\android-sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | # Uncomment this to preserve the line number information for 20 | # debugging stack traces. 21 | #-keepattributes SourceFile,LineNumberTable 22 | 23 | # If you keep the line number information, uncomment this to 24 | # hide the original source file name. 25 | #-renamesourcefileattribute SourceFile 26 | 27 | #app混淆标记 28 | -keep class com.github.mmin18.** {*;} 29 | 30 | -dontwarn android.support.v8.renderscript.* 31 | -keepclassmembers class android.support.v8.renderscript.RenderScript { 32 | native *** rsn*(...); 33 | native *** n*(...); 34 | } 35 | 36 | -keep class com.wang.avi.** { *; } 37 | -keep class com.wang.avi.indicators.** { *; } 38 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/scwang/refreshlayout/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.scwang.refreshlayout; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.scwang.refreshlayout", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hongyangAndroid/SmartRefreshLayout/763da0ffe8461532f1f0444a90f8c45eb5537a1d/app/src/main/ic_launcher-web.png -------------------------------------------------------------------------------- /app/src/main/java/com/scwang/refreshlayout/App.java: -------------------------------------------------------------------------------- 1 | package com.scwang.refreshlayout; 2 | 3 | import android.app.Application; 4 | import android.content.Context; 5 | import android.support.annotation.NonNull; 6 | import android.support.v7.app.AppCompatDelegate; 7 | 8 | import com.scwang.refreshlayout.util.DynamicTimeFormat; 9 | import com.scwang.smartrefresh.layout.SmartRefreshLayout; 10 | import com.scwang.smartrefresh.layout.api.DefaultRefreshHeaderCreater; 11 | import com.scwang.smartrefresh.layout.api.DefaultRefreshHeaderCreator; 12 | import com.scwang.smartrefresh.layout.api.RefreshHeader; 13 | import com.scwang.smartrefresh.layout.api.RefreshLayout; 14 | import com.scwang.smartrefresh.layout.constant.SpinnerStyle; 15 | import com.scwang.smartrefresh.layout.header.ClassicsHeader; 16 | import com.squareup.leakcanary.LeakCanary; 17 | 18 | /** 19 | * 20 | * Created by SCWANG on 2017/6/11. 21 | */ 22 | 23 | public class App extends Application { 24 | 25 | static { 26 | AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);//启用矢量图兼容 27 | SmartRefreshLayout.setDefaultRefreshHeaderCreator(new DefaultRefreshHeaderCreator() { 28 | @NonNull 29 | @Override 30 | public RefreshHeader createRefreshHeader(@NonNull Context context, @NonNull RefreshLayout layout) { 31 | layout.setPrimaryColorsId(R.color.colorPrimary, android.R.color.white);//全局设置主题颜色 32 | return new ClassicsHeader(context).setTimeFormat(new DynamicTimeFormat("更新于 %s")); 33 | } 34 | }); 35 | } 36 | 37 | @Override 38 | public void onCreate() { 39 | super.onCreate(); 40 | if (LeakCanary.isInAnalyzerProcess(this)) { 41 | // This process is dedicated to LeakCanary for heap analysis. 42 | // You should not init your app in this process. 43 | return; 44 | } 45 | LeakCanary.install(this); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /app/src/main/java/com/scwang/refreshlayout/activity/practice/FeedlistPracticeActivity.java: -------------------------------------------------------------------------------- 1 | package com.scwang.refreshlayout.activity.practice; 2 | 3 | import android.os.Bundle; 4 | import android.support.v7.app.AppCompatActivity; 5 | import android.support.v7.widget.Toolbar; 6 | import android.view.View; 7 | 8 | import com.scwang.refreshlayout.R; 9 | import com.scwang.smartrefresh.layout.api.RefreshLayout; 10 | 11 | /** 12 | * 微博列表 13 | */ 14 | public class FeedlistPracticeActivity extends AppCompatActivity { 15 | 16 | private static boolean isFirstEnter = true; 17 | 18 | @Override 19 | protected void onCreate(Bundle savedInstanceState) { 20 | super.onCreate(savedInstanceState); 21 | setContentView(R.layout.activity_practice_feedlist); 22 | 23 | final Toolbar toolbar = (Toolbar)findViewById(R.id.toolbar); 24 | toolbar.setNavigationOnClickListener(new View.OnClickListener() { 25 | @Override 26 | public void onClick(View v) { 27 | finish(); 28 | } 29 | }); 30 | 31 | final RefreshLayout refreshLayout = (RefreshLayout) findViewById(R.id.refreshLayout); 32 | if (isFirstEnter) { 33 | isFirstEnter = false; 34 | refreshLayout.autoRefresh(); 35 | } 36 | 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /app/src/main/java/com/scwang/refreshlayout/activity/practice/ProfilePracticeActivity.java: -------------------------------------------------------------------------------- 1 | package com.scwang.refreshlayout.activity.practice; 2 | 3 | import android.os.Bundle; 4 | import android.support.v7.app.AppCompatActivity; 5 | import android.support.v7.widget.Toolbar; 6 | import android.view.View; 7 | 8 | import com.scwang.refreshlayout.R; 9 | import com.scwang.refreshlayout.util.StatusBarUtil; 10 | 11 | /** 12 | * 个人中心 13 | */ 14 | public class ProfilePracticeActivity extends AppCompatActivity { 15 | 16 | 17 | @Override 18 | protected void onCreate(Bundle savedInstanceState) { 19 | super.onCreate(savedInstanceState); 20 | setContentView(R.layout.activity_practice_profile); 21 | 22 | final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); 23 | toolbar.setNavigationOnClickListener(new View.OnClickListener() { 24 | @Override 25 | public void onClick(View v) { 26 | finish(); 27 | } 28 | }); 29 | 30 | //状态栏透明和间距处理 31 | StatusBarUtil.immersive(this); 32 | StatusBarUtil.setPaddingSmart(this, toolbar); 33 | StatusBarUtil.setPaddingSmart(this, findViewById(R.id.profile)); 34 | StatusBarUtil.setPaddingSmart(this, findViewById(R.id.blurview)); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /app/src/main/java/com/scwang/refreshlayout/activity/practice/QQBrowserPracticeActivity.java: -------------------------------------------------------------------------------- 1 | package com.scwang.refreshlayout.activity.practice; 2 | 3 | import android.annotation.SuppressLint; 4 | import android.os.Bundle; 5 | import android.support.v7.app.AppCompatActivity; 6 | import android.support.v7.widget.Toolbar; 7 | import android.view.View; 8 | import android.webkit.WebView; 9 | import android.webkit.WebViewClient; 10 | 11 | import com.scwang.refreshlayout.R; 12 | import com.scwang.refreshlayout.util.StatusBarUtil; 13 | 14 | import ezy.ui.layout.LoadingLayout; 15 | 16 | /** 17 | * QQ浏览器-Github 18 | */ 19 | public class QQBrowserPracticeActivity extends AppCompatActivity { 20 | 21 | @SuppressLint("SetJavaScriptEnabled") 22 | @Override 23 | protected void onCreate(Bundle savedInstanceState) { 24 | super.onCreate(savedInstanceState); 25 | setContentView(R.layout.activity_practice_qqbrowser); 26 | 27 | final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); 28 | toolbar.setNavigationOnClickListener(new View.OnClickListener() { 29 | @Override 30 | public void onClick(View v) { 31 | finish(); 32 | } 33 | }); 34 | 35 | final LoadingLayout loading = (LoadingLayout) findViewById(R.id.loading); 36 | 37 | final WebView webView = (WebView) findViewById(R.id.webView); 38 | webView.loadUrl("https://github.com/scwang90/SmartRefreshLayout"); 39 | webView.getSettings().setJavaScriptEnabled(true); 40 | webView.setWebViewClient(new WebViewClient(){ 41 | @Override 42 | public boolean shouldOverrideUrlLoading(WebView view, String url) { 43 | view.loadUrl(url); 44 | return true; 45 | } 46 | @Override 47 | public void onPageFinished(WebView view, String url) { 48 | super.onPageFinished(view, url); 49 | loading.showContent(); 50 | } 51 | }); 52 | 53 | //状态栏透明和间距处理 54 | StatusBarUtil.immersive(this); 55 | StatusBarUtil.setPaddingSmart(this, toolbar); 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /app/src/main/java/com/scwang/refreshlayout/activity/practice/WebviewPracticeActivity.java: -------------------------------------------------------------------------------- 1 | package com.scwang.refreshlayout.activity.practice; 2 | 3 | import android.annotation.SuppressLint; 4 | import android.os.Bundle; 5 | import android.support.v7.app.AppCompatActivity; 6 | import android.support.v7.widget.Toolbar; 7 | import android.view.View; 8 | import android.webkit.WebView; 9 | import android.webkit.WebViewClient; 10 | 11 | import com.scwang.refreshlayout.R; 12 | import com.scwang.refreshlayout.util.StatusBarUtil; 13 | import com.scwang.smartrefresh.layout.api.RefreshLayout; 14 | import com.scwang.smartrefresh.layout.listener.OnRefreshListener; 15 | import com.scwang.smartrefresh.layout.util.DensityUtil; 16 | 17 | import java.util.Locale; 18 | 19 | /** 20 | * 网页-Github 21 | */ 22 | public class WebviewPracticeActivity extends AppCompatActivity { 23 | 24 | @SuppressLint("SetJavaScriptEnabled") 25 | @Override 26 | protected void onCreate(Bundle savedInstanceState) { 27 | super.onCreate(savedInstanceState); 28 | setContentView(R.layout.activity_practice_webview); 29 | 30 | final Toolbar toolbar = (Toolbar)findViewById(R.id.toolbar); 31 | toolbar.setNavigationOnClickListener(new View.OnClickListener() { 32 | @Override 33 | public void onClick(View v) { 34 | finish(); 35 | } 36 | }); 37 | 38 | final WebView webView = (WebView) findViewById(R.id.webView); 39 | final RefreshLayout refreshLayout = (RefreshLayout) findViewById(R.id.refreshLayout); 40 | refreshLayout.setOnRefreshListener(new OnRefreshListener() { 41 | @Override 42 | public void onRefresh(RefreshLayout refreshLayout) { 43 | webView.loadUrl("https://github.com/scwang90/SmartRefreshLayout"); 44 | } 45 | }); 46 | refreshLayout.autoRefresh(); 47 | 48 | 49 | webView.getSettings().setJavaScriptEnabled(true); 50 | webView.setWebViewClient(new WebViewClient(){ 51 | @Override 52 | public boolean shouldOverrideUrlLoading(WebView view, String url) { 53 | view.loadUrl(url); 54 | return true; 55 | } 56 | 57 | @Override 58 | public void onPageFinished(WebView view, String url) { 59 | super.onPageFinished(view, url); 60 | refreshLayout.finishRefresh(); 61 | view.loadUrl(String.format(Locale.CHINA, "javascript:document.body.style.paddingTop='%fpx'; void 0", DensityUtil.px2dp(webView.getPaddingTop()))); 62 | } 63 | }); 64 | 65 | //状态栏透明和间距处理 66 | StatusBarUtil.immersive(this); 67 | StatusBarUtil.setPaddingSmart(this, webView); 68 | StatusBarUtil.setPaddingSmart(this, toolbar); 69 | StatusBarUtil.setMargin(this, findViewById(R.id.header)); 70 | StatusBarUtil.setPaddingSmart(this, findViewById(R.id.blurview)); 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /app/src/main/java/com/scwang/refreshlayout/activity/using/AssignCodeUsingActivity.java: -------------------------------------------------------------------------------- 1 | package com.scwang.refreshlayout.activity.using; 2 | 3 | import android.os.Bundle; 4 | import android.support.v7.app.AppCompatActivity; 5 | import android.support.v7.widget.Toolbar; 6 | import android.view.View; 7 | 8 | import com.scwang.refreshlayout.R; 9 | import com.scwang.smartrefresh.header.MaterialHeader; 10 | import com.scwang.smartrefresh.layout.api.RefreshLayout; 11 | import com.scwang.smartrefresh.layout.constant.RefreshState; 12 | import com.scwang.smartrefresh.layout.constant.SpinnerStyle; 13 | import com.scwang.smartrefresh.layout.footer.BallPulseFooter; 14 | import com.scwang.smartrefresh.layout.listener.SimpleMultiPurposeListener; 15 | 16 | /** 17 | * 在Java代码中指定Header和Footer 18 | */ 19 | public class AssignCodeUsingActivity extends AppCompatActivity { 20 | 21 | private static boolean isFirstEnter = true; 22 | 23 | @Override 24 | protected void onCreate(Bundle savedInstanceState) { 25 | super.onCreate(savedInstanceState); 26 | setContentView(R.layout.activity_using_assign_code); 27 | 28 | final Toolbar toolbar = (Toolbar)findViewById(R.id.toolbar); 29 | toolbar.setNavigationOnClickListener(new View.OnClickListener() { 30 | @Override 31 | public void onClick(View v) { 32 | finish(); 33 | } 34 | }); 35 | 36 | 37 | final RefreshLayout refreshLayout = (RefreshLayout) findViewById(R.id.refreshLayout); 38 | //设置 Header 为 Material风格 39 | refreshLayout.setRefreshHeader(new MaterialHeader(this).setShowBezierWave(true)); 40 | //设置 Footer 为 球脉冲 41 | refreshLayout.setRefreshFooter(new BallPulseFooter(this).setSpinnerStyle(SpinnerStyle.Scale)); 42 | 43 | /** 44 | * 以下代码仅仅为了演示效果而已,不是必须的 45 | */ 46 | //设置主题颜色 47 | refreshLayout.setPrimaryColorsId(R.color.colorPrimary, android.R.color.white); 48 | 49 | if (isFirstEnter) { 50 | isFirstEnter = false; 51 | //触发上拉加载 52 | refreshLayout.autoLoadMore(250); 53 | //通过多功能监听接口实现 在第一次加载完成之后 自动刷新 54 | refreshLayout.setOnMultiPurposeListener(new SimpleMultiPurposeListener(){ 55 | @Override 56 | public void onStateChanged(RefreshLayout refreshLayout, RefreshState oldState, RefreshState newState) { 57 | if (oldState == RefreshState.LoadFinish && newState == RefreshState.None) { 58 | refreshLayout.autoRefresh(); 59 | refreshLayout.setOnMultiPurposeListener(null); 60 | } 61 | } 62 | }); 63 | } 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /app/src/main/java/com/scwang/refreshlayout/activity/using/AssignXmlUsingActivity.java: -------------------------------------------------------------------------------- 1 | package com.scwang.refreshlayout.activity.using; 2 | 3 | import android.os.Bundle; 4 | import android.support.v7.app.AppCompatActivity; 5 | import android.support.v7.widget.Toolbar; 6 | import android.view.View; 7 | 8 | import com.scwang.refreshlayout.R; 9 | import com.scwang.smartrefresh.layout.api.RefreshLayout; 10 | import com.scwang.smartrefresh.layout.constant.RefreshState; 11 | import com.scwang.smartrefresh.layout.listener.SimpleMultiPurposeListener; 12 | 13 | /** 14 | * 在XML中指定Header和Footer 15 | */ 16 | public class AssignXmlUsingActivity extends AppCompatActivity { 17 | 18 | private static boolean isFirstEnter = true; 19 | 20 | @Override 21 | protected void onCreate(Bundle savedInstanceState) { 22 | super.onCreate(savedInstanceState); 23 | setContentView(R.layout.activity_using_assign_xml); 24 | 25 | final Toolbar toolbar = (Toolbar)findViewById(R.id.toolbar); 26 | toolbar.setNavigationOnClickListener(new View.OnClickListener() { 27 | @Override 28 | public void onClick(View v) { 29 | finish(); 30 | } 31 | }); 32 | 33 | 34 | /** 35 | * 以下代码仅仅为了演示效果而已,不是必须的 36 | * 关键代码在 activity_using_assign_xml 中 37 | */ 38 | final RefreshLayout refreshLayout = (RefreshLayout) findViewById(R.id.refreshLayout); 39 | if (isFirstEnter) { 40 | isFirstEnter = false; 41 | //触发上拉加载 42 | refreshLayout.autoLoadMore(250); 43 | //通过多功能监听接口实现 在第一次加载完成之后 自动刷新 44 | refreshLayout.setOnMultiPurposeListener(new SimpleMultiPurposeListener(){ 45 | @Override 46 | public void onStateChanged(RefreshLayout refreshLayout, RefreshState oldState, RefreshState newState) { 47 | if (oldState == RefreshState.LoadFinish && newState == RefreshState.None) { 48 | refreshLayout.autoRefresh(); 49 | refreshLayout.setOnMultiPurposeListener(null); 50 | } 51 | } 52 | }); 53 | } 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /app/src/main/java/com/scwang/refreshlayout/activity/using/OverScrollUsingActivity.java: -------------------------------------------------------------------------------- 1 | package com.scwang.refreshlayout.activity.using; 2 | 3 | import android.os.Bundle; 4 | import android.support.v7.app.AppCompatActivity; 5 | import android.support.v7.widget.Toolbar; 6 | import android.view.View; 7 | import android.webkit.WebView; 8 | import android.webkit.WebViewClient; 9 | 10 | import com.scwang.refreshlayout.R; 11 | import com.scwang.smartrefresh.layout.api.RefreshLayout; 12 | import com.scwang.smartrefresh.layout.listener.OnRefreshListener; 13 | 14 | /** 15 | * 越界回弹使用演示 16 | */ 17 | public class OverScrollUsingActivity extends AppCompatActivity { 18 | 19 | @Override 20 | protected void onCreate(Bundle savedInstanceState) { 21 | super.onCreate(savedInstanceState); 22 | setContentView(R.layout.activity_using_overscroll); 23 | 24 | final Toolbar toolbar = (Toolbar)findViewById(R.id.toolbar); 25 | toolbar.setNavigationOnClickListener(new View.OnClickListener() { 26 | @Override 27 | public void onClick(View v) { 28 | finish(); 29 | } 30 | }); 31 | 32 | final WebView webView = (WebView) findViewById(R.id.webView); 33 | final RefreshLayout refreshLayout = (RefreshLayout) findViewById(R.id.refreshLayout); 34 | refreshLayout.setOnRefreshListener(new OnRefreshListener() { 35 | @Override 36 | public void onRefresh(RefreshLayout refreshLayout) { 37 | webView.loadUrl("http://github.com"); 38 | } 39 | }); 40 | refreshLayout.autoRefresh(); 41 | 42 | 43 | webView.setWebViewClient(new WebViewClient(){ 44 | @Override 45 | public boolean shouldOverrideUrlLoading(WebView view, String url) { 46 | view.loadUrl(url); 47 | return true; 48 | } 49 | @Override 50 | public void onPageCommitVisible(WebView view, String url) { 51 | refreshLayout.finishRefresh(); 52 | } 53 | }); 54 | // TextView textView = (TextView) findViewById(R.id.textView); 55 | // textView.setMovementMethod(new ScrollingMovementMethod()); 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /app/src/main/java/com/scwang/refreshlayout/activity/using/SnapHelperUsingActivity.java: -------------------------------------------------------------------------------- 1 | package com.scwang.refreshlayout.activity.using; 2 | 3 | import android.os.Bundle; 4 | import android.support.v7.app.AppCompatActivity; 5 | import android.support.v7.widget.DefaultItemAnimator; 6 | import android.support.v7.widget.LinearLayoutManager; 7 | import android.support.v7.widget.PagerSnapHelper; 8 | import android.support.v7.widget.RecyclerView; 9 | import android.support.v7.widget.SnapHelper; 10 | import android.support.v7.widget.Toolbar; 11 | import android.view.View; 12 | 13 | import com.scwang.refreshlayout.R; 14 | import com.scwang.refreshlayout.adapter.BaseRecyclerAdapter; 15 | import com.scwang.refreshlayout.adapter.SmartViewHolder; 16 | 17 | import java.util.Arrays; 18 | import java.util.Collection; 19 | 20 | /** 21 | * 结合 SnapHelper 使用 22 | * Created by SCWANG on 2017/8/4. 23 | */ 24 | 25 | public class SnapHelperUsingActivity extends AppCompatActivity { 26 | 27 | @Override 28 | protected void onCreate(Bundle savedInstanceState) { 29 | super.onCreate(savedInstanceState); 30 | setContentView(R.layout.activity_using_snaphelper); 31 | 32 | final Toolbar toolbar = (Toolbar)findViewById(R.id.toolbar); 33 | toolbar.setNavigationOnClickListener(new View.OnClickListener() { 34 | @Override 35 | public void onClick(View v) { 36 | finish(); 37 | } 38 | }); 39 | 40 | //初始化列表和监听 41 | View view = findViewById(R.id.recyclerView); 42 | if (view instanceof RecyclerView) { 43 | RecyclerView recyclerView = (RecyclerView) view; 44 | recyclerView.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); 45 | recyclerView.setItemAnimator(new DefaultItemAnimator()); 46 | recyclerView.setAdapter(new BaseRecyclerAdapter(loadModels(), R.layout.listitem_using_snaphelper) { 47 | @Override 48 | protected void onBindViewHolder(SmartViewHolder holder, Integer model, int position) { 49 | holder.image(R.id.imageView, model); 50 | } 51 | }); 52 | SnapHelper snapHelper = new PagerSnapHelper(); 53 | snapHelper.attachToRecyclerView(recyclerView); 54 | } 55 | 56 | } 57 | 58 | private Collection loadModels() { 59 | return Arrays.asList( 60 | R.mipmap.image_weibo_home_1, 61 | R.mipmap.image_weibo_home_2, 62 | R.mipmap.image_weibo_home_1, 63 | R.mipmap.image_weibo_home_2, 64 | R.mipmap.image_weibo_home_1, 65 | R.mipmap.image_weibo_home_2); 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /app/src/main/java/com/scwang/refreshlayout/fragment/practice/TwoLevelPracticeFragment.java: -------------------------------------------------------------------------------- 1 | package com.scwang.refreshlayout.fragment.practice; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.NonNull; 5 | import android.support.annotation.Nullable; 6 | import android.support.v4.app.Fragment; 7 | import android.support.v7.widget.Toolbar; 8 | import android.view.LayoutInflater; 9 | import android.view.View; 10 | import android.view.ViewGroup; 11 | import android.widget.Toast; 12 | 13 | import com.scwang.refreshlayout.R; 14 | import com.scwang.refreshlayout.util.StatusBarUtil; 15 | import com.scwang.refreshlayout.widget.TwoLevelHeader; 16 | import com.scwang.smartrefresh.layout.api.RefreshLayout; 17 | import com.scwang.smartrefresh.layout.listener.OnRefreshListener; 18 | 19 | /** 20 | * 二级刷新 21 | * Created by SCWANG on 2018/1/7. 22 | */ 23 | 24 | public class TwoLevelPracticeFragment extends Fragment { 25 | 26 | @Override 27 | public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 28 | return inflater.inflate(R.layout.fragment_practice_twolevel, container, false); 29 | } 30 | 31 | @Override 32 | public void onViewCreated(@NonNull final View root, @Nullable Bundle savedInstanceState) { 33 | super.onViewCreated(root, savedInstanceState); 34 | 35 | final Toolbar toolbar = (Toolbar)root.findViewById(R.id.toolbar); 36 | final TwoLevelHeader header = (TwoLevelHeader)root.findViewById(R.id.header); 37 | toolbar.setNavigationOnClickListener(new View.OnClickListener() { 38 | @Override 39 | public void onClick(View v) { 40 | getActivity().finish(); 41 | } 42 | }); 43 | 44 | final RefreshLayout refreshLayout = (RefreshLayout)root.findViewById(R.id.refreshLayout); 45 | 46 | header.setOnTwoLevelListener(new TwoLevelHeader.OnTwoLevelListener() { 47 | @Override 48 | public boolean onTwoLevel(RefreshLayout refreshLayout) { 49 | Toast.makeText(getContext(),"触发二楼事件",Toast.LENGTH_SHORT).show(); 50 | refreshLayout.getLayout().postDelayed(new Runnable() { 51 | @Override 52 | public void run() { 53 | header.finishTwoLevel(); 54 | } 55 | },5000); 56 | return true;//true 将会展开二楼状态 false 关闭刷新 57 | } 58 | }); 59 | 60 | refreshLayout.setOnRefreshListener(new OnRefreshListener() { 61 | @Override 62 | public void onRefresh(RefreshLayout refreshLayout) { 63 | Toast.makeText(getContext(),"触发刷新事件",Toast.LENGTH_SHORT).show(); 64 | refreshLayout.finishRefresh(2000); 65 | } 66 | }); 67 | 68 | //状态栏透明和间距处理 69 | StatusBarUtil.immersive(getActivity()); 70 | StatusBarUtil.setPaddingSmart(getActivity(), root.findViewById(R.id.toolbar)); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/animation_loading_frame.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/animation_loading_rotate.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/bc_background_panel.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_arrow_back_dark_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_arrow_back_gray_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_arrow_back_white_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_chevron_right.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_chevron_right_gray.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_empty.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_error.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_feed_list_favorite.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_feed_list_mail.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_feed_list_photo.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_fly_refresh_folder.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_fly_refresh_info.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_fly_refresh_poll.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_fly_refresh_send.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_fly_refresh_smartphone.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_index_dashboard.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_index_home.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_index_notifications.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_list_divider.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_progress_hojder.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_experiment.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 13 | 18 | 25 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_fly_refresh_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 14 | 15 | 23 | 24 | 31 | 32 | 38 | 39 | 48 | 49 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_index_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 15 | 16 | 21 | 22 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_practice_banner.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 20 | 25 | 34 | 35 | 36 | 42 | 43 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_practice_qqbrowser.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 15 | 16 | 20 | 26 | 39 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_practice_repast.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 20 | 28 | 36 | 42 | 43 | 44 | 49 | 50 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_practice_webview.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 18 | 23 | 29 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_style_bezier.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 | 24 | 28 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_style_circle.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 | 24 | 27 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_style_classics.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 | 20 | 33 | 40 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_style_delivery.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 17 | 18 | 25 | 28 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_style_dropbox.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 | 26 | 29 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_style_fungame_battlecity.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 | 23 | 26 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_style_fungame_hitblock.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 | 23 | 26 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_style_material.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 | 24 | 27 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_style_storehouse.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 | 24 | 29 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_style_water_drop.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 | 24 | 25 | 28 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_style_wave_swip.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 | 24 | 27 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_using_assign_code.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 | 20 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_using_assign_default.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 | 19 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_using_assign_xml.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 | 23 | 24 | 28 | 29 | 35 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_using_basic.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 | 21 | 28 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_using_custom.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 | 19 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_using_listener.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 | 21 | 25 | 28 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_using_overscroll.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_using_snaphelper.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 18 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /app/src/main/res/layout/common_independence_recycler.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 13 | 14 | 19 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /app/src/main/res/layout/common_loading.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_practice_twolevel.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 15 | 16 | 17 | 21 | 25 | 29 | 30 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_refresh_practive.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 12 | 13 | 20 | 26 | 32 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_refresh_styles.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 12 | 13 | 23 | 26 | 32 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_refresh_using.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 12 | 13 | 21 | 28 | 34 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_using_emptylayout.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 13 | 14 | 18 | 23 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_using_emptylayout_inner.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 13 | 14 | 18 | 21 | 28 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_using_emptylayout_outer.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 13 | 14 | 17 | 21 | 28 | 29 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_using_purescroll.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 13 | 14 | 19 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_using_purescroll_header.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 13 | 14 | 20 | 23 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_using_viewpager.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 13 | 14 | 21 | 26 | 31 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /app/src/main/res/layout/listitem_movie_banner.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 13 | 14 | 26 | 27 | -------------------------------------------------------------------------------- /app/src/main/res/layout/listitem_movie_header.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/layout/listitem_movie_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 17 | 18 | 22 | 27 | 33 | 38 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /app/src/main/res/layout/listitem_practive_repast.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 17 | 18 | 24 | 25 | 30 | 31 | 38 | 39 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /app/src/main/res/layout/listitem_style_delivery.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 17 | 18 | 24 | 25 | 29 | 34 | 39 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /app/src/main/res/layout/listitem_using_snaphelper.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 21 | 22 | -------------------------------------------------------------------------------- /app/src/main/res/menu/navigation.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 13 | 14 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/gif_header_repast.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hongyangAndroid/SmartRefreshLayout/763da0ffe8461532f1f0444a90f8c45eb5537a1d/app/src/main/res/mipmap-hdpi/gif_header_repast.gif -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_item1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hongyangAndroid/SmartRefreshLayout/763da0ffe8461532f1f0444a90f8c45eb5537a1d/app/src/main/res/mipmap-hdpi/ic_item1.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_item2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hongyangAndroid/SmartRefreshLayout/763da0ffe8461532f1f0444a90f8c45eb5537a1d/app/src/main/res/mipmap-hdpi/ic_item2.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_item3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hongyangAndroid/SmartRefreshLayout/763da0ffe8461532f1f0444a90f8c45eb5537a1d/app/src/main/res/mipmap-hdpi/ic_item3.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hongyangAndroid/SmartRefreshLayout/763da0ffe8461532f1f0444a90f8c45eb5537a1d/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hongyangAndroid/SmartRefreshLayout/763da0ffe8461532f1f0444a90f8c45eb5537a1d/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/image_avatar_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hongyangAndroid/SmartRefreshLayout/763da0ffe8461532f1f0444a90f8c45eb5537a1d/app/src/main/res/mipmap-hdpi/image_avatar_1.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/image_avatar_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hongyangAndroid/SmartRefreshLayout/763da0ffe8461532f1f0444a90f8c45eb5537a1d/app/src/main/res/mipmap-hdpi/image_avatar_2.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/image_avatar_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hongyangAndroid/SmartRefreshLayout/763da0ffe8461532f1f0444a90f8c45eb5537a1d/app/src/main/res/mipmap-hdpi/image_avatar_3.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/image_avatar_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hongyangAndroid/SmartRefreshLayout/763da0ffe8461532f1f0444a90f8c45eb5537a1d/app/src/main/res/mipmap-hdpi/image_avatar_4.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/image_avatar_5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hongyangAndroid/SmartRefreshLayout/763da0ffe8461532f1f0444a90f8c45eb5537a1d/app/src/main/res/mipmap-hdpi/image_avatar_5.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/image_avatar_6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hongyangAndroid/SmartRefreshLayout/763da0ffe8461532f1f0444a90f8c45eb5537a1d/app/src/main/res/mipmap-hdpi/image_avatar_6.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/image_movie_header_12231501221682438.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hongyangAndroid/SmartRefreshLayout/763da0ffe8461532f1f0444a90f8c45eb5537a1d/app/src/main/res/mipmap-hdpi/image_movie_header_12231501221682438.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/image_movie_header_12981501221820220.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hongyangAndroid/SmartRefreshLayout/763da0ffe8461532f1f0444a90f8c45eb5537a1d/app/src/main/res/mipmap-hdpi/image_movie_header_12981501221820220.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/image_movie_header_48621499931969370.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hongyangAndroid/SmartRefreshLayout/763da0ffe8461532f1f0444a90f8c45eb5537a1d/app/src/main/res/mipmap-hdpi/image_movie_header_48621499931969370.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/image_practice_repast_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hongyangAndroid/SmartRefreshLayout/763da0ffe8461532f1f0444a90f8c45eb5537a1d/app/src/main/res/mipmap-hdpi/image_practice_repast_1.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/image_practice_repast_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hongyangAndroid/SmartRefreshLayout/763da0ffe8461532f1f0444a90f8c45eb5537a1d/app/src/main/res/mipmap-hdpi/image_practice_repast_2.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/image_practice_repast_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hongyangAndroid/SmartRefreshLayout/763da0ffe8461532f1f0444a90f8c45eb5537a1d/app/src/main/res/mipmap-hdpi/image_practice_repast_3.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/image_practice_repast_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hongyangAndroid/SmartRefreshLayout/763da0ffe8461532f1f0444a90f8c45eb5537a1d/app/src/main/res/mipmap-hdpi/image_practice_repast_4.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/image_practice_repast_5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hongyangAndroid/SmartRefreshLayout/763da0ffe8461532f1f0444a90f8c45eb5537a1d/app/src/main/res/mipmap-hdpi/image_practice_repast_5.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/image_practice_repast_6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hongyangAndroid/SmartRefreshLayout/763da0ffe8461532f1f0444a90f8c45eb5537a1d/app/src/main/res/mipmap-hdpi/image_practice_repast_6.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hongyangAndroid/SmartRefreshLayout/763da0ffe8461532f1f0444a90f8c45eb5537a1d/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hongyangAndroid/SmartRefreshLayout/763da0ffe8461532f1f0444a90f8c45eb5537a1d/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/image_secondfloor.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hongyangAndroid/SmartRefreshLayout/763da0ffe8461532f1f0444a90f8c45eb5537a1d/app/src/main/res/mipmap-mdpi/image_secondfloor.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/image_secondfloor_content.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hongyangAndroid/SmartRefreshLayout/763da0ffe8461532f1f0444a90f8c45eb5537a1d/app/src/main/res/mipmap-mdpi/image_secondfloor_content.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/image_taobao.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hongyangAndroid/SmartRefreshLayout/763da0ffe8461532f1f0444a90f8c45eb5537a1d/app/src/main/res/mipmap-mdpi/image_taobao.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/image_weibo_home_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hongyangAndroid/SmartRefreshLayout/763da0ffe8461532f1f0444a90f8c45eb5537a1d/app/src/main/res/mipmap-mdpi/image_weibo_home_1.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/image_weibo_home_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hongyangAndroid/SmartRefreshLayout/763da0ffe8461532f1f0444a90f8c45eb5537a1d/app/src/main/res/mipmap-mdpi/image_weibo_home_2.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hongyangAndroid/SmartRefreshLayout/763da0ffe8461532f1f0444a90f8c45eb5537a1d/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hongyangAndroid/SmartRefreshLayout/763da0ffe8461532f1f0444a90f8c45eb5537a1d/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hongyangAndroid/SmartRefreshLayout/763da0ffe8461532f1f0444a90f8c45eb5537a1d/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hongyangAndroid/SmartRefreshLayout/763da0ffe8461532f1f0444a90f8c45eb5537a1d/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hongyangAndroid/SmartRefreshLayout/763da0ffe8461532f1f0444a90f8c45eb5537a1d/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hongyangAndroid/SmartRefreshLayout/763da0ffe8461532f1f0444a90f8c45eb5537a1d/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/values-v19/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/values-v21/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 11 | 12 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #33aaff 4 | #2299ee 5 | #cc0094ff 6 | #FF4081 7 | 8 | #333333 9 | #444444 10 | #888888 11 | 12 | #FFFFFF 13 | #f2f2f2 14 | #33aaaaaa 15 | 16 | 17 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 240dp 3 | 16dp 4 | 16dp 5 | 6 | 16dp 7 | 16dp 8 | 9 | 10 | 0.5dp 11 | 12 | 10dp 13 | 15dp 14 | 10dp 15 | 5dp 16 | 17 | 12sp 18 | 14sp 19 | 16sp 20 | 17sp 21 | 19sp 22 | 20sp 23 | 24 | 25 | -------------------------------------------------------------------------------- /app/src/test/java/com/scwang/refreshlayout/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.scwang.refreshlayout; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /bintrayUpload.bat: -------------------------------------------------------------------------------- 1 | gradlew clean build bintrayUpload -PbintrayUser=scwang90 -PbintrayKey=%1 -PdryRun=false -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:2.3.3' 9 | // NOTE: Do not place your application dependencies here; they belong 10 | // in the individual module build.gradle files 11 | classpath 'com.novoda:bintray-release:0.5.0' 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | jcenter() 18 | } 19 | tasks.withType(Javadoc) { 20 | options { 21 | encoding "UTF-8" 22 | charSet 'UTF-8' 23 | links "http://docs.oracle.com/javase/7/docs/api" 24 | } 25 | } 26 | } 27 | 28 | task clean(type: Delete) { 29 | delete rootProject.buildDir 30 | } 31 | -------------------------------------------------------------------------------- /refresh-footer/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /refresh-footer/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | //apply plugin: 'com.novoda.bintray-release' 3 | 4 | android { 5 | 6 | compileSdkVersion 25 7 | buildToolsVersion "25.0.3" 8 | 9 | defaultConfig { 10 | minSdkVersion 12 11 | targetSdkVersion 25 12 | versionCode 1 13 | versionName "1.0" 14 | 15 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 16 | 17 | } 18 | buildTypes { 19 | release { 20 | minifyEnabled false 21 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 22 | } 23 | } 24 | lintOptions { 25 | abortOnError false 26 | } 27 | } 28 | 29 | dependencies { 30 | compile fileTree(include: ['*.jar'], dir: 'libs') 31 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 32 | exclude group: 'com.android.support', module: 'support-annotations' 33 | }) 34 | testCompile 'junit:junit:4.12' 35 | provided 'com.android.support:support-compat:25.3.1' 36 | provided project(':refresh-layout') 37 | } 38 | 39 | //publish { 40 | // userOrg = 'scwang90' 41 | // groupId = 'com.scwang.smartrefresh' 42 | // artifactId = 'SmartRefreshFooter' 43 | // version = '1.0.0-alpha-1' 44 | // description = 'Some delicate footers of SmartRefreshLayout' 45 | // website = "https://github.com/scwang90/${rootProject.name}" 46 | //} -------------------------------------------------------------------------------- /refresh-footer/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in E:\Android\android-sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | # Uncomment this to preserve the line number information for 20 | # debugging stack traces. 21 | #-keepattributes SourceFile,LineNumberTable 22 | 23 | # If you keep the line number information, uncomment this to 24 | # hide the original source file name. 25 | #-renamesourcefileattribute SourceFile 26 | -------------------------------------------------------------------------------- /refresh-footer/src/androidTest/java/com/scwang/smartrefresh/footer/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smartrefreshfooter; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.scwang.smartrefreshfooter.test", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /refresh-footer/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /refresh-footer/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /refresh-footer/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | SmartRefreshFooter 3 | 4 | -------------------------------------------------------------------------------- /refresh-footer/src/test/java/com/scwang/smartrefresh/footer/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smartrefreshfooter; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /refresh-header/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /refresh-header/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'com.novoda.bintray-release' 3 | 4 | android { 5 | 6 | compileSdkVersion 25 7 | buildToolsVersion "25.0.3" 8 | 9 | defaultConfig { 10 | minSdkVersion 12 11 | targetSdkVersion 25 12 | versionCode 1 13 | versionName "1.0" 14 | 15 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 16 | 17 | } 18 | buildTypes { 19 | release { 20 | minifyEnabled false 21 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 22 | } 23 | } 24 | lintOptions { 25 | abortOnError false 26 | } 27 | } 28 | 29 | dependencies { 30 | compile fileTree(include: ['*.jar'], dir: 'libs') 31 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 32 | exclude group: 'com.android.support', module: 'support-annotations' 33 | }) 34 | testCompile 'junit:junit:4.12' 35 | provided 'com.android.support:support-compat:25.3.1' 36 | provided project(':refresh-layout') 37 | } 38 | 39 | publish { 40 | userOrg = 'scwang90' 41 | groupId = 'com.scwang.smartrefresh' 42 | artifactId = 'SmartRefreshHeader' 43 | version = '1.0.5' 44 | description = 'Some delicate headers of SmartRefreshLayout' 45 | website = "https://github.com/scwang90/${rootProject.name}" 46 | } 47 | -------------------------------------------------------------------------------- /refresh-header/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in E:\Android\android-sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | # Uncomment this to preserve the line number information for 20 | # debugging stack traces. 21 | #-keepattributes SourceFile,LineNumberTable 22 | 23 | # If you keep the line number information, uncomment this to 24 | # hide the original source file name. 25 | #-renamesourcefileattribute SourceFile 26 | -------------------------------------------------------------------------------- /refresh-header/src/androidTest/java/com/scwang/smartrefresh/header/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smartrefresh.header; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.scwang.smartrefresh.header.test", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /refresh-header/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /refresh-header/src/main/java/com/scwang/smartrefresh/header/flyrefresh/FlyView.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smartrefresh.header.flyrefresh; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | 6 | import com.scwang.smartrefresh.layout.internal.pathview.PathsView; 7 | import com.scwang.smartrefresh.layout.util.DensityUtil; 8 | 9 | /** 10 | * 纸飞机视图 11 | * Created by SCWANG on 2017/6/6. 12 | */ 13 | public class FlyView extends PathsView { 14 | 15 | public FlyView(Context context) { 16 | super(context); 17 | this.initView(context, null, 0); 18 | } 19 | 20 | public FlyView(Context context, AttributeSet attrs) { 21 | super(context, attrs); 22 | this.initView(context, attrs, 0); 23 | } 24 | 25 | public FlyView(Context context, AttributeSet attrs, int defStyleAttr) { 26 | super(context, attrs, defStyleAttr); 27 | this.initView(context, attrs, defStyleAttr); 28 | } 29 | 30 | private void initView(Context context, AttributeSet attrs, int defStyleAttr) { 31 | parserColors(0xffffffff); 32 | parserPaths("M2.01,21L23,12 2.01,3 2,10l15,2 -15,2z"); 33 | setMinimumWidth(DensityUtil.dp2px(25)); 34 | setMinimumHeight(DensityUtil.dp2px(25)); 35 | } 36 | 37 | @Override 38 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 39 | setMeasuredDimension(resolveSize(getSuggestedMinimumWidth(), widthMeasureSpec), 40 | resolveSize(getSuggestedMinimumHeight(), heightMeasureSpec)); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /refresh-header/src/main/java/com/scwang/smartrefresh/header/flyrefresh/PathInterpolatorCompatApi21.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 The Android Open Source Project 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 | 17 | package com.scwang.smartrefresh.header.flyrefresh; 18 | 19 | import android.graphics.Path; 20 | import android.support.annotation.RequiresApi; 21 | import android.annotation.TargetApi; 22 | import android.view.animation.Interpolator; 23 | import android.view.animation.PathInterpolator; 24 | 25 | /** 26 | * API 21+ implementation for path interpolator compatibility. 27 | */ 28 | 29 | @RequiresApi(21) 30 | @TargetApi(21) 31 | class PathInterpolatorCompatApi21 { 32 | 33 | private PathInterpolatorCompatApi21() { 34 | // prevent instantiation 35 | } 36 | 37 | public static Interpolator create(Path path) { 38 | return new PathInterpolator(path); 39 | } 40 | 41 | public static Interpolator create(float controlX, float controlY) { 42 | return new PathInterpolator(controlX, controlY); 43 | } 44 | 45 | public static Interpolator create(float controlX1, float controlY1, 46 | float controlX2, float controlY2) { 47 | return new PathInterpolator(controlX1, controlY1, controlX2, controlY2); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /refresh-header/src/main/java/com/scwang/smartrefresh/header/flyrefresh/PathInterpolatorCompatBase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 The Android Open Source Project 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 | 17 | package com.scwang.smartrefresh.header.flyrefresh; 18 | 19 | import android.graphics.Path; 20 | import android.support.annotation.RequiresApi; 21 | import android.annotation.TargetApi; 22 | import android.view.animation.Interpolator; 23 | 24 | /** 25 | * Base implementation for path interpolator compatibility. 26 | */ 27 | 28 | @RequiresApi(9) 29 | @TargetApi(9) 30 | class PathInterpolatorCompatBase { 31 | 32 | private PathInterpolatorCompatBase() { 33 | // prevent instantiation 34 | } 35 | 36 | public static Interpolator create(Path path) { 37 | return new PathInterpolatorGingerbread(path); 38 | } 39 | 40 | public static Interpolator create(float controlX, float controlY) { 41 | return new PathInterpolatorGingerbread(controlX, controlY); 42 | } 43 | 44 | public static Interpolator create(float controlX1, float controlY1, 45 | float controlX2, float controlY2) { 46 | return new PathInterpolatorGingerbread(controlX1, controlY1, controlX2, controlY2); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /refresh-header/src/main/java/com/scwang/smartrefresh/header/internal/LookupTableInterpolator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 The Android Open Source Project 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 | 17 | package com.scwang.smartrefresh.header.internal; 18 | 19 | import android.view.animation.Interpolator; 20 | 21 | /** 22 | * An {@link Interpolator} that uses a lookup table to compute an interpolation based on a 23 | * given input. 24 | */ 25 | abstract class LookupTableInterpolator implements Interpolator { 26 | 27 | private final float[] mValues; 28 | private final float mStepSize; 29 | 30 | public LookupTableInterpolator(float[] values) { 31 | mValues = values; 32 | mStepSize = 1f / (mValues.length - 1); 33 | } 34 | 35 | @Override 36 | public float getInterpolation(float input) { 37 | if (input >= 1.0f) { 38 | return 1.0f; 39 | } 40 | if (input <= 0f) { 41 | return 0f; 42 | } 43 | 44 | // Calculate index - We use min with length - 2 to avoid IndexOutOfBoundsException when 45 | // we lerp (linearly interpolate) in the return statement 46 | int position = Math.min((int) (input * (mValues.length - 1)), mValues.length - 2); 47 | 48 | // Calculate values to account for small offsets as the lookup table has discrete values 49 | float quantized = position * mStepSize; 50 | float diff = input - quantized; 51 | float weight = diff / mStepSize; 52 | 53 | // Linearly interpolate between the table values 54 | return mValues[position] + weight * (mValues[position + 1] - mValues[position]); 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /refresh-header/src/main/java/com/scwang/smartrefresh/header/storehouse/StoreHouseBarItem.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smartrefresh.header.storehouse; 2 | 3 | import android.graphics.Canvas; 4 | import android.graphics.Paint; 5 | import android.graphics.PointF; 6 | import android.view.animation.Animation; 7 | import android.view.animation.Transformation; 8 | 9 | import java.util.Random; 10 | 11 | /** 12 | * 13 | * Created by srain on 11/6/14. 14 | */ 15 | public class StoreHouseBarItem extends Animation { 16 | 17 | public PointF midPoint; 18 | public float translationX; 19 | public int index; 20 | 21 | private final Paint mPaint = new Paint(); 22 | private float mFromAlpha = 1.0f; 23 | private float mToAlpha = 0.4f; 24 | private PointF mCStartPoint; 25 | private PointF mCEndPoint; 26 | 27 | public StoreHouseBarItem(int index, PointF start, PointF end, int color, int lineWidth) { 28 | this.index = index; 29 | 30 | midPoint = new PointF((start.x + end.x) / 2, (start.y + end.y) / 2); 31 | 32 | mCStartPoint = new PointF(start.x - midPoint.x, start.y - midPoint.y); 33 | mCEndPoint = new PointF(end.x - midPoint.x, end.y - midPoint.y); 34 | 35 | setColor(color); 36 | setLineWidth(lineWidth); 37 | mPaint.setAntiAlias(true); 38 | mPaint.setStyle(Paint.Style.STROKE); 39 | } 40 | 41 | public void setLineWidth(int width) { 42 | mPaint.setStrokeWidth(width); 43 | } 44 | 45 | public void setColor(int color) { 46 | mPaint.setColor(color); 47 | } 48 | 49 | public void resetPosition(int horizontalRandomness) { 50 | Random random = new Random(); 51 | int randomNumber = -random.nextInt(horizontalRandomness) + horizontalRandomness; 52 | translationX = randomNumber; 53 | } 54 | 55 | @Override 56 | protected void applyTransformation(float interpolatedTime, Transformation t) { 57 | float alpha = mFromAlpha; 58 | alpha = alpha + ((mToAlpha - alpha) * interpolatedTime); 59 | setAlpha(alpha); 60 | } 61 | 62 | public void start(float fromAlpha, float toAlpha) { 63 | mFromAlpha = fromAlpha; 64 | mToAlpha = toAlpha; 65 | super.start(); 66 | } 67 | 68 | public void setAlpha(float alpha) { 69 | mPaint.setAlpha((int) (alpha * 255)); 70 | } 71 | 72 | public void draw(Canvas canvas) { 73 | canvas.drawLine(mCStartPoint.x, mCStartPoint.y, mCEndPoint.x, mCEndPoint.y, mPaint); 74 | } 75 | } -------------------------------------------------------------------------------- /refresh-header/src/main/java/com/scwang/smartrefresh/header/util/ColorUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 The Android Open Source Project 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 | 17 | package com.scwang.smartrefresh.header.util; 18 | 19 | import android.graphics.Color; 20 | import android.support.annotation.ColorInt; 21 | import android.support.annotation.IntRange; 22 | 23 | /** 24 | * A set of color-related utility methods, building upon those available in {@code Color}. 25 | */ 26 | public final class ColorUtils { 27 | 28 | private ColorUtils() {} 29 | 30 | /* 31 | * Composite two potentially translucent colors over each other and returns the result. 32 | */ 33 | public static int compositeColors(@ColorInt int foreground, @ColorInt int background) { 34 | int bgAlpha = Color.alpha(background); 35 | int fgAlpha = Color.alpha(foreground); 36 | int a = compositeAlpha(fgAlpha, bgAlpha); 37 | 38 | int r = compositeComponent(Color.red(foreground), fgAlpha, 39 | Color.red(background), bgAlpha, a); 40 | int g = compositeComponent(Color.green(foreground), fgAlpha, 41 | Color.green(background), bgAlpha, a); 42 | int b = compositeComponent(Color.blue(foreground), fgAlpha, 43 | Color.blue(background), bgAlpha, a); 44 | 45 | return Color.argb(a, r, g, b); 46 | } 47 | 48 | private static int compositeAlpha(int foregroundAlpha, int backgroundAlpha) { 49 | return 0xFF - (((0xFF - backgroundAlpha) * (0xFF - foregroundAlpha)) / 0xFF); 50 | } 51 | 52 | private static int compositeComponent(int fgC, int fgA, int bgC, int bgA, int a) { 53 | if (a == 0) return 0; 54 | return ((0xFF * fgC * fgA) + (bgC * bgA * (0xFF - fgA))) / (a * 0xFF); 55 | } 56 | 57 | /* 58 | * Set the alpha component of {@code color} to be {@code alpha}. 59 | */ 60 | @ColorInt 61 | public static int setAlphaComponent(@ColorInt int color, 62 | @IntRange(from = 0x0, to = 0xFF) int alpha) { 63 | if (alpha < 0 || alpha > 255) { 64 | throw new IllegalArgumentException("alpha must be between 0 and 255."); 65 | } 66 | return (color & 0x00ffffff) | (alpha << 24); 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /refresh-header/src/main/java/com/scwang/smartrefresh/header/waterdrop/Circle.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smartrefresh.header.waterdrop; 2 | 3 | /** 4 | * Created by xiayong on 2015/6/25. 5 | * 实心圆 6 | */ 7 | public class Circle { 8 | public float x;//圆x坐标 9 | public float y;//圆y坐标 10 | public float radius;//圆半径 11 | public int color;//圆的颜色 12 | } -------------------------------------------------------------------------------- /refresh-header/src/main/java/com/scwang/smartrefresh/header/waveswipe/AnimationImageView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 RECRUIT LIFESTYLE CO., LTD. 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 | 17 | package com.scwang.smartrefresh.header.waveswipe; 18 | 19 | import android.content.Context; 20 | import android.view.animation.Animation; 21 | import android.widget.ImageView; 22 | 23 | /** 24 | * @author amyu 25 | */ 26 | public class AnimationImageView extends ImageView { 27 | 28 | /** 29 | * AnimationのStartとEnd時にListenerにアレする 30 | */ 31 | private Animation.AnimationListener mListener; 32 | 33 | /** 34 | * コンストラクタ 35 | * {@inheritDoc} 36 | */ 37 | public AnimationImageView(Context context) { 38 | super(context); 39 | } 40 | 41 | /** 42 | * {@link AnimationImageView#mListener} のセット 43 | * 44 | * @param listener {@link android.view.animation.Animation.AnimationListener} 45 | */ 46 | public void setAnimationListener(Animation.AnimationListener listener) { 47 | mListener = listener; 48 | } 49 | 50 | /** 51 | * ViewのAnimationのStart時にセットされたListenerの {@link android.view.animation.Animation.AnimationListener#onAnimationStart(Animation)} 52 | * を呼ぶ 53 | */ 54 | @Override public void onAnimationStart() { 55 | super.onAnimationStart(); 56 | if (mListener != null) { 57 | mListener.onAnimationStart(getAnimation()); 58 | } 59 | } 60 | 61 | /** 62 | * ViewのAnimationのEnd時にセットされたListenerの {@link android.view.animation.Animation.AnimationListener#onAnimationEnd(Animation)} 63 | * (Animation)} を呼ぶ 64 | */ 65 | @Override public void onAnimationEnd() { 66 | super.onAnimationEnd(); 67 | if (mListener != null) { 68 | mListener.onAnimationEnd(getAnimation()); 69 | } 70 | } 71 | } -------------------------------------------------------------------------------- /refresh-header/src/main/java/com/scwang/smartrefresh/header/waveswipe/DisplayUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) RECRUIT LIFESTYLE CO., LTD. 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 | 17 | package com.scwang.smartrefresh.header.waveswipe; 18 | 19 | import android.content.Context; 20 | import android.content.res.Resources; 21 | import android.util.DisplayMetrics; 22 | 23 | /** 24 | * @author amyu 25 | */ 26 | public class DisplayUtil { 27 | 28 | private DisplayUtil(){} 29 | 30 | /** 31 | * 現在の向きが600dpを超えているかどうか 32 | * 33 | * @param context {@link Context} 34 | * @return 600dpを超えているかどうか 35 | */ 36 | public static boolean isOver600dp(Context context) { 37 | Resources resources = context.getResources(); 38 | DisplayMetrics displayMetrics = resources.getDisplayMetrics(); 39 | return displayMetrics.widthPixels / displayMetrics.density >= 600; 40 | } 41 | } -------------------------------------------------------------------------------- /refresh-header/src/main/java/com/scwang/smartrefresh/header/waveswipe/DropBounceInterpolator.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smartrefresh.header.waveswipe; 2 | /* 3 | * Copyright (C) 2015 RECRUIT LIFESTYLE CO., LTD. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | import android.content.Context; 19 | import android.util.AttributeSet; 20 | import android.view.animation.Interpolator; 21 | 22 | /** 23 | * @author amyu 24 | * 25 | * {@link WaveView#mDropBounceHorizontalAnimator} と {@link WaveView#mDropVertexAnimator} にセットするInterpolator 26 | * WavePullToRefresh/DropBounceInterpolator.gcxにグラフの詳細 27 | */ 28 | public class DropBounceInterpolator implements Interpolator { 29 | 30 | public DropBounceInterpolator() { 31 | } 32 | 33 | @SuppressWarnings({"UnusedDeclaration"}) 34 | public DropBounceInterpolator(Context context, AttributeSet attrs) { 35 | } 36 | 37 | /** 38 | * {@inheritDoc} 39 | * @param v 动画帧 40 | * @return 加速值 41 | */ 42 | @Override 43 | public float getInterpolation(float v) { 44 | //y = -19 * (x - 0.125)^2 + 1.3 (0 <= x < 0.25) 45 | //y = -6.5 * (x - 0.625)^2 + 1.1 (0.5 <= x < 0.75) 46 | //y = 0 (0.25 <= x < 0.5 && 0.75 <= x <=1) 47 | 48 | if (v < 0.25f) { 49 | return -38.4f * (float) Math.pow(v - 0.125, 2) + 0.6f; 50 | } else if (v >= 0.5 && v < 0.75) { 51 | return -19.2f * (float) Math.pow(v - 0.625, 2) + 0.3f; 52 | } else { 53 | return 0; 54 | } 55 | } 56 | } -------------------------------------------------------------------------------- /refresh-header/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | SmartRefreshHeader 3 | 4 | -------------------------------------------------------------------------------- /refresh-header/src/test/java/com/scwang/smartrefresh/header/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smartrefresh.header; 2 | 3 | import org.junit.Test; 4 | 5 | import java.text.SimpleDateFormat; 6 | import java.util.Date; 7 | import java.util.Locale; 8 | 9 | import static org.junit.Assert.*; 10 | 11 | /** 12 | * Example local unit test, which will execute on the development machine (host). 13 | * 14 | * @see Testing documentation 15 | */ 16 | public class ExampleUnitTest { 17 | @Test 18 | public void addition_isCorrect() throws Exception { 19 | System.out.println(new SimpleDateFormat("'Last update' M-d HH:mm", Locale.CHINA).format(new Date())); 20 | assertEquals(4, 2 + 2); 21 | } 22 | } -------------------------------------------------------------------------------- /refresh-layout/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /refresh-layout/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'com.novoda.bintray-release' 3 | 4 | android { 5 | 6 | compileSdkVersion 25 7 | buildToolsVersion "25.0.3" 8 | 9 | defaultConfig { 10 | minSdkVersion 12 11 | targetSdkVersion 25 12 | versionCode 1 13 | versionName "1.0" 14 | 15 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 16 | 17 | } 18 | buildTypes { 19 | release { 20 | minifyEnabled false 21 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 22 | } 23 | } 24 | lintOptions { 25 | abortOnError false 26 | } 27 | } 28 | 29 | dependencies { 30 | compile fileTree(dir: 'libs', include: ['*.jar']) 31 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 32 | exclude group: 'com.android.support', module: 'support-annotations' 33 | }) 34 | testCompile 'junit:junit:4.12' 35 | provided 'com.android.support:design:25.3.1' 36 | } 37 | 38 | publish { 39 | userOrg = 'scwang90' 40 | groupId = 'com.scwang.smartrefresh' 41 | artifactId = 'SmartRefreshLayout' 42 | version = '1.0.5' 43 | description = 'An intelligent refresh layout' 44 | website = "https://github.com/scwang90/${rootProject.name}" 45 | } -------------------------------------------------------------------------------- /refresh-layout/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in E:\Android\android-sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | # Uncomment this to preserve the line number information for 20 | # debugging stack traces. 21 | #-keepattributes SourceFile,LineNumberTable 22 | 23 | # If you keep the line number information, uncomment this to 24 | # hide the original source file name. 25 | #-renamesourcefileattribute SourceFile 26 | -------------------------------------------------------------------------------- /refresh-layout/src/androidTest/java/com/scwang/smartrefresh/layout/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smartrefresh.layout; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.scwang.smartrefresh.layout.test", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /refresh-layout/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /refresh-layout/src/main/java/com/scwang/smartrefresh/layout/api/DefaultRefreshFooterCreater.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smartrefresh.layout.api; 2 | 3 | /** 4 | * 默认Footer创建器 5 | * @deprecated 使用 {@link DefaultRefreshFooterCreator} 代替 6 | * Created by SCWANG on 2017/5/26. 7 | */ 8 | @Deprecated 9 | public interface DefaultRefreshFooterCreater extends DefaultRefreshFooterCreator { 10 | } 11 | -------------------------------------------------------------------------------- /refresh-layout/src/main/java/com/scwang/smartrefresh/layout/api/DefaultRefreshFooterCreator.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smartrefresh.layout.api; 2 | 3 | import android.content.Context; 4 | import android.support.annotation.NonNull; 5 | 6 | /** 7 | * 默认Footer创建器 8 | * Created by SCWANG on 2018/1/26. 9 | */ 10 | 11 | public interface DefaultRefreshFooterCreator { 12 | @NonNull 13 | RefreshFooter createRefreshFooter(@NonNull Context context,@NonNull RefreshLayout layout); 14 | } 15 | -------------------------------------------------------------------------------- /refresh-layout/src/main/java/com/scwang/smartrefresh/layout/api/DefaultRefreshHeaderCreater.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smartrefresh.layout.api; 2 | 3 | /** 4 | * 默认Header创建器 5 | * @deprecated 使用 {@link DefaultRefreshHeaderCreator} 代替 6 | * Created by SCWANG on 2017/5/26. 7 | */ 8 | @Deprecated 9 | public interface DefaultRefreshHeaderCreater extends DefaultRefreshHeaderCreator { 10 | } 11 | -------------------------------------------------------------------------------- /refresh-layout/src/main/java/com/scwang/smartrefresh/layout/api/DefaultRefreshHeaderCreator.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smartrefresh.layout.api; 2 | 3 | import android.content.Context; 4 | import android.support.annotation.NonNull; 5 | 6 | /** 7 | * 默认Header创建器 8 | * Created by SCWANG on 2018/1/26. 9 | */ 10 | public interface DefaultRefreshHeaderCreator { 11 | @NonNull 12 | RefreshHeader createRefreshHeader(@NonNull Context context,@NonNull RefreshLayout layout); 13 | } 14 | -------------------------------------------------------------------------------- /refresh-layout/src/main/java/com/scwang/smartrefresh/layout/api/OnLoadmoreListener.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smartrefresh.layout.api; 2 | 3 | /** 4 | * 加载更多监听器 5 | * @deprecated 使用 {@link com.scwang.smartrefresh.layout.listener.OnLoadMoreListener} 代替 6 | * Created by SCWANG on 2017/5/26. 7 | */ 8 | @Deprecated 9 | public interface OnLoadmoreListener { 10 | void onLoadmore(RefreshLayout refreshLayout); 11 | } 12 | -------------------------------------------------------------------------------- /refresh-layout/src/main/java/com/scwang/smartrefresh/layout/api/OnRefreshLoadmoreListener.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smartrefresh.layout.api; 2 | 3 | import com.scwang.smartrefresh.layout.listener.OnRefreshListener; 4 | 5 | /** 6 | * 刷新加载组合监听器 7 | * @deprecated 使用 {@link com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener} 代替 8 | * Created by SCWANG on 2017/5/26. 9 | */ 10 | @Deprecated 11 | public interface OnRefreshLoadmoreListener extends OnRefreshListener, OnLoadmoreListener { 12 | } 13 | -------------------------------------------------------------------------------- /refresh-layout/src/main/java/com/scwang/smartrefresh/layout/api/RefreshContent.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smartrefresh.layout.api; 2 | 3 | import android.animation.ValueAnimator.AnimatorUpdateListener; 4 | import android.support.annotation.RestrictTo; 5 | import android.view.MotionEvent; 6 | import android.view.View; 7 | import android.view.ViewGroup; 8 | 9 | import static android.support.annotation.RestrictTo.Scope.LIBRARY; 10 | import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP; 11 | import static android.support.annotation.RestrictTo.Scope.SUBCLASSES; 12 | 13 | /** 14 | * 刷新内容组件 15 | * Created by SCWANG on 2017/5/26. 16 | */ 17 | @RestrictTo({LIBRARY,LIBRARY_GROUP,SUBCLASSES}) 18 | public interface RefreshContent { 19 | void moveSpinner(int spinner); 20 | boolean canRefresh(); 21 | boolean canLoadMore(); 22 | int getMeasuredWidth(); 23 | int getMeasuredHeight(); 24 | void measure(int widthSpec, int heightSpec); 25 | void layout(int left, int top, int right, int bottom); 26 | 27 | View getView(); 28 | View getScrollableView(); 29 | ViewGroup.LayoutParams getLayoutParams(); 30 | 31 | void onActionDown(MotionEvent e); 32 | void onActionUpOrCancel(); 33 | 34 | void fling(int velocity); 35 | void setUpComponent(RefreshKernel kernel, View fixedHeader, View fixedFooter); 36 | void onInitialHeaderAndFooter(int headerHeight, int footerHeight); 37 | void setScrollBoundaryDecider(ScrollBoundaryDecider boundary); 38 | 39 | void setEnableLoadMoreWhenContentNotFull(boolean enable); 40 | 41 | AnimatorUpdateListener scrollContentWhenFinished(int spinner); 42 | } 43 | -------------------------------------------------------------------------------- /refresh-layout/src/main/java/com/scwang/smartrefresh/layout/api/RefreshFooter.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smartrefresh.layout.api; 2 | 3 | import android.support.annotation.RestrictTo; 4 | 5 | import static android.support.annotation.RestrictTo.Scope.LIBRARY; 6 | import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP; 7 | import static android.support.annotation.RestrictTo.Scope.SUBCLASSES; 8 | 9 | /** 10 | * 刷新底部 11 | * Created by SCWANG on 2017/5/26. 12 | */ 13 | @RestrictTo({LIBRARY,LIBRARY_GROUP,SUBCLASSES}) 14 | public interface RefreshFooter extends RefreshInternal { 15 | 16 | /** 17 | * 设置数据全部加载完成,将不能再次触发加载功能 18 | * @param noMoreData 是否有更多数据 19 | * @return true 支持全部加载完成的状态显示 false 不支持 20 | */ 21 | boolean setNoMoreData(boolean noMoreData); 22 | } 23 | -------------------------------------------------------------------------------- /refresh-layout/src/main/java/com/scwang/smartrefresh/layout/api/RefreshHeader.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smartrefresh.layout.api; 2 | 3 | import android.support.annotation.RestrictTo; 4 | 5 | import static android.support.annotation.RestrictTo.Scope.LIBRARY; 6 | import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP; 7 | import static android.support.annotation.RestrictTo.Scope.SUBCLASSES; 8 | 9 | /** 10 | * 刷新头部 11 | * Created by SCWANG on 2017/5/26. 12 | */ 13 | @RestrictTo({LIBRARY,LIBRARY_GROUP,SUBCLASSES}) 14 | public interface RefreshHeader extends RefreshInternal { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /refresh-layout/src/main/java/com/scwang/smartrefresh/layout/api/ScrollBoundaryDecider.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smartrefresh.layout.api; 2 | 3 | import android.view.View; 4 | 5 | /** 6 | * 滚动边界 7 | * Created by SCWANG on 2017/7/8. 8 | */ 9 | 10 | public interface ScrollBoundaryDecider { 11 | /** 12 | * 根据内容视图状态判断是否可以开始下拉刷新 13 | * @param content 内容视图 14 | * @return true 将会触发下拉刷新 15 | */ 16 | boolean canRefresh(View content); 17 | /** 18 | * 根据内容视图状态判断是否可以开始上拉加载 19 | * @param content 内容视图 20 | * @return true 将会触发加载更多 21 | */ 22 | boolean canLoadMore(View content); 23 | } 24 | -------------------------------------------------------------------------------- /refresh-layout/src/main/java/com/scwang/smartrefresh/layout/constant/DimensionStatus.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smartrefresh.layout.constant; 2 | 3 | /** 4 | * 尺寸值的定义状态,用于在值覆盖的时候决定优先级 5 | * 越往下优先级越高 6 | */ 7 | public enum DimensionStatus { 8 | DefaultUnNotify(false),//默认值,但是还没通知确认 9 | Default(true),//默认值 10 | XmlWrapUnNotify(false),//Xml计算,但是还没通知确认 11 | XmlWrap(true),//Xml计算 12 | XmlExactUnNotify(false),//Xml 的view 指定,但是还没通知确认 13 | XmlExact(true),//Xml 的view 指定 14 | XmlLayoutUnNotify(false),//Xml 的layout 中指定,但是还没通知确认 15 | XmlLayout(true),//Xml 的layout 中指定 16 | CodeExactUnNotify(false),//代码指定,但是还没通知确认 17 | CodeExact(true),//代码指定 18 | DeadLockUnNotify(false),//锁死,但是还没通知确认 19 | DeadLock(true);//锁死 20 | public final boolean notified; 21 | 22 | DimensionStatus(boolean notified) { 23 | this.notified = notified; 24 | } 25 | 26 | /** 27 | * 转换为未通知状态 28 | * @return 未通知状态 29 | */ 30 | public DimensionStatus unNotify() { 31 | if (notified) { 32 | DimensionStatus prev = values()[ordinal() - 1]; 33 | if (!prev.notified) { 34 | return prev; 35 | } 36 | return DefaultUnNotify; 37 | } 38 | return this; 39 | } 40 | 41 | /** 42 | * 转换为通知状态 43 | * @return 通知状态 44 | */ 45 | public DimensionStatus notified() { 46 | if (!notified) { 47 | return values()[ordinal() + 1]; 48 | } 49 | return this; 50 | } 51 | 52 | /** 53 | * 是否可以被新的状态替换 54 | * @param status 新转台 55 | * @return 小于等于 56 | */ 57 | public boolean canReplaceWith(DimensionStatus status) { 58 | return ordinal() < status.ordinal() || ((!notified || CodeExact == this) && ordinal() == status.ordinal()); 59 | } 60 | 61 | /** 62 | * 是否没有达到新的状态 63 | * @param status 新转台 64 | * @return 大于等于 65 | */ 66 | public boolean gteReplaceWith(DimensionStatus status) { 67 | return ordinal() >= status.ordinal(); 68 | } 69 | } -------------------------------------------------------------------------------- /refresh-layout/src/main/java/com/scwang/smartrefresh/layout/constant/RefreshState.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smartrefresh.layout.constant; 2 | 3 | /** 4 | * 刷新状态 5 | */ 6 | @SuppressWarnings("unused") 7 | public enum RefreshState { 8 | None(0,false), 9 | PullDownToRefresh(1,true), PullUpToLoad(2,true), 10 | PullDownCanceled(1,false), PullUpCanceled(2,false), 11 | ReleaseToRefresh(1,true), ReleaseToLoad(2,true), 12 | ReleaseToTwoLevel(1, true), TwoLevelReleased(1,false), 13 | RefreshReleased(1,false), LoadReleased(2,false), 14 | Refreshing(1,false,true), Loading(2,false,true), TwoLevel(1, false, true), 15 | RefreshFinish(1,false,false,true), LoadFinish(2,false,false,true), TwoLevelFinish(1,false,false,true),; 16 | 17 | private final int role; 18 | public final boolean dragging;// 正在拖动状态:PullDownToRefresh PullUpToLoad ReleaseToRefresh ReleaseToLoad ReleaseToTwoLevel 19 | public final boolean opening;// 正在刷新状态:Refreshing Loading TwoLevel 20 | public final boolean finishing;//正在完成状态:RefreshFinish LoadFinish TwoLevelFinish 21 | 22 | RefreshState(int role, boolean dragging) { 23 | this.role = role; 24 | this.dragging = dragging; 25 | this.opening = false; 26 | this.finishing = false; 27 | } 28 | 29 | RefreshState(int role, boolean dragging, boolean opening) { 30 | this.role = role; 31 | this.dragging = dragging; 32 | this.opening = opening; 33 | this.finishing = false; 34 | } 35 | 36 | RefreshState(int role, boolean dragging, boolean opening, boolean finishing) { 37 | this.role = role; 38 | this.dragging = dragging; 39 | this.opening = opening; 40 | this.finishing = finishing; 41 | } 42 | 43 | public boolean isHeader() { 44 | return role == 1; 45 | } 46 | 47 | public boolean isFooter() { 48 | return role == 2; 49 | } 50 | 51 | } -------------------------------------------------------------------------------- /refresh-layout/src/main/java/com/scwang/smartrefresh/layout/constant/SpinnerStyle.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smartrefresh.layout.constant; 2 | 3 | /** 4 | * 顶部和底部的组件在拖动时候的变换方式 5 | * Created by SCWANG on 2017/5/26. 6 | */ 7 | 8 | public enum SpinnerStyle { 9 | Translate,//平行移动 特点: HeaderView高度不会改变, 10 | Scale,//拉伸形变 特点:在下拉和上弹(HeaderView高度改变)时候,会自动触发OnDraw事件 11 | FixedBehind,//固定在背后 特点:HeaderView高度不会改变, 12 | FixedFront,//固定在前面 特点:HeaderView高度不会改变, 13 | MatchLayout//填满布局 特点:HeaderView高度不会改变,尺寸充满 RefreshLayout 14 | } 15 | -------------------------------------------------------------------------------- /refresh-layout/src/main/java/com/scwang/smartrefresh/layout/footer/FalsifyFooter.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smartrefresh.layout.footer; 2 | 3 | import android.content.Context; 4 | import android.os.Build; 5 | import android.support.annotation.NonNull; 6 | import android.support.annotation.Nullable; 7 | import android.support.annotation.RequiresApi; 8 | import android.util.AttributeSet; 9 | 10 | import com.scwang.smartrefresh.layout.api.RefreshFooter; 11 | import com.scwang.smartrefresh.layout.api.RefreshKernel; 12 | import com.scwang.smartrefresh.layout.header.FalsifyHeader; 13 | 14 | /** 15 | * 虚假的 Footer 16 | * 用于 正真的 Footer 在 RefreshLayout 外部时, 17 | * Created by SCWANG on 2017/6/14. 18 | */ 19 | @SuppressWarnings("unused") 20 | public class FalsifyFooter extends FalsifyHeader implements RefreshFooter { 21 | 22 | // 23 | public FalsifyFooter(Context context) { 24 | super(context); 25 | } 26 | 27 | public FalsifyFooter(Context context, AttributeSet attrs) { 28 | super(context, attrs); 29 | } 30 | 31 | public FalsifyFooter(Context context, AttributeSet attrs, int defStyleAttr) { 32 | super(context, attrs, defStyleAttr); 33 | } 34 | 35 | @RequiresApi(Build.VERSION_CODES.LOLLIPOP) 36 | public FalsifyFooter(Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) { 37 | super(context, attrs, defStyleAttr, defStyleRes); 38 | } 39 | 40 | // 41 | 42 | // 43 | 44 | @Override 45 | public void onInitialized(@NonNull RefreshKernel kernel, int height, int extendHeight) { 46 | super.onInitialized(kernel, height, extendHeight); 47 | kernel.getRefreshLayout().setEnableAutoLoadMore(false); 48 | } 49 | 50 | @Override 51 | public boolean setNoMoreData(boolean noMoreData) { 52 | return false; 53 | } 54 | 55 | // 56 | 57 | } 58 | -------------------------------------------------------------------------------- /refresh-layout/src/main/java/com/scwang/smartrefresh/layout/header/bezierradar/RippleView.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smartrefresh.layout.header.bezierradar; 2 | 3 | 4 | import android.animation.Animator; 5 | import android.animation.AnimatorListenerAdapter; 6 | import android.animation.ValueAnimator; 7 | import android.content.Context; 8 | import android.graphics.Canvas; 9 | import android.graphics.Paint; 10 | import android.support.annotation.ColorInt; 11 | import android.view.View; 12 | 13 | /** 14 | * cjj 15 | */ 16 | public class RippleView extends View { 17 | 18 | private int mRadius; 19 | private Paint mPaint; 20 | private ValueAnimator mAnimator; 21 | 22 | public RippleView(Context context) { 23 | super(context); 24 | mPaint = new Paint(); 25 | mPaint.setAntiAlias(true); 26 | mPaint.setColor(0xffffffff); 27 | mPaint.setStyle(Paint.Style.FILL); 28 | } 29 | 30 | @Override 31 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 32 | setMeasuredDimension(resolveSize(getSuggestedMinimumWidth(), widthMeasureSpec), 33 | resolveSize(getSuggestedMinimumHeight(), heightMeasureSpec)); 34 | } 35 | 36 | public void setFrontColor(@ColorInt int color) { 37 | mPaint.setColor(color); 38 | } 39 | 40 | public void startReveal() { 41 | if (mAnimator == null) { 42 | int bigRadius = (int) (Math.sqrt(Math.pow(getHeight(), 2) + Math.pow(getWidth(), 2))); 43 | mAnimator = ValueAnimator.ofInt(0, bigRadius); 44 | mAnimator.setDuration(400); 45 | mAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { 46 | @Override 47 | public void onAnimationUpdate(ValueAnimator animation) { 48 | mRadius = (int) animation.getAnimatedValue(); 49 | invalidate(); 50 | } 51 | }); 52 | mAnimator.addListener(new AnimatorListenerAdapter() { 53 | @Override 54 | public void onAnimationEnd(Animator animation) { 55 | } 56 | }); 57 | } 58 | mAnimator.start(); 59 | } 60 | 61 | @Override 62 | protected void onDraw(Canvas canvas) { 63 | super.onDraw(canvas); 64 | canvas.drawCircle(getWidth() / 2, getHeight() / 2, mRadius, mPaint); 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /refresh-layout/src/main/java/com/scwang/smartrefresh/layout/header/bezierradar/RoundDotView.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smartrefresh.layout.header.bezierradar; 2 | 3 | import android.content.Context; 4 | import android.graphics.Canvas; 5 | import android.graphics.Color; 6 | import android.graphics.Paint; 7 | import android.support.annotation.ColorInt; 8 | import android.view.View; 9 | 10 | import com.scwang.smartrefresh.layout.util.DensityUtil; 11 | 12 | /** 13 | * 14 | * Created by cjj on 2015/8/27. 15 | */ 16 | public class RoundDotView extends View { 17 | 18 | private int num = 7; 19 | private Paint mPath; 20 | private float mRadius; 21 | private float fraction; 22 | 23 | public RoundDotView(Context context) { 24 | super(context); 25 | mPath = new Paint(); 26 | mPath.setAntiAlias(true); 27 | mPath.setColor(Color.WHITE); 28 | mRadius = DensityUtil.dp2px(7); 29 | } 30 | 31 | @Override 32 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 33 | setMeasuredDimension(resolveSize(getSuggestedMinimumWidth(), widthMeasureSpec), 34 | resolveSize(getSuggestedMinimumHeight(), heightMeasureSpec)); 35 | } 36 | 37 | public void setDotColor(@ColorInt int color) { 38 | mPath.setColor(color); 39 | } 40 | 41 | @Override 42 | protected void onDraw(Canvas canvas) { 43 | super.onDraw(canvas); 44 | int width = getWidth(); 45 | int height = getHeight(); 46 | float wide = (width / num) * fraction-((fraction>1)?((fraction-1)*(width / num)/fraction):0);//y1 = t*(w/n)-(t>1)*((t-1)*(w/n)/t) 47 | float high = height - ((fraction>1)?((fraction-1)*height/2/fraction):0);//y2 = x - (t>1)*((t-1)*x/t); 48 | for (int i = 0 ; i < num; i++) { 49 | float index = 1f + i - (1f + num) / 2;//y3 = (x + 1) - (n + 1)/2; 居中 index 变量:0 1 2 3 4 结果: -2 -1 0 1 2 50 | float alpha = 255 * (1 - (2 * (Math.abs(index) / num)));//y4 = m * ( 1 - 2 * abs(y3) / n); 横向 alpha 差 51 | float x = DensityUtil.px2dp(height); 52 | mPath.setAlpha((int) (alpha * (1d - 1d / Math.pow((x / 800d + 1d), 15))));//y5 = y4 * (1-1/((x/800+1)^15));竖直 alpha 差 53 | float radius = mRadius * (1-1/((x/10+1)));//y6 = mRadius*(1-1/(x/10+1));半径 54 | canvas.drawCircle(width / 2- radius/2 + wide * index , high / 2, radius, mPath); 55 | } 56 | } 57 | 58 | public void setFraction(float fraction) { 59 | this.fraction = fraction; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /refresh-layout/src/main/java/com/scwang/smartrefresh/layout/header/bezierradar/WaveView.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smartrefresh.layout.header.bezierradar; 2 | 3 | import android.content.Context; 4 | import android.graphics.Canvas; 5 | import android.graphics.Paint; 6 | import android.graphics.Path; 7 | import android.support.annotation.ColorInt; 8 | import android.util.AttributeSet; 9 | import android.view.View; 10 | 11 | /** 12 | * Created by cjj on 2015/8/5. 13 | * 绘制贝塞尔来绘制波浪形 14 | */ 15 | public class WaveView extends View { 16 | 17 | private int waveHeight; 18 | private int height; 19 | private Path path; 20 | private Paint paint; 21 | private int mOffsetX = -1; 22 | 23 | public WaveView(Context context) { 24 | this(context, null, 0); 25 | } 26 | 27 | public WaveView(Context context, AttributeSet attrs) { 28 | this(context, attrs, 0); 29 | } 30 | 31 | public WaveView(Context context, AttributeSet attrs, int defStyleAttr) { 32 | super(context, attrs, defStyleAttr); 33 | initView(); 34 | } 35 | 36 | private void initView() { 37 | path = new Path(); 38 | paint = new Paint(); 39 | paint.setColor(0xff1F2426); 40 | paint.setAntiAlias(true); 41 | } 42 | 43 | @Override 44 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 45 | setMeasuredDimension(resolveSize(getSuggestedMinimumWidth(), widthMeasureSpec), 46 | resolveSize(getSuggestedMinimumHeight(), heightMeasureSpec)); 47 | } 48 | 49 | public void setWaveColor(@ColorInt int color) { 50 | paint.setColor(color); 51 | } 52 | 53 | public int getHeadHeight() { 54 | return height; 55 | } 56 | 57 | public void setHeadHeight(int height) { 58 | this.height = height; 59 | } 60 | 61 | public int getWaveHeight() { 62 | return waveHeight; 63 | } 64 | 65 | public void setWaveHeight(int waveHeight) { 66 | this.waveHeight = waveHeight; 67 | } 68 | 69 | @Override 70 | protected void onDraw(Canvas canvas) { 71 | super.onDraw(canvas); 72 | final int width = getWidth(); 73 | //重置画笔 74 | path.reset(); 75 | //绘制贝塞尔曲线 76 | path.lineTo(0, height); 77 | path.quadTo(mOffsetX >= 0 ? (mOffsetX) : width / 2, height + waveHeight, width, height); 78 | path.lineTo(width, 0); 79 | canvas.drawPath(path, paint); 80 | } 81 | 82 | public void setWaveOffsetX(int offset) { 83 | mOffsetX = offset; 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /refresh-layout/src/main/java/com/scwang/smartrefresh/layout/impl/ScrollBoundaryDeciderAdapter.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smartrefresh.layout.impl; 2 | 3 | import android.view.MotionEvent; 4 | import android.view.View; 5 | 6 | import com.scwang.smartrefresh.layout.api.ScrollBoundaryDecider; 7 | import com.scwang.smartrefresh.layout.util.ScrollBoundaryUtil; 8 | 9 | /** 10 | * 滚动边界 11 | * Created by SCWANG on 2017/7/8. 12 | */ 13 | 14 | @SuppressWarnings("WeakerAccess") 15 | public class ScrollBoundaryDeciderAdapter implements ScrollBoundaryDecider { 16 | 17 | // 18 | protected MotionEvent mActionEvent; 19 | protected ScrollBoundaryDecider boundary; 20 | protected boolean mEnableLoadMoreWhenContentNotFull; 21 | 22 | void setScrollBoundaryDecider(ScrollBoundaryDecider boundary){ 23 | this.boundary = boundary; 24 | } 25 | 26 | void setActionEvent(MotionEvent event) { 27 | //event 在没有必要时候会被设置为 null 28 | mActionEvent = event; 29 | } 30 | // 31 | 32 | // 33 | @Override 34 | public boolean canRefresh(View content) { 35 | if (boundary != null) { 36 | return boundary.canRefresh(content); 37 | } 38 | //mActionEvent == null 时 canRefresh 不会动态递归搜索 39 | return ScrollBoundaryUtil.canRefresh(content, mActionEvent); 40 | } 41 | 42 | @Override 43 | public boolean canLoadMore(View content) { 44 | if (boundary != null) { 45 | return boundary.canLoadMore(content); 46 | } 47 | if (mEnableLoadMoreWhenContentNotFull) { 48 | //mActionEvent == null 时 canScrollDown 不会动态递归搜索 49 | return !ScrollBoundaryUtil.canScrollDown(content, mActionEvent); 50 | } 51 | //mActionEvent == null 时 canLoadMore 不会动态递归搜索 52 | return ScrollBoundaryUtil.canLoadMore(content, mActionEvent); 53 | } 54 | 55 | public void setEnableLoadMoreWhenContentNotFull(boolean enable) { 56 | mEnableLoadMoreWhenContentNotFull = enable; 57 | } 58 | // 59 | } 60 | -------------------------------------------------------------------------------- /refresh-layout/src/main/java/com/scwang/smartrefresh/layout/internal/pathview/PathsView.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smartrefresh.layout.internal.pathview; 2 | 3 | import android.content.Context; 4 | import android.graphics.Canvas; 5 | import android.util.AttributeSet; 6 | import android.view.View; 7 | 8 | /** 9 | * 路径视图 10 | * Created by SCWANG on 2017/5/29. 11 | */ 12 | public class PathsView extends View { 13 | 14 | protected PathsDrawable mPathsDrawable = new PathsDrawable(); 15 | 16 | public PathsView(Context context) { 17 | super(context); 18 | this.initView(context, null, 0); 19 | } 20 | 21 | public PathsView(Context context, AttributeSet attrs) { 22 | super(context, attrs); 23 | this.initView(context, attrs, 0); 24 | } 25 | 26 | public PathsView(Context context, AttributeSet attrs, int defStyleAttr) { 27 | super(context, attrs, defStyleAttr); 28 | this.initView(context, attrs, defStyleAttr); 29 | } 30 | 31 | private void initView(Context context, AttributeSet attrs, int defStyleAttr) { 32 | mPathsDrawable = new PathsDrawable(); 33 | } 34 | 35 | @Override 36 | protected void onFinishInflate() { 37 | super.onFinishInflate(); 38 | if (getTag() instanceof String) { 39 | parserPaths(getTag().toString()); 40 | } 41 | } 42 | 43 | @Override 44 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 45 | setMeasuredDimension(resolveSize(mPathsDrawable.width()+getPaddingLeft()+getPaddingRight(), widthMeasureSpec), 46 | resolveSize(mPathsDrawable.height()+getPaddingTop()+getPaddingBottom(), heightMeasureSpec)); 47 | } 48 | 49 | @Override 50 | protected void onLayout(boolean changed, int left, int top, int right, int bottom) { 51 | super.onLayout(changed, left, top, right, bottom); 52 | mPathsDrawable.setBounds(getPaddingLeft(), getPaddingTop(), 53 | Math.max((right - left) - getPaddingRight(), getPaddingLeft()), 54 | Math.max((bottom - top) - getPaddingTop(), getPaddingTop())); 55 | } 56 | 57 | @Override 58 | protected void onDraw(Canvas canvas) { 59 | super.onDraw(canvas); 60 | mPathsDrawable.draw(canvas); 61 | } 62 | 63 | public void parserPaths(String... paths) { 64 | mPathsDrawable.parserPaths(paths); 65 | } 66 | 67 | public void parserColors(int... colors) { 68 | mPathsDrawable.parserColors(colors); 69 | } 70 | 71 | 72 | } 73 | -------------------------------------------------------------------------------- /refresh-layout/src/main/java/com/scwang/smartrefresh/layout/listener/AnimationEndListener.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smartrefresh.layout.listener; 2 | 3 | /** 4 | * 动画 5 | * Created by SCWANG on 2017/6/21. 6 | */ 7 | 8 | public interface AnimationEndListener { 9 | void onAnimationEnd(); 10 | } 11 | -------------------------------------------------------------------------------- /refresh-layout/src/main/java/com/scwang/smartrefresh/layout/listener/OnLoadMoreListener.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smartrefresh.layout.listener; 2 | 3 | import com.scwang.smartrefresh.layout.api.RefreshLayout; 4 | 5 | /** 6 | * 加载更多监听器 7 | * Created by SCWANG on 2017/5/26. 8 | */ 9 | 10 | public interface OnLoadMoreListener { 11 | void onLoadMore(RefreshLayout refreshLayout); 12 | } 13 | -------------------------------------------------------------------------------- /refresh-layout/src/main/java/com/scwang/smartrefresh/layout/listener/OnMultiPurposeListener.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smartrefresh.layout.listener; 2 | 3 | import com.scwang.smartrefresh.layout.api.RefreshFooter; 4 | import com.scwang.smartrefresh.layout.api.RefreshHeader; 5 | 6 | /** 7 | * 多功能监听器 8 | * Created by SCWANG on 2017/5/26. 9 | */ 10 | 11 | public interface OnMultiPurposeListener extends OnRefreshLoadMoreListener, OnStateChangedListener { 12 | void onHeaderPulling(RefreshHeader header, float percent, int offset, int headerHeight, int extendHeight); 13 | void onHeaderReleased(RefreshHeader header, int headerHeight, int extendHeight); 14 | void onHeaderReleasing(RefreshHeader header, float percent, int offset, int headerHeight, int extendHeight); 15 | void onHeaderStartAnimator(RefreshHeader header, int headerHeight, int extendHeight); 16 | void onHeaderFinish(RefreshHeader header, boolean success); 17 | 18 | void onFooterPulling(RefreshFooter footer, float percent, int offset, int footerHeight, int extendHeight); 19 | void onFooterReleased(RefreshFooter footer, int footerHeight, int extendHeight); 20 | void onFooterReleasing(RefreshFooter footer, float percent, int offset, int footerHeight, int extendHeight); 21 | void onFooterStartAnimator(RefreshFooter footer, int footerHeight, int extendHeight); 22 | void onFooterFinish(RefreshFooter footer, boolean success); 23 | } 24 | -------------------------------------------------------------------------------- /refresh-layout/src/main/java/com/scwang/smartrefresh/layout/listener/OnRefreshListener.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smartrefresh.layout.listener; 2 | 3 | import com.scwang.smartrefresh.layout.api.RefreshLayout; 4 | 5 | /** 6 | * 刷新监听器 7 | * Created by SCWANG on 2017/5/26. 8 | */ 9 | 10 | public interface OnRefreshListener { 11 | void onRefresh(RefreshLayout refreshLayout); 12 | } 13 | -------------------------------------------------------------------------------- /refresh-layout/src/main/java/com/scwang/smartrefresh/layout/listener/OnRefreshLoadMoreListener.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smartrefresh.layout.listener; 2 | 3 | /** 4 | * 刷新加载组合监听器 5 | * Created by SCWANG on 2017/5/26. 6 | */ 7 | public interface OnRefreshLoadMoreListener extends OnRefreshListener, OnLoadMoreListener { 8 | } 9 | -------------------------------------------------------------------------------- /refresh-layout/src/main/java/com/scwang/smartrefresh/layout/listener/OnStateChangedListener.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smartrefresh.layout.listener; 2 | 3 | 4 | import com.scwang.smartrefresh.layout.api.RefreshLayout; 5 | import com.scwang.smartrefresh.layout.constant.RefreshState; 6 | 7 | /** 8 | * 刷新状态改变监听器 9 | * Created by SCWANG on 2017/5/26. 10 | */ 11 | 12 | public interface OnStateChangedListener { 13 | /** 14 | * 状态改变事件 {@link RefreshState} 15 | * @param refreshLayout RefreshLayout 16 | * @param oldState 改变之前的状态 17 | * @param newState 改变之后的状态 18 | */ 19 | void onStateChanged(RefreshLayout refreshLayout, RefreshState oldState, RefreshState newState); 20 | } 21 | -------------------------------------------------------------------------------- /refresh-layout/src/main/java/com/scwang/smartrefresh/layout/listener/SimpleMultiPurposeListener.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smartrefresh.layout.listener; 2 | 3 | import com.scwang.smartrefresh.layout.api.RefreshFooter; 4 | import com.scwang.smartrefresh.layout.api.RefreshHeader; 5 | import com.scwang.smartrefresh.layout.api.RefreshLayout; 6 | import com.scwang.smartrefresh.layout.constant.RefreshState; 7 | 8 | /** 9 | * 多功能监听器 10 | * Created by SCWANG on 2017/5/26. 11 | */ 12 | 13 | public class SimpleMultiPurposeListener implements OnMultiPurposeListener { 14 | 15 | @Override 16 | public void onHeaderPulling(RefreshHeader header, float percent, int offset, int headerHeight, int extendHeight) { 17 | 18 | } 19 | 20 | @Override 21 | public void onHeaderReleased(RefreshHeader header, int headerHeight, int extendHeight) { 22 | 23 | } 24 | 25 | @Override 26 | public void onHeaderReleasing(RefreshHeader header, float percent, int offset, int footerHeight, int extendHeight) { 27 | 28 | } 29 | 30 | @Override 31 | public void onHeaderStartAnimator(RefreshHeader header, int footerHeight, int extendHeight) { 32 | 33 | } 34 | 35 | @Override 36 | public void onHeaderFinish(RefreshHeader header, boolean success) { 37 | 38 | } 39 | 40 | @Override 41 | public void onFooterPulling(RefreshFooter footer, float percent, int offset, int footerHeight, int extendHeight) { 42 | 43 | } 44 | 45 | @Override 46 | public void onFooterReleased(RefreshFooter footer, int footerHeight, int extendHeight) { 47 | 48 | } 49 | 50 | @Override 51 | public void onFooterReleasing(RefreshFooter footer, float percent, int offset, int footerHeight, int extendHeight) { 52 | 53 | } 54 | 55 | @Override 56 | public void onFooterStartAnimator(RefreshFooter footer, int headerHeight, int extendHeight) { 57 | 58 | } 59 | 60 | @Override 61 | public void onFooterFinish(RefreshFooter footer, boolean success) { 62 | 63 | } 64 | 65 | @Override 66 | public void onRefresh(RefreshLayout refreshLayout) { 67 | 68 | } 69 | 70 | @Override 71 | public void onLoadMore(RefreshLayout refreshLayout) { 72 | 73 | } 74 | 75 | @Override 76 | public void onStateChanged(RefreshLayout refreshLayout, RefreshState oldState, RefreshState newState) { 77 | 78 | } 79 | 80 | } 81 | -------------------------------------------------------------------------------- /refresh-layout/src/main/java/com/scwang/smartrefresh/layout/util/CoordinatorLayoutListener.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smartrefresh.layout.util; 2 | 3 | public interface CoordinatorLayoutListener { 4 | void update(boolean enableRefresh, boolean enableLoadMore); 5 | } -------------------------------------------------------------------------------- /refresh-layout/src/main/java/com/scwang/smartrefresh/layout/util/DelayedRunnable.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smartrefresh.layout.util; 2 | 3 | public class DelayedRunnable implements Runnable { 4 | public long delayMillis; 5 | public Runnable runnable = null; 6 | public DelayedRunnable(Runnable runnable) { 7 | this.runnable = runnable; 8 | } 9 | public DelayedRunnable(Runnable runnable, long delayMillis) { 10 | this.runnable = runnable; 11 | this.delayMillis = delayMillis; 12 | } 13 | @Override 14 | public void run() { 15 | try { 16 | if (runnable != null) { 17 | runnable.run(); 18 | runnable = null; 19 | } 20 | } catch (Throwable e) { 21 | e.printStackTrace(); 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /refresh-layout/src/main/java/com/scwang/smartrefresh/layout/util/DensityUtil.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smartrefresh.layout.util; 2 | 3 | import android.content.res.Resources; 4 | 5 | /** 6 | * 像素密度计算工具 7 | */ 8 | @SuppressWarnings("unused") 9 | public class DensityUtil { 10 | 11 | public float density; 12 | 13 | public DensityUtil() { 14 | density = Resources.getSystem().getDisplayMetrics().density; 15 | } 16 | 17 | /** 18 | * 根据手机的分辨率从 dp 的单位 转成为 px(像素) 19 | * @param dpValue 虚拟像素 20 | * @return 像素 21 | */ 22 | public static int dp2px(float dpValue) { 23 | return (int) (0.5f + dpValue * Resources.getSystem().getDisplayMetrics().density); 24 | } 25 | 26 | /** 27 | * 根据手机的分辨率从 px(像素) 的单位 转成为 dp 28 | * @param pxValue 像素 29 | * @return 虚拟像素 30 | */ 31 | public static float px2dp(int pxValue) { 32 | return (pxValue / Resources.getSystem().getDisplayMetrics().density); 33 | } 34 | 35 | /** 36 | * 根据手机的分辨率从 dp 的单位 转成为 px(像素) 37 | * @param dpValue 虚拟像素 38 | * @return 像素 39 | */ 40 | public int dip2px(float dpValue) { 41 | return (int) (0.5f + dpValue * density); 42 | } 43 | 44 | /** 45 | * 根据手机的分辨率从 px(像素) 的单位 转成为 dp 46 | * @param pxValue 像素 47 | * @return 虚拟像素 48 | */ 49 | public float px2dip(int pxValue) { 50 | return (pxValue / density); 51 | } 52 | } -------------------------------------------------------------------------------- /refresh-layout/src/main/java/com/scwang/smartrefresh/layout/util/DesignUtil.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smartrefresh.layout.util; 2 | 3 | import android.support.design.widget.AppBarLayout; 4 | import android.support.design.widget.CoordinatorLayout; 5 | import android.view.View; 6 | import android.view.ViewGroup; 7 | 8 | import com.scwang.smartrefresh.layout.api.RefreshKernel; 9 | import com.scwang.smartrefresh.layout.api.RefreshLayout; 10 | 11 | /** 12 | * Design 兼容包缺省尝试 13 | * Created by SCWANG on 2018/1/29. 14 | */ 15 | 16 | public class DesignUtil { 17 | 18 | public static void checkCoordinatorLayout(View content, RefreshKernel kernel, CoordinatorLayoutListener listener) { 19 | try {//try 不能删除,不然会出现兼容性问题 20 | if (content instanceof CoordinatorLayout) { 21 | kernel.getRefreshLayout().setEnableNestedScroll(false); 22 | wrapperCoordinatorLayout(((ViewGroup) content), kernel.getRefreshLayout(),listener); 23 | } 24 | } catch (Throwable ignored) { 25 | } 26 | } 27 | 28 | private static void wrapperCoordinatorLayout(ViewGroup layout, final RefreshLayout refreshLayout, final CoordinatorLayoutListener listener) { 29 | for (int i = layout.getChildCount() - 1; i >= 0; i--) { 30 | View view = layout.getChildAt(i); 31 | if (view instanceof AppBarLayout) { 32 | ((AppBarLayout) view).addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() { 33 | @Override 34 | public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) { 35 | listener.update( 36 | verticalOffset >= 0, 37 | refreshLayout.isEnableLoadMore() && (appBarLayout.getTotalScrollRange() + verticalOffset) <= 0); 38 | } 39 | }); 40 | } 41 | } 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /refresh-layout/src/main/java/com/scwang/smartrefresh/layout/util/ViscousFluidInterpolator.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smartrefresh.layout.util; 2 | 3 | import android.view.animation.Interpolator; 4 | 5 | public class ViscousFluidInterpolator implements Interpolator { 6 | /** Controls the viscous fluid effect (how much of it). */ 7 | private static final float VISCOUS_FLUID_SCALE = 8.0f; 8 | 9 | private static final float VISCOUS_FLUID_NORMALIZE; 10 | private static final float VISCOUS_FLUID_OFFSET; 11 | 12 | static { 13 | 14 | // must be set to 1.0 (used in viscousFluid()) 15 | VISCOUS_FLUID_NORMALIZE = 1.0f / viscousFluid(1.0f); 16 | // account for very small floating-point error 17 | VISCOUS_FLUID_OFFSET = 1.0f - VISCOUS_FLUID_NORMALIZE * viscousFluid(1.0f); 18 | } 19 | 20 | private static float viscousFluid(float x) { 21 | x *= VISCOUS_FLUID_SCALE; 22 | if (x < 1.0f) { 23 | x -= (1.0f - (float)Math.exp(-x)); 24 | } else { 25 | float start = 0.36787944117f; // 1/e == exp(-1) 26 | x = 1.0f - (float)Math.exp(1.0f - x); 27 | x = start + x * (1.0f - start); 28 | } 29 | return x; 30 | } 31 | 32 | @Override 33 | public float getInterpolation(float input) { 34 | final float interpolated = VISCOUS_FLUID_NORMALIZE * viscousFluid(input); 35 | if (interpolated > 0) { 36 | return interpolated + VISCOUS_FLUID_OFFSET; 37 | } 38 | return interpolated; 39 | } 40 | } -------------------------------------------------------------------------------- /refresh-layout/src/main/res/values-zh/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 智能刷新 3 | SmartRefreshLayout中没有找到内容视图。您是否忘记在xml布局文件中添加? 4 | %s 虚假区域\n代表运行时拖动的高度【%.1fdp】 \n而不会显示任何东西 5 | 6 | -------------------------------------------------------------------------------- /refresh-layout/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | SmartRefreshLayout 3 | The content view in SmartRefreshLayout is empty. Do you forget to add it in xml layout file? 4 | %s falsify area,\n Represents the height[%.1fdp] of drag at run time,\n It does not show anything. 5 | 6 | -------------------------------------------------------------------------------- /refresh-layout/src/test/java/com/scwang/smartrefresh/layout/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smartrefresh.layout; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app'//, ':app-design' 2 | include ':refresh-layout', ':refresh-header', ':refresh-footer' 3 | --------------------------------------------------------------------------------