();
21 |
22 | public void fromJson(JSONObject jsonObject) throws JSONException
23 | {
24 | if(null == jsonObject){
25 | return ;
26 | }
27 |
28 | JSONArray subItemArray;
29 |
30 | this.total_number = jsonObject.optInt("total_number");
31 |
32 | subItemArray = jsonObject.optJSONArray("statuses");
33 | if(null != subItemArray)
34 | {
35 | for(int i = 0;i < subItemArray.length();i++)
36 | {
37 | JSONObject subItemObject = subItemArray.getJSONObject(i);
38 | STATUSES subItem = new STATUSES();
39 | subItem.fromJson(subItemObject);
40 | this.statuses.add(subItem);
41 | }
42 | }
43 |
44 | return ;
45 | }
46 |
47 | public JSONObject toJson() throws JSONException
48 | {
49 | JSONObject localItemObject = new JSONObject();
50 | JSONArray itemJSONArray = new JSONArray();
51 | localItemObject.put("total_number", total_number);
52 |
53 | for(int i =0; i< statuses.size(); i++)
54 | {
55 | STATUSES itemData =statuses.get(i);
56 | JSONObject itemJSONObject = itemData.toJson();
57 | itemJSONArray.put(itemJSONObject);
58 | }
59 | localItemObject.put("statuses", itemJSONArray);
60 | return localItemObject;
61 | }
62 |
63 | }
64 |
--------------------------------------------------------------------------------
/src/com/external/viewpagerindicator/PageIndicator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011 Patrik Akerfeldt
3 | * Copyright (C) 2011 Jake Wharton
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | package com.external.viewpagerindicator;
19 |
20 | import android.support.v4.view.ViewPager;
21 |
22 | /**
23 | * A PageIndicator is responsible to show an visual indicator on the total views
24 | * number and the current visible view.
25 | */
26 | public interface PageIndicator extends ViewPager.OnPageChangeListener {
27 | /**
28 | * Bind the indicator to a ViewPager.
29 | *
30 | * @param view
31 | */
32 | void setViewPager(ViewPager view);
33 |
34 | /**
35 | * Bind the indicator to a ViewPager.
36 | *
37 | * @param view
38 | * @param initialPosition
39 | */
40 | void setViewPager(ViewPager view, int initialPosition);
41 |
42 | /**
43 | * Set the current page of both the ViewPager and indicator.
44 | *
45 | * This must be used if you need to set the page before
46 | * the views are drawn on screen (e.g., default start page).
47 | *
48 | * @param item
49 | */
50 | void setCurrentItem(int item);
51 |
52 | /**
53 | * Set a page change listener which will receive forwarded events.
54 | *
55 | * @param listener
56 | */
57 | void setOnPageChangeListener(ViewPager.OnPageChangeListener listener);
58 |
59 | /**
60 | * Notify the indicator that the fragment list has changed.
61 | */
62 | void notifyDataSetChanged();
63 | }
64 |
--------------------------------------------------------------------------------
/res/values/vpi__styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
18 |
22 |
23 |
25 |
26 |
37 |
38 |
42 |
43 |
47 |
48 |
--------------------------------------------------------------------------------
/src/com/BeeFramework/model/MockServer.java:
--------------------------------------------------------------------------------
1 | package com.BeeFramework.model;
2 |
3 | import com.external.androidquery.callback.AjaxCallback;
4 | import org.json.JSONObject;
5 |
6 | /*
7 | * ______ ______ ______
8 | * /\ __ \ /\ ___\ /\ ___\
9 | * \ \ __< \ \ __\_ \ \ __\_
10 | * \ \_____\ \ \_____\ \ \_____\
11 | * \/_____/ \/_____/ \/_____/
12 | *
13 | *
14 | * Copyright (c) 2013-2014, {Bee} open source community
15 | * http://www.bee-framework.com
16 | *
17 | *
18 | * Permission is hereby granted, free of charge, to any person obtaining a
19 | * copy of this software and associated documentation files (the "Software"),
20 | * to deal in the Software without restriction, including without limitation
21 | * the rights to use, copy, modify, merge, publish, distribute, sublicense,
22 | * and/or sell copies of the Software, and to permit persons to whom the
23 | * Software is furnished to do so, subject to the following conditions:
24 | *
25 | * The above copyright notice and this permission notice shall be included in
26 | * all copies or substantial portions of the Software.
27 | *
28 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
29 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
30 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
31 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
32 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
33 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
34 | * IN THE SOFTWARE.
35 | */
36 |
37 | public class MockServer
38 | {
39 | private static MockServer instance;
40 | public static MockServer getInstance()
41 | {
42 | if (instance == null) {
43 | instance = new MockServer();
44 | }
45 | return instance;
46 | }
47 |
48 | public static void ajax(AjaxCallback callback)
49 | {
50 | JSONObject responseJsonObject = new JSONObject();
51 |
52 | ((BeeCallback)callback).callback(callback.getUrl(), responseJsonObject, callback.getStatus());
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/src/com/external/HorizontalVariableListView/widget/HorizontalListView.java:
--------------------------------------------------------------------------------
1 | package com.external.HorizontalVariableListView.widget;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 | import android.view.View;
6 | import android.widget.AdapterView;
7 | import android.widget.ListAdapter;
8 |
9 | public abstract class HorizontalListView extends AdapterView {
10 |
11 | public HorizontalListView( Context context ) {
12 | super( context );
13 | }
14 |
15 | public HorizontalListView( Context context, AttributeSet attrs ) {
16 | super( context, attrs );
17 | }
18 |
19 | public HorizontalListView( Context context, AttributeSet attrs, int defStyle ) {
20 | super( context, attrs, defStyle );
21 | }
22 |
23 | public abstract int getScreenPositionForView( View view );
24 |
25 |
26 | /**
27 | * Interface definition for a callback to be invoked when an item in this view has been clicked and held.
28 | */
29 | public interface OnItemDragListener {
30 |
31 | /**
32 | * Callback method to be invoked when an item in this view has been dragged outside the vertical tolerance area.
33 | *
34 | * Implementers can call getItemAtPosition(position) if they need to access the data associated with the selected item.
35 | *
36 | * @param parent
37 | * The AbsListView where the click happened
38 | * @param view
39 | * The view within the AbsListView that was clicked
40 | * @param position
41 | * The position of the view in the list
42 | * @param id
43 | * The row id of the item that was clicked
44 | *
45 | * @return true if the callback consumed the long click, false otherwise
46 | */
47 | boolean onItemStartDrag( AdapterView> parent, View view, int position, long id );
48 | }
49 |
50 | public interface OnLayoutChangeListener {
51 | void onLayoutChange( boolean changed, int left, int top, int right, int bottom );
52 | }
53 |
54 | public interface OnScrollFinishedListener {
55 | /**
56 | * Callback method to be invoked when the scroll has completed.
57 | *
58 | * @param currentX
59 | * The current scroll position of the view
60 | */
61 | void onScrollFinished( int currentX );
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/src/com/external/imagezoom/easing/Elastic.java:
--------------------------------------------------------------------------------
1 | package com.external.imagezoom.easing;
2 |
3 | public class Elastic implements Easing {
4 |
5 | @Override
6 | public double easeIn( double time, double start, double end, double duration ) {
7 | return easeIn( time, start, end, duration, start + end, duration );
8 | }
9 |
10 | public double easeIn( double t, double b, double c, double d, double a, double p ) {
11 | double s;
12 | if ( t == 0 ) return b;
13 | if ( ( t /= d ) == 1 ) return b + c;
14 | if ( !( p > 0 ) ) p = d * .3;
15 | if ( !( a > 0 ) || a < Math.abs( c ) ) {
16 | a = c;
17 | s = p / 4;
18 | } else
19 | s = p / ( 2 * Math.PI ) * Math.asin( c / a );
20 | return -( a * Math.pow( 2, 10 * ( t -= 1 ) ) * Math.sin( ( t * d - s ) * ( 2 * Math.PI ) / p ) ) + b;
21 | }
22 |
23 | @Override
24 | public double easeOut( double time, double start, double end, double duration ) {
25 | return easeOut( time, start, end, duration, start + end, duration );
26 | }
27 |
28 | public double easeOut( double t, double b, double c, double d, double a, double p ) {
29 | double s;
30 | if ( t == 0 ) return b;
31 | if ( ( t /= d ) == 1 ) return b + c;
32 | if ( !( p > 0 ) ) p = d * .3;
33 | if ( !( a > 0 ) || a < Math.abs( c ) ) {
34 | a = c;
35 | s = p / 4;
36 | } else
37 | s = p / ( 2 * Math.PI ) * Math.asin( c / a );
38 | return ( a * Math.pow( 2, -10 * t ) * Math.sin( ( t * d - s ) * ( 2 * Math.PI ) / p ) + c + b );
39 | }
40 |
41 | @Override
42 | public double easeInOut( double t, double b, double c, double d ) {
43 | return easeInOut( t, b, c, d, b + c, d );
44 | }
45 |
46 | public double easeInOut( double t, double b, double c, double d, double a, double p ) {
47 | double s;
48 |
49 | if ( t == 0 ) return b;
50 | if ( ( t /= d / 2 ) == 2 ) return b + c;
51 | if ( !( p > 0 ) ) p = d * ( .3 * 1.5 );
52 | if ( !( a > 0 ) || a < Math.abs( c ) ) {
53 | a = c;
54 | s = p / 4;
55 | } else
56 | s = p / ( 2 * Math.PI ) * Math.asin( c / a );
57 | if ( t < 1 ) return -.5 * ( a * Math.pow( 2, 10 * ( t -= 1 ) ) * Math.sin( ( t * d - s ) * ( 2 * Math.PI ) / p ) ) + b;
58 | return a * Math.pow( 2, -10 * ( t -= 1 ) ) * Math.sin( ( t * d - s ) * ( 2 * Math.PI ) / p ) * .5 + c + b;
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/src/com/external/activeandroid/query/Join.java:
--------------------------------------------------------------------------------
1 | package com.external.activeandroid.query;
2 |
3 | /*
4 | * Copyright (C) 2010 Michael Pardo
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | import android.text.TextUtils;
20 | import com.external.activeandroid.Cache;
21 | import com.external.activeandroid.Model;
22 |
23 | public final class Join implements Sqlable {
24 | static enum JoinType {
25 | LEFT, OUTER, INNER, CROSS
26 | }
27 |
28 | private From mFrom;
29 | private Class extends Model> mType;
30 | private String mAlias;
31 | private JoinType mJoinType;
32 | private String mOn;
33 | private String[] mUsing;
34 |
35 | Join(From from, Class extends Model> table, JoinType joinType) {
36 | mFrom = from;
37 | mType = table;
38 | mJoinType = joinType;
39 | }
40 |
41 | public Join as(String alias) {
42 | mAlias = alias;
43 | return this;
44 | }
45 |
46 | public From on(String on) {
47 | mOn = on;
48 | return mFrom;
49 | }
50 |
51 | public From on(String on, Object... args) {
52 | mOn = on;
53 | mFrom.addArguments(args);
54 | return mFrom;
55 | }
56 |
57 | public From using(String... columns) {
58 | mUsing = columns;
59 | return mFrom;
60 | }
61 |
62 | @Override
63 | public String toSql() {
64 | String sql = "";
65 |
66 | if (mJoinType != null) {
67 | sql += mJoinType.toString() + " ";
68 | }
69 |
70 | sql += "JOIN " + Cache.getTableName(mType) + " ";
71 |
72 | if (mAlias != null) {
73 | sql += "AS " + mAlias + " ";
74 | }
75 |
76 | if (mOn != null) {
77 | sql += "ON " + mOn + " ";
78 | }
79 | else if (mUsing != null) {
80 | sql += "USING (" + TextUtils.join(", ", mUsing) + ") ";
81 | }
82 |
83 | return sql;
84 | }
85 | }
--------------------------------------------------------------------------------
/src/com/external/eventbus/PendingPost.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2012 Markus Junginger, greenrobot (http://greenrobot.de)
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.external.eventbus;
17 |
18 | import java.util.ArrayList;
19 | import java.util.List;
20 |
21 | final class PendingPost {
22 | private final static List pendingPostPool = new ArrayList();
23 |
24 | Object event;
25 | Subscription subscription;
26 | PendingPost next;
27 |
28 | private PendingPost(Object event, Subscription subscription) {
29 | this.event = event;
30 | this.subscription = subscription;
31 | }
32 |
33 | static PendingPost obtainPendingPost(Subscription subscription, Object event) {
34 | synchronized (pendingPostPool) {
35 | int size = pendingPostPool.size();
36 | if (size > 0) {
37 | PendingPost pendingPost = pendingPostPool.remove(size - 1);
38 | pendingPost.event = event;
39 | pendingPost.subscription = subscription;
40 | pendingPost.next = null;
41 | return pendingPost;
42 | }
43 | }
44 | return new PendingPost(event, subscription);
45 | }
46 |
47 | static void releasePendingPost(PendingPost pendingPost) {
48 | pendingPost.event = null;
49 | pendingPost.subscription = null;
50 | pendingPost.next = null;
51 | synchronized (pendingPostPool) {
52 | // Don't let the pool grow indefinitely
53 | if (pendingPostPool.size() < 10000) {
54 | pendingPostPool.add(pendingPost);
55 | }
56 | }
57 | }
58 |
59 | }
--------------------------------------------------------------------------------
/res/drawable/vpi__tab_indicator.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/res/layout/shot_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
11 |
14 |
18 |
22 |
25 |
29 |
30 |
34 |
37 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/res/layout/debug_message_detail.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
20 |
21 |
29 |
30 |
38 |
39 |
48 |
49 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/src/com/BeeFramework/AppConst.java:
--------------------------------------------------------------------------------
1 | package com.BeeFramework;
2 |
3 | /*
4 | * ______ ______ ______
5 | * /\ __ \ /\ ___\ /\ ___\
6 | * \ \ __< \ \ __\_ \ \ __\_
7 | * \ \_____\ \ \_____\ \ \_____\
8 | * \/_____/ \/_____/ \/_____/
9 | *
10 | *
11 | * Copyright (c) 2013-2014, {Bee} open source community
12 | * http://www.bee-framework.com
13 | *
14 | *
15 | * Permission is hereby granted, free of charge, to any person obtaining a
16 | * copy of this software and associated documentation files (the "Software"),
17 | * to deal in the Software without restriction, including without limitation
18 | * the rights to use, copy, modify, merge, publish, distribute, sublicense,
19 | * and/or sell copies of the Software, and to permit persons to whom the
20 | * Software is furnished to do so, subject to the following conditions:
21 | *
22 | * The above copyright notice and this permission notice shall be included in
23 | * all copies or substantial portions of the Software.
24 | *
25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
28 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
30 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
31 | * IN THE SOFTWARE.
32 | */
33 | public class AppConst {
34 |
35 | public static final String TAG = "BeeFramework";
36 | public static final int BALL_COLOR_RED = 0;
37 | public static final int BALL_COLOR_BLUE = 0;
38 | public static final Boolean DEBUG = true;
39 | /** 下载图片保存目录 */
40 | public static final String PIC_DIR_PATH = "/BeeFramework/pic";
41 | /** 允许发送的最大字数 */
42 | public static final int MAX_CONTENT_LEN = 140;
43 |
44 | public static final int RESULT_PHOTO_PREVIEW = 2;
45 |
46 |
47 | /** 程序运行期间产生的文件,缓存根目录 */
48 | public static final String ROOT_DIR_PATH = "/BeeFramework/cache";
49 | /** 缓存文件保存的根目录 */
50 | public static final String CACHE_DIR_PATH = ROOT_DIR_PATH + "/file";
51 | public static final String LOG_DIR_PATH = ROOT_DIR_PATH + "log";
52 |
53 | public static final String SINA_KEY = "804874423";
54 | }
55 |
--------------------------------------------------------------------------------
/src/com/external/eventbus/SubscriberMethod.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2012 Markus Junginger, greenrobot (http://greenrobot.de)
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.external.eventbus;
17 |
18 | import java.lang.reflect.Method;
19 |
20 | final class SubscriberMethod {
21 | final Method method;
22 | final ThreadMode threadMode;
23 | final Class> eventType;
24 | /** Used for efficient comparison */
25 | String methodString;
26 |
27 | SubscriberMethod(Method method, ThreadMode threadMode, Class> eventType) {
28 | this.method = method;
29 | this.threadMode = threadMode;
30 | this.eventType = eventType;
31 | }
32 |
33 | @Override
34 | public boolean equals(Object other) {
35 | if (other instanceof SubscriberMethod) {
36 | checkMethodString();
37 | // Don't use method.equals because of http://code.google.com/p/android/issues/detail?id=7811#c6
38 | return methodString.equals(((SubscriberMethod) other).methodString);
39 | } else {
40 | return false;
41 | }
42 | }
43 |
44 | private synchronized void checkMethodString() {
45 | if (methodString == null) {
46 | // Method.toString has more overhead, just take relevant parts of the method
47 | StringBuilder builder = new StringBuilder(64);
48 | builder.append(method.getDeclaringClass().getName());
49 | builder.append('#').append(method.getName());
50 | builder.append('(').append(eventType.getName());
51 | methodString = builder.toString();
52 | }
53 | }
54 |
55 | @Override
56 | public int hashCode() {
57 | return method.hashCode();
58 | }
59 | }
--------------------------------------------------------------------------------
/src/com/BeeFramework/model/BeeQuery.java:
--------------------------------------------------------------------------------
1 | package com.BeeFramework.model;
2 |
3 | import android.content.Context;
4 | import com.external.androidquery.AQuery;
5 | import com.external.androidquery.callback.AjaxCallback;
6 |
7 | import java.util.Map;
8 |
9 |
10 | public class BeeQuery extends AQuery {
11 | public BeeQuery(Context context) {
12 | super(context);
13 | // TODO Auto-generated constructor stub
14 | }
15 |
16 | public static final int ENVIRONMENT_PRODUCTION = 1;
17 | public static final int ENVIROMENT_DEVELOPMENT = 2;
18 | public static final int ENVIROMENT_MOCKSERVER = 3;
19 |
20 | public static int environment()
21 | {
22 | return ENVIROMENT_DEVELOPMENT;
23 | }
24 |
25 | public static String serviceUrl()
26 | {
27 | if (ENVIRONMENT_PRODUCTION == BeeQuery.environment())
28 | {
29 | return "http://api.dribbble.com";
30 | }
31 | else
32 | {
33 | return "http://api.dribbble.com";
34 | }
35 | }
36 | public AQuery ajax(AjaxCallback callback){
37 |
38 | if (BeeQuery.environment() == BeeQuery.ENVIROMENT_MOCKSERVER)
39 | {
40 | MockServer.ajax(callback);
41 | return null;
42 | }
43 | else
44 | {
45 | String url = callback.getUrl();
46 | String absoluteUrl = getAbsoluteUrl(url);
47 |
48 | callback.url(absoluteUrl);
49 |
50 | }
51 |
52 | if(BeeQuery.environment() == BeeQuery.ENVIROMENT_DEVELOPMENT)
53 | {
54 | DebugMessageModel.addMessage((BeeCallback)callback);
55 | }
56 |
57 | return (BeeQuery)super.ajax(callback);
58 | }
59 |
60 | public AQuery ajaxAbsolute(AjaxCallback callback){
61 |
62 | return (BeeQuery)super.ajax(callback);
63 | }
64 |
65 | public AQuery ajax(String url, Map params, Class type, BeeCallback callback){
66 |
67 | callback.type(type).url(url).params(params);
68 |
69 | if (BeeQuery.environment() == BeeQuery.ENVIROMENT_MOCKSERVER)
70 | {
71 | MockServer.ajax(callback);
72 | return null;
73 | }
74 | else
75 | {
76 | String absoluteUrl = getAbsoluteUrl(url);
77 | callback.url(absoluteUrl);
78 | }
79 | return ajax(callback);
80 | }
81 |
82 |
83 | public static String getAbsoluteUrl(String relativeUrl) {
84 | return BeeQuery.serviceUrl() + relativeUrl;
85 | }
86 | }
--------------------------------------------------------------------------------
/src/com/external/activeandroid/query/Select.java:
--------------------------------------------------------------------------------
1 | package com.external.activeandroid.query;
2 |
3 | /*
4 | * Copyright (C) 2010 Michael Pardo
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | import android.text.TextUtils;
20 | import com.external.activeandroid.Model;
21 |
22 | public final class Select implements Sqlable {
23 | private String[] mColumns;
24 | private boolean mDistinct = false;
25 | private boolean mAll = false;
26 |
27 | public Select() {
28 | }
29 |
30 | public Select(String... columns) {
31 | mColumns = columns;
32 | }
33 |
34 | public Select(Column... columns) {
35 | final int size = columns.length;
36 | mColumns = new String[size];
37 | for (int i = 0; i < size; i++) {
38 | mColumns[i] = columns[i].name + " AS " + columns[i].alias;
39 | }
40 | }
41 |
42 | public Select distinct() {
43 | mDistinct = true;
44 | mAll = false;
45 |
46 | return this;
47 | }
48 |
49 | public Select all() {
50 | mDistinct = false;
51 | mAll = true;
52 |
53 | return this;
54 | }
55 |
56 | public From from(Class extends Model> table) {
57 | return new From(table, this);
58 | }
59 |
60 | public static class Column {
61 | String name;
62 | String alias;
63 |
64 | public Column(String name, String alias) {
65 | this.name = name;
66 | this.alias = alias;
67 | }
68 | }
69 |
70 | @Override
71 | public String toSql() {
72 | StringBuilder sql = new StringBuilder();
73 |
74 | sql.append("SELECT ");
75 |
76 | if (mDistinct) {
77 | sql.append("DISTINCT ");
78 | }
79 | else if (mAll) {
80 | sql.append("ALL ");
81 | }
82 |
83 | if (mColumns != null && mColumns.length > 0) {
84 | sql.append(TextUtils.join(", ", mColumns) + " ");
85 | }
86 | else {
87 | sql.append("* ");
88 | }
89 |
90 | return sql.toString();
91 | }
92 | }
--------------------------------------------------------------------------------
/src/com/BeeFramework/view/ToastView.java:
--------------------------------------------------------------------------------
1 | package com.BeeFramework.view;
2 |
3 | import java.util.Timer;
4 | import java.util.TimerTask;
5 |
6 | import android.content.Context;
7 | import android.view.LayoutInflater;
8 | import android.view.View;
9 | import android.widget.TextView;
10 | import android.widget.Toast;
11 |
12 | import com.BeeFramework.example.R;
13 |
14 | public class ToastView {
15 |
16 | public static Toast toast;
17 | private int time;
18 | private Timer timer;
19 |
20 | public ToastView(Context context, String text) {
21 | LayoutInflater inflater = LayoutInflater.from(context);
22 | View view = inflater.inflate(R.layout.taost_view, null);
23 | TextView t = (TextView) view.findViewById(R.id.toast_text);
24 | t.setText(text);
25 | if(toast != null) {
26 | toast.cancel();
27 | }
28 | toast = new Toast(context);
29 | toast.setDuration(Toast.LENGTH_SHORT);
30 | toast.setView(view);
31 | }
32 |
33 | public ToastView(Context context, int text) {
34 | LayoutInflater inflater = LayoutInflater.from(context);
35 | View view = inflater.inflate(R.layout.taost_view, null);
36 | TextView t = (TextView) view.findViewById(R.id.toast_text);
37 | t.setText(text);
38 | if(toast != null) {
39 | toast.cancel();
40 | }
41 | toast = new Toast(context);
42 | toast.setDuration(Toast.LENGTH_SHORT);
43 | toast.setView(view);
44 | }
45 |
46 | //设置toast显示位置
47 | public void setGravity(int gravity, int xOffset, int yOffset) {
48 | //toast.setGravity(Gravity.CENTER, 0, 0); //居中显示
49 | toast.setGravity(gravity, xOffset, yOffset);
50 | }
51 |
52 | //设置toast显示时间
53 | public void setDuration(int duration) {
54 | toast.setDuration(duration);
55 | }
56 |
57 | //设置toast显示时间(自定义时间)
58 | public void setLongTime(int duration) {
59 | //toast.setDuration(duration);
60 | time = duration;
61 | timer = new Timer();
62 | timer.schedule(new TimerTask(){
63 | @Override
64 | public void run() {
65 | // TODO Auto-generated method stub
66 | if(time-1000 >= 0) {
67 | show();
68 | time= time - 1000;
69 | } else {
70 | timer.cancel();
71 | }
72 | }
73 | }, 0, 1000);
74 | }
75 |
76 | public void show() {
77 | toast.show();
78 | }
79 |
80 | public static void cancel() {
81 | if(toast != null) {
82 | toast.cancel();
83 | }
84 | }
85 |
86 | }
87 |
--------------------------------------------------------------------------------
/src/com/external/eventbus/util/ErrorDialogConfig.java:
--------------------------------------------------------------------------------
1 | package com.external.eventbus.util;
2 |
3 | import android.content.res.Resources;
4 | import android.util.Log;
5 | import com.external.eventbus.EventBus;
6 |
7 | public class ErrorDialogConfig {
8 | final Resources resources;
9 | final int defaultTitleId;
10 | final int defaultErrorMsgId;
11 | final ExceptionToResourceMapping mapping;
12 |
13 | EventBus eventBus;
14 | boolean logExceptions = true;
15 | String tagForLoggingExceptions;
16 | int defaultDialogIconId;
17 | Class> defaultEventTypeOnDialogClosed;
18 |
19 | public ErrorDialogConfig(Resources resources, int defaultTitleId, int defaultMsgId) {
20 | this.resources = resources;
21 | this.defaultTitleId = defaultTitleId;
22 | this.defaultErrorMsgId = defaultMsgId;
23 | mapping = new ExceptionToResourceMapping();
24 | }
25 |
26 | public ErrorDialogConfig addMapping(Class extends Throwable> clazz, int msgId) {
27 | mapping.addMapping(clazz, msgId);
28 | return this;
29 | }
30 |
31 | public int getMessageIdForThrowable(final Throwable throwable) {
32 | Integer resId = mapping.mapThrowable(throwable);
33 | if (resId != null) {
34 | return resId;
35 | } else {
36 | Log.d(EventBus.TAG, "No specific message ressource ID found for " + throwable);
37 | return defaultErrorMsgId;
38 | }
39 | }
40 |
41 | public void setDefaultDialogIconId(int defaultDialogIconId) {
42 | this.defaultDialogIconId = defaultDialogIconId;
43 | }
44 |
45 | public void setDefaultEventTypeOnDialogClosed(Class> defaultEventTypeOnDialogClosed) {
46 | this.defaultEventTypeOnDialogClosed = defaultEventTypeOnDialogClosed;
47 | }
48 |
49 | public void disableExceptionLogging() {
50 | logExceptions = false;
51 | }
52 |
53 | public void setTagForLoggingExceptions(String tagForLoggingExceptions) {
54 | this.tagForLoggingExceptions = tagForLoggingExceptions;
55 | }
56 |
57 | public void setEventBus(EventBus eventBus) {
58 | this.eventBus = eventBus;
59 | }
60 |
61 | /** eventBus!=null ? eventBus: EventBus.getDefault() */
62 | EventBus getEventBus() {
63 | return eventBus!=null ? eventBus: EventBus.getDefault();
64 | }
65 | }
--------------------------------------------------------------------------------
/res/layout/download_dialog.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
13 |
14 |
22 |
23 |
27 |
28 |
34 |
35 |
44 |
45 |
46 |
50 |
51 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/src/com/external/activeandroid/ActiveAndroid.java:
--------------------------------------------------------------------------------
1 | package com.external.activeandroid;
2 |
3 | /*
4 | * Copyright (C) 2010 Michael Pardo
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | import android.app.Application;
20 | import android.database.sqlite.SQLiteDatabase;
21 | import com.external.activeandroid.util.Log;
22 |
23 | public final class ActiveAndroid {
24 | //////////////////////////////////////////////////////////////////////////////////////
25 | // PUBLIC METHODS
26 | //////////////////////////////////////////////////////////////////////////////////////
27 |
28 | public synchronized static void initialize(Application application) {
29 | initialize(application, false);
30 | }
31 |
32 | public synchronized static void initialize(Application application, boolean loggingEnabled) {
33 | setLoggingEnabled(loggingEnabled);
34 | Cache.initialize(application);
35 | }
36 |
37 | public static void clearCache() {
38 | Cache.clear();
39 | }
40 |
41 | public static void dispose() {
42 | Cache.dispose();
43 | }
44 |
45 | public static void setLoggingEnabled(boolean enabled) {
46 | Log.setEnabled(enabled);
47 | }
48 |
49 | public synchronized static SQLiteDatabase getDatabase() {
50 | return Cache.openDatabase();
51 | }
52 |
53 | public static void beginTransaction() {
54 | Cache.openDatabase().beginTransaction();
55 | }
56 |
57 | public static void endTransaction() {
58 | Cache.openDatabase().endTransaction();
59 | }
60 |
61 | public static void setTransactionSuccessful() {
62 | Cache.openDatabase().setTransactionSuccessful();
63 | }
64 |
65 | public static boolean inTransaction() {
66 | return Cache.openDatabase().inTransaction();
67 | }
68 |
69 | public static void execSQL(String sql) {
70 | Cache.openDatabase().execSQL(sql);
71 | }
72 |
73 | public static void execSQL(String sql, Object[] bindArgs) {
74 | Cache.openDatabase().execSQL(sql, bindArgs);
75 | }
76 | }
--------------------------------------------------------------------------------
/res/layout/debug_message_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
21 |
22 |
30 |
31 |
41 |
42 |
52 |
53 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/src/com/BeeFramework/view/MyScrollView.java:
--------------------------------------------------------------------------------
1 | package com.BeeFramework.view;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 | import android.view.MotionEvent;
6 | import android.widget.ScrollView;
7 |
8 | /*
9 | * ______ ______ ______
10 | * /\ __ \ /\ ___\ /\ ___\
11 | * \ \ __< \ \ __\_ \ \ __\_
12 | * \ \_____\ \ \_____\ \ \_____\
13 | * \/_____/ \/_____/ \/_____/
14 | *
15 | *
16 | * Copyright (c) 2013-2014, {Bee} open source community
17 | * http://www.bee-framework.com
18 | *
19 | *
20 | * Permission is hereby granted, free of charge, to any person obtaining a
21 | * copy of this software and associated documentation files (the "Software"),
22 | * to deal in the Software without restriction, including without limitation
23 | * the rights to use, copy, modify, merge, publish, distribute, sublicense,
24 | * and/or sell copies of the Software, and to permit persons to whom the
25 | * Software is furnished to do so, subject to the following conditions:
26 | *
27 | * The above copyright notice and this permission notice shall be included in
28 | * all copies or substantial portions of the Software.
29 | *
30 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
31 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
32 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
33 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
34 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
35 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
36 | * IN THE SOFTWARE.
37 | */
38 | public class MyScrollView extends ScrollView{
39 | public MyScrollView(Context context, AttributeSet attrs) {
40 | super(context, attrs);
41 | requestDisallowInterceptTouchEvent(true);
42 | }
43 |
44 | @Override
45 | public boolean onTouchEvent(MotionEvent ev) {
46 |
47 | final int action = ev.getAction();
48 | if (action == MotionEvent.ACTION_UP)
49 | {
50 | int l = 0;
51 | }
52 | return super.onTouchEvent(ev);
53 | }
54 |
55 | @Override
56 | public boolean onInterceptTouchEvent(MotionEvent ev) {
57 | final int action = ev.getAction();
58 | if (action == MotionEvent.ACTION_UP)
59 | {
60 | int l = 0;
61 | }
62 | return super.onInterceptTouchEvent(ev);
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/src/com/external/activeandroid/util/ReflectionUtils.java:
--------------------------------------------------------------------------------
1 | package com.external.activeandroid.util;
2 |
3 | /*
4 | * Copyright (C) 2010 Michael Pardo
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | import android.content.Context;
20 | import android.content.pm.ApplicationInfo;
21 | import android.content.pm.PackageManager;
22 | import com.external.activeandroid.Model;
23 | import com.external.activeandroid.serializer.TypeSerializer;
24 |
25 | public final class ReflectionUtils {
26 | //////////////////////////////////////////////////////////////////////////////////////
27 | // PUBLIC METHODS
28 | //////////////////////////////////////////////////////////////////////////////////////
29 |
30 | public static boolean isModel(Class> type) {
31 | return isSubclassOf(type, Model.class);
32 | }
33 |
34 | public static boolean isTypeSerializer(Class> type) {
35 | return isSubclassOf(type, TypeSerializer.class);
36 | }
37 |
38 | // Meta-data
39 |
40 | @SuppressWarnings("unchecked")
41 | public static T getMetaData(Context context, String name) {
42 | try {
43 | final ApplicationInfo ai = context.getPackageManager().getApplicationInfo(context.getPackageName(),
44 | PackageManager.GET_META_DATA);
45 |
46 | if (ai.metaData != null) {
47 | return (T) ai.metaData.get(name);
48 | }
49 | }
50 | catch (Exception e) {
51 | Log.w("Couldn't find meta-data: " + name);
52 | }
53 |
54 | return null;
55 | }
56 |
57 | //////////////////////////////////////////////////////////////////////////////////////
58 | // PRIVATE METHODS
59 | //////////////////////////////////////////////////////////////////////////////////////
60 |
61 | public static boolean isSubclassOf(Class> type, Class> superClass) {
62 | if (type.getSuperclass() != null) {
63 | if (type.getSuperclass().equals(superClass)) {
64 | return true;
65 | }
66 |
67 | return isSubclassOf(type.getSuperclass(), superClass);
68 | }
69 |
70 | return false;
71 | }
72 | }
--------------------------------------------------------------------------------