front: Sort gallery items by the same name used for display.

This also fixes the badly-implemented comparator that sometimes throws
   java.lang.IllegalArgumentException:
       Comparison method violates its general contract!