GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — 项目介绍排版 · StandOpen/SmartRefreshLayout@dff1430

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • app/src/main
    • AndroidManifest.xml
    • java/com/scwang/refreshlayout
      • activity
        • style
          • StoreHouseStyleActivity.java
        • using
          • BasicUsingActivity.java
          • ListenerUsingActivity.java
      • fragment
        • RefreshUsingFragment.java
    • res
      • layout
        • activity_style_storehouse.xml
        • activity_using_listener.xml
      • values
        • strings.xml
        • styles.xml
  • refresh-header/src/main/java/com/scwang/smartrefresh/header
    • CircleHeader.java
    • CircleRefreshHeader.java
    • FlyRefreshHeader.java
    • MaterialHeader.java
    • PhoenixHeader.java
    • StoreHouseHeader.java
    • TaurusHeader.java
    • WaterDropHeader.java
    • WaveSwipeHeader.java
    • fungame
      • FunGameBase.java
      • FunGameHeader.java
      • FunGameView.java
  • refresh-layout/src/main/java/com/scwang/smartrefresh/layout
    • SmartRefreshLayout.java
    • api
      • RefreshInternal.java
      • RefreshKernel.java
    • footer
      • BallPulseFooter.java
      • ClassicsFooter.java
    • header
      • BezierRadarHeader.java
      • ClassicsHeader.java
      • FalsifyHeader.java
    • impl
      • RefreshBottomWrapper.java
      • RefreshHeaderWrapper.java
    • listener
      • OnMultiPurposeListener.java
      • SimpleMultiPurposeListener.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎app/src/main/AndroidManifest.xml‎

Copy file name to clipboardExpand all lines: app/src/main/AndroidManifest.xml
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@
9090
android:name=".activity.using.AssignCodeUsingActivity"
9191
android:label="@string/title_activity_using_assign_code"
9292
android:screenOrientation="portrait"/>
93+
<activity
94+
android:name=".activity.using.ListenerUsingActivity"
95+
android:label="@string/title_activity_using_listener"
96+
android:screenOrientation="portrait"/>
9397
</application>
9498

9599
</manifest>
Collapse file

‎app/src/main/java/com/scwang/refreshlayout/activity/style/StoreHouseStyleActivity.java‎

Copy file name to clipboardExpand all lines: app/src/main/java/com/scwang/refreshlayout/activity/style/StoreHouseStyleActivity.java
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ public void onItemClick(AdapterView<?> parent, View view, int position, long id)
9797

9898
private void setThemeColor(int colorPrimary, int colorPrimaryDark) {
9999
mToolbar.setBackgroundResource(colorPrimary);
100-
((View)mRefreshLayout).setBackgroundResource(colorPrimary);
101100
mRefreshLayout.setPrimaryColorsId(colorPrimary, android.R.color.white);
102101
if (Build.VERSION.SDK_INT >= 21) {
103102
getWindow().setStatusBarColor(ContextCompat.getColor(this, colorPrimaryDark));
Collapse file

‎app/src/main/java/com/scwang/refreshlayout/activity/using/BasicUsingActivity.java‎

Copy file name to clipboardExpand all lines: app/src/main/java/com/scwang/refreshlayout/activity/using/BasicUsingActivity.java
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ protected void onBindViewHolder(SmartViewHolder holder, Void model, int position
6666
});
6767

6868
final RefreshLayout refreshLayout = (RefreshLayout) findViewById(R.id.smart);
69-
refreshLayout.autoRefresh();//触发自动刷新(非必须)
7069
refreshLayout.setEnableAutoLoadmore(true);//开启自动加载功能(非必须)
7170
refreshLayout.setOnRefreshListener(new OnRefreshListener() {
7271
@Override
@@ -99,7 +98,7 @@ public void run() {
9998

10099
if (isFirstEnter) {
101100
isFirstEnter = false;
102-
//触发上啦加载
101+
//触发自动刷新
103102
refreshLayout.autoRefresh();
104103
}
105104

Collapse file

‎app/src/main/java/com/scwang/refreshlayout/activity/using/ListenerUsingActivity.java‎

Copy file name to clipboard
+178Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
package com.scwang.refreshlayout.activity.using;
2+
3+
import android.os.Bundle;
4+
import android.support.v7.app.AppCompatActivity;
5+
import android.support.v7.widget.Toolbar;
6+
import android.view.View;
7+
import android.widget.TextView;
8+
9+
import com.scwang.refreshlayout.R;
10+
import com.scwang.smartrefresh.layout.api.RefreshFooter;
11+
import com.scwang.smartrefresh.layout.api.RefreshHeader;
12+
import com.scwang.smartrefresh.layout.api.RefreshLayout;
13+
import com.scwang.smartrefresh.layout.constant.RefreshState;
14+
import com.scwang.smartrefresh.layout.listener.SimpleMultiPurposeListener;
15+
16+
import java.text.DateFormat;
17+
import java.text.SimpleDateFormat;
18+
import java.util.Date;
19+
import java.util.Locale;
20+
21+
/**
22+
* 多功能监听器的使用
23+
*/
24+
public class ListenerUsingActivity extends AppCompatActivity {
25+
26+
27+
private static DateFormat FORMAT = new SimpleDateFormat("HH:mm sss", Locale.CHINA);
28+
29+
private Toolbar mToolbar;
30+
private TextView mTvContent;
31+
private static boolean isFirstEnter = true;
32+
private String mHeaderPulling;
33+
private String mHeaderReleasing;
34+
private String mFooterPulling;
35+
private String mFooterReleasing;
36+
private String mFooterStartAnimator;
37+
private String mHeaderStartAnimator;
38+
private String mFooterFinish;
39+
private String mHeaderFinish;
40+
private String mRefresh;
41+
private String mLoadmore;
42+
private String mStateChanged;
43+
44+
@Override
45+
protected void onCreate(Bundle savedInstanceState) {
46+
super.onCreate(savedInstanceState);
47+
setContentView(R.layout.activity_using_listener);
48+
49+
mToolbar = (Toolbar)findViewById(R.id.toolbar);
50+
mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
51+
@Override
52+
public void onClick(View v) {
53+
finish();
54+
}
55+
});
56+
57+
mTvContent = (TextView) findViewById(R.id.content);
58+
59+
final RefreshLayout refreshLayout = (RefreshLayout) findViewById(R.id.smart);
60+
refreshLayout.setOnMultiPurposeListener(new SimpleMultiPurposeListener() {
61+
@Override
62+
public void onHeaderPulling(RefreshHeader header, float percent, int offset, int headerHeight, int extendHeight) {
63+
mHeaderPulling = String.format(Locale.CHINA, "%s\npercent=%.02f offset=%03d\nheight=%03d extend=%03d",
64+
FORMAT.format(new Date()),
65+
percent,offset,headerHeight,extendHeight);
66+
updateContent();
67+
}
68+
69+
@Override
70+
public void onHeaderReleasing(RefreshHeader header, float percent, int offset, int headerHeight, int extendHeight) {
71+
mHeaderReleasing = String.format(Locale.CHINA, "%s\npercent=%.02f offset=%03d\nheight=%03d extend=%03d",
72+
FORMAT.format(new Date()),
73+
percent,offset,headerHeight,extendHeight);
74+
updateContent();
75+
}
76+
77+
@Override
78+
public void onHeaderStartAnimator(RefreshHeader header, int headerHeight, int extendHeight) {
79+
mHeaderStartAnimator = String.format(Locale.CHINA, "%s\nheight=%03d extend=%03d",
80+
FORMAT.format(new Date()),
81+
headerHeight,extendHeight);
82+
updateContent();
83+
}
84+
85+
@Override
86+
public void onHeaderFinish(RefreshHeader header) {
87+
mHeaderFinish = String.format(Locale.CHINA, "%s",FORMAT.format(new Date()));
88+
updateContent();
89+
}
90+
91+
@Override
92+
public void onFooterPulling(RefreshFooter footer, float percent, int offset, int footerHeight, int extendHeight) {
93+
mFooterPulling = String.format(Locale.CHINA, "%s\npercent=%.02f\noffset=%03d height=%03d\nextend=%03d",
94+
FORMAT.format(new Date()),
95+
percent,offset,footerHeight,extendHeight);
96+
updateContent();
97+
}
98+
99+
@Override
100+
public void onFooterReleasing(RefreshFooter footer, float percent, int offset, int footerHeight, int extendHeight) {
101+
mFooterReleasing = String.format(Locale.CHINA, "%s\npercent=%.02f\noffset=%03d height=%03d\nextend=%03d",
102+
FORMAT.format(new Date()),
103+
percent,offset,footerHeight,extendHeight);
104+
updateContent();
105+
}
106+
107+
@Override
108+
public void onFooterStartAnimator(RefreshFooter footer, int footerHeight, int extendHeight) {
109+
mFooterStartAnimator = String.format(Locale.CHINA, "%s\nheight=%03d extend=%03d",
110+
FORMAT.format(new Date()),
111+
footerHeight,extendHeight);
112+
updateContent();
113+
}
114+
115+
@Override
116+
public void onFooterFinish(RefreshFooter footer) {
117+
mFooterFinish = String.format(Locale.CHINA, "%s",FORMAT.format(new Date()));
118+
updateContent();
119+
}
120+
121+
@Override
122+
public void onRefresh(RefreshLayout refreshlayout) {
123+
mRefresh = String.format(Locale.CHINA, "%s",FORMAT.format(new Date()));
124+
updateContent();
125+
}
126+
127+
@Override
128+
public void onLoadmore(RefreshLayout refreshlayout) {
129+
mLoadmore = String.format(Locale.CHINA, "%s",FORMAT.format(new Date()));
130+
updateContent();
131+
}
132+
133+
@Override
134+
public void onStateChanged(RefreshLayout refreshLayout, RefreshState oldState, RefreshState newState) {
135+
mStateChanged = String.format(Locale.CHINA, "%s\nnew=%s\nold=%s",
136+
FORMAT.format(new Date()),
137+
newState.name(),
138+
oldState.name());
139+
updateContent();
140+
}
141+
});
142+
143+
144+
if (isFirstEnter) {
145+
isFirstEnter = false;
146+
//触发自动刷新
147+
refreshLayout.autoRefresh();
148+
}
149+
150+
}
151+
152+
private void updateContent() {
153+
mTvContent.setText(String.format(Locale.CHINA,
154+
"onStateChanged:%s\n\n" +
155+
"onHeaderPulling:%s\n\n" +
156+
"onHeaderReleasing:%s\n\n" +
157+
"onHeaderStartAnimator:%s\n\n" +
158+
"onHeaderFinish:%s\n\n" +
159+
"onFooterPulling:%s\n\n" +
160+
"onFooterReleasing:%s\n\n" +
161+
"onFooterStartAnimator:%s\n\n" +
162+
"onFooterFinish:%s\n\n" +
163+
"onRefresh:%s\n\n" +
164+
"onLoadmore:%s\n\n",
165+
mStateChanged,
166+
mHeaderPulling,
167+
mHeaderReleasing,
168+
mHeaderStartAnimator,
169+
mHeaderFinish,
170+
mFooterPulling,
171+
mFooterReleasing,
172+
mFooterStartAnimator,
173+
mFooterFinish,
174+
mRefresh,
175+
mLoadmore));
176+
}
177+
178+
}
Collapse file

‎app/src/main/java/com/scwang/refreshlayout/fragment/RefreshUsingFragment.java‎

Copy file name to clipboardExpand all lines: app/src/main/java/com/scwang/refreshlayout/fragment/RefreshUsingFragment.java
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import com.scwang.refreshlayout.activity.using.AssignDefaultUsingActivity;
2222
import com.scwang.refreshlayout.activity.using.AssignXmlUsingActivity;
2323
import com.scwang.refreshlayout.activity.using.BasicUsingActivity;
24+
import com.scwang.refreshlayout.activity.using.ListenerUsingActivity;
2425
import com.scwang.refreshlayout.adapter.BaseRecyclerAdapter;
2526
import com.scwang.refreshlayout.adapter.SmartViewHolder;
2627
import com.scwang.smartrefresh.layout.api.RefreshHeader;
@@ -44,6 +45,7 @@ private enum Item {
4445
DefaultCreater("设置全局默认的Header和Footer", AssignDefaultUsingActivity.class),
4546
XmlDefine("在XML中定义Header和Footer", AssignXmlUsingActivity.class),
4647
CodeDefine("在代码中指定Header和Footer", AssignCodeUsingActivity.class),
48+
Listener("多功能监听器", ListenerUsingActivity.class),
4749
;
4850
public String name;
4951
public Class<?> clazz;
@@ -56,7 +58,7 @@ private enum Item {
5658

5759
@Override
5860
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
59-
return inflater.inflate(R.layout.fragment_refresh_styles, container, false);
61+
return inflater.inflate(R.layout.fragment_refresh_using, container, false);
6062
}
6163

6264
@Override
Collapse file

‎app/src/main/res/layout/activity_style_storehouse.xml‎

Copy file name to clipboardExpand all lines: app/src/main/res/layout/activity_style_storehouse.xml
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
android:id="@+id/smart"
1717
android:layout_width="match_parent"
1818
android:layout_height="match_parent"
19-
android:background="#333"
2019
app:srlPrimaryColor="#333"
2120
app:srlAccentColor="#fff"
2221
app:srlEnableLoadmore="false"
Collapse file

‎app/src/main/res/layout/activity_using_listener.xml‎

Copy file name to clipboard
+28Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:app="http://schemas.android.com/apk/res-auto"
4+
xmlns:tools="http://schemas.android.com/tools"
5+
android:layout_width="match_parent"
6+
android:layout_height="match_parent"
7+
android:orientation="vertical"
8+
tools:context="com.scwang.refreshlayout.activity.using.ListenerUsingActivity">
9+
10+
<android.support.v7.widget.Toolbar style="@style/AppTheme.Toolbar"
11+
android:id="@+id/toolbar"
12+
app:navigationIcon="?attr/homeAsUpIndicator"
13+
app:title="@string/title_activity_using_listener"/>
14+
15+
<com.scwang.smartrefresh.layout.SmartRefreshLayout
16+
android:id="@+id/smart"
17+
android:layout_width="match_parent"
18+
android:layout_height="match_parent">
19+
<TextView
20+
android:id="@+id/content"
21+
android:layout_width="match_parent"
22+
android:layout_height="match_parent"
23+
android:padding="@dimen/padding_common"
24+
android:background="@android:color/white"
25+
android:text="@string/description_define_in_xml"/>
26+
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
27+
28+
</LinearLayout>
Collapse file

‎app/src/main/res/values/strings.xml‎

Copy file name to clipboardExpand all lines: app/src/main/res/values/strings.xml
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104

105105
<!-- TODO: Remove or change this placeholder text -->
106106
<string name="hello_blank_fragment">Hello blank fragment</string>
107-
<string name="fragment_refresh_styles">风格列表</string>
107+
<string name="fragment_refresh_styles">风格展示</string>
108108
<string name="fragment_refresh_using">使用示例</string>
109109
<string name="title_activity_style_wave_swip">全屏水波</string>
110110
<string name="title_activity_style_material">官方主题</string>
@@ -171,4 +171,5 @@
171171
//设置 Footer 为 三球动画\n
172172
refreshLayout.setRefreshFooter(new BallPulseFooter(this));\n\n
173173
</string>
174+
<string name="title_activity_using_listener">多功能监听器</string>
174175
</resources>
Collapse file

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

Copy file name to clipboardExpand all lines: app/src/main/res/values/styles.xml
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +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>
810
<item name="android:listDivider">@color/colorDivison</item>
911
<item name="android:homeAsUpIndicator">@drawable/ic_arrow_back_white_24dp</item>
1012
</style>
Collapse file

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

Copy file name to clipboardExpand all lines: refresh-header/src/main/java/com/scwang/smartrefresh/header/CircleHeader.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ private void drawFinish(Canvas canvas, int viewWidth) {
239239
//<editor-fold desc="RefreshHeader">
240240

241241
@Override
242-
public void onSizeDefined(RefreshKernel kernel, int height, int extendHeight) {
242+
public void onInitialized(RefreshKernel kernel, int height, int extendHeight) {
243243
kernel.registHeaderHook(new RefreshLayoutHeaderHooker() {
244244
@Override
245245
public void onHookFinishRefresh(SuperMethod supper, RefreshLayout layout) {

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.