=""> 131
+			mHeader.layout(l, t, r, headerHeight);
132
+			mItemTop = headerHeight;
133
+			mItem.layout(l, headerHeight, r, b);
134
+		} else if (mDivider != null) {
135
+			mDivider.setBounds(l, t, r, mDividerHeight);
136
+			mItemTop = mDividerHeight;
137
+			mItem.layout(l, mDividerHeight, r, b);
138
+		} else {
139
+			mItemTop = t;
140
+			mItem.layout(l, t, r, b);
141
+		}
142
+	}
143
+
144
+	@Override
145
+	protected void dispatchDraw(Canvas canvas) {
146
+		super.dispatchDraw(canvas);
147
+		if (mHeader == null && mDivider != null&&mItem.getVisibility()!=View.GONE) {
148
+			// Drawable.setBounds() does not seem to work pre-honeycomb. So have
149
+			// to do this instead
150
+			if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
151
+				canvas.clipRect(0, 0, getWidth(), mDividerHeight);
152
+			}
153
+			mDivider.draw(canvas);
154
+		}
155
+	}
156
+}

+ 196 - 0
views/src/main/java/com/android/views/stickylistheaders/WrapperViewList.java

@@ -0,0 +1,196 @@
1
+package com.android.views.stickylistheaders;
2
+
3
+import android.content.Context;
4
+import android.graphics.Canvas;
5
+import android.graphics.Rect;
6
+import android.os.Build;
7
+import android.view.View;
8
+import android.widget.AbsListView;
9
+import android.widget.ListView;
10
+
11
+import java.lang.reflect.Field;
12
+import java.util.ArrayList;
13
+import java.util.List;
14
+
15
+class WrapperViewList extends ListView {
16
+
17
+	interface LifeCycleListener {
18
+		void onDispatchDrawOccurred(Canvas canvas);
19
+	}
20
+
21
+	private LifeCycleListener mLifeCycleListener;
22
+	private List<View> mFooterViews;
23
+	private int mTopClippingLength;
24
+	private Rect mSelectorRect = new Rect();// for if reflection fails
25
+	private Field mSelectorPositionField;
26
+	private boolean mClippingToPadding = true;
27
+    private boolean mBlockLayoutChildren = false;
28
+
29
+	public WrapperViewList(Context context) {
30
+		super(context);
31
+
32
+		// Use reflection to be able to change the size/position of the list
33
+		// selector so it does not come under/over the header
34
+		try {
35
+			Field selectorRectField = AbsListView.class.getDeclaredField("mSelectorRect");
36
+			selectorRectField.setAccessible(true);
37
+			mSelectorRect = (Rect) selectorRectField.get(this);
38
+
39
+			if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
40
+				mSelectorPositionField = AbsListView.class.getDeclaredField("mSelectorPosition");
41
+				mSelectorPositionField.setAccessible(true);
42
+			}
43
+		} catch (NoSuchFieldException e) {
44
+			e.printStackTrace();
45
+		} catch (IllegalArgumentException e) {
46
+			e.printStackTrace();
47
+		} catch (IllegalAccessException e) {
48
+			e.printStackTrace();
49
+		}
50
+	}
51
+
52
+	@Override
53
+	public boolean performItemClick(View view, int position, long id) {
54
+		if (view instanceof WrapperView) {
55
+			view = ((WrapperView) view).mItem;
56
+		}
57
+		return super.performItemClick(view, position, id);
58
+	}
59
+
60
+	private void positionSelectorRect() {
61
+		if (!mSelectorRect.isEmpty()) {
62
+			int selectorPosition = getSelectorPosition();
63
+			if (selectorPosition >= 0) {
64
+				int firstVisibleItem = getFixedFirstVisibleItem();
65
+				View v = getChildAt(selectorPosition - firstVisibleItem);
66
+				if (v instanceof WrapperView) {
67
+					WrapperView wrapper = ((WrapperView) v);
68
+					mSelectorRect.top = wrapper.getTop() + wrapper.mItemTop;
69
+				}
70
+			}
71
+		}
72
+	}
73
+
74
+	private int getSelectorPosition() {
75
+		if (mSelectorPositionField == null) { // not all supported andorid
76
+			// version have this variable
77
+			for (int i = 0; i < getChildCount(); i++) {
78
+				if (getChildAt(i).getBottom() == mSelectorRect.bottom) {
79
+					return i + getFixedFirstVisibleItem();
80
+				}
81
+			}
82
+		} else {
83
+			try {
84
+				return mSelectorPositionField.getInt(this);
85
+			} catch (IllegalArgumentException e) {
86
+				e.printStackTrace();
87
+			} catch (IllegalAccessException e) {
88
+				e.printStackTrace();
89
+			}
90
+		}
91
+		return -1;
92
+	}
93
+
94
+	@Override
95
+	protected void dispatchDraw(Canvas canvas) {
96
+		positionSelectorRect();
97
+		if (mTopClippingLength != 0) {
98
+			canvas.save();
99
+			Rect clipping = canvas.getClipBounds();
100
+			clipping.top = mTopClippingLength;
101
+			canvas.clipRect(clipping);
102
+			super.dispatchDraw(canvas);
103
+			canvas.restore();
104
+		} else {
105
+			super.dispatchDraw(canvas);
106
+		}
107
+		mLifeCycleListener.onDispatchDrawOccurred(canvas);
108
+	}
109
+
110
+	void setLifeCycleListener(LifeCycleListener lifeCycleListener) {
111
+		mLifeCycleListener = lifeCycleListener;
112
+	}
113
+
114
+	@Override
115
+	public void addFooterView(View v) {
116
+		super.addFooterView(v);
117
+		addInternalFooterView(v);
118
+	}
119
+
120
+	@Override
121
+	public void addFooterView(View v, Object data, boolean isSelectable) {
122
+		super.addFooterView(v, data, isSelectable);
123
+		addInternalFooterView(v);
124
+	}
125
+
126
+	private void addInternalFooterView(View v) {
127
+		if (mFooterViews == null) {
128
+			mFooterViews = new ArrayList<View>();
129
+		}
130
+		mFooterViews.add(v);
131
+	}
132
+
133
+	@Override
134
+	public boolean removeFooterView(View v) {
135
+		if (super.removeFooterView(v)) {
136
+			mFooterViews.remove(v);
137
+			return true;
138
+		}
139
+		return false;
140
+	}
141
+
142
+	boolean containsFooterView(View v) {
143
+		if (mFooterViews == null) {
144
+			return false;
145
+		}
146
+		return mFooterViews.contains(v);
147
+	}
148
+
149
+	void setTopClippingLength(int topClipping) {
150
+		mTopClippingLength = topClipping;
151
+	}
152
+
153
+	int getFixedFirstVisibleItem() {
154
+		int firstVisibleItem = getFirstVisiblePosition();
155
+		if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
156
+			return firstVisibleItem;
157
+		}
158
+
159
+		// first getFirstVisiblePosition() reports items
160
+		// outside the view sometimes on old versions of android
161
+		for (int i = 0; i < getChildCount(); i++) {
162
+			if (getChildAt(i).getBottom() >= 0) {
163
+				firstVisibleItem += i;
164
+				break;
165
+			}
166
+		}
167
+
168
+		// work around to fix bug with firstVisibleItem being to high
169
+		// because list view does not take clipToPadding=false into account
170
+		// on old versions of android
171
+		if (!mClippingToPadding && getPaddingTop() > 0 && firstVisibleItem > 0) {
172
+			if (getChildAt(0).getTop() > 0) {
173
+				firstVisibleItem -= 1;
174
+			}
175
+		}
176
+
177
+		return firstVisibleItem;
178
+	}
179
+
180
+	@Override
181
+	public void setClipToPadding(boolean clipToPadding) {
182
+		mClippingToPadding = clipToPadding;
183
+		super.setClipToPadding(clipToPadding);
184
+	}
185
+
186
+    public void setBlockLayoutChildren(boolean block) {
187
+        mBlockLayoutChildren = block;
188
+    }
189
+
190
+    @Override
191
+    protected void layoutChildren() {
192
+        if (!mBlockLayoutChildren) {
193
+            super.layoutChildren();
194
+        }
195
+    }
196
+}

+ 34 - 0
views/src/main/res/values/attrs.xml

@@ -87,4 +87,38 @@
87 87
     </declare-styleable>
88 88
 
89 89
     <attr name="SwipeBackLayoutStyle" format="reference"/>
90
+
91
+    <declare-styleable name="StickyListHeadersListView">
92
+        <attr name="stickyListHeadersListViewStyle" format="reference"/>
93
+
94
+        <!-- View attributes -->
95
+        <attr name="android:clipToPadding" />
96
+        <attr name="android:scrollbars" />
97
+        <attr name="android:overScrollMode" />
98
+        <attr name="android:padding" />
99
+        <attr name="android:paddingLeft" />
100
+        <attr name="android:paddingTop" />
101
+        <attr name="android:paddingRight" />
102
+        <attr name="android:paddingBottom" />
103
+
104
+        <!-- ListView attributes -->
105
+        <attr name="android:fadingEdgeLength" />
106
+        <attr name="android:requiresFadingEdge" />
107
+        <attr name="android:cacheColorHint" />
108
+        <attr name="android:choiceMode" />
109
+        <attr name="android:drawSelectorOnTop" />
110
+        <attr name="android:fastScrollEnabled" />
111
+        <attr name="android:fastScrollAlwaysVisible" />
112
+        <attr name="android:listSelector" />
113
+        <attr name="android:scrollingCache" />
114
+        <attr name="android:scrollbarStyle" />
115
+        <attr name="android:divider" />
116
+        <attr name="android:dividerHeight" />
117
+        <attr name="android:transcriptMode" />
118
+        <attr name="android:stackFromBottom" />
119
+
120
+        <!-- StickyListHeaders attributes -->
121
+        <attr name="hasStickyHeaders" format="boolean" />
122
+        <attr name="isDrawingListUnderStickyHeader" format="boolean" />
123
+    </declare-styleable>
90 124
 </resources>

kodo - Gogs: Go Git Service

暫無描述

joinus.html 2.6KB

    <!doctype html> <html> <head> <meta charset="UTF-8"> <title>拍爱 PAI.AI 加入拍爱</title> <meta name="keywords" content="摄影 图片 影像 分享 交流 社交 交友 摄影师 女性 孩子 亲子 旅行 旅游 约拍 iphone android app" /> <link href="css/layout.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="js/jquery.min.js"></script> </head> <body> <div id="header"> <div class="content"> <a href="index.html" target="_self" class="logo"></a> <div class="navigation"> <a href="contactus.html" target="_self" >联系我们</a> <a href="joinus.html" target="_self" class="current" >加入拍爱</a> <a href="aboutus.html" target="_self" >关于我们</a> <a href="index.html" target="_self" >首页</a> </div> </div> </div> <div id="container" ><div class="content joinus"> <p> 在我们这里,你可以参与到一个火热的创业项目,未来很有可能看到自己作品满大街的人都在使用...如果您喜欢摄影...除了会有各种相机把玩,还会有同好可以畅聊...最重要的,你还会发现...... 你将成为——软件工程师中最懂摄影的人 来和我们一起做一份激动人心的事业吧 </p> <p> <strong>职位名称:iOS软件工程师</strong><br> <strong>岗位职责:</strong><br> 负责iOS平台下应用的开发<br> <strong>任职要求:</strong><br> 1、至少1年的iOS平台开发经验;<br> 2、具备扎实的数据结构、算法等技术功底;<br> 3、具备良好的编程风格与团队合作意识,可承担较大的工作压力;<br> 4、正直、优秀、有上进心,经验丰富的同时没有丧失开发NB产品的热情;<br> 5、年轻;<br> 6、期待您喜欢摄影,喜欢相机;<br> </p> <p> <strong>职位名称:专利工程师</strong><br> <strong>岗位职责:</strong><br> 1、撰写高质量的专利申请文件、答复审查意见;<br> 2、专利检索咨询、专利挖掘、以及撰写专利分析报告。<br> <strong>任职要求:</strong><br> 1、具有一年以上独立撰写专利文件经验,熟悉专利申请相关知识;<br> 2、理工科,大学本科以上毕业,物理、数学、电子、通讯、互联网等技术专业背景之一;<br> 3、有专利代理人资格证优先考虑;<br> 4、期待您喜欢摄影,喜欢相机; </p> </div></div> <div id="footer"> <div class="content foot"> <a href="aboutus.html" target="_self" >关于我们</a> <span>|</span> <a href="contactus.html" target="_self" >联系我们</a> ©2016 拍爱 PAI.AI 琼ICP备16000076号 </div> </div> </body> </html>