Add a few helpful APIs.

Change-Id: Ie57aa71eb77a1e0fb058f4eb6f40d4144a6dfce7
This commit is contained in:
Jeff Hamilton
2010-08-09 16:54:05 -05:00
parent 77bdba839b
commit f0cfe3438a
3 changed files with 63 additions and 12 deletions

View File

@@ -61923,6 +61923,21 @@
<parameter name="sqlString" type="java.lang.String">
</parameter>
</method>
<method name="appendSelectionArgs"
return="java.lang.String[]"
abstract="false"
native="false"
synchronized="false"
static="true"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="originalValues" type="java.lang.String[]">
</parameter>
<parameter name="newValues" type="java.lang.String[]">
</parameter>
</method>
<method name="appendValueToSql"
return="void"
abstract="false"
@@ -104574,6 +104589,21 @@
visibility="public"
>
</method>
<method name="getBooleanQueryParameter"
return="boolean"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="key" type="java.lang.String">
</parameter>
<parameter name="defaultValue" type="boolean">
</parameter>
</method>
<method name="getEncodedAuthority"
return="java.lang.String"
abstract="true"
@@ -213236,17 +213266,6 @@
visibility="public"
>
</method>
<method name="getVisibleTitleHeight"
return="int"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
</method>
<method name="getZoomControls"
return="android.view.View"
abstract="false"

View File

@@ -1203,4 +1203,18 @@ public class DatabaseUtils {
}
return STATEMENT_OTHER;
}
/**
* Appends one set of selection args to another. This is useful when adding a selection
* argument to a user provided set.
*/
public static String[] appendSelectionArgs(String[] originalValues, String[] newValues) {
if (originalValues == null || originalValues.length == 0) {
return newValues;
}
String[] result = new String[originalValues.length + newValues.length ];
System.arraycopy(originalValues, 0, result, 0, originalValues.length);
System.arraycopy(newValues, 0, result, originalValues.length, newValues.length);
return result;
}
}

View File

@@ -1568,7 +1568,7 @@ public abstract class Uri implements Parcelable, Comparable<Uri> {
throw new UnsupportedOperationException(NOT_HIERARCHICAL);
}
if (key == null) {
throw new NullPointerException("key");
throw new NullPointerException("key");
}
final String query = getEncodedQuery();
@@ -1608,6 +1608,24 @@ public abstract class Uri implements Parcelable, Comparable<Uri> {
return null;
}
/**
* Searches the query string for the first value with the given key and interprets it
* as a boolean value. "false" and "0" are interpreted as <code>false</code>, everything
* else is interpreted as <code>true</code>.
*
* @param key which will be decoded
* @param defaultValue the default value to return if there is no query parameter for key
* @return the boolean interpretation of the query parameter key
*/
public boolean getBooleanQueryParameter(String key, boolean defaultValue) {
String flag = getQueryParameter(key);
if (flag == null) {
return defaultValue;
}
flag = flag.toLowerCase();
return (!"false".equals(flag) && !"0".equals(flag));
}
/** Identifies a null parcelled Uri. */
private static final int NULL_TYPE_ID = 0;