multiple power sources - power via usb and rechargeable battery together.

I want the Arduino to work both with usb power and battery.

when connected to usb, device the arduino will work with usb power and also charge the battery.

when the usb device is not connected, it should work with battery alone with and have indicator how much battery charge is left.

how to do that?

best regards

jossie.