Skip to content

Commit f3d41d9

Browse files
author
wsc
committed
完成自主开发的DropboxHeader
1 parent 77b3690 commit f3d41d9

28 files changed

+175
-72
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
- 支持设置多种滑动方式来适配各种效果的Header和Footer:位置平移、尺寸拉伸、背后固定、顶层固定、全屏
2323
- 支持内容尺寸自适应 Content-wrap_content
2424
- 支持继承重写和扩展功能,内部实现没有 private 方法和字段,继承之后都可以重写覆盖
25-
- 支持越界回弹(Listview、RecyclerView)
25+
- 支持越界回弹(Listview、RecyclerView、ScrollView、WebView...View
2626

2727
## Demo
2828
[下载 APK-Demo](art/app-debug.apk)

app/src/main/AndroidManifest.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
33
package="com.scwang.refreshlayout">
44

5+
<uses-permission android:name="android.permission.INTERNET"/>
6+
57
<application
68
android:name=".App"
79
android:allowBackup="true"

app/src/main/java/com/scwang/refreshlayout/activity/using/OverScrollUsingActivity.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import android.support.v7.app.AppCompatActivity;
55
import android.support.v7.widget.Toolbar;
66
import android.view.View;
7+
import android.webkit.WebView;
8+
import android.webkit.WebViewClient;
79

810
import com.scwang.refreshlayout.R;
911
import com.scwang.smartrefresh.layout.api.RefreshLayout;
@@ -36,6 +38,19 @@ public void onClick(View v) {
3638
refreshLayout.autoRefresh();
3739
}
3840

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());
3954
}
4055

4156
}

app/src/main/java/com/scwang/refreshlayout/util/StatusBarUtil.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.scwang.refreshlayout.util;
22

3-
import android.annotation.TargetApi;
3+
import android.support.annotation.RequiresApi;
44
import android.app.Activity;
55
import android.content.Context;
66
import android.content.res.Resources;
@@ -120,7 +120,7 @@ public static void darkMode(Window window, int color, @FloatRange(from = 0.0, to
120120
//------------------------->
121121

122122
/** android 6.0设置字体颜色 */
123-
@TargetApi(Build.VERSION_CODES.M)
123+
@RequiresApi(Build.VERSION_CODES.M)
124124
private static void darkModeForM(Window window, boolean dark) {
125125
// window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
126126
// window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
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>-->

app/src/main/res/layout/activity_using_overscroll.xml

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,28 @@
1616
android:id="@+id/smartLayout"
1717
android:layout_width="match_parent"
1818
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"
2139
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"/>
3041
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
3142

3243
</LinearLayout>

app/src/main/res/layout/fragment_refresh_styles.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
android:id="@+id/recyclerView"
2323
android:layout_width="match_parent"
2424
android:layout_height="match_parent"
25+
android:background="@android:color/white"
2526
tools:listitem="@android:layout/simple_list_item_2"/>
2627
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
2728

app/src/main/res/values/styles.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
<item name="colorPrimary">@color/colorPrimary</item>
66
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
77
<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>
1010
<item name="android:listDivider">@drawable/ic_list_divider</item>
1111
<item name="android:homeAsUpIndicator">@drawable/ic_arrow_back_white_24dp</item>
1212
</style>

refresh-header/src/main/java/com/scwang/smartrefresh/header/CircleHeader.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import android.animation.Animator;
44
import android.animation.AnimatorListenerAdapter;
55
import android.animation.ValueAnimator;
6-
import android.annotation.TargetApi;
6+
import android.support.annotation.RequiresApi;
77
import android.content.Context;
88
import android.graphics.Canvas;
99
import android.graphics.Color;
@@ -76,7 +76,7 @@ public CircleHeader(Context context, AttributeSet attrs, int defStyleAttr) {
7676
initView(context, attrs);
7777
}
7878

79-
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
79+
@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
8080
public CircleHeader(Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) {
8181
super(context, attrs, defStyleAttr, defStyleRes);
8282
initView(context, attrs);

refresh-header/src/main/java/com/scwang/smartrefresh/header/DeliveryHeader.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.scwang.smartrefresh.header;
22

3-
import android.annotation.TargetApi;
3+
import android.support.annotation.RequiresApi;
44
import android.content.Context;
55
import android.graphics.Canvas;
66
import android.graphics.Paint;
@@ -58,7 +58,7 @@ public DeliveryHeader(Context context, @Nullable AttributeSet attrs, int defStyl
5858
}
5959

6060
@SuppressWarnings("unused")
61-
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
61+
@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
6262
public DeliveryHeader(Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) {
6363
super(context, attrs, defStyleAttr, defStyleRes);
6464
this.initView(context, attrs);

0 commit comments

Comments
 (0)