10 |
--------------------------------------------------------------------------------
/FlipDigitExample/res/values-sw720dp-land/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 | 128dp
8 |
9 |
10 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Android-FlipDigitView
2 | =====================
3 |
4 | The FlipDigitView is simulating an analog flip display (like those for the departure time on the airport). Please open a Github issue, if you think anything is missing or wrong.
5 |
6 | Video: http://youtu.be/d6-M2nN2Gzg
7 |
8 | 
9 |
--------------------------------------------------------------------------------
/FlipDigitLib/res/anim/flip_point_from_middle.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
--------------------------------------------------------------------------------
/FlipDigitLib/res/anim/flip_point_to_middle.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
--------------------------------------------------------------------------------
/FlipDigitLib/res/values-v11/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/FlipDigitExample/res/values-v11/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # built application files
2 | *.apk
3 | *.ap_
4 |
5 | # files for the dex VM
6 | *.dex
7 |
8 | # Java class files
9 | *.class
10 |
11 | # generated files
12 | bin/
13 | gen/
14 |
15 | # Local configuration file (sdk path, etc)
16 | local.properties
17 |
18 | # Eclipse project files
19 | .classpath
20 | .project
21 |
22 | # Proguard folder generated by Eclipse
23 | proguard/
24 |
25 | # Intellij project files
26 | *.iml
27 | *.ipr
28 | *.iws
29 | .idea/
30 |
--------------------------------------------------------------------------------
/FlipDigitLib/res/values-v14/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/FlipDigitExample/res/values-v14/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/FlipDigitLib/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
9 |
10 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/FlipDigitLib/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-18
15 | android.library=true
16 |
--------------------------------------------------------------------------------
/FlipDigitExample/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-18
15 | android.library.reference.1=../FlipDigitLib
16 |
--------------------------------------------------------------------------------
/FlipDigitLib/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
14 |
15 |
16 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/FlipDigitExample/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
14 |
15 |
16 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/FlipDigitLib/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 |
--------------------------------------------------------------------------------
/FlipDigitExample/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 |
--------------------------------------------------------------------------------
/FlipDigitExample/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
10 |
11 |
16 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/FlipDigitExample/src/com/vinayrraj/flipdigitexample/SampleActivity.java:
--------------------------------------------------------------------------------
1 | package com.vinayrraj.flipdigitexample;
2 |
3 | import android.app.Activity;
4 | import android.os.Bundle;
5 | import android.view.View;
6 | import android.view.View.OnClickListener;
7 | import android.widget.EditText;
8 |
9 | import com.vinayrraj.flipdigit.lib.Flipmeter;
10 |
11 | public class SampleActivity extends Activity {
12 |
13 | private final int value = 000000;
14 | private Flipmeter flipMeter = null;
15 |
16 | @Override
17 | protected void onCreate(Bundle savedInstanceState) {
18 | super.onCreate(savedInstanceState);
19 | setContentView(R.layout.activity_sample);
20 |
21 | flipMeter = (Flipmeter) findViewById(R.id.Flipmeter);
22 |
23 | final EditText text = (EditText) findViewById(R.id.edittext);
24 | final View button = findViewById(R.id.button);
25 |
26 | button.setOnClickListener(new OnClickListener() {
27 |
28 | @Override
29 | public void onClick(View arg0) {
30 |
31 | try {
32 | flipMeter.setValue(Integer.parseInt(text.getText().toString().trim()), true);
33 | text.setText("");
34 | } catch (Exception e) {
35 | e.printStackTrace();
36 | }
37 |
38 | }
39 | });
40 |
41 | flipMeter.setValue(value, true);
42 | }
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/FlipDigitLib/res/layout/view_flipmeter_spinner.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
13 |
14 |
20 |
21 |
26 |
27 |
33 |
34 |
--------------------------------------------------------------------------------
/FlipDigitExample/res/layout/activity_sample.xml:
--------------------------------------------------------------------------------
1 |
11 |
12 |
18 |
19 |
26 |
27 |
33 |
34 |
--------------------------------------------------------------------------------
/FlipDigitLib/res/layout/widget_flipmeter.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
17 |
18 |
22 |
23 |
27 |
28 |
32 |
33 |
37 |
38 |
--------------------------------------------------------------------------------
/FlipDigitLib/src/com/vinayrraj/flipdigit/lib/FlipmeterSpinner.java:
--------------------------------------------------------------------------------
1 | package com.vinayrraj.flipdigit.lib;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.widget.RelativeLayout;
8 |
9 | /**
10 | * @author VinayrajSingh
11 | *
12 | */
13 | public class FlipmeterSpinner extends RelativeLayout {
14 |
15 | private Context context;
16 | private View flipMeterSpinner = null;
17 |
18 | private int mCurrentDigit;
19 |
20 | private FlipDigit flipDigit = null;
21 |
22 | /*
23 | * Simple constructor used when creating a view from code.
24 | */
25 | public FlipmeterSpinner(Context context) {
26 | super(context);
27 | this.context = context;
28 | initialize();
29 | }
30 |
31 | /*
32 | * This is called when a view is being constructed from an XML file, supplying attributes that were specified in the
33 | * XML file.
34 | */
35 | public FlipmeterSpinner(Context context, AttributeSet attrs) {
36 | super(context, attrs);
37 | this.context = context;
38 | initialize();
39 | }
40 |
41 | /*
42 | * Perform inflation from XML and apply a class-specific base style. This constructor of View allows subclasses to
43 | * use their own base style when they are inflating.
44 | */
45 | public FlipmeterSpinner(Context context, AttributeSet attrs, int defStyle) {
46 | super(context, attrs, defStyle);
47 | this.context = context;
48 | initialize();
49 | }
50 |
51 | private void inflateLayout() {
52 | LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
53 | flipMeterSpinner = layoutInflater.inflate(R.layout.view_flipmeter_spinner, this);
54 |
55 | }
56 |
57 | public View getFlipmeterSpinner() {
58 | return flipMeterSpinner;
59 | }
60 |
61 | public void setDigit(int animateTo, boolean withAnimation) {
62 | flipDigit.setDigit(animateTo, withAnimation);
63 | }
64 |
65 | /*
66 | * Initialize all of our class members and variables
67 | */
68 | private void initialize() {
69 | inflateLayout();
70 |
71 | flipDigit = new FlipDigit(context, getId(), flipMeterSpinner, null);
72 |
73 | }
74 |
75 | public int getCurrentDigit() {
76 | return mCurrentDigit;
77 | }
78 |
79 | }
80 |
--------------------------------------------------------------------------------
/FlipDigitLib/src/com/vinayrraj/flipdigit/lib/Flipmeter.java:
--------------------------------------------------------------------------------
1 | package com.vinayrraj.flipdigit.lib;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 | import android.view.LayoutInflater;
6 | import android.widget.LinearLayout;
7 |
8 | /**
9 | * @author VinayrajSingh
10 | *
11 | */
12 | public class Flipmeter extends LinearLayout {
13 | private static final int NUM_DIGITS = 6;
14 |
15 | private int mCurrentValue;
16 | private int animationCompleteCounter = 0;
17 |
18 | private FlipmeterSpinner[] mDigitSpinners;
19 |
20 | public Flipmeter(Context context) {
21 | super(context);
22 |
23 | initialize();
24 | }
25 |
26 | public Flipmeter(Context context, AttributeSet attrs) {
27 | super(context, attrs);
28 |
29 | initialize();
30 | }
31 |
32 | private void initialize() {
33 | mDigitSpinners = new FlipmeterSpinner[NUM_DIGITS];
34 |
35 | // Inflate the view from the layout resource.
36 | String infService = Context.LAYOUT_INFLATER_SERVICE;
37 | LayoutInflater li;
38 | li = (LayoutInflater) getContext().getSystemService(infService);
39 | li.inflate(R.layout.widget_flipmeter, this, true);
40 |
41 | mDigitSpinners[0] = (FlipmeterSpinner) findViewById(R.id.widget_flipmeter_spinner_1);
42 | mDigitSpinners[1] = (FlipmeterSpinner) findViewById(R.id.widget_flipmeter_spinner_10);
43 | mDigitSpinners[2] = (FlipmeterSpinner) findViewById(R.id.widget_flipmeter_spinner_100);
44 | mDigitSpinners[3] = (FlipmeterSpinner) findViewById(R.id.widget_flipmeter_spinner_1k);
45 | mDigitSpinners[4] = (FlipmeterSpinner) findViewById(R.id.widget_flipmeter_spinner_10k);
46 | mDigitSpinners[5] = (FlipmeterSpinner) findViewById(R.id.widget_flipmeter_spinner_100k);
47 |
48 | }
49 |
50 | public void setValue(int value, boolean withAnimation) {
51 |
52 | mCurrentValue = value;
53 | int tempValue = value;
54 |
55 | for (int i = 5; i > 0; --i) {
56 | int factor = (int) Math.pow(10, i);
57 |
58 | int digitVal = (int) Math.floor(tempValue / factor);
59 | tempValue -= (digitVal * factor);
60 | mDigitSpinners[i].setDigit(digitVal, withAnimation);
61 | changeAnimationCompleteCounter(withAnimation);
62 | }
63 |
64 | mDigitSpinners[0].setDigit(tempValue, withAnimation);
65 | changeAnimationCompleteCounter(withAnimation);
66 |
67 | }
68 |
69 | private synchronized int changeAnimationCompleteCounter(Boolean increment) {
70 | if (increment == null)
71 | return animationCompleteCounter;
72 | else if (increment)
73 | return ++animationCompleteCounter;
74 | else
75 | return --animationCompleteCounter;
76 | }
77 |
78 | /**
79 | * @return
80 | */
81 | public int getValue() {
82 | return mCurrentValue;
83 | }
84 |
85 | public interface OnValueChangeListener {
86 | abstract void onValueChange(Flipmeter sender, int newValue);
87 | }
88 |
89 | }
90 |
--------------------------------------------------------------------------------
/FlipDigitLib/src/com/vinayrraj/flipdigit/lib/FlipDigit.java:
--------------------------------------------------------------------------------
1 | package com.vinayrraj.flipdigit.lib;
2 |
3 | import android.content.Context;
4 | import android.view.View;
5 | import android.view.animation.Animation;
6 | import android.view.animation.Animation.AnimationListener;
7 | import android.view.animation.AnimationUtils;
8 | import android.widget.ImageView;
9 |
10 | /**
11 | * @author VinayrajSingh
12 | *
13 | */
14 | class FlipDigit implements AnimationListener {
15 |
16 | private ImageView flipImage_BackUpper = null;
17 | private ImageView flipImage_BackLower = null;
18 | private ImageView flipImage_FrontUpper = null;
19 | private ImageView flipImage_FrontLower = null;
20 |
21 | private Context context;
22 | private Animation animation1;
23 | private Animation animation2;
24 | private int id;
25 | private OnAnimationComplete onAnimComplete;
26 |
27 | private int animateTo = 0;
28 | private int animateFrom = 0;
29 |
30 | public interface OnAnimationComplete {
31 | public void onComplete(int id);
32 | }
33 |
34 | public FlipDigit(Context act, int id, View view, OnAnimationComplete onAnimComplete) {
35 | super();
36 | this.context = act;
37 | this.id = id;
38 | this.onAnimComplete = onAnimComplete;
39 |
40 | flipImage_BackUpper = (ImageView) view.findViewById(R.id.FlipMeterSpinner_image_back_upper);
41 | flipImage_BackLower = (ImageView) view.findViewById(R.id.FlipMeterSpinner_image_back_lower);
42 | flipImage_FrontUpper = (ImageView) view.findViewById(R.id.FlipMeterSpinner_image_front_upper);
43 | flipImage_FrontLower = (ImageView) view.findViewById(R.id.FlipMeterSpinner_image_front_lower);
44 |
45 | init();
46 | }
47 |
48 | public void setDigit(int digit, boolean withAnimation) {
49 |
50 | if (digit < 0)
51 | digit = 0;
52 | if (digit > 9)
53 | digit = 9;
54 |
55 | animateTo = digit;
56 |
57 | if (withAnimation)
58 | animateDigit(true);
59 | else
60 | setDigitImageToAll(digit);
61 | }
62 |
63 | private void animateDigit(boolean isUpper) {
64 |
65 | animateFrom = getLastDigit(isUpper);
66 | startAnimation();
67 |
68 | }
69 |
70 | private void init() {
71 |
72 | flipImage_BackUpper.setTag(0);
73 | flipImage_BackLower.setTag(0);
74 | flipImage_FrontUpper.setTag(0);
75 | flipImage_FrontLower.setTag(0);
76 |
77 | animation1 = AnimationUtils.loadAnimation(context, R.anim.flip_point_to_middle);
78 | animation1.setAnimationListener(this);
79 | animation2 = AnimationUtils.loadAnimation(context, R.anim.flip_point_from_middle);
80 | animation2.setAnimationListener(this);
81 |
82 | }
83 |
84 | private void startAnimation() {
85 |
86 | if (animateTo == animateFrom) {
87 | if (onAnimComplete != null)
88 | onAnimComplete.onComplete(id);
89 | } else {
90 | startDigitAnimation(true);
91 | }
92 |
93 | }
94 |
95 | private void startDigitAnimation(boolean isUpper) {
96 |
97 | if (isUpper) {
98 | flipImage_FrontUpper.clearAnimation();
99 | flipImage_FrontUpper.setAnimation(animation1);
100 | flipImage_FrontUpper.startAnimation(animation1);
101 |
102 | } else {
103 | flipImage_FrontLower.clearAnimation();
104 | flipImage_FrontLower.setAnimation(animation2);
105 | flipImage_FrontLower.startAnimation(animation2);
106 |
107 | }
108 | }
109 |
110 | private void incrementFromCode() {
111 | animateFrom++;
112 | if (animateFrom < 0)
113 | animateFrom = 0;
114 |
115 | if (animateFrom > 9)
116 | animateFrom = 9;
117 |
118 | }
119 |
120 | private int getLastDigit(boolean isUpper) {
121 | int digit = 0;
122 | try {
123 | if (isUpper)
124 | digit = (Integer) flipImage_FrontUpper.getTag();
125 | else
126 | digit = (Integer) flipImage_FrontLower.getTag();
127 | } catch (Exception e) {
128 | e.printStackTrace();
129 | }
130 | if (digit > 9)
131 | digit = 0;
132 |
133 | return digit;
134 | }
135 |
136 | private int getDigitToShow() {
137 | if (animateFrom + 1 > 9)
138 | return 0;
139 | else
140 | return animateFrom + 1;
141 | }
142 |
143 | private void setDigitImageToAll(int digit) {
144 | setDigitImage(digit, true, flipImage_BackUpper);
145 | setDigitImage(digit, false, flipImage_BackLower);
146 | setDigitImage(digit, true, flipImage_FrontUpper);
147 | setDigitImage(digit, false, flipImage_FrontLower);
148 |
149 | }
150 |
151 | private void setDigitImage(int digitToShow, boolean isUpper, ImageView image) {
152 | image.setTag(digitToShow);
153 | int resource = 0;
154 | switch (digitToShow) {
155 | case 0:
156 | if (isUpper)
157 | resource = R.drawable.digit_0_upper;
158 | else
159 | resource = R.drawable.digit_0_lower;
160 |
161 | break;
162 |
163 | case 1:
164 | if (isUpper)
165 | resource = R.drawable.digit_1_upper;
166 | else
167 | resource = R.drawable.digit_1_lower;
168 |
169 | break;
170 |
171 | case 2:
172 | if (isUpper)
173 | resource = R.drawable.digit_2_upper;
174 | else
175 | resource = R.drawable.digit_2_lower;
176 |
177 | break;
178 |
179 | case 3:
180 | if (isUpper)
181 | resource = R.drawable.digit_3_upper;
182 | else
183 | resource = R.drawable.digit_3_lower;
184 |
185 | break;
186 |
187 | case 4:
188 | if (isUpper)
189 | resource = R.drawable.digit_4_upper;
190 | else
191 | resource = R.drawable.digit_4_lower;
192 |
193 | break;
194 |
195 | case 5:
196 | if (isUpper)
197 | resource = R.drawable.digit_5_upper;
198 | else
199 | resource = R.drawable.digit_5_lower;
200 |
201 | break;
202 |
203 | case 6:
204 | if (isUpper)
205 | resource = R.drawable.digit_6_upper;
206 | else
207 | resource = R.drawable.digit_6_lower;
208 |
209 | break;
210 |
211 | case 7:
212 | if (isUpper)
213 | resource = R.drawable.digit_7_upper;
214 | else
215 | resource = R.drawable.digit_7_lower;
216 |
217 | break;
218 |
219 | case 8:
220 | if (isUpper)
221 | resource = R.drawable.digit_8_upper;
222 | else
223 | resource = R.drawable.digit_8_lower;
224 |
225 | break;
226 |
227 | case 9:
228 | if (isUpper)
229 | resource = R.drawable.digit_9_upper;
230 | else
231 | resource = R.drawable.digit_9_lower;
232 |
233 | break;
234 |
235 | }
236 |
237 | image.setImageResource(resource);
238 | }
239 |
240 | @Override
241 | public void onAnimationEnd(Animation animation) {
242 | if (animation == animation1) {
243 | flipImage_FrontUpper.setVisibility(View.INVISIBLE);
244 | startDigitAnimation(false);
245 |
246 | } else if (animation == animation2) {
247 |
248 | flipImage_FrontUpper.setVisibility(View.VISIBLE);
249 | setDigitImage(getDigitToShow(), true, flipImage_FrontUpper);
250 | setDigitImage(getDigitToShow(), false, flipImage_BackLower);
251 | incrementFromCode();
252 | animateDigit(false);
253 | }
254 |
255 | }
256 |
257 | @Override
258 | public void onAnimationRepeat(Animation arg0) {
259 |
260 | }
261 |
262 | @Override
263 | public void onAnimationStart(Animation animation) {
264 |
265 | if (animation == animation1) {
266 |
267 | flipImage_FrontLower.setVisibility(View.INVISIBLE);
268 | flipImage_FrontUpper.setVisibility(View.VISIBLE);
269 |
270 | setDigitImage(getDigitToShow(), false, flipImage_FrontLower);
271 | setDigitImage(getDigitToShow(), true, flipImage_BackUpper);
272 |
273 | } else if (animation == animation2) {
274 | flipImage_FrontLower.setVisibility(View.VISIBLE);
275 | }
276 |
277 | }
278 |
279 | }
280 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction, and
10 | distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by the copyright
13 | owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all other entities
16 | that control, are controlled by, or are under common control with that entity.
17 | For the purposes of this definition, "control" means (i) the power, direct or
18 | indirect, to cause the direction or management of such entity, whether by
19 | contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
20 | outstanding shares, or (iii) beneficial ownership of such entity.
21 |
22 | "You" (or "Your") shall mean an individual or Legal Entity exercising
23 | permissions granted by this License.
24 |
25 | "Source" form shall mean the preferred form for making modifications, including
26 | but not limited to software source code, documentation source, and configuration
27 | files.
28 |
29 | "Object" form shall mean any form resulting from mechanical transformation or
30 | translation of a Source form, including but not limited to compiled object code,
31 | generated documentation, and conversions to other media types.
32 |
33 | "Work" shall mean the work of authorship, whether in Source or Object form, made
34 | available under the License, as indicated by a copyright notice that is included
35 | in or attached to the work (an example is provided in the Appendix below).
36 |
37 | "Derivative Works" shall mean any work, whether in Source or Object form, that
38 | is based on (or derived from) the Work and for which the editorial revisions,
39 | annotations, elaborations, or other modifications represent, as a whole, an
40 | original work of authorship. For the purposes of this License, Derivative Works
41 | shall not include works that remain separable from, or merely link (or bind by
42 | name) to the interfaces of, the Work and Derivative Works thereof.
43 |
44 | "Contribution" shall mean any work of authorship, including the original version
45 | of the Work and any modifications or additions to that Work or Derivative Works
46 | thereof, that is intentionally submitted to Licensor for inclusion in the Work
47 | by the copyright owner or by an individual or Legal Entity authorized to submit
48 | on behalf of the copyright owner. For the purposes of this definition,
49 | "submitted" means any form of electronic, verbal, or written communication sent
50 | to the Licensor or its representatives, including but not limited to
51 | communication on electronic mailing lists, source code control systems, and
52 | issue tracking systems that are managed by, or on behalf of, the Licensor for
53 | the purpose of discussing and improving the Work, but excluding communication
54 | that is conspicuously marked or otherwise designated in writing by the copyright
55 | owner as "Not a Contribution."
56 |
57 | "Contributor" shall mean Licensor and any individual or Legal Entity on behalf
58 | of whom a Contribution has been received by Licensor and subsequently
59 | incorporated within the Work.
60 |
61 | 2. Grant of Copyright License.
62 |
63 | Subject to the terms and conditions of this License, each Contributor hereby
64 | grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
65 | irrevocable copyright license to reproduce, prepare Derivative Works of,
66 | publicly display, publicly perform, sublicense, and distribute the Work and such
67 | Derivative Works in Source or Object form.
68 |
69 | 3. Grant of Patent License.
70 |
71 | Subject to the terms and conditions of this License, each Contributor hereby
72 | grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
73 | irrevocable (except as stated in this section) patent license to make, have
74 | made, use, offer to sell, sell, import, and otherwise transfer the Work, where
75 | such license applies only to those patent claims licensable by such Contributor
76 | that are necessarily infringed by their Contribution(s) alone or by combination
77 | of their Contribution(s) with the Work to which such Contribution(s) was
78 | submitted. If You institute patent litigation against any entity (including a
79 | cross-claim or counterclaim in a lawsuit) alleging that the Work or a
80 | Contribution incorporated within the Work constitutes direct or contributory
81 | patent infringement, then any patent licenses granted to You under this License
82 | for that Work shall terminate as of the date such litigation is filed.
83 |
84 | 4. Redistribution.
85 |
86 | You may reproduce and distribute copies of the Work or Derivative Works thereof
87 | in any medium, with or without modifications, and in Source or Object form,
88 | provided that You meet the following conditions:
89 |
90 | You must give any other recipients of the Work or Derivative Works a copy of
91 | this License; and
92 | You must cause any modified files to carry prominent notices stating that You
93 | changed the files; and
94 | You must retain, in the Source form of any Derivative Works that You distribute,
95 | all copyright, patent, trademark, and attribution notices from the Source form
96 | of the Work, excluding those notices that do not pertain to any part of the
97 | Derivative Works; and
98 | If the Work includes a "NOTICE" text file as part of its distribution, then any
99 | Derivative Works that You distribute must include a readable copy of the
100 | attribution notices contained within such NOTICE file, excluding those notices
101 | that do not pertain to any part of the Derivative Works, in at least one of the
102 | following places: within a NOTICE text file distributed as part of the
103 | Derivative Works; within the Source form or documentation, if provided along
104 | with the Derivative Works; or, within a display generated by the Derivative
105 | Works, if and wherever such third-party notices normally appear. The contents of
106 | the NOTICE file are for informational purposes only and do not modify the
107 | License. You may add Your own attribution notices within Derivative Works that
108 | You distribute, alongside or as an addendum to the NOTICE text from the Work,
109 | provided that such additional attribution notices cannot be construed as
110 | modifying the License.
111 | You may add Your own copyright statement to Your modifications and may provide
112 | additional or different license terms and conditions for use, reproduction, or
113 | distribution of Your modifications, or for any such Derivative Works as a whole,
114 | provided Your use, reproduction, and distribution of the Work otherwise complies
115 | with the conditions stated in this License.
116 |
117 | 5. Submission of Contributions.
118 |
119 | Unless You explicitly state otherwise, any Contribution intentionally submitted
120 | for inclusion in the Work by You to the Licensor shall be under the terms and
121 | conditions of this License, without any additional terms or conditions.
122 | Notwithstanding the above, nothing herein shall supersede or modify the terms of
123 | any separate license agreement you may have executed with Licensor regarding
124 | such Contributions.
125 |
126 | 6. Trademarks.
127 |
128 | This License does not grant permission to use the trade names, trademarks,
129 | service marks, or product names of the Licensor, except as required for
130 | reasonable and customary use in describing the origin of the Work and
131 | reproducing the content of the NOTICE file.
132 |
133 | 7. Disclaimer of Warranty.
134 |
135 | Unless required by applicable law or agreed to in writing, Licensor provides the
136 | Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,
137 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
138 | including, without limitation, any warranties or conditions of TITLE,
139 | NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
140 | solely responsible for determining the appropriateness of using or
141 | redistributing the Work and assume any risks associated with Your exercise of
142 | permissions under this License.
143 |
144 | 8. Limitation of Liability.
145 |
146 | In no event and under no legal theory, whether in tort (including negligence),
147 | contract, or otherwise, unless required by applicable law (such as deliberate
148 | and grossly negligent acts) or agreed to in writing, shall any Contributor be
149 | liable to You for damages, including any direct, indirect, special, incidental,
150 | or consequential damages of any character arising as a result of this License or
151 | out of the use or inability to use the Work (including but not limited to
152 | damages for loss of goodwill, work stoppage, computer failure or malfunction, or
153 | any and all other commercial damages or losses), even if such Contributor has
154 | been advised of the possibility of such damages.
155 |
156 | 9. Accepting Warranty or Additional Liability.
157 |
158 | While redistributing the Work or Derivative Works thereof, You may choose to
159 | offer, and charge a fee for, acceptance of support, warranty, indemnity, or
160 | other liability obligations and/or rights consistent with this License. However,
161 | in accepting such obligations, You may act only on Your own behalf and on Your
162 | sole responsibility, not on behalf of any other Contributor, and only if You
163 | agree to indemnify, defend, and hold each Contributor harmless for any liability
164 | incurred by, or claims asserted against, such Contributor by reason of your
165 | accepting any such warranty or additional liability.
166 |
167 | END OF TERMS AND CONDITIONS
168 |
169 | APPENDIX: How to apply the Apache License to your work
170 |
171 | To apply the Apache License to your work, attach the following boilerplate
172 | notice, with the fields enclosed by brackets "[]" replaced with your own
173 | identifying information. (Don't include the brackets!) The text should be
174 | enclosed in the appropriate comment syntax for the file format. We also
175 | recommend that a file or class name and description of purpose be included on
176 | the same "printed page" as the copyright notice for easier identification within
177 | third-party archives.
178 |
179 | Copyright [yyyy] [name of copyright owner]
180 |
181 | Licensed under the Apache License, Version 2.0 (the "License");
182 | you may not use this file except in compliance with the License.
183 | You may obtain a copy of the License at
184 |
185 | http://www.apache.org/licenses/LICENSE-2.0
186 |
187 | Unless required by applicable law or agreed to in writing, software
188 | distributed under the License is distributed on an "AS IS" BASIS,
189 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
190 | See the License for the specific language governing permissions and
191 | limitations under the License.
192 |
--------------------------------------------------------------------------------