GeezerVison is showing github.com — 完成自主开发的DropboxHeader · StandOpen/SmartRefreshLayout@f3d41d9
File treeExpand file treeCollapse file tree Open diff view settings java/com/scwang/refreshlayout
refresh-header/src/main/java/com/scwang/smartrefresh/header refresh-layout/src/main/java/com/scwang/smartrefresh/layout
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: README.md +1-1Lines changed: 1 addition & 1 deletion - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
| 22 | 22 | - 支持设置多种滑动方式来适配各种效果的Header和Footer:位置平移、尺寸拉伸、背后固定、顶层固定、全屏 | 23 | 23 | - 支持内容尺寸自适应 Content-wrap_content | 24 | 24 | - 支持继承重写和扩展功能,内部实现没有 private 方法和字段,继承之后都可以重写覆盖 | 25 | | - - 支持越界回弹(Listview、RecyclerView) | | 25 | + - 支持越界回弹(Listview、RecyclerView、ScrollView、WebView...View) | 26 | 26 |
| 27 | 27 | ## Demo | 28 | 28 | [下载 APK-Demo](art/app-debug.apk) | |
Collapse file Copy file name to clipboardExpand all lines: app/src/main/AndroidManifest.xml +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 2 | 2 | <manifest xmlns:android="http://schemas.android.com/apk/res/android" | 3 | 3 | package="com.scwang.refreshlayout"> | 4 | 4 |
| | 5 | + <uses-permission android:name="android.permission.INTERNET"/> | | 6 | + | 5 | 7 | <application | 6 | 8 | android:name=".App" | 7 | 9 | android:allowBackup="true" | |
Collapse file Copy file name to clipboardExpand all lines: app/src/main/java/com/scwang/refreshlayout/activity/using/OverScrollUsingActivity.java +15Lines changed: 15 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 4 | 4 | import android.support.v7.app.AppCompatActivity; | 5 | 5 | import android.support.v7.widget.Toolbar; | 6 | 6 | import android.view.View; | | 7 | +import android.webkit.WebView; | | 8 | +import android.webkit.WebViewClient; | 7 | 9 |
| 8 | 10 | import com.scwang.refreshlayout.R; | 9 | 11 | import com.scwang.smartrefresh.layout.api.RefreshLayout; | @@ -36,6 +38,19 @@ public void onClick(View v) { | 36 | 38 | refreshLayout.autoRefresh(); | 37 | 39 | } | 38 | 40 |
| | 41 | + WebView webView = (WebView) findViewById(R.id.webView); | | 42 | + webView.loadUrl("http://baidu.com"); | | 43 | + webView.setWebViewClient(new WebViewClient(){ | | 44 | + @Override | | 45 | + public boolean shouldOverrideUrlLoading(WebView view, String url) { | | 46 | + // TODO Auto-generated method stub | | 47 | + //返回值是true的时候控制去WebView打开,为false调用系统浏览器或第三方浏览器 | | 48 | + view.loadUrl(url); | | 49 | + return true; | | 50 | + } | | 51 | + }); | | 52 | +// TextView textView = (TextView) findViewById(R.id.textView); | | 53 | +// textView.setMovementMethod(new ScrollingMovementMethod()); | 39 | 54 | } | 40 | 55 |
| 41 | 56 | } |
Collapse file Copy file name to clipboardExpand all lines: app/src/main/java/com/scwang/refreshlayout/util/StatusBarUtil.java +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | package com.scwang.refreshlayout.util; | 2 | 2 |
| 3 | | -import android.annotation.TargetApi; | | 3 | +import android.support.annotation.RequiresApi; | 4 | 4 | import android.app.Activity; | 5 | 5 | import android.content.Context; | 6 | 6 | import android.content.res.Resources; | @@ -120,7 +120,7 @@ public static void darkMode(Window window, int color, @FloatRange(from = 0.0, to | 120 | 120 | //-------------------------> | 121 | 121 |
| 122 | 122 | /** android 6.0设置字体颜色 */ | 123 | | - @TargetApi(Build.VERSION_CODES.M) | | 123 | + @RequiresApi(Build.VERSION_CODES.M) | 124 | 124 | private static void darkModeForM(Window window, boolean dark) { | 125 | 125 | // window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); | 126 | 126 | // window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); | |
Collapse file Copy file name to clipboard +18-5Lines changed: 18 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | | -<shape xmlns:android="http://schemas.android.com/apk/res/android" | 2 | | - android:shape="line" | 3 | | - android:thickness="1dp" | 4 | | - android:tint="@color/colorDivison"> | 5 | | -</shape> | | 1 | +<?xml version="1.0" encoding="utf-8"?> | | 2 | +<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> | | 3 | + <item android:left="@dimen/padding_common"> | | 4 | + <shape android:shape="rectangle"> | | 5 | + <solid android:color="@color/colorDivison" /> | | 6 | + <size android:height="@dimen/division_line"/> | | 7 | + </shape> | | 8 | + </item> | | 9 | +</layer-list> | | 10 | +<!--<shape xmlns:android="http://schemas.android.com/apk/res/android"--> | | 11 | + <!--android:shape="line"--> | | 12 | + <!--android:thickness="1dp"--> | | 13 | + <!--android:tint="@color/colorDivison">--> | | 14 | + | | 15 | + <!--<stroke android:color="@color/colorDivison"/>--> | | 16 | + <!--<size android:height="0.5dp"/>--> | | 17 | + | | 18 | +<!--</shape>--> |
Collapse file Copy file name to clipboardExpand all lines: app/src/main/res/layout/activity_using_overscroll.xml +21-10Lines changed: 21 additions & 10 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 16 | 16 | android:id="@+id/smartLayout" | 17 | 17 | android:layout_width="match_parent" | 18 | 18 | android:layout_height="match_parent"> | 19 | | - <ScrollView | 20 | | - android:id="@+id/scrollView" | | 19 | + <!--<TextView--> | | 20 | + <!--android:id="@+id/textView"--> | | 21 | + <!--android:layout_width="match_parent"--> | | 22 | + <!--android:layout_height="wrap_content"--> | | 23 | + <!--android:scrollbars = "vertical"--> | | 24 | + <!--android:padding="@dimen/padding_common"--> | | 25 | + <!--android:text="@string/large_text"/>--> | | 26 | + <!--<ScrollView--> | | 27 | + <!--android:id="@+id/scrollView"--> | | 28 | + <!--android:layout_width="match_parent"--> | | 29 | + <!--android:layout_height="match_parent"--> | | 30 | + <!--android:background="@android:color/white">--> | | 31 | + <!--<TextView--> | | 32 | + <!--android:layout_width="match_parent"--> | | 33 | + <!--android:layout_height="wrap_content"--> | | 34 | + <!--android:layout_margin="@dimen/padding_common"--> | | 35 | + <!--android:text="@string/large_text"/>--> | | 36 | + <!--</ScrollView>--> | | 37 | + <WebView | | 38 | + android:id="@+id/webView" | 21 | 39 | android:layout_width="match_parent" | 22 | | - android:layout_height="match_parent" | 23 | | - android:background="@android:color/white"> | 24 | | - <TextView | 25 | | - android:layout_width="match_parent" | 26 | | - android:layout_height="wrap_content" | 27 | | - android:layout_margin="@dimen/padding_common" | 28 | | - android:text="@string/large_text"/> | 29 | | - </ScrollView> | | 40 | + android:layout_height="match_parent"/> | 30 | 41 | </com.scwang.smartrefresh.layout.SmartRefreshLayout> | 31 | 42 |
| 32 | 43 | </LinearLayout> |
Collapse file Copy file name to clipboardExpand all lines: app/src/main/res/layout/fragment_refresh_styles.xml +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 22 | 22 | android:id="@+id/recyclerView" | 23 | 23 | android:layout_width="match_parent" | 24 | 24 | android:layout_height="match_parent" | | 25 | + android:background="@android:color/white" | 25 | 26 | tools:listitem="@android:layout/simple_list_item_2"/> | 26 | 27 | </com.scwang.smartrefresh.layout.SmartRefreshLayout> | 27 | 28 |
| |
Collapse file Copy file name to clipboardExpand all lines: app/src/main/res/values/styles.xml +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 5 | 5 | <item name="colorPrimary">@color/colorPrimary</item> | 6 | 6 | <item name="colorPrimaryDark">@color/colorPrimaryDark</item> | 7 | 7 | <item name="colorAccent">@color/colorAccent</item> | 8 | | - <item name="android:divider">@color/colorDivison</item> | 9 | | - <item name="android:dividerHeight">0.5dp</item> | | 8 | + <item name="android:divider">@drawable/ic_list_divider</item> | | 9 | + <item name="android:dividerHeight">@dimen/division_line</item> | 10 | 10 | <item name="android:listDivider">@drawable/ic_list_divider</item> | 11 | 11 | <item name="android:homeAsUpIndicator">@drawable/ic_arrow_back_white_24dp</item> | 12 | 12 | </style> | |
Collapse file Copy file name to clipboardExpand all lines: refresh-header/src/main/java/com/scwang/smartrefresh/header/CircleHeader.java +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 3 | 3 | import android.animation.Animator; | 4 | 4 | import android.animation.AnimatorListenerAdapter; | 5 | 5 | import android.animation.ValueAnimator; | 6 | | -import android.annotation.TargetApi; | | 6 | +import android.support.annotation.RequiresApi; | 7 | 7 | import android.content.Context; | 8 | 8 | import android.graphics.Canvas; | 9 | 9 | import android.graphics.Color; | @@ -76,7 +76,7 @@ public CircleHeader(Context context, AttributeSet attrs, int defStyleAttr) { | 76 | 76 | initView(context, attrs); | 77 | 77 | } | 78 | 78 |
| 79 | | - @TargetApi(Build.VERSION_CODES.LOLLIPOP) | | 79 | + @RequiresApi(Build.VERSION_CODES.LOLLIPOP) | 80 | 80 | public CircleHeader(Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) { | 81 | 81 | super(context, attrs, defStyleAttr, defStyleRes); | 82 | 82 | initView(context, attrs); | |
Collapse file Copy file name to clipboardExpand all lines: refresh-header/src/main/java/com/scwang/smartrefresh/header/DeliveryHeader.java +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | package com.scwang.smartrefresh.header; | 2 | 2 |
| 3 | | -import android.annotation.TargetApi; | | 3 | +import android.support.annotation.RequiresApi; | 4 | 4 | import android.content.Context; | 5 | 5 | import android.graphics.Canvas; | 6 | 6 | import android.graphics.Paint; | @@ -58,7 +58,7 @@ public DeliveryHeader(Context context, @Nullable AttributeSet attrs, int defStyl | 58 | 58 | } | 59 | 59 |
| 60 | 60 | @SuppressWarnings("unused") | 61 | | - @TargetApi(Build.VERSION_CODES.LOLLIPOP) | | 61 | + @RequiresApi(Build.VERSION_CODES.LOLLIPOP) | 62 | 62 | public DeliveryHeader(Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) { | 63 | 63 | super(context, attrs, defStyleAttr, defStyleRes); | 64 | 64 | this.initView(context, attrs); | |
|