Bug 1001129 - Autoselect an item in icon grid inputs. r=mfinkle

This commit is contained in:
Wes Johnston 2014-05-12 10:18:54 -07:00
parent 46ee08f495
commit be6e94a4ab
2 changed files with 4 additions and 2 deletions

View File

@ -38,7 +38,7 @@ public class IconGridInput extends PromptInput implements OnItemClickListener {
private static int mColumnWidth = -1; // The maximum width of columns
private static int mMaxColumns = -1; // The maximum number of columns to show
private static int mIconSize = -1; // Size of icons in the grid
private int mSelected = -1; // Current selection
private int mSelected = 0; // Current selection, default to first item
private JSONArray mArray;
public IconGridInput(JSONObject obj) {
@ -76,7 +76,6 @@ public class IconGridInput extends PromptInput implements OnItemClickListener {
items.add(item);
if (item.selected) {
mSelected = i;
view.setSelection(i);
}
}
@ -85,6 +84,8 @@ public class IconGridInput extends PromptInput implements OnItemClickListener {
mAdapter = new IconGridAdapter(context, -1, items);
view.setAdapter(mAdapter);
view.setItemChecked(mSelected, true);
mView = view;
return mView;
}

View File

@ -134,6 +134,7 @@ HelperAppLauncherDialog.prototype = {
name: bundle.GetStringFromName("helperapps.saveToDisk"),
packageName: "org.mozilla.gecko.Download",
iconUri: "drawable://icon",
selected: true, // Default to download for all files
launch: function() {
// Reset the preferredAction here.
aLauncher.MIMEInfo.preferredAction = Ci.nsIMIMEInfo.saveToDisk;