~ubuntu-branches/ubuntu/utopic/gpsprune/utopic

« back to all changes in this revision

Viewing changes to tim/prune/function/RearrangePhotosFunction.java

  • Committer: Package Import Robot
  • Author(s): Mònica Ramírez Arceda
  • Date: 2013-05-15 10:26:51 UTC
  • mfrom: (1.1.9)
  • Revision ID: package-import@ubuntu.com-20130515102651-130bcw88wox3u0q0
Tags: 15-1
* New upstream version
  - "nautical mile" is added to unit selector (Closes: #639503)
* debian/control:
  - Add myself as an uploader
  - Standards-Version bump to 3.9.4, no changes needed
* debian/copyright:
  - Add required Copyright field to tim/prune/function/srtm/gen/ files
  - Update years
* debian/scripts/gpsprune:
  - Fix sed commands, when there is no host/port, proxyhost/proxyport
    variables must be empty.
    Thanks to Simó Albert i Beltran <sim6@probeta.net> and to
    <debian@activityworkshop.net> for the patch!

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
import java.awt.event.ActionEvent;
6
6
import java.awt.event.ActionListener;
7
7
import java.util.Arrays;
8
 
import java.util.Comparator;
9
8
 
10
9
import javax.swing.BoxLayout;
11
10
import javax.swing.ButtonGroup;
193
192
         */
194
193
        private static void sortPhotos(DataPoint[] inPhotos, boolean inSortByFile)
195
194
        {
196
 
                Comparator<DataPoint> comparator = null;
197
 
                if (inSortByFile)
198
 
                {
199
 
                        // sort by filename
200
 
                        comparator = new Comparator<DataPoint>() {
201
 
                                public int compare(DataPoint inP1, DataPoint inP2) {
202
 
                                        if (inP2 == null) return -1; // all nulls at end
203
 
                                        if (inP1 == null) return 1;
204
 
                                        if (inP1.getPhoto().getFile() == null || inP2.getPhoto().getFile() == null)
205
 
                                                return inP1.getPhoto().getName().compareTo(inP2.getPhoto().getName());
206
 
                                        return inP1.getPhoto().getFile().compareTo(inP2.getPhoto().getFile());
207
 
                                }
208
 
                        };
209
 
                }
210
 
                else
211
 
                {
212
 
                        // sort by photo timestamp
213
 
                        comparator = new Comparator<DataPoint>() {
214
 
                                public int compare(DataPoint inP1, DataPoint inP2) {
215
 
                                        if (inP2 == null) return -1; // all nulls at end
216
 
                                        if (inP1 == null) return 1;
217
 
                                        long secDiff = inP1.getPhoto().getTimestamp().getSecondsSince(inP2.getPhoto().getTimestamp());
218
 
                                        return (secDiff<0?-1:(secDiff==0?0:1));
219
 
                                }
220
 
                        };
221
 
                }
222
 
                Arrays.sort(inPhotos, comparator);
 
195
                PhotoComparer comparer = new PhotoComparer(inSortByFile ? PhotoComparer.SortMode.SORTBY_NAME : PhotoComparer.SortMode.SORTBY_TIME);
 
196
                Arrays.sort(inPhotos, comparer);
223
197
        }
224
198
}