Make android.content.ComponentName implement java.lang.Comparable.
This commit is contained in:
@@ -22658,6 +22658,8 @@
|
|||||||
deprecated="not deprecated"
|
deprecated="not deprecated"
|
||||||
visibility="public"
|
visibility="public"
|
||||||
>
|
>
|
||||||
|
<implements name="java.lang.Comparable">
|
||||||
|
</implements>
|
||||||
<implements name="android.os.Parcelable">
|
<implements name="android.os.Parcelable">
|
||||||
</implements>
|
</implements>
|
||||||
<constructor name="ComponentName"
|
<constructor name="ComponentName"
|
||||||
@@ -22706,6 +22708,19 @@
|
|||||||
<parameter name="in" type="android.os.Parcel">
|
<parameter name="in" type="android.os.Parcel">
|
||||||
</parameter>
|
</parameter>
|
||||||
</constructor>
|
</constructor>
|
||||||
|
<method name="compareTo"
|
||||||
|
return="int"
|
||||||
|
abstract="false"
|
||||||
|
native="false"
|
||||||
|
synchronized="false"
|
||||||
|
static="false"
|
||||||
|
final="false"
|
||||||
|
deprecated="not deprecated"
|
||||||
|
visibility="public"
|
||||||
|
>
|
||||||
|
<parameter name="that" type="android.content.ComponentName">
|
||||||
|
</parameter>
|
||||||
|
</method>
|
||||||
<method name="describeContents"
|
<method name="describeContents"
|
||||||
return="int"
|
return="int"
|
||||||
abstract="false"
|
abstract="false"
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ package android.content;
|
|||||||
|
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
|
import java.lang.Comparable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Identifier for a specific application component
|
* Identifier for a specific application component
|
||||||
@@ -29,7 +30,7 @@ import android.os.Parcelable;
|
|||||||
* name inside of that package.
|
* name inside of that package.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public final class ComponentName implements Parcelable {
|
public final class ComponentName implements Parcelable, Comparable<ComponentName> {
|
||||||
private final String mPackage;
|
private final String mPackage;
|
||||||
private final String mClass;
|
private final String mClass;
|
||||||
|
|
||||||
@@ -196,6 +197,15 @@ public final class ComponentName implements Parcelable {
|
|||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return mPackage.hashCode() + mClass.hashCode();
|
return mPackage.hashCode() + mClass.hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int compareTo(ComponentName that) {
|
||||||
|
int v;
|
||||||
|
v = this.mPackage.compareTo(that.mPackage);
|
||||||
|
if (v != 0) {
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
return this.mClass.compareTo(that.mClass);
|
||||||
|
}
|
||||||
|
|
||||||
public int describeContents() {
|
public int describeContents() {
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user