Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(668)

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/photo_picker/PickerBitmap.java

Issue 2758313002: Implement the new Photo picker, part two. (Closed)
Patch Set: Address Ted's comments (and sync to latest) Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 package org.chromium.chrome.browser.photo_picker;
6
7 import android.support.annotation.IntDef;
8
9 import org.chromium.base.ApiCompatibilityUtils;
10 import org.chromium.base.annotations.SuppressFBWarnings;
11
12 import java.lang.annotation.Retention;
13 import java.lang.annotation.RetentionPolicy;
14
15 /**
16 * A class to keep track of the meta data associated with a an image in the phot o picker.
17 */
18 @SuppressFBWarnings("EQ_COMPARETO_USE_OBJECT_EQUALS")
19 public class PickerBitmap implements Comparable<PickerBitmap> {
20 // The possible types of tiles involved in the viewer.
21 @IntDef({PICTURE, CAMERA, GALLERY})
22 @Retention(RetentionPolicy.SOURCE)
23 public @interface TileTypes {}
24 public static final int PICTURE = 0;
25 public static final int CAMERA = 1;
26 public static final int GALLERY = 2;
27
28 // The file path to the bitmap to show.
29 private String mFilePath;
30
31 // When the bitmap was last modified on disk.
32 private long mLastModified;
33
34 // The type of tile involved.
35 @TileTypes
36 private int mType;
37
38 /**
39 * The PickerBitmap constructor.
40 * @param filePath The file path to the bitmap to show.
41 * @param lastModified When the bitmap was last modified on disk.
42 * @param type The type of tile involved.
43 */
44 public PickerBitmap(String filePath, long lastModified, @TileTypes int type) {
45 mFilePath = filePath;
46 mLastModified = lastModified;
47 mType = type;
48 }
49
50 /**
51 * Accessor for the filepath.
52 * @return The file path for this PickerBitmap object.
53 */
54 public String getFilePath() {
55 return mFilePath;
56 }
57
58 /**
59 * Accessor for the tile type.
60 * @return The type of tile involved for this bitmap object.
61 */
62 @TileTypes
63 public int type() {
64 return mType;
65 }
66
67 /**
68 * A comparison function for PickerBitmaps (results in a last-modified first sort).
69 * @param other The PickerBitmap to compare it to.
70 * @return 0, 1, or -1, depending on which is bigger.
71 */
72 @Override
73 public int compareTo(PickerBitmap other) {
74 return ApiCompatibilityUtils.compareLong(other.mLastModified, mLastModif ied);
75 }
76 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698