A man of God prayed for God to heal the nation. God said he had a plan: things will get a lot worse before they get better. The man cries "how is that a solution?" God says "trust me." Then the man gets a fresh glimpse of God in his majesty, he says "I trust you, whatever you choose to do."
The story step by step:
Habakkuk the prophet cries out to God because the nation of Israel is corrupt, and God is not answering his prayers. "How long must I call for help, but you do not listen. ... the law is paralyzed and justice never prevails. The wicked hem in the righteous."
God answers that he has a plan -- the Babylonians will rise up and conquer Israel. "I am raising up the Babylonians, that ruthless and impetuous people, who sweep across the whole earth to seize dwelling places not their own."
Habakkuk then asks, "You have chosen them to punish us, but why? Why are you silent when the wicked swallow up those more righteous than themselves." I think Habakkuk is thinking "we're bad, but those Babylonians are worse. Why use them to punish us."
God replies to write down the revelation and hang onto it, you may have to wait a long while but it will come true. Justice will come upon those who do evil. The Babylonians will be judged in turn.
Habakkuk then prays for God to show himself. "I have heard of your fame, renew your deeds in our time." Do again the great things we read about that happened in the past.
God then shows himself to Habakkuk in a vision. "His glory covered the heavens and his praise filled the earth. His splendor was like the sunrise; rays flashed from his hand, where his power was hidden." One part sounds like Armageddon. "You came out to deliver your people, to save your anointed one. You crushed the leader of the land of wickedness, you stripped him from head to foot."
Habakkuk, now having seen God's greatness, responds that whatever God chooses to do is OK. "I will wait patiently for the day of calamity to come on the nation invading us. Though the fig tree does not bud and there are no grapes on the vines, though the olive crop fails and the fields produce no food, though there are no sheep in the pen and no cattle in the stalls, yet I will rejoice in the LORD, I will be joyful in God my Savior."
Those last words, to rejoice even if everything goes wrong, are sometimes quoted in isolation, as a challenge to be thankful even in hardship. While that is a good principle, I think it short-circuits the point of the story. The point is Habakkuk sought God, and when he saw God, when he understood who God was, he was able to be content even when everything goes wrong. We should seek the same kind of knowledge and experience of God, so that God produces in us the same kind of faith Habakkuk had.