Here's a stylesheet approach. Give the "Input" style the option:
CellOpen :> CurrentValue[{TaggingRules, "CellOpen"}]
and then give the notebook a "CellOpen" tagging rule, and a DockedCells
option to toggle the tagging rule. Here is a stylesheet that does this:
SetOptions[
EvaluationNotebook[],
StyleDefinitions -> Notebook[
{
Cell[StyleData[StyleDefinitions->"Default.nb"]],
Cell[StyleData["Notebook"],
DockedCells -> Cell[
BoxData @ RowBox[{
CheckboxBox[Dynamic[CurrentValue[EvaluationNotebook[], {TaggingRules, "CellOpen"}]]],
"\"Show input\""
}],
TextAlignment->Right
],
TaggingRules->{"CellOpen"->True}
],
Cell[StyleData["Input"],
CellOpen :> CurrentValue[{TaggingRules, "CellOpen"}],
CellElementSpacings->{"CellMinHeight"->0,"ClosedCellHeight"->0}
],
Cell[StyleData["DockedCell"],
CellFrameMargins->0,
Background->LightBlue
]
},
StyleDefinitions->"PrivateStylesheetFormatting.nb"
]
]
And, here is an animation of the stylesheet in action:

This approach avoids the need to modify every input cell (which may be time consuming if the notebook has many input cells).
CellOpen->False
for input cells? $\endgroup$