I converted the answer to a comment so that the conversation will flow properly.
The reason your Riolu appeared to evolve through affection in Pokemon Amie would be because it also happened to have sufficient happiness to evolve. Pokemon Amie had no bearing on when it evolved.
I will reiterate, in case it was not clear: the five hearts you see in Pokemon Amie are not the happiness used to evolve Pokemon, but instead a separate attribute called affection that does not have any link to happiness. Both Riolu and Cleffa evolve using happiness, not affection from Pokemon Amie like your answer suggests.
I never contested anything you mentioned in your second comment, except that the five hearts are used to evolve Cleffa. The "happiness" attribute that causes Cleffa to evolve is a hidden number that can only be estimated using vague descriptions from in-game characters -- as the original post mentions, the Cleffa has the maximum 255 happiness, which exceeds the requirement for evolution which is 220.
If anything about what I said is unclear, let me know. The links below will further describe both happiness and affection, if you are at all interested: