Fix the DEFAULT_SORT_ORDER value for media files. Changing this
is OK, because existing app will have the old value compiled in as a literal, and so will continue to (not) work in the same way as before. Add code to media key generator to give a leading ascii \001 the special meaning of "sort first".
This commit is contained in:
@@ -88821,7 +88821,7 @@
|
|||||||
type="java.lang.String"
|
type="java.lang.String"
|
||||||
transient="false"
|
transient="false"
|
||||||
volatile="false"
|
volatile="false"
|
||||||
value=""title""
|
value=""title_key""
|
||||||
static="true"
|
static="true"
|
||||||
final="true"
|
final="true"
|
||||||
deprecated="not deprecated"
|
deprecated="not deprecated"
|
||||||
@@ -88918,7 +88918,7 @@
|
|||||||
type="java.lang.String"
|
type="java.lang.String"
|
||||||
transient="false"
|
transient="false"
|
||||||
volatile="false"
|
volatile="false"
|
||||||
value=""title""
|
value=""title_key""
|
||||||
static="true"
|
static="true"
|
||||||
final="true"
|
final="true"
|
||||||
deprecated="not deprecated"
|
deprecated="not deprecated"
|
||||||
|
|||||||
@@ -104491,7 +104491,7 @@
|
|||||||
type="java.lang.String"
|
type="java.lang.String"
|
||||||
transient="false"
|
transient="false"
|
||||||
volatile="false"
|
volatile="false"
|
||||||
value=""title""
|
value=""title_key""
|
||||||
static="true"
|
static="true"
|
||||||
final="true"
|
final="true"
|
||||||
deprecated="not deprecated"
|
deprecated="not deprecated"
|
||||||
@@ -104588,7 +104588,7 @@
|
|||||||
type="java.lang.String"
|
type="java.lang.String"
|
||||||
transient="false"
|
transient="false"
|
||||||
volatile="false"
|
volatile="false"
|
||||||
value=""title""
|
value=""title_key""
|
||||||
static="true"
|
static="true"
|
||||||
final="true"
|
final="true"
|
||||||
deprecated="not deprecated"
|
deprecated="not deprecated"
|
||||||
|
|||||||
@@ -722,9 +722,15 @@ public final class MediaStore
|
|||||||
*/
|
*/
|
||||||
public static String keyFor(String name) {
|
public static String keyFor(String name) {
|
||||||
if (name != null) {
|
if (name != null) {
|
||||||
|
boolean sortfirst = false;
|
||||||
if (name.equals(android.media.MediaFile.UNKNOWN_STRING)) {
|
if (name.equals(android.media.MediaFile.UNKNOWN_STRING)) {
|
||||||
return "\001";
|
return "\001";
|
||||||
}
|
}
|
||||||
|
// Check if the first character is \001. We use this to
|
||||||
|
// force sorting of certain special files, like the silent ringtone.
|
||||||
|
if (name.startsWith("\001")) {
|
||||||
|
sortfirst = true;
|
||||||
|
}
|
||||||
name = name.trim().toLowerCase();
|
name = name.trim().toLowerCase();
|
||||||
if (name.startsWith("the ")) {
|
if (name.startsWith("the ")) {
|
||||||
name = name.substring(4);
|
name = name.substring(4);
|
||||||
@@ -753,7 +759,11 @@ public final class MediaStore
|
|||||||
b.append('.');
|
b.append('.');
|
||||||
}
|
}
|
||||||
name = b.toString();
|
name = b.toString();
|
||||||
return DatabaseUtils.getCollationKey(name);
|
String key = DatabaseUtils.getCollationKey(name);
|
||||||
|
if (sortfirst) {
|
||||||
|
key = "\001" + key;
|
||||||
|
}
|
||||||
|
return key;
|
||||||
} else {
|
} else {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@@ -800,7 +810,7 @@ public final class MediaStore
|
|||||||
/**
|
/**
|
||||||
* The default sort order for this table
|
* The default sort order for this table
|
||||||
*/
|
*/
|
||||||
public static final String DEFAULT_SORT_ORDER = TITLE;
|
public static final String DEFAULT_SORT_ORDER = TITLE_KEY;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Activity Action: Start SoundRecorder application.
|
* Activity Action: Start SoundRecorder application.
|
||||||
@@ -897,7 +907,7 @@ public final class MediaStore
|
|||||||
/**
|
/**
|
||||||
* The default sort order for this table
|
* The default sort order for this table
|
||||||
*/
|
*/
|
||||||
public static final String DEFAULT_SORT_ORDER = TITLE;
|
public static final String DEFAULT_SORT_ORDER = TITLE_KEY;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The ID of the audio file
|
* The ID of the audio file
|
||||||
|
|||||||
Reference in New Issue
Block a user