Authorities said the suspected gunman who opened fire on a crowd during a Fourth of July parade that killed seven and injured more than 30 people planned the attack for weeks.