result = new ArrayList<>();
99 | for (int i = 0; i < getCount(); i++) {
100 | if (mSelectedPositions.get(i, false)) {
101 | result.add(i);
102 | }
103 | }
104 | return result;
105 | }
106 |
107 |
108 | }
109 |
--------------------------------------------------------------------------------
/app/src/main/java/com/likebamboo/osa/android/ui/fragments/SettingsFragment.java:
--------------------------------------------------------------------------------
1 | package com.likebamboo.osa.android.ui.fragments;
2 |
3 | import android.content.DialogInterface;
4 | import android.content.Intent;
5 | import android.os.Bundle;
6 | import android.support.v4.app.DialogFragment;
7 | import android.view.LayoutInflater;
8 | import android.view.View;
9 | import android.view.ViewGroup;
10 | import android.widget.AdapterView;
11 | import android.widget.ArrayAdapter;
12 | import android.widget.ListView;
13 |
14 | import com.likebamboo.osa.android.R;
15 | import com.likebamboo.osa.android.request.RequestUrl;
16 | import com.likebamboo.osa.android.ui.AboutActivity;
17 | import com.likebamboo.osa.android.ui.BaseActivity;
18 | import com.likebamboo.osa.android.ui.nav.ActivityNavigator;
19 | import com.likebamboo.osa.android.ui.view.blur.BlurDialogFragmentHelper;
20 |
21 | /**
22 | * 关于Fragment
23 | *
24 | * @author likebamboo
25 | */
26 | public class SettingsFragment extends DialogFragment {
27 |
28 | private BlurDialogFragmentHelper mHelper;
29 |
30 | public static SettingsFragment newInstance() {
31 | SettingsFragment fragment = new SettingsFragment();
32 | return fragment;
33 | }
34 |
35 | @Override
36 | public void onCreate(Bundle savedInstanceState) {
37 | super.onCreate(savedInstanceState);
38 | mHelper = new BlurDialogFragmentHelper(this);
39 | mHelper.onCreate();
40 | }
41 |
42 | @Override
43 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
44 | View v = inflater.inflate(R.layout.fragment_settings, container, false);
45 |
46 | ListView listView = (ListView) v.findViewById(R.id.dialog_content);
47 | listView.setAdapter(new ArrayAdapter<>(
48 | getActivity(), R.layout.simple_text,
49 | android.R.id.text1,
50 | getResources().getStringArray(R.array.about_list)
51 | ));
52 | listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
53 | @Override
54 | public void onItemClick(AdapterView> adapterView, View view, int i, long l) {
55 | if (getActivity() == null) {
56 | return;
57 | }
58 | switch (i) {
59 | case 0:// 意见反馈
60 | ActivityNavigator.openWebView(getActivity(), null, RequestUrl.ISSUES_URL);
61 | break;
62 | case 1:// 关于作者
63 | ActivityNavigator.openWebView(getActivity(), null, RequestUrl.ABOUT_ME_URL);
64 | break;
65 | case 2:// 关于app
66 | Intent intent = new Intent(getActivity(), AboutActivity.class);
67 | intent.putExtra(BaseActivity.EXTRA_TITLE, getString(R.string.about));
68 | ActivityNavigator.startActivity(getActivity(), intent);
69 | break;
70 | }
71 | }
72 | });
73 | return v;
74 | }
75 |
76 | public void onActivityCreated(Bundle savedInstanceState) {
77 | super.onActivityCreated(savedInstanceState);
78 | mHelper.onActivityCreated();
79 | }
80 |
81 | @Override
82 | public void onStart() {
83 | super.onStart();
84 | mHelper.onStart();
85 | }
86 |
87 | @Override
88 | public void onDismiss(DialogInterface dialog) {
89 | mHelper.onDismiss();
90 | super.onDismiss(dialog);
91 | }
92 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/likebamboo/osa/android/ui/view/FilterFooter.java:
--------------------------------------------------------------------------------
1 | package com.likebamboo.osa.android.ui.view;
2 |
3 | import android.content.Context;
4 | import android.graphics.Point;
5 | import android.os.Build;
6 | import android.util.AttributeSet;
7 | import android.view.Display;
8 | import android.view.View;
9 | import android.view.WindowManager;
10 | import android.view.animation.AccelerateInterpolator;
11 | import android.view.animation.Interpolator;
12 | import android.widget.FrameLayout;
13 | import android.widget.TextView;
14 |
15 | import com.likebamboo.osa.android.R;
16 | import com.likebamboo.osa.android.ui.view.fab.FloatingView;
17 | import com.nineoldandroids.animation.ObjectAnimator;
18 | import com.nineoldandroids.view.ViewHelper;
19 |
20 | import butterknife.ButterKnife;
21 | import butterknife.InjectView;
22 |
23 | /**
24 | * listView底部过滤器布局
25 | *
26 | * Created by likebamboo on 2015/6/15.
27 | */
28 | public class FilterFooter extends FrameLayout implements FloatingView {
29 |
30 | /**
31 | * 加速器
32 | */
33 | private Interpolator mInterpolator = new AccelerateInterpolator();
34 | /**
35 | * 是否隐藏
36 | */
37 | private boolean mHidden = false;
38 |
39 | /**
40 | * 隐藏时候的Y值
41 | */
42 | private float mYHidden = -1;
43 | /**
44 | * 显示时候的Y值
45 | */
46 | private float mYDisplayed = -1;
47 |
48 | @InjectView(R.id.filter_category_tv)
49 | TextView mCategoryTv = null;
50 |
51 | @InjectView(R.id.filter_sort_tv)
52 | TextView mSortTv = null;
53 |
54 | /**
55 | * 点击事件回调
56 | */
57 | private IOnFilterClickListener mFilterClickListener = null;
58 |
59 | public FilterFooter(Context context) {
60 | this(context, null);
61 | }
62 |
63 | public FilterFooter(Context context, AttributeSet attrs) {
64 | this(context, attrs, 0);
65 | }
66 |
67 | public FilterFooter(Context context, AttributeSet attrs, int defStyleAttr) {
68 | super(context, attrs, defStyleAttr);
69 | WindowManager mWindowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
70 | Display display = mWindowManager.getDefaultDisplay();
71 | Point size = new Point();
72 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
73 | display.getSize(size);
74 | mYHidden = size.y;
75 | } else {
76 | mYHidden = display.getHeight();
77 | }
78 | }
79 |
80 | @Override
81 | protected void onFinishInflate() {
82 | super.onFinishInflate();
83 | if (isInEditMode()) {
84 | return;
85 | }
86 | ButterKnife.inject(this);
87 | mCategoryTv.setOnClickListener(new OnClickListener() {
88 | @Override
89 | public void onClick(View view) {
90 | if (mFilterClickListener == null) {
91 | return;
92 | }
93 | mFilterClickListener.onCategoryClick();
94 | }
95 | });
96 | mSortTv.setOnClickListener(new OnClickListener() {
97 | @Override
98 | public void onClick(View view) {
99 | if (mFilterClickListener == null) {
100 | return;
101 | }
102 | mFilterClickListener.onSortClick();
103 | }
104 | });
105 | }
106 |
107 | @Override
108 | protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
109 | // Perform the default behavior
110 | super.onLayout(changed, left, top, right, bottom);
111 | // Store the FAB button's displayed Y position if we are not already aware of it
112 | if (mYDisplayed == -1) {
113 | mYDisplayed = ViewHelper.getY(this);
114 | }
115 | }
116 |
117 | @Override
118 | public void hide() {
119 | hide(true);
120 | }
121 |
122 | @Override
123 | public void show() {
124 | hide(false);
125 | }
126 |
127 | /**
128 | * 设置点击事件回调
129 | *
130 | * @param l
131 | */
132 | public void setFilterClickListener(IOnFilterClickListener l) {
133 | this.mFilterClickListener = l;
134 | }
135 |
136 | private void hide(boolean hide) {
137 | // If the hidden state is being updated
138 | if (mHidden != hide) {
139 | // Store the new hidden state
140 | mHidden = hide;
141 |
142 | // Animate the FAB to it's new Y position
143 | ObjectAnimator animator = ObjectAnimator.ofFloat(this, "y", mHidden ? mYHidden : mYDisplayed).setDuration(500);
144 | animator.setInterpolator(mInterpolator);
145 | animator.start();
146 | }
147 | }
148 |
149 | /**
150 | * 点击事件回调
151 | */
152 | public interface IOnFilterClickListener {
153 | /**
154 | * 点击排序
155 | */
156 | void onSortClick();
157 |
158 | /**
159 | * 点击分类
160 | */
161 | void onCategoryClick();
162 | }
163 | }
164 |
--------------------------------------------------------------------------------
/app/src/main/java/com/likebamboo/osa/android/ui/view/LoadingLayout.java:
--------------------------------------------------------------------------------
1 | package com.likebamboo.osa.android.ui.view;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.content.Context;
5 | import android.text.TextUtils;
6 | import android.util.AttributeSet;
7 | import android.view.View;
8 | import android.widget.LinearLayout;
9 | import android.widget.TextView;
10 |
11 | import com.likebamboo.osa.android.R;
12 |
13 | import butterknife.ButterKnife;
14 | import butterknife.InjectView;
15 |
16 | /**
17 | * @author likebamboo
18 | * @date 2015/5/13.
19 | * @desc 描述: Loading(整块区域或者加载更多时loading)
20 | */
21 | public class LoadingLayout extends LinearLayout {
22 | /**
23 | * 正在加载view
24 | */
25 | @InjectView(R.id.loading_layout)
26 | View mLoadingView = null;
27 |
28 | /**
29 | * Loading 提示TextView
30 | */
31 | @InjectView(R.id.loading_tv)
32 | TextView mLoadingTv = null;
33 |
34 | /**
35 | * 重试布局
36 | */
37 | @InjectView(R.id.loading_fail_layout)
38 | View mRetryLayout = null;
39 |
40 | /**
41 | * 错误提示TextView
42 | */
43 | @InjectView(R.id.loading_fail_tv)
44 | TextView mErrorTv = null;
45 |
46 | /**
47 | * 重试接口
48 | */
49 | private IRetryListener mRetryListener = null;
50 |
51 | /**
52 | * 是否可以重试
53 | */
54 | private boolean canRetry = true;
55 |
56 | public interface IRetryListener {
57 | void onRetry();
58 | }
59 |
60 | public LoadingLayout(Context context) {
61 | this(context, null);
62 | }
63 |
64 | public LoadingLayout(Context context, AttributeSet attrs) {
65 | super(context, attrs);
66 | }
67 |
68 | @SuppressLint("NewApi")
69 | public LoadingLayout(Context context, AttributeSet attrs, int defStyleAttr) {
70 | super(context, attrs, defStyleAttr);
71 | }
72 |
73 | @Override
74 | protected void onFinishInflate() {
75 | super.onFinishInflate();
76 | if (isInEditMode()) {
77 | return;
78 | }
79 | ButterKnife.inject(this);
80 | mRetryLayout.setOnClickListener(new View.OnClickListener() {
81 | @Override
82 | public void onClick(View view) {
83 | if (!canRetry) {
84 | return;
85 | }
86 | if (mRetryListener != null) {
87 | mRetryListener.onRetry();
88 | }
89 | }
90 | });
91 | }
92 |
93 | /**
94 | * 显示/隐藏正在加载中。。。
95 | *
96 | * @param show
97 | * @see [类、类#方法、类#成员]
98 | */
99 | public void showLoading(boolean show) {
100 | showLoading(show, null);
101 | }
102 |
103 | /**
104 | * 显示/隐藏正在加载中。。。
105 | *
106 | * @param show
107 | * @param text
108 | * @see [类、类#方法、类#成员]
109 | */
110 | public void showLoading(boolean show, String text) {
111 | if (show) {
112 | setVisibility(View.VISIBLE);
113 | mLoadingView.setVisibility(View.VISIBLE);
114 | mRetryLayout.setVisibility(View.GONE);
115 | if (!TextUtils.isEmpty(text)) {
116 | mLoadingTv.setText(text);
117 | }
118 | } else {
119 | setVisibility(View.GONE);
120 | }
121 | }
122 |
123 | /**
124 | * 显示加载失败信息
125 | *
126 | * @param msg
127 | * @see [类、类#方法、类#成员]
128 | */
129 | public void showError(String msg) {
130 | setVisibility(View.VISIBLE);
131 | mLoadingView.setVisibility(View.GONE);
132 | mRetryLayout.setVisibility(View.VISIBLE);
133 | if (!TextUtils.isEmpty(msg)) {
134 | mErrorTv.setText(msg);
135 | }
136 | canRetry = true;
137 | }
138 |
139 | /**
140 | * 显示"空"信息
141 | *
142 | * @param msg
143 | */
144 | public void showEmpty(String msg) {
145 | showError(msg);
146 | // 不允许重试
147 | canRetry = false;
148 | }
149 |
150 | /**
151 | * 设置重试监听器。
152 | *
153 | * @param listener
154 | */
155 | public void setRetryListener(IRetryListener listener) {
156 | this.mRetryListener = listener;
157 | }
158 |
159 | }
160 |
--------------------------------------------------------------------------------
/app/src/main/java/com/likebamboo/osa/android/ui/view/ObservedWebView.java:
--------------------------------------------------------------------------------
1 | package com.likebamboo.osa.android.ui.view;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 | import android.webkit.WebView;
6 |
7 | /**
8 | * 可监听滚动的WebView
9 | *
10 | * Created by wentaoli on 2015/5/22.
11 | */
12 | public class ObservedWebView extends WebView {
13 | private OnScrollChangedCallback mOnScrollChangedCallback;
14 |
15 | public ObservedWebView(final Context context) {
16 | super(context);
17 | }
18 |
19 | public ObservedWebView(final Context context, final AttributeSet attrs) {
20 | super(context, attrs);
21 | }
22 |
23 | public ObservedWebView(final Context context, final AttributeSet attrs, final int defStyle) {
24 | super(context, attrs, defStyle);
25 | }
26 |
27 | @Override
28 | protected void onScrollChanged(final int l, final int t, final int oldl, final int oldt) {
29 | super.onScrollChanged(l, t, oldl, oldt);
30 | if (mOnScrollChangedCallback != null) {
31 | mOnScrollChangedCallback.onScroll(l, t);
32 | }
33 | }
34 |
35 | public OnScrollChangedCallback getOnScrollChangedCallback() {
36 | return mOnScrollChangedCallback;
37 | }
38 |
39 | public void setOnScrollChangedCallback(final OnScrollChangedCallback onScrollChangedCallback) {
40 | mOnScrollChangedCallback = onScrollChangedCallback;
41 | }
42 |
43 | /**
44 | * Impliment in the activity/fragment/view that you want to listen to the webview
45 | */
46 | public interface OnScrollChangedCallback {
47 | void onScroll(int l, int t);
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/app/src/main/java/com/likebamboo/osa/android/ui/view/WebViewToolBar.java:
--------------------------------------------------------------------------------
1 | package com.likebamboo.osa.android.ui.view;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.webkit.WebView;
8 | import android.widget.RelativeLayout;
9 |
10 | import com.likebamboo.osa.android.R;
11 |
12 | /**
13 | * WebView 操作栏封装,提供 back ,refresh ,forward 功能
14 | *
15 | * @author likebamboo
16 | * @version [版本号, 2015年5月20日]
17 | * @see [相关类/方法]
18 | * @since [产品/模块版本]
19 | */
20 | public class WebViewToolBar extends RelativeLayout implements View.OnClickListener
21 | {
22 |
23 | /**
24 | * 后退
25 | */
26 | private View mWebviewGoBack;
27 |
28 | /**
29 | * 刷新
30 | */
31 | private View mWebviewRefresh;
32 |
33 | /**
34 | * 前进
35 | */
36 | private View mWebviewGoForward;
37 |
38 | /**
39 | * 目标WebView
40 | */
41 | private WebView mTargetView = null;
42 |
43 | public WebViewToolBar(Context context)
44 | {
45 | this(context, null);
46 | }
47 |
48 | public WebViewToolBar(Context context, AttributeSet attrs)
49 | {
50 | this(context, attrs, 0);
51 | }
52 |
53 | public WebViewToolBar(Context context, AttributeSet attrs, int defStyleAttr)
54 | {
55 | super(context, attrs, defStyleAttr);
56 | LayoutInflater.from(context).inflate(R.layout.webview_toolbar, this, true);
57 | if (!isInEditMode())
58 | {
59 | // 初始化
60 | initView();
61 | // 添加监听器
62 | addListener();
63 | }
64 | }
65 |
66 | /**
67 | * 初始化界面元素
68 | *
69 | * @see [类、类#方法、类#成员]
70 | */
71 | private void initView()
72 | {
73 | mWebviewGoBack = findViewById(R.id.webviewGoBack);
74 | mWebviewGoBack.setEnabled(false);
75 | mWebviewRefresh = findViewById(R.id.webviewRefresh);
76 | mWebviewRefresh.setEnabled(false);
77 | mWebviewGoForward = findViewById(R.id.webviewGoForward);
78 | mWebviewGoForward.setEnabled(false);
79 | }
80 |
81 | /**
82 | * 添加监听器
83 | *
84 | * @see [类、类#方法、类#成员]
85 | */
86 | private void addListener()
87 | {
88 | mWebviewGoBack.setOnClickListener(this);
89 | mWebviewRefresh.setOnClickListener(this);
90 | mWebviewGoForward.setOnClickListener(this);
91 | }
92 |
93 | @Override
94 | public void onClick(View v)
95 | {
96 | if (v == null || mTargetView == null)
97 | {
98 | return;
99 | }
100 | switch (v.getId())
101 | {
102 | case R.id.webviewGoBack:// 后退
103 | mTargetView.goBack();
104 | break;
105 | case R.id.webviewRefresh:// 刷新
106 | mTargetView.reload();
107 | break;
108 | case R.id.webviewGoForward:// 向前
109 | mTargetView.goForward();
110 | break;
111 | default:
112 | break;
113 | }
114 | }
115 |
116 | /**
117 | * 将本控件绑定到具体的webView 上
118 | *
119 | * @see [类、类#方法、类#成员]
120 | */
121 | public void attachToWebView(WebView target)
122 | {
123 | mTargetView = target;
124 | }
125 |
126 | /**
127 | * 更新状态
128 | *
129 | * @see [类、类#方法、类#成员]
130 | */
131 | public void updateStatus()
132 | {
133 | if (mTargetView == null)
134 | {
135 | return;
136 | }
137 | mWebviewGoBack.setEnabled(mTargetView.canGoBack());
138 | mWebviewRefresh.setEnabled(true);
139 | mWebviewGoForward.setEnabled(mTargetView.canGoForward());
140 | }
141 |
142 | }
143 |
--------------------------------------------------------------------------------
/app/src/main/java/com/likebamboo/osa/android/ui/view/blur/BlurBehind.java:
--------------------------------------------------------------------------------
1 | package com.likebamboo.osa.android.ui.view.blur;
2 |
3 | import android.app.Activity;
4 | import android.graphics.Bitmap;
5 | import android.graphics.PorterDuff;
6 | import android.graphics.drawable.BitmapDrawable;
7 | import android.os.AsyncTask;
8 | import android.support.v4.util.LruCache;
9 | import android.view.View;
10 |
11 | /**
12 | * READ ME
13 | *
14 | * Created by wentaoli on 2015/5/18.
15 | */
16 | public class BlurBehind {
17 |
18 | private static final String KEY_CACHE_BLURRED_BACKGROUND_IMAGE = "KEY_CACHE_BLURRED_BACKGROUND_IMAGE";
19 | private static final int CONSTANT_BLUR_RADIUS = 10;
20 | private static final int CONSTANT_DEFAULT_ALPHA = 100;
21 |
22 | private static final LruCache mImageCache = new LruCache(1);
23 | private static CacheBlurBehindAndExecuteTask cacheBlurBehindAndExecuteTask;
24 |
25 | private int mAlpha = CONSTANT_DEFAULT_ALPHA;
26 | private int mFilterColor = -1;
27 |
28 | private enum State {
29 | READY,
30 | EXECUTING
31 | }
32 |
33 | private State mState = State.READY;
34 |
35 | private static BlurBehind mInstance;
36 |
37 | public static BlurBehind getInstance() {
38 | if (mInstance == null) {
39 | mInstance = new BlurBehind();
40 | }
41 | return mInstance;
42 | }
43 |
44 | public void execute(Activity activity, OnBlurCompleteListener onBlurCompleteListener) {
45 | if (mState.equals(State.READY)) {
46 | mState = State.EXECUTING;
47 | cacheBlurBehindAndExecuteTask = new CacheBlurBehindAndExecuteTask(activity, onBlurCompleteListener);
48 | cacheBlurBehindAndExecuteTask.execute();
49 | }
50 | }
51 |
52 | public BlurBehind withAlpha(int alpha) {
53 | this.mAlpha = alpha;
54 | return this;
55 | }
56 |
57 | public BlurBehind withFilterColor(int filterColor) {
58 | this.mFilterColor = filterColor;
59 | return this;
60 | }
61 |
62 | public void setBackground(Activity activity) {
63 | if (mImageCache.size() != 0) {
64 | BitmapDrawable bd = new BitmapDrawable(activity.getResources(), mImageCache.get(KEY_CACHE_BLURRED_BACKGROUND_IMAGE));
65 | bd.setAlpha(mAlpha);
66 | if (mFilterColor != -1) {
67 | bd.setColorFilter(mFilterColor, PorterDuff.Mode.DST_ATOP);
68 | }
69 | activity.getWindow().setBackgroundDrawable(bd);
70 | mImageCache.remove(KEY_CACHE_BLURRED_BACKGROUND_IMAGE);
71 | cacheBlurBehindAndExecuteTask = null;
72 | }
73 | }
74 |
75 | private class CacheBlurBehindAndExecuteTask extends AsyncTask {
76 | private Activity activity;
77 | private OnBlurCompleteListener onBlurCompleteListener;
78 |
79 | private View decorView;
80 | private Bitmap image;
81 |
82 | public CacheBlurBehindAndExecuteTask(Activity activity, OnBlurCompleteListener onBlurCompleteListener) {
83 | this.activity = activity;
84 | this.onBlurCompleteListener = onBlurCompleteListener;
85 | }
86 |
87 | @Override
88 | protected void onPreExecute() {
89 | super.onPreExecute();
90 |
91 | decorView = activity.getWindow().getDecorView();
92 | decorView.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_LOW);
93 | decorView.setDrawingCacheEnabled(true);
94 | decorView.buildDrawingCache();
95 |
96 | image = decorView.getDrawingCache();
97 | }
98 |
99 | @Override
100 | protected Void doInBackground(Void... params) {
101 | Bitmap blurredBitmap = Blur.apply(activity, image, 0.5F, CONSTANT_BLUR_RADIUS);
102 | mImageCache.put(KEY_CACHE_BLURRED_BACKGROUND_IMAGE, blurredBitmap);
103 |
104 | return null;
105 | }
106 |
107 | @Override
108 | protected void onPostExecute(Void aVoid) {
109 | super.onPostExecute(aVoid);
110 |
111 | decorView.destroyDrawingCache();
112 | decorView.setDrawingCacheEnabled(false);
113 |
114 | activity = null;
115 |
116 | onBlurCompleteListener.onBlurComplete();
117 |
118 | mState = State.READY;
119 | }
120 | }
121 | }
122 |
--------------------------------------------------------------------------------
/app/src/main/java/com/likebamboo/osa/android/ui/view/blur/EtsyActionBarDrawerToggle.java:
--------------------------------------------------------------------------------
1 | package com.likebamboo.osa.android.ui.view.blur;
2 |
3 | import android.app.Activity;
4 | import android.graphics.Bitmap;
5 | import android.support.v4.widget.DrawerLayout;
6 | import android.support.v7.app.ActionBarDrawerToggle;
7 | import android.support.v7.widget.Toolbar;
8 | import android.view.View;
9 | import android.widget.ImageView;
10 |
11 | import com.likebamboo.osa.android.R;
12 |
13 | /**
14 | * EtsyActionBarDrawerToggle.java
15 | *
16 | * @author Manabu-GT on 6/12/14.
17 | */
18 | public class EtsyActionBarDrawerToggle extends ActionBarDrawerToggle {
19 |
20 | private static final int DEFAULT_RADIUS = 10;
21 | private static final int DEFAULT_DOWN_SAMPLING = 3;
22 |
23 | private Activity mActivity;
24 |
25 | private View mContainer;
26 | private ImageView mBlurImage;
27 |
28 | private int mBlurRadius;
29 | private int mDownSampling;
30 |
31 | public EtsyActionBarDrawerToggle(Activity activity, DrawerLayout drawerLayout,
32 | int openDrawerContentDescRes, int closeDrawerContentDescRes) {
33 | super(activity, drawerLayout, openDrawerContentDescRes, closeDrawerContentDescRes);
34 | init(activity);
35 | }
36 |
37 | public EtsyActionBarDrawerToggle(Activity activity, DrawerLayout drawerLayout, Toolbar toolbar,
38 | int openDrawerContentDescRes, int closeDrawerContentDescRes) {
39 | super(activity, drawerLayout, toolbar, openDrawerContentDescRes, closeDrawerContentDescRes);
40 | init(activity);
41 | }
42 |
43 | public void setBlurImage() {
44 | mBlurImage.setImageBitmap(null);
45 | mBlurImage.setVisibility(View.VISIBLE);
46 | // do the downscaling for faster processing
47 | Bitmap downScaled = Util.drawViewToBitmap(mContainer,
48 | mContainer.getWidth(), mContainer.getHeight(), mDownSampling);
49 | if (downScaled == null) {
50 | return;
51 | }
52 | // apply the blur using the renderscript
53 | Bitmap blurred = Blur.apply(mActivity, downScaled, mBlurRadius);
54 | if (blurred == null) {
55 | return;
56 | }
57 | mBlurImage.setImageBitmap(blurred);
58 | downScaled.recycle();
59 | }
60 |
61 | public void clearBlurImage() {
62 | mBlurImage.setVisibility(View.GONE);
63 | mBlurImage.setImageBitmap(null);
64 | }
65 |
66 | public void setBlurRadius(int blurRadius) {
67 | if (0 < blurRadius && blurRadius <= 25) {
68 | mBlurRadius = blurRadius;
69 | }
70 | }
71 |
72 | public void setDownSampling(int downSampling) {
73 | mDownSampling = downSampling;
74 | }
75 |
76 | private void init(Activity activity) {
77 | mActivity = activity;
78 | mBlurRadius = DEFAULT_RADIUS;
79 | mDownSampling = DEFAULT_DOWN_SAMPLING;
80 |
81 | mContainer = activity.findViewById(R.id.container);
82 | mBlurImage = (ImageView) activity.findViewById(R.id.blur_view);
83 | }
84 |
85 | private void setBlurAlpha(float slideOffset) {
86 | if (mBlurImage.getVisibility() != View.VISIBLE) {
87 | setBlurImage();
88 | }
89 | Util.setAlpha(mBlurImage, slideOffset);
90 | }
91 |
92 | @Override
93 | public void onDrawerSlide(final View drawerView, final float slideOffset) {
94 | super.onDrawerSlide(drawerView, slideOffset);
95 | if (slideOffset > 0f) {
96 | setBlurAlpha(slideOffset);
97 | } else {
98 | clearBlurImage();
99 | }
100 | }
101 |
102 | @Override
103 | public void onDrawerClosed(View drawerView) {
104 | super.onDrawerClosed(drawerView);
105 | clearBlurImage();
106 | }
107 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/likebamboo/osa/android/ui/view/blur/OnBlurCompleteListener.java:
--------------------------------------------------------------------------------
1 | package com.likebamboo.osa.android.ui.view.blur;
2 |
3 | /**
4 | * Created by wentaoli on 2015/5/18.
5 | */
6 | public interface OnBlurCompleteListener {
7 | void onBlurComplete();
8 | }
9 |
--------------------------------------------------------------------------------
/app/src/main/java/com/likebamboo/osa/android/ui/view/blur/Util.java:
--------------------------------------------------------------------------------
1 | package com.likebamboo.osa.android.ui.view.blur;
2 |
3 | import android.animation.Animator;
4 | import android.animation.AnimatorListenerAdapter;
5 | import android.annotation.TargetApi;
6 | import android.graphics.Bitmap;
7 | import android.graphics.Canvas;
8 | import android.os.Build;
9 | import android.os.Handler;
10 | import android.view.View;
11 | import android.view.ViewPropertyAnimator;
12 | import android.view.animation.AlphaAnimation;
13 | import android.view.animation.Animation;
14 |
15 | /**
16 | * READ ME
17 | * Util.java
18 | *
19 | * @author Manabu-GT on 6/12/14.
20 | */
21 | public class Util {
22 |
23 | public static Bitmap drawViewToBitmap(View view, int width, int height, int downSampling) {
24 | return drawViewToBitmap(view, width, height, 0f, 0f, downSampling);
25 | }
26 |
27 | public static Bitmap drawViewToBitmap(View view, int width, int height, float translateX,
28 | float translateY, int downSampling) {
29 | if (width * height == 0) {
30 | return null;
31 | }
32 | float scale = 1f / downSampling;
33 | int bmpWidth = (int) (width * scale - translateX / downSampling);
34 | int bmpHeight = (int) (height * scale - translateY / downSampling);
35 | Bitmap dest = Bitmap.createBitmap(bmpWidth, bmpHeight, Bitmap.Config.ARGB_8888);
36 | Canvas c = new Canvas(dest);
37 | c.translate(-translateX / downSampling, -translateY / downSampling);
38 | if (downSampling > 1) {
39 | c.scale(scale, scale);
40 | }
41 | view.draw(c);
42 | return dest;
43 | }
44 |
45 | public static boolean isPostHoneycomb() {
46 | return Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1;
47 | }
48 |
49 | @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR1)
50 | public static void setAlpha(View view, float alpha) {
51 | if (isPostHoneycomb()) {
52 | view.setAlpha(alpha);
53 | } else {
54 | AlphaAnimation alphaAnimation = new AlphaAnimation(alpha, alpha);
55 | // make it instant
56 | alphaAnimation.setDuration(0);
57 | alphaAnimation.setFillAfter(true);
58 | view.startAnimation(alphaAnimation);
59 | }
60 | }
61 |
62 | @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR1)
63 | public static void animateAlpha(final View view, float fromAlpha, float toAlpha, int duration, final Runnable endAction) {
64 | if (isPostHoneycomb()) {
65 | ViewPropertyAnimator animator = view.animate().alpha(toAlpha).setDuration(duration);
66 | if (endAction != null) {
67 | animator.setListener(new AnimatorListenerAdapter() {
68 | public void onAnimationEnd(Animator animation) {
69 | endAction.run();
70 | }
71 | });
72 | }
73 | } else {
74 | AlphaAnimation alphaAnimation = new AlphaAnimation(fromAlpha, toAlpha);
75 | alphaAnimation.setDuration(duration);
76 | alphaAnimation.setFillAfter(true);
77 | if (endAction != null) {
78 | alphaAnimation.setAnimationListener(new Animation.AnimationListener() {
79 | @Override
80 | public void onAnimationEnd(Animation animation) {
81 | // fixes the crash bug while removing views
82 | Handler handler = new Handler();
83 | handler.post(endAction);
84 | }
85 | @Override
86 | public void onAnimationStart(Animation animation) { }
87 | @Override
88 | public void onAnimationRepeat(Animation animation) { }
89 | });
90 | }
91 | view.startAnimation(alphaAnimation);
92 | }
93 | }
94 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/likebamboo/osa/android/ui/view/fa/ButtonAwesome.java:
--------------------------------------------------------------------------------
1 | package com.likebamboo.osa.android.ui.view.fa;
2 |
3 | import android.content.Context;
4 | import android.graphics.Typeface;
5 | import android.support.v4.util.LruCache;
6 | import android.util.AttributeSet;
7 | import android.widget.Button;
8 |
9 | /**
10 | * ButtonAwesome
11 | *
12 | * @see FontAwesomeAndroid
13 | */
14 | public class ButtonAwesome extends Button {
15 | private final static String NAME = "FONTAWESOME";
16 | private static LruCache sTypefaceCache = new LruCache(12);
17 |
18 | public ButtonAwesome(Context context) {
19 | super(context);
20 | init();
21 |
22 | }
23 |
24 | public ButtonAwesome(Context context, AttributeSet attrs) {
25 | super(context, attrs);
26 | init();
27 | }
28 |
29 | public ButtonAwesome(Context context, AttributeSet attrs, int defStyle) {
30 | super(context, attrs, defStyle);
31 | init();
32 | }
33 |
34 | public synchronized void init() {
35 | Typeface typeface = sTypefaceCache.get(NAME);
36 | if (typeface == null) {
37 | typeface = Typeface.createFromAsset(getContext().getAssets(), "fontawesome-webfont.ttf");
38 | sTypefaceCache.put(NAME, typeface);
39 | }
40 |
41 | setTypeface(typeface);
42 | }
43 | }
44 |
45 |
46 |
--------------------------------------------------------------------------------
/app/src/main/java/com/likebamboo/osa/android/ui/view/fa/TextAwesome.java:
--------------------------------------------------------------------------------
1 | package com.likebamboo.osa.android.ui.view.fa;
2 |
3 | import android.content.Context;
4 | import android.graphics.Typeface;
5 | import android.support.v4.util.LruCache;
6 | import android.util.AttributeSet;
7 | import android.widget.TextView;
8 |
9 | /**
10 | * DrawableAwesome
11 | *
12 | * @see FontAwesomeAndroid
13 | */
14 | public class TextAwesome extends TextView {
15 |
16 | private final static String NAME = "FONTAWESOME";
17 | private static LruCache sTypefaceCache = new LruCache(12);
18 |
19 | public TextAwesome(Context context) {
20 | super(context);
21 | init();
22 | }
23 |
24 | public TextAwesome(Context context, AttributeSet attrs) {
25 | super(context, attrs);
26 | init();
27 | }
28 |
29 | public synchronized void init() {
30 | Typeface typeface = sTypefaceCache.get(NAME);
31 | if (typeface == null) {
32 | typeface = Typeface.createFromAsset(getContext().getAssets(), "fontawesome-webfont.ttf");
33 | sTypefaceCache.put(NAME, typeface);
34 | }
35 | setTypeface(typeface);
36 | }
37 |
38 | /**
39 | * 设置文字
40 | *
41 | * @param icon
42 | * @param text
43 | */
44 | public void setText(int icon, String text) {
45 | String iconStr = getResources().getString(icon);
46 | setText(iconStr + " " + text);
47 | }
48 |
49 | }
50 |
51 |
52 |
--------------------------------------------------------------------------------
/app/src/main/java/com/likebamboo/osa/android/ui/view/fab/DirectionScrollListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014 SBG Apps
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.likebamboo.osa.android.ui.view.fab;
18 |
19 | import android.view.View;
20 | import android.widget.AbsListView;
21 |
22 | /**
23 | * Created by Stéphane on 09/07/2014.
24 | */
25 | public class DirectionScrollListener implements AbsListView.OnScrollListener {
26 |
27 | private static final int DIRECTION_CHANGE_THRESHOLD = 1;
28 | private final FloatingView mFloatingView;
29 | private int mPrevPosition;
30 | private int mPrevTop;
31 | private boolean mUpdated;
32 |
33 | public DirectionScrollListener(FloatingView floatingView) {
34 | mFloatingView = floatingView;
35 | }
36 |
37 | @Override
38 | public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
39 | final View topChild = view.getChildAt(0);
40 | int firstViewTop = 0;
41 | if (topChild != null) {
42 | firstViewTop = topChild.getTop();
43 | }
44 | boolean goingDown;
45 | boolean changed = true;
46 | if (mPrevPosition == firstVisibleItem) {
47 | final int topDelta = mPrevTop - firstViewTop;
48 | goingDown = firstViewTop < mPrevTop;
49 | changed = Math.abs(topDelta) > DIRECTION_CHANGE_THRESHOLD;
50 | } else {
51 | goingDown = firstVisibleItem > mPrevPosition;
52 | }
53 | if (changed && mUpdated) {
54 | if (goingDown) {
55 | mFloatingView.hide();
56 | } else {
57 | mFloatingView.show();
58 | }
59 | }
60 | mPrevPosition = firstVisibleItem;
61 | mPrevTop = firstViewTop;
62 | mUpdated = true;
63 | }
64 |
65 | @Override
66 | public void onScrollStateChanged(AbsListView view, int scrollState) {
67 | }
68 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/likebamboo/osa/android/ui/view/fab/FloatingView.java:
--------------------------------------------------------------------------------
1 | package com.likebamboo.osa.android.ui.view.fab;
2 |
3 | /**
4 | * 浮动的View接口
5 | * Created by wentaoli on 2015/6/15.
6 | */
7 | public interface FloatingView {
8 | /**
9 | * 隐藏
10 | */
11 | void hide();
12 |
13 | /**
14 | * 显示
15 | */
16 | void show();
17 | }
18 |
--------------------------------------------------------------------------------
/app/src/main/java/com/likebamboo/osa/android/ui/view/fastscroll/BubbleTextGetter.java:
--------------------------------------------------------------------------------
1 | package com.likebamboo.osa.android.ui.view.fastscroll;
2 |
3 | /**
4 | *
5 | */
6 | public interface BubbleTextGetter {
7 | String getTextToShowInBubble(int pos);
8 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/likebamboo/osa/android/utils/DateUtil.java:
--------------------------------------------------------------------------------
1 | package com.likebamboo.osa.android.utils;
2 |
3 | import android.text.TextUtils;
4 |
5 | import java.text.SimpleDateFormat;
6 | import java.util.Date;
7 |
8 | /**
9 | *
10 | */
11 | public class DateUtil {
12 |
13 | /**
14 | * 格式化服务器端给的时间字符串
15 | *
16 | * @param timeStr
17 | * @return
18 | */
19 | public static String parseDate(String timeStr) {
20 | return parseDate(timeStr, "yyyy-MM-dd");
21 | }
22 |
23 | /**
24 | * 将时间字符串转为本地显示的时间形式
25 | *
26 | * @param timeStr
27 | * @param pattern
28 | * @return
29 | */
30 | public static String parseDate(String timeStr, String pattern) {
31 | if (TextUtils.isEmpty(timeStr) || TextUtils.isEmpty(pattern)) {
32 | return "";
33 | }
34 |
35 | try {
36 | SimpleDateFormat sdf = new SimpleDateFormat(pattern);
37 | // 将字符串转为日期
38 | Date d = sdf.parse(timeStr);
39 | return parseDate(d.getTime());
40 | } catch (Exception e) {
41 | e.printStackTrace();
42 | }
43 | return timeStr;
44 | }
45 |
46 | /**
47 | * 将时间戳转为本地显示的时间形式
48 | *
49 | * @param timeStamp
50 | * @return
51 | */
52 | public static String parseDate(long timeStamp) {
53 | long now = System.currentTimeMillis();
54 | SimpleDateFormat sdf = null;
55 | try {
56 | // 将字符串转为日期
57 | Date d = new Date(timeStamp);
58 | Date dd = new Date();
59 | // 如果是同一天
60 | if ((now - timeStamp < ONE_DAY) && (d.getDate() == dd.getDate())) {
61 | // sdf = new SimpleDateFormat("HH:mm");
62 | return "今天";
63 | } else if (dd.getYear() != d.getYear()) {// 如果是不同年份
64 | sdf = new SimpleDateFormat("yyyy-MM-dd");
65 | } else {
66 | sdf = new SimpleDateFormat("MM-dd");
67 | }
68 | return sdf.format(d);
69 | } catch (Exception e) {
70 | e.printStackTrace();
71 | }
72 | return "";
73 | }
74 |
75 | public static final long ONE_DAY = 24 * 60 * 60 * 1000L;
76 | }
77 |
--------------------------------------------------------------------------------
/app/src/main/java/com/likebamboo/osa/android/utils/DeviceUtil.java:
--------------------------------------------------------------------------------
1 | package com.likebamboo.osa.android.utils;
2 |
3 | import android.content.Context;
4 | import android.content.pm.PackageInfo;
5 | import android.content.pm.PackageManager;
6 |
7 | /**
8 | * Created by likebamboo on 2015/5/30.
9 | */
10 | public class DeviceUtil {
11 |
12 | /**
13 | * 获取软件版本名称
14 | *
15 | * @param ctx
16 | * @return
17 | */
18 | public static String getVersionName(Context ctx) {
19 | if (ctx == null) {
20 | return "";
21 | }
22 |
23 | try {
24 | PackageManager pm = ctx.getPackageManager();
25 | PackageInfo pi = pm.getPackageInfo(ctx.getPackageName(), 0);
26 | return pi.versionName;
27 | } catch (PackageManager.NameNotFoundException e) {
28 | e.printStackTrace();
29 | }
30 | return "";
31 | }
32 |
33 | /**
34 | * 获取软件版本号
35 | *
36 | * @param ctx
37 | * @return
38 | */
39 | public static int getVersionCode(Context ctx) {
40 | if (ctx == null) {
41 | return 0;
42 | }
43 |
44 | try {
45 | PackageManager pm = ctx.getPackageManager();
46 | PackageInfo pi = pm.getPackageInfo(ctx.getPackageName(), 0);
47 | return pi.versionCode;
48 | } catch (PackageManager.NameNotFoundException e) {
49 | e.printStackTrace();
50 | }
51 | return 0;
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/app/src/main/java/com/likebamboo/osa/android/utils/NetworkUtil.java:
--------------------------------------------------------------------------------
1 |
2 | package com.likebamboo.osa.android.utils;
3 |
4 | import android.content.Context;
5 | import android.net.ConnectivityManager;
6 | import android.net.NetworkInfo;
7 | import android.util.Log;
8 |
9 | /**
10 | * @author likebamboo
11 | * @date 2015年5月17日
12 | */
13 | public class NetworkUtil {
14 |
15 | /**
16 | * Returns whether the network is available
17 | *
18 | * @param context Context
19 | * @return 网络是否可用
20 | * @see [类、类#方法、类#成员]
21 | */
22 | public static boolean isNetworkAvailable(Context context) {
23 | return getConnectedNetworkInfo(context) != null;
24 | }
25 |
26 | /**
27 | * 获取网络类型
28 | *
29 | * @param context Context
30 | * @return 网络类型
31 | * @see [类、类#方法、类#成员]
32 | */
33 | public static int getNetworkType(Context context) {
34 | NetworkInfo networkInfo = getConnectedNetworkInfo(context);
35 | if (networkInfo != null) {
36 | return networkInfo.getType();
37 | }
38 |
39 | return -1;
40 | }
41 |
42 | public static NetworkInfo getConnectedNetworkInfo(Context context) {
43 | try {
44 | ConnectivityManager connectivity = (ConnectivityManager) context
45 | .getSystemService(Context.CONNECTIVITY_SERVICE);
46 | if (connectivity == null) {
47 | Log.e("network", "couldn't get connectivity manager");
48 | } else {
49 | NetworkInfo info = connectivity.getActiveNetworkInfo();
50 | if (info != null) {
51 | return info;
52 | }
53 | }
54 | } catch (Exception e) {
55 | Log.e("network", e.toString(), e);
56 | }
57 | return null;
58 | }
59 |
60 | /**
61 | * 判断网络是不是手机网络,非wifi
62 | *
63 | * @param context Context
64 | * @return boolean
65 | * @see [类、类#方法、类#成员]
66 | */
67 | public static boolean isMobileNetwork(Context context) {
68 | return (ConnectivityManager.TYPE_MOBILE == getNetworkType(context));
69 | }
70 |
71 | /**
72 | * 判断网络是不是wifi
73 | *
74 | * @param context Context
75 | * @return boolean
76 | * @see [类、类#方法、类#成员]
77 | */
78 | public static boolean isWifiNetwork(Context context) {
79 | return (ConnectivityManager.TYPE_WIFI == getNetworkType(context));
80 | }
81 |
82 | }
83 |
--------------------------------------------------------------------------------
/app/src/main/java/com/likebamboo/osa/android/utils/PreferencesUtil.java:
--------------------------------------------------------------------------------
1 |
2 | package com.likebamboo.osa.android.utils;
3 |
4 | import android.content.Context;
5 | import android.content.SharedPreferences;
6 |
7 | /**
8 | * sharedPreferences工具类
9 | *
10 | * @author likebamboo
11 | * @version [版本号, 2015年6月8日]
12 | * @see [相关类/方法]
13 | * @since [产品/模块版本]
14 | */
15 | public class PreferencesUtil {
16 |
17 | /**
18 | * 当前数据库版本
19 | */
20 | public static final String PREF_DB_VERSION = "pref_db_version";
21 |
22 | private static String PREF_NAME = "osa_simple_data";
23 |
24 | private static PreferencesUtil mInstance = null;
25 |
26 | private SharedPreferences mSettings;
27 |
28 | private SharedPreferences.Editor mEditor;
29 |
30 | public static PreferencesUtil getInstance(Context context) {
31 | if (mInstance == null) {
32 | mInstance = new PreferencesUtil(context.getApplicationContext());
33 | }
34 | return mInstance;
35 | }
36 |
37 | public boolean contains(String key) {
38 | return mSettings.contains(key);
39 | }
40 |
41 | public String getString(String key) {
42 | return mSettings.getString(key, "");
43 | }
44 |
45 | public String getString(String key, String defValue) {
46 | return mSettings.getString(key, defValue);
47 | }
48 |
49 | public void putString(String key, String value) {
50 | mEditor.putString(key, value);
51 | mEditor.commit();
52 | }
53 |
54 | public void remove(String key) {
55 | mEditor.remove(key);
56 | mEditor.commit();
57 | }
58 |
59 | public void clear() {
60 | mEditor.clear();
61 | mEditor.commit();
62 | }
63 |
64 | public boolean getBoolean(String key, boolean defValue) {
65 | return mSettings.getBoolean(key, defValue);
66 | }
67 |
68 | public void putBoolean(String key, boolean value) {
69 | mEditor.putBoolean(key, value);
70 | mEditor.commit();
71 | }
72 |
73 | public int getInt(String key, int defValue) {
74 | return mSettings.getInt(key, defValue);
75 | }
76 |
77 | public void putInt(String key, int value) {
78 | mEditor.putInt(key, value);
79 | mEditor.commit();
80 | }
81 |
82 | public long getLong(String key, long defValue) {
83 | return mSettings.getLong(key, defValue);
84 | }
85 |
86 | public void putLong(String key, long value) {
87 | mEditor.putLong(key, value);
88 | mEditor.commit();
89 | }
90 |
91 | private PreferencesUtil(Context c) {
92 | mSettings = c.getSharedPreferences(PREF_NAME, 0);
93 | mEditor = mSettings.edit();
94 | }
95 | }
96 |
--------------------------------------------------------------------------------
/app/src/main/java/com/likebamboo/osa/android/utils/ToastUtil.java:
--------------------------------------------------------------------------------
1 | package com.likebamboo.osa.android.utils;
2 |
3 | import android.content.Context;
4 | import android.widget.Toast;
5 |
6 | /**
7 | * toast util
8 | *
9 | * @author likebamboo
10 | * @since 2015-06-08
11 | */
12 | public class ToastUtil {
13 |
14 | public static void show(Context context, int resId) {
15 | show(context, context.getResources().getText(resId), Toast.LENGTH_SHORT);
16 | }
17 |
18 | public static void show(Context context, int resId, int duration) {
19 | show(context, context.getResources().getText(resId), duration);
20 | }
21 |
22 | public static void show(Context context, CharSequence text) {
23 | show(context, text, Toast.LENGTH_SHORT);
24 | }
25 |
26 | public static void show(Context context, CharSequence text, int duration) {
27 | if (context == null) {
28 | return;
29 | }
30 | Toast.makeText(context, text, duration).show();
31 | }
32 |
33 | public static void show(Context context, int resId, Object... args) {
34 | show(context, String.format(context.getResources().getString(resId), args), Toast.LENGTH_SHORT);
35 | }
36 |
37 | public static void show(Context context, String format, Object... args) {
38 | show(context, String.format(format, args), Toast.LENGTH_SHORT);
39 | }
40 |
41 | public static void show(Context context, int resId, int duration, Object... args) {
42 | show(context, String.format(context.getResources().getString(resId), args), duration);
43 | }
44 |
45 | public static void show(Context context, String format, int duration, Object... args) {
46 | show(context, String.format(format, args), duration);
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/app/src/main/java/com/likebamboo/osa/android/utils/UrlDetect.java:
--------------------------------------------------------------------------------
1 | package com.likebamboo.osa.android.utils;
2 |
3 | import android.text.TextUtils;
4 | import android.webkit.URLUtil;
5 |
6 | import com.likebamboo.osa.android.request.RequestUrl;
7 |
8 | /**
9 | * URL 检测
10 | * Created by wentaoli on 2015/5/27.
11 | */
12 | public class UrlDetect {
13 |
14 | /**
15 | * 是否为正确的url
16 | *
17 | * @param url
18 | * @return
19 | */
20 | public static boolean isValidURL(String url) {
21 | if (TextUtils.isEmpty(url)) {
22 | return false;
23 | }
24 | return URLUtil.isValidUrl(url);
25 | }
26 |
27 | /**
28 | * 是否为本站URL
29 | *
30 | * @param url
31 | */
32 | public static boolean isOurselvesURL(String url) {
33 | if (!isValidURL(url)) {
34 | return false;
35 | }
36 | if (!url.startsWith("http")) {
37 | url = "http://" + url;
38 | }
39 | System.out.println(url);
40 | if (url.startsWith(RequestUrl.BASE_URL)) {
41 | return true;
42 | }
43 | return false;
44 | }
45 |
46 | /**
47 | * 是否是博客链接
48 | *
49 | * @param url
50 | * @return
51 | */
52 | public static String isBlogUrl(String url) {
53 | if (!isOurselvesURL(url)) {
54 | return "";
55 | }
56 | if (!url.startsWith("http")) {
57 | url = "http://" + url;
58 | }
59 | // 查看该链接是否以博客url开头
60 | if (!url.startsWith(RequestUrl.BLOG_URL)) {
61 | return "";
62 | }
63 | // 去掉链接前面的内容
64 | url = url.substring((RequestUrl.BLOG_URL + "/").length());
65 | // 如果处理后的 url 不含"/",或者只有最后一个字符是"/",说明是blog链接
66 | if (!url.contains("/") || url.indexOf("/") == url.length() - 1) {
67 | if (url.endsWith("/")) {
68 | url = url.substring(0, url.length() - 1);
69 | }
70 | return url;
71 | }
72 | return "";
73 | }
74 |
75 |
76 | /**
77 | * 是否是标签blog列表链接
78 | *
79 | * @param url
80 | * @return
81 | */
82 | public static String isTagBlogUrl(String url) {
83 | if (!isOurselvesURL(url)) {
84 | return "";
85 | }
86 | if (!url.startsWith("http")) {
87 | url = "http://" + url;
88 | }
89 | // 查看该链接是否以博客url开头
90 | if (!url.startsWith(RequestUrl.BLOG_URL)) {
91 | return "";
92 | }
93 | // 去掉链接前面的内容
94 | url = url.substring((RequestUrl.BLOG_URL + "/").length());
95 | // 如果 url 不是以 "tag/" 开头
96 | if (!url.toLowerCase().startsWith("tag/")) {
97 | return "";
98 | }
99 | // 截取 "tag/" 后边的内容
100 | url = url.substring(4);
101 | // 如果处理后的 url 不含"/",或者只有最后一个字符是"/",说明是 tag blog链接
102 | if (!url.contains("/") || url.indexOf("/") == url.length() - 1) {
103 | if (url.endsWith("/")) {
104 | url = url.substring(0, url.length() - 1);
105 | }
106 | return url;
107 | }
108 | return "";
109 | }
110 |
111 | }
112 |
--------------------------------------------------------------------------------
/app/src/main/java/com/likebamboo/osa/android/utils/ValidateUtil.java:
--------------------------------------------------------------------------------
1 | package com.likebamboo.osa.android.utils;
2 |
3 | import android.text.TextUtils;
4 |
5 | import java.util.regex.Matcher;
6 | import java.util.regex.Pattern;
7 |
8 | /**
9 | * 格式验证工具类
10 | * Created by likebamboo on 2015/7/16.
11 | */
12 | public class ValidateUtil {
13 |
14 | /**
15 | * 验证手机格式
16 | *
17 | * @param num
18 | * @return
19 | */
20 | public static boolean isPhoneNum(String num) {
21 | if (TextUtils.isEmpty(num) || num.length() < 11) {
22 | return false;
23 | }
24 | Pattern pattern = Pattern.compile("^(13[0-9]|15[0-9]|14[7|5]|17[0-9]|18[0-9])\\d{8}$");
25 | // 匹配手机号码
26 | Matcher matcher = pattern.matcher(num);
27 | return matcher.matches();
28 | }
29 |
30 | /**
31 | * 验证邮箱格式
32 | *
33 | * @param email
34 | * @return
35 | */
36 | public static boolean isEmail(String email) {
37 | String str = "^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$";
38 | Pattern p = Pattern.compile(str);
39 | Matcher m = p.matcher(email);
40 |
41 | return m.matches();
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/fade_in.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/fade_out.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/slide_down_dialog.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/slide_up_dialog.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/bg_card.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/likebamboo/AndroidBlog/c5db942056fc179b2a45fb1410e5ab9c0f431f37/app/src/main/res/drawable-hdpi/bg_card.9.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/bg_card_active.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/likebamboo/AndroidBlog/c5db942056fc179b2a45fb1410e5ab9c0f431f37/app/src/main/res/drawable-hdpi/bg_card_active.9.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/default_avatar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/likebamboo/AndroidBlog/c5db942056fc179b2a45fb1410e5ab9c0f431f37/app/src/main/res/drawable-hdpi/default_avatar.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_add_white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/likebamboo/AndroidBlog/c5db942056fc179b2a45fb1410e5ab9c0f431f37/app/src/main/res/drawable-hdpi/ic_add_white.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/likebamboo/AndroidBlog/c5db942056fc179b2a45fb1410e5ab9c0f431f37/app/src/main/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_up.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/likebamboo/AndroidBlog/c5db942056fc179b2a45fb1410e5ab9c0f431f37/app/src/main/res/drawable-hdpi/ic_up.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/likebamboo/AndroidBlog/c5db942056fc179b2a45fb1410e5ab9c0f431f37/app/src/main/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/likebamboo/AndroidBlog/c5db942056fc179b2a45fb1410e5ab9c0f431f37/app/src/main/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_up.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/likebamboo/AndroidBlog/c5db942056fc179b2a45fb1410e5ab9c0f431f37/app/src/main/res/drawable-xhdpi/ic_up.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/likebamboo/AndroidBlog/c5db942056fc179b2a45fb1410e5ab9c0f431f37/app/src/main/res/drawable-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bg_card_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bg_feedback_submit_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 | -
7 |
8 |
9 |
10 |
11 |
12 | -
13 |
14 |
15 |
16 |
17 |
18 |
19 | -
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bg_list_item_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 | -
7 |
8 |
9 |
10 |
11 | -
12 |
13 |
14 |
15 |
16 | -
17 |
18 |
19 |
20 |
21 | -
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bg_tag_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 | -
7 |
8 |
9 |
10 |
11 |
12 |
13 | -
14 |
15 |
16 |
17 |
18 |
19 |
20 | -
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bg_translucent_gradient.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/list_divider_padded_vertical.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | -
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/recycler_view_fast_scroller__bubble.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
10 |
11 |
12 |
15 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/recycler_view_fast_scroller__handle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
6 |
7 |
8 |
9 |
10 | -
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/webview_progress_bar.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
6 |
7 |
8 |
9 | -
10 |
11 |
12 |
13 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_about.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
13 |
14 |
18 |
19 |
25 |
26 |
27 |
37 |
38 |
46 |
47 |
56 |
57 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_author.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
10 |
11 |
15 |
16 |
20 |
21 |
22 |
23 |
32 |
33 |
34 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_blog.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
11 |
12 |
18 |
19 |
27 |
28 |
36 |
37 |
45 |
46 |
47 |
48 |
54 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_blog_list.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
11 |
12 |
19 |
20 |
21 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_category.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_navigation.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
11 |
15 |
16 |
17 |
23 |
24 |
29 |
31 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_search.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
12 |
13 |
18 |
19 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_webview.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/common_webview.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
11 |
12 |
19 |
20 |
25 |
26 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fab_tool_bar.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
17 |
18 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/footer_loading_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
15 |
16 |
22 |
23 |
32 |
33 |
34 |
40 |
41 |
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_author_info.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
13 |
14 |
18 |
19 |
25 |
26 |
27 |
37 |
38 |
45 |
46 |
49 |
50 |
54 |
55 |
56 |
63 |
64 |
67 |
68 |
74 |
75 |
76 |
82 |
83 |
86 |
87 |
92 |
93 |
94 |
95 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_feedback.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
11 |
12 |
19 |
20 |
29 |
30 |
38 |
39 |
47 |
48 |
57 |
58 |
63 |
64 |
73 |
74 |
84 |
85 |
95 |
96 |
97 |
98 |
99 |
103 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_navigation_drawer.xml:
--------------------------------------------------------------------------------
1 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
19 |
20 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_author.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
17 |
18 |
27 |
28 |
34 |
35 |
45 |
46 |
56 |
57 |
58 |
69 |
70 |
71 |
75 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_blog.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
13 |
14 |
18 |
19 |
27 |
28 |
37 |
38 |
39 |
43 |
44 |
54 |
55 |
56 |
62 |
63 |
72 |
73 |
81 |
82 |
83 |
84 |
85 |
90 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_category.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
13 |
14 |
20 |
21 |
32 |
33 |
43 |
44 |
45 |
46 |
50 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_nav_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_simple_list_dialog.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
20 |
21 |
31 |
32 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/list_filter_footer.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
16 |
17 |
24 |
25 |
35 |
36 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/recycler_view_fast_scroller.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
18 |
19 |
26 |
27 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/simple_list_dialog.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
22 |
23 |
27 |
28 |
38 |
39 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/simple_text.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/space_loading_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
15 |
21 |
22 |
31 |
32 |
33 |
39 |
40 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/webview_toolbar.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
13 |
14 |
23 |
24 |
33 |
34 |
35 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/edit.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/global.xml:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/main.xml:
--------------------------------------------------------------------------------
1 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/values/arrays.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | - 发现
6 | - 分类
7 | - 作者
8 | - 收藏
9 | - 设置
10 |
11 |
12 |
13 |
14 | - 意见反馈
15 | - 关于作者
16 | - 关于APP
17 |
18 |
19 |
20 |
21 | - 默认排序
22 | - 发表时间
23 | - 标题
24 | - 浏览量
25 |
26 |
27 |
28 |
29 |
30 | - post_time-desc
31 | - title-asc
32 | - viewCount-desc
33 |
34 |
--------------------------------------------------------------------------------
/app/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/app/src/main/res/values/attrs_fab.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | #eeeeee
5 |
6 | #34322d
7 |
8 | #e25600
9 |
10 | #88ffffff
11 |
12 | #faffffff
13 |
14 |
15 | #55000000
16 |
17 |
18 | #e0ffffff
19 |
20 |
21 | #1a000000
22 |
23 | #ff202020
24 |
25 | #ffe0e0e0
26 | #ffe9e9e9
27 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 16dp
5 | 16dp
6 |
8 | 240dp
9 |
10 | 16.0dip
11 | 24.0dip
12 | 8.0dip
13 | 12.0dip
14 | 4.0dip
15 | 6.0dip
16 | 2.0dip
17 | 1.0dip
18 | 32.0dip
19 | 48.0dip
20 |
21 | 16.0dip
22 | 24.0dip
23 | 8.0dip
24 | 12.0dip
25 | 4.0dip
26 | 2.0dip
27 | 32.0dip
28 | 36.0dip
29 | 48.0dip
30 |
31 |
32 | 16.0dip
33 | 18.0dip
34 | 14.0dip
35 | 12.0dip
36 | 10.0dip
37 | 20.0dip
38 | 8.0dip
39 | 22.0dip
40 | 24.0dip
41 | 28.0dip
42 |
43 | 56dp
44 | 16dp
45 |
46 |
--------------------------------------------------------------------------------
/app/src/main/res/values/ids.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/values/integers.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 2
4 | 3
5 | 1000
6 | 2000
7 | 3
8 | 2
9 | 2000
10 | 0
11 | 2
12 | 0
13 | 300
14 | 400
15 | 350
16 | 200
17 | 3
18 | 2
19 | 60
20 | 1800
21 | 6587000
22 | 2
23 | 3
24 | 2
25 | 2
26 | 2
27 | 2
28 | 1
29 | 2
30 | 300
31 | 600
32 | 5
33 | 200
34 | 5
35 | 3
36 | 4
37 | 1
38 | 3
39 | 2
40 | 20
41 | 200
42 | 3
43 |
44 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Android博客
4 |
5 | Open navigation drawer
6 | Close navigation drawer
7 | 数据加载中...
8 | 没有啦...
9 | 没有找到想要的数据
10 | 请重试
11 |
12 | 请输入关键字
13 |
14 | 历史记录
15 | %1$s 记录已删除
16 | 网络连接错误,请检查网络状态
17 |
18 | 反馈
19 | 详情
20 | issue
21 | 收藏
22 | 收藏成功
23 | 取消收藏
24 | 取消收藏成功
25 | 未收藏任何博客
26 |
27 | 译者
28 | 作者
29 | 分类
30 | 原文作者
31 | 发表时间
32 | 原文发表时间
33 | 来源链接
34 | 原文链接
35 |
36 | 获取博客信息失败
37 |
38 | 关于
39 | 版本:%1$s
40 | Etsy 。
42 | AndroidBlog网站已经上线。
43 | ]]>
44 |
45 | 更多...
46 |
47 | 全选
48 | 全不选
49 | 删除
50 |
51 | 排序
52 |
53 | 联系方式:
54 | 问题:
55 | 请填写邮箱/手机号
56 | 请填写正确的邮箱或手机号
57 | 请选择问题类型
58 | 描述:
59 | 请填写问题详细信息
60 | 提交
61 |
62 | 您的反馈信息我们已经收到,感谢使用~
63 |
64 |
--------------------------------------------------------------------------------
/art/author.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/likebamboo/AndroidBlog/c5db942056fc179b2a45fb1410e5ab9c0f431f37/art/author.png
--------------------------------------------------------------------------------
/art/blog.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/likebamboo/AndroidBlog/c5db942056fc179b2a45fb1410e5ab9c0f431f37/art/blog.png
--------------------------------------------------------------------------------
/art/home.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/likebamboo/AndroidBlog/c5db942056fc179b2a45fb1410e5ab9c0f431f37/art/home.png
--------------------------------------------------------------------------------
/art/info.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/likebamboo/AndroidBlog/c5db942056fc179b2a45fb1410e5ab9c0f431f37/art/info.png
--------------------------------------------------------------------------------
/art/menu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/likebamboo/AndroidBlog/c5db942056fc179b2a45fb1410e5ab9c0f431f37/art/menu.png
--------------------------------------------------------------------------------
/art/menu2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/likebamboo/AndroidBlog/c5db942056fc179b2a45fb1410e5ab9c0f431f37/art/menu2.png
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:1.2.2'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | maven {url "https://jitpack.io"}
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Wed Apr 10 15:27:10 PDT 2013
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/osa-android.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------