summaryrefslogtreecommitdiff
path: root/src/plugins/android.codeutils/templates/activity_samples/endless_list_pull_to_refresh/ListElement.java
diff options
context:
space:
mode:
authorEric Cloninger <dcp874@motorola.com>2012-08-15 11:57:06 -0500
committerEric Cloninger <dcp874@motorola.com>2012-08-17 09:33:37 -0500
commitb613ddc1cf740750ab9dc20f1b051a2f04f5dbef (patch)
tree10b2a4be4590c35e0f8027f3773fbcc61e05fd08 /src/plugins/android.codeutils/templates/activity_samples/endless_list_pull_to_refresh/ListElement.java
parent1fc2254217371e1bae3c9373d2474b1053c869f9 (diff)
downloadmotodev-b613ddc1cf740750ab9dc20f1b051a2f04f5dbef.tar.gz
Initial contribution of Motorola MOTODEV tools code
This patch contains Eclipse plugins that complement the Android Development Tools (ADT). The patch also contains the MOTODEV App Validator, a static analysis tool for Android apps. App Validator is built as an Eclipse RCP that runs on the command line, but also has an Eclipse IDE integration. To build the plugins, you will need Eclipse 3.7 or 4.2 with the PDE installed with Java 6. An ant build file will come in a separate patch. Change-Id: I8af2e5980eb24ed1c206bb2ddb9b3d733b9eff56 Signed-off-by: Eric Cloninger <dcp874@motorola.com>
Diffstat (limited to 'src/plugins/android.codeutils/templates/activity_samples/endless_list_pull_to_refresh/ListElement.java')
-rw-r--r--src/plugins/android.codeutils/templates/activity_samples/endless_list_pull_to_refresh/ListElement.java97
1 files changed, 97 insertions, 0 deletions
diff --git a/src/plugins/android.codeutils/templates/activity_samples/endless_list_pull_to_refresh/ListElement.java b/src/plugins/android.codeutils/templates/activity_samples/endless_list_pull_to_refresh/ListElement.java
new file mode 100644
index 0000000..8030fb2
--- /dev/null
+++ b/src/plugins/android.codeutils/templates/activity_samples/endless_list_pull_to_refresh/ListElement.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package #package_name#;
+
+import java.io.Serializable;
+
+/**
+ * Element which belongs to each row of the List of this view.
+ */
+class ListElement implements Serializable {
+
+ private static final long serialVersionUID = -1494059051539426231L;
+ String text;
+ Integer imageId;
+
+ /**
+ * Always create the object with a text and an image.
+ *
+ * @param text
+ * Text of the {@link ListElement}.
+ * @param imageId
+ * Image identifier of the {@link ListElement}.
+ */
+ public ListElement(String text, Integer imageId) {
+ this.text = text;
+ this.imageId = imageId;
+ }
+
+ /**
+ * Get the Text.
+ *
+ * @return Return the Text.
+ */
+ public String getText() {
+ return text;
+ }
+
+ /**
+ * Set the Text.
+ *
+ * @param text
+ * Text to be set.
+ */
+ public void setText(String text) {
+ this.text = text;
+ }
+
+ /**
+ * Get the Image identifier.
+ *
+ * @return Return the Image identifier.
+ */
+ public Integer getImageId() {
+ return imageId;
+ }
+
+ /**
+ * Set the Image identifier.
+ *
+ * @param imageId
+ * Image Identifier to be set.
+ */
+ public void setImageId(Integer imageId) {
+ this.imageId = imageId;
+ }
+
+ /**
+ * Here we consider two {@link ListElement}s to be equal when they have
+ * the same text field.
+ */
+ @Override
+ public boolean equals(Object element) {
+ return element != null && element instanceof ListElement
+ && this.text != null
+ && ((ListElement) element).text != null
+ && ((ListElement) element).text.equals(text);
+ }
+
+ @Override
+ public int hashCode() {
+ return text != null ? text.length() * 3 : 4;
+ }
+} \ No newline at end of file