├── .gitignore ├── JitPackUpload.gradle ├── LICENSE ├── README.md ├── README_EN.md ├── app ├── .gitignore ├── build.gradle ├── debug.keystore ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── ic_launcher-web.png │ ├── java │ └── com │ │ └── scwang │ │ └── refreshlayout │ │ ├── App.java │ │ ├── activity │ │ ├── FragmentActivity.java │ │ ├── IndexMainActivity.java │ │ ├── example │ │ │ ├── AssignCodeExampleActivity.java │ │ │ ├── AssignDefaultExampleActivity.java │ │ │ ├── AssignXmlExampleActivity.java │ │ │ ├── BasicExampleActivity.java │ │ │ ├── CustomExampleActivity.java │ │ │ ├── ListenerExampleActivity.java │ │ │ ├── NestedLayoutExampleActivity.java │ │ │ ├── OverScrollExampleActivity.java │ │ │ └── SnapHelperExampleActivity.java │ │ ├── practice │ │ │ ├── BannerPracticeActivity.java │ │ │ ├── FeedListPracticeActivity.java │ │ │ ├── ProfilePracticeActivity.java │ │ │ ├── QQBrowserPracticeActivity.java │ │ │ ├── RepastPracticeActivity.java │ │ │ ├── WebViewPracticeActivity.java │ │ │ └── WeiboPracticeActivity.java │ │ └── style │ │ │ ├── BezierCircleStyleActivity.java │ │ │ ├── BezierRadarStyleActivity.java │ │ │ ├── ClassicsStyleActivity.java │ │ │ ├── DeliveryStyleActivity.java │ │ │ ├── DropBoxStyleActivity.java │ │ │ ├── FlyRefreshStyleActivity.java │ │ │ ├── FunGameBattleCityStyleActivity.java │ │ │ ├── FunGameHitBlockStyleActivity.java │ │ │ ├── MaterialStyleActivity.java │ │ │ ├── PhoenixStyleActivity.java │ │ │ ├── StoreHouseStyleActivity.java │ │ │ ├── TaurusStyleActivity.java │ │ │ ├── WaterDropStyleActivity.java │ │ │ └── WaveSwipeStyleActivity.java │ │ ├── adapter │ │ ├── BaseRecyclerAdapter.java │ │ └── SmartViewHolder.java │ │ ├── fragment │ │ ├── example │ │ │ ├── BottomSheetExampleFragment.java │ │ │ ├── EmptyLayoutExampleFragment.java │ │ │ ├── EmptyLayoutExampleFragmentInner.java │ │ │ ├── EmptyLayoutExampleFragmentOuter.java │ │ │ ├── NestedScrollExampleFragment.java │ │ │ ├── NestedScrollExampleFragmentIntegral.java │ │ │ ├── NestedScrollExampleFragmentViewPager.java │ │ │ ├── PureScrollExampleFragment.java │ │ │ ├── PureScrollExampleFragmentFooter.java │ │ │ ├── PureScrollExampleFragmentHeader.java │ │ │ ├── SpecifyStyleExampleFragment.java │ │ │ ├── ThreeLevelExampleFragment.java │ │ │ └── ViewPagerExampleFragment.java │ │ ├── index │ │ │ ├── RefreshExampleFragment.java │ │ │ ├── RefreshPracticeFragment.java │ │ │ └── RefreshStylesFragment.java │ │ └── practice │ │ │ ├── SecondFloorPracticeFragment.java │ │ │ └── TwoLevelPracticeFragment.java │ │ └── util │ │ ├── DynamicTimeFormat.java │ │ └── StatusBarUtil.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_puzzle.xml │ ├── layout │ ├── activity_example_assign_code.xml │ ├── activity_example_assign_default.xml │ ├── activity_example_assign_xml.xml │ ├── activity_example_basic.xml │ ├── activity_example_custom.xml │ ├── activity_example_listener.xml │ ├── activity_example_overscroll.xml │ ├── activity_example_region.xml │ ├── activity_example_snaphelper.xml │ ├── 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_swipe.xml │ ├── common_independence_recycler.xml │ ├── common_loading.xml │ ├── fragment_example_bottom_sheet.xml │ ├── fragment_example_emptylayout.xml │ ├── fragment_example_emptylayout_inner.xml │ ├── fragment_example_emptylayout_outer.xml │ ├── fragment_example_nestedscroll.xml │ ├── fragment_example_nestedscroll_integral.xml │ ├── fragment_example_nestedscroll_view_pager.xml │ ├── fragment_example_purescroll.xml │ ├── fragment_example_purescroll_header.xml │ ├── fragment_example_three_level.xml │ ├── fragment_example_viewpager.xml │ ├── fragment_practice_secondfloor.xml │ ├── fragment_practice_twolevel.xml │ ├── fragment_refresh_example.xml │ ├── fragment_refresh_practive.xml │ ├── fragment_refresh_styles.xml │ ├── item_example_snaphelper.xml │ ├── item_movie_banner.xml │ ├── item_movie_header.xml │ ├── item_movie_item.xml │ ├── item_practice_repast.xml │ └── item_style_delivery.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 │ ├── arrays.xml │ ├── strings.xml │ └── strings_srl.xml │ └── values │ ├── arrays.xml │ ├── colors.xml │ ├── dimens.xml │ ├── strings.xml │ ├── strings_srl.xml │ └── styles.xml ├── bintrayUpload.bat ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── method-count-layout.bat ├── refresh-header ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── 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 │ │ ├── fungame │ │ ├── FunGameBase.java │ │ └── FunGameView.java │ │ ├── internal │ │ ├── MaterialProgressDrawable.java │ │ └── pathview │ │ │ ├── PathParser.java │ │ │ ├── PathsDrawable.java │ │ │ └── PathsView.java │ │ ├── material │ │ └── CircleImageView.java │ │ ├── storehouse │ │ ├── StoreHouseBarItem.java │ │ └── StoreHousePath.java │ │ ├── waterdrop │ │ ├── Circle.java │ │ └── WaterDropView.java │ │ └── waveswipe │ │ ├── DropBounceInterpolator.java │ │ └── WaveView.java │ └── res │ ├── values-zh │ └── strings.xml │ └── values │ ├── attrs.xml │ └── strings.xml ├── refresh-layout ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── scwang │ │ └── smartrefresh │ │ └── layout │ │ ├── SmartRefreshLayout.java │ │ ├── adapter │ │ ├── BaseRecyclerAdapter.java │ │ ├── SmartRecyclerAdapter.java │ │ └── SmartViewHolder.java │ │ ├── api │ │ ├── DefaultRefreshFooterCreator.java │ │ ├── DefaultRefreshHeaderCreator.java │ │ ├── DefaultRefreshInitializer.java │ │ ├── OnTwoLevelListener.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 │ │ ├── header │ │ ├── BezierRadarHeader.java │ │ ├── ClassicsHeader.java │ │ ├── FalsifyHeader.java │ │ └── TwoLevelHeader.java │ │ ├── impl │ │ ├── RefreshContentWrapper.java │ │ ├── RefreshFooterWrapper.java │ │ ├── RefreshHeaderWrapper.java │ │ └── ScrollBoundaryDeciderAdapter.java │ │ ├── internal │ │ ├── ArrowDrawable.java │ │ ├── InternalAbstract.java │ │ ├── InternalClassics.java │ │ ├── PaintDrawable.java │ │ └── ProgressDrawable.java │ │ ├── listener │ │ ├── CoordinatorLayoutListener.java │ │ ├── OnLoadMoreListener.java │ │ ├── OnMultiPurposeListener.java │ │ ├── OnRefreshListener.java │ │ ├── OnRefreshLoadMoreListener.java │ │ ├── OnStateChangedListener.java │ │ └── SimpleMultiPurposeListener.java │ │ └── util │ │ ├── DelayedRunnable.java │ │ ├── DensityUtil.java │ │ ├── DesignUtil.java │ │ ├── ScrollBoundaryUtil.java │ │ ├── SmartUtil.java │ │ └── ViscousFluidInterpolator.java │ └── res │ ├── values-zh │ └── strings.xml │ └── values │ ├── attrs.xml │ └── strings.xml ├── settings.gradle └── versions.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /LocalRepository 4 | /keystores 5 | /local.properties 6 | /.idea 7 | .DS_Store 8 | /build 9 | /captures 10 | .externalNativeBuild -------------------------------------------------------------------------------- /JitPackUpload.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.github.dcendents.android-maven' 2 | 3 | // 指定group,com.github.<用户名>,这里我默认填写的是我的github账号,请换成你自己的。 4 | group='com.github.xuexiangjys' 5 | 6 | //--------------------------------------------- 7 | 8 | 9 | // 指定编码 10 | tasks.withType(JavaCompile) { 11 | options.encoding = "UTF-8" 12 | } 13 | 14 | tasks.withType(Javadoc) { 15 | options.encoding = 'UTF-8' 16 | } 17 | 18 | if (project.hasProperty("android")) { // Android libraries 19 | task sourcesJar(type: Jar) { 20 | classifier = 'sources' 21 | from android.sourceSets.main.java.srcDirs 22 | } 23 | 24 | task javadoc(type: Javadoc) { 25 | failOnError false 26 | source = android.sourceSets.main.java.srcDirs 27 | classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) 28 | } 29 | } else { // Java libraries 30 | task sourcesJar(type: Jar, dependsOn: classes) { 31 | classifier = 'sources' 32 | from sourceSets.main.allSource 33 | } 34 | } 35 | 36 | javadoc { 37 | options { 38 | encoding "UTF-8" 39 | charSet 'UTF-8' 40 | author true 41 | version true 42 | links "http://docs.oracle.com/javase/7/docs/api" 43 | } 44 | } 45 | 46 | // 制作文档(Javadoc) 47 | task javadocJar(type: Jar, dependsOn: javadoc) { 48 | classifier = 'javadoc' 49 | from javadoc.destinationDir 50 | } 51 | 52 | artifacts { 53 | archives javadocJar 54 | archives sourcesJar 55 | } -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion build_versions.target_sdk 5 | buildToolsVersion build_versions.build_tools 6 | 7 | defaultConfig { 8 | applicationId "com.scwang.refreshlayout.app" 9 | minSdkVersion 15 10 | targetSdkVersion build_versions.target_sdk 11 | versionCode 1 12 | versionName "1.0" 13 | vectorDrawables.useSupportLibrary = true 14 | 15 | renderscriptTargetApi 25 16 | renderscriptSupportModeEnabled true // Enable RS support 17 | } 18 | 19 | signingConfigs { 20 | debug { 21 | storeFile file('debug.keystore') 22 | storePassword "android" 23 | keyAlias "androiddebugkey" 24 | keyPassword "android" 25 | } 26 | } 27 | buildTypes { 28 | debug { 29 | signingConfig = signingConfigs.debug 30 | } 31 | release { 32 | minifyEnabled true 33 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 34 | signingConfig = signingConfigs.debug 35 | } 36 | } 37 | lintOptions { 38 | abortOnError false 39 | } 40 | } 41 | 42 | dependencies { 43 | implementation fileTree(include: ['*.jar'], dir: 'libs') 44 | androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', { 45 | exclude group: 'com.android.support', module: 'support-annotations' 46 | }) 47 | 48 | debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.6.2' 49 | releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.2' 50 | testImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.2' 51 | 52 | //下拉刷新 53 | 54 | implementation 'com.github.xuexiangjys.SmartRefreshLayout:refresh-header:1.1.3' 55 | implementation 'com.github.xuexiangjys.SmartRefreshLayout:refresh-layout:1.1.3' 56 | // implementation project(':refresh-header') 57 | // implementation project(':refresh-layout') 58 | implementation deps.support.app_compat 59 | implementation deps.support.recyclerview 60 | implementation deps.support.design 61 | 62 | implementation deps.support.cardview 63 | 64 | implementation 'com.android.support.constraint:constraint-layout:1.1.3' 65 | 66 | implementation 'com.flyco.roundview:FlycoRoundView_Lib:1.1.4@aar' 67 | implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.34' 68 | implementation 'com.github.czy1121:loadinglayout:1.0.1' 69 | implementation 'com.github.mmin18:realtimeblurview:1.0.6' 70 | implementation 'com.google.code.gson:gson:2.8.2' 71 | implementation 'com.wang.avi:library:2.1.3' 72 | implementation 'com.youth.banner:banner:1.4.9' //最新版本 73 | implementation 'de.hdodenhof:circleimageview:2.1.0' 74 | implementation 'jp.wasabeef:recyclerview-animators:2.2.6' 75 | implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.3' 76 | 77 | implementation 'com.github.bumptech.glide:glide:4.8.0' 78 | annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0' 79 | } 80 | -------------------------------------------------------------------------------- /app/debug.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuexiangjys/SmartRefreshLayout/d110c199eb2402ac5002c6b53711fb797d09d2ba/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 | 39 | -keep class com.scwang.refreshlayout.activity.practice.BannerPracticeActivity$Movie {*;} -------------------------------------------------------------------------------- /app/src/main/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuexiangjys/SmartRefreshLayout/d110c199eb2402ac5002c6b53711fb797d09d2ba/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.DefaultRefreshHeaderCreator; 11 | import com.scwang.smartrefresh.layout.api.DefaultRefreshInitializer; 12 | import com.scwang.smartrefresh.layout.api.RefreshHeader; 13 | import com.scwang.smartrefresh.layout.api.RefreshLayout; 14 | import com.scwang.smartrefresh.layout.header.ClassicsHeader; 15 | import com.squareup.leakcanary.LeakCanary; 16 | 17 | /** 18 | * 19 | * Created by SCWANG on 2017/6/11. 20 | */ 21 | 22 | public class App extends Application { 23 | 24 | static { 25 | //启用矢量图兼容 26 | AppCompatDelegate.setCompatVectorFromResourcesEnabled(true); 27 | //设置全局默认配置(优先级最低,会被其他设置覆盖) 28 | SmartRefreshLayout.setDefaultRefreshInitializer(new DefaultRefreshInitializer() { 29 | @Override 30 | public void initialize(@NonNull Context context, @NonNull RefreshLayout layout) { 31 | //全局设置(优先级最低) 32 | layout.setEnableAutoLoadMore(true); 33 | layout.setEnableOverScrollDrag(false); 34 | layout.setEnableOverScrollBounce(true); 35 | layout.setEnableLoadMoreWhenContentNotFull(true); 36 | layout.setEnableScrollContentWhenRefreshed(true); 37 | } 38 | }); 39 | SmartRefreshLayout.setDefaultRefreshHeaderCreator(new DefaultRefreshHeaderCreator() { 40 | @NonNull 41 | @Override 42 | public RefreshHeader createRefreshHeader(@NonNull Context context, @NonNull RefreshLayout layout) { 43 | //全局设置主题颜色(优先级第二低,可以覆盖 DefaultRefreshInitializer 的配置,与下面的ClassicsHeader绑定) 44 | layout.setPrimaryColorsId(R.color.colorPrimary, android.R.color.white); 45 | 46 | return new ClassicsHeader(context).setTimeFormat(new DynamicTimeFormat("更新于 %s")); 47 | } 48 | }); 49 | } 50 | 51 | @Override 52 | public void onCreate() { 53 | super.onCreate(); 54 | if (LeakCanary.isInAnalyzerProcess(this)) { 55 | // This process is dedicated to LeakCanary for heap analysis. 56 | // You should not init your app in this process. 57 | return; 58 | } 59 | LeakCanary.install(this); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /app/src/main/java/com/scwang/refreshlayout/activity/example/AssignCodeExampleActivity.java: -------------------------------------------------------------------------------- 1 | package com.scwang.refreshlayout.activity.example; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.NonNull; 5 | import android.support.v7.app.AppCompatActivity; 6 | import android.support.v7.widget.Toolbar; 7 | import android.view.View; 8 | 9 | import com.scwang.refreshlayout.R; 10 | import com.scwang.smartrefresh.header.MaterialHeader; 11 | import com.scwang.smartrefresh.layout.api.RefreshLayout; 12 | import com.scwang.smartrefresh.layout.constant.RefreshState; 13 | import com.scwang.smartrefresh.layout.constant.SpinnerStyle; 14 | import com.scwang.smartrefresh.layout.footer.BallPulseFooter; 15 | import com.scwang.smartrefresh.layout.listener.SimpleMultiPurposeListener; 16 | 17 | /** 18 | * 在Java代码中指定Header和Footer 19 | */ 20 | public class AssignCodeExampleActivity extends AppCompatActivity { 21 | 22 | private static boolean isFirstEnter = true; 23 | 24 | @Override 25 | protected void onCreate(Bundle savedInstanceState) { 26 | super.onCreate(savedInstanceState); 27 | setContentView(R.layout.activity_example_assign_code); 28 | 29 | final Toolbar toolbar = findViewById(R.id.toolbar); 30 | toolbar.setNavigationOnClickListener(new View.OnClickListener() { 31 | @Override 32 | public void onClick(View v) { 33 | finish(); 34 | } 35 | }); 36 | 37 | 38 | final RefreshLayout refreshLayout = findViewById(R.id.refreshLayout); 39 | //设置 Header 为 Material风格 40 | refreshLayout.setRefreshHeader(new MaterialHeader(this).setShowBezierWave(true)); 41 | //设置 Footer 为 球脉冲 42 | refreshLayout.setRefreshFooter(new BallPulseFooter(this).setSpinnerStyle(SpinnerStyle.Scale)); 43 | 44 | /* 45 | * 以下代码仅仅为了演示效果而已,不是必须的 46 | */ 47 | //设置主题颜色 48 | refreshLayout.setPrimaryColorsId(R.color.colorPrimary, android.R.color.white); 49 | 50 | if (isFirstEnter) { 51 | isFirstEnter = false; 52 | // //触发上拉加载 53 | // refreshLayout.autoLoadMore(250, 250, 1.5f); 54 | //通过多功能监听接口实现 在第一次加载完成之后 自动刷新 55 | refreshLayout.setOnMultiPurposeListener(new SimpleMultiPurposeListener(){ 56 | @Override 57 | public void onStateChanged(@NonNull RefreshLayout refreshLayout, @NonNull RefreshState oldState, @NonNull RefreshState newState) { 58 | if (oldState == RefreshState.LoadFinish && newState == RefreshState.None) { 59 | refreshLayout.autoRefresh(); 60 | refreshLayout.setOnMultiPurposeListener(null); 61 | } 62 | } 63 | @Override 64 | public void onLoadMore(@NonNull RefreshLayout refreshLayout) { 65 | refreshLayout.finishLoadMore(2000); 66 | } 67 | @Override 68 | public void onRefresh(@NonNull RefreshLayout refreshLayout) { 69 | refreshLayout.finishRefresh(3000); 70 | } 71 | }); 72 | } 73 | } 74 | 75 | } 76 | -------------------------------------------------------------------------------- /app/src/main/java/com/scwang/refreshlayout/activity/example/AssignXmlExampleActivity.java: -------------------------------------------------------------------------------- 1 | package com.scwang.refreshlayout.activity.example; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.NonNull; 5 | import android.support.v7.app.AppCompatActivity; 6 | import android.support.v7.widget.Toolbar; 7 | import android.view.View; 8 | 9 | import com.scwang.refreshlayout.R; 10 | import com.scwang.smartrefresh.layout.api.RefreshLayout; 11 | import com.scwang.smartrefresh.layout.constant.RefreshState; 12 | import com.scwang.smartrefresh.layout.listener.SimpleMultiPurposeListener; 13 | 14 | /** 15 | * 在XML中指定Header和Footer 16 | */ 17 | public class AssignXmlExampleActivity extends AppCompatActivity { 18 | 19 | private static boolean isFirstEnter = true; 20 | 21 | @Override 22 | protected void onCreate(Bundle savedInstanceState) { 23 | super.onCreate(savedInstanceState); 24 | setContentView(R.layout.activity_example_assign_xml); 25 | 26 | final Toolbar toolbar = findViewById(R.id.toolbar); 27 | toolbar.setNavigationOnClickListener(new View.OnClickListener() { 28 | @Override 29 | public void onClick(View v) { 30 | finish(); 31 | } 32 | }); 33 | 34 | /* 35 | * 以下代码仅仅为了演示效果而已,不是必须的 36 | * 关键代码在 activity_example_assign_xml 中 37 | */ 38 | final RefreshLayout refreshLayout = findViewById(R.id.refreshLayout); 39 | if (isFirstEnter) { 40 | isFirstEnter = false; 41 | // //触发上拉加载 42 | // refreshLayout.autoLoadMore(250, 250, 1.5f); 43 | //通过多功能监听接口实现 在第一次加载完成之后 自动刷新 44 | refreshLayout.setOnMultiPurposeListener(new SimpleMultiPurposeListener(){ 45 | @Override 46 | public void onStateChanged(@NonNull RefreshLayout refreshLayout, @NonNull RefreshState oldState, @NonNull RefreshState newState) { 47 | if (oldState == RefreshState.LoadFinish && newState == RefreshState.None) { 48 | refreshLayout.autoRefresh(); 49 | refreshLayout.setOnMultiPurposeListener(null); 50 | } 51 | } 52 | @Override 53 | public void onLoadMore(@NonNull RefreshLayout refreshLayout) { 54 | refreshLayout.finishLoadMore(2000); 55 | } 56 | @Override 57 | public void onRefresh(@NonNull RefreshLayout refreshLayout) { 58 | refreshLayout.finishRefresh(3000); 59 | } 60 | }); 61 | } 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /app/src/main/java/com/scwang/refreshlayout/activity/example/OverScrollExampleActivity.java: -------------------------------------------------------------------------------- 1 | package com.scwang.refreshlayout.activity.example; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.NonNull; 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.smartrefresh.layout.api.RefreshLayout; 13 | import com.scwang.smartrefresh.layout.listener.OnRefreshListener; 14 | 15 | /** 16 | * 越界回弹使用演示 17 | */ 18 | public class OverScrollExampleActivity extends AppCompatActivity { 19 | 20 | @Override 21 | protected void onCreate(Bundle savedInstanceState) { 22 | super.onCreate(savedInstanceState); 23 | setContentView(R.layout.activity_example_overscroll); 24 | 25 | final 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 | final WebView webView = findViewById(R.id.webView); 34 | final RefreshLayout refreshLayout = findViewById(R.id.refreshLayout); 35 | refreshLayout.setOnRefreshListener(new OnRefreshListener() { 36 | @Override 37 | public void onRefresh(@NonNull RefreshLayout refreshLayout) { 38 | webView.loadUrl("http://github.com"); 39 | } 40 | }); 41 | refreshLayout.autoRefresh(); 42 | 43 | 44 | webView.setWebViewClient(new WebViewClient(){ 45 | @Override 46 | public boolean shouldOverrideUrlLoading(WebView view, String url) { 47 | view.loadUrl(url); 48 | return true; 49 | } 50 | @Override 51 | public void onPageCommitVisible(WebView view, String url) { 52 | refreshLayout.finishRefresh(); 53 | } 54 | }); 55 | // TextView textView = findViewById(R.id.textView); 56 | // textView.setMovementMethod(new ScrollingMovementMethod()); 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /app/src/main/java/com/scwang/refreshlayout/activity/example/SnapHelperExampleActivity.java: -------------------------------------------------------------------------------- 1 | package com.scwang.refreshlayout.activity.example; 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 SnapHelperExampleActivity extends AppCompatActivity { 26 | 27 | @Override 28 | protected void onCreate(Bundle savedInstanceState) { 29 | super.onCreate(savedInstanceState); 30 | setContentView(R.layout.activity_example_snaphelper); 31 | 32 | final 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.item_example_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/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 = 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 = 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 = 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 = 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 = findViewById(R.id.loading); 36 | 37 | final 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.annotation.NonNull; 6 | import android.support.v7.app.AppCompatActivity; 7 | import android.support.v7.widget.Toolbar; 8 | import android.view.View; 9 | import android.webkit.WebView; 10 | import android.webkit.WebViewClient; 11 | 12 | import com.scwang.refreshlayout.R; 13 | import com.scwang.refreshlayout.util.StatusBarUtil; 14 | import com.scwang.smartrefresh.layout.api.RefreshLayout; 15 | import com.scwang.smartrefresh.layout.listener.OnRefreshListener; 16 | import com.scwang.smartrefresh.layout.util.DensityUtil; 17 | 18 | import java.util.Locale; 19 | 20 | /** 21 | * 网页-Github 22 | */ 23 | public class WebViewPracticeActivity extends AppCompatActivity { 24 | 25 | @SuppressLint("SetJavaScriptEnabled") 26 | @Override 27 | protected void onCreate(Bundle savedInstanceState) { 28 | super.onCreate(savedInstanceState); 29 | setContentView(R.layout.activity_practice_webview); 30 | 31 | final Toolbar toolbar = findViewById(R.id.toolbar); 32 | toolbar.setNavigationOnClickListener(new View.OnClickListener() { 33 | @Override 34 | public void onClick(View v) { 35 | finish(); 36 | } 37 | }); 38 | 39 | final WebView webView = findViewById(R.id.webView); 40 | final RefreshLayout refreshLayout = findViewById(R.id.refreshLayout); 41 | refreshLayout.setOnRefreshListener(new OnRefreshListener() { 42 | @Override 43 | public void onRefresh(@NonNull RefreshLayout refreshLayout) { 44 | webView.loadUrl("https://github.com/scwang90/SmartRefreshLayout"); 45 | } 46 | }); 47 | refreshLayout.autoRefresh(); 48 | 49 | 50 | webView.getSettings().setJavaScriptEnabled(true); 51 | webView.setWebViewClient(new WebViewClient(){ 52 | @Override 53 | public boolean shouldOverrideUrlLoading(WebView view, String url) { 54 | view.loadUrl(url); 55 | return true; 56 | } 57 | 58 | @Override 59 | public void onPageFinished(WebView view, String url) { 60 | super.onPageFinished(view, url); 61 | refreshLayout.finishRefresh(); 62 | view.loadUrl(String.format(Locale.CHINA, "javascript:document.body.style.paddingTop='%fpx'; void 0", DensityUtil.px2dp(webView.getPaddingTop()))); 63 | } 64 | }); 65 | 66 | //状态栏透明和间距处理 67 | StatusBarUtil.immersive(this); 68 | StatusBarUtil.setPaddingSmart(this, webView); 69 | StatusBarUtil.setPaddingSmart(this, toolbar); 70 | StatusBarUtil.setMargin(this, findViewById(R.id.header)); 71 | StatusBarUtil.setPaddingSmart(this, findViewById(R.id.blurView)); 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /app/src/main/java/com/scwang/refreshlayout/adapter/SmartViewHolder.java: -------------------------------------------------------------------------------- 1 | package com.scwang.refreshlayout.adapter; 2 | 3 | import android.content.res.Resources; 4 | import android.support.annotation.StringRes; 5 | import android.support.v4.content.ContextCompat; 6 | import android.support.v7.widget.RecyclerView; 7 | import android.util.TypedValue; 8 | import android.view.View; 9 | import android.widget.AdapterView; 10 | import android.widget.ImageView; 11 | import android.widget.TextView; 12 | 13 | public class SmartViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { 14 | 15 | private final AdapterView.OnItemClickListener mListener; 16 | private int mPosition = -1; 17 | 18 | public SmartViewHolder(View itemView, AdapterView.OnItemClickListener mListener) { 19 | super(itemView); 20 | this.mListener = mListener; 21 | itemView.setOnClickListener(this); 22 | 23 | /* 24 | * 设置水波纹背景 25 | */ 26 | if (itemView.getBackground() == null) { 27 | TypedValue typedValue = new TypedValue(); 28 | Resources.Theme theme = itemView.getContext().getTheme(); 29 | int top = itemView.getPaddingTop(); 30 | int bottom = itemView.getPaddingBottom(); 31 | int left = itemView.getPaddingLeft(); 32 | int right = itemView.getPaddingRight(); 33 | if (theme.resolveAttribute(android.R.attr.selectableItemBackground, typedValue, true)) { 34 | itemView.setBackgroundResource(typedValue.resourceId); 35 | } 36 | itemView.setPadding(left, top, right, bottom); 37 | } 38 | } 39 | 40 | public void setPosition(int position) { 41 | mPosition = position; 42 | } 43 | 44 | @Override 45 | public void onClick(View v) { 46 | if (mListener != null) { 47 | int position = getAdapterPosition(); 48 | if(position >= 0){ 49 | mListener.onItemClick(null, v, position, getItemId()); 50 | } else if (mPosition > -1) { 51 | mListener.onItemClick(null, v, mPosition, getItemId()); 52 | } 53 | } 54 | } 55 | 56 | private View findViewById(int id) { 57 | return id == 0 ? itemView : itemView.findViewById(id); 58 | } 59 | 60 | public SmartViewHolder text(int id, CharSequence sequence) { 61 | View view = findViewById(id); 62 | if (view instanceof TextView) { 63 | ((TextView) view).setText(sequence); 64 | } 65 | return this; 66 | } 67 | 68 | public SmartViewHolder text(int id,@StringRes int stringRes) { 69 | View view = findViewById(id); 70 | if (view instanceof TextView) { 71 | ((TextView) view).setText(stringRes); 72 | } 73 | return this; 74 | } 75 | 76 | public SmartViewHolder textColorId(int id, int colorId) { 77 | View view = findViewById(id); 78 | if (view instanceof TextView) { 79 | ((TextView) view).setTextColor(ContextCompat.getColor(view.getContext(), colorId)); 80 | } 81 | return this; 82 | } 83 | 84 | public SmartViewHolder image(int id, int imageId) { 85 | View view = findViewById(id); 86 | if (view instanceof ImageView) { 87 | ((ImageView) view).setImageResource(imageId); 88 | } 89 | return this; 90 | } 91 | } -------------------------------------------------------------------------------- /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.smartrefresh.layout.api.OnTwoLevelListener; 16 | import com.scwang.smartrefresh.layout.api.RefreshLayout; 17 | import com.scwang.smartrefresh.layout.header.TwoLevelHeader; 18 | import com.scwang.smartrefresh.layout.listener.OnRefreshListener; 19 | 20 | /** 21 | * 二级刷新 22 | * Created by SCWANG on 2018/1/7. 23 | */ 24 | 25 | public class TwoLevelPracticeFragment extends Fragment { 26 | 27 | @Override 28 | public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 29 | return inflater.inflate(R.layout.fragment_practice_twolevel, container, false); 30 | } 31 | 32 | @Override 33 | public void onViewCreated(@NonNull final View root, @Nullable Bundle savedInstanceState) { 34 | super.onViewCreated(root, savedInstanceState); 35 | 36 | final Toolbar toolbar = root.findViewById(R.id.toolbar); 37 | final TwoLevelHeader header = root.findViewById(R.id.header); 38 | toolbar.setNavigationOnClickListener(new View.OnClickListener() { 39 | @Override 40 | public void onClick(View v) { 41 | getActivity().finish(); 42 | } 43 | }); 44 | 45 | final RefreshLayout refreshLayout = root.findViewById(R.id.refreshLayout); 46 | 47 | header.setOnTwoLevelListener(new OnTwoLevelListener() { 48 | @Override 49 | public boolean onTwoLevel(@NonNull RefreshLayout refreshLayout) { 50 | Toast.makeText(getContext(),"触发二楼事件",Toast.LENGTH_SHORT).show(); 51 | refreshLayout.getLayout().postDelayed(new Runnable() { 52 | @Override 53 | public void run() { 54 | header.finishTwoLevel(); 55 | } 56 | },5000); 57 | return true;//true 将会展开二楼状态 false 关闭刷新 58 | } 59 | }); 60 | 61 | refreshLayout.setOnRefreshListener(new OnRefreshListener() { 62 | @Override 63 | public void onRefresh(@NonNull RefreshLayout refreshLayout) { 64 | Toast.makeText(getContext(),"触发刷新事件",Toast.LENGTH_SHORT).show(); 65 | refreshLayout.finishRefresh(2000); 66 | } 67 | }); 68 | 69 | //状态栏透明和间距处理 70 | StatusBarUtil.immersive(getActivity()); 71 | StatusBarUtil.setPaddingSmart(getActivity(), root.findViewById(R.id.toolbar)); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /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_puzzle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_example_assign_code.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 | 20 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_example_assign_default.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 | 19 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_example_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_example_basic.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 | 21 | 28 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_example_custom.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 | 19 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_example_listener.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 | 21 | 25 | 28 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_example_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_example_region.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 | 21 | 22 | 27 | 35 | 40 | 44 | 48 | 49 | 50 | 51 | 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_example_snaphelper.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 18 | 24 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_experiment.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 13 | 18 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /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 | 43 | 44 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /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 | 21 | 34 | 41 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /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_phoenix.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 15 | 16 | 23 | 24 | 31 | 32 | 33 | 34 | 35 | 44 | 47 | 53 | 54 | 55 | 65 | 66 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_style_storehouse.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 | 24 | 30 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_style_taurus.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 15 | 16 | 23 | 24 | 31 | 32 | 33 | 34 | 35 | 44 | 47 | 53 | 54 | 55 | 65 | 66 | -------------------------------------------------------------------------------- /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_swipe.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 | 24 | 27 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /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_example_bottom_sheet.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 13 | 14 | 20 | 21 | 22 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_example_emptylayout.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 13 | 14 | 18 | 23 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_example_emptylayout_inner.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 13 | 14 | 18 | 21 | 28 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_example_emptylayout_outer.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 13 | 14 | 17 | 21 | 28 | 29 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_example_nestedscroll.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 15 | 16 | 23 | 24 | 31 | 32 | 33 | 34 | 35 | 44 | 47 | 53 | 54 | 55 | 65 | 66 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_example_purescroll.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 13 | 14 | 19 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_example_purescroll_header.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 13 | 14 | 20 | 23 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_example_viewpager.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 13 | 14 | 21 | 26 | 31 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /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_example.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 12 | 13 | 22 | 29 | 35 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /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/item_example_snaphelper.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 21 | 22 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_movie_banner.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 13 | 14 | 26 | 27 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_movie_header.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_movie_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 17 | 18 | 22 | 27 | 33 | 38 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_practice_repast.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 17 | 18 | 24 | 25 | 30 | 31 | 38 | 39 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_style_delivery.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 17 | 18 | 24 | 25 | 29 | 34 | 39 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /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/xuexiangjys/SmartRefreshLayout/d110c199eb2402ac5002c6b53711fb797d09d2ba/app/src/main/res/mipmap-hdpi/gif_header_repast.gif -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_item1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuexiangjys/SmartRefreshLayout/d110c199eb2402ac5002c6b53711fb797d09d2ba/app/src/main/res/mipmap-hdpi/ic_item1.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_item2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuexiangjys/SmartRefreshLayout/d110c199eb2402ac5002c6b53711fb797d09d2ba/app/src/main/res/mipmap-hdpi/ic_item2.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_item3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuexiangjys/SmartRefreshLayout/d110c199eb2402ac5002c6b53711fb797d09d2ba/app/src/main/res/mipmap-hdpi/ic_item3.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuexiangjys/SmartRefreshLayout/d110c199eb2402ac5002c6b53711fb797d09d2ba/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuexiangjys/SmartRefreshLayout/d110c199eb2402ac5002c6b53711fb797d09d2ba/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/image_avatar_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuexiangjys/SmartRefreshLayout/d110c199eb2402ac5002c6b53711fb797d09d2ba/app/src/main/res/mipmap-hdpi/image_avatar_1.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/image_avatar_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuexiangjys/SmartRefreshLayout/d110c199eb2402ac5002c6b53711fb797d09d2ba/app/src/main/res/mipmap-hdpi/image_avatar_2.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/image_avatar_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuexiangjys/SmartRefreshLayout/d110c199eb2402ac5002c6b53711fb797d09d2ba/app/src/main/res/mipmap-hdpi/image_avatar_3.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/image_avatar_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuexiangjys/SmartRefreshLayout/d110c199eb2402ac5002c6b53711fb797d09d2ba/app/src/main/res/mipmap-hdpi/image_avatar_4.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/image_avatar_5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuexiangjys/SmartRefreshLayout/d110c199eb2402ac5002c6b53711fb797d09d2ba/app/src/main/res/mipmap-hdpi/image_avatar_5.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/image_avatar_6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuexiangjys/SmartRefreshLayout/d110c199eb2402ac5002c6b53711fb797d09d2ba/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/xuexiangjys/SmartRefreshLayout/d110c199eb2402ac5002c6b53711fb797d09d2ba/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/xuexiangjys/SmartRefreshLayout/d110c199eb2402ac5002c6b53711fb797d09d2ba/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/xuexiangjys/SmartRefreshLayout/d110c199eb2402ac5002c6b53711fb797d09d2ba/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/xuexiangjys/SmartRefreshLayout/d110c199eb2402ac5002c6b53711fb797d09d2ba/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/xuexiangjys/SmartRefreshLayout/d110c199eb2402ac5002c6b53711fb797d09d2ba/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/xuexiangjys/SmartRefreshLayout/d110c199eb2402ac5002c6b53711fb797d09d2ba/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/xuexiangjys/SmartRefreshLayout/d110c199eb2402ac5002c6b53711fb797d09d2ba/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/xuexiangjys/SmartRefreshLayout/d110c199eb2402ac5002c6b53711fb797d09d2ba/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/xuexiangjys/SmartRefreshLayout/d110c199eb2402ac5002c6b53711fb797d09d2ba/app/src/main/res/mipmap-hdpi/image_practice_repast_6.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuexiangjys/SmartRefreshLayout/d110c199eb2402ac5002c6b53711fb797d09d2ba/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuexiangjys/SmartRefreshLayout/d110c199eb2402ac5002c6b53711fb797d09d2ba/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/image_secondfloor.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuexiangjys/SmartRefreshLayout/d110c199eb2402ac5002c6b53711fb797d09d2ba/app/src/main/res/mipmap-mdpi/image_secondfloor.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/image_secondfloor_content.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuexiangjys/SmartRefreshLayout/d110c199eb2402ac5002c6b53711fb797d09d2ba/app/src/main/res/mipmap-mdpi/image_secondfloor_content.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/image_taobao.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuexiangjys/SmartRefreshLayout/d110c199eb2402ac5002c6b53711fb797d09d2ba/app/src/main/res/mipmap-mdpi/image_taobao.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/image_weibo_home_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuexiangjys/SmartRefreshLayout/d110c199eb2402ac5002c6b53711fb797d09d2ba/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/xuexiangjys/SmartRefreshLayout/d110c199eb2402ac5002c6b53711fb797d09d2ba/app/src/main/res/mipmap-mdpi/image_weibo_home_2.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuexiangjys/SmartRefreshLayout/d110c199eb2402ac5002c6b53711fb797d09d2ba/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuexiangjys/SmartRefreshLayout/d110c199eb2402ac5002c6b53711fb797d09d2ba/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuexiangjys/SmartRefreshLayout/d110c199eb2402ac5002c6b53711fb797d09d2ba/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuexiangjys/SmartRefreshLayout/d110c199eb2402ac5002c6b53711fb797d09d2ba/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuexiangjys/SmartRefreshLayout/d110c199eb2402ac5002c6b53711fb797d09d2ba/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuexiangjys/SmartRefreshLayout/d110c199eb2402ac5002c6b53711fb797d09d2ba/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-zh/arrays.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 22,0,0,30, 6 | 22,0,30,0, 7 | 30,0,52,30, 8 | 0,30,26,30, 9 | 60,0,60,15, 10 | 60,15,60,30, 11 | 60,15,85,15, 12 | 85,15,108,0, 13 | 85,15,108,30, 14 | 117,0,147,0, 15 | 147,0,177,0, 16 | 147,0,147,32, 17 | 198,0,176,30, 18 | 198,0,206,0, 19 | 206,0,228,30, 20 | 176,30,202,30, 21 | 22 | 23 | 24 | 0,35,12,42, 25 | 12,42,24,35, 26 | 24,35,12,28, 27 | 0,35,12,28, 28 | 0,21,12,28, 29 | 12,28,24,21, 30 | 24,35,24,21, 31 | 24,21,12,14, 32 | 0,21,12,14, 33 | 0,21,0,7, 34 | 12,14,0,7, 35 | 12,14,24,7, 36 | 24,7,12,0, 37 | 0,7,12,0, 38 | 39 | 40 | -------------------------------------------------------------------------------- /app/src/main/res/values-zh/strings_srl.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | \@下拉刷新 4 | \@正在刷新… 5 | \@正在加载… 6 | \@释放刷新 7 | \@刷新完成 8 | \@刷新失败 9 | \@上次更新 M-d HH:mm 10 | \@进入二楼 11 | 12 | \@上拉加载 13 | \@释放加载 14 | \@正在加载… 15 | \@正在刷新… 16 | \@加载完成 17 | \@加载失败 18 | \@没有更多数据了 19 | 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/res/values/arrays.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 22,0,0,30, 6 | 22,0,30,0, 7 | 30,0,52,30, 8 | 0,30,26,30, 9 | 60,0,60,15, 10 | 60,15,60,30, 11 | 60,15,85,15, 12 | 85,15,108,0, 13 | 85,15,108,30, 14 | 117,0,147,0, 15 | 147,0,177,0, 16 | 147,0,147,32, 17 | 198,0,176,30, 18 | 198,0,206,0, 19 | 206,0,228,30, 20 | 176,30,202,30, 21 | 22 | 23 | 24 | 0,35,12,42, 25 | 12,42,24,35, 26 | 24,35,12,28, 27 | 0,35,12,28, 28 | 0,21,12,28, 29 | 12,28,24,21, 30 | 24,35,24,21, 31 | 24,21,12,14, 32 | 0,21,12,14, 33 | 0,21,0,7, 34 | 12,14,0,7, 35 | 12,14,24,7, 36 | 24,7,12,0, 37 | 0,7,12,0, 38 | 39 | 40 | -------------------------------------------------------------------------------- /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/main/res/values/strings_srl.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | \@Pull Down To Refresh 4 | \@Refreshing… 5 | \@Wait For Loading… 6 | \@Release To Refresh 7 | \@Refresh Finished 8 | \@Refresh Failed 9 | \@\'Last Update\' M-d HH:mm 10 | \@Release To Second Floor 11 | 12 | \@Pull Up To Load More 13 | \@Release To Load More 14 | \@Loading… 15 | \@Wait For Refreshing… 16 | \@Load More Finished 17 | \@Load More Failed 18 | \@No More Data 19 | 20 | 21 | -------------------------------------------------------------------------------- /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 | apply from: './versions.gradle' 5 | addRepos(repositories) //增加代码仓库 6 | 7 | dependencies { 8 | classpath deps.android_gradle_plugin 9 | classpath deps.android_maven_gradle_plugin 10 | 11 | // NOTE: Do not place your application dependencies here; they belong 12 | // in the individual module build.gradle files 13 | } 14 | } 15 | 16 | allprojects { 17 | addRepos(repositories) 18 | } 19 | 20 | task clean(type: Delete) { 21 | delete rootProject.buildDir 22 | } 23 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuexiangjys/SmartRefreshLayout/d110c199eb2402ac5002c6b53711fb797d09d2ba/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Oct 30 09:54:23 CST 2018 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip 7 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /method-count-layout.bat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuexiangjys/SmartRefreshLayout/d110c199eb2402ac5002c6b53711fb797d09d2ba/method-count-layout.bat -------------------------------------------------------------------------------- /refresh-header/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /refresh-header/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion build_versions.target_sdk 5 | buildToolsVersion build_versions.build_tools 6 | 7 | defaultConfig { 8 | minSdkVersion 12 9 | targetSdkVersion build_versions.target_sdk 10 | } 11 | lintOptions { 12 | abortOnError false 13 | } 14 | } 15 | 16 | dependencies { 17 | compileOnly deps.support.app_compat 18 | compileOnly project(':refresh-layout') 19 | } 20 | 21 | apply from: '../JitPackUpload.gradle' 22 | -------------------------------------------------------------------------------- /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/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.header.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 | this(context, null); 17 | } 18 | 19 | public FlyView(Context context, AttributeSet attrs) { 20 | super(context, attrs); 21 | super.parserColors(0xffffffff); 22 | if (!mPathsDrawable.parserPaths("M2.01,21L23,12 2.01,3 2,10l15,2 -15,2z")) { 23 | mPathsDrawable.declareOriginal(2, 3, 20, 18); 24 | } 25 | int side = DensityUtil.dp2px(25); 26 | mPathsDrawable.setBounds(0, 0, side, side); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /refresh-header/src/main/java/com/scwang/smartrefresh/header/internal/pathview/PathsView.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smartrefresh.header.internal.pathview; 2 | 3 | import android.content.Context; 4 | import android.graphics.Canvas; 5 | import android.graphics.drawable.Drawable; 6 | import android.util.AttributeSet; 7 | import android.view.View; 8 | 9 | /** 10 | * 路径视图 11 | * Created by SCWANG on 2017/5/29. 12 | */ 13 | public class PathsView extends View { 14 | 15 | protected PathsDrawable mPathsDrawable = new PathsDrawable(); 16 | 17 | public PathsView(Context context) { 18 | this(context, null); 19 | } 20 | 21 | public PathsView(Context context, AttributeSet attrs) { 22 | super(context, attrs); 23 | mPathsDrawable = new PathsDrawable(); 24 | } 25 | 26 | @Override 27 | protected void onFinishInflate() { 28 | super.onFinishInflate(); 29 | final View thisView = this; 30 | if (thisView.getTag() instanceof String) { 31 | parserPaths(thisView.getTag().toString()); 32 | } 33 | } 34 | 35 | @Override 36 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 37 | final View thisView = this; 38 | final Drawable drawable = mPathsDrawable; 39 | super.setMeasuredDimension( 40 | View.resolveSize(drawable.getBounds().width()+thisView.getPaddingLeft()+thisView.getPaddingRight(), widthMeasureSpec), 41 | View.resolveSize(drawable.getBounds().height()+thisView.getPaddingTop()+thisView.getPaddingBottom(), heightMeasureSpec)); 42 | } 43 | 44 | @Override 45 | protected void onLayout(boolean changed, int left, int top, int right, int bottom) { 46 | final View thisView = this; 47 | super.onLayout(changed, left, top, right, bottom); 48 | mPathsDrawable.setBounds(thisView.getPaddingLeft(), thisView.getPaddingTop(), 49 | Math.max((right - left) - thisView.getPaddingRight(), thisView.getPaddingLeft()), 50 | Math.max((bottom - top) - thisView.getPaddingTop(), thisView.getPaddingTop())); 51 | } 52 | 53 | @Override 54 | protected void onDraw(Canvas canvas) { 55 | mPathsDrawable.draw(canvas); 56 | } 57 | 58 | public boolean parserPaths(String... paths) { 59 | return mPathsDrawable.parserPaths(paths); 60 | } 61 | 62 | public void parserColors(int... colors) { 63 | mPathsDrawable.parserColors(colors); 64 | } 65 | 66 | 67 | } 68 | -------------------------------------------------------------------------------- /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 | protected final Paint mPaint = new Paint(); 22 | protected float mFromAlpha = 1.0f; 23 | protected float mToAlpha = 0.4f; 24 | protected PointF mCStartPoint; 25 | protected 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 | translationX = -random.nextInt(horizontalRandomness) + horizontalRandomness; 52 | } 53 | 54 | @Override 55 | protected void applyTransformation(float interpolatedTime, Transformation t) { 56 | float alpha = mFromAlpha; 57 | alpha = alpha + ((mToAlpha - alpha) * interpolatedTime); 58 | setAlpha(alpha); 59 | } 60 | 61 | public void start(float fromAlpha, float toAlpha) { 62 | mFromAlpha = fromAlpha; 63 | mToAlpha = toAlpha; 64 | super.start(); 65 | } 66 | 67 | public void setAlpha(float alpha) { 68 | mPaint.setAlpha((int) (alpha * 255)); 69 | } 70 | 71 | public void draw(Canvas canvas) { 72 | canvas.drawLine(mCStartPoint.x, mCStartPoint.y, mCEndPoint.x, mCEndPoint.y, mPaint); 73 | } 74 | } -------------------------------------------------------------------------------- /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/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.view.animation.Interpolator; 19 | 20 | /** 21 | * @author amyu 22 | * 23 | * {@link WaveView#mDropBounceHorizontalAnimator} と {@link WaveView#mDropVertexAnimator} にセットするInterpolator 24 | * WavePullToRefresh/DropBounceInterpolator.gcxにグラフの詳細 25 | */ 26 | public class DropBounceInterpolator implements Interpolator { 27 | 28 | /** 29 | * {@inheritDoc} 30 | * @param v 动画帧 31 | * @return 加速值 32 | */ 33 | @Override 34 | public float getInterpolation(float v) { 35 | //y = -19 * (x - 0.125)^2 + 1.3 (0 <= x < 0.25) 36 | //y = -6.5 * (x - 0.625)^2 + 1.1 (0.5 <= x < 0.75) 37 | //y = 0 (0.25 <= x < 0.5 && 0.75 <= x <=1) 38 | 39 | if (v < 0.25f) { 40 | return -38.4f * (float) Math.pow(v - 0.125, 2) + 0.6f; 41 | } else if (v >= 0.5 && v < 0.75) { 42 | return -19.2f * (float) Math.pow(v - 0.625, 2) + 0.3f; 43 | } else { 44 | return 0; 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /refresh-header/src/main/res/values-zh/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 下拉开始游戏! 3 | 释放立刻开始! 4 | 上下滑动控制游戏 5 | 6 | 游戏结束 7 | 玩个游戏解解闷 8 | 刷新完成 9 | 刷新失败 10 | 11 | 12 | -------------------------------------------------------------------------------- /refresh-header/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Pull To Break Out! 3 | Release To Break Out! 4 | Scroll to move handle 5 | 6 | Game Over 7 | Refreshing… 8 | Refreshing Finished 9 | Refreshing Failed 10 | 11 | 12 | -------------------------------------------------------------------------------- /refresh-layout/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /refresh-layout/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion build_versions.target_sdk 5 | buildToolsVersion build_versions.build_tools 6 | 7 | defaultConfig { 8 | minSdkVersion 14 9 | targetSdkVersion build_versions.target_sdk 10 | } 11 | lintOptions { 12 | abortOnError false 13 | } 14 | } 15 | 16 | dependencies { 17 | compileOnly deps.support.app_compat 18 | compileOnly deps.support.recyclerview 19 | compileOnly deps.support.design 20 | } 21 | 22 | apply from: '../JitPackUpload.gradle' 23 | -------------------------------------------------------------------------------- /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/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /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/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/DefaultRefreshInitializer.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smartrefresh.layout.api; 2 | 3 | import android.content.Context; 4 | import android.support.annotation.NonNull; 5 | 6 | /** 7 | * 默认全局初始化器 8 | * Created by Administrator on 2018/5/29 0029. 9 | */ 10 | 11 | public interface DefaultRefreshInitializer { 12 | void initialize(@NonNull Context context, @NonNull RefreshLayout layout); 13 | } 14 | -------------------------------------------------------------------------------- /refresh-layout/src/main/java/com/scwang/smartrefresh/layout/api/OnTwoLevelListener.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smartrefresh.layout.api; 2 | 3 | import android.support.annotation.NonNull; 4 | 5 | /** 6 | * 二级刷新监听器 7 | */ 8 | public interface OnTwoLevelListener { 9 | /** 10 | * 二级刷新触发 11 | * @param refreshLayout 刷新布局 12 | * @return true 将会展开二楼状态 false 关闭刷新 13 | */ 14 | boolean onTwoLevel(@NonNull RefreshLayout refreshLayout); 15 | } -------------------------------------------------------------------------------- /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.NonNull; 5 | import android.view.MotionEvent; 6 | import android.view.View; 7 | 8 | /** 9 | * 刷新内容组件 10 | * Created by SCWANG on 2017/5/26. 11 | */ 12 | public interface RefreshContent { 13 | 14 | @NonNull 15 | View getView(); 16 | @NonNull 17 | View getScrollableView(); 18 | 19 | void onActionDown(MotionEvent e); 20 | 21 | void setUpComponent(RefreshKernel kernel, View fixedHeader, View fixedFooter); 22 | void setScrollBoundaryDecider(ScrollBoundaryDecider boundary); 23 | 24 | void setEnableLoadMoreWhenContentNotFull(boolean enable); 25 | 26 | void moveSpinner(int spinner, int headerTranslationViewId, int footerTranslationViewId); 27 | 28 | boolean canRefresh(); 29 | boolean canLoadMore(); 30 | 31 | AnimatorUpdateListener scrollContentWhenFinished(int spinner); 32 | } 33 | -------------------------------------------------------------------------------- /refresh-layout/src/main/java/com/scwang/smartrefresh/layout/api/RefreshFooter.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smartrefresh.layout.api; 2 | 3 | /** 4 | * 刷新底部 5 | * Created by SCWANG on 2017/5/26. 6 | */ 7 | public interface RefreshFooter extends RefreshInternal { 8 | 9 | /** 10 | * 设置数据全部加载完成,将不能再次触发加载功能 11 | * @param noMoreData 是否有更多数据 12 | * @return true 支持全部加载完成的状态显示 false 不支持 13 | */ 14 | boolean setNoMoreData(boolean noMoreData); 15 | } 16 | -------------------------------------------------------------------------------- /refresh-layout/src/main/java/com/scwang/smartrefresh/layout/api/RefreshHeader.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smartrefresh.layout.api; 2 | 3 | /** 4 | * 刷新头部 5 | * Created by SCWANG on 2017/5/26. 6 | */ 7 | public interface RefreshHeader extends RefreshInternal { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /refresh-layout/src/main/java/com/scwang/smartrefresh/layout/api/RefreshKernel.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smartrefresh.layout.api; 2 | 3 | import android.animation.ValueAnimator; 4 | import android.support.annotation.NonNull; 5 | 6 | import com.scwang.smartrefresh.layout.constant.RefreshState; 7 | 8 | /** 9 | * 刷新布局核心功能接口 10 | * 为功能复杂的 Header 或者 Footer 开放的接口 11 | * Created by SCWANG on 2017/5/26. 12 | */ 13 | 14 | @SuppressWarnings({"unused", "UnusedReturnValue", "SameParameterValue"}) 15 | public interface RefreshKernel { 16 | 17 | @NonNull 18 | RefreshLayout getRefreshLayout(); 19 | @NonNull 20 | RefreshContent getRefreshContent(); 21 | 22 | RefreshKernel setState(@NonNull RefreshState state); 23 | 24 | // 25 | 26 | /** 27 | * 开始执行二极刷新 28 | * @param open 是否展开 29 | * @return RefreshKernel 30 | */ 31 | RefreshKernel startTwoLevel(boolean open); 32 | 33 | /** 34 | * 结束关闭二极刷新 35 | * @return RefreshKernel 36 | */ 37 | RefreshKernel finishTwoLevel(); 38 | 39 | /** 40 | * 移动视图到指定位置 41 | * moveSpinner 的取名来自 谷歌官方的 {@link android.support.v4.widget.SwipeRefreshLayout} 42 | * @param spinner 位置 (px) 43 | * @param isDragging true 手指正在拖动 false 回弹动画执行 44 | * @return RefreshKernel 45 | */ 46 | RefreshKernel moveSpinner(int spinner, boolean isDragging); 47 | 48 | /** 49 | * 执行动画使视图位移到指定的 位置 50 | * moveSpinner 的取名来自 谷歌官方的 {@link android.support.v4.widget.SwipeRefreshLayout} 51 | * @param endSpinner 指定的结束位置 (px) 52 | * @return ValueAnimator 如果没有执行动画 null 53 | */ 54 | ValueAnimator animSpinner(int endSpinner); 55 | 56 | // 57 | 58 | // 59 | 60 | /** 61 | * 指定在下拉时候为 Header 或 Footer 绘制背景 62 | * @param internal Header Footer 调用时传 this 63 | * @param backgroundColor 背景颜色 64 | * @return RefreshKernel 65 | */ 66 | RefreshKernel requestDrawBackgroundFor(@NonNull RefreshInternal internal, int backgroundColor); 67 | /** 68 | * 请求事件 69 | * @param internal Header Footer 调用时传 this 70 | * @param request 请求 71 | * @return RefreshKernel 72 | */ 73 | RefreshKernel requestNeedTouchEventFor(@NonNull RefreshInternal internal, boolean request); 74 | /** 75 | * 请求设置默认内容滚动设置 76 | * @param internal Header Footer 调用时传 this 77 | * @param translation 移动 78 | * @return RefreshKernel 79 | */ 80 | RefreshKernel requestDefaultTranslationContentFor(@NonNull RefreshInternal internal, boolean translation); 81 | /** 82 | * 请求重新测量 headerHeight 或 footerHeight , 要求 height 高度为 WRAP_CONTENT 83 | * @param internal Header Footer 调用时传 this 84 | * @return RefreshKernel 85 | */ 86 | RefreshKernel requestRemeasureHeightFor(@NonNull RefreshInternal internal); 87 | /** 88 | * 设置二楼回弹时长 89 | * @param duration 二楼回弹时长 90 | * @return RefreshKernel 91 | */ 92 | RefreshKernel requestFloorDuration(int duration); 93 | // 94 | } 95 | -------------------------------------------------------------------------------- /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 大于等于 gte 65 | // */ 66 | // public boolean gteStatusWith(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,false,false,false), 9 | PullDownToRefresh(1,true,false,false,false), PullUpToLoad(2,true,false,false,false), 10 | PullDownCanceled(1,false,false,false,false), PullUpCanceled(2,false,false,false,false), 11 | ReleaseToRefresh(1,true,false,false,false), ReleaseToLoad(2,true,false,false,false), 12 | ReleaseToTwoLevel(1,true,false,false,true), TwoLevelReleased(1,false,false,false,true), 13 | RefreshReleased(1,false,false,false,false), LoadReleased(2,false,false,false,false), 14 | Refreshing(1,false,true,false,false), Loading(2,false,true,false,false), TwoLevel(1, false, true,false,true), 15 | RefreshFinish(1,false,false,true,false), LoadFinish(2,false,false,true,false), TwoLevelFinish(1,false,false,true,true); 16 | 17 | public final boolean isHeader; 18 | public final boolean isFooter; 19 | public final boolean isTwoLevel; 20 | public final boolean isDragging;// 正在拖动状态:PullDownToRefresh PullUpToLoad ReleaseToRefresh ReleaseToLoad ReleaseToTwoLevel 21 | public final boolean isOpening;// 正在刷新状态:Refreshing Loading TwoLevel 22 | public final boolean isFinishing;//正在完成状态:RefreshFinish LoadFinish TwoLevelFinish 23 | 24 | RefreshState(int role, boolean dragging, boolean opening, boolean finishing, boolean twoLevel) { 25 | this.isHeader = role == 1; 26 | this.isFooter = role == 2; 27 | this.isDragging = dragging; 28 | this.isOpening = opening; 29 | this.isFinishing = finishing; 30 | this.isTwoLevel = twoLevel; 31 | } 32 | 33 | public RefreshState toFooter() { 34 | if (isHeader && !isTwoLevel) { 35 | return values()[ordinal() + 1]; 36 | } 37 | return this; 38 | } 39 | 40 | public RefreshState toHeader() { 41 | if (isFooter && !isTwoLevel) { 42 | return values()[ordinal()-1]; 43 | } 44 | return this; 45 | } 46 | } -------------------------------------------------------------------------------- /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/impl/ScrollBoundaryDeciderAdapter.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smartrefresh.layout.impl; 2 | 3 | import android.graphics.PointF; 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 | public PointF mActionEvent; 19 | public ScrollBoundaryDecider boundary; 20 | public boolean mEnableLoadMoreWhenContentNotFull = true; 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 | // public void setEnableLoadMoreWhenContentNotFull(boolean enable) { 32 | // mEnableLoadMoreWhenContentNotFull = enable; 33 | // } 34 | // 35 | 36 | // 37 | @Override 38 | public boolean canRefresh(View content) { 39 | if (boundary != null) { 40 | return boundary.canRefresh(content); 41 | } 42 | //mActionEvent == null 时 canRefresh 不会动态递归搜索 43 | return ScrollBoundaryUtil.canRefresh(content, mActionEvent); 44 | } 45 | 46 | @Override 47 | public boolean canLoadMore(View content) { 48 | if (boundary != null) { 49 | return boundary.canLoadMore(content); 50 | } 51 | // if (mEnableLoadMoreWhenContentNotFull) { 52 | // //mActionEvent == null 时 canScrollDown 不会动态递归搜索 53 | // return !ScrollBoundaryUtil.canScrollDown(content, mActionEvent); 54 | // } 55 | //mActionEvent == null 时 canLoadMore 不会动态递归搜索 56 | return ScrollBoundaryUtil.canLoadMore(content, mActionEvent, mEnableLoadMoreWhenContentNotFull); 57 | } 58 | // 59 | } 60 | -------------------------------------------------------------------------------- /refresh-layout/src/main/java/com/scwang/smartrefresh/layout/internal/ArrowDrawable.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smartrefresh.layout.internal; 2 | 3 | import android.graphics.Canvas; 4 | import android.graphics.Path; 5 | import android.graphics.Rect; 6 | import android.graphics.drawable.Drawable; 7 | import android.support.annotation.NonNull; 8 | 9 | /** 10 | * 箭头图像 11 | * Created by SCWANG on 2018/2/5. 12 | */ 13 | 14 | public class ArrowDrawable extends PaintDrawable { 15 | 16 | private int mWidth = 0; 17 | private int mHeight = 0; 18 | private Path mPath = new Path(); 19 | 20 | @Override 21 | public void draw(@NonNull Canvas canvas) { 22 | final Drawable drawable = ArrowDrawable.this; 23 | final Rect bounds = drawable.getBounds(); 24 | int width = bounds.width(); 25 | int height = bounds.height(); 26 | if (mWidth != width || mHeight != height) { 27 | int lineWidth = width * 30 / 225; 28 | mPath.reset(); 29 | 30 | float vector1 = (float) (lineWidth * Math.sin(Math.PI/4)); 31 | float vector2 = (float) (lineWidth / Math.sin(Math.PI/4)); 32 | mPath.moveTo(width / 2, height); 33 | mPath.lineTo(0, height / 2); 34 | mPath.lineTo(vector1, height / 2 - vector1); 35 | mPath.lineTo(width / 2 - lineWidth / 2, height - vector2 - lineWidth / 2); 36 | mPath.lineTo(width / 2 - lineWidth / 2, 0); 37 | mPath.lineTo(width / 2 + lineWidth / 2, 0); 38 | mPath.lineTo(width / 2 + lineWidth / 2, height - vector2 - lineWidth / 2); 39 | mPath.lineTo(width - vector1, height / 2 - vector1); 40 | mPath.lineTo(width, height / 2); 41 | mPath.close(); 42 | 43 | mWidth = width; 44 | mHeight = height; 45 | } 46 | canvas.drawPath(mPath, mPaint); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /refresh-layout/src/main/java/com/scwang/smartrefresh/layout/internal/PaintDrawable.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smartrefresh.layout.internal; 2 | 3 | import android.graphics.ColorFilter; 4 | import android.graphics.Paint; 5 | import android.graphics.PixelFormat; 6 | import android.graphics.drawable.Drawable; 7 | 8 | /** 9 | * 画笔 Drawable 10 | * Created by SCWANG on 2017/6/16. 11 | */ 12 | 13 | public abstract class PaintDrawable extends Drawable { 14 | 15 | protected Paint mPaint = new Paint(); 16 | 17 | protected PaintDrawable() { 18 | mPaint.setStyle(Paint.Style.FILL); 19 | mPaint.setAntiAlias(true); 20 | mPaint.setColor(0xffaaaaaa); 21 | } 22 | 23 | public void setColor(int color) { 24 | mPaint.setColor(color); 25 | } 26 | 27 | @Override 28 | public void setAlpha(int alpha) { 29 | mPaint.setAlpha(alpha); 30 | } 31 | 32 | @Override 33 | public void setColorFilter(ColorFilter cf) { 34 | mPaint.setColorFilter(cf); 35 | } 36 | 37 | @Override 38 | public int getOpacity() { 39 | return PixelFormat.TRANSLUCENT; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /refresh-layout/src/main/java/com/scwang/smartrefresh/layout/internal/ProgressDrawable.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smartrefresh.layout.internal; 2 | 3 | import android.animation.ValueAnimator; 4 | import android.graphics.Canvas; 5 | import android.graphics.Path; 6 | import android.graphics.Rect; 7 | import android.graphics.drawable.Animatable; 8 | import android.graphics.drawable.Drawable; 9 | import android.support.annotation.NonNull; 10 | import android.view.animation.LinearInterpolator; 11 | 12 | /** 13 | * 旋转动画 14 | * Created by SCWANG on 2017/6/16. 15 | */ 16 | @SuppressWarnings("WeakerAccess") 17 | public class ProgressDrawable extends PaintDrawable implements Animatable , ValueAnimator.AnimatorUpdateListener{ 18 | 19 | protected int mWidth = 0; 20 | protected int mHeight = 0; 21 | protected int mProgressDegree = 0; 22 | protected ValueAnimator mValueAnimator; 23 | protected Path mPath = new Path(); 24 | 25 | public ProgressDrawable() { 26 | mValueAnimator = ValueAnimator.ofInt(30, 3600); 27 | mValueAnimator.setDuration(10000); 28 | mValueAnimator.setInterpolator(new LinearInterpolator()); 29 | mValueAnimator.setRepeatCount(ValueAnimator.INFINITE); 30 | mValueAnimator.setRepeatMode(ValueAnimator.RESTART); 31 | } 32 | 33 | @Override 34 | public void onAnimationUpdate(ValueAnimator animation) { 35 | int value = (int) animation.getAnimatedValue(); 36 | mProgressDegree = 30 * (value / 30); 37 | final Drawable drawable = ProgressDrawable.this; 38 | drawable.invalidateSelf(); 39 | } 40 | 41 | // 42 | @Override 43 | public void draw(@NonNull Canvas canvas) { 44 | final Drawable drawable = ProgressDrawable.this; 45 | final Rect bounds = drawable.getBounds(); 46 | final int width = bounds.width(); 47 | final int height = bounds.height(); 48 | final int r = Math.max(1, width / 20); 49 | 50 | if (mWidth != width || mHeight != height) { 51 | mPath.reset(); 52 | mPath.addCircle(width - r, height / 2, r, Path.Direction.CW); 53 | mPath.addRect(width - 5 * r, height / 2 - r, width - r, height / 2 + r, Path.Direction.CW); 54 | mPath.addCircle(width - 5 * r, height / 2, r, Path.Direction.CW); 55 | mWidth = width; 56 | mHeight = height; 57 | } 58 | 59 | canvas.save(); 60 | canvas.rotate(mProgressDegree, (width) / 2, (height) / 2); 61 | for (int i = 0; i < 12; i++) { 62 | mPaint.setAlpha((i+5) * 0x11); 63 | canvas.rotate(30, (width) / 2, (height) / 2); 64 | canvas.drawPath(mPath, mPaint); 65 | } 66 | canvas.restore(); 67 | } 68 | 69 | // 70 | 71 | @Override 72 | public void start() { 73 | if (!mValueAnimator.isRunning()) { 74 | mValueAnimator.addUpdateListener(this); 75 | mValueAnimator.start(); 76 | } 77 | } 78 | 79 | @Override 80 | public void stop() { 81 | if (mValueAnimator.isRunning()) { 82 | mValueAnimator.removeAllListeners(); 83 | mValueAnimator.removeAllUpdateListeners(); 84 | mValueAnimator.cancel(); 85 | } 86 | } 87 | 88 | @Override 89 | public boolean isRunning() { 90 | return mValueAnimator.isRunning(); 91 | } 92 | 93 | } 94 | -------------------------------------------------------------------------------- /refresh-layout/src/main/java/com/scwang/smartrefresh/layout/listener/CoordinatorLayoutListener.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smartrefresh.layout.listener; 2 | 3 | public interface CoordinatorLayoutListener { 4 | void onCoordinatorUpdate(boolean enableRefresh, boolean enableLoadMore); 5 | } -------------------------------------------------------------------------------- /refresh-layout/src/main/java/com/scwang/smartrefresh/layout/listener/OnLoadMoreListener.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smartrefresh.layout.listener; 2 | 3 | import android.support.annotation.NonNull; 4 | 5 | import com.scwang.smartrefresh.layout.api.RefreshLayout; 6 | 7 | /** 8 | * 加载更多监听器 9 | * Created by SCWANG on 2017/5/26. 10 | */ 11 | 12 | public interface OnLoadMoreListener { 13 | void onLoadMore(@NonNull RefreshLayout refreshLayout); 14 | } 15 | -------------------------------------------------------------------------------- /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 | /** 13 | * 手指拖动下拉(会连续多次调用,添加isDragging并取代之前的onPulling、onReleasing) 14 | * @param header 头部 15 | * @param isDragging true 手指正在拖动 false 回弹动画 16 | * @param percent 下拉的百分比 值 = offset/footerHeight (0 - percent - (footerHeight+maxDragHeight) / footerHeight ) 17 | * @param offset 下拉的像素偏移量 0 - offset - (footerHeight+maxDragHeight) 18 | * @param headerHeight 高度 HeaderHeight or FooterHeight 19 | * @param maxDragHeight 最大拖动高度 20 | */ 21 | void onHeaderMoving(RefreshHeader header, boolean isDragging, float percent, int offset, int headerHeight, int maxDragHeight); 22 | 23 | // void onHeaderPulling(RefreshHeader header, float percent, int offset, int headerHeight, int maxDragHeight); 24 | // void onHeaderReleasing(RefreshHeader header, float percent, int offset, int headerHeight, int maxDragHeight); 25 | void onHeaderReleased(RefreshHeader header, int headerHeight, int maxDragHeight); 26 | void onHeaderStartAnimator(RefreshHeader header, int headerHeight, int maxDragHeight); 27 | void onHeaderFinish(RefreshHeader header, boolean success); 28 | 29 | /** 30 | * 手指拖动上拉(会连续多次调用,添加isDragging并取代之前的onPulling、onReleasing) 31 | * @param footer 尾部 32 | * @param isDragging true 手指正在拖动 false 回弹动画 33 | * @param percent 下拉的百分比 值 = offset/footerHeight (0 - percent - (footerHeight+maxDragHeight) / footerHeight ) 34 | * @param offset 下拉的像素偏移量 0 - offset - (footerHeight+maxDragHeight) 35 | * @param footerHeight 高度 HeaderHeight or FooterHeight 36 | * @param maxDragHeight 最大拖动高度 37 | */ 38 | void onFooterMoving(RefreshFooter footer, boolean isDragging, float percent, int offset, int footerHeight, int maxDragHeight); 39 | 40 | // void onFooterPulling(RefreshFooter footer, float percent, int offset, int footerHeight, int maxDragHeight); 41 | // void onFooterReleasing(RefreshFooter footer, float percent, int offset, int footerHeight, int maxDragHeight); 42 | void onFooterReleased(RefreshFooter footer, int footerHeight, int maxDragHeight); 43 | void onFooterStartAnimator(RefreshFooter footer, int footerHeight, int maxDragHeight); 44 | void onFooterFinish(RefreshFooter footer, boolean success); 45 | } 46 | -------------------------------------------------------------------------------- /refresh-layout/src/main/java/com/scwang/smartrefresh/layout/listener/OnRefreshListener.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smartrefresh.layout.listener; 2 | 3 | import android.support.annotation.NonNull; 4 | 5 | import com.scwang.smartrefresh.layout.api.RefreshLayout; 6 | 7 | /** 8 | * 刷新监听器 9 | * Created by SCWANG on 2017/5/26. 10 | */ 11 | 12 | public interface OnRefreshListener { 13 | void onRefresh(@NonNull RefreshLayout refreshLayout); 14 | } 15 | -------------------------------------------------------------------------------- /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 android.support.annotation.NonNull; 5 | import android.support.annotation.RestrictTo; 6 | 7 | import com.scwang.smartrefresh.layout.api.RefreshLayout; 8 | import com.scwang.smartrefresh.layout.constant.RefreshState; 9 | 10 | import static android.support.annotation.RestrictTo.Scope.LIBRARY; 11 | import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP; 12 | import static android.support.annotation.RestrictTo.Scope.SUBCLASSES; 13 | 14 | /** 15 | * 刷新状态改变监听器 16 | * Created by SCWANG on 2017/5/26. 17 | */ 18 | 19 | public interface OnStateChangedListener { 20 | /** 21 | * 状态改变事件 {@link RefreshState} 22 | * @param refreshLayout RefreshLayout 23 | * @param oldState 改变之前的状态 24 | * @param newState 改变之后的状态 25 | */ 26 | @RestrictTo({LIBRARY,LIBRARY_GROUP,SUBCLASSES}) 27 | void onStateChanged(@NonNull RefreshLayout refreshLayout, @NonNull RefreshState oldState, @NonNull RefreshState newState); 28 | } 29 | -------------------------------------------------------------------------------- /refresh-layout/src/main/java/com/scwang/smartrefresh/layout/listener/SimpleMultiPurposeListener.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smartrefresh.layout.listener; 2 | 3 | import android.support.annotation.NonNull; 4 | 5 | import com.scwang.smartrefresh.layout.api.RefreshFooter; 6 | import com.scwang.smartrefresh.layout.api.RefreshHeader; 7 | import com.scwang.smartrefresh.layout.api.RefreshLayout; 8 | import com.scwang.smartrefresh.layout.constant.RefreshState; 9 | 10 | /** 11 | * 多功能监听器 12 | * Created by SCWANG on 2017/5/26. 13 | */ 14 | 15 | public class SimpleMultiPurposeListener implements OnMultiPurposeListener { 16 | 17 | // @Override 18 | // public void onHeaderPulling(RefreshHeader header, float percent, int offset, int headerHeight, int maxDragHeight) { 19 | // 20 | // } 21 | 22 | @Override 23 | public void onHeaderMoving(RefreshHeader header, boolean isDragging, float percent, int offset, int headerHeight, int maxDragHeight) { 24 | 25 | } 26 | 27 | @Override 28 | public void onHeaderReleased(RefreshHeader header, int headerHeight, int maxDragHeight) { 29 | 30 | } 31 | 32 | // @Override 33 | // public void onHeaderReleasing(RefreshHeader header, float percent, int offset, int footerHeight, int maxDragHeight) { 34 | // 35 | // } 36 | 37 | @Override 38 | public void onHeaderStartAnimator(RefreshHeader header, int footerHeight, int maxDragHeight) { 39 | 40 | } 41 | 42 | @Override 43 | public void onHeaderFinish(RefreshHeader header, boolean success) { 44 | 45 | } 46 | 47 | @Override 48 | public void onFooterMoving(RefreshFooter footer, boolean isDragging, float percent, int offset, int footerHeight, int maxDragHeight) { 49 | 50 | } 51 | 52 | // @Override 53 | // public void onFooterPulling(RefreshFooter footer, float percent, int offset, int footerHeight, int maxDragHeight) { 54 | // 55 | // } 56 | 57 | @Override 58 | public void onFooterReleased(RefreshFooter footer, int footerHeight, int maxDragHeight) { 59 | 60 | } 61 | 62 | // @Override 63 | // public void onFooterReleasing(RefreshFooter footer, float percent, int offset, int footerHeight, int maxDragHeight) { 64 | // 65 | // } 66 | 67 | @Override 68 | public void onFooterStartAnimator(RefreshFooter footer, int headerHeight, int maxDragHeight) { 69 | 70 | } 71 | 72 | @Override 73 | public void onFooterFinish(RefreshFooter footer, boolean success) { 74 | 75 | } 76 | 77 | @Override 78 | public void onRefresh(@NonNull RefreshLayout refreshLayout) { 79 | 80 | } 81 | 82 | @Override 83 | public void onLoadMore(@NonNull RefreshLayout refreshLayout) { 84 | 85 | } 86 | 87 | @Override 88 | public void onStateChanged(@NonNull RefreshLayout refreshLayout, @NonNull RefreshState oldState, @NonNull RefreshState newState) { 89 | 90 | } 91 | 92 | } 93 | -------------------------------------------------------------------------------- /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 | private Runnable runnable; 6 | public DelayedRunnable(Runnable runnable, long delayMillis) { 7 | this.runnable = runnable; 8 | this.delayMillis = delayMillis; 9 | } 10 | @Override 11 | public void run() { 12 | try { 13 | if (runnable != null) { 14 | runnable.run(); 15 | runnable = null; 16 | } 17 | } catch (Throwable e) { 18 | if (!(e instanceof NoClassDefFoundError)) { 19 | e.printStackTrace(); 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /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.listener.CoordinatorLayoutListener; 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.onCoordinatorUpdate( 36 | verticalOffset >= 0, 37 | /*refreshLayout.isEnableLoadMore() && */ 38 | (appBarLayout.getTotalScrollRange() + verticalOffset) <= 0); 39 | } 40 | }); 41 | } 42 | } 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /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 | // must be set to 1.0 (used in viscousFluid()) 14 | VISCOUS_FLUID_NORMALIZE = 1.0f / viscousFluid(1.0f); 15 | // account for very small floating-point error 16 | VISCOUS_FLUID_OFFSET = 1.0f - VISCOUS_FLUID_NORMALIZE * viscousFluid(1.0f); 17 | } 18 | 19 | private static float viscousFluid(float x) { 20 | x *= VISCOUS_FLUID_SCALE; 21 | if (x < 1.0f) { 22 | x -= (1.0f - (float)Math.exp(-x)); 23 | } else { 24 | float start = 0.36787944117f; // 1/e == exp(-1) 25 | x = 1.0f - (float)Math.exp(1.0f - x); 26 | x = start + x * (1.0f - start); 27 | } 28 | return x; 29 | } 30 | 31 | @Override 32 | public float getInterpolation(float input) { 33 | final float interpolated = VISCOUS_FLUID_NORMALIZE * viscousFluid(input); 34 | if (interpolated > 0) { 35 | return interpolated + VISCOUS_FLUID_OFFSET; 36 | } 37 | return interpolated; 38 | } 39 | } -------------------------------------------------------------------------------- /refresh-layout/src/main/res/values-zh/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 下拉可以刷新 3 | 正在刷新… 4 | 等待底部加载完成… 5 | 释放立即刷新 6 | 刷新完成 7 | 刷新失败 8 | 上次更新 M-d HH:mm 9 | 释放进入二楼 10 | 11 | 上拉加载更多 12 | 释放立即加载 13 | 正在加载… 14 | 等待头部刷新完成… 15 | 加载完成 16 | 加载失败 17 | 没有更多数据了 18 | 19 | SmartRefreshLayout中没有找到内容视图。您是否忘记在xml布局文件中添加? 20 | %s 虚假区域\n代表运行时拖动的高度【%.1fdp】 \n而不会显示任何东西 21 | 22 | -------------------------------------------------------------------------------- /refresh-layout/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Pull Down To Refresh 3 | Release To Refresh 4 | Wait For Refreshing… 5 | Loading… 6 | Refresh Success 7 | Refresh Failed 8 | \'Last Update\' M-d HH:mm 9 | Release To Second Floor 10 | 11 | Pull Up To Load More 12 | Release To Load More 13 | Loading… 14 | Wait For Refreshing… 15 | Load Success 16 | Load Failed 17 | No More Data 18 | 19 | The content view in SmartRefreshLayout is empty. Do you forget to add it in xml layout file? 20 | %s falsify area,\n Represents the height[%.1fdp] of drag at run time,\n It does not show anything. 21 | 22 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | include ':refresh-layout', ':refresh-header' 3 | --------------------------------------------------------------------------------