();
18 | }
19 |
20 | void addLayout(LoadingLayout layout) {
21 | if (null != layout) {
22 | mLoadingLayouts.add(layout);
23 | }
24 | }
25 |
26 | @Override
27 | public void setLastUpdatedLabel(CharSequence label) {
28 | for (LoadingLayout layout : mLoadingLayouts) {
29 | layout.setLastUpdatedLabel(label);
30 | }
31 |
32 | mPullToRefreshView.refreshLoadingViewsSize();
33 | }
34 |
35 | @Override
36 | public void setLoadingDrawable(Drawable drawable) {
37 | for (LoadingLayout layout : mLoadingLayouts) {
38 | layout.setLoadingDrawable(drawable);
39 | }
40 |
41 | mPullToRefreshView.refreshLoadingViewsSize();
42 | }
43 |
44 | @Override
45 | public void setRefreshingLabel(CharSequence refreshingLabel) {
46 | for (LoadingLayout layout : mLoadingLayouts) {
47 | layout.setRefreshingLabel(refreshingLabel);
48 | }
49 | }
50 |
51 | @Override
52 | public void setPullLabel(CharSequence label) {
53 | for (LoadingLayout layout : mLoadingLayouts) {
54 | layout.setPullLabel(label);
55 | }
56 | }
57 |
58 | @Override
59 | public void setReleaseLabel(CharSequence label) {
60 | for (LoadingLayout layout : mLoadingLayouts) {
61 | layout.setRefreshingLabel(label);
62 | }
63 | }
64 |
65 | public void setTextTypeface(Typeface tf) {
66 | for (LoadingLayout layout : mLoadingLayouts) {
67 | layout.setTextTypeface(tf);
68 | }
69 |
70 | mPullToRefreshView.refreshLoadingViewsSize();
71 | }
72 | }
--------------------------------------------------------------------------------
/src/com/rincliu/library/common/reference/push/RLNotificationActivity.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2013-2014, Rinc Liu (http://rincliu.com).
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.rincliu.library.common.reference.push;
17 |
18 | import org.json.JSONException;
19 | import org.json.JSONObject;
20 |
21 | import com.rincliu.library.R;
22 | import android.app.Activity;
23 | import android.os.Bundle;
24 | import android.widget.TextView;
25 |
26 | public class RLNotificationActivity extends Activity {
27 |
28 | @Override
29 | protected void onCreate(Bundle savedInstanceState) {
30 | super.onCreate(savedInstanceState);
31 | RLNotificationEntity ne=(RLNotificationEntity) getIntent().getSerializableExtra("data");
32 | setTitle(ne.getTitle());
33 | setContentView(R.layout.push);
34 | TextView tv_content=(TextView)findViewById(R.id.tv_content);
35 | tv_content.setText(ne.getContent());
36 | String x=ne.getExtra();
37 | if(x!=null&&!x.equals("")){
38 | JSONObject object=null;
39 | try {
40 | object=new JSONObject(x);
41 | } catch (JSONException e) {
42 | e.printStackTrace();
43 | }
44 | if(object!=null&&object.has("data")){
45 | String data=null;
46 | try {
47 | data=object.get("data").toString();
48 | } catch (JSONException e) {
49 | e.printStackTrace();
50 | }
51 | if(data!=null){
52 | System.out.println(x);
53 | }
54 | }
55 | }
56 | }
57 | }
--------------------------------------------------------------------------------
/src/com/rincliu/library/util/RLStrUtil.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2013-2014, Rinc Liu (http://rincliu.com).
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.rincliu.library.util;
17 |
18 | import java.util.regex.Matcher;
19 | import java.util.regex.Pattern;
20 |
21 | public class RLStrUtil {
22 | private static final String URL_REG_EXPRESSION = "^(https?://)?([a-zA-Z0-9_-]+\\.[a-zA-Z0-9_-]+)+(/*[A-Za-z0-9/\\-_&:?\\+=//.%]*)*";
23 | private static final String EMAIL_REG_EXPRESSION = "\\w+(\\.\\w+)*@\\w+(\\.\\w+)+";
24 |
25 | /**
26 | *
27 | * @param str
28 | * @return
29 | */
30 | public static String replaceBlank(String str) {
31 | String dest = "";
32 | if (str!=null) {
33 | Pattern p = Pattern.compile("\\s*|\t|\r|\n");
34 | Matcher m = p.matcher(str);
35 | dest = m.replaceAll("");
36 | }
37 | return dest;
38 | }
39 |
40 | /**
41 | *
42 | * @param s
43 | * @return
44 | */
45 | public static boolean isUrl(String s) {
46 | if (s == null) {
47 | return false;
48 | }
49 | return Pattern.matches(URL_REG_EXPRESSION, s);
50 | }
51 |
52 | /**
53 | *
54 | * @param s
55 | * @return
56 | */
57 | public static boolean isEmail(String s) {
58 | if (s == null) {
59 | return true;
60 | }
61 | return Pattern.matches(EMAIL_REG_EXPRESSION, s);
62 | }
63 |
64 | /**
65 | *
66 | * @param s
67 | * @return
68 | */
69 | public static boolean isBlank(String s) {
70 | if (s == null) {
71 | return true;
72 | }
73 | return Pattern.matches("\\s*", s);
74 | }
75 | }
--------------------------------------------------------------------------------
/src/com/rincliu/library/common/persistence/image/core/assist/DiscCacheUtil.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright 2011-2013 Sergey Tarasevich
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.rincliu.library.common.persistence.image.core.assist;
17 |
18 | import com.rincliu.library.common.persistence.image.cache.disc.DiscCacheAware;
19 |
20 | import java.io.File;
21 |
22 | /**
23 | * Utility for convenient work with disc cache.
24 | * NOTE: This utility works with file system so avoid using it on application main thread.
25 | *
26 | * @author Sergey Tarasevich (nostra13[at]gmail[dot]com)
27 | * @since 1.8.0
28 | */
29 | public final class DiscCacheUtil {
30 |
31 | private DiscCacheUtil() {
32 | }
33 |
34 | /** Returns {@link File} of cached image or null if image was not cached in disc cache */
35 | public static File findInCache(String imageUri, DiscCacheAware discCache) {
36 | File image = discCache.get(imageUri);
37 | return image.exists() ? image : null;
38 | }
39 |
40 | /**
41 | * Removed cached image file from disc cache (if image was cached in disc cache before)
42 | *
43 | * @return true - if cached image file existed and was deleted; false - otherwise.
44 | */
45 | public static boolean removeFromCache(String imageUri, DiscCacheAware discCache) {
46 | File image = discCache.get(imageUri);
47 | return image.delete();
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/src/com/rincliu/library/common/persistence/rootmanager/utils/RootUtils.java:
--------------------------------------------------------------------------------
1 |
2 | package com.rincliu.library.common.persistence.rootmanager.utils;
3 |
4 | import com.rincliu.library.common.persistence.rootmanager.RootManager;
5 | import com.rincliu.library.common.persistence.rootmanager.container.Command;
6 |
7 | import android.os.Looper;
8 | import android.util.Log;
9 |
10 | /**
11 | * This class is a set of methods used in {@link RootManager}.
12 | *
13 | * @author Chris
14 | */
15 | public class RootUtils {
16 |
17 | private final static String TAG = "RootManager";
18 | private static int cmdID = 0;
19 |
20 | /**
21 | * To check if the caller is on the ui thread, throw exception if it calls
22 | * on UI thread.
23 | */
24 | public static void checkUIThread() {
25 | if (Looper.myLooper() == Looper.getMainLooper()) {
26 | throw new IllegalStateException("Please do not call this fuction on UI thread");
27 | }
28 | }
29 |
30 | /**
31 | * Output log to logcat as the debug level.
32 | *
33 | * @param message
34 | */
35 | public static void Log(String message) {
36 | Log.d(TAG, message);
37 | }
38 |
39 | /**
40 | * Output log to logcat as the debug level with extend log tag.
41 | *
42 | * The example: LibTag::YourExtendTag, Log Message.
43 | *
44 | *
45 | * @param extendTag Your extend tag.
46 | * @param message
47 | */
48 | public static void Log(String extendTag, String message) {
49 | Log.d(TAG + "::" + extendTag, message);
50 | }
51 |
52 | /**
53 | * Get a command Id for each {@link Command}.
54 | *
55 | * @return the actual ID.
56 | */
57 | public static int generateCommandID() {
58 | cmdID = cmdID + 1;
59 | RootUtils.Log("Return a command id " + cmdID);
60 | return cmdID;
61 | }
62 |
63 | /**
64 | * Check if command need patch.
65 | *
66 | * @return
67 | */
68 | public static boolean isNeedPathSDK() {
69 | return android.os.Build.VERSION.SDK_INT == 17;
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/src/com/rincliu/library/util/RLUiUtil.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2013-2014, Rinc Liu (http://rincliu.com).
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.rincliu.library.util;
17 |
18 | import com.rincliu.library.R;
19 | import android.content.Context;
20 | import android.view.Gravity;
21 | import android.view.LayoutInflater;
22 | import android.view.View;
23 | import android.widget.TextView;
24 | import android.widget.Toast;
25 |
26 | public class RLUiUtil {
27 | /**
28 | *
29 | * @param context
30 | * @param msg
31 | * @param duration
32 | */
33 | public static void toast(Context context, String msg, int duration){
34 | Toast toast;
35 | toast=new Toast(context);
36 | View view=LayoutInflater.from(context).inflate(R.layout.toast, null);
37 | TextView tv=(TextView) view.findViewById(R.id.tv_msg);
38 | tv.setText(msg);
39 | toast.setView(view);
40 | toast.setDuration(duration);
41 | toast.setGravity(Gravity.CENTER, 0, 0);
42 | toast.show();
43 | }
44 | /**
45 | *
46 | * @param context
47 | * @param msg
48 | */
49 | public static void toast(Context context, String msg){
50 | toast(context, msg, Toast.LENGTH_SHORT);
51 | }
52 | /**
53 | *
54 | * @param context
55 | * @param strResId
56 | * @param duration
57 | */
58 | public static void toast(Context context, int strResId, int duration){
59 | toast(context,context.getString(strResId),duration);
60 | }
61 | /**
62 | *
63 | * @param context
64 | * @param strResId
65 | */
66 | public static void toast(Context context, int strResId){
67 | toast(context,context.getString(strResId));
68 | }
69 | }
--------------------------------------------------------------------------------
/src/com/rincliu/library/widget/gestureimageview/FlingAnimation.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2012 Jason Polites
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.rincliu.library.widget.gestureimageview;
17 |
18 | /**
19 | * @author Jason Polites
20 | *
21 | */
22 | public class FlingAnimation implements Animation {
23 |
24 | private float velocityX;
25 | private float velocityY;
26 |
27 | private float factor = 0.85f;
28 |
29 | private float threshold = 10;
30 |
31 | private FlingAnimationListener listener;
32 |
33 | /* (non-Javadoc)
34 | * @see com.polites.android.Transformer#update(com.polites.android.GestureImageView, long)
35 | */
36 | @Override
37 | public boolean update(GestureImageView view, long time) {
38 | float seconds = (float) time / 1000.0f;
39 |
40 | float dx = velocityX * seconds;
41 | float dy = velocityY * seconds;
42 |
43 | velocityX *= factor;
44 | velocityY *= factor;
45 |
46 | boolean active = (Math.abs(velocityX) > threshold && Math.abs(velocityY) > threshold);
47 |
48 | if(listener != null) {
49 | listener.onMove(dx, dy);
50 |
51 | if(!active) {
52 | listener.onComplete();
53 | }
54 | }
55 |
56 | return active;
57 | }
58 |
59 | public void setVelocityX(float velocityX) {
60 | this.velocityX = velocityX;
61 | }
62 |
63 | public void setVelocityY(float velocityY) {
64 | this.velocityY = velocityY;
65 | }
66 |
67 | public void setFactor(float factor) {
68 | this.factor = factor;
69 | }
70 |
71 | public void setListener(FlingAnimationListener listener) {
72 | this.listener = listener;
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/src/com/rincliu/library/common/persistence/image/core/download/HttpClientImageDownloader.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright 2011-2013 Sergey Tarasevich
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.rincliu.library.common.persistence.image.core.download;
17 |
18 | import java.io.IOException;
19 | import java.io.InputStream;
20 |
21 | import org.apache.http.HttpEntity;
22 | import org.apache.http.HttpResponse;
23 | import org.apache.http.client.HttpClient;
24 | import org.apache.http.client.methods.HttpGet;
25 | import org.apache.http.entity.BufferedHttpEntity;
26 |
27 | import android.content.Context;
28 |
29 | /**
30 | * Implementation of ImageDownloader which uses {@link HttpClient} for image stream retrieving.
31 | *
32 | * @author Sergey Tarasevich (nostra13[at]gmail[dot]com)
33 | * @since 1.4.1
34 | */
35 | public class HttpClientImageDownloader extends BaseImageDownloader {
36 |
37 | private HttpClient httpClient;
38 |
39 | public HttpClientImageDownloader(Context context, HttpClient httpClient) {
40 | super(context);
41 | this.httpClient = httpClient;
42 | }
43 |
44 | @Override
45 | protected InputStream getStreamFromNetwork(String imageUri, Object extra) throws IOException {
46 | HttpGet httpRequest = new HttpGet(imageUri);
47 | HttpResponse response = httpClient.execute(httpRequest);
48 | HttpEntity entity = response.getEntity();
49 | BufferedHttpEntity bufHttpEntity = new BufferedHttpEntity(entity);
50 | return bufHttpEntity.getContent();
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/com/rincliu/library/common/persistence/rootmanager/container/Mount.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the RootKit Project: http://code.google.com/p/RootKit/
3 | * Copyright (c) 2012 Stephen Erickson, Chris Ravenscroft, Dominik Schuermann, Adam Shanks
4 | * This code is dual-licensed under the terms of the Apache License Version 2.0 and
5 | * the terms of the General Public License (GPL) Version 2.
6 | * You may use this code according to either of these licenses as is most appropriate
7 | * for your project on a case-by-case basis.
8 | * The terms of each license can be found in the root directory of this project's repository as well
9 | * as at:
10 | * * http://www.apache.org/licenses/LICENSE-2.0
11 | * * http://www.gnu.org/licenses/gpl-2.0.txt
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under these Licenses is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See each License for the specific language governing permissions and
16 | * limitations under that License.
17 | */
18 |
19 | package com.rincliu.library.common.persistence.rootmanager.container;
20 |
21 | import java.io.File;
22 | import java.util.Arrays;
23 | import java.util.HashSet;
24 | import java.util.Set;
25 |
26 | public class Mount {
27 | final File mDevice;
28 | final File mMountPoint;
29 | final String mType;
30 | final Set mFlags;
31 |
32 | public Mount(File device, File path, String type, String flagsStr) {
33 | mDevice = device;
34 | mMountPoint = path;
35 | mType = type;
36 | mFlags = new HashSet(Arrays.asList(flagsStr.split(",")));
37 | }
38 |
39 | public File getDevice() {
40 | return mDevice;
41 | }
42 |
43 | public File getMountPoint() {
44 | return mMountPoint;
45 | }
46 |
47 | public String getType() {
48 | return mType;
49 | }
50 |
51 | public Set getFlags() {
52 | return mFlags;
53 | }
54 |
55 | @Override
56 | public String toString() {
57 | return String.format("%s on %s type %s %s", mDevice, mMountPoint, mType, mFlags);
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | 常用功能模块
2 | ==========
3 | * Android持久化框架[Afinal](https://github.com/RincLiu/afinal)中的FinalActivity(支持组件事件注解)和FinalDb(SQLite操作);
4 | * HTTP框架[AsyncHttpClient](https://github.com/loopj/android-async-http);
5 | * 图片处理框架[UniversalImageLoader](https://github.com/nostra13/Android-Universal-Image-Loader);
6 | * ROOT相关操作模块[RootManager](https://github.com/Chrisplus/RootManager);
7 |
8 | 第三方SDK模块
9 | ==========
10 | * 基于[多盟](http://www.duomeng.net/developers/developers.htm)的广告模块;
11 | * 基于[友盟](http://www.umeng.com)的数据分析统计模块、用户反馈、版本更新等模块;
12 | * 基于[极光推送](http://www.jpush.cn/)的消息推送模块;
13 | * 基于[百度地图API](http://developer.baidu.com/map/)的定位模块;
14 | * 基于[百度媒体云](http://developer.baidu.com/wiki/index.php?title=docs/cplat/media)的视频播放模块,支持本地视频文件和网络视频资源播放;
15 | * 基于[科大讯飞](http://open.voicecloud.cn/developer.php)的语音引擎模块,支持语音识别和语音朗读;
16 | * 社会化组件:新浪微博SSO登录、微博分享、微信分享;
17 |
18 | 组件及工具类
19 | ==========
20 | * 国际化:支持English、简体中文、繁體中文;
21 | * 经过简化和定制的二维码扫描模块zxing;
22 | * 全局异常处理模块CrashHandler;
23 | * API兼容类RLAPICompat;
24 | * RLScrollView,新增了滚动相关方法;
25 | * 列表分页组件ListPagerView;
26 | * 定制的下拉刷新组件,包括PullToRefreshGridView、PullToRefreshListView、PullToRefreshScrollView;
27 | * 改进的轮播组件ViewFlow,增加了BitmapIndicator(可设置图片指针)、可设置播放模式(手动、自动向左、自动向右);
28 | * 定制的侧滑菜单组件MenuDrawer;
29 | * 定制的手势缩放图片视图组件GestureImageView;
30 | * 其他自定义组件:RLDialog、RLAlertDialog、RLListDialog、RLLoadingDialog、RLFileExplorer、RLSpinner、RLWebView、RLOnClickListener;
31 | * 工具类:RLAppUtil(应用管理)、RLFileUtil(IO操作)、RLImgUtil(图像处理)、RLIntentUtil(系统服务调用)、RLJsonUtil(JSON解析)、RLNetUtil(网络服务)、RLStrUtil(字符串处理)、RLSysUtil(系统参数配置)、RLUiUtil(UI相关,自定义toast等);
32 |
33 | 使用注意
34 | ==========
35 | * Analytics、CrashHandler、Feedback、Push这些需要在Application或Activity创建时初始化的组件可以在AndroidManifest.xml中配置是否启用:
36 |
37 | ```xml
38 | ...
39 |
41 |
42 |
43 |
44 |
45 | ...
46 |
47 | ...
48 | ```
49 |
--------------------------------------------------------------------------------
/src/com/rincliu/library/common/persistence/image/cache/disc/impl/UnlimitedDiscCache.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright 2011-2013 Sergey Tarasevich
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.rincliu.library.common.persistence.image.cache.disc.impl;
17 |
18 | import com.rincliu.library.common.persistence.image.cache.disc.BaseDiscCache;
19 | import com.rincliu.library.common.persistence.image.cache.disc.DiscCacheAware;
20 | import com.rincliu.library.common.persistence.image.cache.disc.naming.FileNameGenerator;
21 | import com.rincliu.library.common.persistence.image.core.DefaultConfigurationFactory;
22 |
23 | import java.io.File;
24 |
25 | /**
26 | * Default implementation of {@linkplain DiscCacheAware disc cache}. Cache size is unlimited.
27 | *
28 | * @author Sergey Tarasevich (nostra13[at]gmail[dot]com)
29 | * @see BaseDiscCache
30 | * @since 1.0.0
31 | */
32 | public class UnlimitedDiscCache extends BaseDiscCache {
33 |
34 | /** @param cacheDir Directory for file caching */
35 | public UnlimitedDiscCache(File cacheDir) {
36 | this(cacheDir, DefaultConfigurationFactory.createFileNameGenerator());
37 | }
38 |
39 | /**
40 | * @param cacheDir Directory for file caching
41 | * @param fileNameGenerator Name generator for cached files
42 | */
43 | public UnlimitedDiscCache(File cacheDir, FileNameGenerator fileNameGenerator) {
44 | super(cacheDir, fileNameGenerator);
45 | }
46 |
47 | @Override
48 | public void put(String key, File file) {
49 | // Do nothing
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | RINC
6 | default
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | An exception occured
20 |
21 |
22 | Invalid url address
23 | Downlaod file
24 | Cache has been cleaned
25 | No cookie
26 | Cookie has bean cleaned
27 | History has been cleaned
28 | No history
29 | Cookie is not allowed to be cleaned in current page
30 |
31 |
32 | Inner cache has been cleaned
33 | External cache has been cleaned
34 | Inner data has been cleaned
35 | External data has been cleaned
36 |
37 | Options
38 |
39 | Failed to launch this app
40 |
41 | Failed to request root permission
42 |
43 | Cannot access this file or directory
44 |
45 | no available external storage
46 |
47 | Checking update…
48 |
49 |
--------------------------------------------------------------------------------
/src/com/rincliu/library/common/reference/analytics/RLAnalyticsHelper.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2013-2014, Rinc Liu (http://rincliu.com).
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.rincliu.library.common.reference.analytics;
17 |
18 | import java.util.HashMap;
19 | import android.content.Context;
20 |
21 | import com.umeng.analytics.MobclickAgent;
22 |
23 | public class RLAnalyticsHelper {
24 |
25 | /**
26 | *
27 | * @param context
28 | * @param isDebug
29 | */
30 | public static void init(Context context, boolean isDebug){
31 | com.umeng.common.Log.LOG=isDebug;
32 | MobclickAgent.setDebugMode(isDebug);
33 | MobclickAgent.setAutoLocation(true);
34 | MobclickAgent.setSessionContinueMillis(1000);
35 | // MobclickAgent.setUpdateOnlyWifi(false);
36 | // MobclickAgent.setDefaultReportPolicy(context, ReportPolicy.BATCH_BY_INTERVAL, 5*1000);
37 | MobclickAgent.updateOnlineConfig(context);
38 | MobclickAgent.onError(context);
39 | }
40 |
41 | /**
42 | *
43 | * @param context
44 | */
45 | public static void onPause(Context context){
46 | MobclickAgent.onPause(context);
47 | }
48 |
49 | /**
50 | *
51 | * @param context
52 | */
53 | public static void onResume(Context context){
54 | MobclickAgent.onResume(context);
55 | }
56 |
57 | /**
58 | *
59 | * @param context
60 | * @param event
61 | */
62 | public static void onEvent(Context context, String event){
63 | MobclickAgent.onEvent(context, event);
64 | }
65 |
66 | /**
67 | *
68 | * @param context
69 | * @param event
70 | * @param map
71 | */
72 | public static void onEvent(Context context, String event, HashMap map){
73 | MobclickAgent.onEvent(context, event, map);
74 | }
75 | }
--------------------------------------------------------------------------------
/src/com/rincliu/library/common/persistence/zxing/camera/PreviewCallback.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2010 ZXing authors
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 |
17 | package com.rincliu.library.common.persistence.zxing.camera;
18 |
19 | import android.graphics.Point;
20 | import android.hardware.Camera;
21 | import android.os.Handler;
22 | import android.os.Message;
23 | import android.util.Log;
24 |
25 | final class PreviewCallback implements Camera.PreviewCallback {
26 |
27 | private static final String TAG = PreviewCallback.class.getSimpleName();
28 |
29 | private final CameraConfigurationManager configManager;
30 | private final boolean useOneShotPreviewCallback;
31 | private Handler previewHandler;
32 | private int previewMessage;
33 |
34 | PreviewCallback(CameraConfigurationManager configManager, boolean useOneShotPreviewCallback) {
35 | this.configManager = configManager;
36 | this.useOneShotPreviewCallback = useOneShotPreviewCallback;
37 | }
38 |
39 | void setHandler(Handler previewHandler, int previewMessage) {
40 | this.previewHandler = previewHandler;
41 | this.previewMessage = previewMessage;
42 | }
43 |
44 | public void onPreviewFrame(byte[] data, Camera camera) {
45 | Point cameraResolution = configManager.getCameraResolution();
46 | if (!useOneShotPreviewCallback) {
47 | camera.setPreviewCallback(null);
48 | }
49 | if (previewHandler != null) {
50 | Message message = previewHandler.obtainMessage(previewMessage, cameraResolution.x,
51 | cameraResolution.y, data);
52 | message.sendToTarget();
53 | previewHandler = null;
54 | } else {
55 | Log.d(TAG, "Got preview callback, but no handler for it");
56 | }
57 | }
58 |
59 | }
60 |
--------------------------------------------------------------------------------
/src/com/rincliu/library/app/RLCrashHandler.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2013-2014, Rinc Liu (http://rincliu.com).
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.rincliu.library.app;
17 |
18 | import java.lang.Thread.UncaughtExceptionHandler;
19 |
20 | import com.rincliu.library.R;
21 | import com.rincliu.library.util.RLUiUtil;
22 | import android.content.Context;
23 | import android.os.Looper;
24 |
25 | public class RLCrashHandler implements UncaughtExceptionHandler {
26 | private Context mContext;
27 | private static RLCrashHandler instance;
28 |
29 | /**
30 | *
31 | * @return
32 | */
33 | public static RLCrashHandler getInstance() {
34 | if(instance==null){
35 | instance=new RLCrashHandler();
36 | }
37 | return instance;
38 | }
39 |
40 | /**
41 | *
42 | * @param context
43 | */
44 | public void init(Context context) {
45 | mContext = context;
46 | Thread.setDefaultUncaughtExceptionHandler(this);
47 | }
48 |
49 | @Override
50 | public void uncaughtException(Thread thread, final Throwable ex) {
51 | ex.printStackTrace();
52 | new Thread(){
53 | public void run(){
54 | Looper.prepare();
55 | RLUiUtil.toast(mContext,R.string.exception_occured);
56 | Looper.loop();
57 | }
58 | }.start();
59 | try {
60 | Thread.sleep(3000);
61 | } catch (InterruptedException e) {
62 | e.printStackTrace();
63 | }
64 | // Intent intent=new Intent(Intent.ACTION_MAIN);
65 | // intent.addCategory(Intent.CATEGORY_HOME);
66 | // mContext.startActivity(intent);
67 | android.os.Process.killProcess(android.os.Process.myPid());
68 | // ((ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE))
69 | // .killBackgroundProcesses(mContext.getPackageName());
70 | }
71 | }
--------------------------------------------------------------------------------
/res/layout/umeng_fb_conversation.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
10 |
11 |
16 |
18 |
20 |
26 |
31 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/res/values/umeng_fb_strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Please tell us your suggestion
4 | You can enter up to 140 characters
5 | Send failed.Click to try again.
6 | Sending…
7 | Resend
8 | Send failed
9 | Send failed
10 | Sending…
11 | Send failed.Click to try again.
12 | Feedback
13 | My feedbacks
14 | Feedback
15 | Your suggestion will help us to do better.
16 | Your suggestion…
17 | Submit
18 | Go back
19 |
20 | Got it
21 | View
22 |
23 |
24 | - Age
25 | - <18
26 | - 18-24
27 | - 25-30
28 | - 31-35
29 | - 36-40
30 | - 41-50
31 | - 51-59
32 | - ≥60
33 |
34 |
35 | - Sex
36 | - Male
37 | - Female
38 |
39 | View feedbacks
40 | Reply of your feedback
41 | Delete
42 | View
43 | Delete
44 | Resend
45 | Delete message
46 | New reply
47 | New reply
48 | View
49 |
50 |
--------------------------------------------------------------------------------
/src/com/rincliu/library/common/reference/update/RLUpdateHelper.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2013-2014, Rinc Liu (http://rincliu.com).
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.rincliu.library.common.reference.update;
17 |
18 | import com.rincliu.library.R;
19 | import com.rincliu.library.util.RLUiUtil;
20 | import com.rincliu.library.widget.dialog.RLLoadingDialog;
21 | import android.content.Context;
22 |
23 | import com.umeng.update.UmengUpdateAgent;
24 | import com.umeng.update.UmengUpdateListener;
25 | import com.umeng.update.UpdateResponse;
26 |
27 | public class RLUpdateHelper {
28 | /**
29 | *
30 | * @param context
31 | * @param isQuietly
32 | */
33 | public static void checkUpdate(final Context context, final boolean isQuietly){
34 | final RLLoadingDialog pd=new RLLoadingDialog(context);
35 | if(!isQuietly){
36 | pd.setMessage(R.string.is_checking_update);
37 | pd.show();
38 | }
39 | UmengUpdateAgent.setUpdateAutoPopup(false);
40 | UmengUpdateAgent.setUpdateOnlyWifi(false);
41 | UmengUpdateAgent.setOnDownloadListener(null);
42 | UmengUpdateAgent.setUpdateListener(new UmengUpdateListener() {
43 | @Override
44 | public void onUpdateReturned(int status,UpdateResponse resp) {
45 | pd.dismiss();
46 | if(status==0){
47 | UmengUpdateAgent.showUpdateDialog(context, resp);
48 | }else{
49 | if(isQuietly){
50 | return;
51 | }
52 | if (status == 1) {
53 | RLUiUtil.toast(context, R.string.UMNoUpdate);
54 | } else if (status == 2) {
55 | RLUiUtil.toast(context, R.string.UMNoWifi);
56 | } else if (status == 3) {
57 | RLUiUtil.toast(context, R.string.UMTimeout);
58 | }
59 | }
60 | }
61 | });
62 | UmengUpdateAgent.update(context);
63 | }
64 | }
--------------------------------------------------------------------------------
/src/com/rincliu/library/common/persistence/zxing/ScanDemoActivity.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2013-2014, Rinc Liu (http://rincliu.com).
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.rincliu.library.common.persistence.zxing;
17 |
18 | import com.rincliu.library.R;
19 | import com.rincliu.library.app.RLActivity;
20 | import com.rincliu.library.util.RLUiUtil;
21 | import com.rincliu.library.widget.dialog.RLAlertDialog;
22 | import android.content.Intent;
23 | import android.os.Bundle;
24 | import android.text.TextUtils;
25 | import android.text.util.Linkify;
26 |
27 | public class ScanDemoActivity extends RLActivity {
28 | private static final int MSG_SCAN=888;
29 |
30 | @Override
31 | protected void onCreate(Bundle savedInstanceState) {
32 | super.onCreate(savedInstanceState);
33 | startActivityForResult(new Intent(ScanDemoActivity.this,ZxingScanActivity.class),MSG_SCAN);
34 | }
35 |
36 | @Override
37 | protected void onActivityResult(int requestCode, int resultCode, Intent data) {
38 | if (resultCode == RESULT_OK && requestCode == 888) {
39 | String result = data.getExtras().getString("result");
40 | if (TextUtils.isEmpty(result)) {
41 | RLUiUtil.toast(this, R.string.scan_retry);
42 | return;
43 | }
44 | RLAlertDialog dialog=new RLAlertDialog(this,getString(R.string.scan_result),
45 | result,Linkify.ALL,
46 | getString(android.R.string.yes),
47 | getString(android.R.string.cancel),new RLAlertDialog.Listener(){
48 | @Override
49 | public void onLeftClick() {
50 | }
51 | @Override
52 | public void onRightClick() {
53 | }
54 | });
55 | dialog.show();
56 | }
57 | }
58 | }
--------------------------------------------------------------------------------