aboutsummaryrefslogtreecommitdiffstats
path: root/src/org/cyanogenmod/wallpapers/photophase/model
diff options
context:
space:
mode:
authorJorge Ruesga <jorge@ruesga.com>2013-11-02 02:20:56 +0100
committerJorge Ruesga <jorge@ruesga.com>2013-11-02 02:20:56 +0100
commit4effddfe30fd045834232f6bb66070edf079578d (patch)
tree2e57f74d55685891a49b02ec069c118cf5b15110 /src/org/cyanogenmod/wallpapers/photophase/model
parentca2f0060cc367ac8174a27a3124cd0124e49c627 (diff)
downloadandroid_packages_wallpapers_PhotoPhase-4effddfe30fd045834232f6bb66070edf079578d.tar.gz
android_packages_wallpapers_PhotoPhase-4effddfe30fd045834232f6bb66070edf079578d.tar.bz2
android_packages_wallpapers_PhotoPhase-4effddfe30fd045834232f6bb66070edf079578d.zip
Multiples fixes
- Fully rewrite the album selection preference - Fix multiple style - Fix lints - Resources cleanup Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
Diffstat (limited to 'src/org/cyanogenmod/wallpapers/photophase/model')
-rw-r--r--src/org/cyanogenmod/wallpapers/photophase/model/Album.java23
-rw-r--r--src/org/cyanogenmod/wallpapers/photophase/model/Picture.java64
2 files changed, 82 insertions, 5 deletions
diff --git a/src/org/cyanogenmod/wallpapers/photophase/model/Album.java b/src/org/cyanogenmod/wallpapers/photophase/model/Album.java
index 83f067d..0c1c2a2 100644
--- a/src/org/cyanogenmod/wallpapers/photophase/model/Album.java
+++ b/src/org/cyanogenmod/wallpapers/photophase/model/Album.java
@@ -24,16 +24,20 @@ import java.util.List;
/**
* A class that represents an album
*/
-public class Album implements Comparable<Album>, Cloneable {
+public class Album implements Comparable<Album>, Cloneable {
private Drawable mIcon;
private String mPath;
private String mName;
private String mDate;
private boolean mSelected;
- private List<String> mItems;
+ private List<Picture> mItems;
+ // We have this array for performance access. Do not forget to sync with Picture#selected
private List<String> mSelectedItems;
+ // Ui properties
+ private boolean mDisplayed = false;
+
public Drawable getIcon() {
return mIcon;
}
@@ -74,11 +78,11 @@ public class Album implements Comparable<Album>, Cloneable {
this.mSelected = selected;
}
- public List<String> getItems() {
+ public List<Picture> getItems() {
return mItems;
}
- public void setItems(List<String> items) {
+ public void setItems(List<Picture> items) {
this.mItems = items;
}
@@ -90,6 +94,14 @@ public class Album implements Comparable<Album>, Cloneable {
this.mSelectedItems = selectedItems;
}
+ public boolean isDisplayed() {
+ return mDisplayed;
+ }
+
+ public void setDisplayed(boolean mDisplayed) {
+ this.mDisplayed = mDisplayed;
+ }
+
@Override
public int compareTo(Album another) {
return mPath.compareTo(another.mPath);
@@ -102,9 +114,10 @@ public class Album implements Comparable<Album>, Cloneable {
album.mPath = mPath;
album.mName = mName;
album.mDate = mDate;
- album.mItems = new ArrayList<String>(mItems);
+ album.mItems = new ArrayList<Picture>(mItems);
album.mSelectedItems = new ArrayList<String>(mSelectedItems);
album.mSelected = mSelected;
+ album.mDisplayed = mDisplayed;
return album;
}
}
diff --git a/src/org/cyanogenmod/wallpapers/photophase/model/Picture.java b/src/org/cyanogenmod/wallpapers/photophase/model/Picture.java
new file mode 100644
index 0000000..76b1bb6
--- /dev/null
+++ b/src/org/cyanogenmod/wallpapers/photophase/model/Picture.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2013 The CyanogenMod 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 org.cyanogenmod.wallpapers.photophase.model;
+
+import java.io.File;
+
+/**
+ * A class that represents a picture
+ */
+public class Picture implements Comparable<Picture>, Cloneable {
+
+ private String mPath;
+ private boolean mSelected;
+
+ public Picture(String path, boolean selected) {
+ super();
+ this.mPath = path;
+ this.mSelected = selected;
+ }
+
+ public String getPath() {
+ return mPath;
+ }
+
+ public void setPath(String path) {
+ this.mPath = path;
+ }
+
+ public boolean isSelected() {
+ return mSelected;
+ }
+
+ public void setSelected(boolean selected) {
+ this.mSelected = selected;
+ }
+
+ public String getName() {
+ return new File(mPath).getName();
+ }
+
+ @Override
+ public int compareTo(Picture another) {
+ return mPath.compareTo(another.mPath);
+ }
+
+ @Override
+ public Object clone() {
+ return new Picture(mPath, mSelected);
+ }
+}