Unifying toString() method for various ItemInfo subclasses

Change-Id: I7cde42f0df412e2877fb93c77e74ee56a25edead
This commit is contained in:
Sunny Goyal
2016-09-01 10:55:20 -07:00
parent 35908f9e67
commit 1edab71d01
9 changed files with 29 additions and 46 deletions
+2 -5
View File
@@ -125,11 +125,8 @@ public class AppInfo extends ItemInfo {
}
@Override
public String toString() {
return "ApplicationInfo(title=" + title + " id=" + this.id
+ " type=" + this.itemType + " container=" + this.container
+ " screen=" + screenId + " cellX=" + cellX + " cellY=" + cellY
+ " spanX=" + spanX + " spanY=" + spanY + " user=" + user + ")";
protected String dumpProperties() {
return super.dumpProperties() + " componentName=" + componentName;
}
/**
@@ -126,14 +126,6 @@ public class FolderInfo extends ItemInfo {
public void onItemsChanged(boolean animate);
}
@Override
public String toString() {
return "FolderInfo(id=" + this.id + " type=" + this.itemType
+ " container=" + this.container + " screen=" + screenId
+ " cellX=" + cellX + " cellY=" + cellY + " spanX=" + spanX
+ " spanY=" + spanY + ")";
}
public boolean hasOption(int optionFlag) {
return (options & optionFlag) != 0;
}
+18 -4
View File
@@ -189,10 +189,24 @@ public class ItemInfo {
}
@Override
public String toString() {
return "Item(id=" + this.id + " type=" + this.itemType + " container=" + this.container
+ " screen=" + screenId + " cellX=" + cellX + " cellY=" + cellY + " spanX=" + spanX
+ " spanY=" + spanY + " user=" + user + ")";
public final String toString() {
return getClass().getSimpleName() + "(" + dumpProperties() + ")";
}
protected String dumpProperties() {
return "id=" + id
+ " type=" + itemType
+ " container=" + container
+ " screen=" + screenId
+ " cellX=" + cellX
+ " cellY=" + cellY
+ " spanX=" + spanX
+ " spanY=" + spanY
+ " minSpanX=" + minSpanX
+ " minSpanY=" + minSpanY
+ " rank=" + rank
+ " user=" + user
+ " title=" + title;
}
/**
@@ -143,8 +143,8 @@ public class LauncherAppWidgetInfo extends ItemInfo {
}
@Override
public String toString() {
return "AppWidget(id=" + Integer.toString(appWidgetId) + ")";
protected String dumpProperties() {
return super.dumpProperties() + " appWidgetId=" + appWidgetId;
}
public final boolean isWidgetIdAllocated() {
@@ -29,4 +29,9 @@ public class PendingAddItemInfo extends ItemInfo {
* The component that will be created.
*/
public ComponentName componentName;
@Override
protected String dumpProperties() {
return super.dumpProperties() + " componentName=" + componentName;
}
}
@@ -270,14 +270,6 @@ public class ShortcutInfo extends ItemInfo {
}
}
@Override
public String toString() {
return "ShortcutInfo(title=" + title + "intent=" + intent + "id=" + this.id
+ " type=" + this.itemType + " container=" + this.container + " screen=" + screenId
+ " cellX=" + cellX + " cellY=" + cellY + " spanX=" + spanX + " spanY=" + spanY
+ " user=" + user + ")";
}
public ComponentName getTargetComponent() {
return promisedIntent != null ? promisedIntent.getComponent() : intent.getComponent();
}
@@ -46,17 +46,12 @@ public class PackageItemInfo extends ItemInfo {
*/
public String titleSectionName;
int flags = 0;
PackageItemInfo(String packageName) {
this.packageName = packageName;
}
@Override
public String toString() {
return "PackageItemInfo(title=" + title + " id=" + this.id
+ " type=" + this.itemType + " container=" + this.container
+ " screen=" + screenId + " cellX=" + cellX + " cellY=" + cellY
+ " spanX=" + spanX + " spanY=" + spanY + " user=" + user + ")";
protected String dumpProperties() {
return super.dumpProperties() + " packageName=" + packageName;
}
}
@@ -35,10 +35,4 @@ public class PendingAddShortcutInfo extends PendingAddItemInfo {
componentName = new ComponentName(activityInfo.packageName, activityInfo.name);
itemType = LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT;
}
@Override
public String toString() {
return String.format("PendingAddShortcutInfo package=%s, name=%s",
activityInfo.packageName, activityInfo.name);
}
}
@@ -59,10 +59,4 @@ public class PendingAddWidgetInfo extends PendingAddItemInfo {
public boolean isCustomWidget() {
return itemType == LauncherSettings.Favorites.ITEM_TYPE_CUSTOM_APPWIDGET;
}
@Override
public String toString() {
return String.format("PendingAddWidgetInfo package=%s, name=%s",
componentName.getPackageName(), componentName.getShortClassName());
}
}