();
211 |
212 | for (int i = 0; i < getCount(); ++i) {
213 | result.add(mListMapping.get(i, i));
214 | }
215 |
216 | return result;
217 | }
218 |
219 | /**
220 | * Get the list position mapped to by the provided Cursor position.
221 | * If the provided Cursor position has been removed by a drag-sort,
222 | * this returns {@link #REMOVED}.
223 | *
224 | * @param cursorPosition A Cursor position
225 | * @return The mapped-to list position or REMOVED
226 | */
227 | public int getListPosition(int cursorPosition) {
228 | if (mRemovedCursorPositions.contains(cursorPosition)) {
229 | return REMOVED;
230 | }
231 |
232 | int index = mListMapping.indexOfValue(cursorPosition);
233 | if (index < 0) {
234 | return cursorPosition;
235 | } else {
236 | return mListMapping.keyAt(index);
237 | }
238 | }
239 |
240 |
241 | }
242 |
--------------------------------------------------------------------------------
/Library/library_drag-sort-listview/src/com/mobeta/android/dslv/DragSortItemView.java:
--------------------------------------------------------------------------------
1 | package com.mobeta.android.dslv;
2 |
3 | import android.content.Context;
4 | import android.view.Gravity;
5 | import android.view.View;
6 | import android.view.View.MeasureSpec;
7 | import android.view.ViewGroup;
8 | import android.widget.AbsListView;
9 | import android.util.Log;
10 |
11 | /**
12 | * Lightweight ViewGroup that wraps list items obtained from user's
13 | * ListAdapter. ItemView expects a single child that has a definite
14 | * height (i.e. the child's layout height is not MATCH_PARENT).
15 | * The width of
16 | * ItemView will always match the width of its child (that is,
17 | * the width MeasureSpec given to ItemView is passed directly
18 | * to the child, and the ItemView measured width is set to the
19 | * child's measured width). The height of ItemView can be anything;
20 | * the
21 | *
22 | *
23 | * The purpose of this class is to optimize slide
24 | * shuffle animations.
25 | */
26 | public class DragSortItemView extends ViewGroup {
27 |
28 | private int mGravity = Gravity.TOP;
29 |
30 | public DragSortItemView(Context context) {
31 | super(context);
32 |
33 | // always init with standard ListView layout params
34 | setLayoutParams(new AbsListView.LayoutParams(
35 | ViewGroup.LayoutParams.FILL_PARENT,
36 | ViewGroup.LayoutParams.WRAP_CONTENT));
37 |
38 | //setClipChildren(true);
39 | }
40 |
41 | public void setGravity(int gravity) {
42 | mGravity = gravity;
43 | }
44 |
45 | public int getGravity() {
46 | return mGravity;
47 | }
48 |
49 | @Override
50 | protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
51 | final View child = getChildAt(0);
52 |
53 | if (child == null) {
54 | return;
55 | }
56 |
57 | if (mGravity == Gravity.TOP) {
58 | child.layout(0, 0, getMeasuredWidth(), child.getMeasuredHeight());
59 | } else {
60 | child.layout(0, getMeasuredHeight() - child.getMeasuredHeight(), getMeasuredWidth(), getMeasuredHeight());
61 | }
62 | }
63 |
64 | /**
65 | *
66 | */
67 | @Override
68 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
69 |
70 | int height = MeasureSpec.getSize(heightMeasureSpec);
71 | int width = MeasureSpec.getSize(widthMeasureSpec);
72 |
73 | int heightMode = MeasureSpec.getMode(heightMeasureSpec);
74 |
75 | final View child = getChildAt(0);
76 | if (child == null) {
77 | setMeasuredDimension(0, width);
78 | return;
79 | }
80 |
81 | if (child.isLayoutRequested()) {
82 | // Always let child be as tall as it wants.
83 | measureChild(child, widthMeasureSpec,
84 | MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
85 | }
86 |
87 | if (heightMode == MeasureSpec.UNSPECIFIED) {
88 | ViewGroup.LayoutParams lp = getLayoutParams();
89 |
90 | if (lp.height > 0) {
91 | height = lp.height;
92 | } else {
93 | height = child.getMeasuredHeight();
94 | }
95 | }
96 |
97 | setMeasuredDimension(width, height);
98 | }
99 |
100 | }
101 |
--------------------------------------------------------------------------------
/Library/library_drag-sort-listview/src/com/mobeta/android/dslv/DragSortItemViewCheckable.java:
--------------------------------------------------------------------------------
1 | package com.mobeta.android.dslv;
2 |
3 | import android.content.Context;
4 | import android.view.Gravity;
5 | import android.view.View;
6 | import android.view.View.MeasureSpec;
7 | import android.view.ViewGroup;
8 | import android.widget.AbsListView;
9 | import android.widget.Checkable;
10 | import android.util.Log;
11 |
12 | /**
13 | * Lightweight ViewGroup that wraps list items obtained from user's
14 | * ListAdapter. ItemView expects a single child that has a definite
15 | * height (i.e. the child's layout height is not MATCH_PARENT).
16 | * The width of
17 | * ItemView will always match the width of its child (that is,
18 | * the width MeasureSpec given to ItemView is passed directly
19 | * to the child, and the ItemView measured width is set to the
20 | * child's measured width). The height of ItemView can be anything;
21 | * the
22 | *
23 | *
24 | * The purpose of this class is to optimize slide
25 | * shuffle animations.
26 | */
27 | public class DragSortItemViewCheckable extends DragSortItemView implements Checkable {
28 |
29 | public DragSortItemViewCheckable(Context context) {
30 | super(context);
31 | }
32 |
33 | @Override
34 | public boolean isChecked() {
35 | View child = getChildAt(0);
36 | if (child instanceof Checkable)
37 | return ((Checkable) child).isChecked();
38 | else
39 | return false;
40 | }
41 |
42 | @Override
43 | public void setChecked(boolean checked) {
44 | View child = getChildAt(0);
45 | if (child instanceof Checkable)
46 | ((Checkable) child).setChecked(checked);
47 | }
48 |
49 | @Override
50 | public void toggle() {
51 | View child = getChildAt(0);
52 | if (child instanceof Checkable)
53 | ((Checkable) child).toggle();
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/Library/library_drag-sort-listview/src/com/mobeta/android/dslv/ResourceDragSortCursorAdapter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011 The Android Open Source Project
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.mobeta.android.dslv;
18 |
19 | import android.content.Context;
20 | import android.database.Cursor;
21 | import android.view.View;
22 | import android.view.ViewGroup;
23 | import android.view.LayoutInflater;
24 |
25 | // taken from v4 rev. 10 ResourceCursorAdapter.java
26 |
27 | /**
28 | * Static library support version of the framework's {@link android.widget.ResourceCursorAdapter}.
29 | * Used to write apps that run on platforms prior to Android 3.0. When running
30 | * on Android 3.0 or above, this implementation is still used; it does not try
31 | * to switch to the framework's implementation. See the framework SDK
32 | * documentation for a class overview.
33 | */
34 | public abstract class ResourceDragSortCursorAdapter extends DragSortCursorAdapter {
35 | private int mLayout;
36 |
37 | private int mDropDownLayout;
38 |
39 | private LayoutInflater mInflater;
40 |
41 | /**
42 | * Constructor the enables auto-requery.
43 | *
44 | * @deprecated This option is discouraged, as it results in Cursor queries
45 | * being performed on the application's UI thread and thus can cause poor
46 | * responsiveness or even Application Not Responding errors. As an alternative,
47 | * use {@link android.app.LoaderManager} with a {@link android.content.CursorLoader}.
48 | *
49 | * @param context The context where the ListView associated with this adapter is running
50 | * @param layout resource identifier of a layout file that defines the views
51 | * for this list item. Unless you override them later, this will
52 | * define both the item views and the drop down views.
53 | */
54 | @Deprecated
55 | public ResourceDragSortCursorAdapter(Context context, int layout, Cursor c) {
56 | super(context, c);
57 | mLayout = mDropDownLayout = layout;
58 | mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
59 | }
60 |
61 | /**
62 | * Constructor with default behavior as per
63 | * {@link CursorAdapter#CursorAdapter(Context, Cursor, boolean)}; it is recommended
64 | * you not use this, but instead {@link #ResourceCursorAdapter(Context, int, Cursor, int)}.
65 | * When using this constructor, {@link #FLAG_REGISTER_CONTENT_OBSERVER}
66 | * will always be set.
67 | *
68 | * @param context The context where the ListView associated with this adapter is running
69 | * @param layout resource identifier of a layout file that defines the views
70 | * for this list item. Unless you override them later, this will
71 | * define both the item views and the drop down views.
72 | * @param c The cursor from which to get the data.
73 | * @param autoRequery If true the adapter will call requery() on the
74 | * cursor whenever it changes so the most recent
75 | * data is always displayed. Using true here is discouraged.
76 | */
77 | public ResourceDragSortCursorAdapter(Context context, int layout, Cursor c, boolean autoRequery) {
78 | super(context, c, autoRequery);
79 | mLayout = mDropDownLayout = layout;
80 | mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
81 | }
82 |
83 | /**
84 | * Standard constructor.
85 | *
86 | * @param context The context where the ListView associated with this adapter is running
87 | * @param layout Resource identifier of a layout file that defines the views
88 | * for this list item. Unless you override them later, this will
89 | * define both the item views and the drop down views.
90 | * @param c The cursor from which to get the data.
91 | * @param flags Flags used to determine the behavior of the adapter,
92 | * as per {@link CursorAdapter#CursorAdapter(Context, Cursor, int)}.
93 | */
94 | public ResourceDragSortCursorAdapter(Context context, int layout, Cursor c, int flags) {
95 | super(context, c, flags);
96 | mLayout = mDropDownLayout = layout;
97 | mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
98 | }
99 |
100 | /**
101 | * Inflates view(s) from the specified XML file.
102 | *
103 | * @see android.widget.CursorAdapter#newView(android.content.Context,
104 | * android.database.Cursor, ViewGroup)
105 | */
106 | @Override
107 | public View newView(Context context, Cursor cursor, ViewGroup parent) {
108 | return mInflater.inflate(mLayout, parent, false);
109 | }
110 |
111 | @Override
112 | public View newDropDownView(Context context, Cursor cursor, ViewGroup parent) {
113 | return mInflater.inflate(mDropDownLayout, parent, false);
114 | }
115 |
116 | /**
117 | * Sets the layout resource of the item views.
118 | *
119 | * @param layout the layout resources used to create item views
120 | */
121 | public void setViewResource(int layout) {
122 | mLayout = layout;
123 | }
124 |
125 | /**
126 | * Sets the layout resource of the drop down views.
127 | *
128 | * @param dropDownLayout the layout resources used to create drop down views
129 | */
130 | public void setDropDownViewResource(int dropDownLayout) {
131 | mDropDownLayout = dropDownLayout;
132 | }
133 | }
134 |
--------------------------------------------------------------------------------
/Library/library_drag-sort-listview/src/com/mobeta/android/dslv/SimpleFloatViewManager.java:
--------------------------------------------------------------------------------
1 | package com.mobeta.android.dslv;
2 |
3 | import android.graphics.Bitmap;
4 | import android.graphics.Point;
5 | import android.graphics.Color;
6 | import android.widget.ListView;
7 | import android.widget.ImageView;
8 | import android.view.View;
9 | import android.view.ViewGroup;
10 | import android.util.Log;
11 |
12 | /**
13 | * Simple implementation of the FloatViewManager class. Uses list
14 | * items as they appear in the ListView to create the floating View.
15 | */
16 | public class SimpleFloatViewManager implements DragSortListView.FloatViewManager {
17 |
18 | private Bitmap mFloatBitmap;
19 |
20 | private ImageView mImageView;
21 |
22 | private int mFloatBGColor = Color.BLACK;
23 |
24 | private ListView mListView;
25 |
26 | public SimpleFloatViewManager(ListView lv) {
27 | mListView = lv;
28 | }
29 |
30 | public void setBackgroundColor(int color) {
31 | mFloatBGColor = color;
32 | }
33 |
34 | /**
35 | * This simple implementation creates a Bitmap copy of the
36 | * list item currently shown at ListView position
.
37 | */
38 | @Override
39 | public View onCreateFloatView(int position) {
40 | // Guaranteed that this will not be null? I think so. Nope, got
41 | // a NullPointerException once...
42 | View v = mListView.getChildAt(position + mListView.getHeaderViewsCount() - mListView.getFirstVisiblePosition());
43 |
44 | if (v == null) {
45 | return null;
46 | }
47 |
48 | v.setPressed(false);
49 |
50 | // Create a copy of the drawing cache so that it does not get
51 | // recycled by the framework when the list tries to clean up memory
52 | //v.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_HIGH);
53 | v.setDrawingCacheEnabled(true);
54 | mFloatBitmap = Bitmap.createBitmap(v.getDrawingCache());
55 | v.setDrawingCacheEnabled(false);
56 |
57 | if (mImageView == null) {
58 | mImageView = new ImageView(mListView.getContext());
59 | }
60 | mImageView.setBackgroundColor(mFloatBGColor);
61 | mImageView.setPadding(0, 0, 0, 0);
62 | mImageView.setImageBitmap(mFloatBitmap);
63 | mImageView.setLayoutParams(new ViewGroup.LayoutParams(v.getWidth(), v.getHeight()));
64 |
65 | return mImageView;
66 | }
67 |
68 | /**
69 | * This does nothing
70 | */
71 | @Override
72 | public void onDragFloatView(View floatView, Point position, Point touch) {
73 | // do nothing
74 | }
75 |
76 | /**
77 | * Removes the Bitmap from the ImageView created in
78 | * onCreateFloatView() and tells the system to recycle it.
79 | */
80 | @Override
81 | public void onDestroyFloatView(View floatView) {
82 | ((ImageView) floatView).setImageDrawable(null);
83 |
84 | mFloatBitmap.recycle();
85 | mFloatBitmap = null;
86 | }
87 |
88 | }
89 |
90 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | 番茄学习法
2 | by Ra
3 |
--------------------------------------------------------------------------------
/TomatoTime/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
10 |
11 |
17 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/TomatoTime/gen/com/time/tomato/BuildConfig.java:
--------------------------------------------------------------------------------
1 | /** Automatically generated file. DO NOT MODIFY */
2 | package com.time.tomato;
3 |
4 | public final class BuildConfig {
5 | public final static boolean DEBUG = true;
6 | }
--------------------------------------------------------------------------------
/TomatoTime/ic_launcher-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/ic_launcher-web.png
--------------------------------------------------------------------------------
/TomatoTime/libs/android-support-v4.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/libs/android-support-v4.jar
--------------------------------------------------------------------------------
/TomatoTime/proguard-project.txt:
--------------------------------------------------------------------------------
1 | # To enable ProGuard in your project, edit project.properties
2 | # to define the proguard.config property as described in that file.
3 | #
4 | # Add project specific ProGuard rules here.
5 | # By default, the flags in this file are appended to flags specified
6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt
7 | # You can edit the include path and order by changing the ProGuard
8 | # include property in project.properties.
9 | #
10 | # For more details, see
11 | # http://developer.android.com/guide/developing/tools/proguard.html
12 |
13 | # Add any project specific keep options here:
14 |
15 | # If your project uses WebView with JS, uncomment the following
16 | # and specify the fully qualified class name to the JavaScript interface
17 | # class:
18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
19 | # public *;
20 | #}
21 |
--------------------------------------------------------------------------------
/TomatoTime/project.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system edit
7 | # "ant.properties", and override values to adapt the script to your
8 | # project structure.
9 | #
10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12 |
13 | # Project target.
14 | target=android-17
15 |
--------------------------------------------------------------------------------
/TomatoTime/res/anim/slide_buttom_in.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
--------------------------------------------------------------------------------
/TomatoTime/res/anim/slide_buttom_out.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
--------------------------------------------------------------------------------
/TomatoTime/res/anim/slide_top_in.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
--------------------------------------------------------------------------------
/TomatoTime/res/anim/slide_top_out.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
--------------------------------------------------------------------------------
/TomatoTime/res/drawable-hdpi/button_rotate_bottom_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/res/drawable-hdpi/button_rotate_bottom_normal.png
--------------------------------------------------------------------------------
/TomatoTime/res/drawable-hdpi/button_rotate_bottom_pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/res/drawable-hdpi/button_rotate_bottom_pressed.png
--------------------------------------------------------------------------------
/TomatoTime/res/drawable-hdpi/button_rotate_icon_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/res/drawable-hdpi/button_rotate_icon_normal.png
--------------------------------------------------------------------------------
/TomatoTime/res/drawable-hdpi/button_rotate_icon_pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/res/drawable-hdpi/button_rotate_icon_pressed.png
--------------------------------------------------------------------------------
/TomatoTime/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/TomatoTime/res/drawable-hdpi/ic_rotate_add.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/res/drawable-hdpi/ic_rotate_add.png
--------------------------------------------------------------------------------
/TomatoTime/res/drawable-hdpi/ic_rotate_refresh.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/res/drawable-hdpi/ic_rotate_refresh.png
--------------------------------------------------------------------------------
/TomatoTime/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/TomatoTime/res/drawable-nodpi/actionbar_shadow.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/res/drawable-nodpi/actionbar_shadow.9.png
--------------------------------------------------------------------------------
/TomatoTime/res/drawable-nodpi/card_background.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/res/drawable-nodpi/card_background.9.png
--------------------------------------------------------------------------------
/TomatoTime/res/drawable-nodpi/drawer_shadow.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/res/drawable-nodpi/drawer_shadow.9.png
--------------------------------------------------------------------------------
/TomatoTime/res/drawable-nodpi/finished_todo_section_bg.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/res/drawable-nodpi/finished_todo_section_bg.9.png
--------------------------------------------------------------------------------
/TomatoTime/res/drawable-nodpi/login_input.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/res/drawable-nodpi/login_input.9.png
--------------------------------------------------------------------------------
/TomatoTime/res/drawable-nodpi/popup_red.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/res/drawable-nodpi/popup_red.9.png
--------------------------------------------------------------------------------
/TomatoTime/res/drawable-nodpi/segment_radio_grey_left.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/res/drawable-nodpi/segment_radio_grey_left.9.png
--------------------------------------------------------------------------------
/TomatoTime/res/drawable-nodpi/segment_radio_grey_left_press.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/res/drawable-nodpi/segment_radio_grey_left_press.9.png
--------------------------------------------------------------------------------
/TomatoTime/res/drawable-nodpi/segment_radio_grey_right.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/res/drawable-nodpi/segment_radio_grey_right.9.png
--------------------------------------------------------------------------------
/TomatoTime/res/drawable-nodpi/segment_radio_grey_right_press.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/res/drawable-nodpi/segment_radio_grey_right_press.9.png
--------------------------------------------------------------------------------
/TomatoTime/res/drawable-nodpi/segment_radio_white_left.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/res/drawable-nodpi/segment_radio_white_left.9.png
--------------------------------------------------------------------------------
/TomatoTime/res/drawable-nodpi/segment_radio_white_left_press.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/res/drawable-nodpi/segment_radio_white_left_press.9.png
--------------------------------------------------------------------------------
/TomatoTime/res/drawable-nodpi/segment_radio_white_right.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/res/drawable-nodpi/segment_radio_white_right.9.png
--------------------------------------------------------------------------------
/TomatoTime/res/drawable-nodpi/segment_radio_white_right_press.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/res/drawable-nodpi/segment_radio_white_right_press.9.png
--------------------------------------------------------------------------------
/TomatoTime/res/drawable-nodpi/widget_preview.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/res/drawable-nodpi/widget_preview.png
--------------------------------------------------------------------------------
/TomatoTime/res/drawable-xhdpi/cir_checkbox_off.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/res/drawable-xhdpi/cir_checkbox_off.png
--------------------------------------------------------------------------------
/TomatoTime/res/drawable-xhdpi/cir_checkbox_on.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/res/drawable-xhdpi/cir_checkbox_on.png
--------------------------------------------------------------------------------
/TomatoTime/res/drawable-xhdpi/empty_finished_todo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/res/drawable-xhdpi/empty_finished_todo.png
--------------------------------------------------------------------------------
/TomatoTime/res/drawable-xhdpi/empty_history_view.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/res/drawable-xhdpi/empty_history_view.png
--------------------------------------------------------------------------------
/TomatoTime/res/drawable-xhdpi/empty_running_view.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/res/drawable-xhdpi/empty_running_view.png
--------------------------------------------------------------------------------
/TomatoTime/res/drawable-xhdpi/hlv_overscroll_glow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/res/drawable-xhdpi/hlv_overscroll_glow.png
--------------------------------------------------------------------------------
/TomatoTime/res/drawable-xhdpi/ic_action_bar_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/res/drawable-xhdpi/ic_action_bar_logo.png
--------------------------------------------------------------------------------
/TomatoTime/res/drawable-xhdpi/ic_action_cancel.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/res/drawable-xhdpi/ic_action_cancel.png
--------------------------------------------------------------------------------
/TomatoTime/res/drawable-xhdpi/ic_action_cancel_red.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/res/drawable-xhdpi/ic_action_cancel_red.png
--------------------------------------------------------------------------------
/TomatoTime/res/drawable-xhdpi/ic_action_delete.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/res/drawable-xhdpi/ic_action_delete.png
--------------------------------------------------------------------------------
/TomatoTime/res/drawable-xhdpi/ic_action_next_item.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/res/drawable-xhdpi/ic_action_next_item.png
--------------------------------------------------------------------------------
/TomatoTime/res/drawable-xhdpi/ic_action_overflow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/res/drawable-xhdpi/ic_action_overflow.png
--------------------------------------------------------------------------------
/TomatoTime/res/drawable-xhdpi/ic_action_play.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/res/drawable-xhdpi/ic_action_play.png
--------------------------------------------------------------------------------
/TomatoTime/res/drawable-xhdpi/ic_action_play_red.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/res/drawable-xhdpi/ic_action_play_red.png
--------------------------------------------------------------------------------
/TomatoTime/res/drawable-xhdpi/ic_action_previous_item.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/res/drawable-xhdpi/ic_action_previous_item.png
--------------------------------------------------------------------------------
/TomatoTime/res/drawable-xhdpi/ic_action_undo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/res/drawable-xhdpi/ic_action_undo.png
--------------------------------------------------------------------------------
/TomatoTime/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/TomatoTime/res/drawable-xhdpi/ic_pulltorefresh_arrow_up.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/res/drawable-xhdpi/ic_pulltorefresh_arrow_up.png
--------------------------------------------------------------------------------
/TomatoTime/res/drawable-xhdpi/ic_stat_notify_msg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/res/drawable-xhdpi/ic_stat_notify_msg.png
--------------------------------------------------------------------------------
/TomatoTime/res/drawable-xhdpi/pin_checked.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/res/drawable-xhdpi/pin_checked.png
--------------------------------------------------------------------------------
/TomatoTime/res/drawable-xhdpi/pin_unchecked.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/res/drawable-xhdpi/pin_unchecked.png
--------------------------------------------------------------------------------
/TomatoTime/res/drawable-xhdpi/progress_bg_pomo.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/res/drawable-xhdpi/progress_bg_pomo.9.png
--------------------------------------------------------------------------------
/TomatoTime/res/drawable-xhdpi/progress_primary_pomo.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/res/drawable-xhdpi/progress_primary_pomo.9.png
--------------------------------------------------------------------------------
/TomatoTime/res/drawable-xhdpi/progress_secondary_pomo.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/res/drawable-xhdpi/progress_secondary_pomo.9.png
--------------------------------------------------------------------------------
/TomatoTime/res/drawable/background_tab.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/TomatoTime/res/drawable/button_rotate_bottom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/TomatoTime/res/drawable/button_rotate_icon.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/TomatoTime/res/drawable/cir_checkbox.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/TomatoTime/res/drawable/history_row_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/TomatoTime/res/drawable/listview_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/TomatoTime/res/drawable/pin_checkbox.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/TomatoTime/res/drawable/wheel_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
20 |
21 |
22 | -
23 |
24 |
29 |
30 |
31 |
32 |
33 | -
34 |
35 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/TomatoTime/res/drawable/wheel_val.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
20 |
21 |
22 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/TomatoTime/res/layout/act_main.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
11 |
12 |
18 |
19 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/TomatoTime/res/layout/act_running.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
28 |
29 |
36 |
37 |
44 |
45 |
46 |
62 |
63 |
72 |
73 |
80 |
81 |
86 |
87 |
88 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
117 |
118 |
125 |
126 |
133 |
134 |
141 |
142 |
143 |
144 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
170 |
171 |
178 |
179 |
187 |
188 |
195 |
196 |
197 |
198 |
--------------------------------------------------------------------------------
/TomatoTime/res/layout/activity_finish_dialog.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
13 |
14 |
23 |
24 |
29 |
30 |
40 |
41 |
45 |
46 |
50 |
51 |
62 |
63 |
67 |
68 |
79 |
80 |
81 |
82 |
--------------------------------------------------------------------------------
/TomatoTime/res/layout/activity_finished_todo.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
22 |
23 |
28 |
29 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/TomatoTime/res/layout/arc_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
13 |
14 |
21 |
22 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/TomatoTime/res/layout/frm_history.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
27 |
28 |
34 |
35 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/TomatoTime/res/layout/frm_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
19 |
20 |
24 |
25 |
33 |
34 |
38 |
39 |
47 |
48 |
49 |
55 |
56 |
--------------------------------------------------------------------------------
/TomatoTime/res/layout/frm_statistical.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/TomatoTime/res/layout/frm_todolist.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
41 |
42 |
52 |
53 |
--------------------------------------------------------------------------------
/TomatoTime/res/layout/list_row_finished_todolist_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
15 |
16 |
27 |
28 |
38 |
39 |
52 |
53 |
54 |
60 |
61 |
--------------------------------------------------------------------------------
/TomatoTime/res/layout/list_row_finished_todolist_section.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
20 |
21 |
35 |
36 |
45 |
46 |
--------------------------------------------------------------------------------
/TomatoTime/res/layout/list_row_history_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
18 |
19 |
31 |
32 |
39 |
40 |
47 |
48 |
55 |
56 |
57 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
93 |
94 |
--------------------------------------------------------------------------------
/TomatoTime/res/layout/list_row_history_section.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/TomatoTime/res/layout/list_row_running_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/TomatoTime/res/layout/list_row_swipe_undo.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
19 |
20 |
25 |
26 |
38 |
39 |
--------------------------------------------------------------------------------
/TomatoTime/res/layout/list_row_todolist_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
15 |
16 |
27 |
28 |
39 |
40 |
53 |
54 |
55 |
62 |
63 |
74 |
75 |
--------------------------------------------------------------------------------
/TomatoTime/res/layout/process_actionbar.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
22 |
23 |
29 |
30 |
38 |
39 |
48 |
49 |
50 |
59 |
60 |
69 |
70 |
--------------------------------------------------------------------------------
/TomatoTime/res/layout/ray_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
12 |
13 |
20 |
21 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/TomatoTime/res/layout/refresh_footer.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
20 |
21 |
30 |
31 |
40 |
41 |
--------------------------------------------------------------------------------
/TomatoTime/res/layout/view_drawer.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
22 |
23 |
31 |
32 |
40 |
48 |
49 |
57 |
58 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/TomatoTime/res/layout/view_fake_listview.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
12 |
13 |
20 |
21 |
32 |
33 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/TomatoTime/res/layout/view_pop_add.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
12 |
13 |
21 |
22 |
33 |
34 |
40 |
41 |
47 |
48 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/TomatoTime/res/layout/view_wheel_time.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
18 |
19 |
24 |
25 |
26 |
32 |
33 |
--------------------------------------------------------------------------------
/TomatoTime/res/menu/main.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/TomatoTime/res/values-sw600dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/TomatoTime/res/values-sw720dp-land/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 | 128dp
8 |
9 |
10 |
--------------------------------------------------------------------------------
/TomatoTime/res/values-v11/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/TomatoTime/res/values-v14/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/TomatoTime/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/TomatoTime/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #ffe4e4e4
4 | #ff000000
5 | #ffd6d6d6
6 | #ffff0000
7 | #ffff6600
8 | #ffa5c4fa
9 | #ffffa500
10 | #ff4468a9
11 | #fff4f4f4
12 | #ffd6d6d6
13 | #fff4f4f4
14 | #ff4183c4
15 | #ff9b9b9b
16 | #ff4a4a4a
17 | #ffff0033
18 | #ffb4b4b4
19 |
20 |
--------------------------------------------------------------------------------
/TomatoTime/res/values/defaults.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | #ff33b5e5
5 | 4.0dip
6 | 2.0dip
7 | 4
8 | 0
9 | - 1.0
10 | false
11 | false
12 | false
13 |
14 |
--------------------------------------------------------------------------------
/TomatoTime/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 48.0dip
5 | 2.0dip
6 | 16.0dip
7 | 16.0dip
8 | 20.0dip
9 | 10.0dip
10 | 5.0dip
11 | 5.0dip
12 | 4.0dip
13 | 8.0dip
14 | 12.0dip
15 | 20.0dip
16 | 16.0dip
17 | 8.0dip
18 | 8.0dip
19 | 45.0dip
20 | 16sp
21 |
--------------------------------------------------------------------------------
/TomatoTime/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 搜索
5 | 增加新土豆
6 | 下午
7 | 番茄土豆
8 | 当前已是最新版本
9 | 四月
10 | 八月
11 | 最佳工作日
12 | 比平均值高出 %1$s
13 | 最佳工作时间
14 | 比平均值高出 %1$s
15 | 开始下一轮番茄
16 | 您现在可以开始下一轮番茄
17 | 休息时间结束
18 | 休息时间结束
19 | 休息中
20 | 出现了一些错误:(
21 | 服务器错误
22 | 检查更新
23 | 点击返回
24 | 请点击提交番茄
25 | 完成了 %1$d 个番茄
26 | 完成了 %1$d 个土豆
27 | 平均每日
28 | 十二月
29 | 您似乎使用的是 MIUI 系统
30 | 以后再说
31 | 立即下载
32 | 正在下载:%1$d%%
33 | 下载成功
34 | 番茄土豆更新中
35 | 编辑
36 | 编辑土豆
37 | 电子邮件
38 | 电子邮件地址有误
39 | 启用滴答声
40 | 请输入您的 Email 地址
41 | 错误:bad_email
42 | 错误:bad_password
43 | 错误:bad_username
44 | 错误:no_account
45 | 错误:电子邮箱账号不可用
46 | 错误:用户名不可用
47 | 错误:用户名不存在
48 | 错误:密码错误
49 | 二月
50 | 反馈
51 | 忘记了您的密码?
52 | 周五
53 | 星期五
54 | 五
55 | 放弃番茄
56 | 开始使用
57 | 结合最高效的时间管理方法“番茄工作法”和 GTD 任务管理方法,让工作如虎添翼。
58 | 结合番茄工作法和 GTD
59 | 任务和番茄历史数据都将安全的储存在云端,并在多个终端自动同步。供您随时随地使用。
60 | 跨平台多终端自动同步
61 | 集合了完整的工作流管理,在一个应用内完成收集想法、计划工作、完成任务、回顾历史的工作。
62 | 完整的工作流管理
63 | 已删除
64 | 一月
65 | 七月
66 | 六月
67 | "KEEP CALM AND GO BACK TO WORK"
68 | 登录
69 | 登录成功
70 | 注销
71 | 确定要注销吗?
72 | 注销时将会清空本地记录
73 | 注销成功
74 | 三月
75 | 五月
76 | 删除
77 | 编辑
78 | 反馈
79 | 帮助
80 | 设置
81 | 分享
82 | 午夜
83 | 自动调整为 MIUI 模式,如非 MIUI 系统用户请在设置中关闭。
84 | 周一
85 | 星期一
86 | 一
87 | 月增长
88 | 上午
89 | 发现新版本
90 | 晚上
91 | 中午
92 | 没有完成的土豆
93 | 没有找到相关的记录
94 | 放弃
95 | 十一月
96 | 发生错误:
97 | 十月
98 | 密码
99 | 密码不能为空
100 | 置顶的土豆会显示在这里
101 | 开启滴答声
102 | 请稍等……
103 | 提交番茄
104 | 是否要提交番茄?
105 | 番茄时间结束
106 | 番茄完成
107 | 番茄已完成
108 | 番茄运行中
109 | 番茄时间结束
110 | 番茄土豆运行中
111 | 已登录
112 | 屏蔽应用
113 | 可选择在工作时间屏蔽的应用
114 | 默认铃声
115 | 启用铃声
116 | 启用震动
117 | 启用 MIUI 模式
118 | 请使用 MIUI 的用户务必勾选此项
119 | 登录/注册
120 | 注销
121 | 更多
122 | 通知铃声
123 | 调试模式
124 | 时间将固定为1分钟
125 | 其它
126 | 番茄时间长度
127 | 喜欢这个应用请评分
128 | 无声
129 | 仅在 Wi-Fi 下同步
130 | 计时器
131 | 使用技巧
132 | 账户
133 | 下拉返回
134 | 上拉显示已完成的任务
135 | 加载中…
136 | 松开显示已完成的任务
137 | 松开后返回
138 | 注册
139 | 注册成功
140 | 周六
141 | 星期六
142 | 六
143 | 九月
144 | 服务器错误:
145 | 番茄土豆月统计数据
146 | 分享到..
147 | 开始
148 | 停止
149 | 真的要放弃本次休息吗?
150 | 放弃休息?
151 | 真的要放弃这个番茄吗?
152 | 放弃番茄?
153 | 提交
154 | 提交成功
155 | 周日
156 | 星期天
157 | 日
158 | 同步失败,请检查您的网络连接
159 | 同步成功
160 | 点击撤销
161 | 周四
162 | 星期四
163 | 四
164 | 滴答声已禁用
165 | 滴答声已启用
166 | 屏蔽应用
167 | 已完成的土豆
168 | 引导界面
169 |
170 | 账户
171 | 番茄土豆
172 | 番茄土豆
173 | 设置
174 | 历史
175 | 统计
176 | 土豆列表
177 | 今日已完成 %1$d 个番茄
178 | 今天尚未完成番茄
179 | 今天完成的番茄将显示在这里
180 | 土豆
181 | 土豆内容不能为空
182 | 总计
183 | 周二
184 | 星期二
185 | 二
186 | 用户名
187 | 用户名不能为空
188 | 已被删除
189 | 周三
190 | 星期三
191 | 三
192 | 凌晨
193 | 您刚刚完成了什么工作?
194 |
195 |
--------------------------------------------------------------------------------
/TomatoTime/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
14 |
15 |
16 |
19 |
20 |
28 |
29 |
--------------------------------------------------------------------------------
/TomatoTime/src/com/time/tomato/FinishedTodoActivity.java:
--------------------------------------------------------------------------------
1 | package com.time.tomato;
2 |
3 | import com.time.tomato.base.BaseActivity;
4 |
5 | public class FinishedTodoActivity extends BaseActivity{
6 |
7 | }
8 |
--------------------------------------------------------------------------------
/TomatoTime/src/com/time/tomato/MainActivity.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/src/com/time/tomato/MainActivity.java
--------------------------------------------------------------------------------
/TomatoTime/src/com/time/tomato/RunningActivity.java:
--------------------------------------------------------------------------------
1 | package com.time.tomato;
2 |
3 | import android.os.Bundle;
4 |
5 | import com.time.tomato.base.BaseActivity;
6 |
7 | public class RunningActivity extends BaseActivity {
8 | @Override
9 | protected void onCreate(Bundle savedInstanceState) {
10 | // TODO Auto-generated method stub
11 | super.onCreate(savedInstanceState);
12 | setContentView(R.layout.act_running);
13 | }
14 |
15 | @Override
16 | public void onBackPressed() {
17 | // TODO Auto-generated method stub
18 | super.onBackPressed();
19 | overridePendingTransition(0, R.anim.slide_top_out);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/TomatoTime/src/com/time/tomato/adapter/TodoListAdapter.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/src/com/time/tomato/adapter/TodoListAdapter.java
--------------------------------------------------------------------------------
/TomatoTime/src/com/time/tomato/adapter/TomatoPagerAdapter.java:
--------------------------------------------------------------------------------
1 | package com.time.tomato.adapter;
2 |
3 | import java.util.ArrayList;
4 |
5 | import android.support.v4.app.Fragment;
6 | import android.support.v4.app.FragmentManager;
7 | import android.support.v4.app.FragmentPagerAdapter;
8 | import android.support.v4.app.FragmentTransaction;
9 | import android.view.ViewGroup;
10 |
11 | public class TomatoPagerAdapter extends FragmentPagerAdapter {
12 | private ArrayList fragments;
13 | private FragmentManager fm;
14 |
15 | public TomatoPagerAdapter(FragmentManager fm) {
16 | super(fm);
17 | this.fm = fm;
18 | }
19 |
20 | public TomatoPagerAdapter(FragmentManager fm,ArrayList fragments) {
21 | super(fm);
22 | this.fm = fm;
23 | this.fragments = fragments;
24 | }
25 |
26 | public void setFragments(ArrayList fragments) {
27 | if (this.fragments != null) {
28 | FragmentTransaction ft = fm.beginTransaction();
29 | for (Fragment f : this.fragments) {
30 | ft.remove(f);
31 | }
32 | ft.commit();
33 | ft = null;
34 | fm.executePendingTransactions();
35 | }
36 | this.fragments = fragments;
37 | notifyDataSetChanged();
38 | }
39 |
40 | @Override
41 | public Fragment getItem(int position) {
42 | // TODO Auto-generated method stub
43 | return fragments.get(position);
44 | }
45 |
46 | @Override
47 | public int getCount() {
48 | // TODO Auto-generated method stub
49 | return fragments == null ? 0 : fragments.size();
50 | }
51 |
52 | @Override
53 | public int getItemPosition(Object object) {
54 | return POSITION_NONE;
55 | }
56 |
57 | @Override
58 | public Object instantiateItem(ViewGroup container, int position) {
59 | Object obj = super.instantiateItem(container, position);
60 | return obj;
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/TomatoTime/src/com/time/tomato/app/AppApplication.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/src/com/time/tomato/app/AppApplication.java
--------------------------------------------------------------------------------
/TomatoTime/src/com/time/tomato/base/BaseActivity.java:
--------------------------------------------------------------------------------
1 | package com.time.tomato.base;
2 |
3 | import android.app.Activity;
4 |
5 | public class BaseActivity extends Activity{
6 |
7 | }
8 |
--------------------------------------------------------------------------------
/TomatoTime/src/com/time/tomato/base/BaseFragment.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/src/com/time/tomato/base/BaseFragment.java
--------------------------------------------------------------------------------
/TomatoTime/src/com/time/tomato/db/DBHelper.java:
--------------------------------------------------------------------------------
1 | package com.time.tomato.db;
2 |
3 | import android.content.Context;
4 | import android.database.sqlite.SQLiteDatabase;
5 | import android.database.sqlite.SQLiteDatabase.CursorFactory;
6 | import android.database.sqlite.SQLiteOpenHelper;
7 |
8 | public class DBHelper extends SQLiteOpenHelper {
9 | public static String DB_NAME = "datebase.db";
10 | public static int DB_VERSION = 1;
11 | public static String TABLE_TOMATO = "tomato";
12 | public static String ID = "id";
13 | public static String CONTENT = "content";
14 | public static String ISTOP = "istop";
15 | public static String ISFINISHED = "isfinished";
16 | public static String ISIMPORTANT = "isimportant";
17 |
18 | public DBHelper(Context context) {
19 | super(context, DB_NAME, null, DB_VERSION);
20 | }
21 |
22 | @Override
23 | public void onCreate(SQLiteDatabase db) {
24 | String sql = "create table if not exists " + TABLE_TOMATO +
25 | "(_id INTEGER PRIMARY KEY AUTOINCREMENT, " +
26 | ID + " INTEGER , " +
27 | CONTENT + " TEXT , " +
28 | ISTOP + " LONG , " +
29 | ISFINISHED + " LONG , " +
30 | ISIMPORTANT + " LONG)";
31 | db.execSQL(sql);
32 | }
33 |
34 | @Override
35 | public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
36 | onCreate(db);
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/TomatoTime/src/com/time/tomato/db/DBUtil.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/src/com/time/tomato/db/DBUtil.java
--------------------------------------------------------------------------------
/TomatoTime/src/com/time/tomato/entity/TomatoEntity.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/src/com/time/tomato/entity/TomatoEntity.java
--------------------------------------------------------------------------------
/TomatoTime/src/com/time/tomato/fragment/HistoryFragment.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/src/com/time/tomato/fragment/HistoryFragment.java
--------------------------------------------------------------------------------
/TomatoTime/src/com/time/tomato/fragment/SettingsFragment.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/src/com/time/tomato/fragment/SettingsFragment.java
--------------------------------------------------------------------------------
/TomatoTime/src/com/time/tomato/fragment/StatisticalFragment.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/src/com/time/tomato/fragment/StatisticalFragment.java
--------------------------------------------------------------------------------
/TomatoTime/src/com/time/tomato/fragment/TodoListFragment.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/src/com/time/tomato/fragment/TodoListFragment.java
--------------------------------------------------------------------------------
/TomatoTime/src/com/time/tomato/service/AutoCountDownTimer.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/src/com/time/tomato/service/AutoCountDownTimer.java
--------------------------------------------------------------------------------
/TomatoTime/src/com/time/tomato/service/AutoService.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/src/com/time/tomato/service/AutoService.java
--------------------------------------------------------------------------------
/TomatoTime/src/com/time/tomato/tools/BaseTools.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/src/com/time/tomato/tools/BaseTools.java
--------------------------------------------------------------------------------
/TomatoTime/src/com/time/tomato/tools/Constants.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/src/com/time/tomato/tools/Constants.java
--------------------------------------------------------------------------------
/TomatoTime/src/com/time/tomato/tools/Settings.java:
--------------------------------------------------------------------------------
1 | package com.time.tomato.tools;
2 |
3 | import android.content.Context;
4 |
5 | public class Settings {
6 | // public static long finalTime(Context mContext, String mString, long mLong) {
7 | // return b(mContext).getLong(mString, mLong);
8 | // }
9 | }
10 |
--------------------------------------------------------------------------------
/TomatoTime/src/com/time/tomato/tools/TimeTools.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/src/com/time/tomato/tools/TimeTools.java
--------------------------------------------------------------------------------
/TomatoTime/src/com/time/tomato/tools/TomatoNotification.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/src/com/time/tomato/tools/TomatoNotification.java
--------------------------------------------------------------------------------
/TomatoTime/src/com/time/tomato/view/BeneathProcessBar.java:
--------------------------------------------------------------------------------
1 | package com.time.tomato.view;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 | import android.view.View;
6 |
7 | public class BeneathProcessBar extends View {
8 |
9 | public BeneathProcessBar(Context context, AttributeSet attrs, int defStyle) {
10 | super(context, attrs, defStyle);
11 | // TODO Auto-generated constructor stub
12 | }
13 |
14 | public BeneathProcessBar(Context context, AttributeSet attrs) {
15 | super(context, attrs);
16 | // TODO Auto-generated constructor stub
17 | }
18 |
19 | public BeneathProcessBar(Context context) {
20 | super(context);
21 | // TODO Auto-generated constructor stub
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/TomatoTime/src/com/time/tomato/view/DragListView.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/src/com/time/tomato/view/DragListView.java
--------------------------------------------------------------------------------
/TomatoTime/src/com/time/tomato/view/ProcessActionBar.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/src/com/time/tomato/view/ProcessActionBar.java
--------------------------------------------------------------------------------
/TomatoTime/src/com/time/tomato/view/PullToRefreshView.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rano1/TomatoTime/6204aafdf0c1a260057e690f09d97447a4ee9ba0/TomatoTime/src/com/time/tomato/view/PullToRefreshView.java
--------------------------------------------------------------------------------
/TomatoTime/src/com/time/tomato/view/rotatemenu/ArcLayout.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2012 Capricorn
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.time.tomato.view.rotatemenu;
18 |
19 | import com.time.tomato.R;
20 |
21 | import android.content.Context;
22 | import android.content.res.TypedArray;
23 | import android.graphics.Rect;
24 | import android.util.AttributeSet;
25 | import android.view.View;
26 | import android.view.ViewGroup;
27 | import android.view.animation.AccelerateInterpolator;
28 | import android.view.animation.Animation;
29 | import android.view.animation.AnimationSet;
30 | import android.view.animation.Interpolator;
31 | import android.view.animation.LinearInterpolator;
32 | import android.view.animation.OvershootInterpolator;
33 | import android.view.animation.RotateAnimation;
34 | import android.view.animation.Animation.AnimationListener;
35 |
36 | /**
37 | * A Layout that arranges its children around its center. The arc can be set by
38 | * calling {@link #setArc(float, float) setArc()}. You can override the method
39 | * {@link #onMeasure(int, int) onMeasure()}, otherwise it is always
40 | * WRAP_CONTENT.
41 | *
42 | * @author Capricorn
43 | *
44 | */
45 | public class ArcLayout extends ViewGroup {
46 | /**
47 | * children will be set the same size.
48 | */
49 | private int mChildSize;
50 |
51 | private int mChildPadding = 5;
52 |
53 | private int mLayoutPadding = 10;
54 |
55 | public static final float DEFAULT_FROM_DEGREES = 270.0f;
56 |
57 | public static final float DEFAULT_TO_DEGREES = 360.0f;
58 |
59 | private float mFromDegrees = DEFAULT_FROM_DEGREES;
60 |
61 | private float mToDegrees = DEFAULT_TO_DEGREES;
62 |
63 | private static final int MIN_RADIUS = 100;
64 |
65 | /* the distance between the layout's center and any child's center */
66 | private int mRadius;
67 |
68 | private boolean mExpanded = false;
69 |
70 | public ArcLayout(Context context) {
71 | super(context);
72 | }
73 |
74 | public ArcLayout(Context context, AttributeSet attrs) {
75 | super(context, attrs);
76 |
77 | if (attrs != null) {
78 | TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.ArcLayout, 0, 0);
79 | mFromDegrees = a.getFloat(R.styleable.ArcLayout_fromDegrees, DEFAULT_FROM_DEGREES);
80 | mToDegrees = a.getFloat(R.styleable.ArcLayout_toDegrees, DEFAULT_TO_DEGREES);
81 | mChildSize = Math.max(a.getDimensionPixelSize(R.styleable.ArcLayout_childSize, 0), 0);
82 |
83 | a.recycle();
84 | }
85 | }
86 |
87 | private static int computeRadius(final float arcDegrees, final int childCount, final int childSize,
88 | final int childPadding, final int minRadius) {
89 | if (childCount < 2) {
90 | return minRadius;
91 | }
92 |
93 | final float perDegrees = arcDegrees / (childCount - 1);
94 | final float perHalfDegrees = perDegrees / 2;
95 | final int perSize = childSize + childPadding;
96 |
97 | final int radius = (int) ((perSize / 2) / Math.sin(Math.toRadians(perHalfDegrees)));
98 |
99 | return Math.max(radius, minRadius);
100 | }
101 |
102 | private static Rect computeChildFrame(final int centerX, final int centerY, final int radius, final float degrees,
103 | final int size) {
104 |
105 | final double childCenterX = centerX + radius * Math.cos(Math.toRadians(degrees));
106 | final double childCenterY = centerY + radius * Math.sin(Math.toRadians(degrees));
107 |
108 | return new Rect((int) (childCenterX - size / 2), (int) (childCenterY - size / 2),
109 | (int) (childCenterX + size / 2), (int) (childCenterY + size / 2));
110 | }
111 |
112 | @Override
113 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
114 | final int radius = mRadius = computeRadius(Math.abs(mToDegrees - mFromDegrees), getChildCount(), mChildSize,
115 | mChildPadding, MIN_RADIUS);
116 | final int size = radius * 2 + mChildSize + mChildPadding + mLayoutPadding * 2;
117 |
118 | setMeasuredDimension(size, size);
119 |
120 | final int count = getChildCount();
121 | for (int i = 0; i < count; i++) {
122 | getChildAt(i).measure(MeasureSpec.makeMeasureSpec(mChildSize, MeasureSpec.EXACTLY),
123 | MeasureSpec.makeMeasureSpec(mChildSize, MeasureSpec.EXACTLY));
124 | }
125 | }
126 |
127 | @Override
128 | protected void onLayout(boolean changed, int l, int t, int r, int b) {
129 | final int centerX = getWidth() / 2;
130 | final int centerY = getHeight() / 2;
131 | final int radius = mExpanded ? mRadius : 0;
132 |
133 | final int childCount = getChildCount();
134 | final float perDegrees = (mToDegrees - mFromDegrees) / (childCount - 1);
135 |
136 | float degrees = mFromDegrees;
137 | for (int i = 0; i < childCount; i++) {
138 | Rect frame = computeChildFrame(centerX, centerY, radius, degrees, mChildSize);
139 | degrees += perDegrees;
140 | getChildAt(i).layout(frame.left, frame.top, frame.right, frame.bottom);
141 | }
142 | }
143 |
144 | /**
145 | * refers to {@link LayoutAnimationController#getDelayForView(View view)}
146 | */
147 | private static long computeStartOffset(final int childCount, final boolean expanded, final int index,
148 | final float delayPercent, final long duration, Interpolator interpolator) {
149 | final float delay = delayPercent * duration;
150 | final long viewDelay = (long) (getTransformedIndex(expanded, childCount, index) * delay);
151 | final float totalDelay = delay * childCount;
152 |
153 | float normalizedDelay = viewDelay / totalDelay;
154 | normalizedDelay = interpolator.getInterpolation(normalizedDelay);
155 |
156 | return (long) (normalizedDelay * totalDelay);
157 | }
158 |
159 | private static int getTransformedIndex(final boolean expanded, final int count, final int index) {
160 | if (expanded) {
161 | return count - 1 - index;
162 | }
163 |
164 | return index;
165 | }
166 |
167 | private static Animation createExpandAnimation(float fromXDelta, float toXDelta, float fromYDelta, float toYDelta,
168 | long startOffset, long duration, Interpolator interpolator) {
169 | Animation animation = new RotateAndTranslateAnimation(0, toXDelta, 0, toYDelta, 0, 720);
170 | animation.setStartOffset(startOffset);
171 | animation.setDuration(duration);
172 | animation.setInterpolator(interpolator);
173 | animation.setFillAfter(true);
174 |
175 | return animation;
176 | }
177 |
178 | private static Animation createShrinkAnimation(float fromXDelta, float toXDelta, float fromYDelta, float toYDelta,
179 | long startOffset, long duration, Interpolator interpolator) {
180 | AnimationSet animationSet = new AnimationSet(false);
181 | animationSet.setFillAfter(true);
182 |
183 | final long preDuration = duration / 2;
184 | Animation rotateAnimation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f,
185 | Animation.RELATIVE_TO_SELF, 0.5f);
186 | rotateAnimation.setStartOffset(startOffset);
187 | rotateAnimation.setDuration(preDuration);
188 | rotateAnimation.setInterpolator(new LinearInterpolator());
189 | rotateAnimation.setFillAfter(true);
190 |
191 | animationSet.addAnimation(rotateAnimation);
192 |
193 | Animation translateAnimation = new RotateAndTranslateAnimation(0, toXDelta, 0, toYDelta, 360, 720);
194 | translateAnimation.setStartOffset(startOffset + preDuration);
195 | translateAnimation.setDuration(duration - preDuration);
196 | translateAnimation.setInterpolator(interpolator);
197 | translateAnimation.setFillAfter(true);
198 |
199 | animationSet.addAnimation(translateAnimation);
200 |
201 | return animationSet;
202 | }
203 |
204 | private void bindChildAnimation(final View child, final int index, final long duration) {
205 | final boolean expanded = mExpanded;
206 | final int centerX = getWidth() / 2;
207 | final int centerY = getHeight() / 2;
208 | final int radius = expanded ? 0 : mRadius;
209 |
210 | final int childCount = getChildCount();
211 | final float perDegrees = (mToDegrees - mFromDegrees) / (childCount - 1);
212 | Rect frame = computeChildFrame(centerX, centerY, radius, mFromDegrees + index * perDegrees, mChildSize);
213 |
214 | final int toXDelta = frame.left - child.getLeft();
215 | final int toYDelta = frame.top - child.getTop();
216 |
217 | Interpolator interpolator = mExpanded ? new AccelerateInterpolator() : new OvershootInterpolator(1.5f);
218 | final long startOffset = computeStartOffset(childCount, mExpanded, index, 0.1f, duration, interpolator);
219 |
220 | Animation animation = mExpanded ? createShrinkAnimation(0, toXDelta, 0, toYDelta, startOffset, duration,
221 | interpolator) : createExpandAnimation(0, toXDelta, 0, toYDelta, startOffset, duration, interpolator);
222 |
223 | final boolean isLast = getTransformedIndex(expanded, childCount, index) == childCount - 1;
224 | animation.setAnimationListener(new AnimationListener() {
225 |
226 | @Override
227 | public void onAnimationStart(Animation animation) {
228 |
229 | }
230 |
231 | @Override
232 | public void onAnimationRepeat(Animation animation) {
233 |
234 | }
235 |
236 | @Override
237 | public void onAnimationEnd(Animation animation) {
238 | if (isLast) {
239 | postDelayed(new Runnable() {
240 |
241 | @Override
242 | public void run() {
243 | onAllAnimationsEnd();
244 | }
245 | }, 0);
246 | }
247 | }
248 | });
249 |
250 | child.setAnimation(animation);
251 | }
252 |
253 | public boolean isExpanded() {
254 | return mExpanded;
255 | }
256 |
257 | public void setArc(float fromDegrees, float toDegrees) {
258 | if (mFromDegrees == fromDegrees && mToDegrees == toDegrees) {
259 | return;
260 | }
261 |
262 | mFromDegrees = fromDegrees;
263 | mToDegrees = toDegrees;
264 |
265 | requestLayout();
266 | }
267 |
268 | public void setChildSize(int size) {
269 | if (mChildSize == size || size < 0) {
270 | return;
271 | }
272 |
273 | mChildSize = size;
274 |
275 | requestLayout();
276 | }
277 |
278 | public int getChildSize() {
279 | return mChildSize;
280 | }
281 |
282 | /**
283 | * switch between expansion and shrinkage
284 | *
285 | * @param showAnimation
286 | */
287 | public void switchState(final boolean showAnimation) {
288 | if (showAnimation) {
289 | final int childCount = getChildCount();
290 | for (int i = 0; i < childCount; i++) {
291 | bindChildAnimation(getChildAt(i), i, 300);
292 | }
293 | }
294 |
295 | mExpanded = !mExpanded;
296 |
297 | if (!showAnimation) {
298 | requestLayout();
299 | }
300 |
301 | invalidate();
302 | }
303 |
304 | private void onAllAnimationsEnd() {
305 | final int childCount = getChildCount();
306 | for (int i = 0; i < childCount; i++) {
307 | getChildAt(i).clearAnimation();
308 | }
309 |
310 | requestLayout();
311 | }
312 |
313 | }
314 |
--------------------------------------------------------------------------------
/TomatoTime/src/com/time/tomato/view/rotatemenu/ArcMenu.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2012 Capricorn
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.time.tomato.view.rotatemenu;
18 |
19 | import com.time.tomato.R;
20 |
21 | import android.content.Context;
22 | import android.content.res.TypedArray;
23 | import android.util.AttributeSet;
24 | import android.view.LayoutInflater;
25 | import android.view.MotionEvent;
26 | import android.view.View;
27 | import android.view.ViewGroup;
28 | import android.view.animation.AlphaAnimation;
29 | import android.view.animation.Animation;
30 | import android.view.animation.AnimationSet;
31 | import android.view.animation.DecelerateInterpolator;
32 | import android.view.animation.RotateAnimation;
33 | import android.view.animation.ScaleAnimation;
34 | import android.view.animation.Animation.AnimationListener;
35 | import android.widget.ImageView;
36 | import android.widget.RelativeLayout;
37 |
38 | /**
39 | * A custom view that looks like the menu in Path
40 | * 2.0 (for iOS).
41 | *
42 | * @author Capricorn
43 | *
44 | */
45 | public class ArcMenu extends RelativeLayout {
46 | private ArcLayout mArcLayout;
47 |
48 | private ImageView mHintView;
49 |
50 | public ArcMenu(Context context) {
51 | super(context);
52 | init(context);
53 | }
54 |
55 | public ArcMenu(Context context, AttributeSet attrs) {
56 | super(context, attrs);
57 | init(context);
58 | applyAttrs(attrs);
59 | }
60 |
61 | private void init(Context context) {
62 | LayoutInflater li = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
63 | li.inflate(R.layout.arc_menu, this);
64 |
65 | mArcLayout = (ArcLayout) findViewById(R.id.item_layout);
66 |
67 | final ViewGroup controlLayout = (ViewGroup) findViewById(R.id.control_layout);
68 | controlLayout.setClickable(true);
69 | controlLayout.setOnTouchListener(new OnTouchListener() {
70 |
71 | @Override
72 | public boolean onTouch(View v, MotionEvent event) {
73 | if (event.getAction() == MotionEvent.ACTION_DOWN) {
74 | mHintView.startAnimation(createHintSwitchAnimation(mArcLayout.isExpanded()));
75 | mArcLayout.switchState(true);
76 | }
77 |
78 | return false;
79 | }
80 | });
81 |
82 | mHintView = (ImageView) findViewById(R.id.control_hint);
83 | }
84 |
85 | private void applyAttrs(AttributeSet attrs) {
86 | if (attrs != null) {
87 | TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.ArcLayout, 0, 0);
88 |
89 | float fromDegrees = a.getFloat(R.styleable.ArcLayout_fromDegrees, ArcLayout.DEFAULT_FROM_DEGREES);
90 | float toDegrees = a.getFloat(R.styleable.ArcLayout_toDegrees, ArcLayout.DEFAULT_TO_DEGREES);
91 | mArcLayout.setArc(fromDegrees, toDegrees);
92 |
93 | int defaultChildSize = mArcLayout.getChildSize();
94 | int newChildSize = a.getDimensionPixelSize(R.styleable.ArcLayout_childSize, defaultChildSize);
95 | mArcLayout.setChildSize(newChildSize);
96 |
97 | a.recycle();
98 | }
99 | }
100 |
101 | public void addItem(View item, OnClickListener listener) {
102 | mArcLayout.addView(item);
103 | item.setOnClickListener(getItemClickListener(listener));
104 | }
105 |
106 | private OnClickListener getItemClickListener(final OnClickListener listener) {
107 | return new OnClickListener() {
108 |
109 | @Override
110 | public void onClick(final View viewClicked) {
111 | Animation animation = bindItemAnimation(viewClicked, true, 400);
112 | animation.setAnimationListener(new AnimationListener() {
113 |
114 | @Override
115 | public void onAnimationStart(Animation animation) {
116 |
117 | }
118 |
119 | @Override
120 | public void onAnimationRepeat(Animation animation) {
121 |
122 | }
123 |
124 | @Override
125 | public void onAnimationEnd(Animation animation) {
126 | postDelayed(new Runnable() {
127 |
128 | @Override
129 | public void run() {
130 | itemDidDisappear();
131 | }
132 | }, 0);
133 | }
134 | });
135 |
136 | final int itemCount = mArcLayout.getChildCount();
137 | for (int i = 0; i < itemCount; i++) {
138 | View item = mArcLayout.getChildAt(i);
139 | if (viewClicked != item) {
140 | bindItemAnimation(item, false, 300);
141 | }
142 | }
143 |
144 | mArcLayout.invalidate();
145 | mHintView.startAnimation(createHintSwitchAnimation(true));
146 |
147 | if (listener != null) {
148 | listener.onClick(viewClicked);
149 | }
150 | }
151 | };
152 | }
153 |
154 | private Animation bindItemAnimation(final View child, final boolean isClicked, final long duration) {
155 | Animation animation = createItemDisapperAnimation(duration, isClicked);
156 | child.setAnimation(animation);
157 |
158 | return animation;
159 | }
160 |
161 | private void itemDidDisappear() {
162 | final int itemCount = mArcLayout.getChildCount();
163 | for (int i = 0; i < itemCount; i++) {
164 | View item = mArcLayout.getChildAt(i);
165 | item.clearAnimation();
166 | }
167 |
168 | mArcLayout.switchState(false);
169 | }
170 |
171 | private static Animation createItemDisapperAnimation(final long duration, final boolean isClicked) {
172 | AnimationSet animationSet = new AnimationSet(true);
173 | animationSet.addAnimation(new ScaleAnimation(1.0f, isClicked ? 2.0f : 0.0f, 1.0f, isClicked ? 2.0f : 0.0f,
174 | Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f));
175 | animationSet.addAnimation(new AlphaAnimation(1.0f, 0.0f));
176 |
177 | animationSet.setDuration(duration);
178 | animationSet.setInterpolator(new DecelerateInterpolator());
179 | animationSet.setFillAfter(true);
180 |
181 | return animationSet;
182 | }
183 |
184 | private static Animation createHintSwitchAnimation(final boolean expanded) {
185 | Animation animation = new RotateAnimation(expanded ? 45 : 0, expanded ? 0 : 45, Animation.RELATIVE_TO_SELF,
186 | 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
187 | animation.setStartOffset(0);
188 | animation.setDuration(100);
189 | animation.setInterpolator(new DecelerateInterpolator());
190 | animation.setFillAfter(true);
191 |
192 | return animation;
193 | }
194 | }
195 |
--------------------------------------------------------------------------------
/TomatoTime/src/com/time/tomato/view/rotatemenu/RayLayout.java:
--------------------------------------------------------------------------------
1 | package com.time.tomato.view.rotatemenu;
2 |
3 | import com.time.tomato.R;
4 |
5 | import android.content.Context;
6 | import android.content.res.TypedArray;
7 | import android.graphics.Rect;
8 | import android.util.AttributeSet;
9 | import android.view.View;
10 | import android.view.ViewGroup;
11 | import android.view.animation.AccelerateInterpolator;
12 | import android.view.animation.Animation;
13 | import android.view.animation.AnimationSet;
14 | import android.view.animation.Interpolator;
15 | import android.view.animation.LinearInterpolator;
16 | import android.view.animation.OvershootInterpolator;
17 | import android.view.animation.RotateAnimation;
18 | import android.view.animation.Animation.AnimationListener;
19 |
20 | public class RayLayout extends ViewGroup {
21 |
22 | /**
23 | * children will be set the same size.
24 | */
25 | private int mChildSize;
26 |
27 | /* the distance between child Views */
28 | private int mChildGap;
29 |
30 | /* left space to place the switch button */
31 | private int mLeftHolderWidth;
32 |
33 | private boolean mExpanded = false;
34 |
35 | public RayLayout(Context context) {
36 | super(context);
37 | }
38 |
39 | public RayLayout(Context context, AttributeSet attrs) {
40 | super(context, attrs);
41 |
42 | if (attrs != null) {
43 | TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.ArcLayout, 0, 0);
44 | mChildSize = Math.max(a.getDimensionPixelSize(R.styleable.ArcLayout_childSize, 0), 0);
45 | a.recycle();
46 |
47 | a = getContext().obtainStyledAttributes(attrs, R.styleable.RayLayout, 0, 0);
48 | mLeftHolderWidth = Math.max(a.getDimensionPixelSize(R.styleable.RayLayout_leftHolderWidth, 0), 0);
49 | a.recycle();
50 |
51 | }
52 | }
53 |
54 | private static int computeChildGap(final float width, final int childCount, final int childSize, final int minGap) {
55 | return Math.max((int) (width / childCount - childSize), minGap);
56 | }
57 |
58 | private static Rect computeChildFrame(final boolean expanded, final int paddingLeft, final int childIndex,
59 | final int gap, final int size) {
60 | final int left = expanded ? (paddingLeft + childIndex * (gap + size) + gap) : ((paddingLeft - size) / 2);
61 |
62 | return new Rect(left, 0, left + size, size);
63 | }
64 |
65 | @Override
66 | protected int getSuggestedMinimumHeight() {
67 | return mChildSize;
68 | }
69 |
70 | @Override
71 | protected int getSuggestedMinimumWidth() {
72 | return mLeftHolderWidth + mChildSize * getChildCount();
73 | }
74 |
75 | @Override
76 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
77 | super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(getSuggestedMinimumHeight(), MeasureSpec.EXACTLY));
78 |
79 | final int count = getChildCount();
80 | mChildGap = computeChildGap(getMeasuredWidth() - mLeftHolderWidth, count, mChildSize, 0);
81 |
82 | for (int i = 0; i < count; i++) {
83 | getChildAt(i).measure(MeasureSpec.makeMeasureSpec(mChildSize, MeasureSpec.EXACTLY),
84 | MeasureSpec.makeMeasureSpec(mChildSize, MeasureSpec.EXACTLY));
85 | }
86 | }
87 |
88 | @Override
89 | protected void onLayout(boolean changed, int l, int t, int r, int b) {
90 | final int paddingLeft = mLeftHolderWidth;
91 | final int childCount = getChildCount();
92 |
93 | for (int i = 0; i < childCount; i++) {
94 | Rect frame = computeChildFrame(mExpanded, paddingLeft, i, mChildGap, mChildSize);
95 | getChildAt(i).layout(frame.left, frame.top, frame.right, frame.bottom);
96 | }
97 |
98 | }
99 |
100 | /**
101 | * refers to {@link LayoutAnimationController#getDelayForView(View view)}
102 | */
103 | private static long computeStartOffset(final int childCount, final boolean expanded, final int index,
104 | final float delayPercent, final long duration, Interpolator interpolator) {
105 | final float delay = delayPercent * duration;
106 | final long viewDelay = (long) (getTransformedIndex(expanded, childCount, index) * delay);
107 | final float totalDelay = delay * childCount;
108 |
109 | float normalizedDelay = viewDelay / totalDelay;
110 | normalizedDelay = interpolator.getInterpolation(normalizedDelay);
111 |
112 | return (long) (normalizedDelay * totalDelay);
113 | }
114 |
115 | private static int getTransformedIndex(final boolean expanded, final int count, final int index) {
116 | return count - 1 - index;
117 | }
118 |
119 | private static Animation createExpandAnimation(float fromXDelta, float toXDelta, float fromYDelta, float toYDelta,
120 | long startOffset, long duration, Interpolator interpolator) {
121 | Animation animation = new RotateAndTranslateAnimation(0, toXDelta, 0, toYDelta, 0, 720);
122 | animation.setStartOffset(startOffset);
123 | animation.setDuration(duration);
124 | animation.setInterpolator(interpolator);
125 | animation.setFillAfter(true);
126 |
127 | return animation;
128 | }
129 |
130 | private static Animation createShrinkAnimation(float fromXDelta, float toXDelta, float fromYDelta, float toYDelta,
131 | long startOffset, long duration, Interpolator interpolator) {
132 | AnimationSet animationSet = new AnimationSet(false);
133 | animationSet.setFillAfter(true);
134 |
135 | final long preDuration = duration / 2;
136 | Animation rotateAnimation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f,
137 | Animation.RELATIVE_TO_SELF, 0.5f);
138 | rotateAnimation.setStartOffset(startOffset);
139 | rotateAnimation.setDuration(preDuration);
140 | rotateAnimation.setInterpolator(new LinearInterpolator());
141 | rotateAnimation.setFillAfter(true);
142 |
143 | animationSet.addAnimation(rotateAnimation);
144 |
145 | Animation translateAnimation = new RotateAndTranslateAnimation(0, toXDelta, 0, toYDelta, 360, 720);
146 | translateAnimation.setStartOffset(startOffset + preDuration);
147 | translateAnimation.setDuration(duration - preDuration);
148 | translateAnimation.setInterpolator(interpolator);
149 | translateAnimation.setFillAfter(true);
150 |
151 | animationSet.addAnimation(translateAnimation);
152 |
153 | return animationSet;
154 | }
155 |
156 | private void bindChildAnimation(final View child, final int index, final long duration) {
157 | final boolean expanded = mExpanded;
158 | final int childCount = getChildCount();
159 | Rect frame = computeChildFrame(!expanded, mLeftHolderWidth, index, mChildGap, mChildSize);
160 |
161 | final int toXDelta = frame.left - child.getLeft();
162 | final int toYDelta = frame.top - child.getTop();
163 |
164 | Interpolator interpolator = mExpanded ? new AccelerateInterpolator() : new OvershootInterpolator(1.5f);
165 | final long startOffset = computeStartOffset(childCount, mExpanded, index, 0.1f, duration, interpolator);
166 |
167 | Animation animation = mExpanded ? createShrinkAnimation(0, toXDelta, 0, toYDelta, startOffset, duration,
168 | interpolator) : createExpandAnimation(0, toXDelta, 0, toYDelta, startOffset, duration, interpolator);
169 |
170 | final boolean isLast = getTransformedIndex(expanded, childCount, index) == childCount - 1;
171 | animation.setAnimationListener(new AnimationListener() {
172 |
173 | @Override
174 | public void onAnimationStart(Animation animation) {
175 |
176 | }
177 |
178 | @Override
179 | public void onAnimationRepeat(Animation animation) {
180 |
181 | }
182 |
183 | @Override
184 | public void onAnimationEnd(Animation animation) {
185 | if (isLast) {
186 | postDelayed(new Runnable() {
187 |
188 | @Override
189 | public void run() {
190 | onAllAnimationsEnd();
191 | }
192 | }, 0);
193 | }
194 | }
195 | });
196 |
197 | child.setAnimation(animation);
198 | }
199 |
200 | public boolean isExpanded() {
201 | return mExpanded;
202 | }
203 |
204 | public void setChildSize(int size) {
205 | if (mChildSize == size || size < 0) {
206 | return;
207 | }
208 |
209 | mChildSize = size;
210 |
211 | requestLayout();
212 | }
213 |
214 | /**
215 | * switch between expansion and shrinkage
216 | *
217 | * @param showAnimation
218 | */
219 | public void switchState(final boolean showAnimation) {
220 | if (showAnimation) {
221 | final int childCount = getChildCount();
222 | for (int i = 0; i < childCount; i++) {
223 | bindChildAnimation(getChildAt(i), i, 300);
224 | }
225 | }
226 |
227 | mExpanded = !mExpanded;
228 |
229 | if (!showAnimation) {
230 | requestLayout();
231 | }
232 |
233 | invalidate();
234 | }
235 |
236 | private void onAllAnimationsEnd() {
237 | final int childCount = getChildCount();
238 | for (int i = 0; i < childCount; i++) {
239 | getChildAt(i).clearAnimation();
240 | }
241 |
242 | requestLayout();
243 | }
244 |
245 | }
246 |
--------------------------------------------------------------------------------
/TomatoTime/src/com/time/tomato/view/rotatemenu/RayMenu.java:
--------------------------------------------------------------------------------
1 | package com.time.tomato.view.rotatemenu;
2 |
3 | import com.time.tomato.R;
4 |
5 | import android.content.Context;
6 | import android.util.AttributeSet;
7 | import android.view.LayoutInflater;
8 | import android.view.MotionEvent;
9 | import android.view.View;
10 | import android.view.ViewGroup;
11 | import android.view.animation.AlphaAnimation;
12 | import android.view.animation.Animation;
13 | import android.view.animation.AnimationSet;
14 | import android.view.animation.DecelerateInterpolator;
15 | import android.view.animation.RotateAnimation;
16 | import android.view.animation.ScaleAnimation;
17 | import android.view.animation.Animation.AnimationListener;
18 | import android.widget.ImageView;
19 | import android.widget.RelativeLayout;
20 |
21 | public class RayMenu extends RelativeLayout {
22 | private RayLayout mRayLayout;
23 |
24 | private ImageView mHintView;
25 |
26 | public RayMenu(Context context) {
27 | super(context);
28 | init(context);
29 | }
30 |
31 | public RayMenu(Context context, AttributeSet attrs) {
32 | super(context, attrs);
33 | init(context);
34 | }
35 |
36 | private void init(Context context) {
37 | setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
38 | setClipChildren(false);
39 |
40 | LayoutInflater li = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
41 | li.inflate(R.layout.ray_menu, this);
42 |
43 | mRayLayout = (RayLayout) findViewById(R.id.item_layout);
44 |
45 | final ViewGroup controlLayout = (ViewGroup) findViewById(R.id.control_layout);
46 | controlLayout.setClickable(true);
47 | controlLayout.setOnTouchListener(new OnTouchListener() {
48 |
49 | @Override
50 | public boolean onTouch(View v, MotionEvent event) {
51 | if (event.getAction() == MotionEvent.ACTION_DOWN) {
52 | mHintView.startAnimation(createHintSwitchAnimation(mRayLayout.isExpanded()));
53 | mRayLayout.switchState(true);
54 | }
55 |
56 | return false;
57 | }
58 | });
59 |
60 | mHintView = (ImageView) findViewById(R.id.control_hint);
61 | }
62 |
63 | public void addItem(View item, OnClickListener listener) {
64 | mRayLayout.addView(item);
65 | item.setOnClickListener(getItemClickListener(listener));
66 | }
67 |
68 | private OnClickListener getItemClickListener(final OnClickListener listener) {
69 | return new OnClickListener() {
70 |
71 | @Override
72 | public void onClick(final View viewClicked) {
73 | Animation animation = bindItemAnimation(viewClicked, true, 400);
74 | animation.setAnimationListener(new AnimationListener() {
75 |
76 | @Override
77 | public void onAnimationStart(Animation animation) {
78 |
79 | }
80 |
81 | @Override
82 | public void onAnimationRepeat(Animation animation) {
83 |
84 | }
85 |
86 | @Override
87 | public void onAnimationEnd(Animation animation) {
88 | postDelayed(new Runnable() {
89 |
90 | @Override
91 | public void run() {
92 | itemDidDisappear();
93 | }
94 | }, 0);
95 | }
96 | });
97 |
98 | final int itemCount = mRayLayout.getChildCount();
99 | for (int i = 0; i < itemCount; i++) {
100 | View item = mRayLayout.getChildAt(i);
101 | if (viewClicked != item) {
102 | bindItemAnimation(item, false, 300);
103 | }
104 | }
105 |
106 | mRayLayout.invalidate();
107 | mHintView.startAnimation(createHintSwitchAnimation(true));
108 |
109 | if (listener != null) {
110 | listener.onClick(viewClicked);
111 | }
112 | }
113 | };
114 | }
115 |
116 | private Animation bindItemAnimation(final View child, final boolean isClicked, final long duration) {
117 | Animation animation = createItemDisapperAnimation(duration, isClicked);
118 | child.setAnimation(animation);
119 |
120 | return animation;
121 | }
122 |
123 | private void itemDidDisappear() {
124 | final int itemCount = mRayLayout.getChildCount();
125 | for (int i = 0; i < itemCount; i++) {
126 | View item = mRayLayout.getChildAt(i);
127 | item.clearAnimation();
128 | }
129 |
130 | mRayLayout.switchState(false);
131 | }
132 |
133 | private static Animation createItemDisapperAnimation(final long duration, final boolean isClicked) {
134 | AnimationSet animationSet = new AnimationSet(true);
135 | animationSet.addAnimation(new ScaleAnimation(1.0f, isClicked ? 2.0f : 0.0f, 1.0f, isClicked ? 2.0f : 0.0f,
136 | Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f));
137 | animationSet.addAnimation(new AlphaAnimation(1.0f, 0.0f));
138 |
139 | animationSet.setDuration(duration);
140 | animationSet.setInterpolator(new DecelerateInterpolator());
141 | animationSet.setFillAfter(true);
142 |
143 | return animationSet;
144 | }
145 |
146 | private static Animation createHintSwitchAnimation(final boolean expanded) {
147 | Animation animation = new RotateAnimation(expanded ? 45 : 0, expanded ? 0 : 45, Animation.RELATIVE_TO_SELF,
148 | 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
149 | animation.setStartOffset(0);
150 | animation.setDuration(100);
151 | animation.setInterpolator(new DecelerateInterpolator());
152 | animation.setFillAfter(true);
153 |
154 | return animation;
155 | }
156 |
157 | }
158 |
--------------------------------------------------------------------------------
/TomatoTime/src/com/time/tomato/view/rotatemenu/RotateAndTranslateAnimation.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2012 Capricorn
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.time.tomato.view.rotatemenu;
18 |
19 | import android.view.animation.Animation;
20 | import android.view.animation.Transformation;
21 |
22 | /**
23 | * An animation that controls the position of an object, and make the object
24 | * rotate on its center at the same time.
25 | *
26 | */
27 | public class RotateAndTranslateAnimation extends Animation {
28 | private int mFromXType = ABSOLUTE;
29 |
30 | private int mToXType = ABSOLUTE;
31 |
32 | private int mFromYType = ABSOLUTE;
33 |
34 | private int mToYType = ABSOLUTE;
35 |
36 | private float mFromXValue = 0.0f;
37 |
38 | private float mToXValue = 0.0f;
39 |
40 | private float mFromYValue = 0.0f;
41 |
42 | private float mToYValue = 0.0f;
43 |
44 | private float mFromXDelta;
45 |
46 | private float mToXDelta;
47 |
48 | private float mFromYDelta;
49 |
50 | private float mToYDelta;
51 |
52 | private float mFromDegrees;
53 |
54 | private float mToDegrees;
55 |
56 | private int mPivotXType = ABSOLUTE;
57 |
58 | private int mPivotYType = ABSOLUTE;
59 |
60 | private float mPivotXValue = 0.0f;
61 |
62 | private float mPivotYValue = 0.0f;
63 |
64 | private float mPivotX;
65 |
66 | private float mPivotY;
67 |
68 | /**
69 | * Constructor to use when building a TranslateAnimation from code
70 | *
71 | * @param fromXDelta
72 | * Change in X coordinate to apply at the start of the animation
73 | * @param toXDelta
74 | * Change in X coordinate to apply at the end of the animation
75 | * @param fromYDelta
76 | * Change in Y coordinate to apply at the start of the animation
77 | * @param toYDelta
78 | * Change in Y coordinate to apply at the end of the animation
79 | *
80 | * @param fromDegrees
81 | * Rotation offset to apply at the start of the animation.
82 | * @param toDegrees
83 | * Rotation offset to apply at the end of the animation.
84 | */
85 | public RotateAndTranslateAnimation(float fromXDelta, float toXDelta, float fromYDelta, float toYDelta,
86 | float fromDegrees, float toDegrees) {
87 | mFromXValue = fromXDelta;
88 | mToXValue = toXDelta;
89 | mFromYValue = fromYDelta;
90 | mToYValue = toYDelta;
91 |
92 | mFromXType = ABSOLUTE;
93 | mToXType = ABSOLUTE;
94 | mFromYType = ABSOLUTE;
95 | mToYType = ABSOLUTE;
96 |
97 | mFromDegrees = fromDegrees;
98 | mToDegrees = toDegrees;
99 |
100 | mPivotXValue = 0.5f;
101 | mPivotXType = RELATIVE_TO_SELF;
102 | mPivotYValue = 0.5f;
103 | mPivotYType = RELATIVE_TO_SELF;
104 | }
105 |
106 | @Override
107 | protected void applyTransformation(float interpolatedTime, Transformation t) {
108 | final float degrees = mFromDegrees + ((mToDegrees - mFromDegrees) * interpolatedTime);
109 | if (mPivotX == 0.0f && mPivotY == 0.0f) {
110 | t.getMatrix().setRotate(degrees);
111 | } else {
112 | t.getMatrix().setRotate(degrees, mPivotX, mPivotY);
113 | }
114 |
115 | float dx = mFromXDelta;
116 | float dy = mFromYDelta;
117 | if (mFromXDelta != mToXDelta) {
118 | dx = mFromXDelta + ((mToXDelta - mFromXDelta) * interpolatedTime);
119 | }
120 | if (mFromYDelta != mToYDelta) {
121 | dy = mFromYDelta + ((mToYDelta - mFromYDelta) * interpolatedTime);
122 | }
123 |
124 | t.getMatrix().postTranslate(dx, dy);
125 | }
126 |
127 | @Override
128 | public void initialize(int width, int height, int parentWidth, int parentHeight) {
129 | super.initialize(width, height, parentWidth, parentHeight);
130 | mFromXDelta = resolveSize(mFromXType, mFromXValue, width, parentWidth);
131 | mToXDelta = resolveSize(mToXType, mToXValue, width, parentWidth);
132 | mFromYDelta = resolveSize(mFromYType, mFromYValue, height, parentHeight);
133 | mToYDelta = resolveSize(mToYType, mToYValue, height, parentHeight);
134 |
135 | mPivotX = resolveSize(mPivotXType, mPivotXValue, width, parentWidth);
136 | mPivotY = resolveSize(mPivotYType, mPivotYValue, height, parentHeight);
137 | }
138 | }
--------------------------------------------------------------------------------
/TomatoTime/src/com/time/tomato/view/smoothprogressbar/ColorsShape.java:
--------------------------------------------------------------------------------
1 | package com.time.tomato.view.smoothprogressbar;
2 |
3 | import android.graphics.Canvas;
4 | import android.graphics.Paint;
5 | import android.graphics.drawable.shapes.Shape;
6 |
7 | /**
8 | * Created by castorflex on 3/5/14.
9 | */
10 | public class ColorsShape extends Shape {
11 |
12 | private float mStrokeWidth;
13 | private int[] mColors;
14 |
15 | public ColorsShape(float strokeWidth, int[] colors) {
16 | mStrokeWidth = strokeWidth;
17 | mColors = colors;
18 | }
19 |
20 | public float getStrokeWidth() {
21 | return mStrokeWidth;
22 | }
23 |
24 | public void setStrokeWidth(float strokeWidth) {
25 | mStrokeWidth = strokeWidth;
26 | }
27 |
28 | public int[] getColors() {
29 | return mColors;
30 | }
31 |
32 | public void setColors(int[] colors) {
33 | mColors = colors;
34 | }
35 |
36 | @Override
37 | public void draw(Canvas canvas, Paint paint) {
38 | float ratio = 1f / mColors.length;
39 | int i = 0;
40 | paint.setStrokeWidth(mStrokeWidth);
41 | for (int color : mColors) {
42 | paint.setColor(color);
43 | canvas.drawLine(i * ratio * getWidth(), getHeight() / 2, ++i * ratio * getWidth(), getHeight() / 2, paint);
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/TomatoTime/src/com/time/tomato/view/smoothprogressbar/SmoothProgressBar.java:
--------------------------------------------------------------------------------
1 | package com.time.tomato.view.smoothprogressbar;
2 |
3 |
4 | import com.time.tomato.R;
5 |
6 | import android.content.Context;
7 | import android.content.res.Resources;
8 | import android.content.res.TypedArray;
9 | import android.graphics.Canvas;
10 | import android.graphics.drawable.Drawable;
11 | import android.util.AttributeSet;
12 | import android.view.animation.AccelerateDecelerateInterpolator;
13 | import android.view.animation.AccelerateInterpolator;
14 | import android.view.animation.DecelerateInterpolator;
15 | import android.view.animation.Interpolator;
16 | import android.view.animation.LinearInterpolator;
17 | import android.widget.ProgressBar;
18 |
19 | /**
20 | * Created by castorflex on 11/10/13.
21 | */
22 | public class SmoothProgressBar extends ProgressBar {
23 |
24 | private static final int INTERPOLATOR_ACCELERATE = 0;
25 | private static final int INTERPOLATOR_LINEAR = 1;
26 | private static final int INTERPOLATOR_ACCELERATEDECELERATE = 2;
27 | private static final int INTERPOLATOR_DECELERATE = 3;
28 |
29 | public SmoothProgressBar(Context context) {
30 | this(context, null);
31 | }
32 |
33 | public SmoothProgressBar(Context context, AttributeSet attrs) {
34 | this(context, attrs, R.attr.spbStyle);
35 | }
36 |
37 | public SmoothProgressBar(Context context, AttributeSet attrs, int defStyle) {
38 | super(context, attrs, defStyle);
39 |
40 | Resources res = context.getResources();
41 | TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.SmoothProgressBar, defStyle, 0);
42 |
43 |
44 | final int color = a.getColor(R.styleable.SmoothProgressBar_spb_color, res.getColor(R.color.spb_default_color));
45 | final int sectionsCount = a.getInteger(R.styleable.SmoothProgressBar_spb_sections_count, res.getInteger(R.integer.spb_default_sections_count));
46 | final int separatorLength = a.getDimensionPixelSize(R.styleable.SmoothProgressBar_spb_stroke_separator_length, res.getDimensionPixelSize(R.dimen.spb_default_stroke_separator_length));
47 | final float strokeWidth = a.getDimension(R.styleable.SmoothProgressBar_spb_stroke_width, res.getDimension(R.dimen.spb_default_stroke_width));
48 | final float speed = a.getFloat(R.styleable.SmoothProgressBar_spb_speed, Float.parseFloat(res.getString(R.string.spb_default_speed)));
49 | final float speedProgressiveStart = a.getFloat(R.styleable.SmoothProgressBar_spb_progressiveStart_speed, speed);
50 | final float speedProgressiveStop = a.getFloat(R.styleable.SmoothProgressBar_spb_progressiveStop_speed, speed);
51 | final int iInterpolator = a.getInteger(R.styleable.SmoothProgressBar_spb_interpolator, -1);
52 | final boolean reversed = a.getBoolean(R.styleable.SmoothProgressBar_spb_reversed, res.getBoolean(R.bool.spb_default_reversed));
53 | final boolean mirrorMode = a.getBoolean(R.styleable.SmoothProgressBar_spb_mirror_mode, res.getBoolean(R.bool.spb_default_mirror_mode));
54 | final int colorsId = a.getResourceId(R.styleable.SmoothProgressBar_spb_colors, 0);
55 | final boolean progressiveStartActivated = a.getBoolean(R.styleable.SmoothProgressBar_spb_progressiveStart_activated, res.getBoolean(R.bool.spb_default_progressiveStart_activated));
56 | final Drawable backgroundDrawable = a.getDrawable(R.styleable.SmoothProgressBar_spb_background);
57 | final boolean generateBackgroundWithColors = a.getBoolean(R.styleable.SmoothProgressBar_spb_generate_background_with_colors, false);
58 | a.recycle();
59 |
60 | //interpolator
61 | Interpolator interpolator = null;
62 | if (iInterpolator == -1) {
63 | interpolator = getInterpolator();
64 | }
65 | if (interpolator == null) {
66 | switch (iInterpolator) {
67 | case INTERPOLATOR_ACCELERATEDECELERATE:
68 | interpolator = new AccelerateDecelerateInterpolator();
69 | break;
70 | case INTERPOLATOR_DECELERATE:
71 | interpolator = new DecelerateInterpolator();
72 | break;
73 | case INTERPOLATOR_LINEAR:
74 | interpolator = new LinearInterpolator();
75 | break;
76 | case INTERPOLATOR_ACCELERATE:
77 | default:
78 | interpolator = new AccelerateInterpolator();
79 | }
80 | }
81 |
82 | int[] colors = null;
83 | //colors
84 | if (colorsId != 0) {
85 | colors = res.getIntArray(colorsId);
86 | }
87 |
88 | SmoothProgressDrawable.Builder builder = new SmoothProgressDrawable.Builder(context)
89 | .speed(speed)
90 | .progressiveStartSpeed(speedProgressiveStart)
91 | .progressiveStopSpeed(speedProgressiveStop)
92 | .interpolator(interpolator)
93 | .sectionsCount(sectionsCount)
94 | .separatorLength(separatorLength)
95 | .strokeWidth(strokeWidth)
96 | .reversed(reversed)
97 | .mirrorMode(mirrorMode)
98 | .progressiveStart(progressiveStartActivated);
99 |
100 | if (backgroundDrawable != null) {
101 | builder.backgroundDrawable(backgroundDrawable);
102 | }
103 |
104 | if (generateBackgroundWithColors) {
105 | builder.generateBackgroundUsingColors();
106 | }
107 |
108 | if (colors != null && colors.length > 0)
109 | builder.colors(colors);
110 | else
111 | builder.color(color);
112 |
113 | SmoothProgressDrawable d = builder.build();
114 | setIndeterminateDrawable(d);
115 | }
116 |
117 | public void applyStyle(int styleResId) {
118 | TypedArray a = getContext().obtainStyledAttributes(null, R.styleable.SmoothProgressBar, 0, styleResId);
119 |
120 | if (a.hasValue(R.styleable.SmoothProgressBar_spb_color)) {
121 | setSmoothProgressDrawableColor(a.getColor(R.styleable.SmoothProgressBar_spb_color, 0));
122 | }
123 | if (a.hasValue(R.styleable.SmoothProgressBar_spb_colors)) {
124 | int colorsId = a.getResourceId(R.styleable.SmoothProgressBar_spb_colors, 0);
125 | if (colorsId != 0) {
126 | int[] colors = getResources().getIntArray(colorsId);
127 | if (colors != null && colors.length > 0)
128 | setSmoothProgressDrawableColors(colors);
129 | }
130 | }
131 | if (a.hasValue(R.styleable.SmoothProgressBar_spb_sections_count)) {
132 | setSmoothProgressDrawableSectionsCount(a.getInteger(R.styleable.SmoothProgressBar_spb_sections_count, 0));
133 | }
134 | if (a.hasValue(R.styleable.SmoothProgressBar_spb_stroke_separator_length)) {
135 | setSmoothProgressDrawableSeparatorLength(a.getDimensionPixelSize(R.styleable.SmoothProgressBar_spb_stroke_separator_length, 0));
136 | }
137 | if (a.hasValue(R.styleable.SmoothProgressBar_spb_stroke_width)) {
138 | setSmoothProgressDrawableStrokeWidth(a.getDimension(R.styleable.SmoothProgressBar_spb_stroke_width, 0));
139 | }
140 | if (a.hasValue(R.styleable.SmoothProgressBar_spb_speed)) {
141 | setSmoothProgressDrawableSpeed(a.getFloat(R.styleable.SmoothProgressBar_spb_speed, 0));
142 | }
143 | if (a.hasValue(R.styleable.SmoothProgressBar_spb_progressiveStart_speed)) {
144 | setSmoothProgressDrawableProgressiveStartSpeed(a.getFloat(R.styleable.SmoothProgressBar_spb_progressiveStart_speed, 0));
145 | }
146 | if (a.hasValue(R.styleable.SmoothProgressBar_spb_progressiveStop_speed)) {
147 | setSmoothProgressDrawableProgressiveStopSpeed(a.getFloat(R.styleable.SmoothProgressBar_spb_progressiveStop_speed, 0));
148 | }
149 | if (a.hasValue(R.styleable.SmoothProgressBar_spb_reversed)) {
150 | setSmoothProgressDrawableReversed(a.getBoolean(R.styleable.SmoothProgressBar_spb_reversed, false));
151 | }
152 | if (a.hasValue(R.styleable.SmoothProgressBar_spb_mirror_mode)) {
153 | setSmoothProgressDrawableMirrorMode(a.getBoolean(R.styleable.SmoothProgressBar_spb_mirror_mode, false));
154 | }
155 | if (a.hasValue(R.styleable.SmoothProgressBar_spb_progressiveStart_activated)) {
156 | setProgressiveStartActivated(a.getBoolean(R.styleable.SmoothProgressBar_spb_progressiveStart_activated, false));
157 | }
158 | if (a.hasValue(R.styleable.SmoothProgressBar_spb_background)) {
159 | setSmoothProgressDrawableBackgroundDrawable(a.getDrawable(R.styleable.SmoothProgressBar_spb_background));
160 | }
161 | if (a.hasValue(R.styleable.SmoothProgressBar_spb_generate_background_with_colors)) {
162 | if (a.getBoolean(R.styleable.SmoothProgressBar_spb_generate_background_with_colors, false)) {
163 | setSmoothProgressDrawableBackgroundDrawable(
164 | SmoothProgressBarUtils.generateDrawableWithColors(checkIndeterminateDrawable().getColors(), checkIndeterminateDrawable().getStrokeWidth()));
165 | }
166 | }
167 | if (a.hasValue(R.styleable.SmoothProgressBar_spb_interpolator)) {
168 | int iInterpolator = a.getInteger(R.styleable.SmoothProgressBar_spb_interpolator, -1);
169 | Interpolator interpolator;
170 | switch (iInterpolator) {
171 | case INTERPOLATOR_ACCELERATEDECELERATE:
172 | interpolator = new AccelerateDecelerateInterpolator();
173 | break;
174 | case INTERPOLATOR_DECELERATE:
175 | interpolator = new DecelerateInterpolator();
176 | break;
177 | case INTERPOLATOR_LINEAR:
178 | interpolator = new LinearInterpolator();
179 | break;
180 | case INTERPOLATOR_ACCELERATE:
181 | interpolator = new AccelerateInterpolator();
182 | break;
183 | default:
184 | interpolator = null;
185 | }
186 | if (interpolator != null) {
187 | setInterpolator(interpolator);
188 | }
189 | }
190 | a.recycle();
191 | }
192 |
193 | @Override
194 | protected synchronized void onDraw(Canvas canvas) {
195 | super.onDraw(canvas);
196 | if (isIndeterminate() && getIndeterminateDrawable() instanceof SmoothProgressDrawable &&
197 | !((SmoothProgressDrawable) getIndeterminateDrawable()).isRunning()) {
198 | getIndeterminateDrawable().draw(canvas);
199 | }
200 | }
201 |
202 | private SmoothProgressDrawable checkIndeterminateDrawable() {
203 | Drawable ret = getIndeterminateDrawable();
204 | if (ret == null || !(ret instanceof SmoothProgressDrawable))
205 | throw new RuntimeException("The drawable is not a SmoothProgressDrawable");
206 | return (SmoothProgressDrawable) ret;
207 | }
208 |
209 | @Override
210 | public void setInterpolator(Interpolator interpolator) {
211 | super.setInterpolator(interpolator);
212 | Drawable ret = getIndeterminateDrawable();
213 | if (ret != null && (ret instanceof SmoothProgressDrawable))
214 | ((SmoothProgressDrawable) ret).setInterpolator(interpolator);
215 | }
216 |
217 | public void setSmoothProgressDrawableInterpolator(Interpolator interpolator) {
218 | checkIndeterminateDrawable().setInterpolator(interpolator);
219 | }
220 |
221 | public void setSmoothProgressDrawableColors(int[] colors) {
222 | checkIndeterminateDrawable().setColors(colors);
223 | }
224 |
225 | public void setSmoothProgressDrawableColor(int color) {
226 | checkIndeterminateDrawable().setColor(color);
227 | }
228 |
229 | public void setSmoothProgressDrawableSpeed(float speed) {
230 | checkIndeterminateDrawable().setSpeed(speed);
231 | }
232 |
233 | public void setSmoothProgressDrawableProgressiveStartSpeed(float speed) {
234 | checkIndeterminateDrawable().setProgressiveStartSpeed(speed);
235 | }
236 |
237 | public void setSmoothProgressDrawableProgressiveStopSpeed(float speed) {
238 | checkIndeterminateDrawable().setProgressiveStopSpeed(speed);
239 | }
240 |
241 | public void setSmoothProgressDrawableSectionsCount(int sectionsCount) {
242 | checkIndeterminateDrawable().setSectionsCount(sectionsCount);
243 | }
244 |
245 | public void setSmoothProgressDrawableSeparatorLength(int separatorLength) {
246 | checkIndeterminateDrawable().setSeparatorLength(separatorLength);
247 | }
248 |
249 | public void setSmoothProgressDrawableStrokeWidth(float strokeWidth) {
250 | checkIndeterminateDrawable().setStrokeWidth(strokeWidth);
251 | }
252 |
253 | public void setSmoothProgressDrawableReversed(boolean reversed) {
254 | checkIndeterminateDrawable().setReversed(reversed);
255 | }
256 |
257 | public void setSmoothProgressDrawableMirrorMode(boolean mirrorMode) {
258 | checkIndeterminateDrawable().setMirrorMode(mirrorMode);
259 | }
260 |
261 | public void setProgressiveStartActivated(boolean progressiveStartActivated) {
262 | checkIndeterminateDrawable().setProgressiveStartActivated(progressiveStartActivated);
263 | }
264 |
265 | public void setSmoothProgressDrawableCallbacks(SmoothProgressDrawable.Callbacks listener) {
266 | checkIndeterminateDrawable().setCallbacks(listener);
267 | }
268 |
269 | public void setSmoothProgressDrawableBackgroundDrawable(Drawable drawable) {
270 | checkIndeterminateDrawable().setBackgroundDrawable(drawable);
271 | }
272 |
273 | public void progressiveStart() {
274 | checkIndeterminateDrawable().progressiveStart();
275 | }
276 |
277 | public void progressiveStop() {
278 | checkIndeterminateDrawable().progressiveStop();
279 | }
280 | }
281 |
--------------------------------------------------------------------------------
/TomatoTime/src/com/time/tomato/view/smoothprogressbar/SmoothProgressBarUtils.java:
--------------------------------------------------------------------------------
1 | package com.time.tomato.view.smoothprogressbar;
2 |
3 | import android.graphics.drawable.Drawable;
4 | import android.graphics.drawable.ShapeDrawable;
5 |
6 | /**
7 | * Created by castorflex on 3/5/14.
8 | */
9 | public final class SmoothProgressBarUtils {
10 | private SmoothProgressBarUtils() {
11 | }
12 |
13 | public static Drawable generateDrawableWithColors(int[] colors, float strokeWidth) {
14 | if (colors == null || colors.length == 0) return null;
15 |
16 | return new ShapeDrawable(new ColorsShape(strokeWidth, colors));
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/TomatoTime/src/com/time/tomato/view/wheel/ArrayWheelAdapter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010 Yuri Kanivets
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.time.tomato.view.wheel;
17 |
18 | /**
19 | * The simple Array wheel adapter
20 | *
21 | * @param
22 | * the element type
23 | */
24 | public class ArrayWheelAdapter implements WheelAdapter {
25 |
26 | /** The default items length */
27 | public static final int DEFAULT_LENGTH = -1;
28 |
29 | // items
30 | private T items[];
31 | // length
32 | private int length;
33 |
34 | /**
35 | * Constructor
36 | *
37 | * @param items
38 | * the items
39 | * @param length
40 | * the max items length
41 | */
42 | public ArrayWheelAdapter(T items[], int length) {
43 | this.items = items;
44 | this.length = length;
45 | }
46 |
47 | /**
48 | * Contructor
49 | *
50 | * @param items
51 | * the items
52 | */
53 | public ArrayWheelAdapter(T items[]) {
54 | this(items, DEFAULT_LENGTH);
55 | }
56 |
57 | @Override
58 | public String getItem(int index) {
59 | if (index >= 0 && index < items.length) {
60 | return items[index].toString();
61 | }
62 | return null;
63 | }
64 |
65 | @Override
66 | public int getItemsCount() {
67 | return items.length;
68 | }
69 |
70 | @Override
71 | public int getMaximumLength() {
72 | return length;
73 | }
74 |
75 | }
76 |
--------------------------------------------------------------------------------
/TomatoTime/src/com/time/tomato/view/wheel/NumericWheelAdapter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010 Yuri Kanivets
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.time.tomato.view.wheel;
18 |
19 |
20 | /**
21 | * Numeric Wheel adapter.
22 | */
23 | public class NumericWheelAdapter implements WheelAdapter {
24 |
25 | /** The default min value */
26 | public static final int DEFAULT_MAX_VALUE = 9;
27 |
28 | /** The default max value */
29 | private static final int DEFAULT_MIN_VALUE = 0;
30 |
31 | // Values
32 | private int minValue;
33 | private int maxValue;
34 |
35 | // format
36 | private String format;
37 |
38 | /**
39 | * Default constructor
40 | */
41 | public NumericWheelAdapter() {
42 | this(DEFAULT_MIN_VALUE, DEFAULT_MAX_VALUE);
43 | }
44 |
45 | /**
46 | * Constructor
47 | * @param minValue the wheel min value
48 | * @param maxValue the wheel max value
49 | */
50 | public NumericWheelAdapter(int minValue, int maxValue) {
51 | this(minValue, maxValue, null);
52 | }
53 |
54 | /**
55 | * Constructor
56 | * @param minValue the wheel min value
57 | * @param maxValue the wheel max value
58 | * @param format the format string
59 | */
60 | public NumericWheelAdapter(int minValue, int maxValue, String format) {
61 | this.minValue = minValue;
62 | this.maxValue = maxValue;
63 | this.format = format;
64 | }
65 |
66 | @Override
67 | public String getItem(int index) {
68 | if (index >= 0 && index < getItemsCount()) {
69 | int value = minValue + index;
70 | return format != null ? String.format(format, value) : Integer.toString(value);
71 | }
72 | return null;
73 | }
74 |
75 | @Override
76 | public int getItemsCount() {
77 | return maxValue - minValue + 1;
78 | }
79 |
80 | @Override
81 | public int getMaximumLength() {
82 | int max = Math.max(Math.abs(maxValue), Math.abs(minValue));
83 | int maxLen = Integer.toString(max).length();
84 | if (minValue < 0) {
85 | maxLen++;
86 | }
87 | return maxLen;
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/TomatoTime/src/com/time/tomato/view/wheel/OnWheelChangedListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010 Yuri Kanivets
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.time.tomato.view.wheel;
18 |
19 | /**
20 | * Wheel changed listener interface.
21 | * The currentItemChanged() method is called whenever current wheel positions is changed:
22 | *
New Wheel position is set
23 | * Wheel view is scrolled
24 | */
25 | public interface OnWheelChangedListener {
26 | /**
27 | * Callback method to be invoked when current item changed
28 | * @param wheel the wheel view whose state has changed
29 | * @param oldValue the old value of current item
30 | * @param newValue the new value of current item
31 | */
32 | void onChanged(WheelView wheel, int oldValue, int newValue);
33 | }
34 |
--------------------------------------------------------------------------------
/TomatoTime/src/com/time/tomato/view/wheel/OnWheelScrollListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010 Yuri Kanivets
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.time.tomato.view.wheel;
18 |
19 | /**
20 | * Wheel scrolled listener interface.
21 | */
22 | public interface OnWheelScrollListener {
23 | /**
24 | * Callback method to be invoked when scrolling started.
25 | * @param wheel the wheel view whose state has changed.
26 | */
27 | void onScrollingStarted(WheelView wheel);
28 |
29 | /**
30 | * Callback method to be invoked when scrolling ended.
31 | * @param wheel the wheel view whose state has changed.
32 | */
33 | void onScrollingFinished(WheelView wheel);
34 | }
35 |
--------------------------------------------------------------------------------
/TomatoTime/src/com/time/tomato/view/wheel/WheelAdapter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010 Yuri Kanivets
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.time.tomato.view.wheel;
18 |
19 | public interface WheelAdapter {
20 | /**
21 | * Gets items count
22 | *
23 | * @return the count of wheel items
24 | */
25 | public int getItemsCount();
26 |
27 | /**
28 | * Gets a wheel item by index.
29 | *
30 | * @param index
31 | * the item index
32 | * @return the wheel item text or null
33 | */
34 | public String getItem(int index);
35 |
36 | /**
37 | * Gets maximum item length. It is used to determine the wheel width. If -1
38 | * is returned there will be used the default wheel width.
39 | *
40 | * @return the maximum item length or -1
41 | */
42 | public int getMaximumLength();
43 | }
44 |
--------------------------------------------------------------------------------