49
+
50
+    @Override
51
+    public int i(String tag, String msg, Throwable tr) {
52
+        return Log.i(tag, msg, tr);
53
+    }
54
+
55
+    @Override
56
+    public int w(String tag, String msg) {
57
+        return Log.w(tag, msg);
58
+    }
59
+
60
+    @Override
61
+    public int w(String tag, String msg, Throwable tr) {
62
+        return Log.w(tag, msg, tr);
63
+    }
64
+
65
+    @Override
66
+    public int e(String tag, String msg) {
67
+        return Log.e(tag, msg);
68
+    }
69
+
70
+    @Override
71
+    public int e(String tag, String msg, Throwable tr) {
72
+        return Log.e(tag, msg, tr);
73
+    }
74
+
75
+
76
+}

+ 61 - 0
views/src/main/java/com/android/views/rotatephotoview/scrollerproxy/GingerScroller.java

@@ -0,0 +1,61 @@
1
+/*******************************************************************************
2
+ * Copyright 2011, 2012 Chris Banes.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ *******************************************************************************/
16
+package com.android.views.rotatephotoview.scrollerproxy;
17
+
18
+import android.annotation.TargetApi;
19
+import android.content.Context;
20
+import android.widget.OverScroller;
21
+
22
+@TargetApi(9)
23
+public class GingerScroller extends ScrollerProxy {
24
+
25
+    protected final OverScroller mScroller;
26
+
27
+    public GingerScroller(Context context) {
28
+        mScroller = new OverScroller(context);
29
+    }
30
+
31
+    @Override
32
+    public boolean computeScrollOffset() {
33
+        return mScroller.computeScrollOffset();
34
+    }
35
+
36
+    @Override
37
+    public void fling(int startX, int startY, int velocityX, int velocityY, int minX, int maxX, int minY, int maxY,
38
+                      int overX, int overY) {
39
+        mScroller.fling(startX, startY, velocityX, velocityY, minX, maxX, minY, maxY, overX, overY);
40
+    }
41
+
42
+    @Override
43
+    public void forceFinished(boolean finished) {
44
+        mScroller.forceFinished(finished);
45
+    }
46
+
47
+    @Override
48
+    public boolean isFinished() {
49
+        return mScroller.isFinished();
50
+    }
51
+
52
+    @Override
53
+    public int getCurrX() {
54
+        return mScroller.getCurrX();
55
+    }
56
+
57
+    @Override
58
+    public int getCurrY() {
59
+        return mScroller.getCurrY();
60
+    }
61
+}

+ 33 - 0
views/src/main/java/com/android/views/rotatephotoview/scrollerproxy/IcsScroller.java

@@ -0,0 +1,33 @@
1
+/*******************************************************************************
2
+ * Copyright 2011, 2012 Chris Banes.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ *******************************************************************************/
16
+package com.android.views.rotatephotoview.scrollerproxy;
17
+
18
+import android.annotation.TargetApi;
19
+import android.content.Context;
20
+
21
+@TargetApi(14)
22
+public class IcsScroller extends GingerScroller {
23
+
24
+    public IcsScroller(Context context) {
25
+        super(context);
26
+    }
27
+
28
+    @Override
29
+    public boolean computeScrollOffset() {
30
+        return mScroller.computeScrollOffset();
31
+    }
32
+
33
+}

+ 58 - 0
views/src/main/java/com/android/views/rotatephotoview/scrollerproxy/PreGingerScroller.java

@@ -0,0 +1,58 @@
1
+/*******************************************************************************
2
+ * Copyright 2011, 2012 Chris Banes.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ *******************************************************************************/
16
+package com.android.views.rotatephotoview.scrollerproxy;
17
+
18
+import android.content.Context;
19
+import android.widget.Scroller;
20
+
21
+public class PreGingerScroller extends ScrollerProxy {
22
+
23
+    private final Scroller mScroller;
24
+
25
+    public PreGingerScroller(Context context) {
26
+        mScroller = new Scroller(context);
27
+    }
28
+
29
+    @Override
30
+    public boolean computeScrollOffset() {
31
+        return mScroller.computeScrollOffset();
32
+    }
33
+
34
+    @Override
35
+    public void fling(int startX, int startY, int velocityX, int velocityY, int minX, int maxX, int minY, int maxY,
36
+                      int overX, int overY) {
37
+        mScroller.fling(startX, startY, velocityX, velocityY, minX, maxX, minY, maxY);
38
+    }
39
+
40
+    @Override
41
+    public void forceFinished(boolean finished) {
42
+        mScroller.forceFinished(finished);
43
+    }
44
+
45
+    public boolean isFinished() {
46
+        return mScroller.isFinished();
47
+    }
48
+
49
+    @Override
50
+    public int getCurrX() {
51
+        return mScroller.getCurrX();
52
+    }
53
+
54
+    @Override
55
+    public int getCurrY() {
56
+        return mScroller.getCurrY();
57
+    }
58
+}

+ 48 - 0
views/src/main/java/com/android/views/rotatephotoview/scrollerproxy/ScrollerProxy.java

@@ -0,0 +1,48 @@
1
+/*******************************************************************************
2
+ * Copyright 2011, 2012 Chris Banes.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ *******************************************************************************/
16
+package com.android.views.rotatephotoview.scrollerproxy;
17
+
18
+import android.content.Context;
19
+import android.os.Build.VERSION;
20
+import android.os.Build.VERSION_CODES;
21
+
22
+public abstract class ScrollerProxy {
23
+
24
+    public static ScrollerProxy getScroller(Context context) {
25
+        if (VERSION.SDK_INT < VERSION_CODES.GINGERBREAD) {
26
+            return new PreGingerScroller(context);
27
+        } else if (VERSION.SDK_INT < VERSION_CODES.ICE_CREAM_SANDWICH) {
28
+            return new GingerScroller(context);
29
+        } else {
30
+            return new IcsScroller(context);
31
+        }
32
+    }
33
+
34
+    public abstract boolean computeScrollOffset();
35
+
36
+    public abstract void fling(int startX, int startY, int velocityX, int velocityY, int minX, int maxX, int minY,
37
+                               int maxY, int overX, int overY);
38
+
39
+    public abstract void forceFinished(boolean finished);
40
+
41
+    public abstract boolean isFinished();
42
+
43
+    public abstract int getCurrX();
44
+
45
+    public abstract int getCurrY();
46
+
47
+
48
+}

update jswe.js · 48c5514e05 - Gogs: Go Git Service

update jswe.js

Brightcells 9 年之前
父节点
当前提交
48c5514e05
共有 1 个文件被更改,包括 8 次插入5 次删除
  1. 8 5
      pai2/static/pai2/js/jswe.js

+ 8 - 5
pai2/static/pai2/js/jswe.js

@@ -1,6 +1,7 @@
1 1
 !(function(e, t) {
2 2
     var config = {
3
-        wxconfig: 'http://api.pai.ai/wx/jsapi_signature'
3
+        wxconfig: 'http://api.pai.ai/wx/jsapi_signature',
4
+        callback: 'callback'
4 5
     }, wxData = {
5 6
         debug: false,
6 7
         imgUrl: '',
@@ -86,6 +87,7 @@
86 87
     }
87 88
 
88 89
     function wxReady(data) {
90
+        data = typeof data === 'object' ? data : JSON.parse(data)
89 91
         wx.config({
90 92
             debug: wxData.debug,
91 93
             appId: data.appId,
@@ -148,11 +150,12 @@
148 150
     }
149 151
 
150 152
     if (isOpenInWeixin() || isOpenOnPC()) {
153
+        if ('undefined' !== typeof JSWE_CONF_UPDATE) JSWE_CONF_UPDATE(config)
151 154
         $.ajax({
152 155
             url: config.wxconfig,
153 156
             type: 'get',
154 157
             dataType: 'jsonp',
155
-            jsonpCallback: 'callback',
158
+            jsonpCallback: config.callback,
156 159
             data: {
157 160
                 url: window.location.href.split('#')[0]
158 161
             },
@@ -166,7 +169,7 @@
166 169
     }
167 170
 
168 171
     function changeWxData(key, value, flag) {
169
-        if (key in falDwxDataata) wxData[key] = value
172
+        if (key in falDwxDataata) {wxData[key] = value}
170 173
         if (flag) fixedWxData()
171 174
     }
172 175
 
@@ -175,7 +178,7 @@
175 178
     }
176 179
 
177 180
     var v = {
178
-        version: '1.0.0',
181
+        version: '1.0.5',
179 182
 
180 183
         // Basic Vars
181 184
         config: config,
@@ -198,4 +201,4 @@
198 201
         fixedWxData: fixedWxData
199 202
     }
200 203
     e.JSWE = e.V = v
201
-})(window)
204
+})(window)