What determines if a battery is charging or discharging in a circuit?
The direction of current through the battery determines whether it is charging or discharging.
The battery is trying to push current in a particular direction. If the current flows in that direction, the battery is discharging. If the current flows in the other direction, the battery is charging.
It is a little bit like a spring or a clockwork toy. When you have a spring, it tries to push in a particular direction (longer or shorter). If the spring moves in that direction, then it's discharging. If you push the spring in the opposite direction, it's charging.
What determines the direction of current? You'll have to solve the circuit to find that out. In general, since the battery is connected in parallel to the charger, the battery charges if the charger is trying to output a voltage which is greater than the battery voltage.